diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/duckuments/duckuments.sty | 259 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/duckuments/example-image-duck-portrait.pdf | bin | 272737 -> 291547 bytes | |||
-rw-r--r-- | Master/texmf-dist/tex/latex/duckuments/example-image-duck.pdf | bin | 278614 -> 280685 bytes |
3 files changed, 144 insertions, 115 deletions
diff --git a/Master/texmf-dist/tex/latex/duckuments/duckuments.sty b/Master/texmf-dist/tex/latex/duckuments/duckuments.sty index 7cadc5ca753..89e69d1cb26 100644 --- a/Master/texmf-dist/tex/latex/duckuments/duckuments.sty +++ b/Master/texmf-dist/tex/latex/duckuments/duckuments.sty @@ -33,36 +33,13 @@ %% \RequirePackage{xparse}[2019-05-03] \RequirePackage{letltxmacro,l3keys2e} -\def\duckuments@version{0.4e} -\def\duckuments@date{2019-09-28} +\def\duckuments@version{0.5} +\def\duckuments@date{2019-10-03} \ProvidesExplPackage {duckuments} {\duckuments@date} {\duckuments@version} {minimal working duckuments} -\bool_if:nF - { - \sys_if_engine_luatex_p: - || \sys_if_engine_pdftex_p: - || \sys_if_engine_xetex_p: - } - {%>>> - \msg_new:nnnn { duckuments } { incompatible } - { - The~duckuments~package~is~currently~only~compatible~with~pdfTeX,~ - LuaTeX,~and~XeTeX! - } - { - \ ~_____________________________\\ - \ (Quack!~Sorry~for~that.~Quack!)\\ - \ ~"""""""""""""""""""""""""""""\\ - \ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ \ ~\ ~\ ~\ ~\string\ \\ - \ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ \ ~\ ~\ ~\ ~\ ~>()_\\ - \ \ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ \ ~\ ~\ ~\ ~\ ~\ ~(__)__ - } - \msg_error:nn { duckuments } { incompatible } - \endinput - }%<<< \file_if_exist:nF { example-image-duck.pdf } - {%>>> + {%>>= \str_if_eq:VnF \c_sys_jobname_str { example-image-duck } { \msg_new:nnnn { duckuments } { missing~file } @@ -82,9 +59,9 @@ in~the~current~working~directory. } } - }%<<< + }%=<< \file_if_exist:nF { example-image-duck-portrait.pdf } - {%>>> + {%>>= \str_if_eq:VnF \c_sys_jobname_str { example-image-duck-portrait } { \msg_if_exist:nnF { duckuments } { missing~file } @@ -107,7 +84,7 @@ in~the~current~working~directory. } } - }%<<< + }%=<< \newcommand*\duckuments@randoms{128} \bool_new:N \l_duckuments_immediate_bool \bool_new:N \l_duckuments_toc_bool @@ -120,13 +97,82 @@ \int_new:N \g_duckuments_blindduck_end_int \regex_const:Nn \c_duckuments_example_regex { - example-image-duck + example-image-duck |example-image-duck.pdf |example-image-duck-portrait |example-image-duck-portrait.pdf } \regex_const:Nn \c_duckuments_range_regex { (\d+|\d+-|-\d+|\d+-\d+|-) } \int_const:Nn \c_duckuments_blindduck_pars_int { 5 } +\sys_if_engine_pdftex:T + { + \cs_new_protected:Npn \duckuments_set_to_pdf_page_count:Nn #1 #2 + { + \group_begin: + \pdfximage { #2 } + \exp_args:NNNo + \group_end: + \int_set:Nn #1 { \the \pdflastximagepages } + } + } +\sys_if_engine_luatex:T + { + \cs_new_protected:Npn \duckuments_set_to_pdf_page_count:Nn #1 #2 + { + \group_begin: + \saveimageresource { #2 } + \exp_args:NNNo + \group_end: + \int_set:Nn #1 { \lastsavedimageresourcepages } + } + } +\sys_if_engine_xetex:T + { + \cs_new_protected:Npn \duckuments_set_to_pdf_page_count:Nn #1 #2 + { + \int_set:Nn #1 { \XeTeXpdfpagecount " #2 " } + } + } +\bool_lazy_any:nTF + { + { \sys_if_engine_luatex_p: } + { \sys_if_engine_pdftex_p: } + { \sys_if_engine_xetex_p: } + } + { \if_false: } + { \if_true: } + \group_begin: + \char_set_catcode_other:N \% + \cs_new_protected:Npn \duckuments_set_to_pdf_page_count:Nn #1 #2 + { + \group_begin: + \char_set_catcode_other:N \% + \char_set_catcode_letter:N \: + \char_set_catcode_ignore:n { 32 } + \ior_shell_open:Nn \g_tmpa_ior { extractbb ~ -O ~ #2 } + \ior_map_inline:Nn \g_tmpa_ior + { + \__duckuments_set_to_pdf_page_count_aux_a:w ##1 %%Pages: \q_stop + } + \ior_close:N \g_tmpa_ior + \exp_args:NNNo + \group_end: + \int_set:Nn #1 { \int_use:N \l_tmpa_int } + } + \cs_new_protected:Npn \__duckuments_set_to_pdf_page_count_aux_a:w + #1 %%Pages: #2 \q_stop + { + \tl_if_empty:nT { #1 } + { \__duckuments_set_to_pdf_page_count_aux_b:w #2 \q_stop } + } + \cs_new_protected:Npn \__duckuments_set_to_pdf_page_count_aux_b:w + #1 %%Pages: \q_stop + { + \int_set:Nn \l_tmpa_int { #1 } + \ior_map_break: + } + \group_end: +\fi: \bool_if:nTF { \str_if_eq_p:Vn \c_sys_jobname_str { example-image-duck } @@ -135,27 +181,10 @@ { \int_const:Nn \c_duckuments_example_pages_int { \c_one_int } } { \group_begin: - \sys_if_engine_pdftex:T - { - \pdfximage{example-image-duck.pdf} - \int_set:Nn \l_tmpa_int { \the\pdflastximagepages } - \pdfximage{example-image-duck-portrait.pdf} - \int_set:Nn \l_tmpb_int { \the\pdflastximagepages } - } - \sys_if_engine_luatex:T - { - \saveimageresource{example-image-duck.pdf} - \int_set:Nn \l_tmpa_int { \lastsavedimageresourcepages } - \saveimageresource{example-image-duck-portrait.pdf} - \int_set:Nn \l_tmpb_int { \lastsavedimageresourcepages } - } - \sys_if_engine_xetex:T - { - \int_set:Nn \l_tmpa_int - { \XeTeXpdfpagecount "example-image-duck.pdf" } - \int_set:Nn \l_tmpb_int - { \XeTeXpdfpagecount "example-image-duck-portrait.pdf" } - } + \duckuments_set_to_pdf_page_count:Nn \l_tmpa_int + { example-image-duck.pdf } + \duckuments_set_to_pdf_page_count:Nn \l_tmpb_int + { example-image-duck-portrait.pdf } \int_const:Nn \c_duckuments_example_pages_int { \int_min:nn { \l_tmpa_int } { \l_tmpb_int } } \group_end: @@ -200,7 +229,7 @@ \ \ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~\ ~(__)__ } \cs_new:Npn \duckuments_patch_see_duckumentation: - {%>>> + {%>>= \cs_set:Nn \msg_see_documentation_text:n { \\\\ @@ -210,10 +239,10 @@ documentation }~for~further~information. } - }%<<< + }%=<< \duckuments_patch_see_duckumentation: \keys_define:nn { duckuments } - {%>>> + {%>>= ,immediate .bool_set:N = \l_duckuments_immediate_bool ,immediate .default:n = true ,full .code:n = @@ -247,20 +276,20 @@ ,toc .default:n = true ,unknown .code:n = { \msg_error:nnx { duckuments } { option~unknown } { \l_keys_key_tl } } - }%<<< + }%=<< \ProcessKeysOptions { duckuments } \keys_define:nn { duckuments } - {%>>> + {%>>= ,toc .undefine: ,toc .bool_set:N = \l_duckuments_toc_bool ,toc .default:n = true ,unknown .code:n = \duckuments_blindduck_range_test:V \l_keys_key_tl - }%<<< + }%=<< \bool_if:NTF \l_duckuments_immediate_bool { \AtEndOfPackage { \duckuments_patch_includegraphics: } } { \AtBeginDocument { \duckuments_patch_includegraphics: } } \NewDocumentCommand \duckument { O{} } - {%>>> + {%>>= \group_begin: \keys_set:nn { duckuments } { #1 } \bool_if:NT \l_duckuments_toc_bool { \tableofcontents } @@ -275,17 +304,17 @@ \duckuments_list_example:n { enumerate } \duckuments_list_example:n { description } \group_end: - }%<<< + }%=<< \NewDocumentCommand \blindduck { O{} } - {%>>> + {%>>= \group_begin: \keys_set:nn { duckuments } { #1 } \duckuments@blindduck@text \bool_if:NT \l_duckuments_blindduck_pars_bool { \par } \group_end: - }%<<< + }%=<< \NewDocumentCommand \ducklist {s m} - {%>>> + {%>>= \begin{#2} \IfBooleanTF { #1 } {\ducklists@content@starred} @@ -295,9 +324,9 @@ \ducklists@content } \end{#2} - }%<<< + }%=<< \NewDocumentCommand \ducklistlist { s m } - {%>>> + {%>>= \IfBooleanTF { #1 } { \duckuments@listlist@starred { #2 } } { @@ -305,12 +334,12 @@ { \duckuments@listlist@starred { description } } { \duckuments@listlist{#2} } } - }%<<< + }%=<< \newcommand*\duckenumerate{\ducklist{enumerate}} \newcommand*\duckitemize{\ducklist{itemize}} \newcommand*\duckdescription{\ducklist{description}} \newcommand*\duckumentsCreateExampleFiles - {%>>> + {%>>= \iow_new:N \duckuments_example_file_iow \iow_open:Nn \duckuments_example_file_iow { example-image-duck.tex } \iow_now:Nn \duckuments_example_file_iow @@ -341,15 +370,15 @@ \iow_now:Nn \duckuments_example_file_iow { \end{document} } \iow_close:N \duckuments_example_file_iow - }%<<< + }%=<< \newcommand*\duckumentsDrawRandomDucks - {%>>> + {%>>= \@ifstar {\duckumentsDrawRandomDucks@portrait} {\duckumentsDrawRandomDucks@landscape}% - }%<<< + }%=<< \newcommand*\duckuments@headings[1] - {%>>> + {%>>= \ifcase#1\relax \expandafter\chapter \or \expandafter\section @@ -359,9 +388,9 @@ \else \expandafter\@gobble \fi {\duckuments@headings@text{#1}} - }%<<< + }%=<< \newcommand*\duckuments@headings@level[1] - {%>>> + {%>>= ( \ifcase#1 chapter @@ -371,20 +400,20 @@ \or paragraph \fi ) - }%<<< + }%=<< \newcommand*\duckuments@ifinline[2][] { \bool_if:NTF \l_duckuments_math_inline_bool { #2 } { #1 } } \newcommand*\duckuments@ifdisplay[2][] { \bool_if:NTF \l_duckuments_math_display_bool { #2 } { #1 } } \cs_new_protected_nopar:Npn \duckuments_list_example:n #1 - {%>>> + {%>>= \subsection{Example\ for\ ducks\ (#1)} \ducklist { #1 } \subsubsection{Nested\ ducks} \ducklistlist { #1 } - }%<<< + }%=<< \NewDocumentCommand \duckuments@enquote { s +m } - {%>>> + {%>>= \IfBooleanTF { #1 } { \cs_if_exist_use:NTF @@ -396,19 +425,19 @@ \enquote { { #2 } } {``#2''} } - }%<<< + }%=<< \newcommand*\duckumentsDrawRandomDucks@landscape[1][\duckuments@randoms] - {%>>> + {%>>= \foreach\x in {1,2,...,#1} {\duckumentsDrawRandomDucks@draw{6.47214}{4}{3.23607}{2}} - }%<<< + }%=<< \newcommand*\duckumentsDrawRandomDucks@portrait[1][\duckuments@randoms] - {%>>> + {%>>= \foreach\x in {1,2,...,#1} {\duckumentsDrawRandomDucks@draw{1.8541}{3}{.92705}{1.5}} - }%<<< + }%=<< \newcommand*\duckumentsDrawRandomDucks@draw[4] - {%>>> + {%>>= \begin{tikzpicture} \draw[fill=gray!50,use~as~bounding~box] (0,0) rectangle (#1,#2); \draw[gray,thin] (0,0) -- (#1,#2); @@ -418,9 +447,9 @@ \node at (#3,#4) {\tikz\randuck;}; \draw[black] (0,0) rectangle (#1,#2); \end{tikzpicture} - }%<<< + }%=<< \cs_new_protected_nopar:Npn \duckuments_patch_includegraphics: - {%>>> + {%>>= \@ifpackageloaded { graphicx } { \LetLtxMacro\duckuments@includegraphicsBAK\includegraphics @@ -443,9 +472,9 @@ } } {} - }%<<< + }%=<< \cs_new_protected:Npn \duckuments_blindduck_range_test:n #1 - {%>>> + {%>>= \regex_match:NnTF \c_duckuments_range_regex { #1 } { \seq_set_split:Nnn \l_duckuments_range_seq { - } { #1 } @@ -487,25 +516,25 @@ \exp_args:NnnV \msg_error:nnn { duckuments } { option~unknown } \l_keys_key_tl } - }%<<< + }%=<< \cs_generate_variant:Nn \duckuments_blindduck_range_test:n { V } \cs_new:Npn \duckuments_blindduck_set_text:nn #1 #2 - {%>>> + {%>>= \def \duckuments@blindduck@text { \int_step_function:nnnN { #1 } { \c_one_int } { #2 } \duckuments_blindduck_par_loop:n \duckuments_blindduck_set_next_start:n { #2 } } - }%<<< + }%=<< \cs_generate_variant:Nn \duckuments_blindduck_set_text:nn { xx } \cs_new:Npn \duckuments_blindduck_set_next_start:n #1 - {%>>> + {%>>= \int_gset:Nn \g_duckuments_blindduck_start_int { \int_mod:nn { #1 } { \c_duckuments_blindduck_pars_int } + \c_one_int } - }%<<< + }%=<< \cs_new:Npn \duckuments_blindduck_single_par:n #1 - {%>>> + {%>>= \bool_if:nTF { \int_compare_p:nNn { #1 } > { \c_duckuments_blindduck_pars_int } @@ -520,24 +549,24 @@ { \use:c { duckuments@blindduck@text@ \int_to_roman:n { #1 } } } - }%<<< + }%=<< \cs_new:Npn \duckuments_blindduck_par_loop:n #1 - {%>>> + {%>>= \duckuments_blindduck_single_par:n { #1 } \par - }%<<< + }%=<< \cs_new_protected:Npn \duckuments_starred:n #1 - {%>>> + {%>>= \IfBooleanTF { #1 } { \def\ProcessedArgument{*} } { \def\ProcessedArgument{} } - }%<<< + }%=<< \cs_new:Npn \duckuments_random_page: { \int_rand:n { \c_duckuments_example_pages_int } } \ExplSyntaxOff \newcommand*\duckuments@blindduck@text{\duckuments@blindduck@text@i} \newcommand*\duckuments@blindduck@text@i - {%>>> + {%>>= There once was a very smart but sadly blind duck. When it was still a small duckling it was renowned for its good vision. But sadly as the duck grew older it caught a sickness which caused its eyesight to worsen. It became so @@ -549,26 +578,26 @@ do its research any longer. It called for its underduckling and said: \duckuments@enquote{Go, find me the best eye ducktor there is. He shall heal me from my disease!}% - }%<<< + }%=<< \newcommand*\duckuments@blindduck@text@ii - {%>>> + {%>>= \duckuments@enquote{But my duck, how are you supposed to manage your daily routines without my visual guidance}, replied the underduckling. The smart duck's face turned grim in anger. \duckuments@enquote{You dare to talk back?} The underduckling blushed ashamed. How could he have objections after his duck gave strict orders? The underduckling was so embarrassed about his own behaviour he had to solve an equation.% - }%<<< + }%=<< \newcommand*\duckuments@blindduck@text@iii - {%>>> + {%>>= After the equation was solved and the underduckling prepared his leave for the next day it fell asleep in a shaky mood. It did not know what the journey had prepared for him and if he was prepared enough for it. His sleep was restless. The dreams he had that night were not calm and bright as they used to be for an innocent underduckling.% - }%<<< + }%=<< \newcommand*\duckuments@blindduck@text@iv - {%>>> + {%>>= Before dawn the underduckling woke. He didn't have the feeling of being well rested. But nonetheless he knew that this was the day he should leave. Except saying goodbye to his beloved ones there was nothing holding him @@ -576,34 +605,34 @@ inexperienced underduckling was ever sent on. He bid farewell to his mother, all his brothers and sisters, and finally from his duck. The bag was shouldered, the boots were tied, the underduckling left.% - }%<<< + }%=<< \newcommand*\duckuments@blindduck@text@v - {%>>> + {%>>= As the underduckling went along he saw a tree. It was so tall he couldn't even approximate its height. Oh, how small he felt. What should he, a small duckling whose plumage was still fluffy, achieve in this vast, gigantic world? He stuck his trembling wings under the straps of his backpack to calm his shaking limbs. Where should he start his search? How should he survive in the hostile nature surrounding the sheltered pond of his community? - }%<<< + }%=<< \newcommand*\duckuments@headings@text[1] {A friendly duck at level #1 \duckuments@headings@level{#1}} \newcommand*\ducklists@content - {%>>> + {%>>= \item First swims father drake \item Then floats mother duck \item After her paddles baby duckling \item And over there bathes uncle canard - }%<<< + }%=<< \newcommand*\ducklists@content@starred - {%>>> + {%>>= \item[drake] is the swimming father \item[duck] is the floating mother \item[duckling] is the paddling baby \item[canard] is the bathing uncle - }%<<< + }%=<< \newcommand*\duckuments@listlist[1] - {%>>> + {%>>= \begin{#1} \item swimming father drake \begin{#1} @@ -620,9 +649,9 @@ \end{#1} \item floating mother duck \end{#1}% - }%<<< + }%=<< \newcommand*\duckuments@listlist@starred[1] - {%>>> + {%>>= \begin{#1} \item[drake] is the swimming father \begin{#1} @@ -639,7 +668,7 @@ \end{#1} \item[duck] is the floating mother \end{#1}% - }%<<< + }%=<< %% %% %% End of file `duckuments.sty'. diff --git a/Master/texmf-dist/tex/latex/duckuments/example-image-duck-portrait.pdf b/Master/texmf-dist/tex/latex/duckuments/example-image-duck-portrait.pdf Binary files differindex ef895dbf687..0371f86663c 100644 --- a/Master/texmf-dist/tex/latex/duckuments/example-image-duck-portrait.pdf +++ b/Master/texmf-dist/tex/latex/duckuments/example-image-duck-portrait.pdf diff --git a/Master/texmf-dist/tex/latex/duckuments/example-image-duck.pdf b/Master/texmf-dist/tex/latex/duckuments/example-image-duck.pdf Binary files differindex 78924c01205..f6e7c99ed6c 100644 --- a/Master/texmf-dist/tex/latex/duckuments/example-image-duck.pdf +++ b/Master/texmf-dist/tex/latex/duckuments/example-image-duck.pdf |