-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.tex
377 lines (324 loc) · 10.4 KB
/
macros.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
% !TeX encoding = UTF-8
% !TeX spellcheck = en_US
% !TeX root = LoopOptTutorial.tex
% Remove the annoying symbols no one uses anyway.
\beamertemplatenavigationsymbolsempty
% Most of these were autogenerated by org export to beamer.tex file
% I don't know if they are all necessary, but I don't think there is any harm in
% including them.
\usepackage[utf8]{luainputenc}
%\usepackage[T1]{fontenc} %MK: LuaLaTeX only properly supports unicode fonts ("TU")
\usepackage{graphicx}
%\usepackage{grffile} %MK: https://github.com/ho-tex/oberdiek/issues/73
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{comment}
\usetheme{default}
% I'm not sure what exactly this is for
% It is copied from a template provided by Till Tantau
%\usepackage[english]{babel} %MK: for LuaLaTeX, use polyglossia (if needed)
% It is copied from a template provided by Till Tantau
% I'm not sure what exactly this is for
%\usepackage{times} %MK: Not available for unicode fonts (it's a Type-1 font, obsolete and its maintainer is dead); use \uspackage{fontspec} to customize font.
\usepackage{listings}
\usepackage{xcolor}
\usepackage{minibox}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{bending}
\usetikzlibrary{shadows}
\usetikzlibrary{fit}
\usetikzlibrary{graphs}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{matrix}
\usetikzlibrary{positioning}
\usegdlibrary{layered}
\pgfdeclarelayer{backbackbackground}
\pgfdeclarelayer{backbackground}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfdeclarelayer{foreforeground}
\pgfsetlayers{backbackbackground,backbackground,background,main,foreground,foreforeground}
\tikzset{>={Stealth[round,flex,length=5pt 4.5 0.8]}} % Standard latex arrow tips are way too small
\tikzset{tight/.style={minimum width=0pt,minimum height=0pt,inner sep=0pt,outer sep=0pt}}
\usepackage{aobs-tikz}
\usepackage{minted}
\newmintinline{c}{style=bw}
\newmintinline{cpp}{style=bw}
\newmintinline{llvm}{}
\newmintinline{text}{style=bw}
\usemintedstyle{borland}
\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
breaklines=true,
postbreak=\raisebox{0ex}[0ex][0ex]{\color{red}$\hookrightarrow$\space}
}
% Use this to adjust text for overlays
% If set to transparent, then text is overlays is visible, but greyed out.
% If not set, then the text in overlays is not visible at all (i.e., invisible).
\setbeamercovered{transparent}
\usecolortheme{}
\usefonttheme{}
\useinnertheme{}
\useoutertheme{}
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor{block title}{bg=blue,fg=white}
\setbeamercolor{block body}{bg=blue!10}
\setbeamercolor{block title example}{bg=darkgreen!80,fg=white}
\setbeamercolor{block body example}{bg=green!10}
% Delete this, if you do not want the table of contents to pop up at
% the beginning of each subsection:
%% \AtBeginSubsection[]
%% {
%% \begin{frame}<beamer>{Outline}
%% \tableofcontents[currentsection,currentsubsection]
%% \end{frame}
%% }
% If you wish to uncover everything in a step-wise fashion, uncomment
% the following command:
%\beamerdefaultoverlayspecification{<+->}
\makeatletter
% pgf 'file' shape
\def\myfoldheight{0.5}
\def\myshapepath{
\pgfextract@process\northwest{
\southwest\pgf@xa=\pgf@x
\northeast
\pgf@x=\pgf@xa
}
\pgfextract@process\southeast{
\southwest\pgf@ya=\pgf@y
\northeast
\pgf@y=\pgf@ya
}
\pgfextract@process\northfold{
\pgfpointdiff{\southwest}{\northeast}
\northeast
\advance\pgf@x-\myfoldheight\pgf@y
}
\pgfextract@process\eastfold{
\pgfpointdiff{\southwest}{\northeast}
\northeast
\advance\pgf@y-\myfoldheight\pgf@y
}
\pgfextract@process\fold{
\northfold\pgf@xa=\pgf@x
\eastfold
\pgf@x=\pgf@xa
}
\pgfpathmoveto{\southwest}
\pgfpathlineto{\northwest}
\pgfpathlineto{\northfold}
\pgfpathlineto{\eastfold}
\pgfpathlineto{\southeast}
\pgfpathclose
}
% compute an intersection point between a line and \myshapepath
% NOTE: Breaks inside \graph[layered layout]
\def\myshapeanchorborder#1#2{
% #1 = point inside the shape
% #2 = direction
\pgftransformreset % without this, the intersection commands yield strange results
\pgf@relevantforpicturesizefalse % don't include drawings in bounding box
\pgfintersectionofpaths{
\myshapepath
%\pgfgetpath\temppath\pgfusepath{stroke}\pgfsetpath\temppath % draw path for debugging
}{
\pgfpathmoveto{
\pgfpointadd{
\pgfpointdiff{\southwest}{\northeast}\pgf@xc=\pgf@x \advance\pgf@xc by \pgf@y % calculate a distance that is guaranteed to be outside the shape
\pgfpointscale{
\pgf@xc
}{
\pgfpointnormalised{
#2
}
}
} {
#1
}
}
\pgfpathlineto{#1}
%\pgfgetpath\temppath\pgfusepath{stroke}\pgfsetpath\temppath % draw path for debugging
}
\pgfpointintersectionsolution{1}
}
\def\myshapeanchorcenter{
\pgfpointscale{.5}{\pgfpointadd{\southwest}{\northeast}}
}
% we could probably re-use some existing \dimen, but better be careful
\newdimen\myshapedimenx
\newdimen\myshapedimeny
\pgfdeclareshape{file}{
% some stuff, we can inherit from the rectangle shape
\inheritsavedanchors[from=rectangle]
\inheritanchor[from=rectangle]{center}
\inheritanchor[from=rectangle]{mid}
\inheritanchor[from=rectangle]{base}
% calculate these anchors so they lie on a coorinate line with .center
\inheritanchor[from=rectangle]{west}
\inheritanchor[from=rectangle]{east}
\inheritanchor[from=rectangle]{north}
\inheritanchor[from=rectangle]{south}
% calculate these anchors so they lie on a line through .center and the corresponding anchor of the underlying rectangle
\inheritanchor[from=rectangle]{south west}
\inheritanchor[from=rectangle]{south east}
\inheritanchor[from=rectangle]{north west}
% \inheritanchor[from=rectangle]{north east}
% somewhat more special anchors. The coordinate calculations were taken from the rectangle node
\inheritanchor[from=rectangle]{mid west}
\inheritanchor[from=rectangle]{mid east}
\inheritanchor[from=rectangle]{base west}
\inheritanchor[from=rectangle]{base east}
\backgroundpath{
\myshapepath
}
\foregroundpath{
\pgfpathmoveto{\northfold}
\pgfpathlineto{\fold}
\pgfpathlineto{\eastfold}
}
% This is from rectangle, i.e. without the fold.
\anchorborder{%
\pgf@xb=\pgf@x% xb/yb is target
\pgf@yb=\pgf@y%
\southwest%
\pgf@xa=\pgf@x% xa/ya is se
\pgf@ya=\pgf@y%
\northeast%
\advance\pgf@x by-\pgf@xa%
\advance\pgf@y by-\pgf@ya%
\pgf@xc=.5\pgf@x% x/y is half width/height
\pgf@yc=.5\pgf@y%
\advance\pgf@xa by\pgf@xc% xa/ya becomes center
\advance\pgf@ya by\pgf@yc%
\edef\pgf@marshal{%
\noexpand\pgfpointborderrectangle
{\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}
{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}%
}%
\pgf@process{\pgf@marshal}%
\advance\pgf@x by\pgf@xa%
\advance\pgf@y by\pgf@ya%
}
% \anchorborder{
% \myshapedimenx=\pgf@x
% \myshapedimeny=\pgf@y
% \myshapeanchorborder{\myshapeanchorcenter}{\pgfpoint{\myshapedimenx}{\myshapedimeny}}
% }
}
\newsavebox{\my@resizeenv@TempBox}%
\newcommand*{\my@resizeenv@width}{}%
\newenvironment{resizeenv}[1]{%
\renewcommand*{\my@resizeenv@width}{#1}%
\begin{lrbox}{\my@resizeenv@TempBox}%
}{%
\end{lrbox}%
\resizebox{\my@resizeenv@width}{!}{\usebox{\my@resizeenv@TempBox}}%
}%
\newsavebox{\my@scale@Lrbox}
\newcommand*{\my@scale@Percentage}{}
\newenvironment*{scaleenv}[1]{%
\renewcommand*{\my@scale@Percentage}{#1}%
\begin{lrbox}{\my@scale@Lrbox}%
}{%
\end{lrbox}%
\scalebox{\my@scale@Percentage}{\usebox{\my@scale@Lrbox}}%
}%
\newsavebox{\my@scalepar@TempBox}
\newenvironment{scalepar}[1]{%
\def\my@DoScalePar{\scalebox{#1}}%
\begin{lrbox}{\my@scalepar@TempBox}%
\pgfmathparse{\textwidth/#1}%
\begin{minipage}{\pgfmathresult pt}%
}{%
\end{minipage}%
\end{lrbox}%
\my@DoScalePar{\usebox{\my@scalepar@TempBox}}%
}
\newenvironment{resizepar}{%
\begin{resizeenv}{\textwidth}%
}{%
\end{resizeenv}%
}%
\newenvironment{tightcenter}{%
\setlength\topsep{0pt}
\setlength\parskip{0pt}
\begin{center}
}{%
\end{center}
}
\newcommand{\anchorbox}[3][]{%
\tikz[remember picture,baseline=(#2.base)] \node[inner sep=0,outer sep=0,minimum size=0pt,#1](#2) {\minibox{#3}};%
}
% Positioniert etwas an eine bestimmte Stelle
% \begin{locate}[options]{position}
\newsavebox{\my@locate@Lrbox}
\newenvironment*{locate}[2][]{%
\tikzset{my@locate@Options/.style={#1}}%
\begin{tikzpicture}[remember picture,overlay]%
\coordinate (my@locate@Position) at (#2);
\end{tikzpicture}%
\begin{lrbox}{\my@locate@Lrbox}%
}{%
\end{lrbox}%
\begin{tikzpicture}[remember picture,overlay]%
\node[my@locate@Options,inner sep=0,outer sep=0] at (my@locate@Position) {\usebox{\my@locate@Lrbox}};%
\end{tikzpicture}%
}
\renewenvironment<>{locate}[2][]{%
\begin{actionenv}#3\begin{originallocate}[#1]{#2}%
}{%
\end{originallocate}\end{actionenv}%
}
% Tikz coordinate system: Relativ zur aktuellen Seite
% "page cs:x=0,y=0" == Oben links
% "page cs:x=1,y=1" == Unten rechts
\define@key{pagekeys}{x}{\def\mypagex{#1}}
\define@key{pagekeys}{y}{\def\mypagey{#1}}
\tikzdeclarecoordinatesystem{page}{%
\setkeys{pagekeys}{#1}%
\pgfpointlineattime{%
\mypagex%
}{%
\pgfpointlineattime{%
\mypagey%
}{%
\pgfpointanchor{current page}{north west}%
}{%
\pgfpointanchor{current page}{south west}%
}%
}{%
\pgfpointlineattime{%
\mypagey%
}{%
\pgfpointanchor{current page}{north east}%
}{%
\pgfpointanchor{current page}{south east}%
}%
}%
}
\makeatother
\newcommand*\arrowdown[1]{%
\begin{tikzpicture}%
%\node[text width=\textwidth,outer ysep=0pt,inner ysep=0pt](text){};
\node[draw=teal!90!black,very thick,single arrow,rotate=-90,anchor=center,minimum width=8mm,minimum height=8mm,outer ysep=0pt,rounded corners=1pt,drop shadow,shade,top color=teal!10,bottom color=teal,shading angle=15](arrow) {};
\ifthenelse{\equal{#1}{}}{}{\node[right=3mm] at (arrow.north) {\minibox{#1}};}
%\draw[blue] (current bounding box.north west) rectangle (current bounding box.south east);
\end{tikzpicture}%
}
\definecolor{darkmagenta}{rgb}{0.55, 0.0, 0.55}
\definecolor{darkspringgreen}{rgb}{0.09, 0.45, 0.27}
\definecolor{darkgreen}{rgb}{0.0, 0.2, 0.13}