
Estoy intentando obtener el mismo pie de página en todas las páginas que la primera página en scrlttr2. Después de buscar en Google, se me ocurrió este código:
\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}
¡Tienes que llenar el comentario con lorem ispum o algo más para generar una segunda página!
Pero tengo los siguientes problemas:
\pagestyle{headings}
También inserta los encabezados en la página siguiente. ¡No quiero eso!- El pie de página de la página siguiente no se representa correctamente. Se parece a esto:
mientras que en la primera página se ve así:
¿Por qué?
Respuesta1
Para eliminar el encabezado en las siguientes páginas utilice
\setkomavar{nexthead}{}
Para el segundo problema use un \parbox
interiorfirstfoot
\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}%
}%
}%
Tenga en cuenta que firstfoot también es una variable y el comando \firstfoot
se deprecia.
Pero el pie de página seguirá teniendo una posición y un ancho diferentes en las dos páginas:
Estilo de página plain
con paquetescrlayer-scrpage
Cargaría el paquete scrlayer-scrpage
y usaría un estilo de página simple en todas las páginas.
Los siguientes ejemplos utilizan el plain
estilo normal. Sólo la línea de los pies está un poco desplazada hacia arriba.
\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}
Pero también puedes cambiar la posición vertical y el ancho del pie de página según tus necesidades. A continuación se muestra un ejemplo similar a la firstfoot
configuración normal.
\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}