| 1 |
% \iffalse meta-comment |
| 2 |
% Copyright (C) 2023 |
| 3 |
% by Phelype Oleinik <[email protected]> |
| 4 |
% Paulo Cereda <[email protected]> |
| 5 |
% samcarter <[email protected]> |
| 6 |
% and Ulrike Fischer <[email protected]> |
| 7 |
% |
| 8 |
% This work may be distributed and/or modified under the conditions of |
| 9 |
% the LaTeX Project Public License, either version 1.3c of this license |
| 10 |
% or (at your option) any later version. The latest version of this |
| 11 |
% license is in |
| 12 |
% |
| 13 |
% http://www.latex-project.org/lppl.txt |
| 14 |
% |
| 15 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 16 |
% version 2005/12/01 or later. |
| 17 |
% |
| 18 |
% This work is "maintained" (as per the LPPL maintenance status) |
| 19 |
% by Phelype Oleinik, Paulo Cereda, samcarter and Ulrike Fischer. |
| 20 |
% |
| 21 |
%<*package> |
| 22 |
\def\sillypageDate{2024-07-23} |
| 23 |
\def\sillypageVersion{1.7} |
| 24 |
%</package> |
| 25 |
%<*driver> |
| 26 |
\documentclass[a4paper,full]{l3doc} |
| 27 |
\usepackage[T1]{fontenc} |
| 28 |
\usepackage{tgbonum} |
| 29 |
\usepackage[scaled=.85]{beramono} |
| 30 |
\usepackage{sillypage} |
| 31 |
\usepackage{hyperref} |
| 32 |
\begin{document} |
| 33 |
\DocInput{\jobname.dtx} |
| 34 |
\end{document} |
| 35 |
%</driver> |
| 36 |
% \fi |
| 37 |
% |
| 38 |
% \GetFileInfo{\jobname.sty} |
| 39 |
% |
| 40 |
% \title{^^A |
| 41 |
% The \pkg{sillypage} package^^A |
| 42 |
% \thanks{This file has version number \sillypageVersion, |
| 43 |
% last revised \sillypageDate.} |
| 44 |
% } |
| 45 |
% |
| 46 |
% \author{^^A |
| 47 |
% Phelype \emph{lemon curry} Oleinik\thanks |
| 48 |
% {^^A |
| 49 |
% E-mail: |
| 50 |
% \href{mailto:[email protected]} |
| 51 |
% {phelype.oleinik\meta{at}latex-project.org}^^A |
| 52 |
% }\\ |
| 53 |
% Paulo \emph{dictates a letter} Cereda\thanks |
| 54 |
% {^^A |
| 55 |
% E-mail: |
| 56 |
% \href{mailto:[email protected]} |
| 57 |
% {cereda.paulo\meta{at}gmail.com}^^A |
| 58 |
% }\\ |
| 59 |
% samcarter \emph{cheesy comestibles}\thanks |
| 60 |
% {^^A |
| 61 |
% E-mail: |
| 62 |
% \href{mailto:[email protected]} |
| 63 |
% {sam.carter8\meta{at}aol.com}^^A |
| 64 |
% }\\ |
| 65 |
% Ulrike \emph{flying lessons} Fischer\thanks |
| 66 |
% {^^A |
| 67 |
% E-mail: |
| 68 |
% \href{mailto:[email protected]} |
| 69 |
% {fischer\meta{at}troubleshooting-tex.de}^^A |
| 70 |
% }^^A |
| 71 |
% } |
| 72 |
% |
| 73 |
% \date{Released \sillypageDate} |
| 74 |
% \pagenumbering{silly} |
| 75 |
% |
| 76 |
% \maketitle |
| 77 |
% |
| 78 |
% \begin{documentation} |
| 79 |
% |
| 80 |
% \section{Introduction} |
| 81 |
% |
| 82 |
% This package is inspired by \emph{The Ministry of Silly Walks}, a famous |
| 83 |
% sketch from Monty Python. According to the corresponding |
| 84 |
% \href{https://bit.ly/33jKsl1}{Wikipedia article}: |
| 85 |
% |
| 86 |
% \begin{quotation} |
| 87 |
% The sketch as originally depicted in the series begins with John Cleese |
| 88 |
% playing Mr.~Teabag, a civil servant who, after purchasing The Times |
| 89 |
% from the newsagent in the previous sketch, walks through the streets |
| 90 |
% of London (at the crossing of Thorpebank Road and Dunraven Road) in a |
| 91 |
% very peculiar manner. He eventually arrives at his place of business: |
| 92 |
% The Ministry of Silly Walks, on the northern end of Whitehall. In the |
| 93 |
% hallway, he passes other employees all exhibiting their own silly walks |
| 94 |
% before arriving at his office. Once there, he finds Mr.~Putey (Michael |
| 95 |
% Palin) waiting for him and apologizes for the delay, explaining that |
| 96 |
% his walk has become particularly silly of late and it takes longer for |
| 97 |
% him to reach his destination. |
| 98 |
% \end{quotation} |
| 99 |
% |
| 100 |
% So we decided to bring this masterpiece of British pop culture to |
| 101 |
% the \TeX{} world through a silly page numbering style. Make sure to |
| 102 |
% use this package in your thesis, it will be a success. |
| 103 |
% |
| 104 |
% \section{Usage} |
| 105 |
% |
| 106 |
% Using a silly package like this is quite straighforward! For starters, |
| 107 |
% make sure to include it in your document preamble through |
| 108 |
% |
| 109 |
% \begin{verbatim} |
| 110 |
% \usepackage{sillypage} |
| 111 |
% \end{verbatim} |
| 112 |
% |
| 113 |
% \noindent and that is it! The available interface is as follows: |
| 114 |
% |
| 115 |
% \begin{function}{\pagenumbering{silly}} |
| 116 |
% \begin{syntax} |
| 117 |
% \cs{pagenumbering}\{silly\} |
| 118 |
% \end{syntax} |
| 119 |
% Write \cs{pagenumbering}|{silly}| in your document to use the page |
| 120 |
% numbering style defined by this package. According to Wikipedia, |
| 121 |
% the typical silly walk gait consists of twelve specific steps to |
| 122 |
% be performed, so page numbering will cycle through these steps, |
| 123 |
% in an kineograph fashion. |
| 124 |
% \end{function} |
| 125 |
% |
| 126 |
% \begin{function}{\silly} |
| 127 |
% \begin{syntax} |
| 128 |
% \cs{silly} \Arg{counter} |
| 129 |
% \end{syntax} |
| 130 |
% Use the macro \cs{silly} on a \LaTeX{} \meta{counter} to typeset the |
| 131 |
% corresponding image for the value of that counter. As noted above, |
| 132 |
% the value will be mapped to an image in the silly walk cycle. Also, |
| 133 |
% observe that this macro is applied to counters and not to integers. |
| 134 |
% \end{function} |
| 135 |
% |
| 136 |
% \begin{function}{\sillystep} |
| 137 |
% \begin{syntax} |
| 138 |
% \cs{sillystep} \Arg{integer} |
| 139 |
% \end{syntax} |
| 140 |
% Prints the step number \meta{integer} from the sequence of steps. |
| 141 |
% This macro works exactly like \cs{silly}, but on integers instead |
| 142 |
% of counters. The integer value will be mapped to an image in the |
| 143 |
% silly walk cycle. |
| 144 |
% \end{function} |
| 145 |
% |
| 146 |
% \begin{function}{\pagenumbering{sillynumeral}} |
| 147 |
% \begin{syntax} |
| 148 |
% \cs{pagenumbering}\{sillynumeral\} |
| 149 |
% \end{syntax} |
| 150 |
% Write \cs{pagenumbering}|{sillynumeral}| in your document to use a |
| 151 |
% silly numeral system, in which each page will be converted to a unique |
| 152 |
% composition of silly steps. Note that this macro differs from its |
| 153 |
% \cs{silly} counterpart, as the former is a proper base 12 numeral |
| 154 |
% system whereas the latter simply walks through a 12-cycle silly routine. |
| 155 |
% \end{function} |
| 156 |
% |
| 157 |
% \begin{function}{\sillynumeral} |
| 158 |
% \begin{syntax} |
| 159 |
% \cs{sillynumeral} \Arg{integer} |
| 160 |
% \end{syntax} |
| 161 |
% Provides the silly numeral system representation from the provided |
| 162 |
% \meta{integer} value. This is a proper base 12 numeral system. |
| 163 |
% \end{function} |
| 164 |
% |
| 165 |
% \bigskip |
| 166 |
% |
| 167 |
% What a silly yet marvellous interface! |
| 168 |
% |
| 169 |
% \section{A sample document} |
| 170 |
% |
| 171 |
% As a means to demonstrate how straightforward (and of course silly) our package |
| 172 |
% is, here is a minimal working example: |
| 173 |
% |
| 174 |
% \begin{verbatim} |
| 175 |
% \documentclass{article} |
| 176 |
% |
| 177 |
% \usepackage{sillypage} |
| 178 |
% \usepackage{blindtext} |
| 179 |
% |
| 180 |
% \begin{document} |
| 181 |
% \pagenumbering{silly} |
| 182 |
% \Blinddocument |
| 183 |
% \end{document} |
| 184 |
% \end{verbatim} |
| 185 |
% |
| 186 |
% After compiling it, take a look at the page numbering: you will be greeted with |
| 187 |
% the silly walk routine! To impress your supervisor, use our package in your thesis, |
| 188 |
% print it and ask them to view those pages in quick succession, so the images appear |
| 189 |
% to animate by simulating motion! It is known to work with thesis committees as well. |
| 190 |
% |
| 191 |
% \section{The silly walk routine} |
| 192 |
% |
| 193 |
% This is the complete silly walk routine as described by Jazeen Hollings in the |
| 194 |
% \href{https://bit.ly/3fc9x46}{corresponding Wikipedia article}. |
| 195 |
% Please note that the |
| 196 |
% images used in this package are created by samcarter and released under |
| 197 |
% the \href{https://creativecommons.org/licenses/by-sa/4.0/}{CC BY-SA 4.0} license and the |
| 198 |
% \href{http://www.latex-project.org/lppl.txt}{LaTeX Project Public License} 1.3c or later. |
| 199 |
% Image sources (vector format) are available in the |
| 200 |
% \href{https://github.com/cereda/sillypage}{package repository}. |
| 201 |
% |
| 202 |
% \bigskip |
| 203 |
% |
| 204 |
% \makeatletter |
| 205 |
% {\centering |
| 206 |
% \def\do#1{\ifnum#1>\silly@steps\else |
| 207 |
% \sillystep{#1} |
| 208 |
% \expandafter\do\expandafter{%^^A |
| 209 |
% \number\numexpr#1+1\relax}\fi}\do{1}\par} |
| 210 |
% \makeatother |
| 211 |
% |
| 212 |
% \bigskip |
| 213 |
% |
| 214 |
% We also recommend Pilates, or any other physical fitness system. |
| 215 |
% |
| 216 |
% \end{documentation} |
| 217 |
% |
| 218 |
% \begin{implementation} |
| 219 |
% |
| 220 |
% \section{Implementation details} |
| 221 |
% |
| 222 |
% The implementation is quite straightforward. Feel free to contact us for |
| 223 |
% suggestions and criticism, code improvements and of course other silly |
| 224 |
% walk variants. |
| 225 |
% |
| 226 |
% \begin{macrocode} |
| 227 |
%<*package> |
| 228 |
%<@@=silly> |
| 229 |
% \end{macrocode} |
| 230 |
% |
| 231 |
% \subsection{Package requirements} |
| 232 |
% |
| 233 |
% \begin{macrocode} |
| 234 |
\ProvidesExplPackage |
| 235 |
{sillypage} {\sillypageDate} {\sillypageVersion} |
| 236 |
{The silly walk as page numbering style} |
| 237 |
\RequirePackage{graphicx} |
| 238 |
% \end{macrocode} |
| 239 |
% |
| 240 |
% \subsection{Picture-specific macros} |
| 241 |
% |
| 242 |
% \begin{macro}[int]{ |
| 243 |
% \silly@steps, |
| 244 |
% \silly@picture, |
| 245 |
% \silly@height} |
| 246 |
% \begin{macrocode} |
| 247 |
\newcommand*\silly@steps{12} |
| 248 |
\newcommand*\silly@height{.8cm} |
| 249 |
\newcommand*\silly@picture{sillywalk-map.pdf} |
| 250 |
% \end{macrocode} |
| 251 |
% \end{macro} |
| 252 |
% |
| 253 |
% \subsection{Single step macros} |
| 254 |
% |
| 255 |
% \begin{macro}{\silly,\sillystep} |
| 256 |
% \begin{macro}[int]{\@silly} |
| 257 |
% \begin{macro}{\@@_step:n} |
| 258 |
% \begin{macrocode} |
| 259 |
\NewDocumentCommand \silly { m } { \exp_args:Nv \@@_step:n { c@#1 } } |
| 260 |
\NewDocumentCommand \sillystep { m } { \@@_step:n {#1} } |
| 261 |
\newcommand*\@silly { \@@_step:n } |
| 262 |
\cs_new:Npn \@@_step:n #1 |
| 263 |
{ |
| 264 |
\UseTaggingSocket{@@/begin}{#1} |
| 265 |
\SuspendTagging{@@} |
| 266 |
\@@_step_aux:eN |
| 267 |
{ \int_eval:n { \int_mod:nn { #1-1 } { \silly@steps } +1 } } |
| 268 |
\c_false_bool |
| 269 |
\ResumeTagging{@@} |
| 270 |
\UseTaggingSocket{@@/end} |
| 271 |
} |
| 272 |
% \end{macrocode} |
| 273 |
% \end{macro} |
| 274 |
% \end{macro} |
| 275 |
% \end{macro} |
| 276 |
% |
| 277 |
% \subsection{Multi step macros} |
| 278 |
% |
| 279 |
% \begin{macro}{\sillynumeral} |
| 280 |
% \begin{macro}[int]{\@sillynumeral} |
| 281 |
% \begin{macro}{\@@_numeral:n,\@@_numeral_aux:n} |
| 282 |
% \begin{macrocode} |
| 283 |
\NewDocumentCommand \sillynumeral { m } { \@@_numeral:n {#1} } |
| 284 |
\newcommand*\@sillynumeral { \@@_numeral:n } |
| 285 |
\cs_new:Npn \@@_numeral:n #1 |
| 286 |
{ |
| 287 |
\UseTaggingSocket{@@/begin}{#1} |
| 288 |
\SuspendTagging{@@} |
| 289 |
\exp_args:Ne \str_map_function:nN |
| 290 |
{ \int_to_base:nn {#1} { 12 } } \@@_numeral_aux:n |
| 291 |
\ResumeTagging{@@} |
| 292 |
\UseTaggingSocket{@@/end} |
| 293 |
} |
| 294 |
\cs_new:Npn \@@_numeral_aux:n #1 |
| 295 |
{ \@@_step_aux:eN { "\char_uppercase:N #1+1 } \c_true_bool } |
| 296 |
% \end{macrocode} |
| 297 |
% \end{macro} |
| 298 |
% \end{macro} |
| 299 |
% \end{macro} |
| 300 |
% |
| 301 |
% \subsection{Tagging Support} |
| 302 |
|
| 303 |
% \begin{macrocode} |
| 304 |
\NewSocket{tagsupport/@@/begin}{1} |
| 305 |
\NewSocket{tagsupport/@@/end}{0} |
| 306 |
\NewSocketPlug{tagsupport/@@/begin}{tagged} |
| 307 |
{ |
| 308 |
\mode_leave_vertical: |
| 309 |
\tag_mc_end_push: |
| 310 |
\tag_struct_begin:n {tag=Span} |
| 311 |
\tag_mc_begin:n {actualtext=#1} |
| 312 |
} |
| 313 |
\NewSocketPlug{tagsupport/@@/end}{tagged} |
| 314 |
{ |
| 315 |
\tag_mc_end: |
| 316 |
\tag_struct_end: |
| 317 |
\tag_mc_begin_pop:n{} |
| 318 |
} |
| 319 |
\AssignSocketPlug{tagsupport/@@/begin}{tagged} |
| 320 |
\AssignSocketPlug{tagsupport/@@/end}{tagged} |
| 321 |
% \end{macrocode} |
| 322 |
% |
| 323 |
% \subsection{Internals} |
| 324 |
% |
| 325 |
% \begin{macro}{\@@_step_aux:nN,\@@_step_aux:eN,\@@_trim_step:nN} |
| 326 |
% \begin{macrocode} |
| 327 |
\cs_new:Npn \@@_step_aux:nN #1 #2 |
| 328 |
{ |
| 329 |
\cs_if_exist_use:cF { texorpdfstring } { \use_i:nn } |
| 330 |
{ \@@_trim_step:nN {#1} #2 } |
| 331 |
{#1} |
| 332 |
} |
| 333 |
\cs_generate_variant:Nn \@@_step_aux:nN { e } |
| 334 |
\cs_new:Npn \@@_trim_step:nN #1 #2 |
| 335 |
{ |
| 336 |
%<@@=> |
| 337 |
\exp_args:Nee \@@silly@place@picture@@nn |
| 338 |
{ |
| 339 |
\bool_if:NT #2 |
| 340 |
{ |
| 341 |
trim = \int_case:nn {#1} |
| 342 |
{ |
| 343 |
{ 1 } { 57 ~ 0 ~ 42 ~ 0 } |
| 344 |
{ 2 } { 59 ~ 0 ~ 29 ~ 0 } |
| 345 |
{ 3 } { 53 ~ 0 ~ 21 ~ 0 } |
| 346 |
{ 4 } { 62 ~ 0 ~ 11 ~ 0 } |
| 347 |
{ 5 } { 50 ~ 0 ~ 8 ~ 0 } |
| 348 |
{ 6 } { 33 ~ 0 ~ 27 ~ 0 } |
| 349 |
{ 7 } { 45 ~ 0 ~ 13 ~ 0 } |
| 350 |
{ 8 } { 56 ~ 0 ~ 27 ~ 0 } |
| 351 |
{ 9 } { 38 ~ 0 ~ 12 ~ 0 } |
| 352 |
{ 10 } { 7 ~ 0 ~ 43 ~ 0 } |
| 353 |
{ 11 } { 33 ~ 0 ~ 33 ~ 0 } |
| 354 |
{ 12 } { 57 ~ 0 ~ 7 ~ 0 } |
| 355 |
} |
| 356 |
, clip |
| 357 |
} |
| 358 |
} |
| 359 |
{ \int_eval:n {#1} } |
| 360 |
} |
| 361 |
% \end{macrocode} |
| 362 |
% \end{macro} |
| 363 |
% |
| 364 |
% \begin{macro}[int]{\@@silly@place@picture@@nn} |
| 365 |
% \begin{macrocode} |
| 366 |
\DeclareRobustCommand \@@silly@place@picture@@nn [2] |
| 367 |
{ |
| 368 |
\includegraphics |
| 369 |
[ #1, page=#2, height=\silly@height ] |
| 370 |
{ \silly@picture } |
| 371 |
} |
| 372 |
\AtBeginDocument |
| 373 |
{ |
| 374 |
\cs_if_exist_use:NF \pdfstringdefDisableCommands { \use_none:n } |
| 375 |
{ \cs_set:Npn \@@silly@place@picture@@nn #1 #2 {#2} } |
| 376 |
} |
| 377 |
\DeclareHookRule { begindocument } |
| 378 |
{ sillypage } { after } { hyperref } |
| 379 |
% \end{macrocode} |
| 380 |
% \end{macro} |
| 381 |
% |
| 382 |
% \begin{macrocode} |
| 383 |
%</package> |
| 384 |
% \end{macrocode} |
| 385 |
% |
| 386 |
% \end{implementation} |
| 387 |
% |
| 388 |
\endinput |