如何在 komascript 中拥有平等的页脚位置?

如何在 komascript 中拥有平等的页脚位置?

是否有某个选项可以让下一页的页脚与第一页的页脚处于相同的位置?

\documentclass{scrlttr2}
%% \documentclass[firstfoot=false]{scrlttr2}

\usepackage[english]{babel}

%% Same left margin for everything
\makeatletter
\@setplength{toaddrhpos}{\dimexpr\oddsidemargin+1in}
\makeatother

%% Add a footer
\setkomavar{firstfoot}{\parbox[b]{\textwidth}{\centering foo | bar}}
\setkomavar{nextfoot}{\usekomavar{firstfoot}}
\pagestyle{myheadings}

%% Move date to the left
\KOMAoptions{refline=dateleft}

%% \areaset{6.5in}{11in}

%% Don't use italics for the footer
\renewcommand*{\footfont}{\normalfont}

\usepackage{lipsum}

\begin{document}

\begin{letter}{addressee}

\opening{Dear XXX}
\lipsum[1-3]
\closing{Yours}
\end{letter}


\end{document}

图像

答案1

我建议加载scrlayer-scrpage属于 KOMA-Script 包一部分的包。

如果第二页的页脚应与第一页的高度相同:

\documentclass{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}

%% Same left margin for everything
\setplength{toaddrhpos}{\dimexpr\oddsidemargin+1in}

%% Add a footer
\setkomavar{firstfoot}{\parbox[b]{\useplength{firstfootwidth}}{\centering foo | bar}}

\usepackage[manualmark]{scrlayer-scrpage}
\KOMAoptions{footwidth=\useplength{firstfootwidth}}
\ForEachLayerOfPageStyle*{scrheadings}{%
  \Ifstrstart{#1}{scrheadings.foot}{%
    \ModifyLayer[
      voffset=\useplength{firstfootvpos}
    ]{#1}
  }{}%
}
\clearpairofpagestyles
\cfoot*{\usekomavar{firstfoot}}
\addtokomafont{pagefoot}{\normalfont}

%% Move date to the left
\KOMAoptions{refline=dateleft}

\usepackage{lipsum}
\begin{document}
\begin{letter}{addressee}
\opening{Dear XXX}
\lipsum[1-3]
\closing{Yours}
\end{letter}
\end{document}

在此处输入图片描述

如果第一页的页脚应与其他页面的高度相同(另请参阅https://tex.stackexchange.com/a/578081):

\documentclass{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}

%% Same left margin for everything
\setplength{toaddrhpos}{\dimexpr\oddsidemargin+1in}


%% Add a footer
\usepackage[manualmark]{scrlayer-scrpage}
\clearpairofpagestyles
\cfoot*{foo | bar}
\addtokomafont{pagefoot}{\normalfont}

\newcommand{\originalopening}{}
\let\originalopening\opening
\renewcommand{\opening}[1]{\originalopening{#1}\thispagestyle{plain}}
\KOMAoptions{firstfoot=false}% disable first footer

%% Move date to the left
\KOMAoptions{refline=dateleft}

\usepackage{lipsum}
\begin{document}
\begin{letter}{addressee}
\opening{Dear XXX}
\lipsum[1-3]
\closing{Yours}
\end{letter}
\end{document}

在此处输入图片描述

相关内容