1

The C programming language has a preprocessor, which has #ifdef #endif macros that allow to preprocess a source code file before the compilation process.

I am looking for something similar. What I actually want is being able to pass some variable straight to the compiler like so (it would compile text enabling some variable):

pdflatex mydocument.tex -DSOME_VARIABLE

Is there anything I could use? Again, all I want is conditional compiling and being able to pass some variable from the command line.

syntagma
  • 369

1 Answers1

3

Your document can look like:

...
\ifx\SOMEVARIABLE y
...
\else
...
\fi
...

and your command would be:

pdflatex '\let\SOMEVARIABLE=y \input' document
wipet
  • 74,238