1

I'm trying to change the standard footer of the scrlttr2 class from {page no.} to Page {page no.} of {total}. While searching for a way to do this, I found out that the current accepted method for KOMA classes is to use the scrlayer-scrpage package. However, loading that package raises the following error:

! Missing = inserted for \ifnum.
<to be read again> 
                   \z@ 
l.7 \end{letter}

Here is the really minimal (non-)working example used to create this error:

\documentclass{scrlttr2}
\usepackage{scrlayer-scrpage}

\begin{document}
\begin{letter}{}
This is a MWE.
\end{letter}
\end{document}

Any suggestions? Are scrlttr2 and scrlayer-scrpage incompatible or could something be wrong with my package (versions)?

1
  • 2
    Works for me. Could you please check if your distribution is up-to-date?
    – TeXnician
    Aug 29, 2017 at 16:10

1 Answer 1

2

Your example does work with old KOMA-Script 3.22, current KOMA-Script release 3.23 or current KOMA-Script prerelease. Nevertheless, you do not need scrlayer-scrpage to change the page mark, you only need to redefine command \pagemark:

\documentclass{scrlttr2}
\usepackage{mwe}
\renewcommand*{\pagemark}{\usekomafont{pagenumber}{\thepage\ of
    \letterlastpage}}
\setkomavar{firstfoot}{\centering \pagemark}
\begin{document}
\begin{letter}{You\\There}
  \opening{Hello,}
  \lipsum
  \closing{Bye}
\end{letter}
\end{document}

enter image description here

Or if you prefer

enter image description here

add

\makeatletter
\@setplength{firstfootvpos}{\dimexpr 1in+\topmargin+\headheight+\headsep+\textheight+\footskip\relax}
\makeatother

to the document preamble.

1
  • Thanks, I was using KOMA v3.12. Updating to the current version solved the problem, but your solution also seems to work. Aug 30, 2017 at 16:18

You must log in to answer this question.

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