我的 scrletter 存在一些问题:
- 我需要第 1 页的页码格式与文档的其余部分一样为“n of N”(scrletter 全局选项
firstfoot=false
无法解决此问题) - 附录目录不是随每个项目一起生成的(
\section{}
),也不会说“附录”而不是“内容”。 - 我的甘特图和 pdf 附件与附录标识符出现在同一页面上,但我不希望它们从新页面开始。
- 附录中的任何内容都会打断页码从“N 之 n”到“N+1 之 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
- 使用
\setkomavar{firstfoot}{\raggedleft\pagemark}
。 - 标题为空的部分不会获得目录条目。因此,请
\section{}
用替换\section{~}
。如果目录的标题应为“附录”,请重新定义\listoftocname
:\renewcommand{\listoftocname}{Appendices}
- 使用
pagecommand
第一个包含页面的选项来获取此页面上的节标题。将环境替换sidewaystable
为sideways
。 - 页码断裂的原因是
sidewaystable
信件末尾的。
例子:
\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}