# Compiling a file with two document classes [duplicate]

Just out of curiosity: Is there a way to compile latex document with two document classes at once?

Suppose that I have a paper which start with line: `\documentclass[preprint,authoryear,12pt]{elsarticle}`

But finally I would like to compile it with such line: `\documentclass[final,5p,times,twocolumn]{elsarticle}`

Obviously I can replace these lines and compile file twice, but I wonder if there is any trick to avoid double compilation?

## marked as duplicate by egreg, Guido, Mico, Jesse, user31729 Oct 16 '14 at 11:41

The easiest way is probably to create two dummy documents `final.tex` and `draft.tex`.

`preprint.tex`

``````\documentclass[preprint,authoryear,12pt]{elsarticle}
\input{main.tex}
``````

`final.tex`

``````\documentclass[final,5p,times,twocolumn]{elsarticle}
\input{myfile.tex}
``````

If you are using an IDE to compile make compiling the documents easier, there may be additional hoops to jump through (e.g., Kile: how to use shortcut to compile the root file directly?).

• This is still a double compilation, but in general it is nice and simple workaround. – mc2 Oct 16 '14 at 11:46