latex/main/core.tex

129 lines
3.6 KiB
TeX

% ▄▄█▀▀▀█▄█
% ▄██▀ ▀█
% ██▀ ▀ ▄██▀██▄▀███▄███ ▄▄█▀██
% ██ ██▀ ▀██ ██▀ ▀▀ ▄█▀ ██
% ██▄ ██ ██ ██ ██▀▀▀▀▀▀
% ▀██▄ ▄▀██▄ ▄██ ██ ██▄ ▄
% ▀▀█████▀ ▀█████▀▄████▄ ▀█████▀
% This file contains all necessary dependencies for the document to compile (at all) and some core macros
% Imports %
\typeout{[Core] Importing!}
\usepackage[table, dvipsnames]{xcolor}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[export]{adjustbox}
\usepackage[most]{tcolorbox}
\usepackage{cancel}
\usepackage{dsfont}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{lipsum}
\usepackage{ulem}
\usepackage{soul}
\usepackage{parskip}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{tocloft}
\usepackage{wasysym}
\usepackage{wrapfig}
\usepackage{multicol}
\usepackage{ifthen}
\usepackage[hidelinks]{hyperref}
\usepackage{enumitem}
% Language Switching. Currently only English and German are supported
% See docs for how to use
\newcounter{lang}
\newcommand{\setLang}[1]{
\edef\lang{#1}
\edef\en{en}
\edef\de{de}
\ifx\lang\en
\typeout{[Lang Switcher] Loading English}
\setcounter{lang}{1}
\else
\ifx\lang\de
\typeout{[Lang Switcher] Loading German}
\setcounter{lang}{2}
\input{\dir/main/lang/de}
\else
\typeout{[Lang Switcher] No such language!}
\fi
\fi
}
\newcommand{\loadLang}{
\ifnum\value{lang}<2{
\typeout{[Lang Loader] Loaded English}
}\else {
\typeout{[Lang Loader] Loaded German}
\setcounter{lang}{2}
}
\fi
}
% Create config counters / variables. See the config file for changing them
\newcounter{numberingConfig}
\newcounter{numberSubsections}
\newcounter{descriptorShadeStrength}
\newcounter{shadeStrength}
% Set up the latex document, configure author, title (as first argument), as well as headers and footers
\newcommand{\setup}[1]{
\typeout{[Setup] Setting up...}
\loadLang
\usepackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
\title{\Huge \textbf{#1}}
\author{\authorTitle}
\makeatletter
\makeatother
\fancyhead{}
\fancyhead[L]{#1}
\fancyhead[R]{\authorHeaders}
\fancyfoot{}
\fancyfoot[L]{\today}
\fancyfoot[R]{\thepage\ /\ \pageref{LastPage}}
\fancypagestyle{plain}{%
\fancyhead{}
\fancyhead[L]{#1}
\fancyhead[R]{\authorHeaders}
\fancyfoot{}
\fancyfoot[L]{\today}
\fancyfoot[R]{\thepage\ /\ \pageref{LastPage}}
}
}
% Start document command (required)
\newcommand{\startDocument}{
\maketitle
\pagestyle{fancy}
\thispagestyle{fancy}
}
% Set up the latex document, only configuring the author, title and page size
\newcommand{\setupBarebones}[1]{
\loadLang
\usepackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
\title{\Huge \textbf{#1}}
\author{\authorTitle}
}
% Set up the latex document for exam summaries (Extra wide body, small margins, no header)
\newcommand{\setupCheatSheet}[1]{
\loadLang
\usepackage[a4paper,textwidth=20cm,textheight=28cm,includehead]{geometry}
\title{#1}
\author{\authorTitle}
}
% translate the document between two languages
\newcommand{\translate}[2]{\ifnum\value{lang}<2{#1}\else{#2}\fi}