% !TEX root = ../HSRTReport.cls % ============================================================================== % Typography Configuration Module % ============================================================================== % Description: Typography settings including text alignment, spacing, and formatting % Author: Frederik Beimgraben % License: Creative Commons CC BY 4.0 % ============================================================================== % ============================================================================== % Page Style Configuration % ============================================================================== \pagestyle{fancy} % ============================================================================== % Line and Paragraph Spacing % ============================================================================== % Line spacing \renewcommand{\baselinestretch}{1.5} % ============================================================================== % Text Alignment % ============================================================================== % Use justified text (Blocksatz) - this is the default in LaTeX % No \raggedright command needed % Enable hyphenation for better text distribution in justified text % Lower penalties encourage more hyphenation for better spacing \hyphenpenalty=500 \exhyphenpenalty=500 \tolerance=1000 \emergencystretch=3em % Prevent excessive word spacing in justified text \spaceskip=0.3em plus 0.2em minus 0.1em \xspaceskip=0.6em plus 0.3em minus 0.15em % ============================================================================== % Widow and Orphan Control % ============================================================================== % Prevent single lines at the beginning or end of a page % High penalties discourage but don't absolutely prevent widows/orphans \widowpenalty=10000 \clubpenalty=10000 \displaywidowpenalty=10000 % Prevent page breaks right after section headings \@beginparpenalty=10000 \@endparpenalty=10000 % ============================================================================== % Enhanced Page Break Control % ============================================================================== % Section page break penalties are handled in PageBreakControl.tex % Minimum lines on a new page after section break % Require at least 2 paragraphs (approximately 8-10 lines) after a section \raggedbottom % Allow variable page heights to avoid bad breaks \flushbottom % But try to align bottoms when possible % Configure penalties for better paragraph cohesion \interlinepenalty=150 % Discourage breaks within paragraphs \predisplaypenalty=10000 % Prevent breaks before equations \postdisplaypenalty=10000 % Prevent breaks after equations \floatingpenalty=20000 % Strongly discourage breaks around floats % Keep at least two paragraphs together at page boundaries \setlength{\parskip}{0.5em plus 0.2em minus 0.1em} \parfillskip=0pt plus 1fil % ============================================================================== % Listing and Itemize Environment Protection % ============================================================================== % Prevent page breaks in listings \lstset{ float=H, % Force listings to stay in place belowskip=-0.5em plus 0.2em, % Adjust spacing aboveskip=0.5em plus 0.2em, keepspaces=true, breaklines=true } % Create protected itemize environment that resists page breaks \newenvironment{protecteditemize}{% \begin{minipage}{\linewidth}% \begin{itemize}% }{% \end{itemize}% \end{minipage}% } % Create protected enumerate environment \newenvironment{protectedenumerate}{% \begin{minipage}{\linewidth}% \begin{enumerate}% }{% \end{enumerate}% \end{minipage}% } % Hook into itemize/enumerate to discourage breaks without redefining % This avoids conflicts with enumitem package options \AtBeginEnvironment{itemize}{% \nopagebreak[4]% Strong discouragement of page break \interlinepenalty=5000% Discourage breaks within items } \AtEndEnvironment{itemize}{% \nopagebreak[3]% Discourage break after list } \AtBeginEnvironment{enumerate}{% \nopagebreak[4]% \interlinepenalty=5000% } \AtEndEnvironment{enumerate}{% \nopagebreak[3]% } % ============================================================================== % Needspace Package for Conditional Page Breaks % ============================================================================== \usepackage{needspace} % Section spacing is handled in PageBreakControl.tex % ============================================================================== % Float Placement Control % ============================================================================== % Adjust float placement to keep figures and tables near their reference \renewcommand{\floatpagefraction}{0.8} % Float page must be 80% full \renewcommand{\topfraction}{0.9} % Max 90% of page for top floats \renewcommand{\bottomfraction}{0.9} % Max 90% of page for bottom floats \renewcommand{\textfraction}{0.1} % Min 10% of page must be text \setcounter{topnumber}{2} % Max 2 floats at top of page \setcounter{bottomnumber}{2} % Max 2 floats at bottom of page \setcounter{totalnumber}{4} % Max 4 floats per page % ============================================================================== % List Formatting % ============================================================================== % Define a list paragraph style with no spacing between items % This will be used for compact lists as required \newenvironment{listenabsatz}{% \begin{itemize}[nosep,leftmargin=*]% }{% \end{itemize}% } % Also provide enumerated version \newenvironment{listenabsatz*}{% \begin{enumerate}[nosep,leftmargin=*]% }{% \end{enumerate}% } % ============================================================================== % End of Typography Configuration Module % ==============================================================================