Browse Source

Improve configuration modularity, use minted for inline code

Julian Ospald 4 years ago
parent
commit
22f0fd9447
No account linked to committer's email address

+ 1
- 1
VL1/content/VL1_ADT1.tex View File

@@ -8,7 +8,7 @@ data WeekDay = Monday
8 8
              | Saturday
9 9
              | Sunday
10 10
 \end{haskellcode}
11
-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}.
11
+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}.
12 12
 \pause
13 13
 \\
14 14
 We could now define a whole week, by creating a list:

+ 1
- 1
VL1/content/VL1_ADT2.tex View File

@@ -1,4 +1,4 @@
1
-And we can again \emph{pattern match} on our \code{WeekDay} type. Let's find out if a given day is a Monday:
1
+And we can again \emph{pattern match} on our \hinline{WeekDay} type. Let's find out if a given day is a Monday:
2 2
 \pause
3 3
 \begin{haskellcode}
4 4
 isMonday :: WeekDay -> Bool

+ 1
- 1
VL1/content/VL1_ADT3.tex View File

@@ -1,4 +1,4 @@
1
-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:
1
+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:
2 2
 \pause
3 3
 \begin{haskellcode}
4 4
 data MaybeInt = NoError Int

+ 1
- 1
VL1/content/VL1_ADT4.tex View File

@@ -12,4 +12,4 @@ addIntToList :: MaybeInt -> [Int]
12 12
 addIntToList (NoError x) = [x]
13 13
 addIntToList (Error str) = []
14 14
 \end{haskellcode}
15
-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.
15
+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.

+ 8
- 8
VL1/content/VL1_ADT5.tex View File

@@ -8,16 +8,16 @@ Uh... that looks mean. Let's examine this.\\
8 8
 \pause
9 9
 We have:
10 10
 \begin{itemizep}
11
-\item defined a data type \code{Tree}
12
-\item a constructor \code{Leaf} of type \code{Tree} with one arguments of type \code{Char}
13
-\item a constructor \code{Node} of type \code{Tree} with 3 arguments
11
+\item defined a data type \hinline{Tree}
12
+\item a constructor \hinline{Leaf} of type \hinline{Tree} with one arguments of type \hinline{Char}
13
+\item a constructor \hinline{Node} of type \hinline{Tree} with 3 arguments
14 14
 \begin{itemizep}
15
-\item \code{Tree}
16
-\item \code{Int}
17
-\item \code{Tree}
15
+\item \hinline{Tree}
16
+\item \hinline{Int}
17
+\item \hinline{Tree}
18 18
 \end{itemizep}
19 19
 \end{itemizep}
20 20
 \slidep
21
-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}.\\
22
-So we can save information in the leafs (\code{Char}) and in the internal nodes (\code{Int}).\\
21
+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}.\\
22
+So we can save information in the leafs (\hinline{Char}) and in the internal nodes (\hinline{Int}).\\
23 23
 This is just an example. There are endless more ways of trees.

+ 1
- 1
VL1/content/VL1_functions_and_control_structures3.tex View File

@@ -7,4 +7,4 @@ mod2 x
7 7
   | x - 2 < 0  = x
8 8
   | otherwise  = mod2 (x - 2)
9 9
 \end{haskellcode}
10
-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.
10
+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.

+ 2
- 2
VL1/content/VL1_lists1.tex View File

@@ -1,12 +1,12 @@
1 1
 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.
2 2
 \pause
3
-We build lists by using either the \code{[]} notation:
3
+We build lists by using either the \hinline{[]} notation:
4 4
 \begin{haskellcode}
5 5
 list1 :: [Integer]
6 6
 list1 = [1, 2]
7 7
 \end{haskellcode}
8 8
 \pause
9
-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.
9
+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.
10 10
 \begin{haskellcode}
11 11
 emptyList = []
12 12
 

+ 1
- 1
VL1/content/VL1_lists3.tex View File

@@ -12,4 +12,4 @@ sumEveryTwo []         = 0
12 12
 sumEveryTwo (x:[])     = [x]
13 13
 sumEveryTwo (x:(y:zs)) = (x + y) : sumEveryTwo zs
14 14
 \end{haskellcode}
15
-Note that \code{(x:(y:zs))} may also be written as \code{(x:y:zs)}.
15
+Note that \hinline{(x:(y:zs))} may also be written as \hinline{(x:y:zs)}.

