[Tex/LaTex] Subfigure package misplaces last subfigure in full width environment

graphicssubfloats

I am using subfigure package along with pdflatex. My paper is in two columns, and sometimes I use a full width figure with subfigures:

\begin{figure*}
\subfigure[AM06]{\includegraphics[width=.25\textwidth]{AR06_RUN03_vort.png}}
\subfigure[AM07]{\includegraphics[width=.25\textwidth]{AR07_RUN03_vort.png}}
\subfigure[AM08]{\includegraphics[width=.25\textwidth]{AR08_run03_vort.png}}
\subfigure[AM09]{\includegraphics[width=.25\textwidth]{AR09_run03_vort.png}}
\subfigure[AM10]{\includegraphics[width=.25\textwidth]{AR10_run03_vort.png}}
\subfigure[AM11]{\includegraphics[width=.25\textwidth]{AR11_run03_vort.png}}
\subfigure[AM12]{\includegraphics[width=.25\textwidth]{AR12_run03_vort.png}}
\subfigure[AM13]{\includegraphics[width=.25\textwidth]{AR13_run03_vort.png}}
\end{figure*}

Subfigure wrong placement.

As you can see from the image, it places the last subfigure in the wrong position. Any ideas on how I can debug this?

Best Answer

If you want the last row to be justified, with subfigure (h) exactly below subfigure (e), then this is a way:

\documentclass[twocolumn]{article}
\usepackage{subfig} % not subfigure!!!
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure*}
\setlength{\lineskip}{1ex}% increase spacing
\subfloat[AM06]{\includegraphics[width=.25\textwidth]{AR06_RUN03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM07]{\includegraphics[width=.25\textwidth]{AR07_RUN03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM08]{\includegraphics[width=.25\textwidth]{AR08_run03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM09]{\includegraphics[width=.25\textwidth]{AR09_run03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM10]{\includegraphics[width=.25\textwidth]{AR10_run03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM11]{\includegraphics[width=.25\textwidth]{AR11_run03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM12]{\includegraphics[width=.25\textwidth]{AR12_run03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM13]{\includegraphics[width=.25\textwidth]{AR13_run03_vort.png}}
\end{figure*}

\end{document}

Note that subfigure has been obsolete for 15 years.

enter image description here

If you prefer the last two subfigures to be centered in the line, just add \centering to the code above:

\documentclass[twocolumn]{article}
\usepackage{subfig} % not subfigure!!!
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure*}
\centering
\setlength{\lineskip}{1ex}% increase spacing
\subfloat[AM06]{\includegraphics[width=.25\textwidth]{AR06_RUN03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM07]{\includegraphics[width=.25\textwidth]{AR07_RUN03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM08]{\includegraphics[width=.25\textwidth]{AR08_run03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM09]{\includegraphics[width=.25\textwidth]{AR09_run03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM10]{\includegraphics[width=.25\textwidth]{AR10_run03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM11]{\includegraphics[width=.25\textwidth]{AR11_run03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM12]{\includegraphics[width=.25\textwidth]{AR12_run03_vort.png}}%
\hspace{.125\textwidth}%
\subfloat[AM13]{\includegraphics[width=.25\textwidth]{AR13_run03_vort.png}}
\end{figure*}

\end{document}

enter image description here

A note about \lineskip.

When TeX forms a paragraph, it doesn't simply butt lines together, but inserts a vertical space between them, computed on the basis of the current value of \baselineskip. However, when the sum of the depth of a line with the height of the following line is more than \baselineskip, TeX inserts \lineskip.

In this case, due to the fact that all lines contain very high pictures, between any two lines in that single paragraph will have \lineskip between them. Increasing (locally) the value of \lineskip (default 1pt) does the trick of separating them.