This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/header.tex

362 lines
14 KiB
TeX

%%%%% title %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{\textbf{\huge\sffamily\tr{Introduction to\\[1ex] Scientific Computing}{Einf\"uhrung in die\\[1ex] wissenschaftliche Datenverarbeitung}}}
\author{{\LARGE Jan Grewe \& Jan Benda}\\[5ex]Abteilung Neuroethologie\\[2ex]\includegraphics[width=0.3\textwidth]{UT_WBMW_Rot_RGB}\vspace{3ex}}
\date{WS 15/16\\\vfill \centerline{\includegraphics[width=0.7\textwidth]{announcements/correlationcartoon}\rotatebox{90}{\footnotesize\url{www.xkcd.com}}}}
%%%% language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \newcommand{\tr}[2]{#1} % en
% \usepackage[english]{babel}
\newcommand{\tr}[2]{#2} % de
\usepackage[ngerman, english]{babel}
%%%% encoding %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[T1]{fontenc}
%%%% layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=25mm,right=25mm,top=20mm,bottom=30mm]{geometry}
\usepackage{pslatex} % nice font for pdf file
\usepackage[within=chapter]{newfloat}
%%%%% section style %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[sf,bf,it,big,clearempty]{titlesec}
\setcounter{secnumdepth}{1}
\setcounter{tocdepth}{1}
%%%%% index %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[makeindex]{splitidx}
\makeindex
\usepackage[totoc]{idxlayout}
\newindex[Fachbegriffe]{term}
\newindex[Englische Fachbegriffe]{enterm}
\newindex[MATLAB Code]{mcode}
\newindex[Python Code]{pcode}
%%%%% units %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[mediumspace,mediumqspace,Gray]{SIunits} % \ohm, \micro
%%%%% graphics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{subcaption}
\usepackage{graphicx}
%%%%%%%%%%%%% colors %%%%%%%%%%%%%%%%
\usepackage{xcolor}
\definecolor{myyellow}{HTML}{FFEE00}
\definecolor{myblue}{HTML}{0055DD}
\colorlet{codeback}{myblue!10}
\colorlet{exerciseback}{myyellow!20}
\colorlet{importantback}{myblue!15}
\colorlet{importantline}{myblue!50}
\colorlet{infoback}{myyellow!20}
\colorlet{infoline}{myyellow!60}
\definecolor{mygreen}{rgb}{0.2,0.7,0.2} % for 'TRUE'
\definecolor{myred}{rgb}{1.,0,0} % for 'FALSE'
\pagecolor{white}
%%%%% figures %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% gnuplot figures:
\newcommand{\texinputpath}{}
\newcommand{\texpicture}[1]{{\sffamily\footnotesize\input{\texinputpath#1.tex}}}
\newcommand{\figlabel}[1]{\textsf{\textbf{\large \uppercase{#1}}}}
% maximum number of floats:
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{0}
\setcounter{totalnumber}{2}
% float placement fractions:
\renewcommand{\textfraction}{0.2}
\renewcommand{\topfraction}{0.9}
\renewcommand{\bottomfraction}{0.0}
\renewcommand{\floatpagefraction}{0.7}
% spacing for floats:
\setlength{\floatsep}{12pt plus 2pt minus 2pt}
\setlength{\textfloatsep}{10pt plus 4pt minus 2pt}
\setlength{\intextsep}{12pt plus 2pt minus 2pt}
% spacing for a floating page:
\makeatletter
\setlength{\@fptop}{0pt}
\setlength{\@fpsep}{8pt plus 2.0fil}
\setlength{\@fpbot}{0pt plus 1.0fil}
\makeatother
% rules for floats:
%\newcommand{\topfigrule}{\vspace*{10pt}{\hrule height0.4pt}\vspace*{-10.4pt}}
%\newcommand{\bottomfigrule}{\vspace*{-10.4pt}{\hrule height0.4pt}\vspace*{10pt}}
% captions:
\usepackage[singlelinecheck=off,labelfont=bf,font={small,sf}]{caption}
\newcommand{\titlecaption}[2]{\caption[#1]{\textbf{#1} #2}}
% put caption on separate float:
\newcommand{\breakfloat}{\end{figure}\begin{figure}[t]}
%%%%% figure references %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% references to panels of a figure within the caption:
\newcommand{\figitem}[1]{\textsf{\bfseries\uppercase{#1}}}
% references to figures:
\newcommand{\panel}[1]{\textsf{\uppercase{#1}}}
\newcommand{\fref}[1]{\textup{\ref{#1}}}
\newcommand{\subfref}[2]{\textup{\ref{#1}}\,\panel{#2}}
% references to figures in normal text:
\newcommand{\fig}{\tr{Fig.}{Abb.}}
\newcommand{\Fig}{\tr{Figure}{Abb.}}
\newcommand{\figs}{\tr{Figs.}{Abb.}}
\newcommand{\Figs}{\tr{Figures}{Abb.}}
\newcommand{\figref}[1]{\fig~\fref{#1}}
\newcommand{\Figref}[1]{\Fig~\fref{#1}}
\newcommand{\figsref}[1]{\figs~\fref{#1}}
\newcommand{\Figsref}[1]{\Figs~\fref{#1}}
\newcommand{\subfigref}[2]{\fig~\subfref{#1}{#2}}
\newcommand{\Subfigref}[2]{\Fig~\subfref{#1}{#2}}
\newcommand{\subfigsref}[2]{\figs~\subfref{#1}{#2}}
\newcommand{\Subfigsref}[2]{\Figs~\subfref{#1}{#2}}
% references to figures within bracketed text:
\newcommand{\figb}{\tr{Fig.}{Abb.}}
\newcommand{\figsb}{\tr{Figs.}{Abb.}}
\newcommand{\figrefb}[1]{\figb~\fref{#1}}
\newcommand{\figsrefb}[1]{\figsb~\fref{#1}}
\newcommand{\subfigrefb}[2]{\figb~\subfref{#1}{#2}}
\newcommand{\subfigsrefb}[2]{\figsb~\subfref{#1}{#2}}
%%%%% table references %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\tref}[1]{\textup{\ref{#1}}}
% references to tables in normal text:
\newcommand{\tab}{\tr{Tab.}{Tabelle}}
\newcommand{\Tab}{\tr{Tabel}{Tabelle}}
\newcommand{\tabs}{\tr{Tabs.}{Tabellen}}
\newcommand{\Tabs}{\tr{Tabels.}{Tabellen}}
\newcommand{\tabref}[1]{\tab~\tref{#1}}
\newcommand{\Tabref}[1]{\Tab~\tref{#1}}
\newcommand{\tabsref}[1]{\tabs~\tref{#1}}
\newcommand{\Tabsref}[1]{\Tabs~\tref{#1}}
% references to tables within bracketed text:
\newcommand{\tabb}{\tr{Tab.}{Tabelle}}
\newcommand{\tabsb}{\tr{Tab.}{Tabelle}}
\newcommand{\tabrefb}[1]{\tabb~\tref{#1}}
\newcommand{\tabsrefb}[1]{\tabsb~\tref{#1}}
% invisible rule for expanding the height of a row in a table header:
\newcommand{\erh}{\rule[-1.2ex]{0pt}{3.5ex}}
% invisible rule for expanding the height of a row in a table body:
\newcommand{\erb}{\rule{0pt}{2.5ex}}
%%%%% equation references %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newcommand{\eqref}[1]{(\ref{#1})}
\newcommand{\eqn}{\tr{Eq}{Gl}.}
\newcommand{\Eqn}{\tr{Eq}{Gl}.}
\newcommand{\eqns}{\tr{Eqs}{Gln}.}
\newcommand{\Eqns}{\tr{Eqs}{Gln}.}
\newcommand{\eqnref}[1]{\eqn~\eqref{#1}}
\newcommand{\Eqnref}[1]{\Eqn~\eqref{#1}}
\newcommand{\eqnsref}[1]{\eqns~\eqref{#1}}
\newcommand{\Eqnsref}[1]{\Eqns~\eqref{#1}}
%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{listings}
\lstset{
basicstyle=\ttfamily\footnotesize,
numbers=left,
showstringspaces=false,
language=Matlab,
commentstyle=\itshape\color{red!60!black},
keywordstyle=\color{blue!50!black},
stringstyle=\color{green!50!black},
backgroundcolor=\color{codeback},
breaklines=true,
breakautoindent=true,
% columns=flexible, % this kills the monospace font
frame=single,
caption={\protect\filename@parse{\lstname}\protect\filename@base},
captionpos=t,
xleftmargin=21pt,
xrightmargin=1mm,
aboveskip=1ex,
belowskip=2ex
}
\SetupFloatingEnvironment{lstlisting}{chapterlistsgaps=on}
%%%%%%%%%%%%% Table stuff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{multirow}
%%%%% math stuff: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsmath}
\usepackage{bm}
\usepackage{dsfont}
\newcommand{\naZ}{\mathds{N}}
\newcommand{\gaZ}{\mathds{Z}}
\newcommand{\raZ}{\mathds{Q}}
\newcommand{\reZ}{\mathds{R}}
\newcommand{\reZp}{\mathds{R^+}}
\newcommand{\reZpN}{\mathds{R^+_0}}
\newcommand{\koZ}{\mathds{C}}
%%%%% english, german, code and file terms: %%%%%%%%%%%%%%%
\usepackage{ifthen}
\newcommand{\enterm}[2][]{``#2''\ifthenelse{\equal{#1}{}}{\protect\sindex[enterm]{#2}}{\protect\sindex[enterm]{#1}}}
\newcommand{\determ}[2][]{\textit{#2}\ifthenelse{\equal{#1}{}}{\protect\sindex[term]{#2}}{\protect\sindex[term]{#1}}}
\newcommand{\codeterm}[2][]{\textit{#2}\ifthenelse{\equal{#1}{}}{\protect\sindex[term]{#2}}{\protect\sindex[term]{#1}}}
\newcommand{\file}[1]{\texttt{#1}}
% for escaping special characters into the index:
\newcommand{\scor}{"|}
%%%%% key-shortcuts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tikz}
\usetikzlibrary{shapes}
\tikzstyle{keybox} = [draw=blue!50!black,fill=white,thick,rectangle,rounded corners,inner sep=3pt,inner ysep=2pt]
\newcommand{\keycode}[1]{\begin{tikzpicture}[baseline=(box.base)]\node[keybox](box){\texttt{#1}};\end{tikzpicture}}
%%%%% code/matlab commands: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{textcomp}
\newcommand{\varcode}[1]{\setlength{\fboxsep}{0.5ex}\colorbox{codeback}{\texttt{#1\protect\rule[-0.1ex]{0pt}{1.6ex}}}}
\newcommand{\code}[2][]{\varcode{#2}\ifthenelse{\equal{#1}{}}{\protect\sindex[mcode]{#2}}{\protect\sindex[mcode]{#1}}}
\newcommand{\pcode}[2][]{\varcode{#2}\ifthenelse{\equal{#1}{}}{\protect\sindex[pcode]{#2}}{\protect\sindex[pcode]{#1}}}
\newcommand{\mcode}[2][]{\varcode{#2}\ifthenelse{\equal{#1}{}}{\protect\sindex[mcode]{#2}}{\protect\sindex[mcode]{#1}}}
\newcommand{\python}{Python}
\newcommand{\matlab}{\texorpdfstring{MATLAB$^{\copyright}$}{MATLAB}}
\newcommand{\pythonfun}[2][]{(\tr{\python-function}{\python-Funktion} \setlength{\fboxsep}{0.5ex}\colorbox{codeback}{\texttt{#2}})\ifthenelse{\equal{#1}{}}{\protect\sindex[pcode]{#2}}{\protect\sindex[pcode]{#1}}}
\newcommand{\matlabfun}[2][]{(\tr{\matlab-function}{\matlab-Funktion} \setlength{\fboxsep}{0.5ex}\colorbox{codeback}{\texttt{#2}})\ifthenelse{\equal{#1}{}}{\protect\sindex[mcode]{#2}}{\protect\sindex[mcode]{#1}}}
%%%%% shortquote and widequote commands: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \shortquote{Something to be quoted}{Source}
\newcommand{\shortquote}[2]{\begin{list}{}{\rightmargin\leftmargin}\item\relax\itshape #1 \hfill \upshape #2\end{list}}
% \widequote{Something to be quoted}{Source}
\newcommand{\widequote}[2]{{\itshape #1} \hfill #2}
%%%%% exercises environment: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% usage:
%
% \begin{exercise}{somecode.m}{someoutput.out}
% Write a function that computes the median.
% \end{exercise}
%
% result:
%
% Exercise 1:
% Write a function that computes the median.
% Listing 1: somecode.m
% the listing
% Output:
% content of someoutput.out
%
% Innerhalb der exercise Umgebung ist enumerate umdefiniert, um (a), (b), (c), .. zu erzeugen.
\usepackage{mdframed}
\usepackage{xstring}
\newcommand{\codepath}{}
\DeclareFloatingEnvironment[
fileext=loe,
listname={\tr{Exercises}{\"Ubungen}},
name={\tr{Exercise}{\"Ubung}},
placement=t
]{exercisef}
\newcounter{maxexercise}
\setcounter{maxexercise}{10000} % show listings up to exercise maxexercise
\newenvironment{exercise}[2]%
{\newcommand{\exercisesource}{#1}%
\newcommand{\exercisefile}{\protect\StrSubstitute{#1}{_}{\_}}%
\newcommand{\exerciseoutput}{#2}%
\setlength{\fboxsep}{2mm}%
\newcommand{\saveenumi}{\theenumi}\renewcommand{\labelenumi}{(\alph{enumi})}%
\captionsetup{singlelinecheck=off,hypcap=false,labelfont={large,sf,it,bf},font={large,sf,it,bf},skip={0.5ex}}%
\begin{mdframed}[linewidth=0pt,backgroundcolor=exerciseback]%
\captionof{exercisef}[\exercisefile]{}%
\captionsetup{font={normal,sf,it}}%
}%
{\hypersetup{hypertexnames=false}%
\ifthenelse{\equal{\exercisesource}{}}{}%
{\ifthenelse{\value{exercisef}>\value{maxexercise}}{}%
{\addtocounter{lstlisting}{-1}%
\lstinputlisting[belowskip=0pt,aboveskip=1ex,nolol=true,title={\textbf{\tr{Solution}{L\"osung}:} \exercisefile}]{\codepath\exercisesource}%
\ifthenelse{\equal{\exerciseoutput}{}}{}%
{\addtocounter{lstlisting}{-1}%
\lstinputlisting[language={},title={\textbf{\tr{Output}{Ausgabe}:}},nolol=true,belowskip=0pt]{\codepath\exerciseoutput}}}}%
\hypersetup{hypertexnames=true}%
\end{mdframed}%
\renewcommand{\theenumi}{\saveenumi}}
%%%%% info box environment: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% usage:
%
% \begin{ibox}[tp]{Python}
% The cooler programming language.
% \end{exercise}
%
% results in a nicely colored float:
%
% Info Box 1: Python
% The cooler programming language.
\DeclareFloatingEnvironment[
fileext=lob,
listname={\tr{Info and Important Boxes}{Info- und Merk-Boxen}},
name={Info-Box},
placement=t
]{iboxf}
\newenvironment{ibox}[2][tp]
{\SetupFloatingEnvironment{iboxf}{placement=#1}%
\begin{iboxf}%
\captionsetup{singlelinecheck=off,labelfont={large,sf,it,bf},font={large,sf,it,bf}}%
\begin{mdframed}[linecolor=infoline,linewidth=1ex,%
backgroundcolor=infoback,font={\sffamily},%
frametitle={\caption{#2}},frametitleaboveskip=-1ex,%
frametitlebackgroundcolor=infoline]%
\setlength{\parindent}{0pt}\setlength{\parskip}{1ex}%
\captionsetup{singlelinecheck=off,labelfont={normalsize,sf,bf},font={normalsize,sf}}}%
{\end{mdframed}%
\end{iboxf}}
%%%%% important environment: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% usage:
%
% \begin{important}[Apples are important]
% Something you should really remember.
% \end{important}
%
% results in a nicely colored box with the text inside.
% The optional title of the box "Apples are important"
% also appears in the list of important things.
% \DeclareFloatingEnvironment[
% fileext=loi,
% listname={\tr{Important hints}{Merk-Boxen}},
% name={Merk-Box},
% placement=t
% ]{importantf}
\newenvironment{important}[1][]%
{\captionsetup{singlelinecheck=off,hypcap=false,labelformat={empty},labelfont={large,sf,it,bf},font={large,sf,it,bf}}
\ifthenelse{\equal{#1}{}}%
{\begin{mdframed}[linecolor=importantline,linewidth=1ex,%
backgroundcolor=importantback,font={\sffamily}]%
\setlength{\parindent}{0pt}\setlength{\parskip}{1ex}}%
{\begin{mdframed}[linecolor=importantline,linewidth=1ex,%
backgroundcolor=importantback,font={\sffamily},%
frametitle={\captionof{iboxf}{#1}},frametitleaboveskip=-1ex,%
frametitlebackgroundcolor=importantline]%
\setlength{\parindent}{0pt}\setlength{\parskip}{1ex}}%
}%
{\end{mdframed}}
%%%%% hyperref %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[bookmarks=true,bookmarksopen=true,%
pdfpagemode=UseNone,pdfstartview=FitH,%
plainpages=false,pdfpagelabels,%
breaklinks=true,colorlinks=true,%
citecolor=blue!50!black,linkcolor=red!70!black,urlcolor=blue!50!black]{hyperref}