# Resize figures using subfloat environment in elsarticle class

I was working with the elsarticle class and subfig package for my article and I used the subfloat environment to include two pictures. However, the scaling of the pictures is completely wrong and the figures simply appear huge.

Observations:

1. No matter what value I use in the \scalebox{} argument, the figures are always blown out of proportion. In fact, changing the parameter of \scalebox{} seems to have no effect on the size of the image.
2. Simply changing the class to article from elsarticle ensures that the figures are properly scaled.
3. This problem with the image sizes occurs only if I use pdfLaTex, compiling with XeLaTex totally eliminates this problem, but I cannot use XeLaTex as the document is to be submitted to ArXiv.

So, is there some definite way to resize figures in the subfloat environment in the elsarticle.cls class? My minimal working example is provided below (although this produces the scaling error discussed above).

\documentclass[preprint, 3p, number]{elsarticle}
\usepackage[dvips]{color}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage[font=footnotesize,labelfont=bf]{caption}
\begin{document}
\begin{frontmatter}
\end{frontmatter}

\section{Section 1}
\begin{figure} [H]
\begin{raggedleft}
\subfloat[]{\scalebox{0.29}{\includegraphics{Rectangle.pdf}}}
\subfloat[]{\scalebox{0.29}{\includegraphics{Circle.pdf}}}
\end{raggedleft}
\caption{The figures to be shown }
\label{A1E}
\end{figure}
\begin{thebibliography}{99}
\end{thebibliography}
\end{document}


I am really very confused about this and any help in this regard would be greatly appreciated. Thank you so much.

• Why you are using [dvips] to color? Remove it and then try. You can also use \includegraphics[width=1cm]{....} with 1cm as you need. – user11232 Apr 5 '14 at 13:00
• @HarishKumar Removing the [dvips] seems to resolve the problem. I was using [dvips] as I had a few PostScript files, but I believe it will be easier to convert them to PDF. Thank you so much for your prompt response. – ACuriousMind Apr 5 '14 at 13:02

As far as I can tell from your write-up, you don't require any of the capabilities of the subfig package; you simply have one figure that shows two images, right? If that's the case, just leave off the \subfig wrappers and state the widths of the graphs as fractions of the overall text width, rather than as a fraction of the original design size. Separately, unless you're compiling to a .dvi file, do replace \usepackage[dvips]{color} with \usepackage[pdftex]{color}.

\RequirePackage[demo]{graphicx} % just for this example
\documentclass[preprint, 3p, number]{elsarticle}
\usepackage[pdftex]{color}
\usepackage[font=footnotesize,labelfont=bf]{caption}
\begin{document}
\begin{figure}
\includegraphics[width=0.48\textwidth]{Rectangle.pdf}
\hspace*{\fill}
\includegraphics[width=0.48\textwidth]{Circle.pdf}
\caption{The figures to be shown } \label{A1E}
\end{figure}
\end{document}


Addendum: If you do need separate subfigures within the overall figure, I would suggest you use the subcaption package (and its subfigure environment) as you're already loading the caption package.

\RequirePackage[demo]{graphicx} % just for this example
\documentclass[preprint, 3p, number]{elsarticle}
\usepackage[pdftex]{color}
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage[font=footnotesize,labelfont=bf]{subcaption}
\begin{document}
\begin{figure}
\begin{subfigure}{0.48\textwidth}
\includegraphics[width=\linewidth]{Rectangle.pdf}
\caption{Caption of first subfigure}
\end{subfigure}
\hspace*{\fill}
\begin{subfigure}{0.48\textwidth}
\includegraphics[width=\linewidth]{Circle.pdf}
\caption{Caption of second subfigure}
\end{subfigure}
\caption{The figures to be shown} \label{A1E}
\end{figure}
\end{document}


You don't have to specify the drivers specifically as most compilers detect them by themselves. Hence remove [dvips] option from \usepackage[dvips]{color}. Then things work. Also you can use width key of \includegraphics to change the width.

\documentclass[preprint, 3p, number]{elsarticle}
\usepackage{color}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage[font=footnotesize,labelfont=bf]{caption}
\begin{document}
\begin{frontmatter}
\end{frontmatter}

\section{Section 1}
\begin{figure} [H]
%\begin{raggedleft}    %% not needed
\hfill
\subfloat[]{\scalebox{0.39}{\includegraphics{example-image}}}
\hfill
\subfloat[]{\scalebox{0.29}{\includegraphics{example-image-a}}}
%\end{raggedleft}
\hfill
\subfloat[]{\includegraphics[width=1cm]{example-image-b}}
\caption{The figures to be shown }
\label{A1E}
\end{figure}
\begin{thebibliography}{99}
\end{thebibliography}
\end{document}