Fixed pathes and added \mcode and \pcode macros

This commit is contained in:
Jan Benda 2015-12-01 11:44:35 +01:00
parent 2241c81d40
commit 543078659b
4 changed files with 23 additions and 8 deletions

View File

@ -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}

View File

@ -3,7 +3,7 @@
\input{../../header}
\lstset{inputpath=../code}
\graphicspath{{images/}}
\graphicspath{{../images/}}
\typein[\pagenumber]{Number of first page}
\typein[\chapternumber]{Chapter number}

View File

@ -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}

View File

@ -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}