[Tex/LaTex] Different styles for the same document

conditionalsformattingpreamble

Suppose I am writing a paper, which I plan to submit to a journal/conference, but also put on a preprint server like the arXiv. Each publisher has its own style files required for typesetting the paper, while for several reasons, it may be convenient to put a "neutral" version on this preprint server, with a neutral style.

My question is the following:

Is it possible to make one single TeX-file, which (e.g., after specifying an option in the preamble) can be compiled to give either version of this same paper?

Even if the solution is a somewhat ugly fix with pure TeX-variables, that would be something. The two different styles may have a different document class, require different packages, etc. so I have no idea where to start, and whether this is even possible.

Best Answer

While the ideal aims to be

write your document and then only change the class and options to the loaded packages in order to adapt it to whatever printing style you want

it is quite difficult to attain it for various reasons.

  1. Printing styles often require parts of the document to be in different order. For instance, AMS classes want the abstract to come before \maketitle, while the standard classes want it after \maketitle.

  2. Line and page breaks are usually very different when changing the class, so any adjustment made for one (say a \linebreak or \pagebreak command) can be disastrous with another.

  3. Some publishers (among which arXiv) prohibit the usage of some packages or provide a list of the only admitted ones; these proscription lists differ among publishers, ça va sans dire.

Thus if you need for your paper the package extrapack that publisher Foo allows, but the public site Bar doesn't, you have a problem. You may be able to emulate the workings of extrapack for submitting the paper to Bar, but that code won't be so nice for Foo.

There is another problem, though. You can't send the paper to Foo and to Bar telling them to compile it with the command line

pdflatex "\def\Foo{YES}\input{TMM-paper}"

as your file starts with

\ifdefined\Foo
  \documentclass[<options>]{foopapers}
  <packages for Foo>
  <special code for Foo>
\else
  \documenclass[a4paper]{article}
  <packages for Bar>
  <special code for Bar>
\fi

because both publishers will probably rely on an automated typesetting process at least for validating the submission.

A different strategy might be to have the paper text in a file TMM-paper.tex and two other files for the submissions

% File TMM-paper-foo.tex
\documentclass[<options>]{foopapers}
<packages for Foo>
<special code for Foo>

\begin{document}
\input{TMM-paper}
\end{document}
% File TMM-paper-foo.tex
\documenclass[a4paper]{article}
<packages for Bar>
<special code for Bar>

\begin{document}
\input{TMM-paper}
\end{document}

but this won't work if one of the publishers requires the submission to consist of only one file. And, if the two classes require elements to be in different orders, … Oh, wonderful!

Is it impossible, then?

You're not without hope and most often the strategy of having the text in one file to which you can just add the right preamble and do only minor changes (for the position of the abstract or for adding keywords and so on) will work.

Above all, when you submit a paper to a publisher, never add hints for line or page breaking, nor absolute dimensions for figures or tables (only relative ones to \columnwidth, for instance).

These may be added for the arXiv version, of which you know precisely the final output format, since their system doesn't touch the contents, but only validates the file from a formal point of view (it compiles without errors). Of course such adjustments cause a fork in your text file; nothing to be really worried about if you use, or maybe abuse, comments in your file.

Related Question