![scrlttr2:使第二页页脚与第一页页脚匹配](https://linux22.com/image/296138/scrlttr2%EF%BC%9A%E4%BD%BF%E7%AC%AC%E4%BA%8C%E9%A1%B5%E9%A1%B5%E8%84%9A%E4%B8%8E%E7%AC%AC%E4%B8%80%E9%A1%B5%E9%A1%B5%E8%84%9A%E5%8C%B9%E9%85%8D.png)
我正在尝试用 写求职信scrlttr2
。我使用的是网上找到的模板,我想让第二页的页脚与第一页的页脚相同。我真的不知道该怎么做,结果第二页的页脚部分只显示“第 2 页”。扩展为两页信函的模板如下所示。
任何帮助将不胜感激。
\documentclass{scrlttr2}
\usepackage{fontspec} % Allows font customization
\usepackage{marvosym} % Allows the use of symbols
\usepackage[english]{babel} % Required to compile in Windows
\setlength\parindent{0pt} % Removes all indentation from paragraphs
\defaultfontfeatures{Mapping=tex-text}
\setmainfont {Garamond} % Main document font
\setsansfont {Garamond} % Used in the from address line above the to address
\renewcommand{\normalsize}{\fontsize{12.5}{17}\selectfont} % Sets the font size and leading
%----------------------------------------------------------------------------------------
% PERSONAL INFORMATION
%----------------------------------------------------------------------------------------
\setkomavar{fromname}{John Smith} % Your name
\setkomavar{fromaddress}{123 Broadway\\City\\Country} % Your address
\setkomavar{fromphone}{(000) 111-1111} % Your phone number
\setkomavar{fromemail}{[email protected]} % Your email address
\setkomavar{place}{} % City written before the date, put your city here if you want this
\setkomavar{signature}{John Smith} % Your name as you want it to appear in the signature
% These are not used in this document, uncomment if you would like to use them and refer to them as \usekomavar{name}
%\setkomavar{fromfax}{+1 (1)23 456789} % Your fax number
%\setkomavar{fromurl}{http://www.johnsmith.com} % Your personal website
%\setkomavar{frombank}{Postbank 9307157}
%----------------------------------------------------------------------------------------
% HEADER SECTION
%----------------------------------------------------------------------------------------
\firsthead{
\centering
{\addfontfeature{LetterSpace=20.0}\fontsize{36}{36}\selectfont\scshape \usekomavar{fromname}}\\[5mm]
\fontsize{21}{21}\selectfont\scshape Programmer at Initech } % Your current job title
%----------------------------------------------------------------------------------------
% FOOTER SECTION
%----------------------------------------------------------------------------------------
\firstfoot{
\centering
\addfontfeature{LetterSpace=20.0}\scshape
{
\renewcommand{\\}{\ {\large\textperiodcentered}\ }
\usekomavar{fromaddress}
}\\
{\Large\Letter} \usekomavar{fromemail} \ {\Large\Telefon} \usekomavar{fromphone} % If you want your fax number or website URL showing, add it here; you may need to play around with spacing
}
%----------------------------------------------------------------------------------------
\begin{document}
%----------------------------------------------------------------------------------------
% COVER LETTER CONTENTS
%----------------------------------------------------------------------------------------
\begin{letter}{ % Address of the company you are applying to
HR Dept. --- Corporation\\
123 Pleasant Lane\\
12345 City, State
}
\setkomavar{subject}{Cover Letter} % This is the bold text saying 'Cover Letter', remove it if you don't like it
\opening{Dear Recruiter,}
PARAGRAPH ONE: State the reason for the letter, name the position or type of work you are applying for and identify the source from which you learned of the opening.\\
PARAGRAPH TWO: Indicate why you are interested in the position, the company, its products, services - above all, stress what you can do for the employer. If you are a recent graduate, explain how your academic background makes you a qualified candidate for the position. If you have practical work experience, point out specific achievements or unique qualifications. Try not to repeat the same information the reader will find in the resume. The purpose of this section is to strengthen your resume by providing details which bring your experiences to life.\\
PARAGRAPH TWO: Indicate why you are interested in the position, the company, its products, services - above all, stress what you can do for the employer. If you are a recent graduate, explain how your academic background makes you a qualified candidate for the position. If you have practical work experience, point out specific achievements or unique qualifications. Try not to repeat the same information the reader will find in the resume. The purpose of this section is to strengthen your resume by providing details which bring your experiences to life.\\
PARAGRAPH TWO: Indicate why you are interested in the position, the company, its products, services - above all, stress what you can do for the employer. If you are a recent graduate, explain how your academic background makes you a qualified candidate for the position. If you have practical work experience, point out specific achievements or unique qualifications. Try not to repeat the same information the reader will find in the resume. The purpose of this section is to strengthen your resume by providing details which bring your experiences to life.\\
PARAGRAPH THREE: Request a personal interview and indicate your flexibility as to the time and place. Repeat your phone number in the letter. End the letter by thanking the employer for taking the time to consider your credentials.\\
Sincerely yours, \\ \\ \\
\usekomavar{signature}
%----------------------------------------------------------------------------------------
\end{letter}
\end{document}
答案1
更新(所有页面的包装scrlayer-scrpage
和页面样式)plain
也可以删除firstfoot
和,在所有页面上使用plain
具有相同页脚的页面样式。页脚层可以向下移动,以便它们处于与相同的垂直位置firstfoot
。请注意,firsthead
仍然可以使用。
\documentclass[
symbolicnames,
firstfoot=false,% disable firstfoot
footlines=2% or footheight=29pt
]{scrlttr2}
%\providecommand*\Ifstrstart{\ifstrstart}% needed up to and including KOMA-Script version 3.27, see https://komascript.de/faq_deprecatedif
\usepackage{blindtext}
\setkomavar{fromname}{John Smith}
\setkomavar{fromaddress}{123 Broadway\\City\\Country}
\setkomavar{fromphone}{(000) 111-1111}
\setkomavar{fromemail}{[email protected]}
\setkomavar{place}{}
\setkomavar{signature}{John Smith}
\setkomavar{subject}{Cover Letter}
\setkomavar{firsthead}{%
\centering{\Huge\scshape\usekomavar{fromname}\par%
}%
{\Large\scshape Application\par}%
}
\setkomavar{firstfoot}{\centering%
{%
\renewcommand{\\}{~{\large\textperiodcentered}~}%
\usekomavar{fromaddress}%
}\\%
\usekomavar*{fromemail}\usekomavar{fromemail}\quad\usekomavar*{fromphone}\usekomavar{fromphone}%
}
\usepackage{scrlayer-scrpage}
\KOMAoptions{footwidth=\useplength{firstfootwidth}}
\ForEachLayerOfPageStyle*{plain.scrheadings}{%
\Ifstrstart{#1}{plain.scrheadings.foot}{%
\ModifyLayer[
voffset=\useplength{firstfootvpos}
]{#1}
}{}
}% shift the footer down
\ModifyLayer[
addvoffset=-1ex
]{plain.scrheadings.foot.above.line}% shift the footsepline up
\addtokomafont{pagefoot}{\normalfont}
\clearpairofpagestyles
\cfoot*{\usekomavar{firstfoot}}
\pagestyle{plain}
\usepackage{xpatch}
\xapptocmd\opening{\thispagestyle{plain}}{}{}% <- first pages will have pagestyle plain too
\begin{document}
\begin{letter}{%
HR Dept. --- Corporation\\%
123 Pleasant Lane\\%
12345 City, State%
}
\opening{Dear Recruiter,}\the\baselineskip
\blindtext[2]
\blindtext
\blindtext[3]
\closing{See you on monday}
\end{letter}
\end{document}
结果:
原始答案
如果第二页的页脚应该与第一页的页脚位于同一位置,则可以加载包scrlayer
并定义自己的页面样式:
\usepackage{scrlayer}
\DeclareNewLayer[
align=tl,
hoffset=\dimexpr.5\paperwidth-.5\useplength{firstfootwidth}\relax,
voffset=\useplength{firstfootvpos},
width=\useplength{firstfootwidth},
height=\dimexpr\paperheight-\useplength{firstfootvpos},
foreground,
contents={\parbox{\layerwidth}{\usekomavar{firstfoot}}}
]{myfoot.fg}
\DeclarePageStyleByLayers{myletter}{myfoot.fg}
\pagestyle{myletter}
代码:
\documentclass[symbolicnames]{scrlttr2}
\usepackage{blindtext}
\setkomavar{fromname}{John Smith}
\setkomavar{fromaddress}{123 Broadway\\City\\Country}
\setkomavar{fromphone}{(000) 111-1111}
\setkomavar{fromemail}{[email protected]}
\setkomavar{place}{}
\setkomavar{signature}{John Smith}
\setkomavar{subject}{Cover Letter}
\setkomavar{firsthead}{%
\centering{\Huge\scshape\usekomavar{fromname}\par%
}%
{\Large\scshape Application\par}%
}
\setkomavar{firstfoot}{\centering%
{%
\renewcommand{\\}{~{\large\textperiodcentered}~}%
\usekomavar{fromaddress}%
}\\%
\usekomavar*{fromemail}\usekomavar{fromemail}\quad\usekomavar*{fromphone}\usekomavar{fromphone}%
}
\usepackage{scrlayer}
\DeclareNewLayer[
align=tl,
hoffset=\dimexpr.5\paperwidth-.5\useplength{firstfootwidth}\relax,
voffset=\useplength{firstfootvpos},
width=\useplength{firstfootwidth},
height=\dimexpr\paperheight-\useplength{firstfootvpos},
foreground,
contents={\parbox{\layerwidth}{\usekomavar{firstfoot}}}
]{myfoot.fg}
\DeclarePageStyleByLayers{myletter}{myfoot.fg}
\pagestyle{myletter}
\begin{document}
\begin{letter}{%
HR Dept. --- Corporation\\%
123 Pleasant Lane\\%
12345 City, State%
}
\opening{Dear Recruiter,}
\blindtext[2]
\blindtext
\blindtext[3]
\closing{See you on monday}
\end{letter}
\end{document}
答案2
首先,我必须说,我不建议使用问题中的模板链接。它使用过时的选项,并且大多数时候都会做一些非常奇怪的事情。
firstfoot
我们在设置变量时只需使用变量即可nextfoot
。为了使其正常工作,我们还必须稍微调整一下第一步,即将所有内容放入 parbox 中。
值得注意的是,只有页面样式headings
处于活动状态时这才有效。
\documentclass[symbolicnames]{scrlttr2}
\usepackage{blindtext}
\pagestyle{headings}
\setkomavar{fromname}{John Smith}
\setkomavar{fromaddress}{123 Broadway\\City\\Country}
\setkomavar{fromphone}{(000) 111-1111}
\setkomavar{fromemail}{[email protected]}
\setkomavar{place}{}
\setkomavar{signature}{John Smith}
\setkomavar{subject}{Cover Letter}
\setkomavar{firsthead}{%
\centering{\Huge\scshape\usekomavar{fromname}\par%
}%
{\Large\scshape Application\par}%
}
\setkomavar{firstfoot}{\parbox{\textwidth}{\centering%
{%
\renewcommand{\\}{~{\large\textperiodcentered}~}%
\usekomavar{fromaddress}%
}\\%
\usekomavar*{fromemail}\usekomavar{fromemail}\quad\usekomavar*{fromphone}\usekomavar{fromphone}%
}%
}
%Simply reusing the variable
\setkomavar{nextfoot}{\usekomavar{firstfoot}}
\begin{document}
\begin{letter}{%
HR Dept. --- Corporation\\%
123 Pleasant Lane\\%
12345 City, State%
}
\opening{Dear Recruiter,}
\blindtext[2]
\blindtext
\blindtext[3]
\closing{See you on monday}
\end{letter}
\end{document}