+ 1
- 1
VL1/content/VL1_lists4.tex View File

@@ -16,4 +16,4 @@ Now let's say we want all numbers between 50 and 100 that have the remainder 0 w
16 16
 \begin{haskellcode*}{bgcolor=mygrey,frame=single,numbers=none,label=GHCi}
17 17
 > [x | x <- [50..100], mod x 12 == 0]
18 18
 \end{haskellcode*}
19
-\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.
19
+\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.

+ 1
- 1
VL1/content/VL1_pairs.tex View File

@@ -8,4 +8,4 @@ sumPair :: (Int, Int) -> Int
8 8
 sumPair (x, y) = x + y
9 9
 \end{haskellcode}
10 10
 \pause
11
-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.
11
+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.

+ 1
- 1
VL1/content/VL1_what_does_pure_mean.tex View File

@@ -4,7 +4,7 @@
4 4
 \item everything (variables, data structures...) is \emph{immutable}
5 5
 \item expressions never have side-effects (remember: mathematical functions)
6 6
 \item same input $\mapsto$ same output... \emph{always}!
7
-\item replace a function with it's (return) value? Yes. What happens in C or java if you do that? Remember \code{void pop();}?
7
+\item replace a function with it's (return) value? Yes. What happens in C or java if you do that? Remember \cppinline{void pop();}?
8 8
 \end{itemizep}
9 9
 \slidep
10 10
 \vspace{\baselineskip}

+ 2
- 2
VL2/content/VL2_composition2.tex View File

@@ -1,8 +1,8 @@
1
-But let's not stop here. What does the dot \code{(.)} actually mean?
1
+But let's not stop here. What does the dot \hinline{(.)} actually mean?
2 2
 \vspace{\baselineskip}
3 3
 \\
4 4
 \pause
5
-It's just a function (the \emph{prefix} version of \code{.})! Here is the type signature:
5
+It's just a function (the \emph{prefix} version of \hinline{.})! Here is the type signature:
6 6
 \begin{haskellcode}
7 7
 (.) :: (b -> c) -> (a -> b) -> a -> c
8 8
 \end{haskellcode}

+ 1
- 1
VL2/content/VL2_currying5.tex View File

@@ -13,4 +13,4 @@ Did you just notice the braces? They are \textbf{very} important! So, currying i
13 13
 f :: Int -> Int -> Int
14 14
 f :: Int -> (Int -> Int)
15 15
 \end{haskellcode}
16
-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?
16
+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?

+ 2
- 4
VL2/content/VL2_currying6.tex View File

@@ -7,11 +7,9 @@ addInt x y = x + y
7 7
 addTwo :: Int -> Int
8 8
 addTwo = addInt 2
9 9
 \end{haskellcode}
10
-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.
11
-\vspace{\baselineskip}
12
-\\
10
+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.
13 11
 \pause
14
-The reason we can omit the \code{x} here is that
12
+The reason we can omit the \hinline{x} here is that
15 13
 \begin{haskellcode}
16 14
 f x y z = ...
17 15
 \end{haskellcode}

+ 3
- 3
VL2/content/VL2_fold2.tex View File

@@ -7,13 +7,13 @@ fold z f (x:xs) = x `f` (fold z f xs)
7 7
 Whoa! What's going on here?\\
8 8
 Let's see...
9 9
 \begin{itemizep}
10
-\item \code{z} is what we return if the list is empty
11
-\item \code{f} is our function (e.g. \code{(*)} or \code{(+)})
10
+\item \hinline{z} is what we return if the list is empty
11
+\item \hinline{f} is our function (e.g. \hinline{(*)} or \hinline{(+)})
12 12
 \item and the last remaining argument is the actual list we are working on
13 13
 \end{itemizep}
14 14
 \slidep
15 15
 The function application has the following form:\\
16
-\code{fold f z [a,b,c] == a `f` (b `f` (c `f` z))}
16
+\hinline{fold f z [a,b,c] == a `f` (b `f` (c `f` z))}
17 17
 \vspace{\baselineskip}
18 18
 \\
19 19
 This folds from the right, so the \emph{Prelude} already defines a function which is very similar to ours and called \textbf{foldr}.

+ 1
- 1
VL2/content/VL2_fold3.tex View File

