Is there a possibility that with compiling my latex document all the time two PDFs are created (a oneside and twoside version). So in my case only the first line would be different for the two versions:

\documentclass[11pt, a4paper, oneside]{scrreprt}
\documentclass[11pt, a4paper, twoside]{scrreprt}
  • Probably with arara or latexmk combined with one of these answers you can automatically compile your document twice, one for oneside and another for twoside. – Ignasi Mar 22 '16 at 8:56
  • Printing on a Möbius strip? – Bernard Mar 22 '16 at 9:52
  • 1
    don't use \documentclass in your .tex file and compile with pdflatex --jobname one \documentclass[11pt, a4paper, oneside]{scrreprt}\input{myfilename} & pdflatex --jobname two \documentclass[11pt, a4paper, twoside]{scrreprt}\input{myfilename} – touhami Mar 22 '16 at 13:05
  • @Bernard For printing on a Möbius strip you only need \documentclass[11pt, a4paper, oneside]{scrreprt} ;) – principal-ideal-domain Mar 22 '16 at 16:44

If it's easier for you, you can also alter your .tex source file within a batch script during compilation. For example, here is an example using a DOS script.

Given a sample.tex file:


The following batch file will create two different tex files and process them to give the shown output.

echo \documentclass[10pt]{article} > temp10.tex
type sample.tex >> temp10.tex
pdflatex temp10.tex

echo \documentclass[12pt]{article} > temp12.tex
type sample.tex >> temp12.tex
pdflatex temp12.tex

enter image description here

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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