我希望我的描述列表能够自动填充投影仪幻灯片的垂直空间。我找到了解决方案这里,但仅适用于itemize
和enumerate
。
我尝试修改列表中的示例以将其转换为description
列表,它给出了所需的垂直间距效果。但是,水平对齐方式不正确。我看不到完整的描述项,因为它在左侧被截断,如下图所示。
我在下面提供了迄今为止尝试过的代码。老实说,当我看到时我有点迷茫\makeatletter
。
\documentclass{beamer}
\makeatletter
\renewcommand{\description}[1][]{%
\beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
\ifnum \@itemdepth >2\relax\@toodeep\else
\advance\@itemdepth\@ne
\beamer@computepref\@itemdepth% sets \beameritemnestingprefix
\usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
\usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
\list
{\usebeamertemplate{itemize \beameritemnestingprefix item}}
{\def\makelabel##1{%
{%
\hss\llap{{%
\usebeamerfont*{itemize \beameritemnestingprefix item}%
\usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
}%
}%
}
\fi%
\setlength\itemsep{\fill}
\ifnum \@itemdepth >1
\vfill
\fi%
\beamer@cramped%
\raggedright%
\beamer@firstlineitemizeunskip%
}
\def\enditemize{\ifhmode\unskip\fi\endlist%
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body end}
\ifnum \@itemdepth >1
\vfil
\fi%
}
\makeatother
\begin{document}
\begin{frame}{Vertical Spacing}
\begin{description}
\item[description] details
\item[description] vertical spacing is working
\item[description] but descriptions are cut off
\end{description}
\end{frame}
\end{document}
答案1
您可以使用与https://topanswers.xyz/tex?q=832#a2071
\documentclass{beamer}
\makeatletter
\define@key{beamerframe}{s}[true]{% stretch
\beamer@frametopskip=0pt\relax%
\beamer@framebottomskip=0pt\relax%
\beamer@frametopskipautobreak=\beamer@frametopskip\relax%
\beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
}
\makeatother
\begin{document}
\begin{frame}[s]
\frametitle{Vertical Spacing}
\begin{description}
\item[description] details
\item[description] vertical spacing is working
\item[description] but descriptions are cut off
\end{description}
\end{frame}
\end{document}