Added all the files for lulu.com + A5 booklet
[littlebook.git] / lb-pocket.tex
1 % -*- mode: latex; mode: reftex; mode: auto-fill; mode: flyspell; coding: utf-8; tex-command: "pdflatex.sh" -*-
2
3 \documentclass[twoside,11pt]{memoir}
4
5 \usepackage{ifthen}
6 \usepackage{caption}
7 \usepackage{adjustbox}
8 \usepackage{calc}
9 \newlength{\captionheight}
10
11 %\pdfminorversion=3
12
13 \makeatletter
14 \@beginparpenalty=10000
15 \makeatother
16
17 \let\ordinal\relax
18 \usepackage[us]{datetime}
19 \newdateformat{dotdate}{\THEYEAR.\twodigit{\THEMONTH}.\twodigit{\THEDAY}}
20
21 \def\highquality{}
22 \def\breakforlittle{}
23
24 \usepackage{imakeidx}
25 \makeindex[columns=1]
26
27 \usepackage{enumitem}
28 \setlist[itemize]{leftmargin=0pt,itemindent=1em,itemsep=2ex}
29 \setlist{nosep} % or \setlist{noitemsep} to leave space around whole list
30
31 \usepackage[utf8]{inputenc}
32 \usepackage[T1]{fontenc}
33 \usepackage[osf]{libertine}
34 \usepackage{microtype}
35
36 \usepackage[
37   linktocpage=true,
38   unicode=true,
39   bookmarks=true,
40   bookmarksnumbered=false,
41   bookmarksopen=false,
42   breaklinks=true,
43   pdfborder={0 0 1},
44   backref=page,
45   colorlinks=true,
46   linkcolor=links,
47   urlcolor=links,
48   citecolor=links,
49   hypertexnames=false, % to avoid errors with autonum
50 ]{hyperref} % PDF meta-information specification
51
52 %\usepackage{cleveref}
53 \usepackage{autonum}
54
55 \urlstyle{same}
56
57 \usepackage{mdframed}
58 \usepackage{lipsum}% just to generate text for the example
59
60 \newmdenv[
61   topline=false,
62   bottomline=false,
63   innertopmargin=0pt,
64   innerbottommargin=0pt,
65   innerleftmargin=4pt,
66   innerrightmargin=4pt,
67   leftmargin=0pt,
68   rightmargin=0pt,
69   skipabove=0pt,
70   skipbelow=0pt,
71 ]{siderules}
72
73 \usepackage[object=vectorian]{pgfornament}
74 \def\textsep{%
75 \vskip1.5ex
76
77 \centerline{\pgfornament[anchor=center,ydelta=0pt,width=2cm]{82}}
78
79 \vskip0.5ex
80 }
81
82 %\AddToHook{cmd/section/before}{\clearpage}
83 \usepackage[section]{placeins}
84
85 \usepackage{xspace}
86 \def\wordfig{Figure\xspace}
87 \def\wordeq{Equation\xspace}
88 \def\wordtable{Table\xspace}
89 \def\wordchap{Chapter\xspace}
90
91 \let\oldcenter\center
92 \let\oldendcenter\endcenter
93 \renewenvironment{center}{\setlength\topsep{0pt}\oldcenter}{\oldendcenter}
94
95 \usepackage{environ}
96 \NewEnviron{hardcenter}{\makebox[\textwidth][c]{\BODY}}
97
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99 % Math
100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
101
102 \usepackage{amsmath}
103 \usepackage{amssymb}
104 \usepackage{dsfont}
105 \usepackage{mleftright}
106
107 %\allowdisplaybreaks
108
109 %% \setlength{\thinmuskip}{1mu} % by default it is equal to 3 mu
110 %% \setlength{\medmuskip}{1mu} % by default it is equal to 4 mu
111 %% \setlength{\thickmuskip}{3mu} % by default it is equal to 5 mu
112
113 \makeatletter
114 \DeclareFontEncoding{LS1}{}{}
115 \DeclareFontSubstitution{LS1}{stix}{m}{n}
116 \DeclareMathAlphabet{\mathcal}{LS1}{stixscr}{m}{n}
117 \makeatother
118
119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120
121 \newcommand{\eqnumber}{\MakeLinkTarget{equation}\text{(\theequation)}}
122
123 \newcommand{\inputgenerated}[1]{%
124   \IfFileExists{#1}{\input{#1}}{%
125     \errmessage{Cannot find "#1", compile with -shell-escape}\stop}%
126 }
127
128 %\newcommand{\gradient}[2]{{\nabla\!}_{#1 \mid #2}}
129 \newcommand{\gradient}[2]{{\nabla\!#1}_{\mid #2}}
130
131 \def\given{\,\middle\vert\,}
132 \newcommand{\proba}{{P}}
133 \newcommand{\seq}{{S}}
134 \newcommand{\expect}{\mathds{E}}
135 \newcommand{\variance}{\mathds{V}}
136 \newcommand{\empexpect}{\hat{\mathds{E}}}
137 \newcommand{\mutinf}{\mathds{I}}
138 \newcommand{\empmutinf}{\hat{\mathds{I}}}
139 \newcommand{\entropy}{\mathds{H}}
140 \newcommand{\empentropy}{\hat{\mathds{H}}}
141 \newcommand{\ganG}{\mathbf{G}}
142 \newcommand{\ganD}{\mathbf{D}}
143 \newcommand{\ganF}{\mathbf{F}}
144
145 \newcommand{\dkl}{\mathds{D}_{\mathsf{KL}}}
146 \newcommand{\djs}{\mathds{D}_{\mathsf{JS}}}
147
148 \newcommand*{\vertbar}{\rule[-1ex]{0.5pt}{2.5ex}}
149 \newcommand*{\horzbar}{\rule[.5ex]{2.5ex}{0.5pt}}
150
151 \def\positionalencoding{\operatorname{pos-enc}}
152 \def\concat{\operatorname{concat}}
153 \def\crossentropy{\LL_{\operatorname{ce}}}
154
155 \def\embedding{\operatorname{embed}}
156 \def\mha{\operatorname{mha}}
157 \def\layernorm{\operatorname{layernorm}}
158 \def\batchnorm{\operatorname{batchnorm}}
159 \def\fullyconnected{\operatorname{fully-conn}}
160 \def\softargmax{\operatorname{softargmax}}
161 \def\selfattention{\operatorname{self-att}}
162 \def\crossattention{\operatorname{cross-att}}
163 \def\ffw{\operatorname{f{}fw}}
164 \def\attention{\operatorname{att}}
165 \def\relu{\operatorname{relu}}
166 \def\gelu{\operatorname{gelu}}
167 \def\dropout{\operatorname{dropout}}
168 \def\resblock{\operatorname{resblock}}
169 \def\dresblock{\operatorname{dresblock}}
170 \def\reshape{\operatorname{reshape}}
171 \def\convtwod{\operatorname{conv-2d}}
172 \def\maxpool{\operatorname{maxpool}}
173 \def\avgpool{\operatorname{avgpool}}
174 %\def\samax{\Upsilon}
175 %\def\samax{\operatorname{samax}}
176 \def\sigmoid{\operatorname{sigm}}
177 \def\sample{\operatorname{sample}}
178 \def\diag{\operatorname{diag}}
179 \def\sign{\operatorname{sign}}
180 \def\argmax{\operatornamewithlimits{argmax}}
181 \def\argmin{\operatornamewithlimits{argmin}}
182
183 %\usepackage{oldgerm}
184 \usepackage{relsize}
185
186 \usepackage{xfp}
187 \newcommand{\adaptedscale}[1]{\fpeval{1.1*#1}}
188 %\newcommand{\adaptedscale}[1]{#1}
189
190 %\newcommand{\li}[1]{^{\textgoth{#1}}}
191 \newcommand{\li}[1]{^{\scalebox{.5}{\textbf{#1}}}}
192 %% \newcommand{\li}[1]{^{\textbf{#1}}}
193 %\newcommand{\li}[1]{{|#1}}
194 \newcommand{\DATAVAR}{\mathbf{{\cal D}}}
195 \newcommand{\DATAVAL}{\mathbf{d}}
196 \newcommand{\BD}{\mathbf{D}}
197 \newcommand{\LL}{\mathcal{L}}
198 \newcommand{\Ll}{\mathcal{l}}
199 \newcommand{\RR}{\mathbb{R}}
200 \newcommand{\Lh}{\mathcal{h}}
201 \newcommand{\transpose}{^{\top}}
202
203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
204 % tikz
205 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
206
207 \usepackage{tikz}
208 \usetikzlibrary{arrows,arrows.meta,calc}
209 \usetikzlibrary{patterns,backgrounds}
210 \usetikzlibrary{positioning,fit}
211 \usetikzlibrary{shapes.geometric,shapes.multipart}
212 \usetikzlibrary{patterns.meta,decorations.pathreplacing,calligraphy}
213 \usetikzlibrary{tikzmark}
214 \usetikzlibrary{decorations.pathmorphing}
215
216 % remove the "There is no ... in font nullfont!" errors
217 \AtBeginEnvironment{tikzpicture}{\tracinglostchars=0\relax}
218
219 %% \tikzset{
220 %% }
221
222 \definecolor{operatorcolor}{rgb}{0.95,0.95,1.00}
223 \definecolor{paramcolor}{rgb}{0.8,0.8,1.0}
224
225 \tikzset{
226   %font={\fontsize{11pt}{12}\selectfont},
227   axes/.style={
228     samples=1000,
229     %smooth,
230     %scale=0.8,
231   },
232 }
233
234 \newlength{\layergap}
235 \setlength{\layergap}{2pt}
236 \newlength{\layerthickness}
237 \setlength{\layerthickness}{13pt}
238 \newlength{\layerwidth}
239 \setlength{\layerwidth}{4.75em}
240
241 \newlength{\diminfoshift}
242 \setlength{\diminfoshift}{70pt}
243
244 \tikzset{
245   >={Straight Barb[angle'=80,scale=\adaptedscale{1.2}]},
246   deepnet/.style={
247 %%     background rectangle/.style={fill=paper},
248 %%     show background rectangle,
249     %every text node part/.style={align=center},
250     %rounded corners=0.5pt,
251     curly brace/.style={sharp corners,very thick,decoration={calligraphic brace,amplitude=0.20cm},decorate},
252     %font=\footnotesize,
253     halo/.style={
254       %%       on layer=background,
255       preaction={
256         draw=white,line width=2pt,-,%shorten <=1pt,shorten >=1pt,
257       },
258     },
259     operator/.style={draw=black!50,fill=operatorcolor,inner sep=1pt,font=\small},
260     next/.style={above=##1\layergap of \tikzlastnode},
261     next/.default={1},
262     prev/.style={below=##1\layergap of \tikzlastnode},
263     prev/.default={1},
264     var/.style={inner sep=2pt},
265     flow/.style={thick},
266     layer/.style={operator,minimum width=\layerwidth,minimum height=\layerthickness,text depth=1pt,text height=1.3ex},
267     layer small/.style={layer,minimum width=\layerthickness},
268     layer large/.style={layer,minimum height=1.5\layerthickness},
269     layer very large/.style={layer,minimum height=1.75\layerthickness},
270     info line/.style={
271       draw=black,line width=0.4pt,dash pattern=on 0.4pt off 2pt,
272 %%       draw=black!50,line width=0.2pt,-,
273       shorten >=2pt,shorten <=2pt,
274     },
275     block definition/.style={draw=black,inner sep=2\layergap,dash pattern=on 2.5pt off 0.5pt},
276     replicated/.style={
277       draw=black,
278       inner sep=\layergap, dash pattern=on 2.5pt off 1pt,
279       label={[%
280           inner sep=2pt,
281           anchor=south west,
282         ]south east:{\scriptsize $\times ##1$}},
283     },
284     %
285     inputs/.style={
286       text depth=1.75ex,
287       path picture={%
288         \draw[black]
289         ($(path picture bounding box.south west)+(1pt,7pt)$)--($(path picture bounding box.south east)+(-1pt,7pt)$)
290         %
291         node[midway,yshift=-18pt] {\scalebox{.52}{##1}};
292       }
293     },
294     %
295     param/.style={%
296 %      draw=paramcolor,
297       fill=paramcolor,
298 %%       preaction={fill=white},
299 %%       pattern color=black!15,
300 %%       pattern={Lines[line width=0.5pt,angle=-45,distance=1pt]}
301     },
302     meta param/.style={label={[%
303           inner sep=0pt,
304           text depth=0pt,
305           anchor=south west,
306           shift={(1.5pt,0pt)},
307         ]south east:{\scriptsize\color{blue}##1}}},
308   }
309 }
310
311 \newcommand{\diminfo}[3]{%
312   \coordinate (t) at ($(#2.north)+(\diminfoshift,0.5\layergap)$);
313   \node[inner sep=0pt,yshift=-0.5pt] (s) at (#1.north east-|t) {\footnotesize #3};
314   \draw[info line] (#1.north east|-s)--(s);
315 }
316
317 \newcommand{\defop}[2]{%
318 %%   \coordinate (BL) at ($(#1.north)+(-0.49\textwidth, 4\layergap)$);
319 %%   \coordinate (BR) at ($(#1.north)+( 0.49\textwidth, 4\layergap)$);
320 %%   \coordinate (TL) at ($(#2.south-|#1)+(-0.49\textwidth,-4\layergap)$);
321 %%   \coordinate (TR) at ($(#2.south-|#1)+( 0.49\textwidth,-4\layergap)$);
322   \begin{pgfinterruptboundingbox}
323     \node[anchor=south west,inner sep=2pt] (label) at #1 {#2};
324     \draw[decorate,decoration={coil,amplitude=0.5pt,segment length=2pt,aspect=0}] (label.south west) -- (label.south east);
325   \end{pgfinterruptboundingbox}
326 }
327
328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
329 % style on layer
330
331 \tikzset{%
332   on layer/.code={
333     \pgfonlayer{#1}\begingroup
334     \aftergroup\endpgfonlayer
335     \aftergroup\endgroup
336   }}
337
338 \makeatletter
339 %% fix for bb computation of double wires.
340 %% from https://tex.stackexchange.com/questions/130456/tikz-double-lines-are-shifted
341 \tikzset{
342   only coordinates are relevant/.is choice,
343   only coordinates are relevant/.default=true,
344   only coordinates are relevant/true/.code={%
345     \tikz@addmode{\pgf@relevantforpicturesizefalse}},
346   only coordinates are relevant/false/.code={%
347     \tikz@addmode{\pgf@relevantforpicturesizetrue}}
348 }
349 \makeatother
350
351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
352
353 \makeatletter
354 % extract interval `start:end` values
355 \def\get@interval@start#1:#2\@nil{#1}
356 \def\get@interval@end#1:#2\@nil{#2}
357 % get domain
358 \def\domainmin{\expandafter\get@interval@start\tikz@plot@domain\@nil}
359 \def\domainmax{\expandafter\get@interval@end\tikz@plot@domain\@nil}
360 % get range
361 \def\rangemin{\expandafter\get@interval@start\tikz@plot@range\@nil}
362 \def\rangemax{\expandafter\get@interval@end\tikz@plot@range\@nil}
363 \makeatother
364
365 \usepackage{pgfplots}
366 \usepgfplotslibrary{patchplots,colormaps}
367 \pgfplotsset{compat = newest}
368
369 \newcommand{\mygrid}[5]{%
370   \pgfmathsetmacro{\xmin}{#1+1}
371   \pgfmathsetmacro{\xmax}{#1+#3-1}
372   \pgfmathsetmacro{\ymin}{#2+1}
373   \pgfmathsetmacro{\ymax}{#2+#4-1}
374   \ifthenelse{\equal{#5}{}}
375   {\draw (#1,#2) rectangle ++(#3,#4);}
376   {\draw[fill=#5] (#1,#2) rectangle ++(#3,#4);}
377   \foreach \x in {\xmin,...,\xmax}{
378     \draw (\x,#2)-- ++(0,#4);
379   }
380   \foreach \y in {\ymin,...,\ymax}{
381     \draw (#1,\y)-- ++(#3,0);
382   }
383 }
384
385 \newcommand{\amatrix}[7]{%
386   \begin{tikzpicture}[scale=\adaptedscale{0.2}]
387     \ifthenelse{\equal{#7}{}}
388                {}
389                {\draw[draw=none,fill=#7] (#3,#4) rectangle ++(#5,#6);}
390                \mygrid{0}{0}{#1}{#2}{}
391   \end{tikzpicture}%
392 }
393
394 \newcommand{\gridcube}[3]{% 7,4,6
395
396   \foreach \b in { 0,...,#2 }{
397     \draw (0,\b,0)--++(#1,0,0)--++(0,0,#3);
398   }
399
400   \foreach \d in { 0,...,#1 }{
401     \draw (\d,0,0)--++(0,#2,0)--++(0,0,#3);
402   }
403
404   \foreach \hw in { 0,...,#3 }{
405     \draw (0,0,\hw)++(#1,0,0)--++(0,#2,0)--++(-#1,0,0);
406   }
407 }
408
409 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
410 % Bibliography
411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
412
413 \usepackage[square]{natbib}
414 \bibliographystyle{plainnatmodified-pocket}
415 \nobibintoc
416 \newcommand{\biburl}[1]{\href{#1}{pdf}}
417
418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
419 % Layout
420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
421
422 \setlength{\cftbeforepartskip}{3ex}
423 \setlength{\cftbeforechapterskip}{1.2ex}
424 \setlength{\cftbeforesectionskip}{0.2ex}
425
426 \cftsetindents{part}{0em}{1.8em}
427 \cftsetindents{chapter}{0em}{1.8em}
428 \cftsetindents{section}{1.8em}{2.2em}
429
430 \setlength{\parindent}{0cm}
431 \setlength{\parskip}{2ex}
432
433 \setstocksize{17.5cm}{10.8cm}
434 \settrimmedsize{\stockheight}{\stockwidth}{*}
435 % Most books will require a gutter of 0.2 - 0.3 in (=5-7.5mm)
436 %\setlrmarginsandblock{19.5mm}{12.5mm}{*} % proto 2023.06.10
437 \setlrmarginsandblock{17.5mm}{12.5mm}{*}
438 \setulmarginsandblock{15mm}{20mm}{*}
439 \setheadfoot{15mm}{10mm}
440 \setheaderspaces{*}{*}{*}
441
442 \makepagestyle{littlebook}
443 \makeoddhead{littlebook}{}{}{}
444 \makeevenhead{littlebook}{}{}{}
445 \newcommand{\myfooter}{\thepage}
446 %\newcommand{\myfooter}{{\thepage \hskip 0.8em \raisebox{-2pt}{\vline height 8pt} \hskip 0.4em \thelastpage}}
447 \makeevenfoot{littlebook}{}{\myfooter}{}
448 \makeoddfoot{littlebook}{}{\myfooter}{}
449 \pagestyle{littlebook}
450
451 \makeevenfoot{plain}{}{\myfooter}{}
452 \makeoddfoot{plain}{}{\myfooter}{}
453
454 \copypagestyle{chapter}{plain}
455 \makeevenfoot{chapter}{}{\myfooter}{}
456 \makeoddfoot{chapter}{}{\myfooter}{}
457
458 \copypagestyle{part}{plain}
459 \makeevenfoot{part}{}{}{}
460 \makeoddfoot{part}{}{}{}
461
462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
463
464 \renewcommand{\partnamefont}{\centering\sffamily\scshape\Huge}
465 \renewcommand{\partnumfont}{\sffamily\Huge}
466 \renewcommand{\parttitlefont}{\centering\sffamily\scshape\Huge}
467 \renewcommand{\beforepartskip}{\vspace*{\stretch{3}}}
468 \renewcommand{\afterpartskip}{%
469 \vspace*{\stretch{4}}
470 \newpage%
471 }
472
473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
474
475 \makechapterstyle{Tufte}{
476 \renewcommand{\chapterheadstart}{\null \vskip3.0\onelineskip}
477 \renewcommand{\printchaptername}{\large\sffamily\itshape\chaptername}
478 \renewcommand{\printchapternum}{\LARGE\thechapter \\}
479 \renewcommand{\afterchapternum}{}
480 \renewcommand{\printchaptertitle}[1]{
481 \raggedright
482 \itshape\Huge{##1}}
483 \renewcommand{\afterchaptertitle}{
484 \vskip3.5\onelineskip
485 }}
486 \chapterstyle{Tufte}
487
488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
489
490 \setsecheadstyle{\sethangfrom{\noindent ##1}\raggedright\sffamily\itshape\Large}
491 \setbeforesecskip{-.9\onelineskip}
492 \setaftersecskip{\onelineskip}
493
494 \setsubsecheadstyle{\sethangfrom{\noindent  ##1}\raggedright\sffamily\itshape\large}
495 \setbeforesubsecskip{\onelineskip}
496 \setaftersubsecskip{.65\onelineskip}
497
498 \setsubsubsecheadstyle{\sethangfrom{\noindent ##1}\raggedright\sffamily\itshape}
499 \setbeforesubsubsecskip{-.5\onelineskip}
500 \setaftersubsubsecskip{.1\onelineskip}
501
502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
503
504 \captiontitlefont{\itshape}
505 \captionnamefont{}
506 \newcommand{\likecaption}{\color{black}\itshape}
507 \setlength{\abovecaptionskip}{3ex}
508
509 \midsloppy
510
511 \checkandfixthelayout
512
513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
514 % The \todo command
515 \newcounter{nbdrafts}
516 \setcounter{nbdrafts}{0}
517 \makeatletter
518 \newcommand{\checknbdrafts}{
519 \ifnum \thenbdrafts > 0
520 \@latex@warning@no@line{*WARNING* The document contains \thenbdrafts \space draft note(s)}
521 \fi}
522 \newcommand{\todo}[1]{\addtocounter{nbdrafts}{1}{\color{red} #1}}
523 \makeatother
524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
525 \definecolor{paper}{rgb}{0.95,0.95,0.95}
526 \definecolor{math}{rgb}{0.0,0.5,0.0}
527 %\definecolor{links}{rgb}{0.0,0.2,0.5}
528 \definecolor{links}{rgb}{0.0,0.0,0.0}
529 %\definecolor{hlcolor}{rgb}{0.8,1.0,0.85}
530
531 \definecolor{blue}{rgb}{0.3,0.5,0.85}
532 \definecolor{red}{rgb}{0.65,0.0,0.0}
533 \definecolor{green}{rgb}{0.0,0.50,0.0}
534 \definecolor{dimmed}{rgb}{0.8,0.8,0.8}
535 \definecolor{orange}{rgb}{1.0,0.75,0.0}
536
537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
538 % Pretty underline, taken from
539 % https://tex.stackexchange.com/questions/36894/underline-omitting-the-descenders
540
541 \usepackage{soul}
542 \usepackage{xcolor}
543 \usepackage{xparse}
544 \makeatletter
545
546 \ExplSyntaxOn
547 \cs_new:Npn \white_text:n #1
548   {
549     \fp_set:Nn \l_tmpa_fp {#1 * .01}
550     \llap{\textcolor{white}{\the\SOUL@syllable}\hspace{\fp_to_decimal:N \l_tmpa_fp em}}
551     \llap{\textcolor{white}{\the\SOUL@syllable}\hspace{-\fp_to_decimal:N \l_tmpa_fp em}}
552   }
553 \NewDocumentCommand{\whiten}{ m }
554     {
555       \int_step_function:nnnN {1}{1}{#1} \white_text:n
556     }
557 \ExplSyntaxOff
558
559 \NewDocumentCommand{ \prettyul }{ D<>{5} O{0.2ex} O{0.1ex} +m } {%
560 \begingroup
561 \setul{#2}{#3}%
562 \def\SOUL@uleverysyllable{%
563    \setbox0=\hbox{\the\SOUL@syllable}%
564    \ifdim\dp0>\z@
565       \SOUL@ulunderline{\phantom{\the\SOUL@syllable}}%
566       \whiten{#1}%
567       \llap{%
568         \the\SOUL@syllable
569         \SOUL@setkern\SOUL@charkern
570       }%
571    \else
572        \SOUL@ulunderline{%
573          \the\SOUL@syllable
574          \SOUL@setkern\SOUL@charkern
575        }%
576    \fi}%
577     \ul{#4}%
578 \endgroup
579 }
580
581 \makeatother
582
583 % end of prettyul
584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
585
586 \usepackage{accsupp}
587 \usepackage{xcolor, soul}
588
589 \definecolor{hlcolor}{rgb}{1.0,1.0,0.5}
590 \definecolor{ulcolor}{rgb}{0.50,0.50,0.50}
591 \sethlcolor{hlcolor}
592 \setulcolor{ulcolor}
593 \newcommand{\keyterm}[2][]{%
594   \BeginAccSupp{method=plain,ActualText={#2}}%
595   \ifthenelse{\equal{#1}{}}
596              {\prettyul[2pt]{#2}\index{#2}}
597              {\prettyul[2pt]{#2}\index{#1}}%
598 %%              {\emph{#2}\index{#2}}
599 %%              {\emph{#2}\index{#1}}%
600   \EndAccSupp{}%
601 }
602
603 \newcommand{\gizmo}{%
604   \begin{tikzpicture}[scale=0.25]
605     \draw[draw=none,fill=red]  (0,0) rectangle ++(1,1);
606     \draw[draw=none,fill=blue] (1,0) rectangle ++(1,1);
607     \draw[draw=none,fill=blue] (0,1) rectangle ++(1,1);
608     \draw[draw=none,fill=red]  (1,1) rectangle ++(1,1);
609   \end{tikzpicture}
610 }
611
612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
613
614 \def\forprint{}
615 %\def\withcover{}
616
617 \raggedbottom
618
619 \input{lb}