SAT-WiSe-25-26/HSRTReport/Config/PageSetup.tex

125 lines
4.3 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}
% ==============================================================================
% Page Number Configuration
% ==============================================================================
% Set page number font style
\setkomafont{pagenumber}{\color{gray}\blenderfont\selectfont}
% ==============================================================================
% Header and Footer Setup
% ==============================================================================
% Clear all header and footer fields
\fancyhf{}
% ------------------------------------------------------------------------------
% Header Configuration
% ------------------------------------------------------------------------------
% Left header: Chapter number and title
% Right header: Empty (no page number in header as per requirements)
\fancyhead[L]{%
\color{gray}\blenderfont%
\ifnum\value{chapter}>0%
\thechapter\quad\leftmark%
\fi%
}
\fancyhead[R]{} % Empty right header
% 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 and uses proper spacing
\fancyfoot[C]{%
\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{}
% No header on chapter start pages
\fancyhead[L]{}
\fancyhead[R]{}
% Same footer as regular pages
\fancyfoot[C]{%
\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[L]{%
\color{gray}\blenderfont%
\ifnum\value{chapter}>0%
\thechapter\quad\leftmark%
\fi%
}
\fancyhead[R]{}
\fancyfoot[C]{%
\color{gray}\blenderfont%
\@author%
\quad|\quad%
\ifdef{\modulename}{\modulename}{Modul-Name}%
\quad|\quad%
Seite~\thepage~von~\pageref{LastPage}%
}
}
% ==============================================================================
% Chapter Start Configuration
% ==============================================================================
% Ensure chapters start on a new page
\let\originalchapter\chapter
\renewcommand{\chapter}[1]{%
\clearpage%
\originalchapter{#1}%
}
% ==============================================================================
% End of Page Setup Module
% ==============================================================================