2

I'm currently creating a two columned article. My document class is given by:

\documentclass[10pt, aps, prb, twocolumn]{revtex4-1}

In my article I would like to include figures. The way I do this is the following:

\begin{figure}[h]
\centering
\includegraphics[width=1.0\linewidth]{Figures/Figure 4.pdf}
\caption{Figure caption \label{fig:Figure_4}}
\end{figure}

The package I use for the figures is:

\usepackage{graphicx}

Note that I use the figure float h. This enables me to place the figure basically exactly where I want. The problem however is that it is now placed such that the figures is on the lower left side of my two columned article whereas the caption of this figure is at the upper right side on the second column.

How can I ensure a non break space between figure and caption when using figure float h?

Here is a minimal example that replicates the problem:

enter image description here

\documentclass[10pt, aps, prb, twocolumn]{revtex4-1}
\usepackage{graphicx,lipsum}

\begin{document}

\lipsum[2]\lipsum[2]\lipsum[2]
\begin{figure}[h]
  \centering
  \includegraphics[width=1.0\linewidth]{example-image}
  \caption{Figure caption}
\end{figure}
\lipsum[2-5]
\end{document}
  • So what do you want the output to look like? Should the figure move over to the second column, or should the caption move over to the first column? Regardless, things will look messy. It also won't really help (I think) if you have the float totally at the top of the second column, unless you leave a noticeable gap between the caption and the text to clearly separate the float of text. – Werner Jun 4 '14 at 23:10
  • I would like to place the figure and caption as close to my figure float h as possible given there is enough space for the two of them. In this case, and in general I guess, this would mean that both should appear in the second column. This is because in the first column there just isn't enough space for the caption. – The Dude Jun 4 '14 at 23:42
  • See what issuing \break before the figure gives you. Then also look at the difference with \raggedbottom\break. Those are the two crude options. – Werner Jun 4 '14 at 23:45
  • If you are willing to add this macro below into your preamble and change \begin/\end{figure} to \begin/\end{figurehere} without the [h] sepecifier, the problem will go. \makeatletter \newenvironment{figurehere} {\def\@captype{figure}} {} \makeatother – Jesse Jun 5 '14 at 7:43
  • 1
    This appears to be a bug in revtex, figure environments should never break. – David Carlisle Jun 5 '14 at 8:36
4

This is a bug in revtex: figures should never break like that, you can work-around it by adding a minipage. Also never use [h] LaTeX normally warns about that and changes it to [ht] but better to include p as otherwise going to the end of the document is the most likely result,

\documentclass[10pt, aps, prb, twocolumn]{revtex4-1}
\usepackage{graphicx,lipsum}

\begin{document}

\lipsum[2]\lipsum[2]\lipsum[2]
\begin{figure}[htp]
\begin{minipage}{\linewidth}
  \centering
  \includegraphics[width=1.0\linewidth]{example-image}
  \caption{Figure caption}
\end{minipage}
\end{figure}
\lipsum[2-5]
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.