TeX - LaTeX Asked on February 13, 2021
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 Garcia710 Ashbury StSan FranciscoCA 94117}
opening{Dear Friend,}
lipsumlipsum
end{letter}
begin{letter}{Jerry Garcia710 Ashbury StSan FranciscoCA 94117}
opening{Dear Friend,}
lipsumlipsum
end{letter}
end{document}
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 Garcia710 Ashbury StSan FranciscoCA 94117}
opening{Dear Friend,}
lipsumlipsum
end{letter}
begin{letter}{Jerry Garcia710 Ashbury StSan FranciscoCA 94117}
opening{Dear Friend,}
lipsumlipsum
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}%
}
letletterpagemarkpagemark
This would work with both documentclass{scrlttr2}
and documentclass{scrartcl}usepackage{scrletter}
.
Correct answer by esdd on February 13, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP