├── .gitignore ├── README.md └── duckuments.dtx /.gitignore: -------------------------------------------------------------------------------- 1 | *.aux 2 | *.glo 3 | *.hd 4 | *.idx 5 | *.log 6 | *.out 7 | *.pdf 8 | *.toc 9 | duckuments.sty 10 | example-image-duck.tex 11 | example-image-duck-portrait.tex 12 | test.tex 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### `duckuments`: minimal working duckuments ### 2 | 3 | 4 | This package may be distributed and/or modified under the conditions of the 5 | LaTeX Project Public License (LPPL), either version 1.3c of this license or (at 6 | your option) any later version. The latest version of this license is in the 7 | file 8 | 9 | https://www.latex-project.org/lppl.txt 10 | 11 | Copyright (C) 2018-2019 by Jonathan P. Spratte 12 | 13 | This package provides means to create duckified dummy contents. The following 14 | macros are available: 15 | 16 | - `\duckument[key=val]` - print a short duckument 17 | - `\blindduck[key=val]` - print a paragraph 18 | - `\ducklist(*){environment}` - create a list of type `environment` 19 | - `\ducklistlist(*){environment}` - create nested lists 20 | - `\duckitemize` - `\ducklist{itemize}` 21 | - `\duckenumerate` - `\ducklist{enumerate}` 22 | - `\duckdescription` - `\ducklist{description}` 23 | - `\duckumentsCreateExampleFile` 24 | - `\duckumentsDrawRandomDucks[count]` 25 | 26 | It also provides `example-image-duck.pdf` which contains several pages of random 27 | `tikzduck`s. Also `\includegraphics` is patched so one can use 28 | `\includegraphics{example-image-duck}` to in fact use a random duck out of 29 | `example-image-duck.pdf`. The behaviour of `\includegraphics` shouldn't be 30 | altered for other files. 31 | 32 | **Attention: 33 | At the moment, the package only works with pdfTeX, LuaTeX, and XeTeX.** 34 | -------------------------------------------------------------------------------- /duckuments.dtx: -------------------------------------------------------------------------------- 1 | % \iffalse meta-comment 2 | % 3 | % File: duckuments.dtx Copyright (C) 2018-2019 Jonathan P. Spratte 4 | % 5 | % It may be distributed and/or modified under the conditions of the LaTeX 6 | % Project Public License (LPPL), either version 1.3c of this license or (at your 7 | % option) any later version. The latest version of this license is in the file 8 | % 9 | % https://www.latex-project.org/lppl.txt 10 | % 11 | % ------------------------------------------------------------------------------ 12 | % 13 | %<*driver> 14 | \def\nameofplainTeX{plain} 15 | \ifx\fmtname\nameofplainTeX\else 16 | \expandafter\begingroup 17 | \fi 18 | \input l3docstrip.tex 19 | \askforoverwritefalse 20 | \preamble 21 | 22 | -------------------------------------------------------------- 23 | duckuments -- minimal working duckuments 24 | E-mail: jspratte@yahoo.de 25 | Released under the LaTeX Project Public License v1.3c or later 26 | See http://www.latex-project.org/lppl.txt 27 | -------------------------------------------------------------- 28 | 29 | Copyright (C) 2018-2019 Jonathan P. Spratte 30 | 31 | This work may be distributed and/or modified under the conditions of the 32 | LaTeX Project Public License (LPPL), either version 1.3c of this license or 33 | (at your option) any later version. The latest version of this license is in 34 | the file: 35 | 36 | http://www.latex-project.org/lppl.txt 37 | 38 | This work is "maintained" (as per LPPL maintenance status) by 39 | Jonathan P. Spratte. 40 | 41 | This work consists of the file duckuments.dtx 42 | and the derived files duckuments.pdf, 43 | duckuments.sty, 44 | example-image-duck.tex and 45 | example-image-duck-portrait.tex 46 | 47 | \endpreamble 48 | % stop docstrip adding \endinput 49 | \postamble 50 | \endpostamble 51 | \generate{\file{duckuments.sty}{\from{duckuments.dtx}{pkg}}} 52 | \generate{\file{example-image-duck.tex}{\from{duckuments.dtx}{eid}}} 53 | \generate{\file{example-image-duck-portrait.tex}{\from{duckuments.dtx}{eidp}}} 54 | \ifx\fmtname\nameofplainTeX 55 | \expandafter\endbatchfile 56 | \else 57 | \expandafter\endgroup 58 | \fi 59 | % 60 | % 61 | %<*driver|pkg> 62 | \def\duckuments@version{0.5} 63 | \def\duckuments@date{2019-10-03} 64 | % 65 | % 66 | %<*driver> 67 | \ProvidesFile{duckuments.dtx} 68 | [\csname duckuments@date\endcsname\space minimal working duckuments] 69 | \documentclass{l3doc} 70 | \usepackage{duckuments} 71 | \usepackage{enumitem} 72 | \newenvironment{options} 73 | {\begin{description}[style=nextline,font=\normalfont\ttfamily]} 74 | {\end{description}} 75 | \begin{document} 76 | \DocInput{duckuments.dtx} 77 | \end{document} 78 | % 79 | % 80 | %<*eid> 81 | \documentclass[tikz,multi]{standalone} 82 | 83 | \usepackage{tikzducks} 84 | \usepackage{duckuments} 85 | 86 | \begin{document} 87 | \duckumentsDrawRandomDucks 88 | \end{document} 89 | % 90 | % 91 | %<*eidp> 92 | \documentclass[tikz,multi]{standalone} 93 | 94 | \usepackage{tikzducks} 95 | \usepackage{duckuments} 96 | 97 | \begin{document} 98 | \duckumentsDrawRandomDucks* 99 | \end{document} 100 | % 101 | % 102 | %<*pkg> 103 | \ProvidesExplPackage 104 | {duckuments} {\duckuments@date} 105 | {\duckuments@version} {minimal working duckuments} 106 | % 107 | % \fi 108 | % 109 | % \title{The \pkg{duckuments} package} 110 | % \author{Jonathan P. Spratte\thanks{E-mail: jspratte@yahoo.de}} 111 | % \makeatletter 112 | % \date{version \duckuments@version, released \duckuments@date} 113 | % \makeatother 114 | % \maketitle 115 | % \tableofcontents 116 | % 117 | % \begin{documentation}^^A>>= 118 | % 119 | % \section{Introducktion}^^A>>= 120 | % 121 | % This package was inspired by the question 122 | % \href{https://tex.stackexchange.com/questions/419751} 123 | % {getting ducks in example images}. 124 | % It began on the idea to patch \cs{includegraphics} to automatically change its 125 | % behaviour if |example-image-duck| is used, but then it turned out to be a 126 | % simple alternative to the \pkg{blindtext} package. 127 | % 128 | % It is written as a docstrip file: executing |latex duckuments.dtx| generates 129 | % the \file{duckuments.sty}, \file{example-image-duck.tex}, and 130 | % \file{example-image-duck-portrait.tex} file and typesets this duckumentation; 131 | % execute |tex duckuments.dtx| to only generate the files \file{duckuments.sty}, 132 | % \file{example-image-duck.tex}, and \file{example-image-duck-portrait.tex}. 133 | % 134 | % For its functionality \file{example-image-duck.tex} and 135 | % \file{example-image-duck-portrait.tex} must be compiled at least once. The 136 | % sources are hosted on 137 | % \href{https://github.com/Skillmon/ltx_duckuments}{github}. 138 | % 139 | % \textbf{The package should support any engine.} However for engines other than 140 | % \pdfTeX, \LuaTeX, and \XeTeX\ it requires |extractbb| to be legal in a 141 | % shell-escape (which should normally be the case). 142 | %^^A=<< 143 | % 144 | % \section{Duckumentation}^^A>>= 145 | % 146 | % \subsection{Ducky content}^^A>>= 147 | % 148 | % \begin{function}{\duckument}^^A>>= 149 | % \begin{syntax} 150 | % \cs{duckument}\oarg{key=value} 151 | % \end{syntax} 152 | % Produces a duckument with one sectioning entry of each level starting at 153 | % \cs{chapter} (if available) and two variants of the list environment 154 | % \env{itemize}, \env{enumerate}, and \env{description}, one only at top 155 | % level and one with 4~environments nested. The \meta{key=value}s accept every 156 | % key as explained in \autoref{sec:keys}, but not every key has an effect. 157 | % \end{function}^^A=<< 158 | % 159 | % \begin{function}{\blindduck}^^A>>= 160 | % \begin{syntax} 161 | % \cs{blindduck}\oarg{key=value} 162 | % \end{syntax} 163 | % Produces one paragraph of dummy content. The \meta{key=value}s accept every 164 | % key as explained in \autoref{sec:keys}, but not every key has an effect. 165 | % \end{function}^^A=<< 166 | % 167 | % \begin{function}{\ducklist}^^A>>= 168 | % \begin{syntax} 169 | % \cs{ducklist}\meta{*}\marg{environment} 170 | % \end{syntax} 171 | % Sets a list of the specified \meta{environment}, if \meta{*} is given 172 | % \cs{item}\oarg{dummy} is used instead of only \cs{item}. For |description| 173 | % the starred version is used automatically. 174 | % \end{function}^^A=<< 175 | % 176 | % \begin{function}{\ducklistlist}^^A>>= 177 | % \begin{syntax} 178 | % \cs{ducklistlist}\meta{*}\marg{list} 179 | % \end{syntax} 180 | % Sets 4~levels of a nested list of the specified \meta{environment}, if 181 | % \meta{*} is given \cs{item}\oarg{dummy} is used instead of only \cs{item}. 182 | % For |description| the starred version is used automatically. 183 | % \end{function}^^A=<< 184 | % 185 | % \begin{function}{\duckitemize}^^A>>= 186 | % Abbreviation for \cs{ducklist}|{itemize}|. 187 | % \end{function}^^A=<< 188 | % 189 | % \begin{function}{\duckenumerate}^^A>>= 190 | % Abbreviation for \cs{ducklist}|{enumerate}|. 191 | % \end{function}^^A=<< 192 | % 193 | % \begin{function}{\duckdescription}^^A>>= 194 | % Abbreviation for \cs{ducklist}|{description}|. 195 | % \end{function}^^A=<< 196 | %^^A=<< 197 | % 198 | % \subsection{Other Macros}^^A>>= 199 | % 200 | % \begin{function}{\duckumentsCreateExampleFiles}^^A>>= 201 | % Creates the files \file{example-image-duck.tex} and 202 | % \file{example-image-duck-portrait.tex} in the current working directory. 203 | % \end{function}^^A=<< 204 | % 205 | % \begin{function}{\duckumentsDrawRandomDucks}^^A>>= 206 | % \begin{syntax} 207 | % \cs{duckumentsDrawRandomDucks}\meta{*}\oarg{count} 208 | % \end{syntax} 209 | % Draws \meta{count} random \pkg{tikzducks} using 210 | % \pkg{Ti\textit{k}Z}. \meta{count} defaults to \cs{duckuments@randoms}. 211 | % Note that \pkg{duckuments} doesn't load \pkg{Ti\textit{k}Z}, this macro is 212 | % for the use in \file{example-image-duck.tex} and 213 | % \file{example-image-duck-portrait.tex}. If the optional star is given, the 214 | % images will be drawn in portrait orientation else in landscape. 215 | % \end{function}^^A=<< 216 | %^^A=<< 217 | % 218 | % \subsection{Patches}^^A>>= 219 | % 220 | % The package patches \cs{includegraphics} if \pkg{graphicx} is loaded at the 221 | % time the patch is applied (see \autoref{sec:keys}, |immediate|). The patch 222 | % changes the behaviour if the used image file is \file{example-image-duck} or 223 | % \file{example-image-duck-portrait}. If that is the case, a random page of that 224 | % document is used. There shouldn't be any change in behaviour if other files 225 | % are used. 226 | % 227 | % The patch is done so that one can use \pkg{tikzducks} ducks without the need 228 | % of loading \pkg{tikz} in a minimal working duckument as example images. 229 | %^^A=<< 230 | % 231 | % \subsection{Options}\label{sec:keys}^^A>>= 232 | % 233 | % The package and commands which take a \oarg{key=value} accept the following 234 | % options. Some of which only make sense as package options. The 235 | % \textbf{\texttt{bold}} printed value is the one used if you don't specify a 236 | % value. The \textit{\texttt{italic}} printed value is the initial one. 237 | % \begin{options} 238 | % \item[toc=\textbf{true}$\vert$\textit{false}] 239 | % If |true| the \cs{duckument} contains a ToC. During package load time the 240 | % key doesn't throw errors but only warnings for values other than |true| 241 | % and |false|. This is done for compatibility reasons with classes which 242 | % take a non-boolean |toc| option (like those of KOMA-script). 243 | % \item[maths=\textbf{both}$\vert$inline$\vert$display$\vert$\textit{none}] 244 | % If |both| the \cs{blindduck} (which is also used by \cs{duckument}) 245 | % contains both inline and displayed math. With |inline| and |display| the 246 | % respective maths is activated. |none| disables both. 247 | % \item[full] 248 | % This typesets the full range of \cs{blindduck}. Don't use this as a 249 | % package option. 250 | % \item[all] 251 | % synonym for |full|. 252 | % \item[immediate=\textbf{true}$\vert$\textit{false}] 253 | % If |true| \cs{includegraphics} is patched during package load time, else 254 | % the patching is done \cs{AtBeginDocument}. 255 | % \end{options} 256 | % Additionally \cs{blindduck} and \cs{duckument} accept another key which must 257 | % match one of the following patterns and doesn't get any value. Patterns: 258 | % \bgroup 259 | % \def\num#1{\texttt{\meta{num#1}}}% 260 | % \begin{description}[style=nextline,font=\normalfont\ttfamily] 261 | % \item[\meta{num1}] The paragraph \num{1} is printed. 262 | % \item[\meta{num1-}] Like the above 263 | % \item[\meta{-num2}] The paragraphs up to \num{2} are printed. 264 | % \item[\meta{num1-num2}] The paragraphs from \num{1} up to \num{2} 265 | % are printed. 266 | % \item[\meta{-}] The next paragraph is printed. 267 | % \end{description} 268 | % If the used pattern includes a ``|-|'' a \cs{par} is used after each 269 | % paragraph. If any pattern is used the next pattern that doesn't include a 270 | % \num{1} starts with the paragraph after the last used paragraph, cycling back 271 | % to the first after the last available paragraph. 272 | % \egroup 273 | %^^A=<< 274 | %^^A=<< 275 | % 276 | % \end{documentation}^^A=<< 277 | % 278 | % \begin{implementation}^^A>>= 279 | % 280 | % \section{Implementation} 281 | % 282 | % \begin{macrocode} 283 | %<*pkg> 284 | % \end{macrocode} 285 | % 286 | % \begin{macrocode} 287 | %<@@=duckuments> 288 | % \end{macrocode} 289 | % 290 | % \subsection{Check for possible problems}^^A>>= 291 | % 292 | % Check whether \file{example-image-duck.pdf} exists. 293 | % \begin{macrocode}^^A>>= 294 | \file_if_exist:nF { example-image-duck.pdf } 295 | {%>>= 296 | % \end{macrocode} 297 | % If the current \cs{jobname} doesn't match \file{example-image-duck} throw an 298 | % error. 299 | % \begin{macrocode} 300 | \str_if_eq:VnF \c_sys_jobname_str { example-image-duck } 301 | { 302 | \msg_new:nnnn { duckuments } { missing~file } 303 | { 304 | The~file~`#1`~can't~be~found.~Make~sure~to~create~it 305 | \tl_if_empty:nF{#2}{~#2}. 306 | } 307 | { Sorry~for~the~inconvenience.~#3 } 308 | \msg_error:nnnnn { duckuments } { missing~file } 309 | { example-image-duck.pdf } 310 | { 311 | by~compiling~example-image-duck.tex~at~least~once 312 | } 313 | { 314 | If~you~don't~find~the~file~on~your~machine~you~can~use~ 315 | `\duckumentsCreateExampleFiles`~in~your~document~to~produce~a~copy~ 316 | in~the~current~working~directory. 317 | } 318 | } 319 | }%=<< 320 | % \end{macrocode}^^A=<< 321 | % And do the same for \file{example-image-duck-portrait.pdf}. 322 | % \begin{macrocode}^^A>>= 323 | \file_if_exist:nF { example-image-duck-portrait.pdf } 324 | {%>>= 325 | \str_if_eq:VnF \c_sys_jobname_str { example-image-duck-portrait } 326 | { 327 | \msg_if_exist:nnF { duckuments } { missing~file } 328 | { 329 | \msg_new:nnnn { duckuments } { missing~file } 330 | { 331 | The~file~`#1`~can't~be~found.~Make~sure~to~create~it 332 | \tl_if_empty:nF{#2}{~#2}. 333 | } 334 | { Sorry~for~the~inconvenience.~#3 } 335 | } 336 | \msg_error:nnnnn { duckuments } { missing~file } 337 | { example-image-duck-portrait.pdf } 338 | { 339 | by~compiling~example-image-duck-portrait.tex~at~least~once 340 | } 341 | { 342 | If~you~don't~find~the~file~on~your~machine~you~can~use~ 343 | `\duckumentsCreateExampleFiles`~in~your~document~to~produce~a~copy~ 344 | in~the~current~working~directory. 345 | } 346 | } 347 | }%=<< 348 | % \end{macrocode}^^A=<< 349 | %^^A=<< 350 | % 351 | % \subsection{Variables}^^A>>= 352 | % 353 | % \begin{variable}[internal]{\duckuments@randoms}^^A>>= 354 | % Stores the number of random ducks in \file{example-image-duck.pdf}. 355 | % \begin{macrocode} 356 | \newcommand*\duckuments@randoms{128} 357 | % \end{macrocode} 358 | % \end{variable}^^A=<< 359 | % 360 | % \begin{variable}{\l_@@_immediate_bool}^^A>>= 361 | % Stores whether the patch is to be done during package load time. 362 | % \begin{macrocode} 363 | \bool_new:N \l_@@_immediate_bool 364 | % \end{macrocode} 365 | % \end{variable}^^A=<< 366 | % 367 | % \begin{variable}{\l_@@_toc_bool}^^A>>= 368 | % Stores whether to display a ToC in \cs{duckument}. 369 | % \begin{macrocode} 370 | \bool_new:N \l_@@_toc_bool 371 | % \end{macrocode} 372 | % \end{variable}^^A=<< 373 | % 374 | % \begin{variable}{\l_@@_math_inline_bool}^^A>>= 375 | % Stores whether to display inline math in \cs{blindduck}. 376 | % \begin{macrocode} 377 | \bool_new:N \l_@@_math_inline_bool 378 | % \end{macrocode} 379 | % \end{variable}^^A=<< 380 | % 381 | % \begin{variable}{\l_@@_math_display_bool}^^A>>= 382 | % Stores whether to display displayed math in \cs{blindduck}. 383 | % \begin{macrocode} 384 | \bool_new:N \l_@@_math_display_bool 385 | % \end{macrocode} 386 | % \end{variable}^^A=<< 387 | % 388 | % \begin{variable}{\l_@@_blindduck_pars_bool}^^A>>= 389 | % Stores whether each paragraph of \cs{blindduck} should end with a \cs{par}. 390 | % \begin{macrocode} 391 | \bool_new:N \l_@@_blindduck_pars_bool 392 | % \end{macrocode} 393 | % \end{variable}^^A=<< 394 | % 395 | % \begin{variable}{\l_@@_range_seq}^^A>>= 396 | % Stores the paragraphs range for \cs{blindduck}. 397 | % \begin{macrocode} 398 | \seq_new:N \l_@@_range_seq 399 | % \end{macrocode} 400 | % \end{variable}^^A=<< 401 | % 402 | % \begin{variable}{\g_@@_blindduck_start_int}^^A>>= 403 | % Stores the paragraph with which \cs{blindduck} should start. 404 | % \begin{macrocode} 405 | \int_new:N \g_@@_blindduck_start_int 406 | \int_gset:Nn \g_@@_blindduck_start_int { \c_one_int } 407 | % \end{macrocode} 408 | % \end{variable}^^A=<< 409 | % 410 | % \begin{variable}{\g_@@_blindduck_end_int}^^A>>= 411 | % Stores the paragraph with which \cs{blindduck} should end. 412 | % \begin{macrocode} 413 | \int_new:N \g_@@_blindduck_end_int 414 | % \end{macrocode} 415 | % \end{variable}^^A=<< 416 | %^^A=<< 417 | % 418 | % \subsection{Constants}^^A>>= 419 | % 420 | % \begin{variable}{\c_@@_example_regex}^^A>>= 421 | % Regex against which the patch of \cs{includegraphics} is testing. 422 | % \begin{macrocode} 423 | \regex_const:Nn \c_@@_example_regex 424 | { 425 | example-image-duck 426 | |example-image-duck.pdf 427 | |example-image-duck-portrait 428 | |example-image-duck-portrait.pdf 429 | } 430 | % \end{macrocode} 431 | % \end{variable}^^A=<< 432 | % 433 | % \begin{variable}{\c_@@_range_regex}^^A>>= 434 | % Regex against which the optional range in \cs{blindduck} is checked. 435 | % \begin{macrocode} 436 | \regex_const:Nn \c_@@_range_regex { (\d+|\d+-|-\d+|\d+-\d+|-) } 437 | % \end{macrocode} 438 | % \end{variable}^^A=<< 439 | % 440 | % \begin{variable}{\c_@@_blindduck_pars_int}^^A>>= 441 | % \begin{macrocode} 442 | \int_const:Nn \c_@@_blindduck_pars_int { 6 } 443 | % \end{macrocode} 444 | % \end{variable}^^A=<< 445 | % 446 | % \begin{variable}{\c_@@_example_pages_int}^^A>>= 447 | % \begin{macro}{\@@_set_to_pdf_page_count:Nn} 448 | % Define a macro that gets the page count of a PDF (this is engine dependent): 449 | % \begin{macrocode} 450 | \sys_if_engine_pdftex:T 451 | { 452 | \cs_new_protected:Npn \@@_set_to_pdf_page_count:Nn #1 #2 453 | { 454 | \group_begin: 455 | \pdfximage { #2 } 456 | \exp_args:NNNo 457 | \group_end: 458 | \int_set:Nn #1 { \the \pdflastximagepages } 459 | } 460 | } 461 | \sys_if_engine_luatex:T 462 | { 463 | \cs_new_protected:Npn \@@_set_to_pdf_page_count:Nn #1 #2 464 | { 465 | \group_begin: 466 | \saveimageresource { #2 } 467 | \exp_args:NNNo 468 | \group_end: 469 | \int_set:Nn #1 { \lastsavedimageresourcepages } 470 | } 471 | } 472 | \sys_if_engine_xetex:T 473 | { 474 | \cs_new_protected:Npn \@@_set_to_pdf_page_count:Nn #1 #2 475 | { 476 | \int_set:Nn #1 { \XeTeXpdfpagecount " #2 " } 477 | } 478 | } 479 | \bool_lazy_any:nTF 480 | { 481 | { \sys_if_engine_luatex_p: } 482 | { \sys_if_engine_pdftex_p: } 483 | { \sys_if_engine_xetex_p: } 484 | } 485 | { \if_false: } 486 | { \if_true: } 487 | \group_begin: 488 | \char_set_catcode_other:N \% 489 | \cs_new_protected:Npn \@@_set_to_pdf_page_count:Nn #1 #2 490 | { 491 | \group_begin: 492 | \char_set_catcode_other:N \% 493 | \char_set_catcode_letter:N \: 494 | \char_set_catcode_ignore:n { 32 } 495 | \ior_shell_open:Nn \g_tmpa_ior { extractbb ~ -O ~ #2 } 496 | \ior_map_inline:Nn \g_tmpa_ior 497 | { 498 | \@@_set_to_pdf_page_count_aux_a:w ##1 %%Pages: \q_stop 499 | } 500 | \ior_close:N \g_tmpa_ior 501 | \exp_args:NNNo 502 | \group_end: 503 | \int_set:Nn #1 { \int_use:N \l_tmpa_int } 504 | } 505 | \cs_new_protected:Npn \@@_set_to_pdf_page_count_aux_a:w 506 | #1 %%Pages: #2 \q_stop 507 | { 508 | \tl_if_empty:nT { #1 } 509 | { \@@_set_to_pdf_page_count_aux_b:w #2 \q_stop } 510 | } 511 | \cs_new_protected:Npn \@@_set_to_pdf_page_count_aux_b:w 512 | #1 %%Pages: \q_stop 513 | { 514 | \int_set:Nn \l_tmpa_int { #1 } 515 | \ior_map_break: 516 | } 517 | \group_end: 518 | \fi: 519 | % \end{macrocode} 520 | % \end{macro} 521 | % Setting the constant: 522 | % \begin{macrocode} 523 | \bool_if:nTF 524 | { 525 | \str_if_eq_p:Vn \c_sys_jobname_str { example-image-duck } 526 | || \str_if_eq_p:Vn \c_sys_jobname_str { example-image-duck-portrait } 527 | } 528 | { \int_const:Nn \c_@@_example_pages_int { \c_one_int } } 529 | { 530 | \group_begin: 531 | \@@_set_to_pdf_page_count:Nn \l_tmpa_int 532 | { example-image-duck.pdf } 533 | \@@_set_to_pdf_page_count:Nn \l_tmpb_int 534 | { example-image-duck-portrait.pdf } 535 | \int_const:Nn \c_@@_example_pages_int 536 | { \int_min:nn { \l_tmpa_int } { \l_tmpb_int } } 537 | \group_end: 538 | } 539 | % \end{macrocode} 540 | % \end{variable}^^A=<< 541 | %^^A=<< 542 | % 543 | % \subsection{Messages}^^A>>= 544 | % 545 | % \begin{macrocode}^^A duckuments option~unknown >>= 546 | \tl_const:Nn \c_@@_msg_nothing_here_tl 547 | { 548 | \ ~_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \\ 549 | \ (Quack!~Nothing~here,~sorry.~Quack!)\\ 550 | \ ~""""""""""""""""""""""""""""""""""\\ 551 | \ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\string\ \\ 552 | \ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~>()_\\ 553 | \ \ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~(_ _ )_ _ 554 | } 555 | \msg_new:nnnn { duckuments } { option~unknown } 556 | { 557 | Unknown~option~'#1'~for~package~duckuments. 558 | } 559 | { \c_@@_msg_nothing_here_tl } 560 | % \end{macrocode}^^A=<< 561 | % \begin{macrocode}^^A duckuments non-boolean~toc >>= 562 | \msg_new:nnnn { duckuments } { non-boolean~toc } 563 | { 564 | A~non-boolean~value~`#1`~was~received~for~the~`toc`~option~during~package~ 565 | load~time.~It~is~assumed~this~was~given~to~\string\documentclass\ and~ 566 | therefore~ignored. 567 | } 568 | { \c_@@_msg_nothing_here_tl } 569 | % \end{macrocode}^^A=<< 570 | % \begin{macrocode}^^A duckuments out~of~range >>= 571 | \msg_new:nnnn { duckuments } { out~of~range } 572 | { 573 | You~requested~element~#3~out~of~the~range~#1~to~#2~of~array~'#4'.\\ 574 | I'll~just~use~element~#1~for~you. 575 | } 576 | { \c_@@_msg_nothing_here_tl } 577 | % \end{macrocode}^^A=<< 578 | %^^A=<< 579 | % 580 | % \subsection{Options and Configurations}^^A>>= 581 | % \begin{macrocode} 582 | \keys_define:nn { duckuments } 583 | {%>>= 584 | ,immediate .bool_set:N = \l_@@_immediate_bool 585 | ,immediate .default:n = true 586 | ,full .code:n = 587 | \@@_blindduck_range_test:n { 1-\c_@@_blindduck_pars_int } 588 | ,all .meta:n = { full } 589 | ,maths .choice: 590 | ,maths / both .code:n = 591 | { 592 | \bool_set_true:N \l_@@_math_inline_bool 593 | \bool_set_true:N \l_@@_math_display_bool 594 | } 595 | ,maths / display .code:n = \bool_set_true:N \l_@@_math_display_bool 596 | ,maths / inline .code:n = \bool_set_true:N \l_@@_math_inline_bool 597 | ,maths / none .code:n = 598 | { 599 | \bool_set_false:N \l_@@_math_inline_bool 600 | \bool_set_false:N \l_@@_math_display_bool 601 | } 602 | ,maths .default:n = both 603 | ,toc .code:n = 604 | { 605 | \str_case:nnF { #1 } 606 | { 607 | { true } { \bool_set_true:N \l_@@_toc_bool } 608 | { false } { \bool_set_false:N \l_@@_toc_bool } 609 | } 610 | { 611 | \msg_warning:nnn { duckuments } { non-boolean~toc } { #1 } 612 | } 613 | } 614 | ,toc .default:n = true 615 | ,unknown .code:n = 616 | { \msg_error:nnx { duckuments } { option~unknown } { \l_keys_key_str } } 617 | }%=<< 618 | \IfFormatAtLeastTF { 2022-06-01 } 619 | { \ProcessKeyOptions [ duckuments ] } 620 | { 621 | \RequirePackage { l3keys2e } 622 | \ProcessKeysOptions { duckuments } 623 | } 624 | \keys_define:nn { duckuments } 625 | {%>>= 626 | ,toc .undefine: 627 | ,toc .bool_set:N = \l_@@_toc_bool 628 | ,toc .default:n = true 629 | ,unknown .code:n = \@@_blindduck_range_test:V \l_keys_key_str 630 | }%=<< 631 | \bool_if:NTF \l_@@_immediate_bool 632 | { \AtEndOfPackage { \@@_patch_includegraphics: } } 633 | { \AtBeginDocument { \@@_patch_includegraphics: } } 634 | % \end{macrocode} 635 | %^^A=<< 636 | % 637 | % \subsection{Functions}^^A>>= 638 | % 639 | % \subsubsection{Duckument Level}^^A>>= 640 | % 641 | % \begin{macro}{\duckument}^^A>>= 642 | % \begin{macrocode} 643 | \NewDocumentCommand \duckument { O{} } 644 | {%>>= 645 | \group_begin: 646 | \keys_set:nn { duckuments } { #1 } 647 | \bool_if:NT \l_@@_toc_bool { \tableofcontents } 648 | \cs_if_exist_use:NT \chapter 649 | { {\duckuments@headings@text{0}} \blindduck } 650 | \duckuments@headings{1} \blindduck 651 | \duckuments@headings{2} \blindduck 652 | \duckuments@headings{3} \blindduck 653 | \duckuments@headings{4} \blindduck 654 | \section {Lists} 655 | \@@_list_example:n { itemize } 656 | \@@_list_example:n { enumerate } 657 | \@@_list_example:n { description } 658 | \group_end: 659 | }%=<< 660 | % \end{macrocode} 661 | % \end{macro}^^A=<< 662 | % 663 | % \begin{macro}{\blindduck}^^A>>= 664 | % \begin{macrocode} 665 | \NewDocumentCommand \blindduck { O{} } 666 | {%>>= 667 | \group_begin: 668 | \keys_set:nn { duckuments } { #1 } 669 | \duckuments@blindduck@text 670 | \bool_if:NT \l_@@_blindduck_pars_bool { \par } 671 | \group_end: 672 | }%=<< 673 | % \end{macrocode} 674 | % \end{macro}^^A=<< 675 | % 676 | % \begin{macro}{\ducklist}^^A>>= 677 | % \begin{macrocode} 678 | \NewDocumentCommand \ducklist {s m} 679 | {%>>= 680 | \begin{#2} 681 | \IfBooleanTF { #1 } 682 | {\ducklists@content@starred} 683 | { 684 | \str_if_eq:nnTF { #2 } { description } 685 | \ducklists@content@starred 686 | \ducklists@content 687 | } 688 | \end{#2} 689 | }%=<< 690 | % \end{macrocode} 691 | % \end{macro}^^A=<< 692 | % \begin{macro}{\ducklistlist}^^A>>= 693 | % \begin{macrocode} 694 | \NewDocumentCommand \ducklistlist { s m } 695 | {%>>= 696 | \IfBooleanTF { #1 } 697 | { \duckuments@listlist@starred { #2 } } 698 | { 699 | \str_if_eq:nnTF { #2 } { description } 700 | { \duckuments@listlist@starred { description } } 701 | { \duckuments@listlist{#2} } 702 | } 703 | }%=<< 704 | % \end{macrocode} 705 | % \end{macro}^^A=<< 706 | % 707 | % \begin{macro}{\duckenumerate}^^A>>= 708 | % \begin{macrocode} 709 | \newcommand*\duckenumerate{\ducklist{enumerate}} 710 | % \end{macrocode} 711 | % \end{macro}^^A=<< 712 | % \begin{macro}{\duckitemize}^^A>>= 713 | % \begin{macrocode} 714 | \newcommand*\duckitemize{\ducklist{itemize}} 715 | % \end{macrocode} 716 | % \end{macro}^^A=<< 717 | % \begin{macro}{\duckdescription}^^A>>= 718 | % \begin{macrocode} 719 | \newcommand*\duckdescription{\ducklist{description}} 720 | % \end{macrocode} 721 | % \end{macro}^^A=<< 722 | % 723 | % \begin{macro}{\duckumentsCreateExampleFiles}^^A>>= 724 | % Create example-image-duck.tex 725 | % \begin{macrocode} 726 | \newcommand*\duckumentsCreateExampleFiles 727 | {%>>= 728 | \iow_open:Nn \g_tmpa_iow { example-image-duck.tex } 729 | \iow_now:Nn \g_tmpa_iow 730 | { \documentclass[tikz,multi]{standalone} } 731 | \iow_now:Nn \g_tmpa_iow 732 | { \usepackage{tikzducks} } 733 | \iow_now:Nn \g_tmpa_iow 734 | { \usepackage{duckuments} } 735 | \iow_now:Nn \g_tmpa_iow 736 | { \begin{document} } 737 | \iow_now:Nn \g_tmpa_iow 738 | { \duckumentsDrawRandomDucks } 739 | \iow_now:Nn \g_tmpa_iow 740 | { \end{document} } 741 | \iow_close:N \g_tmpa_iow 742 | % \end{macrocode} 743 | % Create example-image-duck-portrait.tex 744 | % \begin{macrocode} 745 | \iow_open:Nn \g_tmpa_iow 746 | { example-image-duck-portrait.tex } 747 | \iow_now:Nn \g_tmpa_iow 748 | { \documentclass[tikz,multi]{standalone} } 749 | \iow_now:Nn \g_tmpa_iow 750 | { \usepackage{tikzducks} } 751 | \iow_now:Nn \g_tmpa_iow 752 | { \usepackage{duckuments} } 753 | \iow_now:Nn \g_tmpa_iow 754 | { \begin{document} } 755 | \iow_now:Nn \g_tmpa_iow 756 | { \duckumentsDrawRandomDucks* } 757 | \iow_now:Nn \g_tmpa_iow 758 | { \end{document} } 759 | \iow_close:N \g_tmpa_iow 760 | }%=<< 761 | % \end{macrocode} 762 | % \end{macro}^^A=<< 763 | % \begin{macro}{\duckumentsDrawRandomDucks}^^A>>= 764 | % \begin{macrocode} 765 | \newcommand*\duckumentsDrawRandomDucks 766 | {%>>= 767 | \@ifstar 768 | {\duckumentsDrawRandomDucks@portrait} 769 | {\duckumentsDrawRandomDucks@landscape}% 770 | }%=<< 771 | % \end{macrocode} 772 | % \end{macro}^^A=<< 773 | %^^A=<< 774 | % 775 | % \subsubsection{Intern}^^A>>= 776 | % 777 | % \begin{macro}[internal]{\duckuments@headings}^^A>>= 778 | % \begin{macrocode} 779 | \newcommand*\duckuments@headings[1] 780 | {%>>= 781 | \ifcase#1\relax 782 | \expandafter\chapter 783 | \or \expandafter\section 784 | \or \expandafter\subsection 785 | \or \expandafter\subsubsection 786 | \or \expandafter\paragraph 787 | \else \expandafter\@gobble 788 | \fi 789 | {\duckuments@headings@text{#1}} 790 | }%=<< 791 | % \end{macrocode} 792 | % \end{macro}^^A=<< 793 | % 794 | % \begin{macro}[internal]{\duckuments@headings@level}^^A>>= 795 | % \begin{macrocode} 796 | \newcommand*\duckuments@headings@level[1] 797 | {%>>= 798 | ( 799 | \ifcase#1 800 | chapter 801 | \or section 802 | \or subsection 803 | \or subsubsection 804 | \or paragraph 805 | \fi 806 | ) 807 | }%=<< 808 | % \end{macrocode} 809 | % \end{macro}^^A=<< 810 | % 811 | % \begin{macro}[internal]{\duckuments@ifinline}^^A>>= 812 | % \begin{macrocode} 813 | \newcommand*\duckuments@ifinline[2][] 814 | { \bool_if:NTF \l_@@_math_inline_bool { #2 } { #1 } } 815 | % \end{macrocode} 816 | % \end{macro}^^A=<< 817 | % 818 | % \begin{macro}[internal]{\duckuments@ifdisplay}^^A>>= 819 | % \begin{macrocode} 820 | \newcommand*\duckuments@ifdisplay[2][] 821 | { \bool_if:NTF \l_@@_math_display_bool { #2 } { #1 } } 822 | % \end{macrocode} 823 | % \end{macro}^^A=<< 824 | % 825 | % \begin{macro}{\@@_list_example:n}^^A>>= 826 | % \begin{macrocode} 827 | \cs_new_protected_nopar:Npn \@@_list_example:n #1 828 | {%>>= 829 | \subsection{Example\ for\ ducks\ (#1)} 830 | \ducklist { #1 } 831 | \subsubsection{Nested\ ducks} 832 | \ducklistlist { #1 } 833 | }%=<< 834 | % \end{macrocode} 835 | % \end{macro}^^A=<< 836 | % 837 | % \begin{macro}[internal]{\duckuments@enquote}^^A>>= 838 | % \begin{macrocode} 839 | \NewDocumentCommand \duckuments@enquote { s +m } 840 | {%>>= 841 | \IfBooleanTF { #1 } 842 | { 843 | \cs_if_exist_use:NTF 844 | \enquote { * { #2 } } 845 | { `#2' } 846 | } 847 | { 848 | \cs_if_exist_use:NTF 849 | \enquote { { #2 } } 850 | {``#2''} 851 | } 852 | }%=<< 853 | % \end{macrocode} 854 | % \end{macro}^^A=<< 855 | % 856 | % \begin{macro}[internal]{\duckumentsDrawRandomDucks@landscape}^^A>>= 857 | % \begin{macrocode} 858 | \newcommand*\duckumentsDrawRandomDucks@landscape[1][\duckuments@randoms] 859 | {%>>= 860 | \foreach\x in {1,2,...,#1} 861 | {\duckumentsDrawRandomDucks@draw{6.47214}{4}{3.23607}{2}} 862 | }%=<< 863 | % \end{macrocode} 864 | % \end{macro}^^A=<< 865 | % 866 | % \begin{macro}[internal]{\duckumentsDrawRandomDucks@portrait}^^A>>= 867 | % \begin{macrocode} 868 | \newcommand*\duckumentsDrawRandomDucks@portrait[1][\duckuments@randoms] 869 | {%>>= 870 | \foreach\x in {1,2,...,#1} 871 | {\duckumentsDrawRandomDucks@draw{1.8541}{3}{.92705}{1.5}} 872 | }%=<< 873 | % \end{macrocode} 874 | % \end{macro}^^A=<< 875 | % 876 | % \begin{macro}[internal]{\duckumentsDrawRandomDucks@draw}^^A>>= 877 | % \begin{macrocode} 878 | \newcommand*\duckumentsDrawRandomDucks@draw[4] 879 | {%>>= 880 | \begin{tikzpicture} 881 | \draw[fill=gray!50,use~as~bounding~box] (0,0) rectangle (#1,#2); 882 | \draw[gray,thin] (0,0) -- (#1,#2); 883 | \draw[gray,thin] (0,#2) -- (#1,0); 884 | \draw[gray,thin] (#3,0) -- (#3,#2); 885 | \draw[gray,thin] (0,#4) -- (#1,#4); 886 | \node at (#3,#4) {\tikz\randuck;}; 887 | \draw[black] (0,0) rectangle (#1,#2); 888 | \end{tikzpicture} 889 | }%=<< 890 | % \end{macrocode} 891 | % \end{macro}^^A=<< 892 | % 893 | % \begin{macro}{\@@_patch_includegraphics:}^^A>>= 894 | % \begin{macrocode} 895 | \cs_new_protected_nopar:Npn \@@_patch_includegraphics: 896 | {%>>= 897 | \@ifpackageloaded { graphicx } 898 | { 899 | \NewCommandCopy\duckuments@includegraphicsBAK\includegraphics 900 | \RenewDocumentCommand \includegraphics 901 | { >{\@@_starred:n}s O{} o m } 902 | { 903 | \IfValueTF { ##3 } 904 | { \duckuments@includegraphicsBAK##1[{##2}][{##3}]{##4} } 905 | { 906 | \regex_if_match:NnTF \c_@@_example_regex { ##4 } 907 | { 908 | \duckuments@includegraphicsBAK##1 909 | [{page=\@@_random_page:,##2}] 910 | { ##4 } 911 | } 912 | { 913 | \duckuments@includegraphicsBAK##1[{##2}]{##4} 914 | } 915 | } 916 | } 917 | } 918 | {} 919 | }%=<< 920 | % \end{macrocode} 921 | % \end{macro}^^A=<< 922 | % 923 | % \begin{macro}{\@@_blindduck_range_test:n}^^A>>= 924 | % \begin{macrocode} 925 | \cs_new_protected:Npn \@@_blindduck_range_test:n #1 926 | {%>>= 927 | \regex_if_match:NnTF \c_@@_range_regex { #1 } 928 | { 929 | \seq_set_split:Nnn \l_@@_range_seq { - } { #1 } 930 | \int_compare:nNnTF 931 | { \c_one_int } = { \seq_count:N \l_@@_range_seq } 932 | { 933 | \cs_set:Npn \duckuments@blindduck@text 934 | { 935 | \@@_blindduck_single_par:n { #1 } 936 | \@@_blindduck_set_next_start:n { #1 } 937 | } 938 | } 939 | { 940 | \bool_set_true:N \l_@@_blindduck_pars_bool 941 | \exp_args:Nx 942 | \tl_if_empty:nF 943 | { \seq_item:Nn \l_@@_range_seq { \c_one_int } } 944 | { 945 | \int_gset:Nn \g_@@_blindduck_start_int 946 | { \seq_item:Nn \l_@@_range_seq { \c_one_int } } 947 | } 948 | \exp_args:Nx 949 | \tl_if_empty:nTF { \seq_item:Nn \l_@@_range_seq { 2 } } 950 | { 951 | \int_gset_eq:NN 952 | \g_@@_blindduck_end_int 953 | \g_@@_blindduck_start_int 954 | } 955 | { 956 | \int_set:Nn \g_@@_blindduck_end_int 957 | { \seq_item:Nn \l_@@_range_seq { 2 } } 958 | } 959 | \@@_blindduck_set_text:VV 960 | \g_@@_blindduck_start_int \g_@@_blindduck_end_int 961 | } 962 | } 963 | { 964 | \exp_args:NnnV 965 | \msg_error:nnn { duckuments } { option~unknown } \l_keys_key_str 966 | } 967 | }%=<< 968 | \cs_generate_variant:Nn \@@_blindduck_range_test:n { V } 969 | % \end{macrocode} 970 | % \end{macro}^^A=<< 971 | % 972 | % \begin{macro}{\@@_blindduck_set_text:nn}^^A>>= 973 | % \begin{macrocode} 974 | \cs_new:Npn \@@_blindduck_set_text:nn #1 #2 975 | {%>>= 976 | \def \duckuments@blindduck@text 977 | { 978 | \int_step_function:nnnN { #1 } { \c_one_int } { #2 } 979 | \@@_blindduck_par_loop:n 980 | \@@_blindduck_set_next_start:n { #2 } 981 | } 982 | }%=<< 983 | \cs_generate_variant:Nn \@@_blindduck_set_text:nn { VV } 984 | % \end{macrocode} 985 | % \end{macro}^^A=<< 986 | % 987 | % \begin{macro}{\@@_blindduck_set_next_start:n}^^A>>= 988 | % \begin{macrocode} 989 | \cs_new:Npn \@@_blindduck_set_next_start:n #1 990 | {%>>= 991 | \int_gset:Nn \g_@@_blindduck_start_int 992 | { \int_mod:nn { #1 } { \c_@@_blindduck_pars_int } + \c_one_int } 993 | }%=<< 994 | % \end{macrocode} 995 | % \end{macro}^^A=<< 996 | % 997 | % \begin{macro}{\@@_blindduck_single_par:n}^^A>>= 998 | % \begin{macrocode} 999 | \cs_new:Npn \@@_blindduck_single_par:n #1 1000 | {%>>= 1001 | \bool_if:nTF 1002 | { 1003 | \int_compare_p:nNn { #1 } > { \c_@@_blindduck_pars_int } 1004 | || \int_compare_p:nNn { #1 } < { \c_one_int } 1005 | } 1006 | { 1007 | \msg_error:nnxxxx { duckuments } { out~of~range } 1008 | { 1 } { \int_use:N \c_@@_blindduck_pars_int } { #1 } 1009 | { blindduck~paragraphs } 1010 | \duckuments@blindduck@text@i 1011 | } 1012 | { 1013 | \use:c { duckuments@blindduck@text@ \int_to_roman:n { #1 } } 1014 | } 1015 | }%=<< 1016 | % \end{macrocode} 1017 | % \end{macro}^^A=<< 1018 | % 1019 | % \begin{macro}{\@@_blindduck_par_loop:n}^^A>>= 1020 | % \begin{macrocode} 1021 | \cs_new:Npn \@@_blindduck_par_loop:n #1 1022 | {%>>= 1023 | \@@_blindduck_single_par:n { #1 } 1024 | \par 1025 | }%=<< 1026 | % \end{macrocode} 1027 | % \end{macro}^^A=<< 1028 | % 1029 | % \begin{macro}{\@@_starred:n}^^A>>= 1030 | % \begin{macrocode} 1031 | \cs_new_protected:Npn \@@_starred:n #1 1032 | {%>>= 1033 | \IfBooleanTF { #1 } 1034 | { \def\ProcessedArgument{*} } 1035 | { \def\ProcessedArgument{} } 1036 | }%=<< 1037 | % \end{macrocode} 1038 | % \end{macro}^^A=<< 1039 | % 1040 | % \begin{macro}{\@@_random_page:}^^A>>= 1041 | % \begin{macrocode} 1042 | \cs_new:Npn \@@_random_page: 1043 | { \int_rand:n { \c_@@_example_pages_int } } 1044 | % \end{macrocode} 1045 | % \end{macro}^^A=<< 1046 | % 1047 | % \begin{macrocode} 1048 | \ExplSyntaxOff 1049 | % \end{macrocode} 1050 | % 1051 | % \begin{macro}[internal]{\duckuments@blindduck@text}^^A>>= 1052 | % \begin{macrocode} 1053 | \newcommand*\duckuments@blindduck@text{\duckuments@blindduck@text@i} 1054 | \newcommand*\duckuments@blindduck@text@i 1055 | {%>>= 1056 | There once was a very smart but sadly blind duck. When it was still a small 1057 | duckling it was renowned for its good vision. But sadly as the duck grew 1058 | older it caught a sickness which caused its eyesight to worsen. It became so 1059 | bad, that the duck couldn't read the notes it once took containing much of 1060 | inline math\duckuments@ifinline{ just like its favoured equation: $d = u_c 1061 | \cdot k$}. Only displayed equations remained legible% 1062 | \duckuments@ifdisplay[.]{ so it could still read \begin{equation}d = r a^k 1063 | e\hbox{.}\end{equation}} That annoyed the smart duck, as it wasn't able to 1064 | do its research any longer. It called for its underduckling and said: 1065 | \duckuments@enquote{Go, find me the best eye ducktor there is. He shall 1066 | heal me from my disease!}% 1067 | }%=<< 1068 | \newcommand*\duckuments@blindduck@text@ii 1069 | {%>>= 1070 | \duckuments@enquote{But my duck, how are you supposed to manage your daily 1071 | routines without my visual guidance}, replied the underduckling. The smart 1072 | duck's face turned grim in anger. \duckuments@enquote{You dare to talk 1073 | back?} The underduckling blushed ashamed. How could he have objections 1074 | after his duck gave strict orders? The underduckling was so embarrassed 1075 | about his own behaviour he had to solve an equation.% 1076 | }%=<< 1077 | \newcommand*\duckuments@blindduck@text@iii 1078 | {%>>= 1079 | After the equation was solved and the underduckling prepared his leave for 1080 | the next day it fell asleep in a shaky mood. It did not know what the 1081 | journey had prepared for him and if he was prepared enough for it. His sleep 1082 | was restless. The dreams he had that night were not calm and bright as they 1083 | used to be for an innocent underduckling.% 1084 | }%=<< 1085 | \newcommand*\duckuments@blindduck@text@iv 1086 | {%>>= 1087 | Before dawn the underduckling woke. He didn't have the feeling of being well 1088 | rested. But nonetheless he knew that this was the day he should leave. 1089 | Except saying goodbye to his beloved ones there was nothing holding him 1090 | back. His duck had sent him on the most important mission a five weeks old 1091 | inexperienced underduckling was ever sent on. He bid farewell to his mother, 1092 | all his brothers and sisters, and finally from his duck. The bag was 1093 | shouldered, the boots were tied, the underduckling left.% 1094 | }%=<< 1095 | \newcommand*\duckuments@blindduck@text@v 1096 | {%>>= 1097 | As the underduckling went along he saw a tree. It was so tall he couldn't 1098 | even approximate its height. But then he luckily remembered one equation of 1099 | the intercept theorems his duck taught him\duckuments@ifdisplay[.]{: 1100 | \begin{equation}\frac{l_1}{l_2}=\frac{h_1}{h_2}\end{equation}% 1101 | } 1102 | With this he had a good way to determine the tree to be more than 200~times 1103 | bigger than he was. Oh, how small he felt. What should he, a small duckling 1104 | whose plumage was still fluffy, achieve in this vast, gigantic world? He 1105 | stuck his trembling wings under the straps of his backpack to calm his 1106 | shaking limbs. Where should he start his search? How should he survive in 1107 | the hostile nature surrounding the sheltered pond of his community? 1108 | }%=<< 1109 | \newcommand*\duckuments@blindduck@text@vi 1110 | {%>>= 1111 | Talking reassuringly to himself the underduckling walked on. He knew to be 1112 | too noisy was dangerous, as predators might hear him and track him down. But 1113 | it couldn't be helped. Continuously muttering things like 1114 | \duckuments@enquote{It's all going to end well.} or 1115 | \duckuments@enquote{It'll only take a couple of days, next week I'll be home 1116 | again.} he placed one foot in front of the other. And when nothing bad had 1117 | happened for the next half an hour or so his voice became quieter and lower 1118 | and eventually he was able to hike silently. 1119 | }%=<< 1120 | % \end{macrocode} 1121 | % \end{macro}^^A=<< 1122 | % 1123 | % \begin{macro}[internal]{\duckuments@headings@text}^^A>>= 1124 | % \begin{macrocode} 1125 | \newcommand*\duckuments@headings@text[1] 1126 | {A friendly duck at level #1 \duckuments@headings@level{#1}} 1127 | % \end{macrocode} 1128 | % \end{macro}^^A=<< 1129 | % 1130 | % \begin{macro}[internal]{\ducklists@content}^^A>>= 1131 | % \begin{macrocode} 1132 | \newcommand*\ducklists@content 1133 | {%>>= 1134 | \item First swims father drake 1135 | \item Then floats mother duck 1136 | \item After her paddles baby duckling 1137 | \item And over there bathes uncle canard 1138 | }%=<< 1139 | % \end{macrocode} 1140 | % \end{macro}^^A=<< 1141 | % 1142 | % \begin{macro}[internal]{\ducklists@content@starred}^^A>>= 1143 | % \begin{macrocode} 1144 | \newcommand*\ducklists@content@starred 1145 | {%>>= 1146 | \item[drake] is the swimming father 1147 | \item[duck] is the floating mother 1148 | \item[duckling] is the paddling baby 1149 | \item[canard] is the bathing uncle 1150 | }%=<< 1151 | % \end{macrocode} 1152 | % \end{macro}^^A=<< 1153 | % 1154 | % \begin{macro}[internal]{\duckuments@listlist}^^A>>= 1155 | % \begin{macrocode} 1156 | \newcommand*\duckuments@listlist[1] 1157 | {%>>= 1158 | \begin{#1} 1159 | \item swimming father drake 1160 | \begin{#1} 1161 | \item swimming father drake 1162 | \begin{#1} 1163 | \item swimming father drake 1164 | \begin{#1} 1165 | \item swimming father drake 1166 | \item floating mother duck 1167 | \end{#1} 1168 | \item floating mother duck 1169 | \end{#1} 1170 | \item floating mother duck 1171 | \end{#1} 1172 | \item floating mother duck 1173 | \end{#1}% 1174 | }%=<< 1175 | % \end{macrocode} 1176 | % \end{macro}^^A=<< 1177 | % 1178 | % \begin{macro}[internal]{\duckuments@listlist@starred}^^A>>= 1179 | % \begin{macrocode} 1180 | \newcommand*\duckuments@listlist@starred[1] 1181 | {%>>= 1182 | \begin{#1} 1183 | \item[drake] is the swimming father 1184 | \begin{#1} 1185 | \item[drake] is the swimming father 1186 | \begin{#1} 1187 | \item[drake] is the swimming father 1188 | \begin{#1} 1189 | \item[drake] is the swimming father 1190 | \item[duck] is the floating mother 1191 | \end{#1} 1192 | \item[duck] is the floating mother 1193 | \end{#1} 1194 | \item[duck] is the floating mother 1195 | \end{#1} 1196 | \item[duck] is the floating mother 1197 | \end{#1}% 1198 | }%=<< 1199 | % \end{macrocode} 1200 | % \end{macro}^^A=<< 1201 | %^^A=<< 1202 | %^^A=<< 1203 | % 1204 | % \begin{macrocode} 1205 | \endinput 1206 | % \end{macrocode} 1207 | % 1208 | % \end{implementation}^^A=<< 1209 | % 1210 | % \begin{macrocode} 1211 | % 1212 | % \end{macrocode} 1213 | % 1214 | % \clearpage 1215 | % \section{The story of the duck}^^A>>= 1216 | % 1217 | % \begingroup 1218 | % \ExplSyntaxOn 1219 | % \newcount\duckuments_count_for_duckumentation_only 1220 | % \cs_set:Nn \__duckuments_blindduck_par_loop:n 1221 | % {^^A>>= 1222 | % \advance\duckuments_count_for_duckumentation_only1 1223 | % \llap 1224 | % { 1225 | % \group_begin: 1226 | % \color_select:nn { gray } { 0.5 } 1227 | % \rlap 1228 | % { 1229 | % \smash 1230 | % { 1231 | % \parbox[t]{2cm} 1232 | % { 1233 | % \scriptsize\raggedright 1234 | % paragraph~\the\duckuments_count_for_duckumentation_only 1235 | % } 1236 | % } 1237 | % } 1238 | % \hspace{\dimexpr\marginparsep+2cm\relax} 1239 | % \group_end: 1240 | % } 1241 | % \vspace{-\baselineskip} 1242 | % \__duckuments_blindduck_single_par:n { #1 } 1243 | % \par 1244 | % }^^A=<< 1245 | % \ExplSyntaxOff 1246 | % \blindduck[full] 1247 | % \endgroup^^A=<< 1248 | % 1249 | % 1250 | ^^A vim: fdm=marker foldmarker=>>=,=<< 1251 | --------------------------------------------------------------------------------