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?
4 Answers
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,\abcand 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
- 1,121,712
Control sequence is (typically, roughly speaking) a sequence of letters with preceded backslash. This is TeX terminology.
Control sequence has assigned its meaning. The meaning typically is:
- TeX primitive ... a command processed by TeX itself (for example
\def,\font). - macro ... a sequence declared by
\def(or similar\edefetc.). For example\newcommandis a LaTeX macro declared by\def. The expansion of\newcommandmacro uses the\defprimitive for declaring new control sequence as macro. - register ... a variable saving some value (primitive register,
\baselineskipfor example, or register declared by\countdef,\dimendefetc. primitives). - character constant ... sequences declared by
\chardefor\mathchardefprimitives, for example\$or\alpha,\sum. - font selectors ... sequences declared by
\fontprimitive.
Undefined control sequence is any control sequence which has no meaning assigned.
LaTeX documentation hide this terminology and simply mentions only "commands". And LaTeX users are confused when they read the TeX error messages. Of course, end users needn't to know that \% is control sequence with the meaning of "character constant". It is sufficient to know that this is "command" which prints the percent character.
- 74,238
To add to the existing answers, "control sequence" has a specific meaning and evokes accurate imagery of a sequence of characters that have control semantics (rather than being printables).
The notion of "control characters" is nothing new (even at the time LaTeX came into being) so talking about "control sequences" makes complete sense.
On the other hand, the term "command" is exceedingly ambiguous. I for one am glad that Knuth made his choice as he did!
To add to existing answers, Knuth made a comment in his parody "An Earthshaking Announcement" talk, in TUG 2010 Conference indicating the peculiarity of this name:
Examples of my tunnel vision abound, on almost every page of The TEXbook. For example, I used backslashes and other strange characters to define what I called “control sequences”. Does any other system you know have control sequences? Of course not.
- 4,252
- 5
- 26
- 49
-
@Mico I added the answer based on my reading of the first part of the talk. As I continued reading, I started to think that Knuth was going crazy, never expected to a spoof to be published in a conference proceedings. :( – jak123 Nov 12 '15 at 06:04
-
1The 2010 TUG conference was a special one, to celebrate and commemorate 2^5=32 years of TeX82. Many (most?!) of the talks given at that conference were of a decidedly celebratory rather than the usual dry and expository nature. And, well, celebrations frequently take a fun turn, don't they? – Mico Nov 12 '15 at 06:15
\MyConTRolSeQUEnce, if you want. For user level macros lowercase is usually preferred (with some natural exceptions such as\Por\Sthat are semantically named). “Global” declarations such as\DeclareMathOperatoruse this peculiar scheme with capital letters. – egreg Apr 25 '16 at 17:37etoolboxspecifies a “control sequence name”, the argument should be braced and consist of letters (normally), that will be transformed in the control sequence with that name. – egreg Aug 08 '18 at 08:34