exercises end of chapter with chapter names

This commit is contained in:
Jan Benda 2019-12-01 18:00:12 +01:00
parent e0b6ca4f33
commit 51d0903d18
7 changed files with 19 additions and 10 deletions

View File

@ -1,7 +1,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{\tr{Bootstrap methods}{Bootstrap Methoden}}
\chapter{Bootstrap methods}
\label{bootstrapchapter}
\exercisechapter{Bootstrap methods}
Bootstrapping methods are applied to create distributions of
statistical measures via resampling of a sample. Bootstrapping offers several

View File

@ -290,14 +290,13 @@
%
\newboolean{showexercisesolutions}
\setboolean{showexercisesolutions}{true}
\newcommand{\exercisesolutions}{chapter} % 0: here, 1: chapter, 2: end
\newcommand{\exercisesolutions}{end} % 0: here, 1: chapter, 2: end
% we need this also as numbers:
\ifthenelse{\equal{\exercisesolutions}{end}}{\newcommand{\exercisesolutionsnum}{2}}{%
\ifthenelse{\equal{\exercisesolutions}{chapter}}{\newcommand{\exercisesolutionsnum}{1}}{%
\newcommand{\exercisesolutionsnum}{0}}}
\newcommand{\codepath}{}
\newcommand{\setcodepath}[1]{\ifthenelse{\not\equal{\exercisesolutions}{here}}{\renewcommand{\codepath}{#1/}}{}\lstset{inputpath=#1}}
\newcommand{\exercisesection}[1]{}
\usepackage{mdframed}
\usepackage{xstring}
\newlistof{exercisef}{loe}{\tr{Exercises}{\"Ubungen}}
@ -316,7 +315,11 @@
\xpretocmd{\include}{\def\currentjobname{#1}\immediate\openout\solutions=\currentjobname-solutions}{}{}\fi%
\ifnum\exercisesolutionsnum=2
\def\currentjobname{\jobname}
\immediate\openout\solutions=\currentjobname-solutions\fi
\immediate\openout\solutions=\currentjobname-solutions
\def\exercisechapter#1{\immediate\write\solutions{\unexpanded{\section}{\thechapter. #1}}}
\else
\def\exercisechapter#1{}
\fi
\newenvironment{exercise}[2]%
{ \setlength{\fboxsep}{2mm}%
\newcommand{\saveenumi}{\theenumi}\renewcommand{\labelenumi}{(\alph{enumi})}%
@ -330,7 +333,7 @@
\newcommand{\exercisefile}{\protect\StrSubstitute{#1}{_}{\_}}%
\newcommand{\exerciseoutput}{#2}%
}{%
\immediate\write\solutions{\unexpanded{\exercisesection}{Exercise \thechapter.\arabic{exercisef}}}%
\immediate\write\solutions{\unexpanded{\subsection}{Exercise \thechapter.\arabic{exercisef}}}%
\immediate\write\solutions{\unexpanded{\label}{solution\arabic{chapter}-\arabic{exercisef}}}%
\immediate\write\solutions{\unexpanded{\lstinputlisting[belowskip=0ex,aboveskip=0ex,%
nolol=true, title={\textbf{Source code:} \protect\StrSubstitute{#1}{_}{\_}}]}{\codepath#1}}%
@ -367,8 +370,9 @@
\or\(\equal{\exercisesolutions}{end}\and\not\isundefined{\chapternumber}\)}{%
\immediate\closeout\solutions%
\ifthenelse{\boolean{showexercisesolutions}}{%
\clearpage\section{Solutions to the exercises}%
\renewcommand{\exercisesection}[1]{\subsection{#1}}%
\clearpage\ifthenelse{\equal{\exercisesolutions}{chapter}}%
{\section{Solutions to the exercises}}%
{\chapter{Solutions to the exercises}}%
\ifthenelse{\isundefined{\chapternumber}}{\lstset{inputpath=}}{}%
\input{\currentjobname-solutions} }{}}{}}
\newcommand{\printallsolutions}{\ifthenelse{\equal{\exercisesolutions}{end}}{%
@ -376,7 +380,6 @@
\ifthenelse{\boolean{showexercisesolutions}}{%
\setcounter{secnumdepth}{0}\lstset{inputpath=}%
\clearpage\chapter{Solutions to the exercises}%
\renewcommand{\exercisesection}[1]{\section{#1}}%
\input{\currentjobname-solutions} }{}}{}}
\setlength{\cftexercisefindent}{1.2em}
\setlength{\cftexercisefnumwidth}{2.6em}

View File

@ -1,7 +1,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{\tr{Maximum likelihood estimation}{Maximum-Likelihood-Sch\"atzer}}
\chapter{Maximum likelihood estimation}
\label{maximumlikelihoodchapter}
\exercisechapter{Maximum likelihood estimation}
A common problem in statistics is to estimate from a probability
distribution one or more parameters $\theta$ that best describe the

View File

@ -1,6 +1,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Spiketrain analysis}
\exercisechapter{Spiketrain analysis}
\enterm[Action potentials]{action potentials} (\enterm{spikes}) are
the carriers of information in the nervous system. Thereby it is the

View File

@ -1,6 +1,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Programming in \matlab}
\label{programming}
\exercisechapter{Programming in MATLAB}
In this chapter we will cover the basics of programming in
\matlab{}. Starting with the concept of simple variables and data

View File

@ -1,4 +1,5 @@
\chapter{\tr{Optimization and gradient descent}{Optimierung und Gradientenabstieg}}
\chapter{Optimization and gradient descent}
\exercisechapter{Optimization and gradient descent}
To understand the behaviour of a given system sciences often probe the
system with input signals and then try to explain the responses

View File

@ -1,6 +1,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Descriptive statistics}
\exercisechapter{Descriptive statistics}
Descriptive statistics characterizes data sets by means of a few measures.
In addition to histograms that estimate the full distribution of the data,