# What is a “Control Sequence”?

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?

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

• Thanks! I wonder what Knuth has in mind when he used the word "sequence"! That would be interesting to know. – jak123 May 4 '15 at 9:30
• @jak123 Knuth uses the name “control word” for the first kind (where the command name consists of letters) and “control symbol” for the second kind (where the command name consists of one nonletter). Since both are special cases of sequences of characters… – egreg May 4 '15 at 9:43
• Interesting! So the sequence comes from the fact that commands were made of sequence of characters. – jak123 May 4 '15 at 9:47
• Concerning the footnote: in principle, one could do it without recompiling by editing the tex.pool file, as long as its checksum is preserved. – Emil Jeřábek May 4 '15 at 18:40
• Actually, it turns out the checksum is just for show, it works happily if the number at the end of the file is simply left intact. Much to my disappointment, a Google search indicates that newer versions of TeX Live bypass pool files entirely. That’s spoiling fun for negligible optimization, if you ask me. – Emil Jeřábek May 4 '15 at 19:04

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).
• register ... a variable saving some value (primitive register, \baselineskip for example, or register declared by \countdef, \dimendef etc. primitives).
• character constant ... sequences declared by \chardef or \mathchardef primitives, for example \\$ or \alpha, \sum.
• font selectors ... sequences declared by \font primitive.

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.

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.

• @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 6:04
• The 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 6:15