%%
%% This is file `sillypage.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% sillypage.dtx  (with options: `package')
%% 
%% 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
%% your option) any later version. The latest version of this license is in
%% 
%%     http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of LaTeX version
%% 2005/12/01 or later.
%% 
\def\sillypageDate{2022-02-02}
\def\sillypageVersion{1.4}
\ProvidesExplPackage
  {sillypage} {\sillypageDate} {\sillypageVersion}
  {The silly walk as page numbering style}
\RequirePackage{graphicx}
\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, samcarter and Ulrike Fischer.
%% 
%% This work consists of the files sillypage.dtx, and
%%                                 sillypage.ins,
%% and the derived files           sillypage.sty,
%%                                 sillypage.pdf,
%%                                 sillywalk-map.pdf, and
%%                                 README.md.
%%
%% End of file `sillypage.sty'.
