如何在 beamer 中插入项目条目后添加空格?

如何在 beamer 中插入项目条目后添加空格?

我想在 中创建一个自定义描述环境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}

在此处输入图片描述

相关内容