%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%					
%%																		%%
%%						defaultPreamble.sty								%%
%%																		%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%																		%%
%%	Setup a preamble for document class: article						%%
%%	1.Pagesettings: 													%%
%%		- DIN A4 Paper													%%
%%		- Margin: Top 	 = 20mm											%%
%%				  Right  = 20mm											%%
%%				  Bottom = 30mm											%%
%%				  Left 	 = 20mm											%%
%%		- Header Separation = 10mm										%%
%%		- Footer Separation = 10mm										%%
%%		- Paragraph Spacing = 1.5 * line height							%%
%%																		%%
%%	2.Redefine Pagelayout												%%
%%		- Remove printed page numbers on page 1.						%%
%%		- Page 1+2 counts for the table of content.						%%
%%		- Print the page numbering like "Seite" a "von" lastpage 		%%
%%		  to the right bottom corner.									%%
%%																		%%
%%	3.Contain Packages 													%%
%%		- geometry	= Set page settings.								%%
%%		- setspace	= Set linespacing, prevent math formula				%%
%%					  streching.										%%
%%		- pageslts	= Get last page number.								%%
%%		- fancyhr	= Set header, footer and page layout.				%%
%%		- babel 	= Set hyphenation rules to [ngerman].				%%
%%		- inputenc	= Set input encoding to UTF-8 (Umlaute etc.).		%%
%%		- ClearSans	= Provide fontfamily ClearSans.						%%
%%		- helvet	= Set fontfamily to Helvetica (sans serif).			%%
%%		- fontenc	= Set font encoding to 8bit (support <,=,>,").		%%
%%		- xcolor	= Provides support of font colors.					%%
%%		- upquote	= Provides support quotes in verbatim and listings.	%%
%%		- listings	= Provides support of indention and code colering.	%%
%%		- float		= Provides support of fiqures and environment float.%%
%%		- hyperref	= Provides support of links (pdf anchor), URL.		%%
%%		- graphicx	= Provides support to add images.					%%
%%		- tabularx	= Provides advanced tabular support.				%%
%%		- pdfpages	= Provides support to include pdf pages.			%%
%%		- amsmath	= Provides advanced math typesetting support.		%%
%%		- amsfonts	= Provides advanced font typesetting support.		%%
%%		- amssymb	= Provides advanced symbol typesetting support.		%%
%%		- blindtext	= Provides support to use Lorem Ipsum text.			%%
%%		- enumitem	= Provides support change enum type in options.		%%
%%		- biblatex	= Set biblatex for citation and bibliography		%%
%%					  with biber as backend and the 					%%
%%					  bibliography style 'ieee'.						%%
%%																		%%
%%	4.Defines New Commands												%%
%%		- \includePdf{filename}		= Include a PDF file.				%%
%%		- \bibfilename{file.bib}	= Set bib file. 					%%
%%		- \printbib					= Print bibliography.				%%
%%		- \b{text}					= Set text to bold format.			%%
%%		- \mono{text}				= Set text to monospace.			%%
%%		- \minsep					= Set item spacing to minimum.		%%
%%		- \clear					= Set fontfamily to ClearSans.		%%
%%									  Default fontfamily is Helvetica.	%%
%%																		%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{defaultPreamble}[2019/03/04 v1.4 DefaultPreamble Package from Erik Roemmelt]%
\ProcessOptions\relax%
%%% Packages %%%
% ___Document___
\RequirePackage[a4paper, left=20mm, right=20mm, top=20mm, bottom=30mm, headsep=10mm, footskip=10mm]{geometry} % Set page settings
\RequirePackage[nodisplayskipstretch]{setspace} % Set linespacing and prevent math formula streching
\setstretch{1.5} % Change typeset line spacing by multiplicator 1.0
\RequirePackage[pagecontinue=false,alphMult=0,AlphMulti=0,fnsymbolmult=false,romanMult=false,RomanMulti=false]{pageslts} % Get last page number with \lastpageref{LastPage}
\RequirePackage{fancyhdr} % Set header, footer and page layout.
\pagestyle{fancy} % Set the pagestyle to fancyhdr settings
%%% Fancyhdr Settings %%%
\fancyhf{} % Clear all header and footer fields
\fancyfoot[R]{\ifnum\value{page}<1\relax\else{Seite \thepage \hspace{1pt} von \lastpageref{VeryLastPage}}\fi} % Set page numbering "n / last" in the right field of footer
\renewcommand{\headrulewidth}{0pt} % Set header ruler hidden
\renewcommand{\footrulewidth}{0pt} % Set footer ruler hidden
\fancypagestyle{plain}{% Redefine plain style
	\fancyhf{} % Clear all header and footer fields
	\fancyfoot[R]{\ifnum\value{page}<2\relax\else{Seite \thepage \hspace{1pt} von \lastpageref{VeryLastPage}}\fi} % Set page numbering "n / last" in the right field of footer, skip page numbering on page 1+2
	\renewcommand{\headrulewidth}{0pt} % Set header ruler hidden
	\renewcommand{\footrulewidth}{0pt} % Set footer ruler hidden
}%
% ___Font___
\RequirePackage[ngerman]{babel} % Changes hyphenation rules
\RequirePackage[utf8]{inputenc} % Input encoding: Unicode support (Umlaute etc.)
\RequirePackage{ClearSans} 		% Provide fontfamily Clear Sans (sans serif) for title page
\RequirePackage[scaled]{helvet} % Scales fontfamily Helvetica to .95 (sans serif)
\renewcommand{\familydefault}{\sfdefault} % Changes default font to sans serif Helvetica
%\RequirePackage[default]{sourcesanspro}
%\RequirePackage[sfdefault]{FiraSans} % option 'sfdefault' activates Fira Sans as the default text font
%\renewcommand*\oldstylenums[1]{{\firaoldstyle #1}}
%\RequirePackage[sfdefault,light]{roboto}  % Option 'sfdefault' only if the base font of the document is to be sans serif
\RequirePackage[T1]{fontenc}	% Font encoding: (8bit) Accents support (<,=,>,",...)
\RequirePackage[dvipsnames]{xcolor} % Provides font coloring
\definecolor{editorGray}{rgb}{0.95, 0.95, 0.95}	% Defines a new Color: gray
\definecolor{editorOcher}{rgb}{0.8, 0.4, 0} % #CC6600 -> rgb(204, 102, 0) % New Color Ocher
\definecolor{editorGreen}{rgb}{0, 0.5, 0} % #007C00 -> rgb(0, 124, 0) 	% New Color Green
\RequirePackage{upquote}		% Allow quotes in verbatim and lstlisting
\RequirePackage{listings}	% Allow indention and code colering
\lstdefinelanguage{JavaScript}{% Defines Javascript for lstlisting
	morekeywords={typeof,new,true,false,catch,function,return,null,catch,switch,var,if,in,while,do,else,case,break},morecomment=[s]{/*}{*/},morecomment=[l]//,morestring=[b]",morestring=[b]'}%
\lstdefinelanguage{HTML5}{%  Redefines HTML for lstlisting
	language=html,sensitive=true,alsoletter={<>=-},otherkeywords={% HTML tags
		<html>,<head>,<title>,</title>,<meta,/>,</head>,<body>,<canvas,\/canvas>,<script>,</script>,</body>,</html>,<!,html>,<style>,</style>,><},%
	ndkeywords={%
		% General
		=,%
		% HTML attributes
		charset=,id=,width=,height=,%
		% CSS properties
		border:,transform:,-moz-transform:,transition-duration:,transition-property:,transition-timing-function:},%
	morecomment=[s]{<!--}{-->},tag=[s]}%
\newcommand{\lstsetdefault}{%
\lstset{%
	% Basic design
	backgroundcolor=\color{editorGray},basicstyle={\small\ttfamily},frame=single,columns=fullflexible,%
	% Line numbers
	xleftmargin={0.75cm},numbers=left,stepnumber=1,firstnumber=1,numberfirstline=true,%
	% Code design   
	keywordstyle=\color{blue}\bfseries,commentstyle=\color{darkgray}\ttfamily,ndkeywordstyle=\color{editorGreen}\bfseries,stringstyle=\color{editorOcher},%
	% Code
	language=HTML5,alsolanguage=JavaScript,alsodigit={.:;},tabsize=4,showtabs=false,showspaces=false,showstringspaces=false,extendedchars=true,breaklines=true,%        
	% Support for German umlauts
	literate=%
	{Ö}{{\"O}}1%
	{Ä}{{\"A}}1%
	{Ü}{{\"U}}1%
	{ß}{{\ss}}1%
	{ü}{{\"u}}1%
	{ä}{{\"a}}1%
	{ö}{{\"o}}1%
}}%
\lstsetdefault%
% ___Other___
\RequirePackage{float} % Allow fiqures and enviroments to float
\RequirePackage[hidelinks,pdfpagelabels=true]{hyperref} % Add a link to your document
\RequirePackage{graphicx} % Add pictures to your document
\RequirePackage{tabularx} % Advanced tabular support
\RequirePackage{pdfpages} % Allows to include pdf pages
\RequirePackage{amsmath} % Advanced math typesetting
\RequirePackage{amsfonts} % Advanced font typesetting 
\RequirePackage{amssymb} % Advanced symoblic typesetting
\RequirePackage{blindtext} % Blindtext, Lorem Ipsum text
\RequirePackage[shortlabels]{enumitem} % Allows to change enumerate type easily
% __Bibliography___
\RequirePackage[backend=biber,style=ieee,sorting=nyt]{biblatex} % Use biblatex package
%%% New Commands %%%
% New command for closer spacing in list
\newcommand{\minsep}{\topsep=0pt\itemsep=0pt\parsep=0pt\partopsep=0pt}%
% Add new command to include a pdf file
\newcommand*{\@includePdf}{%
	\PackageWarning{defaultPreamble}{PDF-File does not exist}%
	NoN%
}%
\newcommand{\includePdf}[1]{\includepdf[pages=-,fitpaper=true,frame=false,pagecommand=\thispagestyle{plain}]{#1}}% Insert the name of the pdf file
% Add new command to set file name for *.bib file
\newcommand*{\@bibfilename}{%
	\PackageWarning{defaultPreamble}{Bib-File-Name undefined}%
	NoN%
}%
\newcommand{\bibfilename}[1]{\addbibresource{#1}}% Insert the name of the BibLatex file
% Add new command to print the bibliography
\newcommand{\printbib}{\printbibliography[heading=bibintoc]}% Insert the name of the BibLatex file
% Add new commant to shorten text format command: \textbf
\renewcommand{\b}{\textbf}%
% Add new commant to shorten text format command: \texttt
\newcommand{\mono}{\texttt}%
\endinput % Das ist das Ende von dieser .sty Datei