![如何在 beamer 中插入项目条目后添加空格?](https://linux22.com/image/460333/%E5%A6%82%E4%BD%95%E5%9C%A8%20beamer%20%E4%B8%AD%E6%8F%92%E5%85%A5%E9%A1%B9%E7%9B%AE%E6%9D%A1%E7%9B%AE%E5%90%8E%E6%B7%BB%E5%8A%A0%E7%A9%BA%E6%A0%BC%EF%BC%9F.png)
我想在 中创建一个自定义描述环境beamer
,但是当仅枚举带有描述的标签时,下一个 itemize 环境的条目直接位于原始标签的侧面。我希望它位于其下方
\documentclass[aspectratio=169, xcolor={x11names},t]{beamer}
\usetheme{Dresden}
\defbeamertemplate{description item}{descriptionbasmah}{\hspace{0mm}\insertdescriptionitem\strut}
\makeatletter
\newenvironment{descriptionbasmah}{%
\par%
\begin{minipage}{\linewidth}%
\vspace{0.47em}%
\begin{description}%
\setbeamerfont{description item}{shape=\itshape\fontencoding{T1}\selectfont, series=\mdseries, family*=ptm}
\setbeamercolor{description item}{fg=DarkOrange1}%
\setbeamertemplate{description item}[descriptionbasmah]%
}{%
\end{description}%
\end{minipage}%
\vspace{0.1961em}%
}
\makeatother
\makeatletter
\newcommand{\setHangDescription}{\beamer@descriptionwidth=\dimexpr -\labelsep \relax}
\makeatother
\setHangDescription
\usepackage{blindtext}
\begin{document}
\begin{frame}
\begin{descriptionbasmah}
\item[HabibiAllahYehfadoh] BasmahWantsMeHappy
\begin{itemize}
\item
\end{itemize}
\item[HabibiAllahYehfadoh]
\begin{itemize}
\item
\end{itemize}
\end{descriptionbasmah}
\end{frame}
\end{document}
答案1
您可以通过不将父项留空来确保子项从新行开始,例如插入空格:
\documentclass[aspectratio=169, xcolor={x11names},t]{beamer}
\usetheme{Dresden}
\defbeamertemplate{description item}{descriptionbasmah}{\hspace{0mm}\insertdescriptionitem\strut}
\makeatletter
\newenvironment{descriptionbasmah}{%
\par%
\begin{minipage}{\linewidth}%
\vspace{0.47em}%
\begin{description}%
\setbeamerfont{description item}{shape=\itshape\fontencoding{T1}\selectfont, series=\mdseries, family*=ptm}
\setbeamercolor{description item}{fg=DarkOrange1}%
\setbeamertemplate{description item}[descriptionbasmah]%
}{%
\end{description}%
\end{minipage}%
\vspace{0.1961em}%
}
\makeatother
\makeatletter
\newcommand{\setHangDescription}{\beamer@descriptionwidth=\dimexpr -\labelsep \relax}
\makeatother
\setHangDescription
\usepackage{blindtext}
\begin{document}
\begin{frame}
\begin{descriptionbasmah}
\item[HabibiAllahYehfadoh] BasmahWantsMeHappy
\begin{itemize}
\item
\end{itemize}
\item[HabibiAllahYehfadoh] ~
\begin{itemize}
\item
\end{itemize}
\end{descriptionbasmah}
\end{frame}
\end{document}