46

How do I create something like this without getting any errors?

\begin{thm}[\cite[page 10]{ABC2011}]
...
\end{thm}

I tried putting various things into {...} brackets, but not eliminating any errors. I probably have misunderstood something about how LaTeX works in the background and the AMS packet:

\usepackage[amsmath,thmmarks]{ntheorem}

4 Answers 4

50

Mask the content of thm' s optional argument with an additional set of braces.

EDIT: For what it's worth, with ntheorem loaded one needs two additional sets of braces.

\documentclass{article}

\usepackage{ntheorem}

\newtheorem{thm}{Theorem}

\begin{document}

\begin{thm}[{{\cite[page 10]{ABC2011}}}]
A theorem.
\end{thm}

\begin{thebibliography}{9}
\bibitem{ABC2011} A bibitem.
\end{thebibliography}

\end{document}
12
  • Thanks for the fast response. I get these errors, when I do that: Argument of \@citex has an extra }. Runaway argument? page 10\color@endgroup Latex Error: Paragraph ended before \@citex was complete. Latex Error: Extra }, or forgotten \endgroup.
    – user46365
    May 1, 2011 at 19:01
  • It must be some other package which is causing troubles :\
    – user46365
    May 1, 2011 at 19:03
  • Tried it on a fresh file and it worked like a charm.. bummer.
    – user46365
    May 1, 2011 at 19:04
  • @user46365: What packages that might affect theorems do you use (amsthm, ntheorem)? What document class? A working example would be even better.
    – lockstep
    May 1, 2011 at 19:04
  • 1
    two brackets, who would have thought. thanks! have a great day.
    – user46365
    May 1, 2011 at 19:23
10
\documentclass{article}
\usepackage{ntheorem}
\newtheorem{thm}{Theorem}

\begin{document}

\begin{thm}[\protect{\cite[page 10]{ABC2011}}]
A theorem.
\end{thm}

\begin{thebibliography}{9}
\bibitem{ABC2011} A bibitem.
\end{thebibliography}

\end{document}

regards

0
2

There seems to be conflict between the packages ntheorem and amsthm. As a slightly different solution to Fiandrino's, I change

[\cite[page 10]{ABC2011}] to [{\cite[page 10]{ABC2011}}],

then it works.

\documentclass{article}
\newtheorem{theorem}{Theorem}[section]

\begin{document}

\begin{theorem}[{\cite[page 10]{ABC2011}}]
A theorem.
\end{theorem}

\begin{thebibliography}{9}
\bibitem{ABC2011} A bibitem.
\end{thebibliography}

\end{document}
1
  • That's the best solution. Jan 31, 2023 at 16:26
-1

I have another solution. I don't use the package theorem.

I just change [\cite[page 10]{ABC2011}] to --> {[\cite[page 10]{ABC2011}]}.

1
  • 1
    Welcome! This answer has already been given by others, please make sure that your answer is really a "new answer" before clicking that button. Small improvements on existing answers can be suggested in the comments or with the "edit" button.
    – T. Verron
    Sep 29, 2014 at 14:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .