# Which section in the header with twocolumn book?

I'm wondering about the logic behind which section name is displayed in the header with a twocolumn book. My MWE:

\documentclass[twocolumn]{book}

\usepackage{lipsum}

\begin{document}

\chapter{Foo}

\section{Bar}
\lipsum[1-15]

\section{Baz}
\lipsum[6]

\section{Qux}
\lipsum[7]

\section{Quux}
\lipsum[8]

\section{Quuux}
\lipsum[9]

\end{document}


As you can see, the first section Bar spans pages 1 and 2 and parts of page 3. Then, on page 3, there are three sections Baz, Qux, and Quux. The header of page 3 contains the header QUX which is the title of the first section in the second column.

I didn't expect this. Why not one of the other section titles? What is the logic behind this? How could I make the title of the last section be displayed in the header?

-

The logic is that the heading is the first section that starts on the page.

Er except LaTeX gets the logic wrong in twocolumn mode as internally the two columns are handled (more or less) as two pages joined together at the end, and it doesn't save enough information from the first column, so....

... the actual logic behind the behaviour is that you can't change something after decades of use, as people rely on it. If you add \usepackage{fixltx2e} it will work as intended.

That gives first sections (BAZ here), if you wanted to change things to get last, that's also possible but may require more extensive changes especially in 2col mode, unless one of the heading packages has this ready packaged up.

-
Thanks for the pointer to fixltx2e. "Nevertheless, there are problems in LaTeX that it “would be nice” to correct" :) –  user10883 Jan 30 '12 at 11:04
@Tichodroma: That's why LaTeX3^W ConTeXt exists. :) –  Martin Schröder Jan 30 '12 at 20:16