From 347279437f10ab0a36d11e5540f58d986e821cea Mon Sep 17 00:00:00 2001 From: Thies Lennart Alff Date: Fri, 3 Nov 2023 09:01:10 +0100 Subject: [PATCH] update --- code-block-settings.tex | 33 ++++++++++++++++----------------- main.tex | 20 ++++++++++++-------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/code-block-settings.tex b/code-block-settings.tex index 85959b7..637d738 100644 --- a/code-block-settings.tex +++ b/code-block-settings.tex @@ -4,24 +4,23 @@ \usepackage{etoolbox} \tcbuselibrary{minted,skins,breakable} -\newtcblisting{pythoncode}[2][]{ - listing engine=minted, - listing only, - nobeforeafter, - minted style=friendly, - minted language=python, - minted options={escapeinside=||,fontsize=\scriptsize,numbersep=3mm,texcl=true,linenos,#1}, - left=5mm,enhanced, - overlay={ - \begin{tcbclipinterior} - \fill[black!25] (frame.south west) rectangle ([xshift=5mm]frame.north west); - \end{tcbclipinterior} - }, - #2, -} +\makeatletter +\renewenvironment{minted@colorbg}[1]{ +\setlength{\fboxsep}{\z@} +\def\minted@bgcol{#1} +\noindent +\begin{lrbox}{\minted@bgbox} +\begin{minipage}{\linewidth}} +{\end{minipage} +\end{lrbox}% +\colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}} +\makeatother + +\usemintedstyle{friendly} +\newminted[pythoncode]{python}{frame=single, framesep=2pt, numbersep=1mm, linenos, fontsize=\tiny, escapeinside=||, bgcolor=black!10} \def\theFancyVerbLine{% - \rmfamily\tiny\arabic{FancyVerbLine}% - {\tikz[remember picture,overlay]\node(minted-\arabic{FancyVerbLine}){};}% + \ttfamily\tiny\arabic{FancyVerbLine}% + %{\tikz[remember picture,overlay]\node(minted-\arabic{FancyVerbLine}){};}% } diff --git a/main.tex b/main.tex index 360df5b..15427fe 100644 --- a/main.tex +++ b/main.tex @@ -69,15 +69,15 @@ \end{tikzpicture} \begin{itemize} \color{mumgreen} - \item these nodes are included in our template for assignment 1 \pause - \item communication between them is already set up! + \item<7-> these nodes are included in our template for assignment 1 \pause + \item<8-> communication between them is already set up! \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Where to Start?} % \begin{noindent} - \begin{pythoncode}[fontsize={\tiny}]{} + \begin{pythoncode} class DepthControlNode(Node): def __init__(self): @@ -96,7 +96,7 @@ class DepthControlNode(Node): \end{pythoncode} % \end{noindent} \begin{itemize} - \item<2-> \color<4->{gray}{implement callbacks (\texttt{on\_setpoint}, \texttt{on\_depth})} \only<4->{\color{mumbluefont}{$\Rightarrow$ already given in our template!}} + \item<2-> \color<4->{gray}{implement callbacks (\texttt{on\_setpoint}, \texttt{on\_depth})} \only<4->{\color{mumbluefont}{$\Rightarrow$ given in template!}} \item<3-> \color<5->{red}{implement the control law} \end{itemize} \end{frame} @@ -107,7 +107,7 @@ class DepthControlNode(Node): \textbf{\Large Again, starting point already provided in our template!} \vskip0.5cm % \begin{noindent} - \begin{pythoncode}[fontsize={\tiny}]{} + \begin{pythoncode} class DepthControlNode(Node): |\vdots| @@ -124,6 +124,8 @@ class DepthControlNode(Node): \begin{equation} u = K_{\mathrm{p}} e + K_\mathrm{i} \int_0^{t} e\,\mathrm{d}\tau + K_{\mathrm{d}}\dot{e} \end{equation} + \pause + \centering \begin{tikzpicture}[node distance=10mm and 20mm] \coordinate (start); \coordinate[right=of start] (first_junction); @@ -152,9 +154,10 @@ class DepthControlNode(Node): \begin{equation} u = \textcolor{red}{K_{\mathrm{p}} e} + K_\mathrm{i} \int_0^{t} e\,\mathrm{d}\tau + K_{\mathrm{d}}\dot{e} \end{equation} + \pause \textbf{\Large Code:}\vskip0.25cm % \begin{noindent} - \begin{pythoncode}[fontsize={\tiny}]{} + \begin{pythoncode} class DepthControlNode(Node): |\vdots| @@ -172,8 +175,9 @@ class DepthControlNode(Node): \begin{equation} u = K_{\mathrm{p}} e + \textcolor{mumblue}{K_\mathrm{i} \int_0^{t} e\,\mathrm{d}\tau} + K_{\mathrm{d}}\dot{e} \end{equation} + \pause % \begin{noindent} - \begin{pythoncode}[fontsize={\tiny}]{} + \begin{pythoncode} class DepthControlNode(Node): def __init__(self): self.error_integral = 0.0 @@ -207,7 +211,7 @@ class DepthControlNode(Node): }{} \pause % \begin{noindent} - \begin{pythoncode}[fontsize={\tiny}]{} + \begin{pythoncode} class DepthControlNode(Node): def __init__(self): self.error_integral = 0.0