Phaune
Phaune

Reputation: 25

LATEX skips numbers in numbering when putting several figures in the same figure environment

Here are the package I am using:

\documentclass[twocolumn,showpacs,preprintnumbers,amsmath,amssymb,superscriptaddress]{revtex4}
\usepackage{graphicx}
\usepackage{bm} 
\usepackage{subcaption}
\usepackage{SIunits} 
\captionsetup{justification=raggedright, singlelinecheck=false}
\bibliographystyle{approve}  

In order to put two figures next to each other, using the full width of the page even with the twocolumn option, I use this syntax:

\begin{figure*}
\centering
    \begin{subfigure}[b]{0.5\textwidth}
            \includegraphics[width=\textwidth]{mfploglog_A.eps}
    \end{subfigure}%
    \begin{subfigure}[b]{0.5\textwidth}
            \includegraphics[width=\textwidth]{mfploglog.eps}
    \end{subfigure}
    \caption{XXX}\protect\label{Eloglog}
\end{figure*}   

The probleme is that using this the numbering is incorrect. For each figure, a number is skipped as if the subfigure environment was counting as one figure. For example if I put just this figure in my code, it is going to be labeled as figure number 2.

Does someone already encountered this kind of problem ?

Upvotes: 1

Views: 8645

Answers (1)

Werner
Werner

Reputation: 15065

Don't use the caption package (or subcaption) with revtex4-1. You'll note in the .log that there are compatibility issues between the package and the class. Instead, place the two images side-by-side in the same figure* without using a subfigure environment:

enter image description here

\documentclass[twocolumn,showpacs,preprintnumbers]{revtex4-1}

\usepackage{graphicx}

\begin{document}

\begin{figure*}
  \centering
  \includegraphics[width=.3333\linewidth]{example-image-a} \qquad
  \includegraphics[width=.3333\linewidth]{example-image-b}
  \caption{XXX}
\end{figure*}

\end{document}

If you wish to add captions to the sub-figures, set the construction inside a tabular and enumerate them manually:

enter image description here

\documentclass[twocolumn,showpacs,preprintnumbers]{revtex4-1}

\usepackage{graphicx}

\begin{document}

\begin{figure*}
  \centering
  \begin{tabular}{c @{\qquad} c }
    \includegraphics[width=.3333\linewidth]{example-image-a} &
    \includegraphics[width=.3333\linewidth]{example-image-b} \\
    \small (a) Left & \small (b) Right
  \end{tabular}
  \caption{XXX}
\end{figure*}

\end{document}

Upvotes: 3

Related Questions