Skip to content
Snippets Groups Projects
Commit e92dd078 authored by fzieris's avatar fzieris
Browse files

Extract preamble into LaTeX class with a few options

parent f3890c63
No related branches found
No related tags found
No related merge requests found
% !TeX encoding = UTF-8 % !TeX encoding = UTF-8
\section{Einführung} \section{Einführung}
... \lipsum[2-3]
\subsection{Verwandte Arbeiten} \subsection{Dies und das}
Siehe \zb \cite{DjeOezSal07}. \lipsum[4-15]
% !TeX encoding = UTF-8 % !TeX encoding = UTF-8
\section{Grundlagen} \section{Grundlagen}
... \lipsum[8]
Siehe \zb \cite{Dje06, DjeOezSal07, CocWil00}.
\lipsum[9-11]
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{agse-thesis}[2017/05/23 v0.1 AGSE Thesis]
%%% Read options
% Language: Default is German
\newcommand{\lang}{ngerman}
\DeclareOption{de}{\renewcommand{\lang}{ngerman}}
\DeclareOption{en}{\renewcommand{\lang}{english}}
% Font family: Default is LaTeX's lmodern
\newcommand{\fonttype}{plain}
\DeclareOption{serif}{ \renewcommand{\fonttype}{serif}}
\DeclareOption{plain}{ \renewcommand{\fonttype}{plain}}
\DeclareOption{sans-serif}{\renewcommand{\fonttype}{sans-serif}}
% Document type: Default is article (twosided)
\newcommand{\baseClass}{article}
\DeclareOption{article}{%
\renewcommand{\baseClass}{article}
\PassOptionsToClass{twoside}{article}
}
\DeclareOption{book}{\renewcommand{\baseClass}{book}}
\newcommand{\useparskip}{no}
\DeclareOption{parskip}{\renewcommand{\useparskip}{yes}}
\DeclareOption{noparskip}{\renewcommand{\useparskip}{no}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseClass}}
\ProcessOptions\relax
\LoadClass[11pt,a4paper]{\baseClass}
% Load required language
\RequirePackage[\lang]{babel}
% Load required font
\RequirePackage{xifthen}
\ifthenelse{\equal{\fonttype}{plain}}{
\RequirePackage{lmodern}
}{}
\ifthenelse{\equal{\fonttype}{serif}}{
\RequirePackage[sc]{mathpazo}
\linespread{1.05} % Palladio needs more leading (space between lines)
}{}
\ifthenelse{\equal{\fonttype}{sans-serif}}{
\RequirePackage{paratype}
\renewcommand*\familydefault{\sfdefault}
}{}
\RequirePackage[T1]{fontenc}
% Allow unicode in input files
\RequirePackage[utf8]{inputenc}
% Set layout
\RequirePackage[
inner=3.4cm,
outer=3cm,
top=3cm,
marginparwidth=2.5cm,
marginparsep=0.1cm
]{geometry}
\ifthenelse{\equal{\useparskip}{yes}}{
\RequirePackage{parskip}
}{}
% Header and Footer Style
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[OR]{\slshape\nouppercase{\rightmark}}
\fancyhead[EL]{\slshape\nouppercase{\leftmark}}
\fancyfoot{}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0pt}
% Display Chapter and Section for book class
\ifthenelse{\equal{\baseClass}{book}}{
\renewcommand{\chaptermark}[1]{\markboth{%
\chaptername\ \thechapter.\ #1}{\chaptername\ \thechapter.\ #1}}
}{%
% Display Section and Subsection for article class
\renewcommand{\sectionmark}[1]{\markboth{%
\thesection.\ #1}{\thesection.\ #1}}
}
% PDF settings
\usepackage[%
pdfstartview=FitH,
linktocpage,
% two lines below = color links
colorlinks=true,
citecolor=blue!20!black!30!green,
% two lines below = don't color links
%colorlinks=false,
%pdfborder={0 0 0},
]{hyperref}
% Misc
\RequirePackage{fancyref}
\RequirePackage{url}
\RequirePackage{makeidx}
\RequirePackage[pdftex]{graphicx}
%%% BibTeX
\RequirePackage[numbers,sort&compress]{natbib}
\RequirePackage[nottoc]{tocbibind}
\bibliographystyle{plain}
% Java Code Listing Style
\RequirePackage{xcolor}
\RequirePackage{listings}
\definecolor{darkblue}{rgb}{0,0,.6}
\definecolor{darkgreen}{rgb}{0,0.5,0}
\definecolor{darkred}{rgb}{0.5,0,0}
\lstset{%
language=Java,
basicstyle=\ttfamily\small\upshape,
commentstyle=\color{darkgreen}\sffamily,
keywordstyle=\color{darkblue}\rmfamily\bfseries,
breaklines=true,
tabsize=2,
xleftmargin=3mm,
xrightmargin=3mm,
numbers=none,
frame=single,
stringstyle=\color{darkred},
showstringspaces=false
}
% Custom commands
\newcommand\zb{z.\,B.\ }
\renewcommand\dh{d.\,h.\ }
\newcommand{\mailto}[1]{\href{mailto:#1}{#1}}
\RequirePackage{pgfkeys}
\pgfkeys{
student/id/.estore in = \studentID,
student/mail/.estore in = \coverpageMail,
thesis/type/.estore in = \thesisType,
thesis/type = Bachelorarbeit,
thesis/date/.estore in = \thesisDate,
thesis/date = \today,
thesis/advisor/.estore in = \advisor,
thesis/examiner/.estore in = \firstExaminer,
thesis/examiner/2/.estore in = \secondExaminer,
thesis/group/.estore in = \groupName,
thesis/group = {Arbeitsgruppe Software Engineering},
title/size/.store in = \titleFontSize,
abstract/separate/.estore in = \separateAbstract,
}
% Define abstract environment for book class
\ifthenelse{\equal{\baseClass}{book}}%
{\newenvironment{abstract}%
{\begin{center}\textbf{\small\abstractname}\end{center}\quotation\small}%
{\endquotation}%
}{}
% (Re)define frontmatter and mainmatter
\ifthenelse{\equal{\baseClass}{book}}{
\let\frontmatterOrig\frontmatter
\renewcommand{\frontmatter}{
\frontmatterOrig
\pagestyle{plain}
}
\let\mainmatterOrig\mainmatter
\renewcommand{\mainmatter}{
\mainmatterOrig
\pagestyle{fancy}
\setcounter{page}{1}
}
}{
\newcommand{\frontmatter}{
\pagestyle{plain}
\pagenumbering{roman}
\setcounter{page}{1}
}
\newcommand{\mainmatter}{
\pagestyle{fancy}
\pagenumbering{arabic}
\setcounter{page}{1}
}
}
\RequirePackage{xstring}
\RequirePackage{etoolbox}
\newcommand{\coverpage}[2][]{
\pgfkeys{#1}
\pagestyle{empty}
\ifcsdef{separateAbstract}{\mbox{}\vspace{15mm}}{\mbox{}}
\begin{center}
\LARGE
\textbf{Freie Universität Berlin}
\vspace{4mm}
\normalsize
\thesisType{} am Institut für Informatik der Freien Universität Berlin
\vspace{2mm}
\groupName
\ifcsdef{separateAbstract}{\vspace{25mm}}{\vspace{13mm}}
\ifcsdef{titleFontSize}{}{%
\StrLen{\thesisTitle}[\titleLength]
\ifthenelse{\titleLength > 100}{%
\let\titleFontSize\LARGE
}{%
\let\titleFontSize\huge
}
}
\titleFontSize\thesisTitle
\ifcsdef{separateAbstract}{\vfill}{\vspace{13mm}}
\Large
\studentName \\
\normalsize
Matrikelnummer: \studentID\\
\mailto{\coverpageMail}
\vspace{4mm}
\begin{tabular}{rl}
\ifcsdef{advisor}{Betreuer: & \advisor\\}{}
Eingereicht bei: & \firstExaminer \\
\ifcsdef{secondExaminer}{Zweitgutachter: & \secondExaminer\\}{}
\end{tabular}
\vspace{4mm}
Berlin, \thesisDate
\end{center}
\ifcsdef{separateAbstract}{\cleardoublepage\frontmatter}{\vfill}
\begin{abstract}
#2
\end{abstract}
\ifcsdef{separateAbstract}{}{\frontmatter}
}
% !TeX encoding = UTF-8 % !TeX encoding = UTF-8
\subsection*{Eidesstattliche Erklärung} \subsection*{Eidesstattliche Erklärung}
Ich versichere hiermit an Eides Statt, dass diese Arbeit von niemand anderem als meiner Person verfasst worden ist. Alle verwendeten Hilfsmittel wie Berichte, Bücher, Internetseiten oder ähnliches sind im Literaturverzeichnis angegeben, Zitate aus fremden Arbeiten sind als solche kenntlich gemacht. Die Arbeit wurde bisher in gleicher oder ähnlicher Form keiner anderen Prüfungskommission vorgelegt und auch nicht veröffentlicht. Ich versichere hiermit an Eides Statt, dass diese Arbeit von niemand anderem
\parbig als meiner Person verfasst worden ist. Alle verwendeten Hilfsmittel wie
<Datum> \\\\ Berichte, Bücher, Internetseiten oder ähnliches sind im Literaturverzeichnis
<Name> angegeben, Zitate aus fremden Arbeiten sind als solche kenntlich gemacht. Die
Arbeit wurde bisher in gleicher oder ähnlicher Form keiner anderen
Prüfungskommission vorgelegt und auch nicht veröffentlicht.\\
\thesisDate \\
\studentName
No preview for this file type
% !TeX encoding = UTF-8 % !TeX encoding = UTF-8
\documentclass[11pt,a4paper,ngerman]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{lmodern}
%=============================================================================== %===============================================================================
% Global parameters, replace with actual values (remove < >) % Font options are:
\newcommand{\thesisTitle}{<Titel>} % plain (default), serif (uses Palladio), sans-serif (uses Paratype Sans)
\newcommand{\thesisType}{<X-Arbeit>} %Bachelorarbeit, Masterarbeit, Diplomarbeit % Layout options are:
\newcommand{\thesisDate}{\today} % article (default, no chapters), book (for longer texts, offers \chapter)
\newcommand{\instituteName}{Institut für Informatik} % Paragraph options are:
\newcommand{\groupName}{Arbeitsgruppe Software Engineering} % noparskip (default, no spacing between paragraphs), parskip (spaced)
\newcommand{\studentName}{<Vorname Nachname>} \documentclass[serif,article,noparskip]{agse-thesis}
\newcommand{\studentEmail}{example@mail.de}
% Global parameters, replace with actual values.
\newcommand{\thesisTitle}{Über den Sinn des Lebens}
% -> You may use \par (but not \\) to format the title. If you do so, you'll
% need to manually set the 'pdftitle' attribute below.
\newcommand{\studentName}{Hugo Schlupps}
%=============================================================================== %===============================================================================
% \hypersetup{pdftitle={\thesisTitle}}
\usepackage{fancyref} \hypersetup{pdfauthor={\studentName}}
\usepackage{fancyhdr}
\usepackage{url}
\usepackage{makeidx}
%
% PDF settings
\usepackage[pdftex]{graphicx}
\usepackage[%
pdfstartview=FitH,
pdftitle={\thesisTitle},
pdfauthor={\studentName},
colorlinks=true,
linktocpage
]{hyperref}
% colorlinks=false, pdfborder={0 0 0} % = keine farbigen Links
%
% Header and Footer Style
\pagestyle{fancy}
\fancyhead{}
\fancyhead[R]{\slshape \studentName}
\fancyhead[L]{\slshape\nouppercase{\rightmark}}
\fancyfoot{}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
%
% No identation
\setlength\headheight{15pt}
\setlength\parindent{0pt}
%
% Custom commands
\newcommand\zb{z.\,B.\ }
\renewcommand\dh{d.\,h.\ }
\newcommand\parbig{\par\bigskip}
\newcommand\parmed{\par\medskip}
\newcommand{\mailto}[1]{\href{mailto:#1}{#1}}
%
% Java Code Listing Style
\usepackage{xcolor}
\usepackage{listings}
\definecolor{darkblue}{rgb}{0,0,.6}
\definecolor{darkgreen}{rgb}{0,0.5,0}
\definecolor{darkred}{rgb}{0.5,0,0}
\lstset{%
language=Java,
basicstyle=\ttfamily\small\upshape,
commentstyle=\color{darkgreen}\sffamily,
keywordstyle=\color{darkblue}\rmfamily\bfseries,
breaklines=true,
tabsize=2,
xleftmargin=3mm,
xrightmargin=3mm,
numbers=none,
frame=single,
stringstyle=\color{darkred},
showstringspaces=false
}
%
% Title and author
\title{{\huge\bfseries Freie Universität Berlin}\\[2ex]
{\normalsize \thesisType{} am \instituteName{} der Freien Universität Berlin,
\groupName}\\[6ex]
\thesisTitle}
\author{\studentName\\
{\normalsize Matrikelnummer: }\\
{\normalsize \mailto{\studentEmail}}\\\\
{\normalsize Betreuer: }\\
{\normalsize Eingereicht bei: }}
\date{Berlin, \thesisDate}
% Blind texts, for demonstration only, not part of the actual template
\usepackage{lipsum}
\begin{document} \begin{document}
\begin{titlepage} \coverpage[
student/id=1234567,
\pagenumbering{alph} student/mail=email@inf.fu-berlin.de,
\maketitle thesis/type=Bachelorarbeit, % optional, default: Bachelorarbeit
\thispagestyle{empty} thesis/group={Arbeitsgruppe Software Engineering},
% optional, default: AGSE
thesis/advisor={Matt Visor}, % optional
thesis/examiner={Prof. Dr. Mia Maus},
thesis/examiner/2={Prof. Dr. Bob Bär}, % optional
thesis/date=\today, % optional, default: \today
%title/size=\LARGE, % set this value to overwrite automatic font size
%abstract/separate % toggle this to move the abstract to its own page
]
{ % Your abstract here:
\lipsum[1]
}
\vfill{} \cleardoublepage
\begin{abstract} \include{declaration}
Abstract
\end{abstract}
\vfill{} \cleardoublepage
\end{titlepage} \tableofcontents
\pagestyle{empty} \cleardoublepage
\clearpage\pagenumbering{roman}
\include{declaration} \mainmatter
\tableofcontents \input{1_introduction}
\input{2_fundamentals}
\input{3_main}
\input{4_conclusion}
\clearpage\pagenumbering{arabic} \bibliography{bibliography}
\pagestyle{fancy}
\setcounter{page}{1}
\include{1_introduction}
\include{2_fundamentals}
\include{3_main}
\include{4_conclusion}
\appendix \appendix
\include{5_appendix} \include{5_appendix}
\bibliographystyle{IEEEtran}
\bibliography{bibliography}
\end{document} \end{document}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment