The conversion could be as automatic as change (manually) article
by paper
in the first line, or a nightmare, or really impossible. The automatic conversion, in general, is impossible.
Let go with a simple example as proof-of-concept of the problem, with the very standard class book
:
\documentclass{book}
\begin{document}
\chapter{Hello}
\end{document}
Work perfectly. Now, imagine that you want change the format to another very standard class:
\documentclass{article}
\begin{document}
\chapter{Hello}
\end{document}
But that simple document cannot be compiled. The reason is a "undefined control sequence" error reading \chapter
. That is, LaTeX do not know nothing about the supposedly well-know command \chapter
. It is not hard coded in the TeX engines but defined in the document class book
.
This is a big problem for a conversion tool. What to do if the command of one class (book
) is not defined in another (article
)? Just pass the definition to the new template? In this case have not sense. Well, then ... Ignore it? Down the header one level? Left as bold font?
This mean that the tool must have a predefined solution for every command in every new class.
Moreover, in this case the control sequence (command) is defined (directly or not) in the document class (.cls
files), but the definition could be located also in any of the included packages (.sty
files), or children .tex
files (using \input{}
in the preample, for example) or directly in the preamble.
Think about known only the uncountable number of control sequences of the thousands of packages in CTAN ... And what to do with user-defined control sequences like \def\myowncommand{Hello}
?
A template conversion only can be compiled when all the definitions of the commands used in the old document (even the dull \myowncommand
) are maintained or redefined in the new template.
Some commands works in all type of documents because they are hard coded in the LaTeX engine. These are mainly TeX primitives and some others that you can use even in a "unclassified document". For example, With pdfLaTeX
document you can make a PDF with only some like:
% This is no a code chunk, but a complete MWE
\def\normalsize{\normalfont}
\begin{document}
Hello, {\em World}\par
Try me without a document class.
\end{document}
Here we must define \normalsize
in some way to avoid an error in the initialization process, since there are not any \documentclass
, but then we can use the commands that obviously do not pertain to any class or package.
The minimal
class do not make much more than a (re)definition of \normalsize
, so is hidden in minimal.cls
. The the above MWE is almost equivalent to:
\documentclass{minimal}
\begin{document}
Hello, {\em World}\par
Try me without a document class.
\end{document}
This class have no utility for any real work, but show you what is not a "universally accessible" command. You may be surprised that commands as \section{}
cannot be used here. Then \section{}
is a control sequence specific of some type of document, without operating warranty in any template.
Said that, the conversion often is very easy. With very specific (user-defined) commands you must be careful in maintain any auxiliar file like mymacros.tex
, the row of the preample with \input{mymacros}
in the main document or the preamble definitions starting with \newcommand
, \def
and so on.
Most time, the problem of a undefined but well-known command is that you have lost in the conversion some package. That is, a undefined \includegraphics
mean that you have lost \usepackage{graphicx}
in the preamble, so it is a problem easy to solve.
The plight become more obscure when the package was not loaded directly but through another package or even the document class of the original template, but the after some research about the real origin, the solution is the same.
The worst problem is the command is defined at the document class level, like \chapter{}
, because you cannot load a book
class inside an article
document, for example. Fortunately, most usual commands like \section{}
are defined in almost all any document class, so the problem in practice is limited to a few commands of less standard clases, like \institution{} of paper
class, that are not defined in article and other common clases.
Then the solution for a undefined command, for example said the command \xxx{} with one argument, could be:
Remove, comment o replace manually every \xxx{}
with another command to follow strictly the new template. Probably the best solution.
Copy the original definition \xxx
from the old document class and use it in your custom class, package, preamble or children file. But this is only part of the problem. The other is make this without breaking anything else and ruin the layout. Do not try if you do not know what are you doing.
Define \xxx
as something simple and inoffensive. For example:
\newcommand\xxx{}
(do nothing)
\newcommand\xxx[1]{#1}
(print the argument as plain text). After check the result, try to modify your own definition with a more elaborated format of the argument (some like \newcommand\xxx[1]{\par\bfseries #1\par\bigskip}
if really is needed.
Finally, take into account that probably the editor of a journal will not be happy with the second or third solution.
Best Answer
The easiest way to get a document in a look far from arcticle-class and Computer Modern is to load the
scrartcl
class from the KOMA-script bundle and to use e.g. the libertine package for the fonts. Give it a try.The english manual of KOMA-script is not really up-to-date, but everthing described there still works as desribed. In case you'd like to have more features, just ask here, tex.stackexchange is visited by many Germans who will give you a hand.
Regards,
Alexander