diff --git a/VL1/content/VL1_ADT1.tex b/VL1/content/VL1_ADT1.tex index e4e52ad..7059f16 100644 --- a/VL1/content/VL1_ADT1.tex +++ b/VL1/content/VL1_ADT1.tex @@ -8,7 +8,7 @@ data WeekDay = Monday | Saturday | Sunday \end{haskellcode} -This declares the new data type \code{WeekDay} with 7 \emph{constructors}. That means \code{Monday}, \code{Tuesday} etc. are all values of the type \code{WeekDay}. +This declares the new data type \hinline{WeekDay} with 7 \emph{constructors}. That means \hinline{Monday}, \hinline{Tuesday} etc. are all values of the type \hinline{WeekDay}. \pause \\ We could now define a whole week, by creating a list: diff --git a/VL1/content/VL1_ADT2.tex b/VL1/content/VL1_ADT2.tex index 7b3c865..0344a59 100644 --- a/VL1/content/VL1_ADT2.tex +++ b/VL1/content/VL1_ADT2.tex @@ -1,4 +1,4 @@ -And we can again \emph{pattern match} on our \code{WeekDay} type. Let's find out if a given day is a Monday: +And we can again \emph{pattern match} on our \hinline{WeekDay} type. Let's find out if a given day is a Monday: \pause \begin{haskellcode} isMonday :: WeekDay -> Bool diff --git a/VL1/content/VL1_ADT3.tex b/VL1/content/VL1_ADT3.tex index 39374d6..47b2c02 100644 --- a/VL1/content/VL1_ADT3.tex +++ b/VL1/content/VL1_ADT3.tex @@ -1,4 +1,4 @@ -But we can do more than enumerations. How about we do some error handling? Let's say we want a function to return an \code{Int}, but in case something went horribly wrong, we don't just want to return a 0 or some magic number, but a proper error message. Here we go: +But we can do more than enumerations. How about we do some error handling? Let's say we want a function to return an \hinline{Int}, but in case something went horribly wrong, we don't just want to return a 0 or some magic number, but a proper error message. Here we go: \pause \begin{haskellcode} data MaybeInt = NoError Int diff --git a/VL1/content/VL1_ADT4.tex b/VL1/content/VL1_ADT4.tex index f528c27..2ca229a 100644 --- a/VL1/content/VL1_ADT4.tex +++ b/VL1/content/VL1_ADT4.tex @@ -12,4 +12,4 @@ addIntToList :: MaybeInt -> [Int] addIntToList (NoError x) = [x] addIntToList (Error str) = [] \end{haskellcode} -So if we got an error, we just return an empty list, otherwise we return a list with the \code{Int} as its only element. \ No newline at end of file +So if we got an error, we just return an empty list, otherwise we return a list with the \hinline{Int} as its only element. \ No newline at end of file diff --git a/VL1/content/VL1_ADT5.tex b/VL1/content/VL1_ADT5.tex index dc4aaf6..a3f27a6 100644 --- a/VL1/content/VL1_ADT5.tex +++ b/VL1/content/VL1_ADT5.tex @@ -8,16 +8,16 @@ Uh... that looks mean. Let's examine this.\\ \pause We have: \begin{itemizep} -\item defined a data type \code{Tree} -\item a constructor \code{Leaf} of type \code{Tree} with one arguments of type \code{Char} -\item a constructor \code{Node} of type \code{Tree} with 3 arguments +\item defined a data type \hinline{Tree} +\item a constructor \hinline{Leaf} of type \hinline{Tree} with one arguments of type \hinline{Char} +\item a constructor \hinline{Node} of type \hinline{Tree} with 3 arguments \begin{itemizep} -\item \code{Tree} -\item \code{Int} -\item \code{Tree} +\item \hinline{Tree} +\item \hinline{Int} +\item \hinline{Tree} \end{itemizep} \end{itemizep} \slidep -That means: a \code{Tree} can either be a \code{Leaf} or an internal \code{Node} with two sub-trees. If we want to create a \code{Leaf}, we have to pass the constructor a \code{Char}. If we want to create a \code{Node}, we have to pass 3 arguments, in order: another \code{Tree}, an \code{Int} and yet another \code{Tree}.\\ -So we can save information in the leafs (\code{Char}) and in the internal nodes (\code{Int}).\\ +That means: a \hinline{Tree} can either be a \hinline{Leaf} or an internal \hinline{Node} with two sub-trees. If we want to create a \hinline{Leaf}, we have to pass the constructor a \hinline{Char}. If we want to create a \hinline{Node}, we have to pass 3 arguments, in order: another \hinline{Tree}, an \hinline{Int} and yet another \hinline{Tree}.\\ +So we can save information in the leafs (\hinline{Char}) and in the internal nodes (\hinline{Int}).\\ This is just an example. There are endless more ways of trees. \ No newline at end of file diff --git a/VL1/content/VL1_functions_and_control_structures3.tex b/VL1/content/VL1_functions_and_control_structures3.tex index 4a6af2e..76293bf 100644 --- a/VL1/content/VL1_functions_and_control_structures3.tex +++ b/VL1/content/VL1_functions_and_control_structures3.tex @@ -7,4 +7,4 @@ mod2 x | x - 2 < 0 = x | otherwise = mod2 (x - 2) \end{haskellcode} -These \verb#|# things above are called \textbf{guards} and are similar to \emph{pattern matching}. They are processed in order. If the condition on the left side of the equation is true, then it returns what stands on the right side of the equation. If it's false, then it processes the next line.\\ \code{otherwise} on the last line is just defined as \code{True}, to make these constructs easier to read and catch all other cases of input. \ No newline at end of file +These \verb#|# things above are called \textbf{guards} and are similar to \emph{pattern matching}. They are processed in order. If the condition on the left side of the equation is true, then it returns what stands on the right side of the equation. If it's false, then it processes the next line.\\ \hinline{otherwise} on the last line is just defined as \hinline{True}, to make these constructs easier to read and catch all other cases of input. \ No newline at end of file diff --git a/VL1/content/VL1_lists1.tex b/VL1/content/VL1_lists1.tex index edea818..f7ca0b3 100644 --- a/VL1/content/VL1_lists1.tex +++ b/VL1/content/VL1_lists1.tex @@ -1,12 +1,12 @@ The list is probably the most basic data structure in Haskell. Like the array in C. It is a singly-linked list and is very lazy. The compiler has numerous ways to optimize lists, so don't be afraid to use them, even for huge things. \pause -We build lists by using either the \code{[]} notation: +We build lists by using either the \hinline{[]} notation: \begin{haskellcode} list1 :: [Integer] list1 = [1, 2] \end{haskellcode} \pause -or by using the \emph{cons} operator \code{(:)} which takes an element and a list and produces a new list with the element prepended to the front. +or by using the \emph{cons} operator \hinline{(:)} which takes an element and a list and produces a new list with the element prepended to the front. \begin{haskellcode} emptyList = [] diff --git a/VL1/content/VL1_lists3.tex b/VL1/content/VL1_lists3.tex index 294b28d..5cf165c 100644 --- a/VL1/content/VL1_lists3.tex +++ b/VL1/content/VL1_lists3.tex @@ -12,4 +12,4 @@ sumEveryTwo [] = 0 sumEveryTwo (x:[]) = [x] sumEveryTwo (x:(y:zs)) = (x + y) : sumEveryTwo zs \end{haskellcode} -Note that \code{(x:(y:zs))} may also be written as \code{(x:y:zs)}. \ No newline at end of file +Note that \hinline{(x:(y:zs))} may also be written as \hinline{(x:y:zs)}. \ No newline at end of file diff --git a/VL1/content/VL1_lists4.tex b/VL1/content/VL1_lists4.tex index ec239fa..fe7dac7 100644 --- a/VL1/content/VL1_lists4.tex +++ b/VL1/content/VL1_lists4.tex @@ -16,4 +16,4 @@ Now let's say we want all numbers between 50 and 100 that have the remainder 0 w \begin{haskellcode*}{bgcolor=mygrey,frame=single,numbers=none,label=GHCi} > [x | x <- [50..100], mod x 12 == 0] \end{haskellcode*} -\code{x <- [50..100]} is the binding, while \code{mod x 12 == 0} is the predicate, separated by a comma. We can have multiple predicates. \ No newline at end of file +\hinline{x <- [50..100]} is the binding, while \hinline{mod x 12 == 0} is the predicate, separated by a comma. We can have multiple predicates. \ No newline at end of file diff --git a/VL1/content/VL1_pairs.tex b/VL1/content/VL1_pairs.tex index 4a2b39d..71becad 100644 --- a/VL1/content/VL1_pairs.tex +++ b/VL1/content/VL1_pairs.tex @@ -8,4 +8,4 @@ sumPair :: (Int, Int) -> Int sumPair (x, y) = x + y \end{haskellcode} \pause -Note: we use \code{(x, y)} notation for both the type and the definition! Those are still two different things. We can also have triples, quadruples etc. \ No newline at end of file +Note: we use \hinline{(x, y)} notation for both the type and the definition! Those are still two different things. We can also have triples, quadruples etc. \ No newline at end of file diff --git a/VL1/content/VL1_what_does_pure_mean.tex b/VL1/content/VL1_what_does_pure_mean.tex index 8d35ade..e70fdf5 100644 --- a/VL1/content/VL1_what_does_pure_mean.tex +++ b/VL1/content/VL1_what_does_pure_mean.tex @@ -4,7 +4,7 @@ \item everything (variables, data structures...) is \emph{immutable} \item expressions never have side-effects (remember: mathematical functions) \item same input $\mapsto$ same output... \emph{always}! -\item replace a function with it's (return) value? Yes. What happens in C or java if you do that? Remember \code{void pop();}? +\item replace a function with it's (return) value? Yes. What happens in C or java if you do that? Remember \cppinline{void pop();}? \end{itemizep} \slidep \vspace{\baselineskip} diff --git a/VL2/content/VL2_composition2.tex b/VL2/content/VL2_composition2.tex index b2cf0b6..c9322ef 100644 --- a/VL2/content/VL2_composition2.tex +++ b/VL2/content/VL2_composition2.tex @@ -1,8 +1,8 @@ -But let's not stop here. What does the dot \code{(.)} actually mean? +But let's not stop here. What does the dot \hinline{(.)} actually mean? \vspace{\baselineskip} \\ \pause -It's just a function (the \emph{prefix} version of \code{.})! Here is the type signature: +It's just a function (the \emph{prefix} version of \hinline{.})! Here is the type signature: \begin{haskellcode} (.) :: (b -> c) -> (a -> b) -> a -> c \end{haskellcode} diff --git a/VL2/content/VL2_currying5.tex b/VL2/content/VL2_currying5.tex index e92d837..0e6a0c4 100644 --- a/VL2/content/VL2_currying5.tex +++ b/VL2/content/VL2_currying5.tex @@ -13,4 +13,4 @@ Did you just notice the braces? They are \textbf{very} important! So, currying i f :: Int -> Int -> Int f :: Int -> (Int -> Int) \end{haskellcode} -On the other hand function application is \emph{left}-associative, so \code{f 3 2} is just a shorthand of \code{(f 3) 2}. Makes sense? \ No newline at end of file +On the other hand function application is \emph{left}-associative, so \hinline{f 3 2} is just a shorthand of \hinline{(f 3) 2}. Makes sense? \ No newline at end of file diff --git a/VL2/content/VL2_currying6.tex b/VL2/content/VL2_currying6.tex index 67923ba..48adb56 100644 --- a/VL2/content/VL2_currying6.tex +++ b/VL2/content/VL2_currying6.tex @@ -7,11 +7,9 @@ addInt x y = x + y addTwo :: Int -> Int addTwo = addInt 2 \end{haskellcode} -You probably noticed that we did not write \code{addTwo x = ...}, but why would we? We gave \code{addInt} one argument, so the arity (we called it dimension in the gemoetrical example) is one less, but there is still one parameter left we can pass in. -\vspace{\baselineskip} -\\ +You probably noticed that we did not write \hinline{addTwo x = ...}, but why would we? We gave \hinline{addInt} one argument, so the arity (we called it dimension in the gemoetrical example) is one less, but there is still one parameter left we can pass in. \pause -The reason we can omit the \code{x} here is that +The reason we can omit the \hinline{x} here is that \begin{haskellcode} f x y z = ... \end{haskellcode} diff --git a/VL2/content/VL2_fold2.tex b/VL2/content/VL2_fold2.tex index 0583e06..491a24c 100644 --- a/VL2/content/VL2_fold2.tex +++ b/VL2/content/VL2_fold2.tex @@ -7,13 +7,13 @@ fold z f (x:xs) = x `f` (fold z f xs) Whoa! What's going on here?\\ Let's see... \begin{itemizep} -\item \code{z} is what we return if the list is empty -\item \code{f} is our function (e.g. \code{(*)} or \code{(+)}) +\item \hinline{z} is what we return if the list is empty +\item \hinline{f} is our function (e.g. \hinline{(*)} or \hinline{(+)}) \item and the last remaining argument is the actual list we are working on \end{itemizep} \slidep The function application has the following form:\\ -\code{fold f z [a,b,c] == a `f` (b `f` (c `f` z))} +\hinline{fold f z [a,b,c] == a `f` (b `f` (c `f` z))} \vspace{\baselineskip} \\ This folds from the right, so the \emph{Prelude} already defines a function which is very similar to ours and called \textbf{foldr}. \ No newline at end of file diff --git a/VL2/content/VL2_fold3.tex b/VL2/content/VL2_fold3.tex index 7aec343..cc5d9ba 100644 --- a/VL2/content/VL2_fold3.tex +++ b/VL2/content/VL2_fold3.tex @@ -1,4 +1,4 @@ -So how do our \code{sum}, \code{prod} and \code{length} functions look like if we use our \code{fold} abstraction? +So how do our \hinline{sum}, \hinline{prod} and \hinline{length} functions look like if we use our \hinline{fold} abstraction? \pause \begin{haskellcode} sum :: [Int] -> Int diff --git a/VL2/content/VL2_fold4.tex b/VL2/content/VL2_fold4.tex index 739ea38..99f79d0 100644 --- a/VL2/content/VL2_fold4.tex +++ b/VL2/content/VL2_fold4.tex @@ -4,7 +4,7 @@ To summarize: foldr f z [a,b,c] == a `f` (b `f` (c `f` z)) foldl f z [a,b,c] == ((z `f` a) `f` b) `f` c \end{haskellcode} -For \code{foldl} the \code{z} is sort of the starting value. +For \hinline{foldl} the \hinline{z} is sort of the starting value. \vspace{\baselineskip} \\ \pause @@ -12,10 +12,7 @@ We can even express foldl in terms of foldr and vice versa. If you are intereste \vspace{\baselineskip} \\ You should definitely look them up in the Prelude and play with them: \url{https://hackage.haskell.org/package/base-4.8.0.0/docs/Prelude.html} -\vspace{\baselineskip} -\\ -GHCi... -\begin{haskellcode} +\begin{haskellcode*}{bgcolor=mygrey,frame=single,numbers=none,label=GHCi} > foldr (-) 0 [1, 2, 3] > foldl (-) 0 [1, 2, 3] -\end{haskellcode} \ No newline at end of file +\end{haskellcode*} \ No newline at end of file diff --git a/VL2/content/VL2_let.tex b/VL2/content/VL2_let.tex index d18611d..d3819b4 100644 --- a/VL2/content/VL2_let.tex +++ b/VL2/content/VL2_let.tex @@ -1,4 +1,4 @@ -Another way which is very similar would be using \code{let}: +Another way which is very similar would be using \hinline{let}: \begin{haskellcode} f :: Int -> Int f x = let y p = x + p diff --git a/VL2/content/VL2_let_vs_where.tex b/VL2/content/VL2_let_vs_where.tex index 467c88e..8348c1b 100644 --- a/VL2/content/VL2_let_vs_where.tex +++ b/VL2/content/VL2_let_vs_where.tex @@ -1,4 +1,4 @@ -These look almost the same, but they are different constructs. \code{where} is bound to the pattern matching \code{f x =} and may also have access to parts of a function that are not syntactically expressions, e.g.: +These look almost the same, but they are different constructs. \hinline{where} is bound to the pattern matching \hinline{f x =} and may also have access to parts of a function that are not syntactically expressions, e.g.: \begin{haskellcode} f x | cond1 x = a @@ -7,11 +7,11 @@ f x where a = w x \end{haskellcode} -While that is not possible with \code{let}, which is an actual expression and can be used whenever expressions are allowed (e.g. inside \emph{Monads}, we'll know more about these in a few weeks). +While that is not possible with \hinline{let}, which is an actual expression and can be used whenever expressions are allowed (e.g. inside \emph{Monads}, we'll know more about these in a few weeks). \vspace{\baselineskip} \\ There are a few more intricacies, but most of the time this is just style consideration:\\ \url{https://wiki.haskell.org/Let_vs._Where} \pause \vspace{\baselineskip} \\ -How would we have to rewrite the function in order to use \code{let}? \ No newline at end of file +How would we have to rewrite the function in order to use \hinline{let}? \ No newline at end of file diff --git a/VL2/content/VL2_map1.tex b/VL2/content/VL2_map1.tex index 5daef15..55419ee 100644 --- a/VL2/content/VL2_map1.tex +++ b/VL2/content/VL2_map1.tex @@ -1,7 +1,7 @@ -Let's say we have a list of \code{Int} and want to add \code{2} to every element of the list. +Let's say we have a list of \hinline{Int} and want to add \hinline{2} to every element of the list. \begin{haskellcode} addTwo :: [Int] -> [Int] addTwo ... ? \end{haskellcode} \pause -\textbf{Exercise:} Find the answer! 5 minutes time, remember the \emph{cons} operator \code{(:)}, pattern matching on lists and ofc recursion! Start with the case of an empty list. \ No newline at end of file +\textbf{Exercise:} Find the answer! 5 minutes time, remember the \emph{cons} operator \hinline{(:)}, pattern matching on lists and ofc recursion! Start with the case of an empty list. \ No newline at end of file diff --git a/VL2/content/VL2_map3.tex b/VL2/content/VL2_map3.tex index 656a2bb..ba6aeb8 100644 --- a/VL2/content/VL2_map3.tex +++ b/VL2/content/VL2_map3.tex @@ -13,4 +13,4 @@ map :: (a -> b) -> [a] -> [b] map f [] = [] map f (x:xs) = f x : map f xs \end{haskellcode} -So we don't really know what the function \code{f} does, but we know that it converts one element of the list to something else. We \emph{map} a function over a list! Hence the name. \ No newline at end of file +So we don't really know what the function \hinline{f} does, but we know that it converts one element of the list to something else. We \emph{map} a function over a list! Hence the name. \ No newline at end of file diff --git a/VL2/content/VL2_map4.tex b/VL2/content/VL2_map4.tex index fcd4d9c..6febfe1 100644 --- a/VL2/content/VL2_map4.tex +++ b/VL2/content/VL2_map4.tex @@ -12,4 +12,4 @@ absList xs = map (\x -> abs x) xs absList = map abs \end{haskellcode} \pause -Cool, right? So now we have abstracted out the \textbf{recursion pattern} that is all the same for those 3 functions. \code{map} is actually part of the standard library (called \emph{Prelude}). \ No newline at end of file +Cool, right? So now we have abstracted out the \textbf{recursion pattern} that is all the same for those 3 functions. \hinline{map} is actually part of the standard library (called \emph{Prelude}). \ No newline at end of file diff --git a/VL2/content/VL2_more_ways_to_define_functions.tex b/VL2/content/VL2_more_ways_to_define_functions.tex index ee630b0..fa6a060 100644 --- a/VL2/content/VL2_more_ways_to_define_functions.tex +++ b/VL2/content/VL2_more_ways_to_define_functions.tex @@ -3,14 +3,14 @@ Now you know how a regular function looks like, e.g: f :: Int -> Int f x = x + 1 \end{haskellcode} -But now imagine we need a helper function which is very specific to the current function. In C we would have to define this new helper function at top-level and would probably make it \code{static}. +But now imagine we need a helper function which is very specific to the current function. In C we would have to define this new helper function at top-level and would probably make it \cinline{static}. \pause \vspace{\baselineskip} \\ Haskell allows us to \textbf{inline} functions in a few more ways, e.g.: \begin{itemizep} -\item with \code{where} -\item with \code{let...in} +\item with \hinline{where} +\item with \hinline{let...in} \item anonymously (lambda abstraction) \end{itemizep} \slidep diff --git a/VL2/content/VL2_polymorphism2.tex b/VL2/content/VL2_polymorphism2.tex index 65ab705..d849230 100644 --- a/VL2/content/VL2_polymorphism2.tex +++ b/VL2/content/VL2_polymorphism2.tex @@ -13,7 +13,7 @@ Whatever the function does... it has something of one type and returns something \vspace{\baselineskip} \\ \pause -Similarly, remember the function \code{head} which gives us the first element of a list? The type signature actually looks like this: +Similarly, remember the function \hinline{head} which gives us the first element of a list? The type signature actually looks like this: \begin{haskellcode} head :: [a] -> a \end{haskellcode} diff --git a/VL2/content/VL2_questions_for_you.tex b/VL2/content/VL2_questions_for_you.tex index 1cfc269..17830b0 100644 --- a/VL2/content/VL2_questions_for_you.tex +++ b/VL2/content/VL2_questions_for_you.tex @@ -1,9 +1,9 @@ \begin{itemize} -\item what is the difference between \code{let} and \code{where}? -\item what is the difference between \code{foldr} and \code{foldl}? +\item what is the difference between \hinline{let} and \hinline{where}? +\item what is the difference between \hinline{foldr} and \hinline{foldl}? \item what is the difference between explicit and implicit recursion? Give examples \item how many arguments does a haskell function have (strictly speaking)? \item what do you have to keep in mind in order to make function composition work? -\item can you define map and filter in terms of foldr? +\item can you define \hinline{map} and \hinline{filter} in terms of \hinline{foldr}? \item what is eta reduction (or: eta abstraction)? \end{itemize} \ No newline at end of file diff --git a/VL2/content/VL2_where.tex b/VL2/content/VL2_where.tex index e715bba..84c92df 100644 --- a/VL2/content/VL2_where.tex +++ b/VL2/content/VL2_where.tex @@ -1,4 +1,4 @@ -We use \code{where} to define a helper function: +We use \hinline{where} to define a helper function: \begin{haskellcode} f :: Int -> Int f x = x + (y 2) diff --git a/common/article_configuration.tex b/common/article_configuration.tex index 7a2fc6a..95f5a17 100644 --- a/common/article_configuration.tex +++ b/common/article_configuration.tex @@ -14,15 +14,10 @@ \usepackage[T1]{fontenc} \usepackage[Q=yes]{examplep} +\input{../common/common_configuration.tex} + % package configuration \DeclareGraphicsExtensions{.pdf,.png,.jpg} -\usemintedstyle{friendly} -\newminted{haskell}{frame=single,numbers=left,samepage=true} -\newminted{cpp}{frame=single,numbers=left} -\newminted{c}{frame=single,numbers=left} -\renewcommand{\theFancyVerbLine}{\ttfamily - \textcolor[rgb]{0.0,0.0,0.0}{\footnotesize - \oldstylenums{\arabic{FancyVerbLine}}}} % macros and environments \NewDocumentCommand {\slide} { m O{} O{} } @@ -33,8 +28,4 @@ \newcommand{\slidep}{} \newenvironment{itemizep} {\begin{itemize}} - {\end{itemize}} - -% color definition -\definecolor{solarized}{HTML}{002B36} -\definecolor{mygreen}{rgb}{0,0.6,0} \ No newline at end of file + {\end{itemize}} \ No newline at end of file diff --git a/common/beamer_configuration.tex b/common/beamer_configuration.tex index 419b44c..101da32 100644 --- a/common/beamer_configuration.tex +++ b/common/beamer_configuration.tex @@ -6,55 +6,26 @@ \usepackage{amssymb} \usepackage{graphicx} \usepackage{listings} -\usepackage{minted} +\usepackage[newfloat=true]{minted} \usepackage{xparse} % for \verb inside \item \usepackage[T1]{fontenc} \usepackage[Q=yes]{examplep} -% color definition -\definecolor{solarized}{HTML}{002B36} -\definecolor{mygreen}{HTML}{009900} -\definecolor{mygrey}{rgb}{0.95,0.95,0.95} +\input{../common/common_configuration.tex} % package configuration \DeclareGraphicsExtensions{.pdf,.png,.jpg} \beamertemplatenavigationsymbolsempty \setbeamertemplate{footline}[frame number] -% minted -%% fix the minted@colorbg environment -\makeatletter -\renewenvironment{minted@colorbg}[1] - {\def\minted@bgcol{#1}% - \noindent - \begin{lrbox}{\minted@bgbox} - \begin{minipage}{\linewidth-2\fboxsep}} - {\end{minipage}% - \end{lrbox}% - \setlength{\topsep}{\smallskipamount}% set the vertical space - \trivlist\item\relax % ensure going to a new line - \colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}% - \endtrivlist % close the trivlist - } -\makeatother -\usemintedstyle{friendly} -\newminted{haskell}{bgcolor=mygrey,frame=single,numbers=left} -\newminted{cpp}{bgcolor=mygrey,frame=single,numbers=left} -\newminted{c}{bgcolor=mygrey,frame=single,numbers=left} -\renewcommand{\theFancyVerbLine}{\ttfamily - \textcolor[rgb]{0.0,0.0,0.0}{\footnotesize - \oldstylenums{\arabic{FancyVerbLine}}}} - % macros and environments -\newcommand{\code}[1]{\texttt{#1}} \newcommand{\slidep}{\onslide<+->} \newenvironment{itemizep} {\begin{itemize}[<+->]} {\end{itemize}} - \NewDocumentCommand {\slide} { m O{} O{} } {\begin{frame}{#3} \frametitle{\thesection.\ifnum\thesubsection=0\else\thesubsection.\fi\ \currentname {#2}} @@ -67,8 +38,7 @@ \tableofcontents[currentsection,hideothersubsections] \end{frame}} - -% sections numbered + % sections numbered \setbeamertemplate{section in toc}[sections numbered] \setbeamertemplate{subsection in toc}[subsections numbered] \defbeamertemplate{subsubsection in toc}{subsubsections numbered} @@ -81,4 +51,4 @@ \usepackage{nameref} \makeatletter \newcommand*{\currentname}{\@currentlabelname} -\makeatother +\makeatother \ No newline at end of file diff --git a/common/common_configuration.tex b/common/common_configuration.tex new file mode 100644 index 0000000..6c2c393 --- /dev/null +++ b/common/common_configuration.tex @@ -0,0 +1,32 @@ +% color definition +\definecolor{solarized}{HTML}{002B36} +\definecolor{mygreen}{HTML}{009900} +\definecolor{myblue}{HTML}{0000FF} +\definecolor{mygrey}{rgb}{0.95,0.95,0.95} + +% minted +%% fix the minted@colorbg environment +\makeatletter +\renewenvironment{minted@colorbg}[1] + {\def\minted@bgcol{#1}% + \noindent + \begin{lrbox}{\minted@bgbox} + \begin{minipage}{\linewidth-2\fboxsep}} + {\end{minipage}% + \end{lrbox}% + \setlength{\topsep}{\smallskipamount}% set the vertical space + \trivlist\item\relax % ensure going to a new line + \colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}% + \endtrivlist % close the trivlist + } +\makeatother +\usemintedstyle{friendly} +\newminted{haskell}{bgcolor=mygrey,frame=single,numbers=left} +\newminted{cpp}{bgcolor=mygrey,frame=single,numbers=left} +\newminted{c}{bgcolor=mygrey,frame=single,numbers=left} +\newcommand{\hinline}[1]{\mintinline{haskell}{#1}} +\newcommand{\cinline}[1]{\mintinline{c}{#1}} +\newcommand{\cppinline}[1]{\mintinline{cpp}{#1}} +\renewcommand{\theFancyVerbLine}{\ttfamily + \textcolor[rgb]{0.0,0.0,0.0}{\footnotesize + \oldstylenums{\arabic{FancyVerbLine}}}} \ No newline at end of file