@@ -1,4 +1,4 @@
1
-So how do our \code{sum}, \code{prod} and \code{length} functions look like if we use our \code{fold} abstraction?
1
+So how do our \hinline{sum}, \hinline{prod} and \hinline{length} functions look like if we use our \hinline{fold} abstraction?
2 2
 \pause
3 3
 \begin{haskellcode}
4 4
 sum :: [Int] -> Int

+ 3
- 6
VL2/content/VL2_fold4.tex View File

@@ -4,7 +4,7 @@ To summarize:
4 4
 foldr f z [a,b,c] == a `f` (b `f` (c `f` z))
5 5
 foldl f z [a,b,c] == ((z `f` a) `f` b) `f` c
6 6
 \end{haskellcode}
7
-For \code{foldl} the \code{z} is sort of the starting value.
7
+For \hinline{foldl} the \hinline{z} is sort of the starting value.
8 8
 \vspace{\baselineskip}
9 9
 \\
10 10
 \pause
@@ -12,10 +12,7 @@ We can even express foldl in terms of foldr and vice versa. If you are intereste
12 12
 \vspace{\baselineskip}
13 13
 \\
14 14
 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}
15
-\vspace{\baselineskip}
16
-\\
17
-GHCi...
18
-\begin{haskellcode}
15
+\begin{haskellcode*}{bgcolor=mygrey,frame=single,numbers=none,label=GHCi}
19 16
 > foldr (-) 0 [1, 2, 3]
20 17
 > foldl (-) 0 [1, 2, 3]
21
-\end{haskellcode}
18
+\end{haskellcode*}

+ 1
- 1
VL2/content/VL2_let.tex View File

@@ -1,4 +1,4 @@
1
-Another way which is very similar would be using \code{let}:
1
+Another way which is very similar would be using \hinline{let}:
2 2
 \begin{haskellcode}
3 3
 f :: Int -> Int
4 4
 f x = let y p = x + p

+ 3
- 3
VL2/content/VL2_let_vs_where.tex View File

@@ -1,4 +1,4 @@
1
-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.:
1
+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.:
2 2
 \begin{haskellcode}
3 3
 f x
4 4
   | cond1 x   = a
@@ -7,11 +7,11 @@ f x
7 7
   where
8 8
     a = w x
9 9
 \end{haskellcode}
10
-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).
10
+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).
11 11
 \vspace{\baselineskip}
12 12
 \\
13 13
 There are a few more intricacies, but most of the time this is just style consideration:\\ \url{https://wiki.haskell.org/Let_vs._Where}
14 14
 \pause
15 15
 \vspace{\baselineskip}
16 16
 \\
17
-How would we have to rewrite the function in order to use \code{let}?
17
+How would we have to rewrite the function in order to use \hinline{let}?

+ 2
- 2
VL2/content/VL2_map1.tex View File

@@ -1,7 +1,7 @@
1
-Let's say we have a list of \code{Int} and want to add \code{2} to every element of the list.
1
+Let's say we have a list of \hinline{Int} and want to add \hinline{2} to every element of the list.
2 2
 \begin{haskellcode}
3 3
 addTwo :: [Int] -> [Int]
4 4
 addTwo ... ?
5 5
 \end{haskellcode}
6 6
 \pause
7
-\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.
7
+\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.

+ 1
- 1
VL2/content/VL2_map3.tex View File

@@ -13,4 +13,4 @@ map :: (a -> b) -> [a] -> [b]
13 13
 map f []     = []
14 14
 map f (x:xs) = f x : map f xs
15 15
 \end{haskellcode}
16
-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.
16
+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.

+ 1
- 1
VL2/content/VL2_map4.tex View File

@@ -12,4 +12,4 @@ absList xs = map (\x -> abs x) xs
12 12
 absList = map abs
13 13
 \end{haskellcode}
14 14
 \pause
15
-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}).
15
+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}).

+ 3
- 3
VL2/content/VL2_more_ways_to_define_functions.tex View File

@@ -3,14 +3,14 @@ Now you know how a regular function looks like, e.g:
3 3
 f :: Int -> Int
4 4
 f x = x + 1
5 5
 \end{haskellcode}
6
-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}.
6
+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}.
7 7
 \pause
8 8
 \vspace{\baselineskip}
9 9
 \\
10 10
 Haskell allows us to \textbf{inline} functions in a few more ways, e.g.:
11 11
 \begin{itemizep}
12
-\item with \code{where}
13
-\item with \code{let...in}
12
+\item with \hinline{where}
13
+\item with \hinline{let...in}
14 14
 \item anonymously (lambda abstraction)
