[Tex/LaTex] Resize figures using subfloat environment in elsarticle class

captionselsarticlesubfloats

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}
\qquad \quad
\subfloat[]{\scalebox{0.29}{\includegraphics{Rectangle.pdf}}}
\qquad\qquad
\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.

Best Answer

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

enter image description here

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

enter image description here

\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}