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

I have a long tex file which uses many newcommands/providecommands sourced in from a separate file using \input{}. To upload to a preprint server I would like to keep only those commands which are really needed. Therefore I wonder how to generate a list of newcommands names to extract from the input file. Assuming all of these are defined as single lines it would be quite easy to extract them. My first approach was to comment the \input-statement to get a list Undefined control sequence errors and to generate the list from it. However the latex output is a little difficult to parse. Is there a switch to latex which allows me to extract a useful list more easily or some different approach?

share|improve this question
Related: tex.stackexchange.com/questions/78073/… – Scott H. Nov 8 '12 at 17:26
The cmdtrack package would seem useful here: ctan.org/pkg/cmdtrack – Loop Space Nov 8 '12 at 17:31
grep -A 1 "Undefined control sequence" filename.log – egreg Nov 8 '12 at 21:21
The package ctan.org/tex-archive/macros/generic/occam seems a bit odd, at least I can't understand how to use it. I'm mentioning it just in case. – Mafra Dec 5 '12 at 23:33
up vote 1 down vote accepted

The package cmdtrack can be useful. Of course you can use the Terminal to search the log-file:

grep -ni -A 1 "Undefined control sequence" <filename>.log
share|improve this answer

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.