15 15
 \end{itemizep}
16 16
 \slidep

+ 1
- 1
VL2/content/VL2_polymorphism2.tex View File

@@ -13,7 +13,7 @@ Whatever the function does... it has something of one type and returns something
13 13
 \vspace{\baselineskip}
14 14
 \\
15 15
 \pause
16
-Similarly, remember the function \code{head} which gives us the first element of a list? The type signature actually looks like this:
16
+Similarly, remember the function \hinline{head} which gives us the first element of a list? The type signature actually looks like this:
17 17
 \begin{haskellcode}
18 18
 head :: [a] -> a
19 19
 \end{haskellcode}

+ 3
- 3
VL2/content/VL2_questions_for_you.tex View File

@@ -1,9 +1,9 @@
1 1
 \begin{itemize}
2
-\item what is the difference between \code{let} and \code{where}?
3
-\item what is the difference between \code{foldr} and \code{foldl}?
2
+\item what is the difference between \hinline{let} and \hinline{where}?
3
+\item what is the difference between \hinline{foldr} and \hinline{foldl}?
4 4
 \item what is the difference between explicit and implicit recursion? Give examples
5 5
 \item how many arguments does a haskell function have (strictly speaking)?
6 6
 \item what do you have to keep in mind in order to make function composition work?
7
-\item can you define map and filter in terms of foldr?
7
+\item can you define \hinline{map} and \hinline{filter} in terms of \hinline{foldr}?
8 8
 \item what is eta reduction (or: eta abstraction)?
9 9
 \end{itemize}

+ 1
- 1
VL2/content/VL2_where.tex View File

@@ -1,4 +1,4 @@
1
-We use \code{where} to define a helper function:
1
+We use \hinline{where} to define a helper function:
2 2
 \begin{haskellcode}
3 3
 f :: Int -> Int
4 4
 f x = x + (y 2)

+ 3
- 12
common/article_configuration.tex View File

@@ -14,15 +14,10 @@
14 14
 \usepackage[T1]{fontenc}
15 15
 \usepackage[Q=yes]{examplep}
16 16
 
17
+\input{../common/common_configuration.tex}
18
+
17 19
 % package configuration
18 20
 \DeclareGraphicsExtensions{.pdf,.png,.jpg}
19
-\usemintedstyle{friendly}
20
-\newminted{haskell}{frame=single,numbers=left,samepage=true}
21
-\newminted{cpp}{frame=single,numbers=left}
22
-\newminted{c}{frame=single,numbers=left}
23
-\renewcommand{\theFancyVerbLine}{\ttfamily
24
-	\textcolor[rgb]{0.0,0.0,0.0}{\footnotesize
25
-	\oldstylenums{\arabic{FancyVerbLine}}}}
26 21
 
27 22
 % macros and environments
28 23
 \NewDocumentCommand {\slide} { m O{} O{} }
@@ -33,8 +28,4 @@
33 28
 \newcommand{\slidep}{}
34 29
 \newenvironment{itemizep}
35 30
  {\begin{itemize}}
36
- {\end{itemize}}
37
-
38
-% color definition
39
-\definecolor{solarized}{HTML}{002B36}
40
-\definecolor{mygreen}{rgb}{0,0.6,0}
31
+ {\end{itemize}}

+ 4
- 34
common/beamer_configuration.tex View File

@@ -6,55 +6,26 @@
6 6
 \usepackage{amssymb}
7 7
 \usepackage{graphicx}
8 8
 \usepackage{listings}
9
-\usepackage{minted}
9
+\usepackage[newfloat=true]{minted}
10 10
 \usepackage{xparse}
11 11
 
12 12
 % for \verb inside \item
13 13
 \usepackage[T1]{fontenc}
14 14
 \usepackage[Q=yes]{examplep}
15 15
 
16
-% color definition
17
-\definecolor{solarized}{HTML}{002B36}
18
-\definecolor{mygreen}{HTML}{009900}
19
-\definecolor{mygrey}{rgb}{0.95,0.95,0.95}
16
+\input{../common/common_configuration.tex}
20 17
 
21 18
 % package configuration
22 19
 \DeclareGraphicsExtensions{.pdf,.png,.jpg}
23 20
 \beamertemplatenavigationsymbolsempty
24 21
 \setbeamertemplate{footline}[frame number]
