# \newpage stays in right column

I am using RevTEX 4.1 with the following parameters:

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


This gives a two-column layout with a balanced two-column bibliography at the end. I would like to add an appendix with code listings and figures after the bibliography. After trying out several ways of using \pagebreak, \newpage and \clearpage and some odd combinations of switching to \onecolumngrid and back, I found this neat macro to actually get the page break without messing with the balanced bibliography.

However, whichever way I use for the page break, the new page starts in the right column. It's as if the page break would not reset the column in which to typeset.

Is this a known behavior/problem that I am just unable to google? Am I totally misunderstanding something about LaTeX's two-page concept?

PS: Oddly enough, if I add a figure of a certain size after the section heading on the new page, it seems to push things back into the left column. But this only happens if I choose the size of the figure such that it fits in one column, but it's caption does not (and place it with h!).

MWE:

\documentclass[aps,prb,reprint]{revtex4-1}
\usepackage{lipsum}

\makeatletter
\newcommand*{\balancecolsandclearpage}{%
\close@column@grid
\clearpage
\twocolumngrid
}
\makeatother

\begin{document}

\lipsum[1-4]

\balancecolsandclearpage

This text is in the right column.

%\begin{figure}[h!]%
%test
%\caption{test}%
%\label{}%
%\end{figure}

\end{document}


Any other way of breaking the page while keeping the balanced columns (like \onecolumngrid\newpage\twocolumngrid) leads to the same behavior. Now if you uncomment that float, the This text is in the right column will move to the left column and the float will appear in the right column. This behavior is slightly different from my actual project, because there this only happens for a certain height of the float. But I think if I just could find out why the normal text continues in the right column in the first place that should solve my problem anyway.

-
Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Jubobs Mar 20 '13 at 20:50
@Jubobs sure, there you go –  Martin Büttner Mar 20 '13 at 21:06

I don't quite understand what causes the problem, but apparently it has something to do with the fact that your text is a single line which cannot be accomodated in two columns, and somehow TeX decides that, since it has to go in a single column, better to the right.

As soon as you add a second line to that page, the problem vanishes (although the result is far from optimal, imho:

\documentclass[aps,prb,reprint]{revtex4-1}
\usepackage{lipsum}
\makeatletter
\newcommand*{\balancecolsandclearpage}{%
\close@column@grid
\cleardoublepage
\twocolumngrid
}
\makeatother
\begin{document}
\lipsum[1-4]
\balancecolsandclearpage

This text is in the right column. But I added more text so that at least two
lines are required.
\end{document}


The problem gets solved if you put a \clearpage after the contents of the last page:

\documentclass[aps,prb,reprint]{revtex4-1}
\usepackage{lipsum}
\makeatletter
\newcommand*{\balancecolsandclearpage}{%
\close@column@grid
\cleardoublepage
\twocolumngrid
}
\makeatother
\begin{document}
\lipsum[1-4]
\balancecolsandclearpage

This text is in the right column. But I added more text so that at least two
lines are required.
\clearpage
\end{document}


It also works when there is a single line, like in your original question. Perhaps it could be a good idea to put \AtEndDocument{\clearpage} in your preamble.

-
Oh wow, I'm feeling a bit stupid now for not typing at least a second line. This is apparently simply how the column-balancing algorithm decides to handle a single line. If I only write a single line in the entire document, it also ends up in the right column. And thanks for the AtEndDocument tip, but I'll rather handle it manually, so that the column balancing works (as I will probably have more than one line in the final document) –  Martin Büttner Mar 21 '13 at 0:32
Hm, I think in my actual document that section after the page break will contain only floats - which don't cause the balancing algorithm to move anything into the left column. If I add a filler line before the first float, it works better, but the caption of the first float ends up in the right column (while the float goes to the left). Do you happen to know whether there is any solution to this? –  Martin Büttner Mar 22 '13 at 11:35