![自动填充投影仪框架中描述列表的垂直空间](https://linux22.com/image/453499/%E8%87%AA%E5%8A%A8%E5%A1%AB%E5%85%85%E6%8A%95%E5%BD%B1%E4%BB%AA%E6%A1%86%E6%9E%B6%E4%B8%AD%E6%8F%8F%E8%BF%B0%E5%88%97%E8%A1%A8%E7%9A%84%E5%9E%82%E7%9B%B4%E7%A9%BA%E9%97%B4.png)
我希望我的描述列表能够自动填充投影仪幻灯片的垂直空间。我找到了解决方案这里,但仅适用于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}