25 22
 
26
-% minted
27
-%% fix the minted@colorbg environment
28
-\makeatletter
29
-\renewenvironment{minted@colorbg}[1]
30
- {\def\minted@bgcol{#1}%
31
-  \noindent
32
-  \begin{lrbox}{\minted@bgbox}
33
-  \begin{minipage}{\linewidth-2\fboxsep}}
34
- {\end{minipage}%
35
-  \end{lrbox}%
36
-  \setlength{\topsep}{\smallskipamount}% set the vertical space
37
-  \trivlist\item\relax % ensure going to a new line
38
-  \colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}%
39
-  \endtrivlist % close the trivlist
40
- }
41
-\makeatother
42
-\usemintedstyle{friendly}
43
-\newminted{haskell}{bgcolor=mygrey,frame=single,numbers=left}
44
-\newminted{cpp}{bgcolor=mygrey,frame=single,numbers=left}
45
-\newminted{c}{bgcolor=mygrey,frame=single,numbers=left}
46
-\renewcommand{\theFancyVerbLine}{\ttfamily
47
-	\textcolor[rgb]{0.0,0.0,0.0}{\footnotesize
48
-	\oldstylenums{\arabic{FancyVerbLine}}}}
49
-
50 23
 % macros and environments
51
-\newcommand{\code}[1]{\texttt{#1}}
52 24
 \newcommand{\slidep}{\onslide<+->}
53 25
 \newenvironment{itemizep}
54 26
  {\begin{itemize}[<+->]}
55 27
  {\end{itemize}}
56 28
  
57
- 
58 29
 \NewDocumentCommand {\slide} { m O{} O{} }
59 30
 	{\begin{frame}{#3}
60 31
 		\frametitle{\thesection.\ifnum\thesubsection=0\else\thesubsection.\fi\ \currentname {#2}}
@@ -67,8 +38,7 @@
67 38
 		\tableofcontents[currentsection,hideothersubsections]
68 39
 	\end{frame}}
69 40
  
70
- 
71
-% sections numbered
41
+ % sections numbered
72 42
 \setbeamertemplate{section in toc}[sections numbered]
73 43
 \setbeamertemplate{subsection in toc}[subsections numbered]
74 44
 \defbeamertemplate{subsubsection in toc}{subsubsections numbered}
@@ -81,4 +51,4 @@
81 51
 \usepackage{nameref}
82 52
 \makeatletter
83 53
 \newcommand*{\currentname}{\@currentlabelname}
84
-\makeatother
54
+\makeatother

+ 32
- 0
common/common_configuration.tex View File

@@ -0,0 +1,32 @@
1
+% color definition
2
+\definecolor{solarized}{HTML}{002B36}
3
+\definecolor{mygreen}{HTML}{009900}
4
+\definecolor{myblue}{HTML}{0000FF}
5
+\definecolor{mygrey}{rgb}{0.95,0.95,0.95}
6
+
7
+% minted
8
+%% fix the minted@colorbg environment
9
+\makeatletter
10
+\renewenvironment{minted@colorbg}[1]
11
+ {\def\minted@bgcol{#1}%
12
+  \noindent
13
+  \begin{lrbox}{\minted@bgbox}
14
+  \begin{minipage}{\linewidth-2\fboxsep}}
15
+ {\end{minipage}%
16
+  \end{lrbox}%
17
+  \setlength{\topsep}{\smallskipamount}% set the vertical space
18
+  \trivlist\item\relax % ensure going to a new line
19
+  \colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}%
20
+  \endtrivlist % close the trivlist
21
+ }
22
+\makeatother
23
+\usemintedstyle{friendly}
24
+\newminted{haskell}{bgcolor=mygrey,frame=single,numbers=left}
25
+\newminted{cpp}{bgcolor=mygrey,frame=single,numbers=left}
26
+\newminted{c}{bgcolor=mygrey,frame=single,numbers=left}
27
+\newcommand{\hinline}[1]{\mintinline{haskell}{#1}}
28
+\newcommand{\cinline}[1]{\mintinline{c}{#1}}
29
+\newcommand{\cppinline}[1]{\mintinline{cpp}{#1}}
30
+\renewcommand{\theFancyVerbLine}{\ttfamily
31
+	\textcolor[rgb]{0.0,0.0,0.0}{\footnotesize
32
+	\oldstylenums{\arabic{FancyVerbLine}}}}