-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathducksay.dtx
2838 lines (2828 loc) · 93.4 KB
/
ducksay.dtx
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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% \iffalse meta-comment
%
% File: ducksay.dtx Copyright (C) 2017-2024 Jonathan P. Spratte
%
% This work may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this license or
% (at your option) any later version. The latest version of this license is in
% the file:
%
% http://www.latex-project.org/lppl.txt
%
% ------------------------------------------------------------------------------
%
%<*driver>^^A>>=
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
\expandafter\begingroup
\fi
\input l3docstrip.tex
\askforoverwritefalse
\preamble
--------------------------------------------------------------
ducksay -- cowsay for LaTeX
E-mail: jspratte@yahoo.de
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
--------------------------------------------------------------
Copyright (C) 2017-2024 Jonathan P. Spratte
This work may be distributed and/or modified under the conditions of the
LaTeX Project Public License (LPPL), either version 1.3c of this license or
(at your option) any later version. The latest version of this license is in
the file:
http://www.latex-project.org/lppl.txt
This work is "maintained" (as per LPPL maintenance status) by
Jonathan P. Spratte.
This work consists of the file ducksay.dtx
and the derived files ducksay.pdf
ducksay.sty
ducksay.code.v1.tex
ducksay.code.v2.tex and
ducksay.animals.tex.
\endpreamble
% stop docstrip adding \endinput
\postamble
\endpostamble
\generate{\file{ducksay.sty}{\from{ducksay.dtx}{pkg}}}
\generate{\file{ducksay.code.v1.tex}{\from{ducksay.dtx}{code.v1}}}
\generate{\file{ducksay.code.v2.tex}{\from{ducksay.dtx}{code.v2}}}
\generate{\file{ducksay.animals.tex}{\from{ducksay.dtx}{animals}}}
\ifx\fmtname\nameofplainTeX
\expandafter\endbatchfile
\else
\expandafter\endgroup
\fi
%
\ProvidesFile{ducksay.dtx}
[\csname ducksay@date\endcsname\ cowsay for LaTeX]
\documentclass{l3doc}
% silence the false positives about internal control sequences in the animals
\csname msg_redirect_name:nnn\endcsname{l3doc}{foreign-internal}{none}
\usepackage[version=2]{ducksay}
\usepackage{marginnote}
\newcommand\sinceversion[1]
{\marginnote{\footnotesize\textsf{v#1}\kern-\marginparsep}}
\let\metaORIG\meta
\protected\def\meta #1{\texttt{\metaORIG{#1}}}
\DucksayOptions{arg=tab,msg-align=l,vpad=1}
\renewcommand*\thefootnote{\fnsymbol{footnote}}
\newcommand*\anml{\meta{animal}}
\newcommand*\msg{\meta{message}}
\newcommand*\PolesInfo
{%
\href{https://ctan.org/pkg/l3kernel}{\file{interface3.pdf}} and the
documentation of \href{https://ctan.org/pkg/xcoffins}{\pkg{xcoffins}} for
information about coffin poles%
}
\usepackage{enumitem}
\newenvironment{options}[1][]
{%
\begin{description}
[
style=nextline
,font=\normalfont\ttfamily
,labelindent=-.5\marginparwidth
,labelwidth=\dimexpr.5\marginparwidth-5pt\relax
,labelsep*=5pt
,leftmargin=!
,#1
]%
\renewenvironment{options}[1][]
{%
\begin{description}
[
style=nextline
,font=\normalfont\ttfamily
,#1
]%
}
{\end{description}}%
}
{\end{description}}
\makeatletter
\renewcommand*\paragraph
{%
\@startsection
{paragraph}
{4}
{\z@}
{-3.25ex \@plus -1ex \@minus -.2ex}
{1ex \@plus .2ex}
{\normalfont\normalsize\bfseries}%
}
\newcommand*\availableAnimal[1]
{%
\@for\cs:=#1\do
{%
\ifx\cs\@empty\else
\rlap{\expandafter\ducksay\expandafter[\cs]{\cs}}\hfill\null\par%
\fi
}%
}
\def\@oddfoot
{%
\null\hfil
\makebox[0pt][c]
{%
\smash
{%
\ducksay
[dog,body=\tiny,wd=3,msg-align=c,out-v=T,MSG=\normalsize,vpad=0]
{\thepage}%
}%
}%
\hfil\null
}
\let\@evenfoot\@oddfoot
\def\@oddhead
{%
\null\hfill\firstmark
}
\let\@evenhead\@oddhead
\newcommand\DocImp{}
\newcommand\SetVersion[1]
{%
\clearpage
\if\relax\detokenize{#1}\relax
\markboth{}{}%
\else
\markboth{}{\DocImp\ of Version #1}%
\fi
}
\makeatother
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{3}
\NewDocumentCommand \tocmsg {}
{%
\marginpar
{%
\tiny
\hfil
\makebox[.\marginparwidth][l]
{%
\ducksay[head-in,MSG=\footnotesize,msg-align=c]
{It's always\\good to\\keep the\\overview!}%
}%
}%
\unskip
}
\addtocontents{toc}{\protect\tocmsg\vspace*{-\baselineskip}}
\newcommand*\closingpage%>>=
{%
\clearpage
\thispagestyle{empty}
\bgroup
\Huge
\null\vfill
\centering
\makebox[0pt]{\duckthink{Who's gonna use it anyway?}}
\vfill
\hfill
\smash
{%
\footnotesize
\ducksay[small-yoda,wd=39,ht=3,msg-align=c,body-align=r]
{Hosted at\\\url{https://github.com/Skillmon/ltx_ducksay}\\it is.}%
}
\egroup
\clearpage
}%=<<
\begin{document}
\DocInput{ducksay.dtx}
\end{document}
%</driver>^^A=<<
%<*pkg>^^A>>=
\NeedsTeXFormat{LaTeX2e}
\@ifundefined{NewDocumentCommand}{\RequirePackage{xparse}}{}
\def\ducksay@version{2.7}
\def\ducksay@date{2024-03-29}
\ProvidesExplPackage
{ducksay} {\ducksay@date}
{\ducksay@version} {cowsay for LaTeX}
%</pkg>
%^^A=<<
% \fi
%
% \begin{titlepage}^^A>>=
% \DucksayOptions{vpad=0}%
% \makeatletter
% \centering
% \Large
% \ducksay[duck,MSG=\huge,msg-align=c]{This is\\\pkg{ducksay}!}\\
% \vfill
% \normalsize
% \hspace*{-2cm}
% \ducksay[cow,MSG=\large,body-mirrored,body-align=r,msg-to-body=hc,out-h=r]
% {v\ducksay@version}\\
% \small
% \vspace*{-5cm}\hspace*{5cm}
% \ducksay[small-duck,MSG=\normalsize]{But which Version?}
% \null\hfil
% \vspace{2cm}
% \vfill
% \vfill
% \hspace*{-0cm}
% \large
% \smash{%
% \ducksay[r2d2,MSG=\large,body-mirrored,msg-to-body=hc,body-to-msg=r]
% {by Jonathan P. Spratte}}
% \small
% \ducksay[hedgehog,MSG=\normalsize]{Today is \ducksay@date}
% \makeatother
% \end{titlepage}^^A=<<
% \tableofcontents
%
% \begin{documentation}^^A>>=
%
% \marginpar^^A>>=
% {
% \tiny
% \hfill
% \ducksay
% [sheep,MSG=\footnotesize,t,body-align=c,msg-align=c,body-mirrored]
% {Give credit\\where credit is due!}
% }^^A=<<
% \section{Acknowledgements}%
% \begingroup
% \scriptsize
% \DucksayOptions{MSG=\normalsize}
% \ducksay[sheep]{I was created by Plergux!\footnotemark}
% \footnotetext
% {\url{https://chat.stackexchange.com/transcript/message/55986902\#55986902}}
% \endgroup
% \clearpage
%
% \marginpar^^A>>=
% {
% \tiny
% \hfill
% \ducksay
% [knight,MSG=\footnotesize,t,body-align=r,msg-align=c]
% {Just beest mod'rn,\\thee peasant!}
% }^^A=<<
% \section{Documentation}\def\DocImp{Documentation}%
%
% This is \pkg{ducksay}! A \texttt{cowsay} for \LaTeX. \pkg{ducksay} is part of
% \TeX Live and MiK\TeX\ since September 2017. If it is not part of your
% installation it means that your \LaTeX\ installation is \emph{really} out of
% date, you have two options: Update your installation or try to install
% \pkg{ducksay} yourself. Chances are that if you opt for the latter, the
% version of \pkg{expl3} in your \LaTeX\ installation is too old, too, and the
% \pkg{l3regex} module is not yet part of \pkg{expl3}. In that case you'll get a
% few undefined control sequence errors. |\usepackage{l3regex}| prior to loading
% \pkg{ducksay} might fix these issues. Additionally you'll need
% \href{https://ctan.org/pkg/grabbox}{\pkg{grabbox}} for version~2 of
% \pkg{ducksay} that won't be part of your \LaTeX\ installation, too. Please
% note that I don't actively support out of date \LaTeX\ installations, so if
% loading \pkg{l3regex} doesn't fix the issues and you're on an old
% installation, I won't provide further support.
%
% \subsection{Downward Compatibility Issues}\label{sec:down}^^A>>=
% \marginpar^^A>>=
% {
% \tiny
% \ducksay[snail,MSG=\footnotesize]{Yep, I screwed up!}
% }^^A=<<
%
% In the following list I use the term ``version'' to refer to package versions,
% the same is true if I use an abbreviation like ``v2.0'' (or anything that
% matches the regular expression |v\d+(.\d+)?|). For the code variant which can
% be set using the |version| option I'll use the term ``variant'' or specify
% directly that I'm referring to that option (the used font may be a hint, too).
%
% \begin{itemize}
% \item
% \sinceversion{2.0}
% Versions prior to v2.0 did use a regular expression for the option
% |ligatures|, see \autoref{sec:options} for more on this issue.
% \item In a document created with package versions prior to v2.0 you'll have
% to specify the option |version=1| with newer package versions to make
% those old documents behave like they used to.
% \item
% \sinceversion{2.3}
% Since v2.3 \cs{AddAnimal} and \cs{AddColoredAnimal} behave
% differently. You no longer have to make sure that in the first three lines
% every backslash which is only preceded by spaces is the bubble's tail.
% Instead you can specify which symbol should be the tail and how many of
% such symbols there are. See \autoref{sec:macros} for more about the
% current behaviour.
% \item
% \sinceversion{2.4}
% The |add-think| key was deprecated in v2.3 and was removed in v2.4 since
% the output symbols of the bubble tail are handled differently and more
% efficiently now.
% \end{itemize}^^A=<<
%
% \subsection{Shared between versions}^^A>>=
%
% \subsubsection{Macros}\label{sec:macros}^^A>>=
% \marginpar^^A>>=
% {
% \tiny
% \hfill
% \ducksay[bunny,MSG=\footnotesize,body-mirrored]
% {Macros for everyone!}
% }^^A=<<
%
% A careful reader might notice that in the below list of macros there is no
% \cs{ducksay} and no \cs{duckthink} contained. This is due to differences
% between the two usable code variants (see the |version| key in
% \autoref{sec:options} for the code variants, \autoref{sec:macros1} and
% \autoref{sec:macros2} for descriptions of the two macros).
%
% \begin{function}{\DefaultAnimal}^^A>>=
% \begin{syntax}
% \cs{DefaultAnimal}\marg{animal}
% \end{syntax}
% use the \anml\ if none is given in the optional argument to \cs{ducksay}
% or \cs{duckthink}. Package default is |duck|.
% \end{function}^^A=<<
%
% \begin{function}{\DucksayOptions}^^A>>=
% \begin{syntax}
% \cs{DucksayOptions}\marg{options}
% \end{syntax}
% set the defaults to the keys described in \autoref{sec:options},
% \autoref{sec:options1} and \autoref{sec:options2}. Don't use an \anml\ here,
% it has no effect.
% \end{function}^^A=<<
%
% \begin{function}{\AddAnimal}^^A>>=
% \begin{syntax}
% \cs{AddAnimal}\meta{*}\oarg{options}\marg{animal}\meta{ascii-art}
% \end{syntax}
% adds \anml\ to the known animals. \meta{ascii-art} is multi-line verbatim
% and therefore should be delimited either by matching braces or by anything
% that works for \cs{verb}. If the star is given \anml\ is the new default.
% One space is added to the begin of \anml\ (compensating the opening symbol).
% The symbols signalizing the speech bubble's tail (in the |hedgehog| example
% below the two |s|) can be set using the |tail-symbol| option and only the
% first |tail-count| occurrences will be substituted (see
% \autoref{sec:addoptions} for more about these options). For example,
% |hedgehog| is added with:\\[1ex]
% \begin{minipage}{\linewidth}
%\begin{verbatim}
% \AddAnimal[tail-symbol=s]{hedgehog}
% { s .\|//||\||.
% s |/\/||/|//|/|
% /. `|/\\|/||/||
% o__,_|//|/||\||'}
%\end{verbatim}
% \end{minipage}\\[1ex]
% It is not checked whether the animal already exists, you could therefore
% redefine existing animals with this macro.
% \end{function}^^A=<<
%
% \begin{function}{\AddColoredAnimal}^^A>>=
% \begin{syntax}
% \cs{AddColoredAnimal}\meta{*}\oarg{options}\marg{animal}\meta{ascii-art}
% \end{syntax}
% \newcommand*\bp{\hspace{0pt}}^^A
% It does the same as \cs{AddAnimal} but allows three different colouring
% syntaxes. You can use \cs{textcolor} in the \meta{ascii-art} with the syntax
% \texttt{\cs{textcolor}\marg{color}\marg{text}}. Note that you can't
% use braces in the arguments of \cs{textcolor}.\\
% You can also use a delimited \cs{color} of the form
% \texttt
% {\cs{bgroup}\bp\cs{color}\bp\marg{color}\bp\meta{text}\bp\cs{egroup}},
% a space after that |\egroup| will be considered a space in the output, so
% you don't have to care for correct termination of the |\egroup| (so
% \texttt{\cs{bgroup}\bp \cs{color}\bp\{red\}\bp RedText\bp
% \cs{egroup}OtherText} is valid syntax). You can't nest delimited
% \cs{color}s.\\
% Also you can use an undelimited \cs{color}. It affects anything until the
% end of the current line (or, if used inside of the \meta{text} of a
% delimited \cs{color}, anything until the end of that delimited \cs{color}'s
% \meta{text}). The syntax would be \cs{color}\marg{color}.\\
% The package doesn't load anything providing those colouring commands for you
% and it doesn't provide any coloured animals. The parsing is done using
% regular expressions provided by \LaTeX3. It is therefore slower than the
% normal \cs{AddAnimal}.
% \end{function}^^A=<<
%
% \begin{function}{\AnimalOptions}^^A>>=
% \begin{syntax}
% \cs{AnimalOptions}\meta{*}\marg{animal}\marg{options}
% \end{syntax}
% With this macro you can set \anml\ specific \meta{options}. If the star is
% given any currently set options for this \anml\ are dropped and only the
% ones specified in \meta{options} will be applied, else \meta{options} will
% be added to the set options for this \anml. The set \meta{options} can
% set the |tail-1| and |tail-2| options and therefore overwrite the effects of
% \cs{duckthink}, as \cs{duckthink} really is just \cs{ducksay} with the
% |think| option.
% \end{function}^^A=<<
%
%^^A=<<
%
% \subsubsection{Options}\label{sec:options}^^A>>=
% \marginpar
% {%
% \vspace*{-2em}\tiny
% \ducksay[pig,MSG=\footnotesize]{Options.\\For every occasion}%
% }
% The following options are available independent on the used code variant (the
% value of the |version| key). They might be used as package options -- unless
% otherwise specified -- or used in the macros \cs{DucksayOptions}, \cs{ducksay}
% and \cs{duckthink} -- again unless otherwise specified. Some options might be
% accessible in both code variants but do slightly different things. If that's
% the case they will be explained in \autoref{sec:options1} and
% \autoref{sec:options2} for |version| 1 and 2, respectively.
% \begin{options}
% \item[version=\meta{number}]
% With this you can choose the code variant to be used. Currently |1| and
% |2| are available. This can be set only during package load time. For a
% dedicated description of each version look into \autoref{sec:v1} and
% \autoref{sec:v2}. The package author would choose |version=2|, the other
% version is mostly for legacy reasons. The default is |2|.
% \item[\anml]
% One of the animals listed in \autoref{sec:animals} or any of the ones
% added with \cs{AddAnimal}. Not useable as package option. Also don't use
% it in \cs{DucksayOptions}, it'll break the default animal selection.
% \item[animal=\anml]
% Locally sets the default animal. Note that \cs{ducksay} and \cs{duckthink}
% do digest their options inside of a group, so it just results in
% a longer alternative to the use of \anml\ if used in their options.
% \item[ligatures=\meta{token list}]
% each token you don't want to form ligatures during \cs{AddAnimal} should
% be contained in this list. All of them get enclosed by grouping |{| and
% |}| so that they can't form ligatures. Giving no argument (or an empty
% one) might enhance compilation speed by disabling this replacement. The
% formation of ligatures was only observed in combination with
% |\usepackage[T1]{fontenc}| by the author of this package. Therefore giving
% the option |ligatures| without an argument might enhance the compilation
% speed for you without any drawbacks. Initially this is set to
% \texttt{\csuse{\detokenize{l_ducksay_ligatures_tl}}}.\\
% \textbf{Note:} In earlier releases this option's expected argument was a
% regular expression. This means that this option is not fully
% downward compatible with older versions. The speed gain however seems
% worth it (and I hope the affected documents are few).
% \item[no-tail]
% Sets |tail-1| and |tail-2| to be a space.
% \item[random=\meta{bool}]
% If |true| a random animal will be used instead of the default one on each
% usage of \cs{ducksay} or \cs{duckthink}. The initial value is false and it
% defaults to true.
% \item[say]
% Sets |tail-1| and |tail-2| as backslashes.
% \item[schroedinger]
% Sets randomly either |animal=schroedinger-alive| or
% |animal=schroedinger-dead| at the time of use. Both have the same size, so
% this doesn't affect the needed space.
% \item[tail-1=\meta{token list}]
% Sets the first tail symbol in the output to be \meta{token list}. If set
% outside of \cs{ducksay} and \cs{duckthink} it will be overwritten inside
% of \cs{duckthink} to be |O|.
% \item[tail-2=\meta{token list}]
% Sets every other tail symbol except the first one in the output to be
% \meta{token list}. If set outside of \cs{ducksay} and \cs{duckthink} it
% will be overwritten inside of \cs{duckthink} to be |o|.
% \item[think]
% Sets |tail-1=O| and |tail-2=o|.
% \end{options}
%
% \paragraph{Options for \cs{AddAnimal}}\label{sec:addoptions}
% The options described here are only available in \cs{AddAnimal} and
% \cs{AddColoredAnimal}.
% \begin{options}
% \item[tail-count=\meta{int}]
% sets the number of tail symbols to be replaced in \cs{AddAnimal} and
% \cs{AddColoredAnimal}. Initial value is 2. If the value is negative every
% occurrence of |tail-symbol| will be replaced.
% \item[tail-symbol=\meta{str}]
% the symbol used in \cs{AddAnimal} and \cs{AddColoredAnimal} to mark the
% bubble's tail. The argument gets \cs{detokenize}d. Initially a single
% backslash.
% \end{options}
%^^A=<<
%
%^^A=<<
%
% \SetVersion{1}%
% \subsection{Version 1}\label{sec:v1}^^A>>=
%
% \subsubsection{Introducktion}^^A>>=
%
% This version is included for legacy support (old documents should behave the
% same without any change to them -- except the usage of |version=1| as an
% option, for a more or less complete list of downward compatibility related
% problems see \autoref{sec:down}). For the bleeding edge version of
% \pkg{ducksay} skip this subsection and read \autoref{sec:v2}.
%^^A=<<
%
% \subsubsection{Macros}\label{sec:macros1}^^A>>=
% \marginpar
% {%
% \rlap
% {%
% \tiny
% \ducksay[yoda,MSG=\footnotesize]{Use those, you might}%
% }%
% }
% The following is the description of macros which differ in behaviour from
% those of version 2.
%
% \begin{function}{\ducksay}^^A>>=
% \begin{syntax}
% \cs{ducksay}\oarg{options}\marg{message}
% \end{syntax}
% options might include any of the options described in \autoref{sec:options}
% and \autoref{sec:options1} if not otherwise specified. Prints an \anml\
% saying \msg. \msg\ is not read in verbatim. Multi-line \msg s are possible
% using |\\|. |\\| should not be contained in a macro definition but at
% toplevel. Else use the option |ht|.
% \end{function}^^A=<<
%
% \begin{function}{\duckthink}^^A>>=
% \begin{syntax}
% \cs{duckthink}\oarg{options}\marg{message}
% \end{syntax}
% options might include any of the options described in \autoref{sec:options}
% and \autoref{sec:options1} if not otherwise specified. Prints an \anml\
% thinking \msg. \msg\ is not read in verbatim. Multi-line \msg s are possible
% using |\\|. |\\| should not be contained in a macro definition but at
% toplevel. Else use the option |ht|.
% \end{function}^^A=<<
%^^A=<<
%
% \subsubsection{Options}\label{sec:options1}^^A>>=
% \marginpar
% {%
% \vspace*{-2em}\tiny
% \hfill
% \ducksay[hedgehog,MSG=\footnotesize]{Everyone likes\\options}%
% }
% The following options are available to \cs{ducksay}, \cs{duckthink}, and
% \cs{DucksayOptions} and if not otherwise specified also as package options:
% \begin{options}
% \item[bubble=\meta{code}]
% use \meta{code} in a group right before the bubble (for font switches).
% Might be used as a package option but not all control sequences work out
% of the box there.
% \item[body=\meta{code}]
% use \meta{code} in a group right before the body (meaning the \anml).
% Might be used as a package option but not all control sequences work out
% of the box there. E.g.\@ to right-align the \anml\ to the bubble, use
% |body=\hfill|.
% \item[align=\meta{valign}]
% use \meta{valign} as the vertical alignment specifier given to the
% \env{tabular} which is around the contents of \cs{ducksay} and
% \cs{duckthink}.
% \item[msg-align=\meta{halign}]
% use \meta{halign} for alignment of the rows of multi-line \msg s. It
% should match a \texttt{tabular} column specifier. Default is |l|. It only
% affects the contents of the speech bubble not the bubble.
% \item[rel-align=\meta{column}]
% use \meta{column} for alignment of the bubble and the body. It should
% match a \env{tabular} column specifier. Default is |l|.
% \item[wd=\meta{count}]
% in order to detect the width the \msg\ is expanded. This might not work
% out for some commands (e.g.\@ \cs{url} from \pkg{hyperref}). If you
% specify the width using |wd| the \msg\ is not expanded and
% therefore the command \emph{might} work out. \meta{count} should be the
% character count.
% \item[ht=\meta{count}]
% you might explicitly set the height (the row count) of the \msg. This only
% has an effect if you also specify |wd|.
% \end{options}
%^^A=<<
%
% \subsubsection{Defects}^^A>>=
% \begingroup
% \reversemarginpar
% \marginpar
% {\tiny\hfill\ducksay[frog,MSG=\footnotesize,t]{Ohh, no!}}
% \endgroup
% \begin{itemize}
% \item no automatic line wrapping
% \item message width detection based on token count with \cs{edef} expansion,
% might fail badly
% \end{itemize}^^A=<<
%
%^^A=<<
%
% \SetVersion{2}%
% \subsection{Version 2}\label{sec:v2}^^A>>=
% \marginpar^^A>>=
% {
% \fontsize{3.5pt}{3.5pt}\selectfont
% \makebox[\marginparwidth]
% {\ducksay[unicorn,MSG=\footnotesize]{Here's all the good stuff!}}%
% }^^A=<<
%
% \subsubsection{Introducktion}^^A>>=
%
% Version~2 is the current version of \pkg{ducksay}. It features automatic line
% wrapping (if you specify a fixed width) and in general more options (with some
% nasty argument parsing).
%
% If you're already used to version~1 you should note one important thing: You
% should only specify the |version| and the |ligatures| during package load time
% as arguments to \cs{usepackage}. The other keys might not work or do
% unintended things and only don't throw errors or warnings because of the
% legacy support of version~1. After the package is loaded, keys only used for
% version~1 will throw an error.
%
%^^A=<<
%
% \subsubsection{Macros}\label{sec:macros2}^^A>>=
% \marginpar^^A>>=
% {
% \tiny
% \ducksay[duck-family,MSG=\footnotesize,t,body-mirrored]
% {Look at those, kids!}
% }^^A=<<
%
% The following is the description of macros which differ in behaviour from
% those of version 1.
%
% \begin{function}{\ducksay}^^A>>=
% \begin{syntax}
% \cs{ducksay}\oarg{options}\marg{message}
% \end{syntax}
% options might include any of the options described in \autoref{sec:options}
% and \autoref{sec:options2} if not otherwise specified. Prints an \anml\
% saying \msg.\\
% The \msg\ can be read in in four different ways. For an explanation of the
% \msg\ reading see the description of the |arg| key in
% \autoref{sec:options2}.\\
% The height and width of the message is determined by measuring its
% dimensions and the bubble will be set accordingly. The box surrounding the
% message will be placed both horizontally and vertically centred inside of
% the bubble. The output utilizes \LaTeX3's coffin mechanism described in
% \href{https://ctan.org/pkg/l3kernel}{\file{interface3.pdf}} and the
% documentation of \href{https://ctan.org/pkg/xcoffins}{\pkg{xcoffins}}.
% \end{function}^^A=<<
%
% \begin{function}{\duckthink}^^A>>=
% \begin{syntax}
% \cs{duckthink}\oarg{options}\marg{message}
% \end{syntax}
% The only difference to \cs{ducksay} is that in \cs{duckthink} the \anml s
% think the \msg\ and don't say it.\\
% \end{function}^^A=<<
%
%^^A=<<
%
% \subsubsection{Options}\label{sec:options2}^^A>>=
% \marginpar^^A>>=
% {
% \tiny
% \hfill\ducksay[small-rabbit,MSG=\footnotesize]
% {Fast, use options!}
% }^^A=<<
% In version 2 the following options are available. Keep in mind that you
% shouldn't use them during package load time but in the arguments of
% \cs{ducksay}, \cs{duckthink} or \cs{DucksayOptions}.
% \begin{options}
% \item[arg=\meta{choice}]
% specifies how the \msg\ argument of \cs{ducksay} and \cs{duckthink} should
% be read in. Available options are |box|, |tab| and |tab*|:
% \begin{options}
% \item[box]
% the argument is read in either as a \cs{hbox} or a \cs{vbox} (the
% latter if a fixed width is specified with either |wd| or |wd*|). Note
% that in this mode any arguments relying on category code changes like
% e.g.\@ \cs{verb} will work (provided that you don't use \cs{ducksay}
% or \cs{duckthink} inside of an argument of another macro of course).
% \item[tab]
% the argument is read in as the contents of a \env{tabular}. Note that
% in this mode any arguments relying on category code changes like
% e.g.\@ \cs{verb} will \emph{not} work. This mode comes closest to the
% behaviour of version 1 of \pkg{ducksay}.
% \item[tab*]
% the argument is read in as the contents of a \env{tabular}. However it
% is read in verbatim and uses \cs{scantokens} to rescan the argument.
% Note that in this mode any arguments relying on category code changes
% like e.g.\@ \cs{verb} will work. You can't use \cs{ducksay} or
% \cs{duckthink} as an argument to another macro in this mode however.
% \end{options}
% \item[b]
% shortcut for |out-v=b|.
% \item[body=\meta{font}]
% add \meta{font} to the font definitions in use to typeset the \anml's
% body.
% \item[body*=\meta{font}]
% clear any definitions previously made (including the package default) and
% set the font definitions in use to typeset the \anml's body to
% \meta{font}. The package default is \cs{verbatim@font}. In addition
% \cs{frenchspacing} will always be used prior to the defined \meta{font}.
% \item[body-align=\meta{choice}]
% sets the relative alignment of the \anml\ to the \msg. Possible choices
% are |l|, |c| and |r|. For |l| the \anml\ is flushed to the left of the
% \msg, for |c| it is centred and for |r| it is flushed right. More fine
% grained control over the alignment can be obtained with the keys
% |msg-to-body|, |body-to-msg|, |body-x| and |body-y|. Package default is
% |l|.
% \item[body-bigger=\meta{count}]
% vertically enlarge the body by \meta{count} empty lines added to the
% bottom. This way top-aligning two different body types is easier (by
% actually bottom aligning the two):\par
% {\tiny
% \hfill\ducksay[ghost,body-x=-7mm,b,body-mirrored]{Buuuh!}
% \ducksay[crusader,body-bigger=4,b,out-h=r,no-bubble]{}
% }
% \hfill\begin{minipage}[b]{.6\textwidth}
% \footnotesize
%\begin{verbatim}
% \ducksay[ghost,body-x=-7mm,b,body-mirrored]{Buuuh!}
% \ducksay[crusader,body-bigger=4,b,out-h=r,no-bubble]{}
%
%
%\end{verbatim}
% \end{minipage}\hfill\null
% \item[body-mirrored=\meta{bool}]
% if set true the \anml\ will be mirrored along its vertical centre axis.
% Package default is |false|. If you set it |true| you'll most likely need
% to manually adjust the alignment of the body with one or more of the
% keys |body-align|, |body-to-msg|, |msg-to-body|, |body-x| and |body-y|.
% \item[body-to-msg=\meta{pole}]
% defines the horizontal coffin \meta{pole} to be used for the placement of
% the \anml\ beneath the \msg. See \PolesInfo.
% \item[body-x=\meta{dimen}]
% defines a horizontal offset of \meta{dimen} length of the \anml\ from its
% placement beneath the \msg.
% \item[body-y=\meta{dimen}]
% defines a vertical offset of \meta{dimen} length of the \anml\ from its
% placement beneath the \msg.
% \item[bubble=\meta{font}]
% add \meta{font} to the font definitions in use to typeset the bubble. This
% does not affect the \msg\ only the bubble put around it.
% \item[bubble*=\meta{font}]
% clear any definitions previously made (including the package default) and
% set the font definitions in use to typeset the bubble to \meta{font}. This
% does not affect the \msg\ only the bubble put around it. The package
% default is \cs{verbatim@font}.
% \item[bubble-bot-kern=\meta{dimen}]
% specifies a vertical offset of the placement of the lower border of the
% bubble from the bottom of the left and right borders.
% \item[bubble-delim-left-1=\meta{token list}]
% the left delimiter used if only one line of delimiters is needed. Package
% default is |(|.
% \item[bubble-delim-left-2=\meta{token list}]
% the upper most left delimiter used if more than one line of delimiters is
% needed. Package default is |/|.
% \item[bubble-delim-left-3=\meta{token list}]
% the left delimiters used to fill the gap if more than two lines of
% delimiters are needed. Package default is \verb+|+.
% \item[bubble-delim-left-4=\meta{token list}]
% the lower most left delimiter used if more than one line of delimiters is
% needed. Package default is |\|.
% \item[bubble-delim-right-1=\meta{token list}]
% the right delimiter used if only one line of delimiters is needed. Package
% default is |)|.
% \item[bubble-delim-right-2=\meta{token list}]
% the upper most right delimiter used if more than one line of delimiters is
% needed. Package default is |\|.
% \item[bubble-delim-right-3=\meta{token list}]
% the right delimiters used to fill the gap if more than two lines of
% delimiters are needed. Package default is \verb+|+.
% \item[bubble-delim-right-4=\meta{token list}]
% the lower most right delimiter used if more than one line of delimiters
% is needed. Package default is |/|.
% \item[bubble-delim-top=\meta{token list}]
% the delimiter used to create the top and bottom border of the bubble. The
% package default is |{-}| (the braces are important to suppress ligatures
% here).
% \item[bubble-side-kern=\meta{dimen}]
% specifies the kerning used to move the sideways delimiters added to fill
% the gap for more than two lines of bubble height. (the left one is moved
% to the left, the right one to the right)
% \item[bubble-top-kern=\meta{dimen}]
% specifies a vertical offset of the placement of the upper border of the
% bubble from the top of the left and right borders.
% \item[c]
% shortcut for |out-v=vc|.
% \item[col=\meta{column}]
% specifies the used column specifier used for the \msg\ enclosing
% \env{tabular} for |arg=tab| and |arg=tab*|. Has precedence over
% |msg-align|. You can also use more than one column this way:
% |\ducksay[arg=tab,col=cc]{ You & can \\ do & it }| would be valid syntax.
% \item[hpad=\meta{count}]
% Add \meta{count} times more |bubble-delim-top| instances than necassary to
% the upper and lower border of the bubble. Package default is 2.
% \item[ht=\meta{count}]
% specifies a minimum height (in lines) of the \msg. The lines' count is
% that of the needed lines of the horizontal bubble delimiters. If the
% count of the actually needed lines is smaller than the specified
% \meta{count}, \meta{count} lines will be used. Else the required lines
% will be used.
% \item[ignore-body=\meta{bool}]
% If set |true| the \anml's body will be added to the output but it will not
% contribute to the bounding box (so will not take up any space).
% \item[msg=\meta{font}]
% add \meta{font} to the font definitions in use to typeset the \msg.
% \item[msg*=\meta{font}]
% clear any definitions previously made (including the package default) and
% set the font definitions in use to typeset the \msg\ to \meta{font}. The
% package default is \cs{verbatim@font}.
% \item[MSG=\meta{font}]
% same as \texttt{msg=\meta{font}, bubble=\meta{font}}.
% \item[MSG*=\meta{font}]
% same as \texttt{msg*=\meta{font}, bubble*=\meta{font}}.
% \item[msg-align=\meta{choice}]
% specifies the alignment of the \msg. Possible values are |l| for flushed
% left, |c| for centred, |r| for flushed right and |j| for justified. If
% |arg=tab| or |arg=tab*| the |j| choice is only available for fixed width
% contents. Package default is |l|.
% \item[msg-align-c=\meta{token list}]
% set the \meta{token list} which is responsible to typeset the message
% centred if the option |msg-align=c| is used. It is used independent of the
% |arg| key. For |arg=tab| and |arg=tab*| it is only used if a fixed width
% is specified and the macro \cs{arraybackslash} provided by \pkg{array} is
% used afterwards. The package default is |\centering|. It might be useful
% if you want to use \pkg{ragged2e}'s \cs{Centering} for example.
% \item[msg-align-j=\meta{token list}]
% set the \meta{token list} which is responsible to typeset the message
% justified if the option |msg-align=j| is used. It is used independent of
% the |arg| key. For |arg=tab| and |arg=tab*| it is only used if a fixed
% width is specified and the macro \cs{arraybackslash} provided by
% \pkg{array} is used afterwards. The package default is empty as
% justification is the default behaviour of contents of a |p| column and of
% a \cs{vbox}. It might be useful if you want to use \pkg{ragged2e}'s
% \cs{justifying} for example.
% \item[msg-align-l=\meta{token list}]
% set the \meta{token list} which is responsible to typeset the message
% flushed left if the option |msg-align=l| is used. It is used independent
% of the |arg| key. For |arg=tab| and |arg=tab*| it is only used if a fixed
% width is specified and the macro \cs{arraybackslash} provided by
% \pkg{array} is used afterwards. The package default is |\raggedright|. It
% might be useful if you want to use \pkg{ragged2e}'s \cs{RaggedRight} for
% example.
% \item[msg-align-r=\meta{token list}]
% set the \meta{token list} which is responsible to typeset the message
% flushed right if the option |msg-align=r| is used. It is used independent
% of the |arg| key. For |arg=tab| and |arg=tab*| it is only used if a fixed
% width is specified and the macro \cs{arraybackslash} provided by
% \pkg{array} is used afterwards. The package default is |\raggedleft|. It
% might be useful if you want to use \pkg{ragged2e}'s \cs{RaggedLeft} for
% example.
% \item[msg-to-body=\meta{pole}]
% defines the horizontal coffin \meta{pole} to be used as the reference
% point for the placement of the \anml\ beneath the \msg. See \PolesInfo.
% \item[no-bubble=\meta{bool}]
% If |true| the \msg\ will not be surrounded by a bubble. Package default is
% of course |false|.
% \item[none=\meta{bool}]
% One could say this is a special animal. If |true| no animal body will be
% used (resulting in just the speech bubble). Package default is of course
% |false|.
% \item[out-h=\meta{pole}]
% defines the horizontal coffin \meta{pole} to be used as the anchor point
% for the print out of the complete result of \cs{ducksay} and
% \cs{duckthink}. See \PolesInfo.
% \item[out-v=\meta{pole}]
% defines the vertical coffin \meta{pole} to be used as the anchor point for
% the print out of the complete result of \cs{ducksay} and \cs{duckthink}.
% See \PolesInfo.
% \item[out-x=\meta{dimen}]
% specifies an additional horizontal offset of the print out of the complete
% result of \cs{ducksay} and \cs{duckthink}.
% \item[out-y=\meta{dimen}]
% specifies an additional vertical offset of the print out of the complete
% result of \cs{ducksay} and \cs{duckthink}
% \item[strip-spaces=\meta{bool}]
% if set |true| leading and trailing spaces are stripped from the \msg\ if
% |arg=box| is used. Initially this is set to |false|.
% \item[t]
% shortcut for |out-v=t|.
% \item[vpad=\meta{count}]
% add \meta{count} to the lines used for the bubble, resulting in
% \meta{count} more lines than necessary to enclose the \msg\ inside of the
% bubble.
% \item[wd=\meta{count}]
% specifies the width of the \msg\ to be fixed to \meta{count} times the
% width of an upper case M in the \msg's font declaration. A value smaller
% than 0 is considered deactivated, else the width is considered as fixed.
% For a fixed width the argument of \cs{ducksay} and \cs{duckthink} is read
% in as a \cs{vbox} for |arg=box| and the column definition uses a |p|-type
% column for |arg=tab| and |arg=tab*|. If both |wd| is not smaller than 0
% and |wd*| is not smaller than 0pt, |wd*| will take precedence.
% \item[wd*=\meta{dimen}]
% specifies the width of the \msg\ to be fixed to \meta{dimen}. A value
% smaller than 0pt is considered deactivated, else the width is considered
% as fixed. For a fixed width the argument of \cs{ducksay} and
% \cs{duckthink} is read in as a \cs{vbox} for |arg=box| and the column
% definition uses a |p|-type column for |arg=tab| and |arg=tab*|. If both
% |wd| is not smaller than 0 and |wd*| is not smaller than 0pt, |wd*| will
% take precedence.
% \item[wd-eq-body=\meta{bool}]
% if this is |true|, |wd| is smaller than 0, and |wd*| is smaller than 0pt
% the \msg\ will be as wide as the \anml's body. Note that because the
% \anml\ bodies contain white space on their left end and due to the
% additional horizontal bubble delimiters the bubble will be wider than the
% \anml's body. If the |none| option was also used this option has no
% effect.
% \end{options}
%
%^^A=<<
%
%^^A=<<
%
% \SetVersion{}%
% \subsection{Dependencies}^^A>>=
% \marginpar
% {%
% \tiny
% \rlap
% {%
% \ducksay
% [
% kangaroo,MSG=\footnotesize
% ,body-mirrored,body-to-msg=r,msg-to-body=hc
% ]
% {We rely on you}%
% }%
% }
% The package depends on the \LaTeX\ kernel, for older versions of \LaTeX\ the
% two packages \pkg{xparse} and \pkg{l3keys2e} and all of their dependencies are
% loaded. Version 2 additionally depends on \pkg{array} and \pkg{grabbox}.
%^^A=<<
%
% \subsection{Available Animals}\label{sec:animals}^^A>>=
% \marginpar
% {%
% \tiny
% \hfill
% \ducksay[turtle,MSG=\footnotesize,msg-align=c]
% {Slowly new animals\\are added.}%
% }
% The following animals are provided by this package. I did not create them (but
% altered some), they belong to their original creators.
% \bgroup
% \fontsize{6pt}{6pt}\selectfont
% \parindent=0pt
% \DucksayOptions{MSG=\footnotesize,vpad=0,arg=tab}
% \begin{multicols}{2}
% \availableAnimal{^^A>>=
% ,duck^^A
% ,small-duck^^A
% ,duck-family^^A
% ,small-rabbit^^A
% ,squirrel^^A
% ,cow^^A
% ,tux^^A
% ,head-in^^A
% ,pig^^A
% ,frog^^A
% ,snowman^^A
% ,bunny^^A
% ,dragon^^A
% ,sodomized^^A
% ,hedgehog^^A
% ,platypus^^A
% ,turtle^^A
% ,kangaroo^^A
% ,small-horse^^A
% ,dog^^A
% ,sheep^^A
% ,rabbit^^A
% ,snail^^A
% ,whale^^A
% ,snake^^A
% ,cat^^A
% ,sleepy-cat^^A
% ,schroedinger-dead^^A
% ,schroedinger-alive^^A
% ,crusader^^A
% ,knight^^A
% ,fairy^^A
% ,ghost^^A