\documentclass[a4paper, 13pt]{article}

% Packages
\usepackage[a4paper, inner=1.5cm, outer=1.5cm, top=1.5cm, bottom=3cm, bindingoffset=0cm]{geometry}
\usepackage{amsmath,amsthm,amssymb,amsfonts}
\usepackage{graphicx}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\usepackage{fontspec,xunicode,xltxtra}
\usepackage{afterpage}
\usepackage{float}
\usepackage{kantlipsum,lipsum}
\usepackage{eso-pic}
\usepackage{ragged2e}
\usepackage{fancyhdr}
\usepackage{background}
\usepackage{changepage}
\usepackage{tabularx}
\usepackage{pgf-pie}

% Font
\setmainfont{"[tierra-nueva.otf]"}[BoldFont="[tierra-nueva-bold.otf]"]

% GERMAN
\usepackage[ngerman=ngerman-x-latest]{hyphsubst}
\usepackage[ngerman]{babel}

% Fancy quote stuff
\usepackage[autostyle=false, style=german]{csquotes}
\MakeOuterQuote{"}

% Figures
\graphicspath{{figures/}}

% Flip image if odd
\newcommand\oddflip[2][]{
	\checkoddpage
	\ifoddpage\includegraphics[#1]{#2}
	\else\scalebox{-1}[1]{\includegraphics[#1]{#2}}
	\fi
}

% Header & footer
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\setlength{\headheight}{60pt}
\addtolength{\topmargin}{-35pt}
\pagestyle{fancy}
\fancyheadoffset{1.5cm}
\fancyfootoffset{1.5cm}
\fancyhf{}
\fancyhead[L]{\hspace*{1cm}\vspace*{-0.3cm}\Huge{\rightmark}}
\fancyfoot[R]{\vspace*{0cm}\oddflip[keepaspectratio=true, width=\paperwidth]{welle.png}}
\fancyfoot[L]{\checkoddpage\vspace*{-0.7cm}\hspace*{\ifoddpage 3cm \else 17.5cm \fi}\Huge{\thepage}}

% Custom title command for header
\renewcommand{\sectionmark}[1]{\markright{#1}}
\renewcommand{\title}[1]{
	\par\refstepcounter{section}
	\sectionmark{#1}
	\addcontentsline{toc}{section}{\protect\numberline{\thesection}#1}
}

% I don't like paragraph indentation
\setlength{\parindent}{0pt}

\begin{document}

\title{ABI Zeitung 2021}
\author{RBS Ulm TG13}

% Updated: https://tex.stackexchange.com/a/7657
% Import all tex files from a directory
\def\app@exe{\immediate\write18}
\def\inputall#1{
	\app@exe{cat #1/*.tex > #1/files.tmp}
	\InputIfFileExists{#1/files.tmp}{}{}
	\AtEndDocument{\app@exe{rm -f #1/files.tmp}}}

\def\part#1{\input{parts/#1.tex}\newpage}
\def\student{\input{parts/studenttemplate.tex}}
\def\ranking{\input{parts/rankingtemplate.tex}}
\def\generated#1{\input{parts/generated/#1.tex}}

%\maketitle

\backgroundsetup{contents={}}
\part{titlepage}
\backgroundsetup{contents={\oddflip[keepaspectratio=true, width=\paperwidth]{kordel.png}},scale=1.1,placement=top,opacity=1,position={0.4\textwidth, 3.3cm}}
\part{tableofcontents}
\part{introduction}
\part{classphoto}
\part{questionnaire}
\part{teacherprofiles}
\part{teacherranking}
\part{secrets}
\part{classoverview}
\part{studentprofiles}
\part{studentranking}
\part{citations}
\part{photos}
\part{trips}
\part{courseoverview}
\part{committeeoverview}
\part{conclusion}
\part{advertisements}
\part{imprint}

\end{document}
