[Font] Make font change better, document it

This commit is contained in:
2025-09-29 15:48:07 +02:00
parent c4779f3d6a
commit e8712fda9a
3 changed files with 62 additions and 48 deletions

Binary file not shown.

View File

@@ -29,7 +29,10 @@
\item \verb|\setcounter{descriptorShadeStrength}|\{\textit{number}\} Change the colour saturation of the inline descriptors \item \verb|\setcounter{descriptorShadeStrength}|\{\textit{number}\} Change the colour saturation of the inline descriptors
\item \verb|\setcounter{shadeStrength}|\{\textit{number}\} Change the colour saturation of the \verb|\shade| command \item \verb|\setcounter{shadeStrength}|\{\textit{number}\} Change the colour saturation of the \verb|\shade| command
\item \verb|\setLang|\{\textit{language}\} Change the language. Will automatically load babel in German. Can only be used once and only at the start of the document or in the preamble, as repeated usage leads to undefined behaviour \item \verb|\setLang|\{\textit{language}\} Change the language. Will automatically load babel in German. Can only be used once and only at the start of the document or in the preamble, as repeated usage leads to undefined behaviour
\item To change the font for the entire document, load the font package using \verb|\usepackage|, then select it by using \verb|\setFont{<font name>}|. A list of fonts is available \color{Cyan}\href{https://www.overleaf.com/learn/latex/Font_typefaces#Reference_guide}{here}\color{black}. You may change the font only for a specific section, by enclosing \verb|\setFont| and the text that should be written in said typeface in curly braces. \item To change the font for the entire document, load the font package using \verb|\usepackage|, with the last occurrence of a font package determining the active one.
Then select the type by using \verb|\setFontType|\textit{\{mono $|$ serif $|$ sans\}}.
A list of fonts is available \color{Cyan}\href{https://www.overleaf.com/learn/latex/Font_typefaces#Reference_guide}{here}\color{black}.
You may change the font only for a specific section, by enclosing \verb|\setFont| and the text that should be written in said typeface in curly braces.
\end{itemize} \end{itemize}
\newpage \newpage

View File

@@ -45,6 +45,17 @@
% Small style elements % % Small style elements %
% -------------------- % % -------------------- %
\newcommand{\setFont}[1]{\fontfamily{#1}\selectfont} \newcommand{\setFont}[1]{\fontfamily{#1}\selectfont}
\newcommand{\setFontType}[1]{
\ifthenelse{\equal{#1}{mono}}{
\renewcommand{\familydefault}{\ttdefault}
}{
\ifthenelse{\equal{#1}{serif}}{
\renewcommand{\familydefault}{\rmdefault}
}{
\renewcommand{\familydefault}{\sfdefault}
}
}
}
\renewcommand{\footrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt}
\newcommand{\TODO}{\color{red} \hl{TODO:} \color{black}} \newcommand{\TODO}{\color{red} \hl{TODO:} \color{black}}
\newcommand{\bi}[1]{\textbf{\textit{#1}}} \newcommand{\bi}[1]{\textbf{\textit{#1}}}