# Is it possible to pass definitions to LaTeX from the command line? [duplicate]

I find myself wanting to be able to compile my document with different settings (e.g. draft mode, Beamer slides/handouts, without coloured references for printing, etc.). It would be really great to be able to pass these settings on the command line when invoking pdflatex.

Currently my solution is to have a wrapper shell script that parses the command line and echoes the right values (i.e. extra definitions) into an extra .tex file which is then read by my main document using e.g. \input{settings.tex}.

Is there a standard way of doing this? Is there a better way of doing this?

-

## marked as duplicate by Andrey Vihrov, Loop Space, lockstep, Kurt, ThorstenOct 26 '12 at 16:44

   pdflatex '\def\foo{yes} \input{myfile}'

and then myfile can use \foo or test its value or whatever. (you might need different quotes or to use double backslashes, depending on the commandline system that you use.