0

I've a number of problems with my scrletter:

  • I need the page numbering on pg 1 to be in format "n of N" like the rest of the document (scrletter global option firstfoot=false does not resolve it)
  • the appendix TOC does not generate with each item (\section{}) nor does it say "appendixes" instead of "contents".
  • the my gantt chart nor the pdf attachment appear on the same page as the appendix identifier, but I don't want them to start on a new page.
  • anything in the appendix breaks the breaks the page numbering from "n of N" to "N+1 of N".

\

\documentclass[a4paper,
%headlines=8.1,
headheight=3cm,
footlines=1.1,
%footheight=2cm,
parskip=full,
%subject=titled,
british]{scrartcl}

\usepackage[a4paper,
%showframe,
rmargin=2cm,
marginparsep=0cm,
marginparwidth=0cm,
footskip=1cm,
lmargin=2cm,
bmargin=2cm,
tmargin=2cm]{geometry}

\usepackage[%
foldmarks=false,
fromalign=right,
fromrule=off,
refline=dateleft,
fromphone=false,
fromemail=true,
%firsthead=true,
%firstfoot=true,
pagenumber=footright,
fromlogo=false]{scrletter}

\usepackage{pgfgantt,caption}
\usepackage{rotating}
\usepackage{pdfpages} % to include PDFs as attachment in appendices

\usepackage[T1]{fontenc}
\usepackage[en-GB]{datetime2}
\DTMlangsetup[en-GB]{ord=raise}
\usepackage{babel}

\usepackage{lipsum}% dummy text

\usepackage[pdflang=en-GB]{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=black,
    filecolor=magenta,
    urlcolor=blue
}
\renewcommand{\contentsname}{\large{Appendixes}}
\KOMAoptions{toc=sectionentrydotfill}
\pagenumbering{arabic}

\renewcommand*\pagemark{\usekomafont{pagenumber}{\thepage of \letterlastpage}}
\let\letterpagemark\pagemark
\setkomavar{firstfoot}{\raggedleft \pagemark of \letterlastpage}

