在以下 LaTeX Beamer MWE 中,为什么项目的间距如此糟糕,为什么可以通过在后面添加百分号来解决这个问题(... subitems)
?
最重要的是:是否有一种可靠而优雅的方法来防止我的演示文稿中出现这种不良间距?
(我知道百分号会以某种方式阻止解析行尾,但即使在之后直接启动子项目化(...subitems)
也不会产生相同的效果。)
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{itemize}
\item A. (requires three sub-items)
\begin{itemize}
\item A.1
\item A.2
\item A.3
\end{itemize}
\item B
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\end{document}
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{itemize}
\item A. (requires three sub-items)%
\begin{itemize}
\item A.1
\item A.2
\item A.3
\end{itemize}
\item B
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\end{document}
答案1
beamer 中 itemize 的定义有缺陷。问题在于它在列表前设置颜色,而颜色命令会插入 whatsits,这会导致空格突然变得重要。beamer 至少应该在颜色前添加 \unskip:
\documentclass{beamer}
\makeatletter
\renewcommand{\itemize}[1][]{%
\ifhmode\unskip\fi %<<< or \unskip \par
\ifblank{#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}% problem
\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%
\beamer@cramped%
\raggedright%
\beamer@firstlineitemizeunskip%
}
\begin{document}
\begin{frame}
\begin{minipage}{0.5\textwidth}
\begin{itemize}
\item A. (requires three sub-items)
\begin{itemize}
\item A.1
\item A.2
\item A.3
\end{itemize}
\item B
\end{itemize}
\end{minipage}
\end{frame}
\end{document}
答案2
谢谢,我找到了不依赖缩进而是依赖输入间隔的另一个原因。;-)
是的,itemize
有beamer
一个小错误,但如果您像下面左栏那样输入,它就变得无关紧要了。
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{itemize}
\item A. (requires three sub-items)
\begin{itemize}
\item A.1
\item A.2
\item A.3
\end{itemize}
\item B
\end{itemize}
\end{column}
\begin{column}{0.5\textwidth}
\begin{itemize}
\item A. (requires three sub-items)
\begin{itemize}
\item A.1
\item A.2
\item A.3
\end{itemize}
\item B
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\end{document}