[Tex/LaTex] How/where did Knuth define the famous \TeX macro

logosmacrostex-core

Does anyone know how Knuth originally defined the famous TeX macro \TeX? Specifically, I want to know where I can find in, say, a TeXLive set of source files, of this macro being constructed.

I'm not asking so that I can recreate it or so I can better understand macros. I'm asking because I've been studying TeX source code/the TeXbook/tex.web for a while, but I'm still confused about its programming structure. All I can really gather is that some of it is written in WEB, Pascal, something called Pascal-H, then TeXLive made WEB2C to translate it to C, etc., so I feel that a concrete identification of where \TeX is defined in TeX source code would be helpful in sorting this stuff out.

Best Answer

The \TeX macro is defined in plain.tex as

\def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX}

or in LaTeX (ltlogos.dtx) as

\DeclareRobustCommand\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@}

(the difference is that LaTeX makes \TeX a robust macro, and adds the spacefactor correction \@).

You can use \show\TeX to see its definition in plain TeX, or in a recent LaTeX distribution, \ShowCommand\TeX:

> \TeX=robust macro:
->\protect \TeX  .

> \TeX =\long macro:
->T\kern -.1667em\lower .5ex\hbox {E}\kern -.125emX\@.
<argument> \TeX  
                 
<*> \ShowCommand\TeX
                     \stop
?

This macro is hand-tuned to Computer Modern, so if you change fonts you might need to adapt the kerning.