# Same pgfplots within standalone for usage in elsarticle and revtex4-1

Suppose I have created a plot with pgfplots for a scientific paper.

However, for usual reasons the targeted journal is not certain. Possibly the plot has to be adjusted to match different journals (consider here revtex4-1 and elsarticle). This includes font type, font sizes, columnwidths/textwidths.

For instance, the values of the \columnwidth differ:

% \documentclass[preprint,5p,twocolumn,12pt]{elsarticle}
\the\columnwidth=252.0pt
% \documentclass[aps,final,pre,twocolumn,10pt]{revtex4-1}
\the\columnwidth=246.0pt


I have considered the package standalone:

plot.tex:

\documentclass[class=elsarticle,5p,twocolumn,12pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=\columnwidth,
title=Inv. cum. normal,
xlabel={$x$},
ylabel={$y$},
]
\end{axis}
\end{tikzpicture}
\end{document}


paper.tex:

\documentclass[preprint,5p,twocolumn,12pt]{elsarticle}
\usepackage{lipsum}
\usepackage{graphicx}
\begin{document}
\setlength{\parindent}{0ex}
\lipsum[1]\vspace*{2ex}
\begin{figure}
\centering
\includegraphics{plot}
\caption{interesting results}
\end{figure}
\vspace*{2ex}\lipsum[2]
\end{document}


After the paper got rejected :(, the documentclass gets changed.

paper.tex

\documentclass[final,aps,pre,twocolumn,10pt]{revtex4-1}


plot.tex

\documentclass[class=revtex4-1,final,aps,pre,twocolumn,10pt]{standalone}


For some reason standalone fails to accept as class option revtex4-1.

What would be a good workflow to minimize the workload using pdflatex without using dvi-eps path. Quantities, which should be available to plotting, are font size, \columnwidth and \textwidth.

Related questions:

You can use \includestandalone from standalone package (requires -shell-escape).

plot.tex:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=\columnwidth,
title=Inv. cum. normal,
xlabel={$x$},
ylabel={$y$},
]
\end{axis}
\end{tikzpicture}
\end{document}


Then in elsarticle:

\documentclass[preprint,twocolumn,12pt]{elsarticle}
\usepackage{lipsum}
\usepackage{graphicx}
%\usepackage{pgfplots}
%\pgfplotsset{compat=1.5}
\usepackage[subpreambles=true]{standalone}
\begin{document}
\setlength{\parindent}{0ex}
\lipsum[1]\vspace*{2ex}
\begin{figure}
\centering
\includestandalone[mode=buildnew]{plot}
%\includegraphics{plot}
\caption{interesting results}
\end{figure}
\vspace*{2ex}\lipsum[2]
\end{document}


And in revtex4-1

\documentclass[final,aps,pre,twocolumn,10pt]{revtex4-1}
\usepackage{lipsum}
\usepackage{graphicx}
%\usepackage{pgfplots}
%\pgfplotsset{compat=1.5}
\usepackage[subpreambles=true]{standalone}
\begin{document}
\setlength{\parindent}{0ex}
\lipsum[1]\vspace*{2ex}
\begin{figure}
\centering
\includestandalone[mode=buildnew]{plot}
%\includegraphics{plot}
\caption{interesting results}
\end{figure}
\vspace*{2ex}\lipsum[2]
\end{document}


Now, for curiosity, try with a big font size and different font.

\documentclass[18pt]{scrartcl}
\usepackage{lipsum}
\usepackage{mathpazo}
\usepackage{graphicx}
%\usepackage{pgfplots}
%\pgfplotsset{compat=1.5}
\usepackage[subpreambles=true]{standalone}
\begin{document}
\setlength{\parindent}{0ex}
\lipsum[1]\vspace*{2ex}
\begin{figure}
\centering
\includestandalone[mode=buildnew]{plot}
%\includegraphics{plot}
\caption{interesting results}
\end{figure}
\vspace*{2ex}\lipsum[2]
\end{document}


• @Kumar: Thank you for your answer. However, when I submit a paper I like to keep the number of required packages small. I would prefer paper.tex does not have to know about standalone and I don't have to adjust the file for submission. Do you know how one could achieve this? May 10 '15 at 6:16
• @Hotschke Not any of that I am aware of. You may remove those packages at very last stage before submitting.
– user11232
May 10 '15 at 8:41
• To my knowledge, journals usually prefer to receive the figures as graphics files (eg .eps), instead of .tex Jan 28 '19 at 14:00