Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

3 Answers 3

up vote 12 down vote accepted

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}
share|improve this answer
    
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 '11 at 19:01
    
It must be some other package which is causing troubles :\ –  user46365 May 1 '11 at 19:03
    
Tried it on a fresh file and it worked like a charm.. bummer. –  user46365 May 1 '11 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 '11 at 19:04
    
@user46365: Strange enough, my example still works if I load amsthm, but not with ntheorem. Obviously you don't use ntheorem if it works for you now. –  lockstep May 1 '11 at 19:07
\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

share|improve this answer
    
thanks marco for your help. –  user46365 May 1 '11 at 19:23

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

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

share|improve this answer
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 at 14:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.