Wiki: TeX

Your best resource for TeX is the TeXBook, particularly chapter 20 ("Definitions (also called Macros)") and Appendix D ("Dirty Tricks"). Appendix B provides a list of almost all macros defined at startup.

The reference for plain TeX at is also a good resource.


Differences from Plain TeX

The TeX language on the site is very similar to Knuth's plain TeX, with a few small modifications:

Looping over a string

The following code loops over all tokens until \relax, replacing all - tokens with (DASH)

    \ifx#1- (DASH)%
    \else #1%

\f 0-185186-70-\relax


One-byte macro ending

If a macro you define takes an argument longer than one token, you might be tempted to use curly braces. However, \def can allow for a single end character, saving one byte per usage.

\def\f#1{something #1 something}
% compare
\def\f#1;{something #1 something}


Commonly-used macros can be aliased with \let


% compare