1

I have trouble with figures in a two-column document of the class revtex4-1.

In my MWE I have two figures.

For a single column, the two figures are to high to be put one about the other. So the best solution would be to put the second figure in the next column.

However, Latex just leaves the next column completely blank and places the second figure on the next page:

enter image description here

How can I solve this?

Here is a MWE:

\documentclass[reprint,amsmath,amssymb,aps,]{revtex4-1}

\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{algpseudocode}

\begin{document}

\begin{figure}
\begin{algorithmic}
\ForAll{$\tau$}
  \ForAll{$\bm G \in \mathcal G_\text{this}$} 
\vspace{0.4em}
    \ForAll{$i\in\mathcal I$}
      \ForAll{$a\in \mathcal A_\text{this}$}
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
      \EndFor
    \EndFor
    \ForAll{$i\in \mathcal I$}
      \ForAll{$j \in \mathcal I_\text{this}\;,j\leq i$}
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
      \EndFor
    \EndFor
    \ForAll{$i\in \mathcal I$}
      \ForAll{$j \in \mathcal I_\text{this}\;,j\leq i$}
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
      \EndFor
    \EndFor
  \EndFor
\EndFor
\end{algorithmic}
\caption{Pseuocode of blablabla }
\end{figure}

\begin{figure}
\begin{algorithmic}
\ForAll{$\tau$}
  \ForAll{$\bm G \in \mathcal G_\text{this}$} 
\vspace{0.4em}
    \ForAll{$i\in\mathcal I$}
      \ForAll{$a\in \mathcal A_\text{this}$}
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
      \EndFor
    \EndFor
    \ForAll{$i\in \mathcal I$}
      \ForAll{$j \in \mathcal I_\text{this}\;,j\leq i$}
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
      \EndFor
    \EndFor
    \ForAll{$i\in \mathcal I$}
      \ForAll{$j \in \mathcal I_\text{this}\;,j\leq i$}
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
      \EndFor
    \EndFor
  \EndFor
\EndFor
\end{algorithmic}
\caption{Pseuocode of lululu }
\end{figure}

\end{document} 
  • If you add some text it works fine. Without text it goes into [p] mode. – John Kormylo Nov 19 '16 at 15:07
1

Alternatively, you can put two minipages into a full width figure.

\documentclass[reprint,amsmath,amssymb,aps,]{revtex4-1}

\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{algpseudocode}

\begin{document}

\begin{figure*}
\begin{minipage}[t]{\dimexpr 0.5\textwidth - 0.5\columnsep}
\begin{algorithmic}
\ForAll{$\tau$}
  \ForAll{$\bm G \in \mathcal G_\text{this}$} 
\vspace{0.4em}
    \ForAll{$i\in\mathcal I$}
      \ForAll{$a\in \mathcal A_\text{this}$}
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
      \EndFor
    \EndFor
    \ForAll{$i\in \mathcal I$}
      \ForAll{$j \in \mathcal I_\text{this}\;,j\leq i$}
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
      \EndFor
    \EndFor
    \ForAll{$i\in \mathcal I$}
      \ForAll{$j \in \mathcal I_\text{this}\;,j\leq i$}
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
        \State $XYZ$
      \EndFor
    \EndFor
  \EndFor
\EndFor
\end{algorithmic}
\caption{Pseuocode of blablabla }
\end{minipage}\hfill
\begin{minipage}[t]{\dimexpr 0.5\textwidth - 0.5\columnsep}
\begin{algorithmic}
\ForAll{$\tau$}
  \ForAll{$\bm G \in \mathcal G_\text{this}$} 
\vspace{0.4em}
    \ForAll{$i\in\mathcal I$}
      \ForAll{$a\in \mathcal A_\text{this}$}
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
      \EndFor
    \EndFor
    \ForAll{$i\in \mathcal I$}
      \ForAll{$j \in \mathcal I_\text{this}\;,j\leq i$}
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
      \EndFor
    \EndFor
    \ForAll{$i\in \mathcal I$}
      \ForAll{$j \in \mathcal I_\text{this}\;,j\leq i$}
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
        \State $ABC$
      \EndFor
    \EndFor
  \EndFor
\EndFor
\end{algorithmic}
\caption{Pseuocode of lululu }
\end{minipage}
\end{figure*}

\end{document} 

full page

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.