This is sort of a follow-up to this question. I want to re-create a Word template for use in LaTeX.
Due to requirements on the sectioning levels, I need to switch from scrartcl
to scrreprt
. I know I can increase the numbering level with \setcounter{secnumdepth}{VALUE}
and I also know that mimicing the behaviour of scrartcl
with scrreprt
is generelly not a good idea. However, I want to try it.
My template has a constant header in the whole document and a footer, but only on the first page. With scrartcl
this looks like the following:
When I make the move to scrreprt
I suppress the titlepage with titlepage=false
in the documentclass options. Additionally, thanks to this thread, I suppress the page break before each chapter. However, when I do that, the header and footer on the first page and the header on the second page are missing. On page 3 the header is back where it is supposed to be.
To get my header and footer on the first page back, I guess I have to somehow modify \titlepagestyle
and for each chapters first page I have to modify \chapterpagestyle
. Unfortunately, I only found
\renewcommand*\titlepagestyle{firstpage}
\renewcommand*\chapterpagestyle{normalpage}
firstpage
and normalpage
are defined in my preamble. This solves the problem for each chapters first page, but unfortunately not for \titlepagestyle
. The header of the titlepage is there, but the footer is missing. Changing the style for the first page with \thispagestyle{firstpage}
does not seem to have an effect.
What am I missing?
MWE
\documentclass[titlepage=false,listof=totoc,bibliography=totoc,parskip=half-,11pt]{scrreprt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Preamble %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---------------------------
% Packages
% ---------------------------
\usepackage{anyfontsize}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{etoolbox}
\usepackage{geometry}
\usepackage{tabularx}
\usepackage[autooneside]{scrlayer-scrpage}
% Page geometry
\geometry{
left=25mm,
right=20mm,
top=25mm,
bottom=12mm,
includefoot=false,
headsep = \dimexpr2\baselineskip\relax,
footskip = \dimexpr1\baselineskip+1.5mm\relax,
}
% ---------------------------
% Template adjustments
% ---------------------------
% Title
\makeatletter
\def\@maketitle{%
\newpage
% Zweck
\begingroup%
\normalsize%
\bfseries%
Test
\par
\endgroup%
% Abstand
\vskip 2\baselineskip
% Authors
\begingroup%
\normalsize%
\bfseries%
\begin{tabularx}{\linewidth}{@{}X}%
\@author
\end{tabularx}
\par
\endgroup%
% Abstand
\vskip 1\baselineskip
% Title
\begingroup%
\normalsize
\bfseries
\@title%
\par%
\endgroup%
% Abstand
\vskip 1\baselineskip
\rule{\textwidth}{0.4pt}%
%\vskip 1.5em%
\vskip 1\baselineskip
% Beschreibung des Vorhabens
\begingroup%
\normalsize
\bfseries
Schalala
\par%
\endgroup%
\vskip 2\baselineskip
}
\makeatother
% Font sizes
\setkomafont{chapter}{\normalsize\bfseries}
\setkomafont{section}{\normalsize\bfseries}
\setkomafont{subsection}{\normalsize\bfseries}
\setkomafont{subsubsection}{\normalsize\bfseries}
\setkomafont{paragraph}{\normalsize\bfseries}
\setkomafont{subparagraph}{\normalsize\bfseries}
% ---------------------------
% Header/Footer commands
% ---------------------------
% Clear old headers/footers
\clearpairofpagestyles
% Fonts for headers/footers
\setkomafont{pageheadfoot}{\sffamily\footnotesize}
\setkomafont{pagehead}{\sffamily}
\setkomafont{pagination}{}
% Trennlinien fuer Kopf und Fuss
\KOMAoptions{
headsepline = false,
footsepline = false,
plainfootsepline = false,
}
% Create new header for title page
\newpairofpagestyles{firstpage}{%
\ihead{Inner head}
\ohead{Outer head}
\ifoot{%
%\hspace{-1em}
\raisebox{1cm}[0pt][0pt]{%
\begin{tabular}[t]{@{}l}
\textbf{An organization}\\
With an address\\
and communication channels
\end{tabular}
}
}
\cfoot{%
\raisebox{1cm}[0pt][0pt]{%
Footer on 1\textsuperscript{st} page only
}
}
\ofoot{%
\raisebox{0.25cm}[0pt][0pt]{%
{\fontsize{37}{44}\selectfont XYZ}
%\normalsize
}
}
}
% Page Layout for normal pages
\newpairofpagestyles{normalpage}{%
\ihead{Inner head}
\ohead{Outer head}
\ifoot{}
\ofoot{}
}
\renewcommand*\titlepagestyle{firstpage}
\renewcommand*\chapterpagestyle{normalpage}
% Abstaende
\RedeclareSectionCommand[
beforeskip=1\baselineskip,
afterskip=1\baselineskip
]{chapter}
\RedeclareSectionCommand[
beforeskip=1\baselineskip,
afterskip=1\baselineskip
]{section}
\RedeclareSectionCommand[
beforeskip=1\baselineskip,
afterskip=1\baselineskip
]{subsection}
\RedeclareSectionCommand[
beforeskip=1\baselineskip,
afterskip=1\baselineskip
]{subsubsection}
\RedeclareSectionCommand[
beforeskip=1\baselineskip,
afterskip=1\baselineskip
]{paragraph}
\RedeclareSectionCommand[
beforeskip=1\baselineskip,
afterskip=1\baselineskip
]{subparagraph}
%
\setlength{\parskip}{0cm}
% No chapter page break: https://tex.stackexchange.com/a/24067/44634
% for report:
%\makeatletter
%\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
%\makeatother
% for scrreprt:
\makeatletter
\patchcmd{\scr@startchapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title and author %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{Title}
\author{Author}
\date{\today}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Stuff at begin of document %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\AtBeginDocument{
\maketitle
\enlargethispage{-1cm}
\thispagestyle{firstpage}
\pagestyle{normalpage}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{First chapter}
\section{Section 1}
\Blindtext[2]
\section{Section 2}
\Blindtext[6]
\chapter{Second chapter}
\Blindtext[9]
\end{document}