summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-02-02 21:40:47 +0000
committerKarl Berry <karl@freefriends.org>2022-02-02 21:40:47 +0000
commit297b98fd50c6384f0976ed1c69bf77dd7af09bbd (patch)
treebf2656059db1304ca9802ccf058fba0e438e44f9
parent325d58ddb0e00127903273312ad2f951f9ced74c (diff)
sillypage (2feb22)
git-svn-id: svn://tug.org/texlive/trunk@61857 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/sillypage/README.md9
-rw-r--r--Master/texmf-dist/doc/latex/sillypage/sillypage-example.pdfbin103728 -> 103728 bytes
-rw-r--r--Master/texmf-dist/doc/latex/sillypage/sillypage.pdfbin196129 -> 219530 bytes
-rw-r--r--Master/texmf-dist/source/latex/sillypage/sillypage.dtx162
-rw-r--r--Master/texmf-dist/source/latex/sillypage/sillypage.ins8
-rw-r--r--Master/texmf-dist/tex/latex/sillypage/sillypage.sty97
6 files changed, 219 insertions, 57 deletions
diff --git a/Master/texmf-dist/doc/latex/sillypage/README.md b/Master/texmf-dist/doc/latex/sillypage/README.md
index 8a1807f4179..4c00f7756bf 100644
--- a/Master/texmf-dist/doc/latex/sillypage/README.md
+++ b/Master/texmf-dist/doc/latex/sillypage/README.md
@@ -13,6 +13,10 @@ Simply add `\usepackage{sillypage}` to your document. Then:
image for the value of that counter.
- Use the macro `\sillystep` to print the step number `n` from the
sequence of steps.
+- Write `\pagenumbering{sillynumeral}` in you document to use a silly
+ numeral system.
+- Use the macro `\sillynumeral` to get the silly numeral system
+ representation from the provided `n` value.
## A sample document
@@ -32,7 +36,7 @@ Here we go:
## Installation notes
-Just note that `sillywalk-map.png` should go under the `tex/` subtree
+Just note that `sillywalk-map.pdf` should go under the `tex/` subtree
(as it is required by `sillypage.sty`) instead of the `doc/` counterpart.
## Isn't this package too silly?
@@ -41,11 +45,12 @@ Yes.
## Authors
-Blame these three individuals:
+Blame these individuals:
- Phelype Oleinik
- Paulo Cereda
- samcarter
+- Ulrike Fischer
## License
diff --git a/Master/texmf-dist/doc/latex/sillypage/sillypage-example.pdf b/Master/texmf-dist/doc/latex/sillypage/sillypage-example.pdf
index 878dde7288b..bc4284ede83 100644
--- a/Master/texmf-dist/doc/latex/sillypage/sillypage-example.pdf
+++ b/Master/texmf-dist/doc/latex/sillypage/sillypage-example.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/sillypage/sillypage.pdf b/Master/texmf-dist/doc/latex/sillypage/sillypage.pdf
index 9789f40c0ac..6f3533869b3 100644
--- a/Master/texmf-dist/doc/latex/sillypage/sillypage.pdf
+++ b/Master/texmf-dist/doc/latex/sillypage/sillypage.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/sillypage/sillypage.dtx b/Master/texmf-dist/source/latex/sillypage/sillypage.dtx
index 4795c81c03f..18e31a3589d 100644
--- a/Master/texmf-dist/source/latex/sillypage/sillypage.dtx
+++ b/Master/texmf-dist/source/latex/sillypage/sillypage.dtx
@@ -2,7 +2,8 @@
% Copyright (C) 2022
% by Phelype Oleinik <phelype.oleinik@latex-project.org>
% Paulo Cereda <cereda.paulo@gmail.com>
-% and samcarter <sam.carter8@aol.com>
+% samcarter <sam.carter8@aol.com>
+% and Ulrike Fischer <fischer@troubleshooting-tex.de>
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.3c of this license
@@ -15,11 +16,11 @@
% version 2005/12/01 or later.
%
% This work is "maintained" (as per the LPPL maintenance status)
-% by Phelype Oleinik and Paulo Cereda.
+% by Phelype Oleinik, Paulo Cereda, samcarter and Ulrike Fischer.
%
%<*package>
-\def\sillypageDate{2022-01-20}
-\def\sillypageVersion{1.3}
+\def\sillypageDate{2022-02-02}
+\def\sillypageVersion{1.4}
%</package>
%<*driver>
\documentclass[a4paper,full]{l3doc}
@@ -60,6 +61,12 @@
% E-mail:
% \href{mailto:sam.carter8@aol.com}
% {sam.carter8\meta{at}aol.com}^^A
+% }\\
+% Ulrike \emph{flying lessons} Fischer\thanks
+% {^^A
+% E-mail:
+% \href{mailto:fischer@troubleshooting-tex.de}
+% {fischer\meta{at}troubleshooting-tex.de}^^A
% }^^A
% }
%
@@ -136,6 +143,25 @@
% silly walk cycle.
% \end{function}
%
+% \begin{function}{\pagenumbering{sillynumeral}}
+% \begin{syntax}
+% \cs{pagenumbering}\{sillynumeral\}
+% \end{syntax}
+% Write \cs{pagenumbering}|{sillynumeral}| in you document to use a
+% silly numeral system, in which each page will be converted to a unique
+% composition of silly steps. Note that this macro differs from its
+% \cs{silly} counterpart, as the former is a proper base 12 numeral
+% system whereas the latter simply walks through a 12-cycle silly routine.
+% \end{function}
+%
+% \begin{function}{\sillynumeral}
+% \begin{syntax}
+% \cs{sillynumeral} \Arg{integer}
+% \end{syntax}
+% Provides the silly numeral system representation from the provided
+% \meta{integer} value. This is a proper base 12 numeral system.
+% \end{function}
+%
% \bigskip
%
% What a silly yet marvellous interface!
@@ -197,49 +223,127 @@
%
% \begin{macrocode}
%<*package>
+%<@@=silly>
% \end{macrocode}
%
% \subsection{Package requirements}
%
% \begin{macrocode}
-\ProvidesPackage{sillypage}[\sillypageDate\space\sillypageVersion\space
- The silly walk as page numbering style]
+\ProvidesExplPackage
+ {sillypage} {\sillypageDate} {\sillypageVersion}
+ {The silly walk as page numbering style}
\RequirePackage{graphicx}
% \end{macrocode}
%
-% \subsection{Loading}
-% \begin{macro}{\silly,\sillystep}
-% \begin{macro}[int]{\@silly}
-% \begin{macro}{
+% \subsection{Picture-specific macros}
+%
+% \begin{macro}[int]{
% \silly@steps,
% \silly@picture,
% \silly@height}
% \begin{macrocode}
-\newcommand*\silly[1]{\expandafter\@silly\csname c@#1\endcsname}
-\newcommand*\sillystep[1]{\@silly{#1}}
-\newcommand*\@silly[1]{\expandafter\@silly@walk
- \expandafter{\number\numexpr#1\relax}}
-\newcommand*\silly@steps{12}%
-\newcommand*\silly@height{.8cm}%
-\newcommand*\silly@picture{sillywalk-map.pdf}%
+\newcommand*\silly@steps{12}
+\newcommand*\silly@height{.8cm}
+\newcommand*\silly@picture{sillywalk-map.pdf}
% \end{macrocode}
% \end{macro}
+%
+% \subsection{Single step macros}
+%
+% \begin{macro}{\silly,\sillystep}
+% \begin{macro}[int]{\@silly}
+% \begin{macro}{\@@_step:n}
+% \begin{macrocode}
+\NewDocumentCommand \silly { m } { \exp_args:Nv \@@_step:n { c@#1 } }
+\NewDocumentCommand \sillystep { m } { \@@_step:n {#1} }
+\newcommand*\@silly { \@@_step:n }
+\cs_new:Npn \@@_step:n #1
+ {
+ \@@_step_aux:eN
+ { \int_eval:n { \int_mod:nn { #1-1 } { \silly@steps } +1 } }
+ \c_false_bool
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Multi step macros}
+%
+% \begin{macro}{\sillynumeral}
+% \begin{macro}[int]{\@sillynumeral}
+% \begin{macro}{\@@_numeral:n,\@@_numeral_aux:n}
+% \begin{macrocode}
+\NewDocumentCommand \sillynumeral { m } { \@@_numeral:n {#1} }
+\newcommand*\@sillynumeral { \@@_numeral:n }
+\cs_new:Npn \@@_numeral:n #1
+ {
+ \exp_args:Ne \str_map_function:nN
+ { \int_to_base:nn {#1} { 12 } } \@@_numeral_aux:n
+ }
+\cs_new:Npn \@@_numeral_aux:n #1
+ { \@@_step_aux:eN { "\char_uppercase:N #1+1 } \c_true_bool }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
% \end{macro}
+%
+% \subsection{Internals}
+%
+% \begin{macro}{\@@_step_aux:nN,\@@_step_aux:eN,\@@_trim_step:nN}
+% \begin{macrocode}
+\cs_new:Npn \@@_step_aux:nN #1 #2
+ {
+ \cs_if_exist_use:cF { texorpdfstring } { \use_i:nn }
+ { \@@_trim_step:nN {#1} #2 }
+ {#1}
+ }
+\cs_generate_variant:Nn \@@_step_aux:nN { e }
+\cs_new:Npn \@@_trim_step:nN #1 #2
+ {
+%<@@=>
+ \exp_args:Nee \@@silly@place@picture@@nn
+ {
+ \bool_if:NT #2
+ {
+ trim = \int_case:nn {#1}
+ {
+ { 1 } { 57 ~ 0 ~ 42 ~ 0 }
+ { 2 } { 59 ~ 0 ~ 29 ~ 0 }
+ { 3 } { 53 ~ 0 ~ 21 ~ 0 }
+ { 4 } { 62 ~ 0 ~ 11 ~ 0 }
+ { 5 } { 50 ~ 0 ~ 8 ~ 0 }
+ { 6 } { 33 ~ 0 ~ 27 ~ 0 }
+ { 7 } { 45 ~ 0 ~ 13 ~ 0 }
+ { 8 } { 56 ~ 0 ~ 27 ~ 0 }
+ { 9 } { 38 ~ 0 ~ 12 ~ 0 }
+ { 10 } { 7 ~ 0 ~ 43 ~ 0 }
+ { 11 } { 33 ~ 0 ~ 33 ~ 0 }
+ { 12 } { 57 ~ 0 ~ 7 ~ 0 }
+ }
+ , clip
+ }
+ }
+ { \int_eval:n {#1} }
+ }
+% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\@silly@walk,\@silly@walk@}
+% \begin{macro}[int]{\@@silly@place@picture@@nn}
% \begin{macrocode}
-\def\@silly@walk#1{%
- \@ifundefined{texorpdfstring}{\@firstoftwo}{\texorpdfstring}%
- {\@silly@walk@{#1}}% TeX
- {#1}}% pdf string
-\def\@silly@walk@#1{%
- \ifnum#1>\silly@steps\space
- \expandafter\@silly@walk@\expandafter
- {\number\numexpr#1-\silly@steps\expandafter}%
- \else
- \includegraphics[height=\silly@height,page=#1]{\silly@picture}%
- \fi}
+\DeclareRobustCommand \@@silly@place@picture@@nn [2]
+ {
+ \includegraphics
+ [ #1, page=#2, height=\silly@height ]
+ { \silly@picture }
+ }
+\AtBeginDocument
+ {
+ \cs_if_exist_use:NF \pdfstringdefDisableCommands { \use_none:n }
+ { \cs_set:Npn \@@silly@place@picture@@nn #1 #2 {#2} }
+ }
+\DeclareHookRule { begindocument }
+ { sillypage } { after } { hyperref }
% \end{macrocode}
% \end{macro}
%
diff --git a/Master/texmf-dist/source/latex/sillypage/sillypage.ins b/Master/texmf-dist/source/latex/sillypage/sillypage.ins
index 4d85a866a60..8c3f6c6a2db 100644
--- a/Master/texmf-dist/source/latex/sillypage/sillypage.ins
+++ b/Master/texmf-dist/source/latex/sillypage/sillypage.ins
@@ -2,7 +2,8 @@
%% Copyright (C) 2022
%% by Phelype Oleinik <phelype.oleinik@latex-project.org>
%% Paulo Cereda <cereda.paulo@gmail.com>
-%% and samcarter <sam.carter8@aol.com>
+%% samcarter <sam.carter8@aol.com>
+%% and Ulrike Fischer <fischer@troubleshooting-tex.de>
%%
%% This work may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3c of this license
@@ -15,7 +16,7 @@
%% version 2005/12/01 or later.
%%
%% This work is "maintained" (as per the LPPL maintenance status)
-%% by Phelype Oleinik, Paulo Cereda and samcarter.
+%% by Phelype Oleinik, Paulo Cereda, samcarter and Ulrike Fischer.
%%
\def\projectname{sillypage}%
\def\nameofplainTeX{plain}%
@@ -35,6 +36,7 @@ This is a generated file.
Copyright 2022 Phelype Oleinik /phelype.oleinik@latex-project.org/
Paulo Cereda /cereda.paulo@gmail.com/
samcarter /sam.carter8@aol.com/
+ Ulrike Fischer /fischer@troubleshooting-tex.de/
This work may be distributed and/or modified under the conditions of the
LaTeX Project Public License, either version 1.3c of this license or (at
@@ -50,7 +52,7 @@ and version 1.3c or later is part of all distributions of LaTeX version
\postamble
This work is "maintained" (as per the LPPL maintenance status)
-by Phelype Oleinik, Paulo Cereda and samcarter.
+by Phelype Oleinik, Paulo Cereda, samcarter and Ulrike Fischer.
This work consists of the files \projectname.dtx, and
\projectname.ins,
diff --git a/Master/texmf-dist/tex/latex/sillypage/sillypage.sty b/Master/texmf-dist/tex/latex/sillypage/sillypage.sty
index 5bfb15ddb1c..9426f012166 100644
--- a/Master/texmf-dist/tex/latex/sillypage/sillypage.sty
+++ b/Master/texmf-dist/tex/latex/sillypage/sillypage.sty
@@ -11,6 +11,7 @@
%% Copyright 2022 Phelype Oleinik /phelype.oleinik@latex-project.org/
%% Paulo Cereda /cereda.paulo@gmail.com/
%% samcarter /sam.carter8@aol.com/
+%% Ulrike Fischer /fischer@troubleshooting-tex.de/
%%
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
@@ -21,32 +22,82 @@
%% and version 1.3c or later is part of all distributions of LaTeX version
%% 2005/12/01 or later.
%%
-\def\sillypageDate{2022-01-20}
-\def\sillypageVersion{1.3}
-\ProvidesPackage{sillypage}[\sillypageDate\space\sillypageVersion\space
- The silly walk as page numbering style]
+\def\sillypageDate{2022-02-02}
+\def\sillypageVersion{1.4}
+\ProvidesExplPackage
+ {sillypage} {\sillypageDate} {\sillypageVersion}
+ {The silly walk as page numbering style}
\RequirePackage{graphicx}
-\newcommand*\silly[1]{\expandafter\@silly\csname c@#1\endcsname}
-\newcommand*\sillystep[1]{\@silly{#1}}
-\newcommand*\@silly[1]{\expandafter\@silly@walk
- \expandafter{\number\numexpr#1\relax}}
-\newcommand*\silly@steps{12}%
-\newcommand*\silly@height{.8cm}%
-\newcommand*\silly@picture{sillywalk-map.pdf}%
-\def\@silly@walk#1{%
- \@ifundefined{texorpdfstring}{\@firstoftwo}{\texorpdfstring}%
- {\@silly@walk@{#1}}% TeX
- {#1}}% pdf string
-\def\@silly@walk@#1{%
- \ifnum#1>\silly@steps\space
- \expandafter\@silly@walk@\expandafter
- {\number\numexpr#1-\silly@steps\expandafter}%
- \else
- \includegraphics[height=\silly@height,page=#1]{\silly@picture}%
- \fi}
+\newcommand*\silly@steps{12}
+\newcommand*\silly@height{.8cm}
+\newcommand*\silly@picture{sillywalk-map.pdf}
+\NewDocumentCommand \silly { m } { \exp_args:Nv \__silly_step:n { c@#1 } }
+\NewDocumentCommand \sillystep { m } { \__silly_step:n {#1} }
+\newcommand*\@silly { \__silly_step:n }
+\cs_new:Npn \__silly_step:n #1
+ {
+ \__silly_step_aux:eN
+ { \int_eval:n { \int_mod:nn { #1-1 } { \silly@steps } +1 } }
+ \c_false_bool
+ }
+\NewDocumentCommand \sillynumeral { m } { \__silly_numeral:n {#1} }
+\newcommand*\@sillynumeral { \__silly_numeral:n }
+\cs_new:Npn \__silly_numeral:n #1
+ {
+ \exp_args:Ne \str_map_function:nN
+ { \int_to_base:nn {#1} { 12 } } \__silly_numeral_aux:n
+ }
+\cs_new:Npn \__silly_numeral_aux:n #1
+ { \__silly_step_aux:eN { "\char_uppercase:N #1+1 } \c_true_bool }
+\cs_new:Npn \__silly_step_aux:nN #1 #2
+ {
+ \cs_if_exist_use:cF { texorpdfstring } { \use_i:nn }
+ { \__silly_trim_step:nN {#1} #2 }
+ {#1}
+ }
+\cs_generate_variant:Nn \__silly_step_aux:nN { e }
+\cs_new:Npn \__silly_trim_step:nN #1 #2
+ {
+ \exp_args:Nee \@@silly@place@picture@@nn
+ {
+ \bool_if:NT #2
+ {
+ trim = \int_case:nn {#1}
+ {
+ { 1 } { 57 ~ 0 ~ 42 ~ 0 }
+ { 2 } { 59 ~ 0 ~ 29 ~ 0 }
+ { 3 } { 53 ~ 0 ~ 21 ~ 0 }
+ { 4 } { 62 ~ 0 ~ 11 ~ 0 }
+ { 5 } { 50 ~ 0 ~ 8 ~ 0 }
+ { 6 } { 33 ~ 0 ~ 27 ~ 0 }
+ { 7 } { 45 ~ 0 ~ 13 ~ 0 }
+ { 8 } { 56 ~ 0 ~ 27 ~ 0 }
+ { 9 } { 38 ~ 0 ~ 12 ~ 0 }
+ { 10 } { 7 ~ 0 ~ 43 ~ 0 }
+ { 11 } { 33 ~ 0 ~ 33 ~ 0 }
+ { 12 } { 57 ~ 0 ~ 7 ~ 0 }
+ }
+ , clip
+ }
+ }
+ { \int_eval:n {#1} }
+ }
+\DeclareRobustCommand \@@silly@place@picture@@nn [2]
+ {
+ \includegraphics
+ [ #1, page=#2, height=\silly@height ]
+ { \silly@picture }
+ }
+\AtBeginDocument
+ {
+ \cs_if_exist_use:NF \pdfstringdefDisableCommands { \use_none:n }
+ { \cs_set:Npn \@@silly@place@picture@@nn #1 #2 {#2} }
+ }
+\DeclareHookRule { begindocument }
+ { sillypage } { after } { hyperref }
%%
%% This work is "maintained" (as per the LPPL maintenance status)
-%% by Phelype Oleinik, Paulo Cereda and samcarter.
+%% by Phelype Oleinik, Paulo Cereda, samcarter and Ulrike Fischer.
%%
%% This work consists of the files sillypage.dtx, and
%% sillypage.ins,