下面观察到一个奇怪的机制:
\documentclass{beamer}
\begin{document}
\abovedisplayskip=0ex
\belowdisplayskip=0ex
\frame{\frametitle{Title}
\begin{itemize}
\item text text text text text text text
\begin{equation}
\cos \pi=-1
\end{equation}
text text text text text text text
\begin{itemize}
\item text text text text text text text
\begin{equation}
\cos \pi=-1
\end{equation}
text text text text text text text
\end{itemize}
\end{itemize}}
\end{document}
\abovedisplayskip=0pt
二级列表中的新内容似乎被忽略了itemize
。这似乎与列表中的字体大小有关,但这样有点烦人。
答案1
每个字体大小更改命令都会重置数学显示周围的跳过。第二级itemize
使用\small
,因此您需要更改它;此外\normalsize
,可能还有其他字体大小更改命令。
\documentclass{beamer}
\usepackage{etoolbox}
\appto\normalsize{%
\abovedisplayskip=0pt
\belowdisplayskip=0pt
\abovedisplayshortskip=0pt
\belowdisplayshortskip=0pt
}
\appto\small{%
\abovedisplayskip=0pt
\belowdisplayskip=0pt
\abovedisplayshortskip=0pt
\belowdisplayshortskip=0pt
}
\begin{document}
\begin{frame}
\frametitle{Title}
\begin{itemize}
\item text text text text text text text
\begin{equation}
\cos \pi=-1
\end{equation}
text text text text text text text
\begin{itemize}
\item text text text text text text text
\begin{equation}
\cos \pi=-1
\end{equation}
text text text text text text text
\end{itemize}
\end{itemize}
\end{frame}
\end{document}
您可能只想在选定的幻灯片中执行此操作:
\documentclass{beamer}
\usepackage{etoolbox}
\newcommand{\zerodisplayskips}{%
\abovedisplayskip=0pt
\belowdisplayskip=0pt
\abovedisplayshortskip=0pt
\belowdisplayshortskip=0pt
}
\newcommand{\removedisplayskips}{%
\appto\normalsize{\zerodisplayskips}
\appto\small{\zerodisplayskips}
\zerodisplayskips
}
\begin{document}
\begin{frame}
\frametitle{Title}
\removedisplayskips
\begin{itemize}
\item text text text text text text text
\begin{equation}
\cos \pi=-1
\end{equation}
text text text text text text text
\begin{itemize}
\item text text text text text text text
\begin{equation}
\cos \pi=-1
\end{equation}
text text text text text text text
\end{itemize}
\end{itemize}
\end{frame}
\end{document}
答案2
尤
\usepackage{enumitem}
应该没问题。如果不可能,请使用:
\makeatletter
\g@addto@macro{\item}{%
\abovedisplayskip=0ex
\belowdisplayskip=0ex}
\makeatother
或重新定义itemize