I don't think that it would be possible to do this easily using the current set of tools (gnuplot
and epslatex
). The reason is that depending on the dimensions and font size of the final LaTeX document, you would need to calculate manually the dimensions and the font size of the figures.
What you require can be easily accomplished using pgfplots
, which is a LaTeX package so that all the code for drawing graphics can be included into your .tex
file. See example below where the figure naturally fills up the column width of the document and uses the same font size.
The process which I use to generate graphs is the following:
- Run experiments using program of choice, output text file
- Use
pgfplots
to write LaTeX code in main .tex
file to plot graph
See the section "Reading coordinates from tables" of the pgfplots manual for more information.
\documentclass[5p]{elsarticle}
\usepackage{lipsum}
\usepackage{pgfplots}
\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzpicture}
\begin{axis}[
width=\columnwidth,
xlabel=$x$,
ylabel=$y$,
legend pos=north west]
\addplot {x^3};
\addlegendentry{$y = x^3$};
\end{axis}
\end{tikzpicture}
\end{figure}
\lipsum[1-2]
\end{document}

\documentclass[3p]{elsarticle}
\usepackage{lipsum}
\usepackage{pgfplots}
\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzpicture}
\begin{axis}[
width=\columnwidth,
xlabel=$x$,
ylabel=$y$,
legend pos=north west]
\addplot {x^3};
\addlegendentry{$y = x^3$};
\end{axis}
\end{tikzpicture}
\end{figure}
\lipsum[1-2]
\end{document}

Best Answer
Since this seems like a one-off deal, just update the
table
counter and add the "sub-counter":The lines commented out are just in case you use
hyperref
. It adds a modification to\theHtable
, in order to avoid duplicate destinations from stepping thetable
counter backwards.