[texhax] Misplaced footer with multicol and fancyhdr
Ulrike Fischer
news3 at nililand.de
Thu Mar 31 14:05:12 CEST 2016
Am Wed, 30 Mar 2016 16:29:10 +0900 schrieb Hironobu YAMASHITA:
> I see footers with fancyhdr.sty (March 22, 2005, v3.2) are
> wrongly shifted toward the upper direction in the mulitcols
> env defined in the latest multicol.sty (2015/08/19 v1.8n).
> I had no problem with multicol.sty v1.8i in TL2014.
>
> %#!pdflatex
> \documentclass[a5paper]{article}
> \usepackage{lipsum}
> \usepackage{multicol} % v1.8n
> \usepackage{fancyhdr} % v3.2
> \pagestyle{fancy}
> \cfoot{Page\\\thepage}
> \begin{document}
> \lipsum[1-3]
> \begin{multicols}{2}
> \lipsum[4-8]
> \end{multicols}
> \lipsum[9-10]
> \end{document}
>
> This behavior is due to the change in multicol.sty between
> v1.8i and v1.8j, which adds \boxmaxdepth\maxdepth in the
> definition of \multi at column@out. It seems that \boxmaxdepth
> has affected not only splitting routine itself but also
> routines _between_ splitting (such as header and footer).
>
> Is this a bug in fancyhdr.sty, or in multicol.sty? Or am I
> doing something wrong?
Imho is it a fancyhdr bug. It sets the footer in a \vbox and simply
assumes that \boxmaxdepth is large enough. But when someone (in this
case multicol) change \boxmaxdepth the depth of the \vbox is changed
and so it moves up.
You should make a bug report.
As a workaround you can locally change \boxmaxdepth to some larger
value by adding some code to \fancy at reset:
\documentclass[a5paper]{article}
\usepackage{lipsum}
\usepackage{multicol} % v1.8n
\usepackage{fancyhdr} % v3.2
\pagestyle{fancy}
\cfoot{Page\\\thepage}
\usepackage{etoolbox}
\makeatletter
\appto\fancy at reset{\boxmaxdepth=\maxdimen} %or some other large
\makeatother
\begin{document}
\lipsum[1-3]
\begin{multicols}{2}
\lipsum[4-8]
\end{multicols}
\lipsum[9-10]
\end{document}
--
Ulrike Fischer
http://www.troubleshooting-tex.de/
More information about the texhax
mailing list