PA_Vorlage/HSRTReport/HSRTReport.cls

272 lines
7.6 KiB
TeX

% =======================================================================================
% Original Author: Martin Oswald (Zürich University of Applied Sciences)
% Modified by: Frederik Beimgraben (University of Applied Sciences Reutlingen)
% Description: This class is a modified version of the ZHAWReport class by Martin Oswald.
% It is used for reports at the University of Applied Sciences Reutlingen.
% =======================================================================================
% License: Creative Commons CC BY 4.0
% Creative Commons Attribution-ShareAlike 4.0 International License.
%
% You should have received a copy of the license along with this
% work. If not, see <http://creativecommons.org/licenses/by-sa/4.0/>.
% =======================================================================================
% String comparison Command
\ExplSyntaxOn
\cs_new_eq:NN \strcompare \str_if_eq:eeTF
\ExplSyntaxOff
% Suppress all warnings; Only show errors
\usepackage{silence}
\WarningsOff*
% If not using XeTeX, print an error message and stop compiling
\ifx\XeTeXversion\undefined
\PackageError{HSRTReport}{This class can only be used with XeLaTeX.}{}
\stop
\fi
%----------------------------------------
% PATHS
%----------------------------------------
\def\classPath{HSRTReport}
\def\fontsPath{\classPath/Assets/Fonts}
\def\imagesPath{\classPath/Assets/Images}
%----------------------------------------
% CLASS DEFINITION AND PARAMETERS
%----------------------------------------
% Original: ZHAWReport.cls by Martin Oswald
\NeedsTeXFormat{LaTeX2e}
\newcommand{\classname}{HSRTReport/HSRTReport}
\ProvidesClass{\classname}[2024/07/08 HSRT Report Class]
\providecommand{\baseclass}{scrreprt}
% Default options
\PassOptionsToClass{pointlessnumbers}{\baseclass}
% Forward options to the base class
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\ProcessOptions\relax
% Load the base class with options
\LoadClass{\baseclass}
% ----------------------------------------
% Imports
% ----------------------------------------
\input{\classPath/Imports}
%----------------------------------------
% REFS
%----------------------------------------
\RequirePackage{hyperref}
\hypersetup{
pdfpagemode={UseOutlines},
bookmarksopen=true,
bookmarksopenlevel=0,
hypertexnames=false,
colorlinks=true,
citecolor=[rgb]{0.286, 0.427, 0.537},
linkcolor=[rgb]{0.161, 0.31, 0.427},
urlcolor=[rgb]{0.071, 0.212, 0.322},
pdfstartview={FitV},
unicode,
breaklinks=true
}
%----------------------------------------
% FONT SETUP
%----------------------------------------
\renewcommand*\rmdefault{lmr}
\renewcommand*\sfdefault{lmss}
\newfontfamily\blenderfont[
Path=\fontsPath/Blender/,
Extension=.ttf,
UprightFont=*-Medium,
BoldFont=*-Bold,
ItalicFont=*-MediumItalic,
BoldItalicFont=*-BoldItalic
]{Blender}
\newfontfamily\dinfont[
Path=\fontsPath/DIN/,
Extension=.ttf,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic
]{DIN}
\setsansfont{Blender}[
Path=\fontsPath/Blender/,
Extension=.ttf,
UprightFont=*-Medium,
BoldFont=*-Bold,
ItalicFont=*-MediumItalic,
BoldItalicFont=*-BoldItalic
]
\setmainfont{DIN}[
Path=\fontsPath/DIN/,
Extension=.ttf,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic
]
%----------------------------------------
% PAGE SETUP
%----------------------------------------
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
%----------------------------------------
% LOGOS
%----------------------------------------
% ==== Add more logos to be placed besides the main logo on the title page ====
\newcommand{\logosScale}{1}
\newcommand{\mainLogoScale}{1}
\newlength{\imageHeight}
\DeclareRobustCommand{\SetLogosScale}[1]{
\renewcommand{\logosScale}{#1}
}
\let\newglobalarray\newarray
\patchcmd{\newglobalarray}{\edef}{\xdef}{}{}
% Set the array to expand the elements
\expandarrayelementtrue
% AddLogo Command with automatic counter
% Array to store the logos and to be used in pgffor later
\newglobalarray\LogosPaths
\newglobalarray\LogosScales
\newglobalarray\LogosOpacities
\newglobalarray\LogosExtensions
\newcounter{logoCounter}
\setcounter{logoCounter}{0}
% Command to add a logo to the array
% Usage: \AddLogoToArray{<Name>}{<Scale>}{<Opacity>}
\DeclareRobustCommand{\AddLogo}[4]{
\stepcounter{logoCounter}
\LogosPaths(\thelogoCounter)={#1}
\LogosScales(\thelogoCounter)={#2}
\LogosOpacities(\thelogoCounter)={#3}
\LogosExtensions(\thelogoCounter)={#4}
}
% Command to get opacity of a logo
\DeclareRobustCommand{\GetLogoOpacity}[1]{
\expand{\LogosOpacities(#1)}
}
% =============================================================================
\def\skylinePath{\classPath/Assets/Images/Skyline.svg}
\newcommand{\footerYShift}{1.5em}
\newcommand{\footerXShift}{0.7em}
% Define the logo and its position
\AtBeginPage{
\setlength{\imageHeight}{2cm*\real{\mainLogoScale}*\real{\logosScale}*\real{0.45}}
\begin{tikzpicture}[overlay, remember picture]
% Skyline
\node[anchor=south west, inner sep=0pt, yshift=0em] at (current page.south west) {
\includesvg[width=1.5\paperwidth]{\skylinePath}
};
\end{tikzpicture}
}
%----------------------------------------
% TITLE PAGE
%----------------------------------------
\setkomafont{pagenumber}{\color{gray}\blenderfont\selectfont}
\fancypagestyle{fancy}{
\fancyhf{}
%\fancyfoot[R]{\color{gray}\blenderfont \@title~- \pagemark/\pageref{LastPage}}
}
% Set font for all headings
\setkomafont{disposition}{\blenderfont\bfseries}
\setkomafont{chapter}{\Large\blenderfont\bfseries}
\setkomafont{section}{\Large\blenderfont\bfseries}
\setkomafont{subsection}{\large\blenderfont\bfseries}
\setkomafont{subsubsection}{\large\blenderfont\bfseries}
\RedeclareSectionCommand[
beforeskip=1ex,
afterskip=0.5ex,
style=section
]{chapter}
\RedeclareSectionCommands[
beforeskip=0.6ex,
afterskip=0.3ex,
]{section,subsection,subsubsection}
\newcommand{\decoRule}{\rule{.8\textwidth}{.4pt}}
%----------------------------------------
% TABLE OF CONTENTS
%----------------------------------------
% Set the toc page style to fancy
\tocloftpagestyle{fancy}
% Page Numbering in the Table of Contents
\renewcommand\cftchappagefont{\blenderfont\color{gray}}
\renewcommand\cftsecpagefont{\blenderfont\color{gray}}
\renewcommand\cftsubsecpagefont{\blenderfont\color{gray}}
\renewcommand\cftsubsubsecpagefont{\blenderfont\color{gray}}
% Chap/Sec/... Title in the Table of Contents
\renewcommand\cftchapfont{\blenderfont\color{gray}}
\renewcommand\cftsecfont{\blenderfont\color{gray}}
\renewcommand\cftsubsecfont{\blenderfont\color{gray}}
\renewcommand\cftsubsubsecfont{\blenderfont\color{gray}}
\newlength\additionalToCIndent
\settowidth\additionalToCIndent{TOP.\hspace*{1em}}
\addtolength\cftchapnumwidth{\additionalToCIndent}
\typeout{cftchapnumwidth: \the\cftchapnumwidth}
\renewcommand\thechapter{TOP.\arabic{chapter}}
\RedeclareSectionCommand[
tocindent=0cm,
tocnumwidth=\cftchapnumwidth
]{chapter}
\RedeclareSectionCommand[
tocindent=0cm,
tocnumwidth=\cftchapnumwidth
]{section}
\RedeclareSectionCommand[
tocindent=0cm,
tocnumwidth=\cftchapnumwidth
]{subsection}
% ----------------------------------------
% Local Imports
% ----------------------------------------
\input{\classPath/Pages/PAPage.tex}
% ==== Tools ====
\input{\classPath/Modules/Listings}
\input{\classPath/Modules/Floats}
\input{\classPath/Modules/MeetingPresence}
\input{\classPath/Modules/InfoBlocks}
\input{\classPath/Modules/Watermark}
\input{\classPath/Modules/Typography}