cleaned header.tex

This commit is contained in:
Jan Benda 2017-11-28 13:45:41 +01:00
parent eafb491ab3
commit 7f0c3e4544
2 changed files with 107 additions and 87 deletions

View File

@ -1,32 +1,38 @@
%%%%% title %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{\textbf{\huge\sffamily\tr{Introduction to\\[1ex] Scientific Computing}%
{Einf\"uhrung in die\\[1ex] wissenschaftliche Datenverarbeitung}}}
%%%%% 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 2017/2018\\\vfill \centerline{\includegraphics[width=0.7\textwidth]{announcements/correlationcartoon}\rotatebox{90}{\footnotesize\url{www.xkcd.com}}}}
\author{{\LARGE Jan Grewe \& Jan Benda}\\[5ex]Abteilung Neuroethologie\\[2ex]%
\includegraphics[width=0.3\textwidth]{UT_WBMW_Rot_RGB}\vspace{3ex}}
%%%% language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \newcommand{\tr}[2]{#1} % en
% \usepackage[english]{babel}
\date{WS 2017/2018\\\vfill%
\centerline{\includegraphics[width=0.7\textwidth]{announcements/correlationcartoon}%
\rotatebox{90}{\footnotesize\url{www.xkcd.com}}}}
%%%% language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\tr}[2]{#1} % en
% \newcommand{\tr}[2]{#2} % de
\usepackage[ngerman,english]{babel}
%%%% encoding %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% encoding %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[T1]{fontenc}
%%%% layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=25mm,right=25mm,top=20mm,bottom=30mm]{geometry}
%%%% fonts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{pslatex} % nice font for pdf file
%%%% layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=25mm,right=25mm,top=20mm,bottom=30mm]{geometry}
\usepackage[within=chapter]{newfloat}
\usepackage{tocloft}
\setlength{\cftfigindent}{1.2em}
\setlength{\cftfignumwidth}{2.6em}
%%%%% section style %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% section style %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[sf,bf,it,big,clearempty]{titlesec}
\setcounter{secnumdepth}{1}
\setcounter{tocdepth}{1}
%%%%% index %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% index %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[makeindex]{splitidx}
\makeindex
\usepackage[totoc]{idxlayout}
@ -36,14 +42,14 @@
\newindex[\tr{MATLAB code}{MATLAB Code}]{mcode}
\newindex[\tr{Python code}{Python Code}]{pcode}
%%%%% units %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% units %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[mediumspace,mediumqspace,Gray]{SIunits} % \ohm, \micro
%%%%% graphics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% graphics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{subcaption}
\usepackage{graphicx}
%%%%%%%%%%%%% colors %%%%%%%%%%%%%%%%
%%%%%%%%%%%%% colors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xcolor}
\definecolor{myyellow}{HTML}{FFEE00}
\definecolor{myblue}{HTML}{0055DD}
@ -60,7 +66,7 @@
\pagecolor{white}
%%%%% figures %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% figures %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% gnuplot figures:
\newcommand{\texinputpath}{}
\newcommand{\texpicture}[1]{{\sffamily\footnotesize\input{\texinputpath#1.tex}}}
@ -100,7 +106,7 @@
% put caption on separate float:
\newcommand{\breakfloat}{\end{figure}\begin{figure}[t]}
%%%%% figure references %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% figure references %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% references to panels of a figure within the caption:
\newcommand{\figitem}[1]{\textsf{\bfseries\uppercase{#1}}}
% references to figures:
@ -128,7 +134,10 @@
\newcommand{\subfigrefb}[2]{\figb~\subfref{#1}{#2}}
\newcommand{\subfigsrefb}[2]{\figsb~\subfref{#1}{#2}}
%%%%% table references %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%% tables %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{multirow}
%%%%% table references %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\tref}[1]{\textup{\ref{#1}}}
% references to tables in normal text:
\newcommand{\tab}{\tr{Tab.}{Tabelle}}
@ -150,7 +159,7 @@
% invisible rule for expanding the height of a row in a table body:
\newcommand{\erb}{\rule{0pt}{2.5ex}}
%%%%% equation references %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% equation references %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newcommand{\eqref}[1]{(\ref{#1})}
\newcommand{\eqn}{\tr{Eq}{Gl}.}
\newcommand{\Eqn}{\tr{Eq}{Gl}.}
@ -161,7 +170,19 @@
\newcommand{\eqnsref}[1]{\eqns~\eqref{#1}}
\newcommand{\Eqnsref}[1]{\Eqns~\eqref{#1}}
%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% 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}}
%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{listings}
\lstset{
basicstyle=\ttfamily\footnotesize,
@ -189,22 +210,7 @@
\let\l@lstlisting\l@figure
\makeatother
%%%%%%%%%%%%% 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: %%%%%%%%%%%%%%%
%%%%% english, german, code and file terms: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{ifthen}
\newcommand{\enterm}[2][]{\tr{\textit{#2}}{``#2''}\ifthenelse{\equal{#1}{}}{\tr{\protect\sindex[term]{#2}}{\protect\sindex[enterm]{#2}}}{\tr{\protect\sindex[term]{#1}}{\protect\sindex[enterm]{#1}}}}
\newcommand{\determ}[2][]{\tr{``#2''}{\textit{#2}}\ifthenelse{\equal{#1}{}}{\tr{\protect\sindex[determ]{#2}}{\protect\sindex[term]{#2}}}{\tr{\protect\sindex[determ]{#1}}{\protect\sindex[term]{#1}}}}
@ -214,13 +220,13 @@
% for escaping special characters into the index:
\newcommand{\scor}{"|}
%%%%% key-shortcuts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% 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: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% code/matlab commands: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{textcomp}
% typeset code inline:
@ -249,14 +255,14 @@
\newcommand{\matlabfun}[1]{(\tr{\matlab-function}{\matlab-Funktion} \varcode{#1})\protect\sindex[mcode]{#1}}
%%%%% shortquote and widequote commands: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% 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: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% exercises environment: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% usage:
%
% \begin{exercise}{somecode.m}{someoutput.out}
@ -272,7 +278,7 @@
% Output:
% content of someoutput.out
%
% Innerhalb der exercise Umgebung ist enumerate umdefiniert, um (a), (b), (c), .. zu erzeugen.
% Within the exercise environment enumerate is redefined to generate (a), (b), (c), ...
\usepackage{mdframed}
\usepackage{xstring}
\newlistof{exercisef}{loe}{\tr{Exercises}{\"Ubungen}}
@ -287,31 +293,40 @@
\newboolean{showexercisesolutions}
\setboolean{showexercisesolutions}{true}
\newenvironment{exercise}[2]%
{\newcommand{\exercisesource}{#1}%
{ \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}}%
\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}%
{ \renewcommand{\theenumi}{\saveenumi}%
\ifthenelse{\boolean{showexercisesolutions}}%
{ \hypersetup{hypertexnames=false}%
\ifthenelse{\equal{\exercisesource}{}}{}%
{\ifthenelse{\boolean{showexercisesolutions}}%
{\addtocounter{lstlisting}{-1}%
\lstinputlisting[belowskip=0pt,aboveskip=1ex,nolol=true,title={\textbf{\tr{Solution}{L\"osung}:} \exercisefile}]{\codepath\exercisesource}%
{ \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}}}{}}%
{ \addtocounter{lstlisting}{-1}%
\lstinputlisting[language={},title={\textbf{\tr{Output}{Ausgabe}:}},%
nolol=true,belowskip=0pt]%
{\codepath\exerciseoutput}%
}%
}%
\hypersetup{hypertexnames=true}%
}{}%
\end{mdframed}%
\renewcommand{\theenumi}{\saveenumi}}
}
\setlength{\cftexercisefindent}{1.2em}
\setlength{\cftexercisefnumwidth}{2.6em}
%%%%% info box environment: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% info box environment: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% usage:
%
% \begin{ibox}[tp]{Python}
@ -345,7 +360,7 @@
\setlength{\cftiboxfnumwidth}{2.6em}
%%%%% important environment: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% important environment: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% usage:
%
% \begin{important}[Apples are important]
@ -363,21 +378,26 @@
% chapterlistsgaps=on,
% ]{importantf}
\newenvironment{important}[1][]%
{\captionsetup{singlelinecheck=off,hypcap=false,labelformat={empty},labelfont={large,sf,it,bf},font={large,sf,it,bf}}
{ \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,%
{ \begin{mdframed}[linecolor=importantline,linewidth=1ex,%
backgroundcolor=importantback,font={\sffamily}]%
\setlength{\parindent}{0pt}\setlength{\parskip}{1ex}}%
{\begin{mdframed}[linecolor=importantline,linewidth=1ex,%
\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}}
\setlength{\parindent}{0pt}%
\setlength{\parskip}{1ex}%
}%
}%
{\end{mdframed}}
%%%%% hyperref %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% hyperref %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[bookmarks=true,bookmarksopen=true,%
pdfpagemode=UseNone,pdfstartview=FitH,%
plainpages=false,pdfpagelabels,%

View File

@ -1,13 +1,13 @@
function m = mymedian( x )
function m = mymedian(x)
% returns the median of the vector x
xs = sort( x );
if ( length( xs ) == 0 ) % empty input vector
xs = sort(x);
if length(xs) == 0 % empty input vector
m = NaN;
elseif ( rem( length( xs ), 2 ) == 0 ) % even number of data values
index = length( xs )/2;
m = (xs( index ) + xs( index+1 ))/2; % average the two central elements
elseif rem(length(xs), 2) == 0 % even number of data values
index = length(xs)/2;
m = (xs(index) + xs(index+1))/2; % average the two central elements
else % odd number of data values
index = (length( xs ) + 1)/2; % take the middle element
m = xs( index );
index = (length(xs) + 1)/2; % take the middle element
m = xs(index);
end
end