TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I try to refer to a theorem in a section title with thref, I get the error message at the end of this question. Is there a way to fix this?

Latex Error: ./seppathq.tex:57 Argument of \@xtrplargoom has an extra }.

Runaway argument?
{\M@sect {subsection}{2}{\subsecindent }{\beforesubsecskip }{\aftersubsecskip \
Latex Error: ./seppathq.tex:57 Paragraph ended before \@xtrplargoom was complete.
Latex Error: ./seppathq.tex:57 Undefined control sequence.
Latex Error: ./seppathq.tex:57 Missing \endcsname inserted.

Runaway argument?

{{\M@sect {subsection}{2}{\subsecindent }{\beforesubsecskip }{\aftersubsecskip 
Latex Error: ./seppathq.tex:218 TeX capacity exceeded, sorry [main memory size=3000000].
Latex Error: ./seppathq.tex:218 ==> Fatal error occurred, no output PDF file produced!
share|improve this question
use \protect\ref – David Carlisle Sep 17 '12 at 18:43
@DavidCarlisle When I use \ref instead of \thref it works, however, I would like to use thref. When I use protect infront of \thref, I get: Missing \endcsname inserted. – sxd Sep 17 '12 at 19:29
Welcome to TeX.SX! A minimal example of code is needed. – egreg Sep 17 '12 at 19:51
@egreg, it is just simply \subsection{Proof of \thref{somereference}.} – sxd Sep 17 '12 at 20:05
up vote 5 down vote accepted

The following works:


\subsection{Proof of \protect\thref{test}}

Remove the .aux file before retrying: the preceding run without \protect has surely corrupted it.

share|improve this answer

Your Answer


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.