Passing definition parameter through pdfTeX(pdflatex) does not work

Viewed 38

Commandline for pdflatex:

pdflatex main.tex "\def\anonymous{}\include{main}"

main.tex:

\documentclass[a4paper]{article}
\begin{document}
\ifx\anonymous\undefined
Lorem ipsum dolor sit amet
\else
Nam eu velit eget neque mollis imperdiet
\fi
\end{document}

The above command line will make PDF file which holds "Lorem ipsum dolor sit amet".

How can I make the output to hold "Nam eu velit eget neque mollis imperdiet"?

1 Answers

Two problems:

  • \include{} is meant to be used to include stuff inside the document body. For your case, use \input{} instead

  • \def\anonymous{}\input{main} is to replace main.tex, not to be used in addition.


pdflatex "\def\anonymous{}\input{main}"
Related