5

I am experiencing a very strange issue. I am using scrlayer-scrpage to generate headers and footers. For headers, everything works great, but for footers, on every next page the footer height is getting larger (see example). What could be the reason for this?..

\documentclass{scrartcl}

\usepackage[headsepline]{scrlayer-scrpage}
\ifoot[\the\footheight\quad\rule{2px}{\footheight}]{\the\footheight\quad\rule{2px}{\footheight}}

\usepackage{lipsum}
\title{test}

\begin{document}

\lipsum[1-40]

\end{document}

enter image description here

1 Answer 1

5

\footheight is total height of the foot, including height (space above the baseline) and depth (space below the baseline) of the foot.

Your rule starts on the baseline. So the height of the foot must be at least the height of your rule plus the depth of a \strutbox. Therefore scrlayer-scrpage enlarges the former \footheight by \dp\strutbox. On the next page your rule starts again on the baseline and so scrlayer-scrpage enlarges the\footheight from the last page by \dp\strutbox again ...

You can shift the rule down by \dp\strutbox:

\documentclass{scrartcl}
\usepackage[headsepline]{scrlayer-scrpage}

\ifoot*{\the\footheight\quad\rule[-\dp\strutbox]{2px}{\footheight}}

\usepackage{lipsum}
\begin{document}
\lipsum[1-40]
\end{document}

enter image description here

Or you have to shorten the rule \dp\strutbox

\documentclass{scrartcl}
\usepackage[headsepline]{scrlayer-scrpage}

\ifoot*{\the\footheight\quad\rule{2px}{\dimexpr\footheight-\dp\strutbox\relax}}

\usepackage{lipsum}
\begin{document}
\lipsum[1-40]
\end{document}

enter image description here

Or you can hide the height of the rule using \smash

\documentclass{scrartcl}
\usepackage[headsepline]{scrlayer-scrpage}

\ifoot*{\the\footheight\quad\smash{\rule{2px}{\footheight}}}

\usepackage{lipsum}
\begin{document}
\lipsum[1-40]
\end{document}

enter image description here


Note that

\ifoot*{\the\footheight\quad\rule[-\dp\strutbox]{2px}{\footheight}}

is a short version of

\ifoot
  [{\the\footheight\quad\rule[-\dp\strutbox]{2px}{\footheight}}]
   {\the\footheight\quad\rule[-\dp\strutbox]{2px}{\footheight}}
2
  • Thank you! This makes sence, I was not aware of this behaviour. Now, I solved the problem by just defining the height of logos (which I'm actually using insteas the rule) by 'em', which is OK. But now, I'm facing following issue: on the 'first' page, I have large logo in the header, so it is increased for all the rest of the document, and vice versa in the footer I'm using on all the other pages a bit larger footer. Is there a possibility to separately define approproate header and footer height for the 'first' and the following pages, so scrlayer-scrpage does not complain and everything fits?
    – Cupora
    Commented Jul 14, 2016 at 13:19
  • Please ask a new question with a new minimal working example. There you can use example-image instead your logos. Is the first page a title page? And if your oiriginal problem here is solved, you could accept the answer.
    – esdd
    Commented Jul 14, 2016 at 13:24

You must log in to answer this question.

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