为什么除非删除枚举环境,否则以下最小工作示例会产生错误? 有没有简单的解决方法?
\documentclass[10pt,presentation]{beamer}
\newif\ifexercise
\exercisetrue
%\exercisefalse
\begin{document}
\section{Some Section}
\begin{frame}{Some Slide}
\ifexercise
What is the answer to everything?
\begin{enumerate}
\item 42
\item 43
\end{enumerate}
\else
\fi
\end{frame}
\end{document}
答案1
如果你愿意使用etoolbox
包裹,您可以\if
用替换您的bool
。
\documentclass[10pt,presentation]{beamer}
\usepackage{etoolbox}
\newbool{exercise}
\booltrue{exercise}
\boolfalse{exercise}
\begin{document}
\section{Some Section}
\begin{frame}{Some Slide}
\ifbool{exercise}{%
What is the answer to everything?
\begin{enumerate}
\item 42
\item 43
\end{enumerate}%
}{}
\end{frame}
\end{document}