[Tex/LaTex] Reformat the paper from one LaTex format to another LaTex format

templates

I am very new to LaTex. One reason I switched to it was to have an easy way to reformat my papers based on the templates provided by different publishers.

Then I don't know yet, laTex provide that convenience for me or not. For example Suppose I have a paper based on the laTex template by IEEE. Then I want to send it to another journal named IJCA, the IJCA give me their specific laTex template.

What is the easiest way to convert my paper (in IEEE format) to XXX format? Is there any automatic conversion tool for that? I just began to use WinEDT and can edit and compile latex files, what is the next step?

I give an example of two templates

IEEE:

\author{\IEEEauthorblockN{Michael Shell}
\IEEEauthorblockA{School of Electrical and\\Computer Engineering\\
Georgia Institute of Technology\\
Atlanta, Georgia 30332--0250\\
Email: http://www.michaelshell.org/contact.html}
\and
\IEEEauthorblockN{Homer Simpson}
\IEEEauthorblockA{Twentieth Century Fox\\
Springfield, USA\\
Email: homer@thesimpsons.com}
\and
\IEEEauthorblockN{James Kirk\\ and Montgomery Scott}
\IEEEauthorblockA{Starfleet Academy\\
San Francisco, California 96678-2391\\
Telephone: (800) 555--1212\\
Fax: (888) 555--1212}}

IJCA:

\author{
   \large 1st Author \\[-3pt]
   \normalsize 1st author's affiliation  \\[-3pt]
    \normalsize 1st line of address \\[-3pt]
    \normalsize 2nd line of address \\[-3pt]
    \normalsize 1st author's email address \\[-3pt]
  \and
   \large 2nd Author \\[-3pt]
   \normalsize 2nd author's affiliation  \\[-3pt]
    \normalsize 1st line of address \\[-3pt]
    \normalsize 2nd line of address \\[-3pt]
    \normalsize 2nd author's email address \\[-3pt]
\and
   \large 3rd Author \\[-3pt]
   \normalsize 3rd author's affiliation  \\[-3pt]
    \normalsize 1st line of address \\[-3pt]
    \normalsize 2nd line of address \\[-3pt]
    \normalsize 3rd author's email address \\[-3pt]
}
.......
\section{USING THE  ijca Article  CLASS FILE}

If the file \verb ijcaArticle.cls  is not already in the appropriate system directory
for \LaTeX{} files, either arrange for it to be put there or copy
it to your working directory. The \verb ijcaArticle  document class is implemented
as a complete class, not a document style option. In order to
use the \verb ijcaArticle  document class, replace \verb article  by \verb ijcaArticle  in the
\verb \documentclass  command at the beginning of your document:
\vskip 6pt
\begin{centering}
    \verb \documentclass{article}  \end{centering}
\vskip 6pt
replace by
\vskip 6pt
 \verb \documentclass{ijcaArticle}  \vskip 6pt
In general, the following standard document \verb style  options should
{ \itshape not} be used with the {\footnotesize \itshape article} class file:
\begin{enumerate}
\item[(1)] \verb 10pt,  \verb 11pt,  \verb 12pt   – unavailable;
\item[(2)] \verb twoside  (no associated style file) – \verb twoside  is the default;
\item[(3)] \verb fleqn, \verb leqno, \verb titlepage – should not be used;
\end{enumerate}

\section{Additional Document Style Options}
\label{sec:additional_doc}
%

I don't know much the latTex tags, then I prefer an automatic conversion tool which matches the tags and convert them to each other. At least does a preprocessing on them.

Best Answer

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 paperclass, 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:

  1. Remove, comment o replace manually every \xxx{} with another command to follow strictly the new template. Probably the best solution.

  2. 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.

  3. 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.