| 1 |
%% memoize-doc.sty |
| 2 |
%% |
| 3 |
%% This file is a part of Memoize, a TeX package for externalization of |
| 4 |
%% graphics and memoization of compilation results in general, available at |
| 5 |
%% https://ctan.org/pkg/memoize and https://github.com/sasozivanovic/memoize. |
| 6 |
%% |
| 7 |
%% Copyright (c) 2020- Saso Zivanovic <[email protected]> |
| 8 |
%% (Sa\v{s}o \v{Z}ivanovi\'{c}) |
| 9 |
%% |
| 10 |
%% This work may be distributed and/or modified under the conditions of the |
| 11 |
%% LaTeX Project Public License, either version 1.3c of this license or (at |
| 12 |
%% your option) any later version. The latest version of this license is in |
| 13 |
%% https://www.latex-project.org/lppl.txt and version 1.3c or later is part of |
| 14 |
%% all distributions of LaTeX version 2008 or later. |
| 15 |
%% |
| 16 |
%% This work has the LPPL maintenance status `maintained'. |
| 17 |
%% The Current Maintainer of this work is Saso Zivanovic. |
| 18 |
%% |
| 19 |
%% The files belonging to this work and covered by LPPL are listed in |
| 20 |
%% (<texmf>/doc/generic/memoize/)FILES. |
| 21 |
|
| 22 |
% \usepackage{lstdoc} % this must be loaded before hyperref |
| 23 |
\usepackage{shortvrb} |
| 24 |
\AtBeginDocument{\MakeShortVerb{\|}} |
| 25 |
% \usepackage{hypdoc} |
| 26 |
\usepackage[hyperindex=false]{hyperref} |
| 27 |
\hypersetup{ |
| 28 |
colorlinks=true, |
| 29 |
allcolors=black, |
| 30 |
linkcolor=Hyperlink, |
| 31 |
} |
| 32 |
|
| 33 |
\usepackage{microtype} |
| 34 |
%\SetExpansion[context=sloppy,stretch=30,shrink=50,step=1]{encoding=*}{}% |
| 35 |
|
| 36 |
\usepackage{fnpct} |
| 37 |
\usepackage{memoize-doc-common} |
| 38 |
|
| 39 |
% explicitly load advice (and thereby collargs) for when we load nomemoize |
| 40 |
\usepackage{advice} |
| 41 |
|
| 42 |
\usepackage{forest} |
| 43 |
\useforestlibrary{edges} |
| 44 |
|
| 45 |
\usepackage[infoshow]{tracefnt} |
| 46 |
|
| 47 |
\tcbuselibrary{xparse,breakable} |
| 48 |
|
| 49 |
\mmzset{ |
| 50 |
auto={tcolorbox}{memoize, options=verbatim}, |
| 51 |
auto={tcboxedraster}{memoize, options=verbatim}, |
| 52 |
auto={tcbraster}{memoize, options={verbatim,ignore spaces}}, |
| 53 |
auto={tcblisting}{memoize, options={verbatim,ignore spaces}}, |
| 54 |
auto csname={tcbinputexample code}{memoize, args=mmm+m, ignore spaces}, |
| 55 |
auto=\tcbinputlisting{memoize, args=m, options=ignore spaces}, |
| 56 |
% The following doesn't work perfectly, but it's good enough. |
| 57 |
auto key={/tcb/breakable}{run if memoizing, outer handler=\makeunmemoizableunless{false}}, |
| 58 |
auto key={/tcb/float}{run if memoizing, outer handler=\makeunmemoizableunless{}}, |
| 59 |
auto=\Emph{nomemoize,args=m}, % why do I need to specify args? |
| 60 |
auto=\EmphTT{nomemoize,args=m}, |
| 61 |
auto=\EmphVerbatim{nomemoize,args=v}, |
| 62 |
} |
| 63 |
|
| 64 |
\def\makeunmemoizableunless#1#2\pgfeov{% |
| 65 |
\ifstrequal{#1}{#2}{}{\mmzUnmemoizable}% |
| 66 |
\AdviceOriginal#1\pgfeov |
| 67 |
} |
| 68 |
|
| 69 |
\NewDocumentCommand\introboxtitle{om}{% |
| 70 |
\strut |
| 71 |
\textcolor{emphcolor}{% |
| 72 |
\IfValueT{#1}{\hypertarget{#1}}{\textbf{#2}}% |
| 73 |
}% |
| 74 |
} |
| 75 |
|
| 76 |
\usepackage{fancyhdr} |
| 77 |
\usepackage[skip=0.3\baselineskip plus 2pt]{parskip} |
| 78 |
\usepackage[bottom]{footmisc} |
| 79 |
\usepackage{xparse} |
| 80 |
\usepackage{multicol} |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
\usepackage{graphicx} |
| 86 |
|
| 87 |
\usepackage{cprotect} |
| 88 |
\setlist[description]{ |
| 89 |
itemsep=0.3\baselineskip plus 2pt minus 1pt, |
| 90 |
parsep=0.3\baselineskip plus 2pt |
| 91 |
} |
| 92 |
\SetEnumitemKey{comma}{itemjoin={{, }}} |
| 93 |
\SetEnumitemKey{and}{itemjoin={{, }}, itemjoin*={{, and }}} |
| 94 |
\setlist[itemize,enumerate]{itemsep=0pt plus 1pt minus 2pt} |
| 95 |
|
| 96 |
% \usepackage{lstdoc} % this must be loaded before hyperref |
| 97 |
%\usepackage{lstautogobble} % todo: does not work! |
| 98 |
\def\listings@file@value@in@reset{} |
| 99 |
\tcbset{ |
| 100 |
listing file/.append code={% |
| 101 |
\ifmemoizing |
| 102 |
\ifstrequal{#1}{\jobname.listing}{% |
| 103 |
% We're in tcolorbox's reset, do nothing |
| 104 |
}{% |
| 105 |
\mmzset{ |
| 106 |
context={% |
| 107 |
listing file={#1}, |
| 108 |
md5sum=\csuse{pdf@filemdfivesum}{#1}, |
| 109 |
}, |
| 110 |
}% |
| 111 |
}% |
| 112 |
\fi |
| 113 |
}, |
| 114 |
centering/.style={before=\centering}, |
| 115 |
} |
| 116 |
\colorlet{pointcolor}{green!50!black} |
| 117 |
\def\pstyle{\color{pointcolor}}% todo: hyperlink? |
| 118 |
\setlength\textfloatsep{0.5\baselineskip plus 2pt minus 2pt} |
| 119 |
\tcbset{ |
| 120 |
top=1mm, bottom=1mm, |
| 121 |
beforeafter skip balanced=0.5\baselineskip plus 2pt minus 2pt, |
| 122 |
raster every box/.style={top=1mm, bottom=1mm}, |
| 123 |
before upper={\parskip0.3\baselineskip plus 2pt\relax}, |
| 124 |
every box on layer 1/.style={ |
| 125 |
fonttitle=\bfseries, |
| 126 |
}, |
| 127 |
my listing options/.style={ |
| 128 |
listing options app={ |
| 129 |
moredelim={[is][\pstyle]{~}{~}}, |
| 130 |
commentstyle=\color{purple}, |
| 131 |
morekeywords={unexpanded,expanded,expandonce,NewDocumentCommand,IfValueTF}, |
| 132 |
breakindent=10pt, |
| 133 |
}, |
| 134 |
}, |
| 135 |
my listing options, |
| 136 |
% for listings inside a tcboxedraster ... |
| 137 |
reset/.append style=my listing options, |
| 138 |
% titles |
| 139 |
attach shifted boxed title to top right/.style={ |
| 140 |
attach boxed title to top right={ |
| 141 |
xshift=1.5mm, yshift=-\tcboxedtitleheight/2, #1}, |
| 142 |
}, |
| 143 |
attach shifted boxed title to top right/.default={}, |
| 144 |
attach shifted boxed title to top left/.style={ |
| 145 |
attach boxed title to top left={ |
| 146 |
xshift=-1.5mm, yshift=-\tcboxedtitleheight/2, #1}, |
| 147 |
}, |
| 148 |
attach shifted boxed title to top left/.default={}, |
| 149 |
my boxed title/.style={ |
| 150 |
enhanced, title={#1}, |
| 151 |
fonttitle=\scriptsize, |
| 152 |
boxed title style={size=small}, |
| 153 |
}, |
| 154 |
my boxed title/.value required, |
| 155 |
extern page/.style={ |
| 156 |
my boxed title=extern page, |
| 157 |
boxed title style={colback=blue!70!black, colframe=blue!25!white}, |
| 158 |
attach shifted boxed title to top right, |
| 159 |
}, |
| 160 |
document page/.style={ |
| 161 |
my boxed title=document page, |
| 162 |
boxed title style={colback=green!60!black, colframe=green!25!white}, |
| 163 |
attach shifted boxed title to top right, |
| 164 |
}, |
| 165 |
% end titles |
| 166 |
bad/.style={enhanced, |
| 167 |
finish={ |
| 168 |
\begin{tcbclipinterior} |
| 169 |
\draw[red!40!white, opacity=0.4, line width=1cm] |
| 170 |
(interior.south west)--(interior.north east); |
| 171 |
\end{tcbclipinterior} |
| 172 |
}, |
| 173 |
}, |
| 174 |
mark region/.style 2 args={ |
| 175 |
enhanced, |
| 176 |
underlay={ |
| 177 |
\fill[pointcolor,opacity=0.1] |
| 178 |
([yshift=-\kvtcb@boxsep-\[email protected]*(#1-1)]interior.north west) rectangle ([yshift=-\kvtcb@boxsep-\[email protected]*#2]interior.north east); |
| 179 |
}, |
| 180 |
}, |
| 181 |
warning/.style={colback=red!15}, |
| 182 |
to be continued on right/.style={ |
| 183 |
frame code={% line thickness is uniform and depends on tcolorbox's leftrule |
| 184 |
\draw[color=tcbcolframe, |
| 185 |
line width=2*\kvtcb@left@rule, rounded corners=2*\kvtcb@left@rule, |
| 186 |
] |
| 187 |
(interior.north east)--(interior.north west) |
| 188 |
--(interior.south west)--(interior.south east); |
| 189 |
}, |
| 190 |
interior code app={ |
| 191 |
\draw[color=tcbcolframe,line width=\kvtcb@left@rule,dashed] |
| 192 |
([xshift=-0.5*\kvtcb@left@rule]interior.south east) |
| 193 |
--([xshift=-0.5*\kvtcb@left@rule]interior.north east); |
| 194 |
}, |
| 195 |
}, |
| 196 |
} |
| 197 |
\NewDocumentCommand{\includeexamplepdf}{ O{} O{\examplename} D(){\exampledotc} m}{% |
| 198 |
\mbox{% |
| 199 |
\tcbincludegraphics[reset,capture=hbox,graphics options={clip,#4},#1]{\exampledir#2#3.pdf}% |
| 200 |
}% |
| 201 |
}% |
| 202 |
\def\examplepath{\exampledir\examplename} |
| 203 |
\RequirePackage{intopdf} |
| 204 |
\RequirePackage{fontawesome} |
| 205 |
\tcbset{ |
| 206 |
example title/.style={ |
| 207 |
enhanced, |
| 208 |
% uniform height and (zero) depth |
| 209 |
before title={\begingroup \setbox0\hbox\bgroup}, |
| 210 |
after title={\egroup\ht0 1.2ex \dp0 0pt \box0 \endgroup}, |
| 211 |
title={\texttt{#1}}, |
| 212 |
top=2mm, |
| 213 |
attach shifted boxed title to top left, |
| 214 |
fonttitle={\small\hypercolor{link}{white}}, |
| 215 |
}, |
| 216 |
example title/.default=\examplename.tex, |
| 217 |
attachment/.estore in=\attachmentname, |
| 218 |
no attachment/.style={attach/.style={}}, |
| 219 |
attach/.style={ |
| 220 |
overlay app={% |
| 221 |
\node at (frame.north east) [ |
| 222 |
fill=white, draw=gray, thick, |
| 223 |
ellipse, inner xsep=-0.5mm, inner ysep=0, shift={(-2mm,-2mm)}, rotate=45, |
| 224 |
]{% |
| 225 |
\expandafter\attachandlink\expandafter[\attachmentname]{\attachmentsdir\attachmentname}[application/x-tex]{Click here to open the code.}{\rotatebox{-45}{\faPaperclip}} |
| 226 |
}; |
| 227 |
} |
| 228 |
}, |
| 229 |
} |
| 230 |
\NewDocumentCommand\attachexample{O{\examplename.tex} O{\examplepath.tex.c1.attachment}}{% |
| 231 |
{\textsuperscript{\kern-0.25em \expandafter\attachandlink\expandafter[#1]{#2}[application/x-tex]{Click here to open the code.}{\rotatebox{-45}{\faPaperclip}}\kern-0.25em \relax}}} |
| 232 |
|
| 233 |
\NewTCBInputListing{\tcbinputexample}{ |
| 234 |
>{\edef\ProcessedArgument} m O{.tex} D(){} +m } |
| 235 |
{% |
| 236 |
/utils/exec={% |
| 237 |
\edef\examplename{#1}% |
| 238 |
\edef\exampledotc{#3}% |
| 239 |
},% |
| 240 |
/mmz/context={dtxmd5sum=\csuse{pdf@filemdfivesum}{\exampledir#1#2.dtx}}, |
| 241 |
example title={#1#2}, |
| 242 |
% enlarge left by=\leftmargin,% this takes care of using this box in lists |
| 243 |
listing and comment, |
| 244 |
no .listing/.style={ |
| 245 |
listing file={\exampledir#1#2#3}, |
| 246 |
%attachment path={\exampledir#1#2#3}, |
| 247 |
%attachment path={\exampledir attachments/#1#2}, |
| 248 |
%attachment={#1#2}, |
| 249 |
}, |
| 250 |
listing file=\exampledir#1#2#3.listing, |
| 251 |
%attachment path=\exampledir#1#2#3.attachment, |
| 252 |
%attachment path=\exampledir attachments/#1#2, |
| 253 |
%attachment name=#1#2,% |
| 254 |
attachment=#1#2,% |
| 255 |
#4, |
| 256 |
attach, |
| 257 |
} |
| 258 |
\nommzkeys{context} |
| 259 |
|
| 260 |
\tcbset{ |
| 261 |
full width/.style={grow to left by=\leftmargin}, |
| 262 |
listing and compile/.style={ |
| 263 |
listing and comment, |
| 264 |
comment={% |
| 265 |
\input\examplepath.tex#1% |
| 266 |
} |
| 267 |
}, |
| 268 |
listing and compile/.default=, |
| 269 |
} |
| 270 |
|
| 271 |
\pgfkeys{ |
| 272 |
/handlers/.detokenize/.style={\pgfkeyscurrentpath/.expand once=\detokenize{#1}}, |
| 273 |
/utils/typeout/.code={\typeout{#1}}, |
| 274 |
} |
| 275 |
\let\pdfsystem\pdf@system |
| 276 |
\let\pdffilemdfivesum\pdf@filemdfivesum |
| 277 |
|
| 278 |
\usepackage{booktabs} |
| 279 |
\usepackage{tabularx} |
| 280 |
|
| 281 |
|
| 282 |
\usetikzlibrary{decorations.pathmorphing, arrows.meta} |
| 283 |
\usepackage{tikzlings-penguins,tikzlings-koalas,tikzlings-owls} |
| 284 |
\tikzset{ |
| 285 |
->/.tip={Kite}, |
| 286 |
snake arrow/.style= |
| 287 |
{->, decorate, |
| 288 |
decoration={snake, amplitude=.4mm, segment length=2mm, post length=2mm}, |
| 289 |
}, |
| 290 |
} |
| 291 |
|
| 292 |
% title page |
| 293 |
\renewcommand\abstractname{\vskip-\baselineskip} |
| 294 |
|
| 295 |
% sections |
| 296 |
\newtcbox{\section@box}[3]{/mmz/disable,tile,before=\noindent,after=, |
| 297 |
fontupper=\normalfont#1\bfseries,capture=minipage, |
| 298 |
colback=emphcolor, |
| 299 |
boxsep=0mm,top=#2,bottom=#2,left=\oddsidemargin+1in,right=\oddsidemargin+1in, |
| 300 |
spread sidewards,#3 |
| 301 |
} |
| 302 |
|
| 303 |
\newif\ifsectionclearpage |
| 304 |
\sectionclearpagetrue |
| 305 |
\newif\ifsubsectionclearpage |
| 306 |
\subsectionclearpagetrue |
| 307 |
|
| 308 |
\renewcommand\section{% |
| 309 |
\ifsectionclearpage\clearpage\fi |
| 310 |
\@startsection{section}{1}{\z@}% |
| 311 |
{5mm}{5mm}% |
| 312 |
{\section@box{\Large}{4mm}{fuzzy halo=1mm with blue!50!gray}}} |
| 313 |
\renewcommand\subsection{% |
| 314 |
\ifsubsectionclearpage\ifnum\c@subsection=0 \else\clearpage\fi\fi |
| 315 |
\@startsection{subsection}{2}{\z@}% |
| 316 |
{-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}% |
| 317 |
{\section@box{\large}{2mm}{fuzzy halo=1mm with blue!50!gray}}} |
| 318 |
\renewcommand\subsubsection{% |
| 319 |
\mmznext{disable}% |
| 320 |
\@startsection{subsubsection}{2}{\z@}% |
| 321 |
{-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}% |
| 322 |
{\section@box{}{2mm}{}}} |
| 323 |
\newtcbox{\paragraph@box}{/mmz/disable,tile,before=,after=,capture=hbox, |
| 324 |
fontupper=\normalfont\normalsize\bfseries\hypercolor{link}{black}\vphantom{dj}, |
| 325 |
box align=base, |
| 326 |
boxsep=0mm, |
| 327 |
left=\oddsidemargin+1in, enlarge left by=-\oddsidemargin-1in, |
| 328 |
top=1.2mm, enlarge top by=-1.2mm, |
| 329 |
bottom=1mm, enlarge bottom by=-1mm, |
| 330 |
right=12mm, enlarge right by=-8mm, arc=0mm, rightrule=0mm, |
| 331 |
interior style={left color=emphcolor, right color=white}, |
| 332 |
} |
| 333 |
\let\oldparagraph\paragraph |
| 334 |
\def\paragraphskip{3.25ex \@plus1ex \@minus1ex} |
| 335 |
\RenewDocumentCommand\paragraph{sm}{% |
| 336 |
\mmznext{disable}% |
| 337 |
\@startsection{paragraph}{4}{\z@}{\paragraphskip}{-1em}{\paragraph@box}{#2}% |
| 338 |
\IfBooleanT{#1}{\hspace*{\dimexpr-8mm+0.5em}}% |
| 339 |
\hskip 0pt plus .5em |
| 340 |
\IfBooleanF{#1}{\nopagebreak}% % todo: this is bad, if the paragraph is long |
| 341 |
} |
| 342 |
|
| 343 |
\NewTotalTCBox{\Emph}{m}{my code box, fontupper=\rm}{#1} |
| 344 |
\NewTotalTCBox{\EmphTT}{m}{my code box}{#1} |
| 345 |
\NewTotalTCBox{\EmphVerbatim}{v}{my code box}{#1} |
| 346 |
\tikzset{ |
| 347 |
emphshade/.style={ |
| 348 |
opacity=0.6, |
| 349 |
top color=#1, bottom color=#1, middle color=emphcolor, |
| 350 |
}, |
| 351 |
emphshade/.default=white, |
| 352 |
} |
| 353 |
\tcbset{ |
| 354 |
my code box/.style={ |
| 355 |
reset, enhanced, verbatim, |
| 356 |
boxsep=0pt, left=0.3ex,right=0.3ex, box align=base, |
| 357 |
interior hidden, frame hidden, |
| 358 |
overlay={\shade[emphshade] |
| 359 |
([yshift=0.7ex]frame.north west) rectangle ([yshift=-0.7ex]frame.south east); |
| 360 |
}, |
| 361 |
}, |
| 362 |
} |
| 363 |
|
| 364 |
% verbatim code in the implementation |
| 365 |
\lstdefinestyle{code}{style=tcblatex,xleftmargin=\leftmargin,aboveskip=\parskip} |
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
\newcommand\therefore{\ensuremath{\Rightarrow}} |
| 373 |
\newcommand\nohyphen{\discretionary{}{}{}} |
| 374 |
\hyphenation{Coll-Args} |
| 375 |
\let\gobble\@gobble |
| 376 |
|
| 377 |
\lstset{ |
| 378 |
rangebeginprefix=\ \ \%\%\%\ begin\ listing\ region:\ , |
| 379 |
rangebeginsuffix=, |
| 380 |
rangeendprefix=\ \ \%\%\%\ end\ listing\ region:\ , |
| 381 |
rangeendsuffix=, |
| 382 |
includerangemarker=false, |
| 383 |
keepspaces=true, |
| 384 |
} |
| 385 |
|
| 386 |
\def\relaxmmzcommands{% |
| 387 |
\let\mmzPrefix\gobble |
| 388 |
\let\mmzNewCMemo\gobble |
| 389 |
\let\mmzNewCCMemo\gobble |
| 390 |
\def\mmzNewExtern##1##2##3##4{}% |
| 391 |
\let\mmzUsedCMemo\gobble |
| 392 |
\let\mmzUsedCCMemo\gobble |
| 393 |
\let\mmzUsedExtern\gobble |
| 394 |
} |
| 395 |
|
| 396 |
\usepackage{xstring} |
| 397 |
\usepackage{placeins} |
| 398 |
|
| 399 |
\usepackage{pifont} |
| 400 |
\newcommand\yes{{\small\ding{51}}} % pifont |
| 401 |
\newcommand\no{{\small\ding{55}}} % pifont |
| 402 |
|
| 403 |
\definecolor{Option}{rgb}{0.118,0.546,0.222} |
| 404 |
\definecolor{Definition}{rgb}{0.784,0.06,0.176} |
| 405 |
\definecolor{ExampleFrame}{rgb}{0.628,0.705,0.942} |
| 406 |
\definecolor{ExampleBack}{rgb}{0.963,0.971,0.994} |
| 407 |
\definecolor{Hyperlink}{rgb}{0.281,0.275,0.485} |
| 408 |
\definecolor{Fade}{rgb}{0.5,0.5,0.5} |
| 409 |
\definecolor{EasyDefinition}{rgb}{0.06,0.784,0.176} |
| 410 |
|
| 411 |
{\catcode`\|=\z@ \catcode`\\=12 |
| 412 |
|gdef|bslash{\}} |
| 413 |
\DeclareRobustCommand\cs[1]{\texttt{\bslash\detokenize{#1}}}% |
| 414 |
\DeclareRobustCommand\env[1]{\texttt{#1}}% |
| 415 |
%\def\marg#1{{\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} |
| 416 |
\def\marg#1{\hskip 0pt plus 1pt{\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} |
| 417 |
\def\oarg#1{\hskip 0pt plus 1pt{\ttfamily[}\meta{#1}{\ttfamily]}} |
| 418 |
\def\bracestt#1{\hskip 0pt plus 1pt{\ttfamily\char`\{#1\char`\}}} |
| 419 |
\def\braces#1{\hskip 0pt plus 1pt{\ttfamily\char`\{}#1{\ttfamily\char`\}}} |
| 420 |
\def\bracketstt#1{\hskip 0pt plus 1pt{\ttfamily[#1]}} |
| 421 |
\def\brackets#1{\hskip 0pt plus 1pt{\ttfamily[}#1{\ttfamily]}} |
| 422 |
\DeclareRobustCommand\meta[1]{% |
| 423 |
\ensuremath\langle |
| 424 |
\ifmmode \expandafter \nfss@text \fi |
| 425 |
{% |
| 426 |
\meta@font@select |
| 427 |
\edef\meta@hyphen@restore{\hyphenchar\the\font\the\hyphenchar\font}% |
| 428 |
\hyphenchar\font\m@ne |
| 429 |
\language\l@nohyphenation |
| 430 |
#1\/% |
| 431 |
\meta@hyphen@restore |
| 432 |
}% |
| 433 |
\ensuremath\rangle |
| 434 |
} |
| 435 |
\def\meta@font@select{\rm\itshape} |
| 436 |
\DeclareRobustCommand\metabf[1]{% |
| 437 |
\begingroup |
| 438 |
\def\meta@font@select{\rm\itshape\bfseries}% |
| 439 |
\meta{#1}% |
| 440 |
\endgroup |
| 441 |
} |
| 442 |
{\catcode`\%=12 \gdef\percentchar{%}} |
| 443 |
\def\coloredpercentchar{\hbox{\textcolor{purple}{\percentchar}}} |
| 444 |
\newcommand\alt{\ensuremath{\vert}}% without space around, unlike \Alt |
| 445 |
\newcommand\code[1]{\texttt{\spaceskip 0.5em plus 0.2em minus 0.2em #1}} |
| 446 |
\newcommand\Arg[1]{\texttt{\##1}} |
| 447 |
|
| 448 |
\NewDocumentCommand{\TikZ}{s}{% |
| 449 |
\IfBooleanF{#1}{\href{https://ctan.org/pkg/pgf}}{{\upshape Ti\textit{k}Z}}\xspace |
| 450 |
} |
| 451 |
\def\PGF{\href{https://ctan.org/pkg/pgf}{PGF}\xspace} |
| 452 |
\def\Emacs{\href{https://www.gnu.org/software/emacs}{Emacs}\xspace} |
| 453 |
\def\AucTeX{\href{https://www.gnu.org/software/auctex}{AUC\hologo{TeX}}\xspace} |
| 454 |
|
| 455 |
% collargs reference, pi = programmer's interface |
| 456 |
% Shrink the glyphs in the footnote if necessary. |
| 457 |
\tcbset{ |
| 458 |
pi/.style={ |
| 459 |
overlay={% |
| 460 |
\node at (frame.north east) [anchor=north west, inner sep=0] {\footnotemark}; |
| 461 |
}, |
| 462 |
after app={% |
| 463 |
\footnotetext{% |
| 464 |
% \adjustspacing=2 % already 2 ... microtype? |
| 465 |
\myfontexpansionon |
| 466 |
\yadocset{before/.code={\cspreto{yadoc@name@prefix}{\myfontexpansionon}}}% |
| 467 |
\mbox{The programmer's interface:} #1.% |
| 468 |
}% |
| 469 |
}, |
| 470 |
}, |
| 471 |
} |
| 472 |
\DeclareRobustCommand\myfontexpansionon{% |
| 473 |
\directlua{font.setexpansion(font.current(),50,50,1)}% |
| 474 |
} |
| 475 |
\DeclareRobustCommand\myfontexpansionoff{% |
| 476 |
\directlua{font.setexpansion(font.current(),0,0,1)}% |
| 477 |
} |
| 478 |
|
| 479 |
\AtBeginDocument{% |
| 480 |
\setbox0=\hbox{% |
| 481 |
\footnotesize\ttfamily |
| 482 |
\directlua{ninettfont=font.current()}% |
| 483 |
}% |
| 484 |
} |
| 485 |
|
| 486 |
% \AtBeginDocument{% |
| 487 |
% \setbox0=\hbox{% |
| 488 |
% \footnotesize\ttfamily |
| 489 |
% \global\expandafter\let\expandafter\fnttfont\font@name |
| 490 |
% %\expandglyphsinfont\fnttfont 30 500 1 autoexpand |
| 491 |
% }% |
| 492 |
% } |
| 493 |
|
| 494 |
\usepackage{yadoc} |
| 495 |
\newif\ifyadoc@short |
| 496 |
\newif\ifyadoc@long |
| 497 |
\yadocset{ |
| 498 |
name color=Definition, |
| 499 |
before body=\parskip 0.3\baselineskip plus 2pt, |
| 500 |
% after body=\medskip, |
| 501 |
head/.style={ |
| 502 |
interior style={fill, left color=red!5,right color=red!5!black!2}, |
| 503 |
}, |
| 504 |
easy/.style={ |
| 505 |
name color=green!50!black, |
| 506 |
head/.style={ |
| 507 |
interior style={fill, left color=green!5,right color=black!5}, |
| 508 |
}, |
| 509 |
}, |
| 510 |
keypath color opacity=30, |
| 511 |
index encapsulator={`}, |
| 512 |
index annotation font=\color{gray}, |
| 513 |
def options/.append style={index page number format=colorhyperpage{red}}, |
| 514 |
aux options/.append style={index page number format=colorhyperpage{red}}, |
| 515 |
ref options/.append style={index page number format=hyperpage}, |
| 516 |
par/.style={parameters={#1}}, |
| 517 |
desc/.style={description={#1}}, |
| 518 |
keypath=/mmz, |
| 519 |
xparse modifier item/.style={ |
| 520 |
index annotation=\texttt{xparse} modifier, |
| 521 |
label prefix=xparse, |
| 522 |
}, |
| 523 |
xparse type item/.style={ |
| 524 |
index annotation=\texttt{xparse} type, |
| 525 |
label prefix=xparse, |
| 526 |
}, |
| 527 |
script item/.style={ |
| 528 |
index annotation=script, |
| 529 |
label prefix=script, |
| 530 |
parameters prefix=\space, |
| 531 |
}, |
| 532 |
key path item/.style={ |
| 533 |
index annotation=keypath, |
| 534 |
label prefix:=keypath:/, |
| 535 |
name prefix=/, |
| 536 |
description=keypath, |
| 537 |
}, |
| 538 |
option item/.style={ |
| 539 |
name prefix={\ifdefempty\yadoc@short@name{}{-\yadoc@short@name\,\Alt\,}--}, |
| 540 |
ref prefix={\protect\ifyadoc@short-\yadoc@short@name\protect\else--}, |
| 541 |
ref suffix={\protect\fi}, |
| 542 |
index prefix={--}, |
| 543 |
index suffix={\ifdefempty\yadoc@short@name{}{\Alt-\yadoc@short@name}}, |
| 544 |
parameters prefix=\ , |
| 545 |
label prefix:={\yadoc@of--}, |
| 546 |
index annotation=option of {\docref[into index=false,link color=gray]{\yadoc@of}}, |
| 547 |
}, |
| 548 |
short name/.store in=\yadoc@short@name, |
| 549 |
short/.is if=yadoc@short, |
| 550 |
long/.is if=yadoc@long, |
| 551 |
conditional/.style={ |
| 552 |
parameters={\texttt{true}\Alt\texttt{false}}, |
| 553 |
/utils/exec={% |
| 554 |
\appto\yadoc@description{default \texttt{true}, initially \texttt{#1}}% |
| 555 |
}, |
| 556 |
}, |
| 557 |
conditional/.value required, |
| 558 |
package item/.style={ |
| 559 |
index annotation=package, |
| 560 |
label prefix=pkg, |
| 561 |
description=package, |
| 562 |
}, |
| 563 |
pkg/.style={ |
| 564 |
after/.style={index annotation/.append={\space of package \pkg{#1}}} |
| 565 |
}, |
| 566 |
hook item/.style={ |
| 567 |
label prefix=hook, |
| 568 |
index annotation=hook, |
| 569 |
}, |
| 570 |
pdfvariable item/.style={ |
| 571 |
label prefix=pdfvar, |
| 572 |
index annotation={\hologo{LuaTeX}'s \refcmd{pdfvariable} register}, |
| 573 |
}, |
| 574 |
pdfcmd item/.style={ |
| 575 |
label prefix=cmd, |
| 576 |
name prefix={% |
| 577 |
\textbackslash |
| 578 |
\protect\ifyadoc@short |
| 579 |
\protect\else |
| 580 |
\protect\ifyadoc@long |
| 581 |
pdf% |
| 582 |
\protect\else |
| 583 |
% todo: revert to the real original font rather than just say \rmfamily |
| 584 |
\rmfamily(\ttfamily pdf\rmfamily)\ttfamily |
| 585 |
\protect\fi |
| 586 |
\protect\fi |
| 587 |
}, |
| 588 |
index prefix=\textbackslash, |
| 589 |
}, |
| 590 |
} |
| 591 |
\def\colorhyperpage#1#2{% |
| 592 |
\begingroup |
| 593 |
\hypercolor{link}{#1}% |
| 594 |
\hyperpage{#2}% |
| 595 |
\endgroup |
| 596 |
} |
| 597 |
|
| 598 |
\patchcmd{\@setref}{??}{#3??}{}{} |
| 599 |
\patchcmd{\real@setref}{??}{#3??}{}{} |
| 600 |
|
| 601 |
\mmzset{ |
| 602 |
auto={tcb@manual@entry}{nomemoize}, |
| 603 |
auto={doc}{nomemoize}, |
| 604 |
} |
| 605 |
|
| 606 |
\DeclareRobustCommand\refkey[2][]{\docref[#1]{key:#2}} |
| 607 |
\DeclareRobustCommand\refmmz[2][]{\docref[#1]{key:/mmz/#2}} |
| 608 |
\DeclareRobustCommand\refmmzauto[2][]{\docref[#1]{key:/mmz/auto/#2}} |
| 609 |
\DeclareRobustCommand\refmmzpath[2][]{\docref[#1]{key:/mmz/path/#2}} |
| 610 |
\DeclareRobustCommand\refcollargs[2][]{\docref[#1]{key:/collargs/#2}} |
| 611 |
\DeclareRobustCommand\refenv[2][]{\docref[#1]{env:#2}} |
| 612 |
\DeclareRobustCommand\refcmd[2][]{\docref[#1]{cmd:#2}} |
| 613 |
\DeclareRobustCommand\reffile[2][]{\docref[#1]{file:#2}} |
| 614 |
\DeclareRobustCommand\refkeypath[2][]{\docref[#1]{keypath:#2}} |
| 615 |
\DeclareRobustCommand\refpkg[2][]{\docref[#1]{pkg:#2}} |
| 616 |
\DeclareRobustCommand\refscript[2][]{\docref[#1]{script:#2}} |
| 617 |
|
| 618 |
\usepackage{xspace} |
| 619 |
\newcommand\dmmz{\docref{file:mmz}\xspace} |
| 620 |
|
| 621 |
\newcommand\hreftt[2]{\href{#1}{\texttt{#2}}} |
| 622 |
|
| 623 |
\ifcsname ifregion\endcsname |
| 624 |
\ifregion{% |
| 625 |
\AddToHook{begindocument/before}{% |
| 626 |
\makeatletter |
| 627 |
\InputIfFileExists{memoize-doc.aux}{}{}% |
| 628 |
\makeatother |
| 629 |
}% |
| 630 |
\AddToHook{enddocument}{% |
| 631 |
\printindex |
| 632 |
}% |
| 633 |
} |
| 634 |
\fi |
| 635 |
|
| 636 |
\AddToHook{begindocument}{% |
| 637 |
\robustify\hyperref |
| 638 |
\robustify\hologo |
| 639 |
\robustify\Alt |
| 640 |
} |
| 641 |
|
| 642 |
\newcommand\noprint[1]{\setbox0=\hbox{#1}} |
| 643 |
\usepackage{wrapfig} |
| 644 |
|
| 645 |
\newcommand\footnoteagain[1]{% |
| 646 |
\def\@thefnmark{\ref{#1}}% |
| 647 |
\@footnotemark |
| 648 |
}% |
| 649 |
|
| 650 |
\usepackage{varioref} |
| 651 |
|
| 652 |
\NewDocumentCommand\TeXLive{o}{% |
| 653 |
{% |
| 654 |
\IfValueT{#1}{\hypercolor{url}{#1}}% |
| 655 |
\href{https://www.tug.org/texlive/}{\hologo{TeX}~Live}% |
| 656 |
}% |
| 657 |
\xspace |
| 658 |
} |
| 659 |
\NewDocumentCommand\MiKTeX{o}{% |
| 660 |
{% |
| 661 |
\IfValueT{#1}{\hypercolor{url}{#1}}% |
| 662 |
\href{https://miktex.org}{MiK\hologo{TeX}}% |
| 663 |
}% |
| 664 |
\xspace |
| 665 |
} |
| 666 |
|
| 667 |
% \usepackage{caption} |
| 668 |
% \captionsetup{labelformat=empty} |
| 669 |
|
| 670 |
% Local Variables: |
| 671 |
% TeX-master: "memoize-doc.tex" |
| 672 |
% TeX-engine: luatex |
| 673 |
% End: |