1

This questions explains how you can show the total page number of your document in the footer on each page, i.e. show a “page # of ##” instead of the default “page # of #”.

However, even though someone asked for that in the comments, it does not explain how to do that in a KOMA class. It has been suggested to ask a new question.

I use scrartcl for a letter (and load scrletter), so I'd like to do the same here. So how can I do it there?

The previous question has been asked about scrlttr2 but the best solution there does not work in this case. See example below.

Example code:

\documentclass{scrartcl}
\usepackage{scrletter}

\renewcommand*\pagemark{% \usekomafont{pagenumber}{\pagename~\thepage~of~\letterlastpage}% }

\usepackage{xpatch} \xpatchcmd{\opening}{\thispagestyle{empty}}{\thispagestyle{plain}}{}{\PatchFailed} \KOMAoptions{firstfoot=false}% disable first footer

\usepackage{lipsum} \begin{document} \begin{letter}{Jerry Garcia\710 Ashbury St\San Francisco\CA 94117} \opening{Dear Friend,} \lipsum\lipsum \end{letter}

\begin{letter}{Jerry Garcia\710 Ashbury St\San Francisco\CA 94117} \opening{Dear Friend,} \lipsum\lipsum \end{letter} \end{document}

esdd
  • 85,675
rugk
  • 1,090
  • 1
  • 10
  • 27

1 Answers1

2

With package scrletter you have to redefine \letterpagemark:

\renewcommand*\letterpagemark{%
  \usekomafont{pagenumber}{\pagename~\thepage~of~\letterlastpage}%
}

Example:

\documentclass{scrartcl}
\usepackage{scrletter}

\renewcommand*\letterpagemark{% \usekomafont{pagenumber}{\pagename~\thepage~of~\letterlastpage}% }

\usepackage{xpatch} \xpatchcmd{\opening}{\thispagestyle{empty}}{\thispagestyle{plain}}{}{\PatchFailed} \KOMAoptions{firstfoot=false}% disable first footer

\usepackage{lipsum} \begin{document} \begin{letter}{Jerry Garcia\710 Ashbury St\San Francisco\CA 94117} \opening{Dear Friend,} \lipsum\lipsum \end{letter}

\begin{letter}{Jerry Garcia\710 Ashbury St\San Francisco\CA 94117} \opening{Dear Friend,} \lipsum\lipsum \end{letter} \end{document}

Additional information can be found in the KOMA-Script documentation or at the end of this answer.


If the document consits of only letters, you can also use

\renewcommand*\pagemark{%
  \usekomafont{pagenumber}{\pagename~\thepage~of~\letterlastpage}%
}
\let\letterpagemark\pagemark

This would work with both \documentclass{scrlttr2} and \documentclass{scrartcl}\usepackage{scrletter}.

esdd
  • 85,675