When I define multiple terms that contain an underscore and begin with the same string ex_ 1, ex_ 2 (as shown in the example below) I get the following error:

! TeX capacity exceeded, sorry [input stack size=5000]. \expandafter l.30 \end{frame}

However, when I define the term e2 using the commented out line below (e2_ 2) it compiles fine. If I just remove the escaped underscores (see below) that works as well. Can someone tell me how to work around this?


% beamer doesn't define \@idxitem, but it's used by the
% \printterms "index" style, so define it:



% this fails:
 \newterm[label=e1]{ex\_ 1}
 \newterm[label=e2]{ex\_ 2}

% this works
%\newterm[label=e1]{ex\_ 1}
%\newterm[label=e2]{e2\_ 2}

% this works
%\newterm[label=e1]{ex 1}
%\newterm[label=e2]{ex 2}


  • As it says in the documentation, you can't use active characters in the label. Do you really need an underscore in your label? (After all, it's only an identifier not typeset material.) Nov 11, 2013 at 17:06
  • I'm a little confused here. In this example: \newterm[label=e1]{ex_ 1} Isn't the label 'e1' and the text/term that contains the active character ('ex\_ 1')? Nov 11, 2013 at 19:20
  • 1
    Sorry, I misread your question. I think the problem is the mechanism that sets the default sort value. Try \newterm[label=e1,sort={ex1}]{ex\_ 1} Nov 11, 2013 at 19:36
  • That's it, and I think it makes sense as well. Thanks, I appreciate it. Nov 11, 2013 at 20:09

1 Answer 1


The second comment by Nicola Talbot answered my question: Without specifying a sort option it tries to sort by the term and when the sorter gets to the escape character it has a hard time. Specifying the sort option:

\newterm[label=e1,sort={ex1}]{ex\_ 1}
\newterm[label=e2,sort={ex2}]{ex\_ 2}

Solves the problem for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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