summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/ducksay/ducksay.tex
blob: b03db19e2c02dd12964f1a3bfb4637647eb4284a (plain)
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
%% This package is distributed under the terms of the GPLv3 or later, or the
%% LPPL 1.3c or later, which ever license fits your needs the best.
%%
%% Copyright (C) 2017 by Jonathan P. Spratte
%%
%% This file is for documentation only
\documentclass[a4paper,10pt]{article}

%\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
\usepackage[ligatures]{ducksay}
\usepackage{multicol}
\usepackage[colorlinks]{hyperref}
\usepackage{lmodern}

\makeatletter
\newcommand*{\availableAnimal}[1]{\@for\cs:=#1\do{%
  \ifx\cs\@empty\else%
    \rlap{\expandafter\ducksay\expandafter[\cs]{\cs}}\hfill\mbox{}\\[1ex]%
  \fi%
}}
\makeatother
\newcommand*{\anml}{\texttt{<animal>}}
\newcommand*{\msg}{\texttt{<message>}}
\newenvironment{codedescription}{%
  \parindent=-3em%
  \parskip=1em%
  \par%
}{}

\begin{document}
\begin{titlepage}%>>>
  \makeatletter
  \centering
  %\mbox{}\vfill
  \Large
    \ducksay[duck,bubble=\huge,msg-align=c,wd=8]{This is\\ducksay!}\\
  \vfill
  \normalsize
  \hspace*{-2cm}
    \ducksay[cow,bubble=\large]{\ducksay@version}\\
  \small
  \vspace*{-5cm}\hspace*{5cm}
    \ducksay[small-duck,bubble=\normalsize]{But which Version?}
  \mbox{}\hfil
  \vspace{2cm}
  \vfill
  \vfill
  \hspace*{-0cm}
  \large
  \smash{%
    \ducksay[r2d2,bubble=\large]{by Jonathan P. Spratte}}
  \small
    \ducksay[hedgehog,bubble=\normalsize]{Today is \ducksay@date}
  \makeatother
\end{titlepage}%<<<
\tableofcontents
\section{Macros}%>>>
\marginpar{%
  \rlap{%
    \tiny\ducksay[yoda,bubble=\footnotesize,align=t]{Use those, you might}}}
The following macros are available:

\begin{codedescription}
\verb|\ducksay[<options>]{<message>}|\\
  options might include any of the options described in
  \autoref{sec:options}. Prints an \anml\ saying \msg. \msg\ is not read in
  verbatim. Multi-line \msg s are possible using \verb|\\|. \verb|\\| should not
  be inside a macro but at toplevel. Else use the option \texttt{ht}.

\verb|\duckthink[<options>]{<message>}|\\
  options might include any of the options described in
  \autoref{sec:options}. Prints an \anml\ thinking \msg. \msg\ is not read in
  verbatim. It is implemented using regular expressions replacing a \verb|\|
  which is only preceded by \verb|\s*| in the first three lines with \verb|O|
  and \verb|o|. It is therefore slower than \verb|\ducksay|. Multi-line \msg s
  are possible using \verb|\\|. \verb|\\| should not be inside a macro but at
  toplevel. Else use the option \texttt{ht}.

\verb|\DefaultAnimal{<animal>}|\\
  use the \anml\ if none is given in the optional argument to \verb|\ducksay| or
  \verb|\duckthink|. Package default is \texttt{duck}.

\verb|\DucksayOptions{<options>}|\\
  set the defaults to the keys described in \autoref{sec:options}. Don't use an
  \anml\ here, it has no effect.

\verb|\AddAnimal(*){<animal>}<ascii-art>|\\
  adds \anml\ to the known animals. \texttt{<ascii-art>} is multi-line verbatim
  and therefore should be delimited either by matching braces or by anything
  that works for \verb|\verb|. If the star is given \anml\ is the new default.
  One space is added to the begin of \anml\ (compensating the opening symbol).
  For example, snowman is added with:\\[1ex]
  \begin{minipage}{\linewidth}
