I am trying to combine a nice footer on all pages with pagenumbers on all pages. I have firsthead=off
since I need a logo in the place of the back address. If I remove \chead*{\pagemark}
from the first link and add \pagemark
to \setkomavar{firstfoot}
I get the pagenumer next to the footer like that:
but I would like it to have it in this position
The footer can take more space on the button if needed to. Also it is ok if the pagenumbers are on the top, like in the first example. Here is my code so far:
\documentclass[
fontsize=11pt,
version=last,
fromalign=left,
backaddress=true,
foldmarks=on,
fromphone=off,
fromemail=off,
parskip=half,
firsthead=off]{scrlttr2}
%
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{eso-pic}
\usepackage{blindtext}
\renewcommand*\familydefault{\sfdefault}
\renewcommand*{\raggedsignature}{\raggedright} % Signatur wird bündig gesetzt
%
%---------------------------------------------------------------------------
% Absender
%
\newcommand{\mVorname}{stupid company GmbH}
\newcommand{\mNachname}{\& Co. KG}
\newcommand{\mStrasse}{Somestreet. 1}
\newcommand{\mStadt}{Somecity}
\newcommand{\mPLZ}{22223}
\setkomavar{date}{}
\setkomavar{fromname}{\mVorname{}~\mNachname{}} % Name
\setkomavar{fromaddress}{\mStrasse{}\\{}\mPLZ{}~\mStadt{}} % Adresse
\setkomavar{frombank}{SomeBank\\
IBAN:DE00 0000 0000 0000 0000 00\\BIC: AAAAAAAAAAA}
\setkomavar{location}{\raggedright
Versandanschrift:\\
\vfill
Some Guy \\
23423 Blablubbing \\
Blabistan \\
Telefon
}
\makeatletter
\@setplength{locvpos}{4.8cm}
\@setplength{locwidth}{7.5cm}
\@setplength{firstfootvpos}{250mm}
\makeatother
\LoadLetterOption{visualize}% loads visualize.lco to visualize boxes
\showfields{address}% show the address box
\renewcommand*\pagemark{%
\usekomafont{pagenumber}{\pagename~\thepage~von~\letterlastpage}%
}
% header and footer first page:
\setkomavar{firstfoot}{% changed ->
\usekomafont{pageheadfoot}%
\parbox{\useplength{firstfootwidth}}{%
\rule{\linewidth}{.4pt}\\
\parbox[t]{0.31\linewidth}{%
\begin{tabular}[t]{l}
\multicolumn{1}{@{}l@{}}{\textbf{Geschäftsinformation:}}\\
persönlich haftende Gesellschafterin:\\
stupid company Verwaltungs-GmbH\\
Amtsgericht Somecity, HBR 111111 \\
Handelsregister: Somecity HRA222222 \\
\begin{tabular}{@{}l@{\;}l@{}}USt-IdNr.:& DE 000000000 \\
WEEE-Nr.: & DE 00000000 \end{tabular}\\
Geschäftsführer: Some Guy \\
Sitz Somecity
\end{tabular}
}%
\hfill
\parbox[t]{0.31\linewidth}{%
\begin{tabular}[t]{l@{}}
\multicolumn{1}{@{}l@{}}{\textbf{\usekomavar*{frombank}:}} \smallskip \\
\usekomavar{frombank} \smallskip \\
Somethirdbank \\
IBAN:DE00 0000 0000 0000 0000 00\\
BIC: CCCCCCCCCCC
\end{tabular}%
}%
\hfill
\parbox[t]{0.31\linewidth}{%
\begin{tabular}[t]{l@{}}
\multicolumn{1}{@{}l@{}}{} \smallskip \\
Someotherbank \\
IBAN:DE00 0000 0000 0000 0000 00\\
BIC: BBBBBBBBBBB
\end{tabular}%
}%
}%
}
\setkomafont{pageheadfoot}{\scriptsize}
\usepackage{scrlayer-scrpage}% <- sets pagestyle scrheadings automatically
\DeclareNewLayer[
foreground,
textarea,
voffset=\useplength{firstfootvpos},
hoffset=\dimexpr.5\paperwidth-.5\useplength{firstfootwidth}\relax,
width=\useplength{firstfootwidth},
mode=picture,
contents=\putUL{\raisebox{\dimexpr-\height}{\usekomavar{firstfoot}}}
]{likefirstpage.foot}
\AddLayersToPageStyle{scrheadings}{likefirstpage.foot}
\clearpairofpagestyles
\chead*{\pagemark}
\begin{document}
%recipient
\begin{letter}{%
Max Musterkunde \\
Teststraße 2 \\
55555 Teststadt \\
Schweiz \\
}
\AddToShipoutPicture{
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north east,yshift=-20.0pt,xshift=-10]%
at (current page.north east)
{\includegraphics[height=18mm]{example-image}};
\node [anchor=north west,yshift=-20.0pt,xshift=47]%
at (current page.north west)
{\includegraphics[height=15mm]{example-image}};
\node [anchor=south east,yshift=0pt,xshift=0]%
at (current page.south east)
{\includegraphics[height=13mm]{example-image}};
\end{tikzpicture}
}
%
%\setkomavar{title}{Titel}
\setkomavar{subject}{BETREFF}
%
\opening{}
%
\Blindtext
\end{letter}
\end{document}
Edit: I put
\begin{textblock*}{3cm}(9.5cm,28.5cm) % {block width} (coords)
\pagemark
\end{textblock*}
in the firstfooter
and it is pretty stupid, but I have no other solution yet
Best Answer
To get a centered page number below the tables add:
after the parbox containing the third table, but inside the outer parbox.
Example:
I have removed options which are not needed in the example. Package
inputenc
with optionutf8
is only needed with outdated TeX distributions. Thetikz
andeso-pic
code is replaced by a new layer for all layer page styles (@everystyle@
).