[Tex/LaTex] Two pdf versions from one single .TEX file

multiple filespdfshell-escape

I publish a lot for science journals and some of them are very strict on the number of pages your manuscript will be, as usual the final version of the articles is double column but for review and stuff like that it is always ez to compile as single column.

My question is this, Is there a way to compile just one .tex file and get a Single column pdf and a double column one?

I read that this could be achieve by use of \write18 but I don't understand at all how

I guess must be something like this:

\documentclass[layout=onecolumn]{SomeJournalStyle}
all the preamble

\write18{pdflatex "2Columnversion" Master.tex some script/modifier to change column layout at preamble }

\begin{document}
.
.
.
.
.
\end{document}    

Best Answer

I would recommend you use a command line option to specify the column type. So the MWE below with either of these two:

pdflatex doc.tex

or

pdflatex "\def\ColumnType{onecolumn}\input{doc.tex}"

will produce a single column layout, but with

pdflatex "\def\ColumnType{twocolumn}\input{doc.tex}"

will produce a two column output.

Code:

\ifdefined\ColumnType
\else
    \def\ColumnType{onecolumn}
\fi
\documentclass[\ColumnType]{article}
\usepackage{lipsum}
\begin{document}
\lipsum[1-5]
\end{document}
Related Question