TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to get list of tokens which comes from TeX "mouth"? If I understand correctly: in mouth all macros, conditionals and special operations (like \the and \input) are expanded and then goes to "stomach".

share|improve this question
I think this two links are related: All LaTeX commands list and this looks like what you want: TeX Primitive Control Sequences. – m0nhawk Mar 25 '13 at 18:35

The question is rather under specified. TeX's macro processor is not like (say) the C pre-processor where all macro expansion happens first and then an expanded source is passed to the compiler. In TeX macros are just expanded as needed and are interleaved with non-expandable assignments, which can change the result of future macro expansion.

So it is not possible to take a latex document and expand it out to just consist of TeX primitives.

It is possible to force the expansion of the following token until the next token is non expandable, so that you may then inspect that non-expandable token, but perhaps that isn't what you want.

share|improve this answer

As far as I understand, Knuth didn't use formal language techniques to parse TeX, just ad-hoc methods. I doubt such a list exists formally (just a few dozen scattered facts in his brain some years back...), I'm afraid to get it you'd have to get a fine comb, much patience, and a copy ot TeX's source.

(I'd like to be proven wrong, though.)

share|improve this answer
You don't need the tex source to understand TeX's parser (although it is available of course) The grammar of every TeX command is given in the TeXBook. – David Carlisle Mar 25 '13 at 18:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.