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

Possible Duplicate:
Passing parameters to a document
How do I make make different versions of my document with command line compile flags?

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?

share|improve this question

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

See also tex.stackexchange.com/q/1492/86 – Loop Space Oct 26 '12 at 16:35

Yes you can go

   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.

share|improve this answer

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