
Я пытаюсь получить тот же нижний колонтитул на всех страницах, что и на первой странице в 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 или чем-то еще, чтобы сгенерировать вторую страницу!
Но у меня есть следующие проблемы:
\pagestyle{headings}
также вставляет заголовки на следующей странице. Я этого не хочу!- Нижний колонтитул на следующей странице отображается неправильно. Он выглядит так:
а на первой странице это выглядит так:
Почему?
решение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 также является переменной, а command \firstfoot
не учитывается.
Но нижний колонтитул все равно будет иметь разное положение и ширину на двух страницах:
Pagestyle plain
с пакетомscrlayer-scrpage
Я бы загрузил пакет scrlayer-scrpage
и использовал простой стиль страницы на всех страницах.
В следующих примерах используется обычный plain
стиль. Только линия стопы немного смещена вверх.
\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}