1

For a long application I have got the following problem: I cannot seem to make page numbering in the letter working.

My workflow is the following: I have got a main document with all preamble-information and

{scrartcl}
as documentclass; in the preamble I load
\usepackage{scrletter}
to have access to letter features of the koma-script letter features; the main document is below:

\documentclass[a4paper,%
fontsize=12pt,parskip=half*,%
headings=optiontoheadandtoc,%
headlines=5,headinclude=on,version=last]{scrartcl}

\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[american,ngerman]{babel}
\usepackage[dvips,final]{graphicx}
\usepackage{scrletter}
\usepackage{microtype}
\usepackage{scrlayer-scrpage}
\usepackage{pifont}
\usepackage{charter}
\usepackage{pdfpages}
\usepackage{titlesec} % Used to customize the \section command
\titleformat{\section}{\Large\scshape\raggedright}{}{0em}{}[\titlerule] % Text formatting of sections
\titlespacing{\section}{0pt}{3pt}{3pt} % Spacing around sections


\pagestyle{scrheadings}

\clearscrheadfoot

\setkomafont{pageheadfoot}{
\normalfont\small
}

\ohead{\textsc{Application}\\ \normalfont{Some Summer School}}

\ihead{ \\E.G. \textsc{Smith}}

\cfoot*{\thepage}

\areaset{155mm}{264mm}

\AtBeginDocument{\renewcaptionname{english}{\subjectname}{%
Application}
}

\renewcommand\raggedsignature{\raggedright}

\begin{document}

\include{title}

\tableofcontents

\include{letter}

\include{cv}

\includepdf[pages=-, scale=0.88,addtotoc={1,section,1,Some Summer School 2017: Online Registration,sosusconline}, pagecommand={\thispagestyle{scrheadings}}]{transcripts/abc.pdf}

\includepdf[pages=1-2, frame, scale=0.88,addtotoc={1,section,1,Transcript Grades: Some University,trgsou}, pagecommand={\thispagestyle{scrheadings}}]{transcripts/def.pdf}
.
.
.

\includepdf[pages=-, frame, scale=0.88,addtotoc={1,section,1,Copy of Passport, passport}, pagecommand={\thispagestyle{scrheadings}}]{transcripts/reisepass-print.pdf}

\end{document}

Then there are

title.tex, cv.tex, and letter.tex

Letter.tex looks like this:

\setkomavar*{enclseparator}{Enclosed}
\setkomavar{date}{\today}
\setkomavar{subject}{Application}

\let\letterpagemark\pagemark

\begin{letter}[]{University\\
Office of International Relations\\
Some Summer School 2017''\\
}

\pagestyle{letter}

\LoadLetterOption{annam-en}

\opening{Dear Sir/ Madam,}

\addcontentsline{toc}{section}{Application Letter}

blablablablabla blala blabla

\closing{Yours sincerely,}

\encl{Resume, Letter of Recommendation, Transcripts, Certificates, Print Copy of Online Registration form, blablabla}

\end{letter}

Even though page numbering works out of the box, even with the pdf-pages, I can not set the page number of the letter to 3. The page number is always set to 1 on the first letter. I tried to put

\setcounter{page}{3}
after
\opening
to no effect.

Thanks for any help in advance.

3

You need to save the page counter before the letter, and then restore it with \AtBeginLetter because KOMA-Script otherwise resets it when the letter starts. If you want the page number to print on the first page of the letter, you also need to provide a suitable \thispagestyle{} after the opening of the letter, because KOMA-Script at that point sets it to empty.

(Note that as esdd points out in a comment to the question, you could just set the value by hand -- but saving and restoring allow for changes in the earlier parts of the document.)

MWE follows. Note that there was a lot in your posted code that was unnecessary to the problem.

\documentclass{scrartcl}
\usepackage{blindtext}
\usepackage[T1]{fontenc}
\usepackage{scrletter}
\pagestyle{scrheadings}

\begin{document}

\blindtext

\clearpage

\newcounter{pagesaver}%to save the value
\setcounter{pagesaver}{\value{page}}%set it to the current value of page
\setkomavar*{enclseparator}{Enclosed}
\setkomavar{date}{\today}
\setkomavar{subject}{Application}
\AtBeginLetter{\setcounter{page}{\value{pagesaver}}}%restore value at start of letter

\begin{letter}[]{University\\
Office of International Relations\\
Some Summer School 2017\\
}

\opening{Dear Sir/ Madam,}

\thispagestyle{letter}

\Blindtext

\closing{Yours sincerely,}

\encl{Resume, Letter of Recommendation, Transcripts, Certificates, Print Copy of Online Registration form, blablabla}

\end{letter}

\blindtext

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.