When you get an error in LaTeX, the message "Undefined control sequence" is printed. Why is it called "control sequence" and not "command", for example? How does the sequence work? Is this a TeX or LaTeX thing?
[Tex/LaTex] a “Control Sequence”
tex-core
Related Solutions
not a definitive answer, but perhaps a reasonable hypothesis ...
\varnothing
is shorter than \varemptyset
. mathematicians aren't generally great typists.
although \varempty
is even shorter, \empty
, while not a primitive, has quite a different meaning, and a "var" of that would only be confusing.
"the joy of tex", while it mentions both, has nothing useful to say on the matter (sorry, must be on auto-pun this morning), and in fact doesn't even point out that they have the same meaning.
the control sequence \nothing
does show up in cjwmath.sty
, where it is equated to \varnothing
, and there is a further alias, \leer
, for \nothing
. i didn't find this name anywhere else in any package on tex live.
so the reason, to me, is lost in the mists of time.
i suppose i could ask mike spivak.
i have consulted the documentation for the composition system used at ams prior to tex. the name given to the slashed circle is "null set", for which a "short name", empty
, was assigned for use by input keyboarders. (the system was highly encoded, and the canonical code was *yo
; keyboarders were free to use whichever form they preferred, i.e., more easily remembered.) so the term "nothing" was not in use at ams in any relation to this symbol prior to the creation of the ams symbol fonts.
what would be in those fonts was defined by a committee; i've sent an inquiry to one of the few surviving members of the committee in the hope that he remembers.
i did ask mike spivak, and he doesn't remember, except that he's pretty sure he wasn't responsible.
i have found the definitive release notice of the original ams extra symbol fonts in the july 1985 issue of tugboat. these were the msxm
and msym
fonts, and initially (and erroneously) referred to as "euler", a lapse corrected in an update later that year. the name \varnothing
is used, however without any commentary on choice of names. (and, unfortunately, the page in the scan of the update that would show this symbol is missing; but i've confirmed its presence in the paper copy on my bookshelf. i'll try to get the posted copy on the tugboat web site corrected.)
Generally you can find the undefined control sequence if you look in the right place. Here's a simple beamer
document:
\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{A title}
\foo
\end{frame}
\end{document}
And the error it generates:
./undefined.tex:6: Undefined control sequence.
\beamer@doifinframe ...\frametitle {A title} \foo
\end {beamer@frameslide}
l.6 \end{frame}
The undefined control sequence is the last control sequence in the first line of code reported by the error. This is in fact fairly consistent, and if you ask TeX for help on the error (by entering h
in the console), this is exactly what it tells you:
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
So you can tell the actual offending undefined control sequence, you just need to know where to look. Unfortunately many editing environments hide or otherwise filter the console output, so perhaps this is why it appears not to report the offending command.
This is not to say that all errors are as easy to diagnose in TeX; they're not, because often the line that the error gets noticed is after the line that causes the error. But for undefined control sequences, this is not the case.
Best Answer
It says “control sequence” because that's the name Knuth chose. In his manual about LaTeX, Lamport decided instead to use “command”.
Since those low level error messages are hardwired in TeX, you cannot dispense with or modify them.
A control sequence can be
\<letters>
, for instance\a
,\ab
,\abc
and so on\<nonletter>
, for instance\?
or\.
<active character>
, for instance~
The description of what a control sequence is and how they are parsed from the text input can be found in TeX by Topic. (
texdoc texbytopic
from a terminal or http://texdoc.net/texmf-dist/doc/plain/texbytopic/TeXbyTopic.pdf). However, you can safely refer to them as “commands”, if you prefer.It would be possible to modify the error messages, by writing a change file for the WEB source of TeX and recompiling it