1

I'm using "\onecolumngrid ... \twocolumngrid" to accommodate a wide figure in Revtex4-2. However, the text that follows the "\twocolumngrid" command is positioned incorrectly and messes up the reading order (down from the top and from the left column to the right column), see MWE attached below.

How can this be fixed?

\documentclass[prd,amsmath,superscriptaddress,twocolumn,eqsecnum,nofootinbib]{revtex4-2}
\interfootnotelinepenalty=10000
\pdfoutput=1

\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{times}
\usepackage{lipsum}  
\usepackage[caption=false]{subfig} 

\begin{document}

\lipsum[1-8]

\onecolumngrid

\begin{figure}[htpb]
    \subfloat[{Caption A.}]{%
        \includegraphics[width=.485\linewidth]{example-image}%
    }\hfill
    \subfloat[{Caption B.}]{%
        \includegraphics[width=.485\linewidth]{example-image}%
    }\\
    \subfloat[{Caption C.}]{%
        \includegraphics[width=.485\linewidth]{example-image}%
    }\hfill
    \subfloat[{Caption D.}]{%
        \includegraphics[width=.485\linewidth]{example-image}%
    }
    \caption{Main caption.} 
\end{figure}
\twocolumngrid

\textcolor{red}{The text following the figure is positioned incorrectly.}

\lipsum[1]

\end{document}

2 Answers 2

2

Try to use figure* and remove \onecolumngrid and \twocolumngrid like as is done in the following MWE:

\documentclass[prd,amsmath,superscriptaddress,twocolumn,eqsecnum,nofootinbib]{revtex4-2}
\usepackage{lipsum}

\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{times}
\usepackage[caption=false]{subfig}

\begin{document}
\lipsum[1-8]

%\onecolumngrid
\begin{figure*}
    \subfloat[{Caption A.}]{%
        \includegraphics[width=.485\linewidth]{example-image}%
    }\hfill
    \subfloat[{Caption B.}]{%
        \includegraphics[width=.485\linewidth]{example-image}%
    }\\
    \subfloat[{Caption C.}]{%
        \includegraphics[width=.485\linewidth]{example-image}%
    }\hfill
    \subfloat[{Caption D.}]{%
        \includegraphics[width=.485\linewidth]{example-image}%
    }
    \caption{Main caption.}
\end{figure*}
%\twocolumngrid

\textcolor{red}{\lipsum[1-5]}
\end{document}

enter image description here

Is the above result what you after?

Addendum: For referencing you should do the following:

  1. insert labels in figure accordingly as is done in the following MWE (they should be after captions or inside then!)

  2. In text use `\ref{}

  3. Compile MWE at least twice:

\documentclass[prd,amsmath,superscriptaddress,twocolumn,eqsecnum,nofootinbib]{revtex4-2}
\usepackage{lipsum}

\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{times}
\usepackage[caption=false]{subfig}

\begin{document}
\lipsum[1-8]

%\onecolumngrid
\begin{figure*}
    \subfloat[{Caption A.}  \label{subfig:a}]{%
        \includegraphics[width=.485\linewidth]{example-image}%
    }\hfill
    \subfloat[{Caption B.}  \label{subfig:ab}]{%
        \includegraphics[width=.485\linewidth]{example-image}%
    }\\
    \subfloat[{Caption C.}  \label{subfig:c}]{%
        \includegraphics[width=.485\linewidth]{example-image}%
    }\hfill
    \subfloat[{Caption D.}  \label{subfig:d}]{%
        \includegraphics[width=.485\linewidth]{example-image}%
    }
    \caption{Main caption.}
    \label{fig:ABCD}
\end{figure*}
%\twocolumngrid

See figure \ref{fig:ABCD} on page \pageref{fig:ABCD}, specially subfigure \ref{subfig:c} \dots

\textcolor{red}{\lipsum[1-5]}

See figure \ref{fig:ABCD}, specially subfigure \ref{subfig:c} \dots

\end{document}

enter image description here

3
  • Thanks, this does fix the issue with the text. However, now I cannot seem to reference the figure in the text using "\label{}" and "\ref{}". Is it possible to fix the text positioning while keeping the possibility of referring to the figure in the text alive? Commented May 9 at 9:05
  • Oh, referencing works, For sure 😉. However, you need to insert labels in a figure accordingly and then use `\ref{<label name>}. See addendum to answer,
    – Zarko
    Commented May 9 at 9:46
  • Thank you so much! Commented May 9 at 10:17
1

The text is being balanced correctly, it does look weird but that's because you are asking REVTeX to do something a bit weird.

\onecolumngrid takes all the text above it and balances it into two columns, then starts a one column stretch. The figure environment then creates a float which then gets placed where—based on the specifiers—LaTeX can fit it (see How to influence the position of float environments like figure and table in LaTeX?). Importantly the figure is not necessarily immediately placed, in this case being large LaTeX finds the top of the next page to be the first place it fits. Nothing else is printed in the onecolumn stretch and then \twocolumngrid starts a new stretch.

This is easier to see if you highlight all the text after the \twocolumngrid, there are two correctly balanced black columns which run two thirds of the way down the page, followed by two correctly balanced red columns filling the rest of the height. Without any visual cue it can be very easy to mistakenly assume the column runs the whole height of the page.

\documentclass[prd,amsmath,superscriptaddress,twocolumn,eqsecnum,nofootinbib]{revtex4-2}
\interfootnotelinepenalty=10000
\pdfoutput=1

\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{times}
\usepackage{lipsum}  

\begin{document}

\lipsum[1-8]

\onecolumngrid

\begin{figure}[htpb]
    \includegraphics[width=0.9\linewidth]{example-image}
    \caption{Main caption.} 
\end{figure}

\twocolumngrid

\color{red} \lipsum[1]

\end{document}

compiled code showing two columns of text, the bottom half of both coumns are in red font

When adding a brief single column interruption to a two column text in revtex it can be better to use the widetext environment, which adds visual indicators and forces more vertical space.

\lipsum[1-8]

\begin{widetext}

\begin{figure}[htpb]
    \includegraphics[width=0.9\linewidth]{example-image}
    \caption{Main caption.} 
\end{figure}

\end{widetext}

\color{red} \lipsum[1]

compiled code showing two columns of text, the bottom half of both coumns are in red font with a gap and lines indicating a visual separation between the black and red text

In this case there is still nothing inside the widetext as the figure still floats. Depending what you actually want, you either need to stop the figure floating so it appears inside the \onecolumngrid or widetext (sometimes an h float specifier will suffice but, as in this MWE, it cannot always be relied upon), or allow it to float as a two column figure using figure* as already noted in another answer here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .