Files
mdbook-template/docs/header.tex
Martin Sukany c0f3e116fd update layout
2026-02-20 08:55:22 +01:00

126 lines
3.6 KiB
TeX
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
% header.tex
% Professional header for mdBook (via Pandoc) PDF output.
% Intended for use with pdflatex.
%
% This header provides:
% - Modern fonts and microtypography
% - Clean page geometry and headers/footers
% - Improved title formatting (with larger author text)
% - Professional table styling with alternating row colors and auto-scaling
%% 1. Encoding, Fonts, and Microtypography
\usepackage[utf8]{inputenc} % Source encoding
\usepackage[T1]{fontenc} % Font encoding
\usepackage{lmodern} % Modern fonts
\usepackage{microtype} % Improves typography
%% 1a. some additional stuff
\usepackage{titleps}
\usepackage{fancyhdr}
\usepackage{awesomebox}
\usepackage{minitoc}
%% 2. Page Geometry
\usepackage[a4paper,margin=1in]{geometry}
%% 3. Graphics and Colors
\usepackage{graphicx} % For images
\usepackage{xcolor}
\definecolor{linkcolor}{RGB}{0, 0, 180} % Deep blue for links
\definecolor{tableShade}{RGB}{245,245,245} % Light gray for table row shading
\definecolor{lightGreen}{RGB}{240,255,240} % Very light green
\definecolor{mediumGreen}{RGB}{220,255,220} % Darker green
\usepackage{colortbl}
%% 4. Hyperlinks
\usepackage{hyperref}
\hypersetup{
colorlinks = true,
linkcolor = linkcolor,
urlcolor = linkcolor,
citecolor = linkcolor,
}
%% 5. Title Formatting (using titling package)
\usepackage{titling}
\renewcommand{\maketitle}{%
\begin{titlepage}
\centering
% push block to vertical centre
\vspace*{\fill}
% Title
{\LARGE\bfseries\thetitle\par}
\vspace{1em}
% Author
{\large\theauthor\par}
\vspace{2em}
% Date
{\normalsize\itshape\thedate\par}
\vspace{2em}
% Logo
\includegraphics[width=0.35\textwidth]{logo.png}\par
% balance to bottom
\vspace*{\fill}
\end{titlepage}%
}
%% 6. Headers and Footers (fancyhdr)
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % Clear header/footer
\lhead{\small \nouppercase{\leftmark}}
\rhead{\small \thepage}
\rhead{\includegraphics[width=1cm]{logo.png}}
\renewcommand{\headrulewidth}{0.4pt}
%% 8. Table Packages: booktabs, tabularx, longtable, and array
%\usepackage{booktabs} % Professional table rules
%\usepackage{tabularx} % Flexible-width tables
%\usepackage{longtable} % Tables spanning multiple pages
%\usepackage{array} % Enhanced array and tabular environments
%\usepackage{colortbl} % For colored table rows
%% 9. Automatic Table Scaling and Alternating Row Colors
\usepackage{adjustbox} % For scaling tables to \textwidth
\usepackage{etoolbox} % For patching environments
% For longtable, add alternating row colors (without adjustbox to avoid grouping conflicts).
\AtBeginEnvironment{longtable}{\rowcolors{1}{mediumGreen}{lightGreen}}
%% 10. Define Custom Column Types for tabularx (optional)
% Use these column types in your Markdown (via Pandoc filters or manual LaTeX)
% to enforce equal-width columns.
\newcolumntype{Y}{>{\centering\arraybackslash}X} % centered
\newcolumntype{L}{>{\raggedright\arraybackslash}X} % left-aligned
\newcolumntype{R}{>{\raggedleft\arraybackslash}X} % right-aligned
%% 11. Use Helvetica sans-serif font
\usepackage{helvet} % Use Helvetica
\renewcommand{\familydefault}{\sfdefault} % Set the default to sans serif
%% 12. highlighting code blocks
\usepackage{listings}
\lstset{
backgroundcolor=\color{yellow},
basicstyle=\ttfamily,
breaklines=true
}