Are there any limitations to how long the text in a \label{text} can be? I'm asking syntax-wise not aesthetic/practicality-wise.


A \label essentially defines a control sequence having a name built upon the label: for example, at the next run after having issued \label{x}, as part of the bookkeeping tasks done at \begin{document}, the macro \r@x will be defined.

Control sequence names can be, practically, arbitrarily long: the only limit is the “pool size”, because TeX has to remember the defined control sequence; on my system this is set to 6250000.

However, there is another constraint: TeX cannot read lines from a file if their length is above the value of buf_size (a variable set at run time, so it can in principle be changed). This variable, on my system, is set to 200000.

A method for defining control sequence names longer than buf_size can be conceived, but our problem are labels, which must be written to the .aux file: so a tad less than buf_size, because the annotation is


and we need to have enough room for the other items besides <label>.

  • Can you recommend a good reference on such issues? – jak123 Mar 11 '15 at 8:36
  • @YazanAhed There's something in TeX by Topic (texdoc texbytopic) or the documentation of kpathsea (texdoc kpathsea) – egreg Mar 11 '15 at 9:12
  • 2
    How does \label prevent TeX from automatically inserting a line break every 80 characters? (I was expecting that to be a possible issue.) – Nicola Talbot Mar 11 '15 at 12:24
  • @NicolaTalbot Seem to work with much more that 80 character without problems. Although the OP exclude the aesthetic/practical issues, the real problem is that such balels are not handy for human beings, and in case of computer generated labels and references by some script, only 8 character are enough for 3025989069143040 labels (more or less) so ... why the hell one may want labels that do not fit on one line? – Fran Mar 11 '15 at 19:33
  • @NicolaTalbot The 80 character (actually 79) limit is about printing text on the terminal, which has nothing to do with the buffer size. – egreg Mar 11 '15 at 20:42

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.