scrlttr2-将 nextfoot 设置为与 firstfoot 相同

scrlttr2-将 nextfoot 设置为与 firstfoot 相同

我尝试在所有页面上使用与 scrlttr2 中第一页相同的页脚。经过一番谷歌搜索,我找到了以下代码:

\documentclass{scrlttr2}
\begin{document}

\firstfoot{\footnotesize%
    \rule[3pt]{\textwidth}{.4pt} \\
    \begin{tabular}[t]{l@{}}% 
        Super Man\\
        Super Straße 30\\
        12345 Super Town
    \end{tabular}%
    \hfill
    \begin{tabular}[t]{l@{}}%
        Telefon: +49123456789\\
        [email protected]\\
    \end{tabular}%
        \hfill
        \begin{tabular}[t]{l@{}}%
            Bankverbindung: \\
            IBAN: DEXX XXXX XXXX XXXX XX\\
            BIC: XXXXXXXXXXXXX
        \end{tabular}%
}%
\addtokomafont{pagefoot}{\normalfont}
\pagestyle{headings}
\nextfoot{\usekomavar{firstfoot}}

\begin{letter}{Addr}
\opening{}
% You have to fill enough text to get to the second page
\closing{}
\end{letter}
\end{document}

您必须用 lorem ispum 或其他内容填充评论才能生成第二页!

但我有以下问题:

  1. \pagestyle{headings}还会在下一页插入页眉。我可不想这样!
  2. 下一页的页脚渲染不正确。它看起来像这样:

错误页脚

而第一页看起来是这样的:

良好的页脚

为什么?

答案1

要删除下一页的页眉,请使用

\setkomavar{nexthead}{}

对于第二个问题,使用\parbox内部firstfoot

\setkomavar{firstfoot}{\usekomafont{pageheadfoot}\usekomafont{pagefoot}%
    \parbox[t]{\textwidth}{%
        \rule[3pt]{\linewidth}{.4pt} \\
        \begin{tabular}[t]{l@{}}% 
            Super Man\\
            Super Straße 30\\
            12345 Super Town
        \end{tabular}%
        \hfill
        \begin{tabular}[t]{l@{}}%
            Telefon: +49123456789\\
            [email protected]\\
        \end{tabular}%
        \hfill
        \begin{tabular}[t]{l@{}}%
            Bankverbindung: \\
            IBAN: DEXX XXXX XXXX XXXX XX\\
            BIC: XXXXXXXXXXXXX
        \end{tabular}%
    }%
}%

请注意,firstfoot 也是一个变量并且命令\firstfoot已被贬低。

但页脚在两个页面上的位置和宽度仍然会有所不同:

在此处输入图片描述


plain带包的Pagestylescrlayer-scrpage

我将加载包scrlayer-scrpage并在所有页面上使用普通的页面样式。

以下示例使用正常plain样式。只有 footsepline 稍微向上移动。

\documentclass[
    firstfoot=false,%<- no first foot
    footheight=48pt
]{scrlttr2}
\usepackage{blindtext}% dummy text

\usepackage[footsepline,plainfootsepline]{scrlayer-scrpage}
\ModifyLayer[
  addvoffset=-1ex
]{plain.scrheadings.foot.above.line}% shift the footsepline up
\addtokomafont{pagefoot}{\normalfont\footnotesize}
\clearpairofpagestyles
\cfoot*{
    \begin{tabular}[t]{l@{}}% 
        Super Man\\
        Super Straße 30\\
        12345 Super Town
    \end{tabular}%
    \hfill
    \begin{tabular}[t]{l@{}}%
        Telefon: +49123456789\\
        [email protected]\\
    \end{tabular}%
    \hfill
    \begin{tabular}[t]{l@{}}%
        Bankverbindung: \\
        IBAN: DEXX XXXX XXXX XXXX XX\\
        BIC: XXXXXXXXXXXXX
    \end{tabular}%
}

\pagestyle{plain}
\usepackage{xpatch}
\xapptocmd\opening{\thispagestyle{plain}}{}{}% <- first pages will have pagestyle plain too

\begin{document}
\setkomavar{fromname}{Name}
\setkomavar{firsthead}{It is still possible to set a firsthead.}% <- firsthead still works

\begin{letter}{Addr}
\opening{}
\Blindtext
\closing{}
\end{letter}
\end{document}

在此处输入图片描述

但您也可以根据需要更改页脚的垂直位置和宽度。这是一个类似于正常firstfoot设置的示例。

\documentclass[
    firstfoot=false,%<- no first foot
    footheight=48pt
]{scrlttr2}
\usepackage{blindtext}% dummy text

\usepackage[footsepline,plainfootsepline]{scrlayer-scrpage}
\KOMAoptions{footwidth=\useplength{firstfootwidth}}
\ForEachLayerOfPageStyle*{plain.scrheadings}{%
  \ifstrstart{#1}{plain.scrheadings.foot}{%
    \ModifyLayer[
      voffset={\useplength{firstfootvpos}-1em}
    ]{#1}
  }{}
}% shift the footer down
\ModifyLayer[
  addvoffset=-1ex
]{plain.scrheadings.foot.above.line}% shift the footsepline up
\addtokomafont{pagefoot}{\normalfont\footnotesize}
\clearpairofpagestyles
\cfoot*{
    \begin{tabular}[t]{l@{}}% 
        Super Man\\
        Super Straße 30\\
        12345 Super Town
    \end{tabular}%
    \hfill
    \begin{tabular}[t]{l@{}}%
        Telefon: +49123456789\\
        [email protected]\\
    \end{tabular}%
    \hfill
    \begin{tabular}[t]{l@{}}%
        Bankverbindung: \\
        IBAN: DEXX XXXX XXXX XXXX XX\\
        BIC: XXXXXXXXXXXXX
    \end{tabular}%
}

\pagestyle{plain}
\usepackage{xpatch}
\xapptocmd\opening{\thispagestyle{plain}}{}{}% <- first pages will have pagestyle plain too

\begin{document}
\setkomavar{fromname}{Name}
\setkomavar{firsthead}{It is still possible to set a firsthead.}% <- firsthead still works

\begin{letter}{Addr}
\opening{}
\Blindtext
\closing{}
\end{letter}
\end{document}

在此处输入图片描述

相关内容