\begin{verbatim}
\AddAnimal{snowman}
{  \
    \_[_]_
      (")
   >-( : )-<
    (__:__)}
\end{verbatim}
  \end{minipage}
\end{codedescription}
%<<<
\section{Options}\label{sec:options}%>>>
{\reversemarginpar\marginpar{%
  \vspace*{-2em}\hspace*{-4em}%
  \tiny%
  \ducksay[hedgehog,bubble=\footnotesize,align=t]{Everyone likes\\options}}}
The following options are available to \verb|\ducksay|, \verb|\duckthink|, and
\verb|\DucksayOptions| and if not otherwise specified also as package options:

\begin{codedescription}
\anml\\
  One of the animals listed in \autoref{sec:animals} or any of the ones added
  with \verb|\AddAnimal|. Not useable as package option.

\texttt{animal=\anml}\\
  a longer alternative to the use of \anml\ if used in \verb|\ducksay| or
  \verb|\duckthink|. If it is used as a package option or in
  \verb|\DucksayOptions| it changes the default animal to \anml.

\texttt{bubble=\#1}\\
  use \texttt{\#1} 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.

\texttt{body=\#1}\\
  use \texttt{\#1} 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 \verb|body=\hfill|.

\texttt{align=\#1}\\
  use \texttt{\#1} as the vertical alignment specifier given to the
  \texttt{tabular} which is around the contents of \verb|\ducksay| and
  \verb|\duckthink|.

\texttt{msg-align=\#1}\\
  use \texttt{\#1} for alignment of the rows of multi-line \msg s. It should
  match a \texttt{tabular} column specifier. Default is \texttt{l}. It only
  affects the contents of the speech bubble not the bubble.

\texttt{wd=\#1}\\
  in order to detect the width the \msg\ is expanded. This might not work out
  for some commands (e.g. \verb|\url| from \texttt{hyperref}). If you specify
  the width using \texttt{wd} the \msg\ is not expanded and therefore the
  command \emph{might} work out. \texttt{\#1} should be the character count.

\texttt{ht=\#1}\\
  you might explicitly set the height (the row count) of the \msg. This only has
  an effect if you also specify \texttt{wd}.

\texttt{ligatures=\#1}\\
  this is a \LaTeX3 regular expression which should match every character you
  don't want to form ligatures during \verb|\AddAnimal|. The default expression
  is \verb|[\-<>`]|. Giving no argument (or an empty one) disables the
  replacement, which enhances compilation speed. The formation of ligatures was
  only observed in combination with \verb|\usepackage[T1]{fontenc}| by the
  author of this package. Therefore giving the option \texttt{ligatures} without
  an argument might enhance the compilation speed for you without any
  drawbacks.
\end{codedescription}
  %<<<
\section{Defects}%>>>
{\reversemarginpar\marginpar{%
  \tiny\rlap{\ducksay[frog,bubble=\footnotesize,align=t]{Ohh, no!}}}}
\begin{itemize}
  \item no automatic line wrapping
\end{itemize}
%<<<
\section{Dependencies}%>>>
\marginpar{%
  \tiny\rlap{\ducksay[kangaroo,bubble=\footnotesize,align=t]{We rely on you}}}
The package depends on the two packages \texttt{xparse} and \texttt{l3keys2e}
and all of their dependencies.
%<<<
%\clearpage
\section{Available Animals}\label{sec:animals}%>>>
The following animals are provided by this package. I did not create them (but
altered some), they belong to their original creators.
\bgroup
\footnotesize
\begin{multicols}{2}
\availableAnimal{%>>>
  ,duck%
  ,small-duck%
  ,duck-family%
  ,small-rabbit%
  ,squirrel%
  ,cow%
  ,tux%
  ,head-in%
  ,pig%
  ,frog%
  ,snowman%
  ,bunny%
  ,dragon%
  ,sodomized%
  ,hedgehog%
  ,kangaroo%
  ,dog%
  ,rabbit%
  ,unicorn%
}\end{multicols}\begin{multicols}{2}
\availableAnimal{%
  ,r2d2%
  ,vader%
  ,yoda-head%
  ,small-yoda%
  ,yoda%
}%<<<
\end{multicols}
\egroup
%<<<
\section{Miscellaneous}%>>>
\marginpar{%
  \rlap{\tiny\ducksay[squirrel,bubble=\footnotesize,align=t]{I'd choose WTFPL}}}
This package is distributed under the terms of the GPLv3 or later, or the LPPL
1.3c or later, choose which ever license fits your needs the best.

The package is hosted on \url{https://github.com/Skillmon/ltx_ducksay}, you
might report bugs there.
%<<<
\clearpage
% closing page>>>
\thispagestyle{empty}
\bgroup
\Huge
\mbox{}\vfill
\centering
\makebox[0pt]{\duckthink{Who's gonna use it anyway?}}
\vfill
\hfill\smash{\footnotesize\ducksay[small-yoda,wd=49]{hosted at
  \url{https://github.com/Skillmon/ltx_ducksay}}}
\egroup
%<<<
\end{document}

% vim: fdm=marker foldmarker=>>>,<<<