\setkomavar{myref}[Internal \#]{Testref1234}
\setkomavar{date}[Date]{\today}
\setkomavar{yourref}[Your \#]{Testref5678}
\setkomavar{fromname}{A N Other}
\setkomavar{signature}{A N Other}
\renewcommand*{\raggedsignature}{\raggedright}
\setkomavar{fromaddress}{Building Number\\Street\\State\\ZIP Code}
\setkomavar{subject}{Testing letter}

\begin{document}
\begin{letter}{A. Person\\Someplace\\ZIP CODE}
\opening{test}
\lipsum[1-9]\footnote{\lipsum[2]}
\closing{cheers}

\clearpage

\appendix
\tableofcontents
\thispagestyle{empty}
\clearpage

\section{}\label{appendix:a}
\includepdf[%
frame=true,
pages=1-3,
fitpaper=false,
scale=0.75,
offset=0 0]{%
    test.pdf
}

\newpage

\section{}\label{appendix:timeline}
%\thispagestyle{empty}
\ganttset{%
    calendar week text={%
        W\currentweek}
}
\DTMsetdatestyle{ddmmyy}
\begin{sidewaystable}
\begin{ganttchart}[%
    inline, 
    bar inline label anchor=west,
    bar inline label node/.append style={anchor=west, text=white},
    bar/.append style={fill=cyan!90!black,}, 
    bar height=.8,]{0}{18}
    \gantttitlelist{0,...,18}{1}\\
    \ganttbar[inline=false]{M1}{0}{3}
    \ganttbar{J1}{0}{3}
    \ganttbar{J2}{3}{4}
    \ganttbar{}{5}{18}\\
    \ganttbar[inline=false]{M2}{0}{5}
    \ganttbar{J2}{5}{8}
    \ganttbar{J1}{8}{12}
    \ganttbar{}{12}{18}
\end{ganttchart}
\end{sidewaystable}
\end{letter}
\end{document}

1 Answer 1

2
  • Use \setkomavar{firstfoot}{\raggedleft\pagemark}.
  • A section with empty title does not get a ToC entry. Therefore replace \section{} by \section{~}. If the title of the ToC should be »Appendices« redefine \listoftocname: \renewcommand{\listoftocname}{Appendices}
  • Use option pagecommand for the first included page to get the section heading on this page. Replace environment sidewaystable by sideways.
  • The reason for the broken page numbering was the sidewaystable at the end of the letter.

Example:

\documentclass[%a4paper,% default
%headlines=8.1,
headheight=3cm,
footlines=1.1,
%footheight=2cm,
parskip=full,
%subject=titled,
british,
numbers=noenddot% <- false
]{scrartcl}

\usepackage[%a4paper,
%showframe,
rmargin=2cm,
marginparsep=0cm,
marginparwidth=0cm,
footskip=1cm,
lmargin=2cm,
bmargin=2cm,
tmargin=2cm]{geometry}

\usepackage[%
foldmarks=false,
fromalign=right,
fromrule=off,
refline=dateleft,
fromphone=false,
fromemail=true,
%firsthead=true,
%firstfoot=true,
pagenumber=footright,
fromlogo=false]{scrletter}

\usepackage{pgfgantt,caption}
\usepackage{rotating}
\usepackage{pdfpages} % to include PDFs as attachment in appendices

\usepackage[T1]{fontenc}
\usepackage[en-GB]{datetime2}
\DTMlangsetup[en-GB]{ord=raise}
\usepackage{babel}

\usepackage{lipsum}% dummy text

\usepackage[pdflang=en-GB]{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=black,
    filecolor=magenta,
    urlcolor=blue
}
\renewcommand{\contentsname}{\large{Appendixes}}
\KOMAoptions{toc=sectionentrydotfill}
\pagenumbering{arabic}

\renewcommand*\pagemark{\usekomafont{pagenumber}{\thepage\ of \letterlastpage}}% <- changed
\let\letterpagemark\pagemark
\setkomavar{firstfoot}{\raggedleft\pagemark}% <- changed

\setkomavar{myref}[Internal \#]{Testref1234}
\setkomavar{date}[Date]{\today}
\setkomavar{yourref}[Your \#]{Testref5678}
\setkomavar{fromname}{A N Other}
\setkomavar{signature}{A N Other}
\renewcommand*{\raggedsignature}{\raggedright}
\setkomavar{fromaddress}{Building Number\\Street\\State\\ZIP Code}
\setkomavar{subject}{Testing letter}

\renewcommand{\sectionformat}{\appendixname~\thesection\autodot}% <- added
\renewcommand{\listoftocname}{Appendices}% <- added


\begin{document}
\begin{letter}{A. Person\\Someplace\\ZIP CODE}
\opening{test}
\lipsum[1-9]\footnote{\lipsum[2]}
\closing{cheers}

\clearpage

\appendix
\tableofcontents
\thispagestyle{empty}
\clearpage

\includepdf[%
frame=true,
pagecommand={\section{~}\label{appendix:a}\thispagestyle{empty}},% <- added
pages=1,
fitpaper=false,
scale=0.75,
offset=0 0]{%
    dummy.pdf
}
\includepdf[%
frame=true,
pages=2-3,
fitpaper=false,
scale=0.75,
offset=0 0]{%
    dummy.pdf
}

%\newpage% not needed

\section{~}\label{appendix:timeline}% <- changed
%\thispagestyle{empty}
\ganttset{%
    calendar week text={%
        W\currentweek}
}
\DTMsetdatestyle{ddmmyy}
\begin{table}[htp]
\centering
\begin{sideways}% <- changed
\begin{ganttchart}[%
    inline, 
    bar inline label anchor=west,
    bar inline label node/.append style={anchor=west, text=white},
    bar/.append style={fill=cyan!90!black,}, 
    bar height=.8,]{0}{18}
    \gantttitlelist{0,...,18}{1}\\
    \ganttbar[inline=false]{M1}{0}{3}
    \ganttbar{J1}{0}{3}
    \ganttbar{J2}{3}{4}
    \ganttbar{}{5}{18}\\
    \ganttbar[inline=false]{M2}{0}{5}
    \ganttbar{J2}{5}{8}
    \ganttbar{J1}{8}{12}
    \ganttbar{}{12}{18}
\end{ganttchart}
\end{sideways}% <- changed
\end{table}
\end{letter}
\end{document}

enter image description here

enter image description here

1
  • .......Stellar!
    – Timmy
    Commented Mar 14, 2022 at 5:02

You must log in to answer this question.

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