From 543078659bab3da68f25a6956ff7e512f5487f44 Mon Sep 17 00:00:00 2001 From: Jan Benda Date: Tue, 1 Dec 2015 11:44:35 +0100 Subject: [PATCH] Fixed pathes and added \mcode and \pcode macros --- header.tex | 20 +++++++++++++++++--- programming/lecture/programming-chapter.tex | 2 +- programming/lecture/programming.tex | 4 ++-- scientificcomputing-script.tex | 5 +++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/header.tex b/header.tex index 2e3face..c2b1572 100644 --- a/header.tex +++ b/header.tex @@ -29,7 +29,8 @@ \usepackage[totoc]{idxlayout} \newindex[Fachbegriffe]{term} \newindex[Englische Fachbegriffe]{enterm} -\newindex[MATLAB Code]{code} +\newindex[MATLAB Code]{mcode} +\newindex[Python Code]{pcode} %%%%% units %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage[mediumspace,mediumqspace,Gray]{SIunits} % \ohm, \micro @@ -213,10 +214,23 @@ %%%%% 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[code]{#2}}{\protect\sindex[code]{#1}}} + +\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{\matlabfun}[2][]{(\tr{\matlab-function}{\matlab-Funktion} \setlength{\fboxsep}{0.5ex}\colorbox{codeback}{\texttt{#2}})\ifthenelse{\equal{#1}{}}{\protect\sindex[code]{#2}}{\protect\sindex[code]{#1}}} + +\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} diff --git a/programming/lecture/programming-chapter.tex b/programming/lecture/programming-chapter.tex index 5798ddb..8d41a07 100644 --- a/programming/lecture/programming-chapter.tex +++ b/programming/lecture/programming-chapter.tex @@ -3,7 +3,7 @@ \input{../../header} \lstset{inputpath=../code} -\graphicspath{{images/}} +\graphicspath{{../images/}} \typein[\pagenumber]{Number of first page} \typein[\chapternumber]{Chapter number} diff --git a/programming/lecture/programming.tex b/programming/lecture/programming.tex index 6374fc8..98d5e7d 100644 --- a/programming/lecture/programming.tex +++ b/programming/lecture/programming.tex @@ -1503,7 +1503,7 @@ legend('show') \pagebreak[4] \end{exercise} -\subsubsection{Einsatz von Funktionen und Skripten} +\subsection{Einsatz von Funktionen und Skripten} Funktionen sind kleine Codefragmente, die im Idealfall genau eine Aufgabe erledigen. Sie besitzen einen eigenen @@ -1524,7 +1524,7 @@ bilden und den Ablauf zu koordinieren (Abbildung \ref{programlayoutfig}). \begin{figure} - \includegraphics[width=0.5\columnwidth]{./images/simple_program.pdf} + \includegraphics[width=0.5\columnwidth]{simple_program.pdf} \titlecaption{Ein typisches Programmlayout.}{Das Kontrollskript koordiniert den Aufruf der Funktionen, \"ubergibt Argumente und nimmt R\"uckgabewerte entgegen.}\label{programlayoutfig} diff --git a/scientificcomputing-script.tex b/scientificcomputing-script.tex index 54122bf..b077c7b 100644 --- a/scientificcomputing-script.tex +++ b/scientificcomputing-script.tex @@ -26,7 +26,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \part{Grundlagen des Programmierens} -\graphicspath{{programming/}{programming/images/}} +\graphicspath{{programming/lecture/}{programming/images/}} \lstset{inputpath=programming/code} \include{programming/lecture/programming} @@ -81,6 +81,7 @@ \printindex[enterm] %\setindexprenote{Some explanations.} -\printindex[code] +%\printindex[pcode] +\printindex[mcode] \end{document}