summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/ducksay/ducksay.code.v1.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/ducksay/ducksay.code.v1.tex')
-rw-r--r--Master/texmf-dist/doc/latex/ducksay/ducksay.code.v1.tex159
1 files changed, 159 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/ducksay/ducksay.code.v1.tex b/Master/texmf-dist/doc/latex/ducksay/ducksay.code.v1.tex
new file mode 100644
index 00000000000..b34e6d42784
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/ducksay/ducksay.code.v1.tex
@@ -0,0 +1,159 @@
+%%
+%% This is file `ducksay.code.v1.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% ducksay.dtx (with options: `code.v1')
+%%
+%% --------------------------------------------------------------
+%% 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-2018 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
+%%
+%% Alternatively you can use this work under the terms of the GNU General Public
+%% Licensce (GPL), version 3 or later, except that you might not redistribute it
+%% under the same name if you change its functionality. Choose which of these
+%% licenses fits your needs the best.
+%%
+%% 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.
+%%
+\cs_new:Npn \ducksay_longest_line:n #1
+ {
+ \int_incr:N \l_ducksay_msg_height_int
+ \exp_args:NNx \tl_set:Nn \l_ducksay_tmpa_tl { #1 }
+ \regex_replace_all:nnN { \s } { \c { space } } \l_ducksay_tmpa_tl
+ \int_set:Nn \l_ducksay_msg_width_int
+ {
+ \int_max:nn
+ { \l_ducksay_msg_width_int } { \tl_count:N \l_ducksay_tmpa_tl }
+ }
+ }
+\cs_new:Npn \ducksay_open_bubble:
+ {
+ \begin{tabular}{@{}l@{}}
+ \null\\
+ \int_compare:nNnTF { \l_ducksay_msg_height_int } = { 1 } { ( }
+ {
+ /
+ \int_step_inline:nnn
+ { 3 } { \l_ducksay_msg_height_int } { \\\kern-0.2em| }
+ \\\detokenize{\ }
+ }
+ \\[-1ex]\null
+ \end{tabular}
+ \begin{tabular}{@{}l@{}}
+ _\\
+ \int_step_inline:nnn { 2 } { \l_ducksay_msg_height_int } { \\ } \\[-1ex]
+ \mbox { - }
+ \end{tabular}
+ }
+\cs_new:Npn \ducksay_close_bubble:
+ {
+ \begin{tabular}{@{}l@{}}
+ _\\
+ \int_step_inline:nnn { 2 } { \l_ducksay_msg_height_int } { \\ } \\[-1ex]
+ { - }
+ \end{tabular}
+ \begin{tabular}{@{}r@{}}
+ \null\\
+ \int_compare:nNnTF { \l_ducksay_msg_height_int } = { 1 }
+ { ) }
+ {
+ \detokenize {\ }
+ \int_step_inline:nnn
+ { 3 } { \l_ducksay_msg_height_int } { \\|\kern-0.2em }
+ \\/
+ }
+ \\[-1ex]\null
+ \end{tabular}
+ }
+\cs_new:Npn \ducksay_print_msg:nn #1 #2
+ {
+ \begin{tabular}{@{} #2 @{}}
+ \int_step_inline:nn { \l_ducksay_msg_width_int } { _ } \\
+ #1\\[-1ex]
+ \int_step_inline:nn { \l_ducksay_msg_width_int } { { - } }
+ \end{tabular}
+ }
+\cs_generate_variant:Nn \ducksay_print_msg:nn { nV }
+\cs_new:Npn \ducksay_print:nn #1 #2
+ {
+ \int_compare:nNnTF { \l_ducksay_msg_width_int } < { 0 }
+ {
+ \int_zero:N \l_ducksay_msg_height_int
+ \seq_set_split:Nnn \l_ducksay_msg_lines_seq { \\ } { #1 }
+ \seq_map_function:NN \l_ducksay_msg_lines_seq \ducksay_longest_line:n
+ }
+ {
+ \int_compare:nNnT { \l_ducksay_msg_height_int } < { 0 }
+ {
+ \regex_count:nnN { \c { \\ } } { #1 } \l_ducksay_msg_height_int
+ \int_incr:N \l_ducksay_msg_height_int
+ }
+ }
+ \group_begin:
+ \frenchspacing
+ \verbatim@font
+ \@noligs
+ \begin{tabular}[\l_ducksay_align_tl]{@{}#2@{}}
+ \l_ducksay_bubble_tl
+ \begin{tabular}{@{}l@{}}
+ \ducksay_open_bubble:
+ \ducksay_print_msg:nV { #1 } \l_ducksay_msg_align_tl
+ \ducksay_close_bubble:
+ \end{tabular}\\
+ \l_ducksay_body_tl
+ \begin{tabular}{@{}l@{}}
+ \l_ducksay_animal_tl
+ \end{tabular}
+ \end{tabular}
+ \group_end:
+ }
+\cs_generate_variant:Nn \ducksay_print:nn { nV }
+\cs_new:Npn \ducksay_prepare_say_and_think:n #1
+ {
+ \int_set:Nn \l_ducksay_msg_width_int { -\c_max_int }
+ \int_set:Nn \l_ducksay_msg_height_int { -\c_max_int }
+ \keys_set:nn { ducksay } { #1 }
+ \tl_if_empty:NT \l_ducksay_animal_tl
+ { \keys_set:nn { ducksay } { default_animal } }
+ }
+\NewDocumentCommand \ducksay { O{} m }
+ {
+ \group_begin:
+ \tl_set:Nn \l_ducksay_say_or_think_tl { say }
+ \ducksay_prepare_say_and_think:n { #1 }
+ \ducksay_print:nV { #2 } \l_ducksay_rel_align_tl
+ \group_end:
+ }
+\NewDocumentCommand \duckthink { O{} m }
+ {
+ \group_begin:
+ \tl_set:Nn \l_ducksay_say_or_think_tl { think }
+ \ducksay_prepare_say_and_think:n { #1 }
+ \ducksay_print:nV { #2 } \l_ducksay_rel_align_tl
+ \group_end:
+ }
+%%
+%%
+%% End of file `ducksay.code.v1.tex'.