emacs.d/texmf/tex/latex/mycustomstyles/komageneral.sty

121 lines
3.6 KiB
TeX

\ProvidesPackage{komageneral}
% Base packages
\usepackage{fontspec}
\usepackage{geometry}
\usepackage{scrlayer-scrpage} % Already included, will be used instead of fancyhdr
\usepackage{enumitem}
\usepackage{caption}
\usepackage[expansion,protrusion=true]{microtype}
\usepackage{polyglossia}
\usepackage{biblatex}
\usepackage{float}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{grffile}
\usepackage{unicode-math}
\usepackage[Export]{adjustbox}
% \usepackage{longtable}
% \usepackage{wrapfig}
% \usepackage{rotating}
% \usepackage[normalem]{ulem}
% \usepackage{amsmath}
% \usepackage{amssymb}
% \usepackage{capt-of}
% \usepackage{hyperref}
% \usepackage{graphicx}
\setdefaultlanguage{english}
\setotherlanguages{german}
\adjustboxset{max size={\textwidth}{0.6\textheight}}
\KOMAoptions{toc=flat,toc=listof}
% Font settings
\defaultfontfeatures{Ligatures=TeX, RawFeature={+zero, +liga}}
\setmainfont{Noto Serif Regular}[BoldFont={Noto Serif Bold}, ItalicFont={Noto Serif Italic}]
\setsansfont{Noto Sans Regular}[BoldFont={Noto Sans Bold}, ItalicFont={Noto Sans Italic}]
\setmonofont{Noto Sans Mono}[BoldFont={Noto Sans Mono Bold}, Scale=0.8]
\linespread{1.1}
% Geometry settings
\geometry{a4paper, left=2cm, right=2cm, top=2cm, bottom=2cm}
% Header and footer settings with scrlayer-scrpage instead of fancyhdr
\pagestyle{scrheadings}
\clearpairofpagestyles
\cfoot{\pagemark}
\setkomafont{pageheadfoot}{\normalfont}
\setkomafont{pagehead}{\normalfont}
% Section formatting with KOMA-Script features instead of titlesec
\setkomafont{section}{\Large\bfseries\sffamily}
\setkomafont{subsection}{\large\bfseries\sffamily}
\setkomafont{subsubsection}{\normalsize\bfseries\sffamily}
% Define the spacing between title and content
\RedeclareSectionCommand[beforeskip=\baselineskip, afterskip=0.5\baselineskip]{section}
\RedeclareSectionCommand[beforeskip=\baselineskip, afterskip=0.5\baselineskip]{subsection}
\RedeclareSectionCommand[beforeskip=\baselineskip, afterskip=0.5\baselineskip]{subsubsection}
% Define the spacing between section number and title
\renewcommand{\sectionformat}{\thesection\hspace{0.5em}}
\renewcommand{\subsectionformat}{\thesubsection\hspace{0.5em}}
\renewcommand{\subsubsectionformat}{\thesubsubsection\hspace{0.5em}}
% Set global table font to Noto Sans Condensed Light
\AtBeginEnvironment{tabular}{\fontspec{Noto Sans Condensed}}
\AtBeginEnvironment{longtable}{\fontspec{Noto Sans Condensed}}
% Caption settings
\captionsetup{font=small, labelfont=bf}
% Custom quote environment
\usepackage{etoolbox}
\AtBeginEnvironment{quote}{\itshape}
% Custom formatting commands
\newcommand{\important}[1]{\textbf{#1}}
\newcommand{\code}[1]{\texttt{#1}}
% Title page settings
\newcommand{\TitlePage}[3]{ % #1 - Logo file, #2 - Company name
\begin{titlepage}
\centering
\vspace*{1cm}
\includegraphics[width=0.3\textwidth]{#1}\par\vspace{1cm}
{\Huge #2\par}
\vspace{2cm}
{\Large #3\par}
\vfill
{\large \today\par}
\end{titlepage}
}
% Global listing settings
\lstset{
basicstyle={\ttfamily\color[rgb]{0.30, 0.34, 0.42}},
showstringspaces=false,
keywordstyle={\color[rgb]{0.23, 0.26, 0.32}\textbf},
commentstyle={\color[rgb]{0.26, 0.30, 0.37}},
stringstyle={\color[rgb]{0.18, 0.20, 0.25}},
frame=single,
numbers=left,
numbersep=5pt,
numberstyle={\ttfamily\color[rgb]{0.30, 0.34, 0.42}},
keepspaces=true,
showspaces=false,
showstringspaces=false,
showtabs=false,
breaklines=true,
breakatwhitespace=false,
tabsize=2,
columns=fullflexible,
aboveskip=1em,
belowskip=1em
}
% set description items to italic
\setlist[description]{font=\normalfont\itshape}