我在序言中使用了带有包scrartcl
的文档类,用于具有章节功能的信件。我想在我的声明后添加附录。scrletter
\end{letter}
使用包很容易做到这一点appendix
,但页脚的格式丢失了。在我的信中,我已经格式化了它根据我在这里的回答,但是在创建\begin{appendices} ...
环境之后,我得到了一个位于页脚边距中心的页码,因此页面样式似乎已在附录环境中重置。
我如何才能使其与我的其他文件/信件保持一致?
梅威瑟:
\documentclass[a4paper,
headlines=8.1,
headheight=3cm,
%footlines=1.1,
%footheight=2cm,
parskip=full,
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,
pagenumber=footright,
firstfoot=true,
fromlogo=false]{scrletter}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[en-GB]{datetime2}
\DTMlangsetup[en-GB]{ord=raise}
\usepackage[british]{babel}
%\usepackage{showframe}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dummy text
\usepackage{blindtext}
\usepackage{lipsum}
\usepackage[pdflang=en-GB]{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=magenta,
urlcolor=blue,
%pdftitle={Overleaf Example},
%pdfpagemode=FullScreen,
}
\usepackage{appendix}
\setkomavar{firstfoot}{\thepage of \letterlastpage}
\renewcommand*\letterpagemark{\usekomafont{pagenumber}{\thepage 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{backaddress}{}
\setkomavar{subject}[]{\underline{Testing letter}}
\setkomavar{subjectseparator}[]{}
\begin{document}
\begin{letter}{%
A. Person\\
Someplace\\
ZIP CODE%
}
\opening{test}
\lipsum[1-4]
\blindtext
\lipsum[1-4]\footnote{\blindtext}
\closing{cheers}
\end{letter}
\begin{appendices}
%\pagestyle{plain}
%\tableofcontents
\appendixpageoff
\appendixtitleoff
\appendixheaderoff
\appendixpagename
% here I would put \section{} statements for each thing I want in the appendix
\end{appendices}
\end{document}
答案1
在环境内使用\appendix
(不带包appendix
)letter
:
\documentclass[
headheight=3cm,
parskip=full,
british
]{scrartcl}
\usepackage[
margin=2cm,
marginparsep=0cm,
marginparwidth=0cm,
footskip=1cm,
]{geometry}
%\usepackage{showframe}
\usepackage[%
foldmarks=false,
fromalign=right,
fromrule=off,
refline=dateleft,
fromphone=false,
fromemail=true,
backaddress=false,
subject=underlined,
pagenumber=footright
]{scrletter}% <- loads package scrlayer-scrpage automatically
\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*\pagemark{\usekomafont{pagenumber}{\thepage\ of \letterlastpage}}% <- changed
\let\letterpagemark\pagemark% <- changed
\setkomavar{firstfoot}{\raggedleft\pagemark}% <- added
\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% <- changed and moved in the letter environment
\tableofcontents
\section{An appendix section}
\lipsum
\section{Another appendix section}
\lipsum
\end{letter}
\end{document}
如果\appendix
应该是letter
环境之外,则不能使用\letterlastpage
,因为它指的是环境内部的最后一页字母letter
。
\documentclass[
headheight=3cm,
parskip=full,
british
]{scrartcl}
\usepackage[
margin=2cm,
marginparsep=0cm,
marginparwidth=0cm,
footskip=1cm,
]{geometry}
%\usepackage{showframe}
\usepackage[%
foldmarks=false,
fromalign=right,
fromrule=off,
refline=dateleft,
fromphone=false,
fromemail=true,
backaddress=false,
subject=underlined,
pagenumber=footright
]{scrletter}% <- loads package scrlayer-scrpage automatically
\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\pagemark{{\usekomafont{pagenumber}{\thepage\ of \pageref{LastPage}}}}% <- changed
\let\letterpagemark\pagemark
\AddToHook{shipout/lastpage}{\label{LastPage}}% <- added
\setkomavar{firstfoot}{\raggedleft\pagemark}
\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}
\end{letter}
\appendix
\tableofcontents
\section{An appendix section}
\lipsum
\section{Another appendix section}
\lipsum
\end{document}