SAT-WiSe-25-26/HSRTReport/Config/PageSetup.tex
2025-10-30 04:37:02 +01:00

135 lines
4.7 KiB
TeX

% !TEX root = ../HSRTReport.cls
% ==============================================================================
% Page Setup Configuration Module
% ==============================================================================
% Description: Page layout configuration including headers, footers, and styling
% Author: Frederik Beimgraben
% License: Creative Commons CC BY 4.0
% ==============================================================================
% ==============================================================================
% Required Packages
% ==============================================================================
\usepackage{lastpage} % For "Page X of Y" functionality
\usepackage{fancyhdr} % Already loaded, but ensure it's available
% ==============================================================================
% Page Style Configuration
% ==============================================================================
% Use fancy page style for headers and footers
\pagestyle{fancy}
% Remove default header rule
\renewcommand{\headrulewidth}{0pt}
% Override KOMA-Script chapter page style to use fancy instead of plain
\renewcommand{\chapterpagestyle}{fancy}
% ==============================================================================
% Page Number Configuration
% ==============================================================================
% Set page number font style
\setkomafont{pagenumber}{\color{gray}\blenderfont\selectfont}
% Adjust footer position - move up by reducing footskip
\setlength{\footskip}{25pt} % Reduced from default to move footer up
% ==============================================================================
% Header and Footer Setup
% ==============================================================================
% Clear all header and footer fields
\fancyhf{}
% ------------------------------------------------------------------------------
% Header Configuration
% ------------------------------------------------------------------------------
% Left header: Chapter number and title
% Right header: Document title
\fancyhead[R]{%
\color{gray}\blenderfont%
\ifnum\value{chapter}>0%
\thechapter\quad\leftmark%
\fi%
}
\fancyhead[L]{\color{gray}\blenderfont\@title} % Document title on right
% Update chapter marks to show only chapter name without "Chapter" prefix
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{} % Don't show sections in header
% ------------------------------------------------------------------------------
% Footer Configuration
% ------------------------------------------------------------------------------
% Footer format: Author Name | Module Name | Page X of Y
% The footer is centered
\fancyfoot[L]{%
\color{gray}\blenderfont%
\@author%
\quad|\quad%
\ifdef{\modulename}{\modulename}{Modul-Name}%
\quad|\quad%
Seite~\thepage~von~\pageref{LastPage}%
}
% ==============================================================================
% Plain Page Style (for chapter pages)
% ==============================================================================
% Define the plain page style (used on chapter start pages)
\fancypagestyle{plain}{
\fancyhf{}
% Show headers also on chapter start pages
\fancyhead[R]{%
\color{gray}\blenderfont%
\ifnum\value{chapter}>0%
\thechapter\quad\leftmark%
\fi%
}
\fancyhead[L]{\color{gray}\blenderfont\@title}
% Same footer as regular pages
\fancyfoot[L]{%
\color{gray}\blenderfont%
\@author%
\quad|\quad%
\ifdef{\modulename}{\modulename}{Modul-Name}%
\quad|\quad%
Seite~\thepage~von~\pageref{LastPage}%
}
\renewcommand{\headrulewidth}{0pt}
}
% ==============================================================================
% Fancy Page Style Definition
% ==============================================================================
% Explicitly define the fancy page style
\fancypagestyle{fancy}{
\fancyhf{}
\fancyhead[R]{%
\color{gray}\blenderfont%
\ifnum\value{chapter}>0%
\thechapter\quad\leftmark%
\fi%
}
\fancyhead[L]{\color{gray}\blenderfont\@title}
\fancyfoot[L]{%
\color{gray}\blenderfont%
\@author%
\quad|\quad%
\ifdef{\modulename}{\modulename}{Modul-Name}%
\quad|\quad%
Seite~\thepage~von~\pageref{LastPage}%
}
}
% ==============================================================================
% Override Default Page Styles
% ==============================================================================
% Ensure all special pages use fancy style
\AtBeginDocument{%
\pagestyle{fancy}%
\renewcommand{\chapterpagestyle}{fancy}%
}
% ==============================================================================
% End of Page Setup Module
% ==============================================================================