0

I just received some tex files where there is a boolean defined at the beginning of the document with the etoolbox package. Changing the boolean produces a slightly different pdf. To produce the other version of the document, I have to copy the first pdf to not overwrite it when compiling again, change the boolean and then compile a second time. Is there a way to compile the document two times with the boolean set to the both true and false separately and and receive two pdfs?

Thank you very much!

3
  • Welcome to TeX.SE!
    – Mensch
    Commented Apr 18 at 13:37
  • topanswers.xyz/tex?q=583 might be helpful Commented Apr 18 at 14:45
  • As Ronnie Marksch mentions, any one call to tex can only produce one pdf. There are various approaches, but at some point they all run tex twice.
    – Teepeemm
    Commented Apr 18 at 15:01

2 Answers 2

1

In my environment I have something similar, which is why I use two .tex files, one like

\documentclass[a4paper,twoside,DIV12,BCOR1.5cm]{scrbook}
%
\osversiontrue
\input{main.tex}

and one like

\documentclass[a4paper,twoside,DIV12,BCOR1.5cm]{scrbook}
%
\input{main.tex}

and a main.tex that contains all the rest, everything starting with \begin{document} and ending with \end{document}.

When I compile both wrapper files, two pdf documents are created. The differences between the two documents are addressed by the boolean osversion.

2
  • Ok, that's smart, I will try that. However, you still have to compile two times.
    – User
    Commented Apr 18 at 13:21
  • well, it's only a single Makefile. One make builds both documents
    – Ronald
    Commented Apr 18 at 20:51
0

See also here how to pass args to the tex file. It is just a different solution.

However, you have to compile twice since one call to pdflatex/.. will create a single PDF only.

Creating both versions in one go resulting in one PDF and splitting that PDF in the 'middle' probably is not more convenient.

Last option I can think of, check for the existence of a file to determine the boolean and create/delete that file between the two pdflatex runs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .