[Tex/LaTex] Table and citation formats that are portable across publishers

acmbibtexieeetrantables

Sometimes, an author has to submit manuscript originally prepared according to one publisher's format (e.g. IEEE) to another publisher's format (e.g., ACM). This may be due to:

  1. A paper is rejected from one journal and needs to be submitted to another
  2. After completing manuscript, author finds that its page-length has exceeded that of one publisher (e.g., 14 pages in one journal) and needs to be submitted to another (e.g., 25 pages in another).
  3. Another journal's scope aligns better than that what was initially thought
  4. and many other possible reasons…

However, since they use different formats, one has to make lot of changes in text, which may introduce grammatical/formatting errors. It would be really nice to achieve this just by changing the macros in the header .tex fil, without changing .cls or .bst/.bib files or any included .tex files.

Some publishers take source-files only after acceptance, so this approach is most useful for them, since after acceptance, the author has surety and more-time for removing his/her macros than that at submission-time (deadline). If publishers take source-files before acceptance, editors won't like macros, as cfr has correctly pointed out, so this approach is not very useful.

Here I focus on table and citation format differences between ACM (journal template, not conference template) and IEEE.

Citations: IEEE uses numbered citation and ACM uses author-year. I would like to use following in .tex file:

\citeN{Lastname2010title} present a technique 

to generate

ACM PDF: Lastname et al. [2010] present a technique
IEEE PDF: Lastname et al. [3] present a technique

Tables: Currently, I have to use following for ACM and IEEE tables, respectively (with MWE). It would be great to just put tabular part in a macro and define that macro differently in header file of IEEE or ACM papers.

\documentclass{acmsmall} 
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Lastname2010title,
author  = "Firstname Lastname and next author and more authors",
title   = "Title of paper",
year    = "2010",
journal = "Some Journal",
}
\end{filecontents}
\begin{document}
\begin{table}[htbp] 
  \centering
\tbl{ My Table Title \label{tab:label1}}{
\begin{tabular}{|l|l|} \hline
 Key & Value \cite{Lastname2010title} \\\hline
\end{tabular}
}
\end{table}
\citeN{Lastname2010title} present a technique.
\bibliographystyle{ACM-Reference-Format-Journals}
\bibliography{\jobname}
\end{document}

This is for IEEE.

\documentclass{IEEEtran} 
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Lastname2010title,
author  = "Firstname Lastname and next author and more authors",
title   = "Title of paper",
year    = "2010",
journal = "Some Journal",}
\end{filecontents}
\begin{document}
\begin{table}[htbp]
\centering
\caption{My Table Title}\label{tab:label1}
\begin{tabular}{|l|l|}\hline
Key & Value \cite{Lastname2010title} \\\hline
\end{tabular}
\end{table}
% Currently I have to use this
Lastname et al. \cite{Lastname2010title} present a technique.
\bibliographystyle{IEEEtran}
\bibliography{\jobname}
\end{document}

Here are full templates for ACM and IEEE. I have uploaded *cls and *bst files here to avoid need of downloading and unzipping them.

Best Answer

You can move the \bibliographystyle to the preamble or whatever, so it is easier to switch out.

That much is unobjectionable. However, everything suggested below this point is subject to a large caveat:

If you are submitting source - as opposed to PDF - you should not do this as it will only annoy. In particular, it will piss off copy editors no end. They do not want a highly customised preamble and a body which uses a bunch of user-defined macros.

Caveat emptor

You could handle the tabular in this way by providing a command which will not overwrite an existing definition, but only supply a default if none is defined.

\documentclass{IEEEtran}
\providecommand\tbl[2]{%
  \caption{#1}%
  #2}
\bibliographystyle{IEEEtran}

\begin{document}
\begin{table}[htbp]
  \centering
  \tbl{My Table Title \label{tab:label1}}{
    \begin{tabular}{|l|l|}\hline
      Key & Value \cite{Lastname2010title} \\\hline
    \end{tabular}
  }
\end{table}
% Currently I have to use this
Lastname et al. \cite{Lastname2010title} present a technique.
\bibliography{\jobname}
\end{document}

produces

version 1

Switching classes means we need to alter the preamble to use the relevant bibliography style, but the \providecommand can stay. We don't need it, but it does no harm. (It will result in an infinitesimal increase in compilation time as TeX will read the code, but it will not make any difference to the compiled result.)

We also still need to change \cite to \citeN etc. as applicable.

\documentclass{acmsmall}
\providecommand\tbl[2]{%
  \caption{#1}%
  #2}
\bibliographystyle{ACM-Reference-Format-Journals}

\begin{document}
\begin{table}[htbp]
  \centering
  \tbl{My Table Title \label{tab:label1}}{
    \begin{tabular}{|l|l|}\hline
      Key & Value \cite{Lastname2010title} \\\hline
    \end{tabular}
  }
\end{table}
\citeN{Lastname2010title} present a technique.
\bibliography{\jobname}
\end{document}

produces

version 2

Note that you could obviously \providecommand for \citeN, too. But you would still need to change the structure of the text in that case.

You could work around this by defining a custom citation command, \myciteN{}{} which does something different, depending on which class is loaded. For example, using etoolbox for testing whether \citeN is defined,

\documentclass{acmsmall}
\usepackage{etoolbox}
\providecommand\tbl[2]{%
  \caption{#1}%
  #2}
\providecommand\myciteN[2]{%
  \ifundef\citeN{%
    #1 \cite{#2}%
  }{%
    \citeN{#2}%
  }%
}
\bibliographystyle{ACM-Reference-Format-Journals}

\begin{document}
\begin{table}[htbp]
  \centering
  \tbl{My Table Title \label{tab:label1}}{
    \begin{tabular}{|l|l|}\hline
      Key & Value \cite{Lastname2010title} \\\hline
    \end{tabular}
  }
\end{table}
\myciteN{Lastname et al.}{Lastname2010title} present a technique.
\bibliography{\jobname}
\end{document}

produces

version 2 mark 2

while merely changing the class and the bibliography style in the preamble as follows

\documentclass{IEEEtran}
\usepackage{etoolbox}
\providecommand\tbl[2]{%
  \caption{#1}%
  #2}
\providecommand\myciteN[2]{%
  \ifundef\citeN{%
    #1 \cite{#2}%
  }{%
    \citeN{#2}%
  }%
}
\bibliographystyle{IEEEtran}

\begin{document}
\begin{table}[htbp]
  \centering
  \tbl{My Table Title \label{tab:label1}}{
    \begin{tabular}{|l|l|}\hline
      Key & Value \cite{Lastname2010title} \\\hline
    \end{tabular}
  }
\end{table}
\myciteN{Lastname et al.}{Lastname2010title} present a technique.
\bibliography{\jobname}
\end{document}

now produces

version 1 take 2

This means that you can write, for example,

\documentclass{IEEEtran}
% \documentclass{acmsmall}
\usepackage{etoolbox}
\providecommand\tbl[2]{%
  \caption{#1}%
  #2}
\providecommand\myciteN[2]{%
  \ifundef\citeN{%
    #1 \cite{#2}%
  }{%
    \citeN{#2}%
  }%
}
\bibliographystyle{IEEEtran}
% \bibliographystyle{ACM-Reference-Format-Journals}

\begin{document}
\begin{table}[htbp]
  \centering
  \tbl{My Table Title \label{tab:label1}}{
    \begin{tabular}{|l|l|}\hline
      Key & Value \cite{Lastname2010title} \\\hline
    \end{tabular}
  }
\end{table}
\myciteN{Lastname et al.}{Lastname2010title} present a technique.
\bibliography{\jobname}
\end{document}

and merely comment/uncomment the class line and one preamble line to switch between formats.

Related Question