\documentclass[presentation]{beamer}
\begin{document}
\begin{frame}
\begin{example}[\cite[p. 42]{Author}]
Nice example.
\end{example}
\end{frame}
\begin{thebibliography}{1}
\bibitem{Author}
Author,
Title,
Publisher,
2016.
\end{thebibliography}
\end{document}
编译上述文件时出现错误
$ pdflatex test.tex
Runaway argument?
p. 42)\fi \end {beamercolorbox}{\parskip 0pt
! Paragraph ended before \@citex was complete.
<to be read again>
\par
如果我[p. 42]
从\cite
命令中删除,错误就会消失。
如何在环境\cite
的可选参数中使用命令的可选参数example
?
$ pdflatex --version
pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016)
答案1
尝试:
\documentclass[presentation]{beamer}
\begin{document}
\begin{frame}
\begin{example}[{\cite[p. 42]{Author}}]% added {...}
Nice example.
\end{example}
\end{frame}
\begin{thebibliography}{1}
\bibitem{Author}
Author,
Title,
Publisher,
2016.
\end{thebibliography}
\end{document}
[ ... ]
不允许 嵌套在(任何)选项中。它必须位于花括号内,即{[...]}