| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: rotchiffre.dtx |
| 4 |
% Version: 2016/05/16 v1.1 |
| 5 |
% Info: Perform simple rotation ciphers |
| 6 |
% |
| 7 |
% Copyright (C) |
| 8 |
% 2010 Heiko Oberdiek |
| 9 |
% 2016-2019 Oberdiek Package Support Group |
| 10 |
% https://github.com/ho-tex/oberdiek/issues |
| 11 |
% |
| 12 |
% This work may be distributed and/or modified under the |
| 13 |
% conditions of the LaTeX Project Public License, either |
| 14 |
% version 1.3c of this license or (at your option) any later |
| 15 |
% version. This version of this license is in |
| 16 |
% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 17 |
% and the latest version of this license is in |
| 18 |
% https://www.latex-project.org/lppl.txt |
| 19 |
% and version 1.3 or later is part of all distributions of |
| 20 |
% LaTeX version 2005/12/01 or later. |
| 21 |
% |
| 22 |
% This work has the LPPL maintenance status "maintained". |
| 23 |
% |
| 24 |
% The Current Maintainers of this work are |
| 25 |
% Heiko Oberdiek and the Oberdiek Package Support Group |
| 26 |
% https://github.com/ho-tex/oberdiek/issues |
| 27 |
% |
| 28 |
% The Base Interpreter refers to any `TeX-Format', |
| 29 |
% because some files are installed in TDS:tex/generic//. |
| 30 |
% |
| 31 |
% This work consists of the main source file rotchiffre.dtx |
| 32 |
% and the derived files |
| 33 |
% rotchiffre.sty, rotchiffre.pdf, rotchiffre.ins, rotchiffre.drv, |
| 34 |
% rotchiffre-test1.tex, rotchiffre-test2.tex. |
| 35 |
% |
| 36 |
% Distribution: |
| 37 |
% CTAN:macros/latex/contrib/oberdiek/rotchiffre.dtx |
| 38 |
% CTAN:macros/latex/contrib/oberdiek/rotchiffre.pdf |
| 39 |
% |
| 40 |
% Unpacking: |
| 41 |
% (a) If rotchiffre.ins is present: |
| 42 |
% tex rotchiffre.ins |
| 43 |
% (b) Without rotchiffre.ins: |
| 44 |
% tex rotchiffre.dtx |
| 45 |
% (c) If you insist on using LaTeX |
| 46 |
% latex \let\install=y\input{rotchiffre.dtx} |
| 47 |
% (quote the arguments according to the demands of your shell) |
| 48 |
% |
| 49 |
% Documentation: |
| 50 |
% (a) If rotchiffre.drv is present: |
| 51 |
% latex rotchiffre.drv |
| 52 |
% (b) Without rotchiffre.drv: |
| 53 |
% latex rotchiffre.dtx; ... |
| 54 |
% The class ltxdoc loads the configuration file ltxdoc.cfg |
| 55 |
% if available. Here you can specify further options, e.g. |
| 56 |
% use A4 as paper format: |
| 57 |
% \PassOptionsToClass{a4paper}{article} |
| 58 |
% |
| 59 |
% Program calls to get the documentation (example): |
| 60 |
% pdflatex rotchiffre.dtx |
| 61 |
% makeindex -s gind.ist rotchiffre.idx |
| 62 |
% pdflatex rotchiffre.dtx |
| 63 |
% makeindex -s gind.ist rotchiffre.idx |
| 64 |
% pdflatex rotchiffre.dtx |
| 65 |
% |
| 66 |
% Installation: |
| 67 |
% TDS:tex/generic/oberdiek/rotchiffre.sty |
| 68 |
% TDS:doc/latex/oberdiek/rotchiffre.pdf |
| 69 |
% TDS:source/latex/oberdiek/rotchiffre.dtx |
| 70 |
% |
| 71 |
%<*ignore> |
| 72 |
\begingroup |
| 73 |
\catcode123=1 % |
| 74 |
\catcode125=2 % |
| 75 |
\def\x{LaTeX2e}% |
| 76 |
\expandafter\endgroup |
| 77 |
\ifcase 0\ifx\install y1\fi\expandafter |
| 78 |
\ifx\csname processbatchFile\endcsname\relax\else1\fi |
| 79 |
\ifx\fmtname\x\else 1\fi\relax |
| 80 |
\else\csname fi\endcsname |
| 81 |
%</ignore> |
| 82 |
%<*install> |
| 83 |
\input docstrip.tex |
| 84 |
\Msg{************************************************************************} |
| 85 |
\Msg{* Installation} |
| 86 |
\Msg{* Package: rotchiffre 2016/05/16 v1.1 Perform simple rotation ciphers (HO)} |
| 87 |
\Msg{************************************************************************} |
| 88 |
|
| 89 |
\keepsilent |
| 90 |
\askforoverwritefalse |
| 91 |
|
| 92 |
\let\MetaPrefix\relax |
| 93 |
\preamble |
| 94 |
|
| 95 |
This is a generated file. |
| 96 |
|
| 97 |
Project: rotchiffre |
| 98 |
Version: 2016/05/16 v1.1 |
| 99 |
|
| 100 |
Copyright (C) |
| 101 |
2010 Heiko Oberdiek |
| 102 |
2016-2019 Oberdiek Package Support Group |
| 103 |
|
| 104 |
This work may be distributed and/or modified under the |
| 105 |
conditions of the LaTeX Project Public License, either |
| 106 |
version 1.3c of this license or (at your option) any later |
| 107 |
version. This version of this license is in |
| 108 |
https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 109 |
and the latest version of this license is in |
| 110 |
https://www.latex-project.org/lppl.txt |
| 111 |
and version 1.3 or later is part of all distributions of |
| 112 |
LaTeX version 2005/12/01 or later. |
| 113 |
|
| 114 |
This work has the LPPL maintenance status "maintained". |
| 115 |
|
| 116 |
The Current Maintainers of this work are |
| 117 |
Heiko Oberdiek and the Oberdiek Package Support Group |
| 118 |
https://github.com/ho-tex/oberdiek/issues |
| 119 |
|
| 120 |
|
| 121 |
The Base Interpreter refers to any `TeX-Format', |
| 122 |
because some files are installed in TDS:tex/generic//. |
| 123 |
|
| 124 |
This work consists of the main source file rotchiffre.dtx |
| 125 |
and the derived files |
| 126 |
rotchiffre.sty, rotchiffre.pdf, rotchiffre.ins, rotchiffre.drv, |
| 127 |
rotchiffre-test1.tex, rotchiffre-test2.tex. |
| 128 |
|
| 129 |
\endpreamble |
| 130 |
\let\MetaPrefix\DoubleperCent |
| 131 |
|
| 132 |
\generate{% |
| 133 |
\file{rotchiffre.ins}{\from{rotchiffre.dtx}{install}}% |
| 134 |
\file{rotchiffre.drv}{\from{rotchiffre.dtx}{driver}}% |
| 135 |
\usedir{tex/generic/oberdiek}% |
| 136 |
\file{rotchiffre.sty}{\from{rotchiffre.dtx}{package}}% |
| 137 |
% \usedir{doc/latex/oberdiek/test}% |
| 138 |
% \file{rotchiffre-test1.tex}{\from{rotchiffre.dtx}{test1}}% |
| 139 |
% \file{rotchiffre-test2.tex}{\from{rotchiffre.dtx}{test2}}% |
| 140 |
} |
| 141 |
|
| 142 |
\catcode32=13\relax% active space |
| 143 |
\let =\space% |
| 144 |
\Msg{************************************************************************} |
| 145 |
\Msg{*} |
| 146 |
\Msg{* To finish the installation you have to move the following} |
| 147 |
\Msg{* file into a directory searched by TeX:} |
| 148 |
\Msg{*} |
| 149 |
\Msg{* rotchiffre.sty} |
| 150 |
\Msg{*} |
| 151 |
\Msg{* To produce the documentation run the file `rotchiffre.drv'} |
| 152 |
\Msg{* through LaTeX.} |
| 153 |
\Msg{*} |
| 154 |
\Msg{* Happy TeXing!} |
| 155 |
\Msg{*} |
| 156 |
\Msg{************************************************************************} |
| 157 |
|
| 158 |
\endbatchfile |
| 159 |
%</install> |
| 160 |
%<*ignore> |
| 161 |
\fi |
| 162 |
%</ignore> |
| 163 |
%<*driver> |
| 164 |
\NeedsTeXFormat{LaTeX2e} |
| 165 |
\ProvidesFile{rotchiffre.drv}% |
| 166 |
[2016/05/16 v1.1 Perform simple rotation ciphers (HO)]% |
| 167 |
\documentclass{ltxdoc} |
| 168 |
\usepackage{holtxdoc}[2011/11/22] |
| 169 |
\usepackage{rotchiffre}[2016/05/16] |
| 170 |
\usepackage{wasysym} |
| 171 |
\begin{document} |
| 172 |
\DocInput{rotchiffre.dtx}% |
| 173 |
\end{document} |
| 174 |
%</driver> |
| 175 |
% \fi |
| 176 |
% |
| 177 |
% |
| 178 |
% |
| 179 |
% \GetFileInfo{rotchiffre.drv} |
| 180 |
% |
| 181 |
% \title{The \xpackage{rotchiffre} package} |
| 182 |
% \date{2016/05/16 v1.1} |
| 183 |
% \author{Heiko Oberdiek\thanks |
| 184 |
% {Please report any issues at \url{https://github.com/ho-tex/oberdiek/issues}}} |
| 185 |
% |
| 186 |
% \maketitle |
| 187 |
% |
| 188 |
% \begin{abstract} |
| 189 |
% This package implements chiffres ROT13 with its variants |
| 190 |
% ROT5, ROT18, and ROT47. |
| 191 |
% \end{abstract} |
| 192 |
% |
| 193 |
% \tableofcontents |
| 194 |
% |
| 195 |
% \section{Documentation} |
| 196 |
% |
| 197 |
% \subsection{Motivation} |
| 198 |
% |
| 199 |
% In the newsgroup \xnewsgroup{comp.text.tex} there was a discussion |
| 200 |
% \cite{fontspecthread} |
| 201 |
% about package \xpackage{fontspec}. Stephan Hennig provided |
| 202 |
% an example to implement ROT13 as OpenType feature \cite{rot13modern}. |
| 203 |
% And Robin Fairbairns requested a CTAN upload \cite{rot13robin} \smiley. |
| 204 |
% |
| 205 |
% But I think it would be not fair to the users of old \TeX\ engines |
| 206 |
% without OpenType support that they will not be able to |
| 207 |
% decrypt texts generated by the new package \smiley. |
| 208 |
% Therefore I have written this package that implements ROT13 |
| 209 |
% even for \iniTeX. Also other variants ROT5, ROT18, ROT47 are |
| 210 |
% provided. |
| 211 |
% |
| 212 |
% \subsection{Usage} |
| 213 |
% |
| 214 |
% \begin{declcs}{EdefRot} \M{type} \M{cmd} \M{text} |
| 215 |
% \end{declcs} |
| 216 |
% The \meta{text} is expanded and sanitized. All tokens |
| 217 |
% are letters with catcode 12 (other) with the exception of |
| 218 |
% the space token that has character code 32 (0x20) and |
| 219 |
% catcode 10 (space). This follows \hologo{TeX}'s convention of |
| 220 |
% \cs{string} and \cs{meaning}. |
| 221 |
% |
| 222 |
% The chiffre type is specified by \meta{type} it takes |
| 223 |
% a number. For example, ROT13 is specified by |13|. |
| 224 |
% The selected chiffre is applied to \meta{text} and |
| 225 |
% the result is stored in macro \meta{cmd}. |
| 226 |
% |
| 227 |
% The following table lists the supported rotation chiffres. |
| 228 |
% \begin{center} |
| 229 |
% \renewcommand*{\arraystretch}{1.2} |
| 230 |
% \begin{tabular}{lll} |
| 231 |
% chiffre & from & to\\ |
| 232 |
% \hline |
| 233 |
% \textbf{ROT13} & |A|-|Z| & |N|-|Z|\,|A|-|M|\\ |
| 234 |
% & |a|-|z| & |n|-|z|\,|a|-|m|\\ |
| 235 |
% \hline |
| 236 |
% \textbf{ROT5} & |0|-|9| & |5|-|9|\,|0|-|4|\\ |
| 237 |
% \hline |
| 238 |
% \textbf{ROT18} & |A|-|Z|\,|0|-|9| & |S|-|Z|\,|0|-|9|\,|A|-|R|\\ |
| 239 |
% & |a|-|z| & |n|-|z|\,|a|-|m|\\ |
| 240 |
% \hline |
| 241 |
% \textbf{ROT47} & |!|-|~| & |P|-|~|\,|!|-|O|\\ |
| 242 |
% \end{tabular} |
| 243 |
% \end{center} |
| 244 |
% In case of ROT47 the range is the ASCII range from character codes |
| 245 |
% 33 (0x21) `|!|' upto 126 (0xFE) `|~|'. |
| 246 |
% |
| 247 |
% The specifications of the algorithms are taken from the description |
| 248 |
% in Wikipedia \cite{wiki:rot13:de,wiki:rot13:en}, ROT18 is further |
| 249 |
% specified by ``computerfreak'' \cite{cf:rot18}. |
| 250 |
% |
| 251 |
% \subsubsection{Examples} |
| 252 |
% |
| 253 |
% The famous English pangram \cite{lazydog} is converted by |
| 254 |
% \begin{quote} |
| 255 |
% |\EdefRot{13}\result{The quick brown fox jumps over the lazy dog}| |
| 256 |
% \end{quote} |
| 257 |
% The result is stored in macro \cs{result} with |
| 258 |
% the following contents: |
| 259 |
% \begin{quote} |
| 260 |
% \EdefRot{13}\result{The quick brown fox jumps over the lazy dog} |
| 261 |
% \texttt{\result} |
| 262 |
% \end{quote} |
| 263 |
% |
| 264 |
% Command names are converted to strings before. Therefore the |
| 265 |
% text should not contain \hologo{TeX} markup, example: |
| 266 |
% \begin{quote} |
| 267 |
% \def\Input{Hello\par World} |
| 268 |
% \EdefRot{13}\result\Input |
| 269 |
% |\EdefRot{13}\result{\texttt{Hello}\par\textit{World}}|\\ |
| 270 |
% \cs{result} $\rightarrow$ \texttt{\result} |
| 271 |
% \end{quote} |
| 272 |
% But macros can be used that contain text. They are expanded. |
| 273 |
% \begin{quote} |
| 274 |
% \def\Name{Heiko} |
| 275 |
% \def\Email{heiko.oberdiek at googlemail.com} |
| 276 |
% \EdefRot{13}\result{Hello \Name\space<\Email>} |
| 277 |
% |\newcommand{\Name}{Heiko}|\\ |
| 278 |
% |\newcommand{\Email}{heiko.oberdiek at googlemail.com}|\\ |
| 279 |
% |\EdefRot{13}\result{Hello \Name\space<\Email>}|\\ |
| 280 |
% \cs{result} $\rightarrow$ \texttt{\result} |
| 281 |
% \end{quote} |
| 282 |
% |
| 283 |
% |
| 284 |
% \StopEventually{ |
| 285 |
% } |
| 286 |
% |
| 287 |
% \section{Implementation} |
| 288 |
% |
| 289 |
% \begin{macrocode} |
| 290 |
%<*package> |
| 291 |
% \end{macrocode} |
| 292 |
% |
| 293 |
% \subsection{Reload check and package identification} |
| 294 |
% Reload check, especially if the package is not used with \LaTeX. |
| 295 |
% \begin{macrocode} |
| 296 |
\begingroup\catcode61\catcode48\catcode32=10\relax% |
| 297 |
\catcode13=5 % ^^M |
| 298 |
\endlinechar=13 % |
| 299 |
\catcode35=6 % # |
| 300 |
\catcode39=12 % ' |
| 301 |
\catcode44=12 % , |
| 302 |
\catcode45=12 % - |
| 303 |
\catcode46=12 % . |
| 304 |
\catcode58=12 % : |
| 305 |
\catcode64=11 % @ |
| 306 |
\catcode123=1 % { |
| 307 |
\catcode125=2 % } |
| 308 |
\expandafter\let\expandafter\x\csname [email protected]\endcsname |
| 309 |
\ifx\x\relax % plain-TeX, first loading |
| 310 |
\else |
| 311 |
\def\empty{}% |
| 312 |
\ifx\x\empty % LaTeX, first loading, |
| 313 |
% variable is initialized, but \ProvidesPackage not yet seen |
| 314 |
\else |
| 315 |
\expandafter\ifx\csname PackageInfo\endcsname\relax |
| 316 |
\def\x#1#2{% |
| 317 |
\immediate\write-1{Package #1 Info: #2.}% |
| 318 |
}% |
| 319 |
\else |
| 320 |
\def\x#1#2{\PackageInfo{#1}{#2, stopped}}% |
| 321 |
\fi |
| 322 |
\x{rotchiffre}{The package is already loaded}% |
| 323 |
\aftergroup\endinput |
| 324 |
\fi |
| 325 |
\fi |
| 326 |
\endgroup% |
| 327 |
% \end{macrocode} |
| 328 |
% Package identification: |
| 329 |
% \begin{macrocode} |
| 330 |
\begingroup\catcode61\catcode48\catcode32=10\relax% |
| 331 |
\catcode13=5 % ^^M |
| 332 |
\endlinechar=13 % |
| 333 |
\catcode35=6 % # |
| 334 |
\catcode39=12 % ' |
| 335 |
\catcode40=12 % ( |
| 336 |
\catcode41=12 % ) |
| 337 |
\catcode44=12 % , |
| 338 |
\catcode45=12 % - |
| 339 |
\catcode46=12 % . |
| 340 |
\catcode47=12 % / |
| 341 |
\catcode58=12 % : |
| 342 |
\catcode64=11 % @ |
| 343 |
\catcode91=12 % [ |
| 344 |
\catcode93=12 % ] |
| 345 |
\catcode123=1 % { |
| 346 |
\catcode125=2 % } |
| 347 |
\expandafter\ifx\csname ProvidesPackage\endcsname\relax |
| 348 |
\def\x#1#2#3[#4]{\endgroup |
| 349 |
\immediate\write-1{Package: #3 #4}% |
| 350 |
\xdef#1{#4}% |
| 351 |
}% |
| 352 |
\else |
| 353 |
\def\x#1#2[#3]{\endgroup |
| 354 |
#2[{#3}]% |
| 355 |
\ifx#1\@undefined |
| 356 |
\xdef#1{#3}% |
| 357 |
\fi |
| 358 |
\ifx#1\relax |
| 359 |
\xdef#1{#3}% |
| 360 |
\fi |
| 361 |
}% |
| 362 |
\fi |
| 363 |
\expandafter\x\csname [email protected]\endcsname |
| 364 |
\ProvidesPackage{rotchiffre}% |
| 365 |
[2016/05/16 v1.1 Perform simple rotation ciphers (HO)]% |
| 366 |
% \end{macrocode} |
| 367 |
% |
| 368 |
% \subsection{Catcodes} |
| 369 |
% |
| 370 |
% \begin{macrocode} |
| 371 |
\begingroup\catcode61\catcode48\catcode32=10\relax% |
| 372 |
\catcode13=5 % ^^M |
| 373 |
\endlinechar=13 % |
| 374 |
\catcode123=1 % { |
| 375 |
\catcode125=2 % } |
| 376 |
\catcode64=11 % @ |
| 377 |
\def\x{\endgroup |
| 378 |
\expandafter\edef\csname RotCh@AtEnd\endcsname{% |
| 379 |
\endlinechar=\the\endlinechar\relax |
| 380 |
\catcode13=\the\catcode13\relax |
| 381 |
\catcode32=\the\catcode32\relax |
| 382 |
\catcode35=\the\catcode35\relax |
| 383 |
\catcode61=\the\catcode61\relax |
| 384 |
\catcode64=\the\catcode64\relax |
| 385 |
\catcode123=\the\catcode123\relax |
| 386 |
\catcode125=\the\catcode125\relax |
| 387 |
}% |
| 388 |
}% |
| 389 |
\x\catcode61\catcode48\catcode32=10\relax% |
| 390 |
\catcode13=5 % ^^M |
| 391 |
\endlinechar=13 % |
| 392 |
\catcode35=6 % # |
| 393 |
\catcode64=11 % @ |
| 394 |
\catcode123=1 % { |
| 395 |
\catcode125=2 % } |
| 396 |
\def\TMP@EnsureCode#1#2{% |
| 397 |
\edef\RotCh@AtEnd{% |
| 398 |
\RotCh@AtEnd |
| 399 |
\catcode#1=\the\catcode#1\relax |
| 400 |
}% |
| 401 |
\catcode#1=#2\relax |
| 402 |
} |
| 403 |
\TMP@EnsureCode{42}{12}% * |
| 404 |
\TMP@EnsureCode{43}{12}% + |
| 405 |
\TMP@EnsureCode{45}{12}% - |
| 406 |
\TMP@EnsureCode{46}{12}% . |
| 407 |
\TMP@EnsureCode{47}{12}% / |
| 408 |
\TMP@EnsureCode{60}{12}% < |
| 409 |
\TMP@EnsureCode{62}{12}% > |
| 410 |
\TMP@EnsureCode{91}{12}% [ |
| 411 |
\TMP@EnsureCode{93}{12}% ] |
| 412 |
\TMP@EnsureCode{96}{12}% ` |
| 413 |
\edef\RotCh@AtEnd{\RotCh@AtEnd\noexpand\endinput} |
| 414 |
% \end{macrocode} |
| 415 |
% |
| 416 |
% \subsection{Loading resources} |
| 417 |
% |
| 418 |
% \begin{macrocode} |
| 419 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 420 |
\expandafter\ifx\csname RequirePackage\endcsname\relax |
| 421 |
\input infwarerr.sty\relax |
| 422 |
\input ltxcmds.sty\relax |
| 423 |
\input pdfescape.sty\relax |
| 424 |
\else |
| 425 |
\RequirePackage{infwarerr}[2010/04/08]% |
| 426 |
\RequirePackage{ltxcmds}[2010/03/01]% |
| 427 |
\RequirePackage{pdfescape}[2010/03/01]% |
| 428 |
\fi |
| 429 |
% \end{macrocode} |
| 430 |
% |
| 431 |
% \subsection{\cs{EdefRot} as robust macro} |
| 432 |
% |
| 433 |
% The main macro \cs{EdefRot} is made robust if |
| 434 |
% \hologo{eTeX} or \hologo{LaTeX} are present. |
| 435 |
% \begin{macro}{\EdefRot} |
| 436 |
% \begin{macrocode} |
| 437 |
\ltx@IfUndefined{protected}{% |
| 438 |
\ltx@IfUndefined{DeclareRobustCommand}{% |
| 439 |
\def\RotCh@temp{\def\EdefRot##1}% |
| 440 |
}{% |
| 441 |
\def\RotCh@temp{\DeclareRobustCommand*\EdefRot[1]}% |
| 442 |
}% |
| 443 |
}{% |
| 444 |
\def\RotCh@temp{\protected\def\EdefRot##1}% |
| 445 |
} |
| 446 |
\RotCh@temp{% |
| 447 |
\RotCh@GetNumber{#1}% |
| 448 |
\ltx@IfUndefined{RotCh@rot@\romannumeral\RotCh@number}{% |
| 449 |
\@PackageError{rotchiffre}{% |
| 450 |
Unknown chiffre ROT\RotCh@number |
| 451 |
}\@ehc |
| 452 |
\EdefSanitize |
| 453 |
}{% |
| 454 |
\RotCh@rot |
| 455 |
}% |
| 456 |
} |
| 457 |
% \end{macrocode} |
| 458 |
% \end{macro} |
| 459 |
% |
| 460 |
% \begin{macro}{\RotCh@GetNumber} |
| 461 |
% If \hologo{eTeX} is active, then |
| 462 |
% the chiffre number can be an expression supported |
| 463 |
% by \cs{numexpr}. |
| 464 |
% \begin{macrocode} |
| 465 |
\ltx@IfUndefined{numexpr}{% |
| 466 |
\def\RotCh@GetNumber#1{% |
| 467 |
\edef\RotCh@number{\number#1}% |
| 468 |
}% |
| 469 |
}{% |
| 470 |
\def\RotCh@GetNumber#1{% |
| 471 |
\edef\RotCh@number{\the\numexpr#1\relax}% |
| 472 |
}% |
| 473 |
} |
| 474 |
% \end{macrocode} |
| 475 |
% \end{macro} |
| 476 |
% |
| 477 |
% \subsection{Set \cs{lccode} on a range of characters} |
| 478 |
% |
| 479 |
% \begin{macro}{\RotCh@count} |
| 480 |
% \begin{macrocode} |
| 481 |
\countdef\RotCh@count=255 % |
| 482 |
% \end{macrocode} |
| 483 |
% \end{macro} |
| 484 |
% \begin{macro}{\RotCh@count@end} |
| 485 |
% \begin{macrocode} |
| 486 |
\countdef\RotCh@count@end=2 % |
| 487 |
% \end{macrocode} |
| 488 |
% \end{macro} |
| 489 |
% \begin{macro}{RotCh@RangeIgnore} |
| 490 |
% \begin{macrocode} |
| 491 |
\def\RotCh@RangeIgnore{% |
| 492 |
\RotCh@loop{% |
| 493 |
\lccode\RotCh@count=\ltx@zero |
| 494 |
}% |
| 495 |
} |
| 496 |
% \end{macrocode} |
| 497 |
% \end{macro} |
| 498 |
% \begin{macro}{\RotCh@RangeSet} |
| 499 |
% \begin{macrocode} |
| 500 |
\ltx@IfUndefined{numexpr}{% |
| 501 |
\countdef\RotCh@count@temp=4 % |
| 502 |
\def\RotCh@RangeSet#1{% |
| 503 |
\RotCh@loop{% |
| 504 |
\RotCh@count@temp=\RotCh@count |
| 505 |
\advance\RotCh@count@temp #1 % |
| 506 |
\lccode\RotCh@count=\RotCh@count@temp |
| 507 |
}% |
| 508 |
}% |
| 509 |
}{% |
| 510 |
\def\RotCh@RangeSet#1{% |
| 511 |
\RotCh@loop{% |
| 512 |
\lccode\RotCh@count=\numexpr\RotCh@count#1\relax |
| 513 |
}% |
| 514 |
}% |
| 515 |
} |
| 516 |
% \end{macrocode} |
| 517 |
% \end{macro} |
| 518 |
% \begin{macro}{\RotCh@loop} |
| 519 |
% \begin{macrocode} |
| 520 |
\def\RotCh@loop#1#2#3{% |
| 521 |
\RotCh@count=#2 % |
| 522 |
\RotCh@count@end=#3 % |
| 523 |
\def\RotCh@action{#1}% |
| 524 |
\RotCh@@loop |
| 525 |
}% |
| 526 |
% \end{macrocode} |
| 527 |
% \end{macro} |
| 528 |
% \begin{macro}{RotCh@@loop} |
| 529 |
% \begin{macrocode} |
| 530 |
\def\RotCh@@loop{% |
| 531 |
\RotCh@action |
| 532 |
\ifnum\RotCh@count<\RotCh@count@end |
| 533 |
\advance\RotCh@count\ltx@one |
| 534 |
\expandafter\RotCh@@loop |
| 535 |
\fi |
| 536 |
} |
| 537 |
% \end{macrocode} |
| 538 |
% \end{macro} |
| 539 |
% |
| 540 |
% \subsection{Chiffres} |
| 541 |
% |
| 542 |
% \subsubsection{ROT13} |
| 543 |
% |
| 544 |
% \begin{macro}{\RotCh@rot@xiii} |
| 545 |
% \begin{macrocode} |
| 546 |
\def\RotCh@rot@xiii{% |
| 547 |
\RotCh@RangeIgnore{0}{64}% |
| 548 |
\RotCh@RangeSet{+13}{65}{77}% |
| 549 |
\RotCh@RangeSet{-13}{78}{90}% |
| 550 |
\RotCh@RangeIgnore{91}{96}% |
| 551 |
\RotCh@RangeSet{+13}{97}{109}% |
| 552 |
\RotCh@RangeSet{-13}{110}{122}% |
| 553 |
\RotCh@RangeIgnore{123}{255}% |
| 554 |
} |
| 555 |
% \end{macrocode} |
| 556 |
% \end{macro} |
| 557 |
% |
| 558 |
% \subsubsection{ROT5} |
| 559 |
% |
| 560 |
% \begin{macro}{\RotCh@rot@v} |
| 561 |
% \begin{macrocode} |
| 562 |
\def\RotCh@rot@v{% |
| 563 |
\RotCh@RangeIgnore{0}{47}% |
| 564 |
\RotCh@RangeSet{+5}{48}{52}% |
| 565 |
\RotCh@RangeSet{-5}{53}{57}% |
| 566 |
\RotCh@RangeIgnore{58}{255}% |
| 567 |
} |
| 568 |
% \end{macrocode} |
| 569 |
% \end{macro} |
| 570 |
% |
| 571 |
% \subsubsection{ROT18} |
| 572 |
% |
| 573 |
% \begin{macro}{\RotCh@rot@xviii} |
| 574 |
% \begin{macrocode} |
| 575 |
\def\RotCh@rot@xviii{% |
| 576 |
\RotCh@RangeIgnore{0}{47}% |
| 577 |
\RotCh@RangeSet{+25}{48}{57}% |
| 578 |
\RotCh@RangeIgnore{58}{64}% |
| 579 |
\RotCh@RangeSet{+18}{65}{72}% |
| 580 |
\RotCh@RangeSet{-25}{73}{82}% |
| 581 |
\RotCh@RangeSet{-18}{83}{90}% |
| 582 |
\RotCh@RangeIgnore{91}{96}% |
| 583 |
\RotCh@RangeSet{+13}{97}{109}% |
| 584 |
\RotCh@RangeSet{-13}{110}{122}% |
| 585 |
\RotCh@RangeIgnore{123}{255}% |
| 586 |
} |
| 587 |
% \end{macrocode} |
| 588 |
% \end{macro} |
| 589 |
% |
| 590 |
% \subsubsection{ROT47} |
| 591 |
% |
| 592 |
% \begin{macro}{\RotCh@rot@xlvii} |
| 593 |
% \begin{macrocode} |
| 594 |
\def\RotCh@rot@xlvii{% |
| 595 |
\RotCh@RangeIgnore{0}{32}% |
| 596 |
\RotCh@RangeSet{+47}{33}{79}% |
| 597 |
\RotCh@RangeSet{-47}{80}{126}% |
| 598 |
\RotCh@RangeIgnore{127}{255}% |
| 599 |
} |
| 600 |
% \end{macrocode} |
| 601 |
% \end{macro} |
| 602 |
% |
| 603 |
% \subsection{\cs{RotCh@rot} with big char support} |
| 604 |
% |
| 605 |
% Some modern \hologo{TeX} engines support characters with more |
| 606 |
% than eight bits (codes greater as 255). \hologo{LuaTeX} and |
| 607 |
% \hologo{XeTeX} are detected by the caret notation that is |
| 608 |
% extended by these engines. |
| 609 |
% \begin{macrocode} |
| 610 |
\begingroup |
| 611 |
\catcode0=9 % |
| 612 |
\catcode`\^=7 % |
| 613 |
\catcode`\^^^=12 % |
| 614 |
\def\x{^^^^0000}% |
| 615 |
\expandafter\endgroup |
| 616 |
\ifx\x\ltx@empty |
| 617 |
% \end{macrocode} |
| 618 |
% |
| 619 |
% \begin{macro}{\RotCh@toks} |
| 620 |
% \begin{macrocode} |
| 621 |
\toksdef\RotCh@toks=0 % |
| 622 |
% \end{macrocode} |
| 623 |
% \end{macro} |
| 624 |
% \begin{macro}{\RotCh@rot} |
| 625 |
% \begin{macrocode} |
| 626 |
\long\def\RotCh@rot#1#2{% |
| 627 |
\EdefSanitize#1{#2}% |
| 628 |
\begingroup |
| 629 |
\csname RotCh@rot@\romannumeral\RotCh@number\endcsname |
| 630 |
\RotCh@toks={}% |
| 631 |
\expandafter\RotCh@SplitSpace#1 \@nil |
| 632 |
\expandafter\endgroup |
| 633 |
\expandafter\def\expandafter#1\expandafter{% |
| 634 |
\the\RotCh@toks |
| 635 |
}% |
| 636 |
}% |
| 637 |
% \end{macrocode} |
| 638 |
% \end{macro} |
| 639 |
% \begin{macro}{\RotCh@SplitSpace} |
| 640 |
% \begin{macrocode} |
| 641 |
\def\RotCh@temp#1{% |
| 642 |
\def\RotCh@SplitSpace##1 ##2\@nil{% |
| 643 |
\RotCh@Add##1\relax |
| 644 |
\ifx\relax##2\relax |
| 645 |
\expandafter\ltx@gobble |
| 646 |
\else |
| 647 |
\RotCh@toks\expandafter{\the\RotCh@toks#1}% |
| 648 |
\expandafter\ltx@firstofone |
| 649 |
\fi |
| 650 |
{% |
| 651 |
\RotCh@SplitSpace##2\@nil |
| 652 |
}% |
| 653 |
}% |
| 654 |
}% |
| 655 |
\RotCh@temp{ }% |
| 656 |
% \end{macrocode} |
| 657 |
% \end{macro} |
| 658 |
% \begin{macro}{\RotCh@Add} |
| 659 |
% \begin{macrocode} |
| 660 |
\def\RotCh@Add#1{% |
| 661 |
\ifx#1\relax |
| 662 |
\else |
| 663 |
\ifnum`#1>126 % |
| 664 |
\RotCh@toks\expandafter{\the\RotCh@toks#1}% |
| 665 |
\else |
| 666 |
\lowercase{% |
| 667 |
\RotCh@toks\expandafter{\the\RotCh@toks#1}% |
| 668 |
}% |
| 669 |
\fi |
| 670 |
\expandafter\RotCh@Add |
| 671 |
\fi |
| 672 |
}% |
| 673 |
% \end{macrocode} |
| 674 |
% \end{macro} |
| 675 |
% \begin{macrocode} |
| 676 |
\else |
| 677 |
% \end{macrocode} |
| 678 |
% |
| 679 |
% \subsection{\cs{RotCh@rot} without big char support} |
| 680 |
% |
| 681 |
% \begin{macro}{\RotCh@rot} |
| 682 |
% \begin{macrocode} |
| 683 |
\long\def\RotCh@rot#1#2{% |
| 684 |
\EdefSanitize#1{#2}% |
| 685 |
\begingroup |
| 686 |
\csname RotCh@rot@\romannumeral\RotCh@number\endcsname |
| 687 |
\lowercase\expandafter{\expandafter\endgroup |
| 688 |
\expandafter\def\expandafter#1\expandafter{#1}% |
| 689 |
}% |
| 690 |
}% |
| 691 |
% \end{macrocode} |
| 692 |
% \end{macro} |
| 693 |
% \begin{macrocode} |
| 694 |
\fi |
| 695 |
% \end{macrocode} |
| 696 |
% |
| 697 |
% \begin{macrocode} |
| 698 |
\RotCh@AtEnd% |
| 699 |
%</package> |
| 700 |
% \end{macrocode} |
| 701 |
%% \section{Installation} |
| 702 |
% |
| 703 |
% \subsection{Download} |
| 704 |
% |
| 705 |
% \paragraph{Package.} This package is available on |
| 706 |
% CTAN\footnote{\CTANpkg{rotchiffre}}: |
| 707 |
% \begin{description} |
| 708 |
% \item[\CTAN{macros/latex/contrib/oberdiek/rotchiffre.dtx}] The source file. |
| 709 |
% \item[\CTAN{macros/latex/contrib/oberdiek/rotchiffre.pdf}] Documentation. |
| 710 |
% \end{description} |
| 711 |
% |
| 712 |
% |
| 713 |
% \paragraph{Bundle.} All the packages of the bundle `oberdiek' |
| 714 |
% are also available in a TDS compliant ZIP archive. There |
| 715 |
% the packages are already unpacked and the documentation files |
| 716 |
% are generated. The files and directories obey the TDS standard. |
| 717 |
% \begin{description} |
| 718 |
% \item[\CTANinstall{install/macros/latex/contrib/oberdiek.tds.zip}] |
| 719 |
% \end{description} |
| 720 |
% \emph{TDS} refers to the standard ``A Directory Structure |
| 721 |
% for \TeX\ Files'' (\CTANpkg{tds}). Directories |
| 722 |
% with \xfile{texmf} in their name are usually organized this way. |
| 723 |
% |
| 724 |
% \subsection{Bundle installation} |
| 725 |
% |
| 726 |
% \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the |
| 727 |
% TDS tree (also known as \xfile{texmf} tree) of your choice. |
| 728 |
% Example (linux): |
| 729 |
% \begin{quote} |
| 730 |
% |unzip oberdiek.tds.zip -d ~/texmf| |
| 731 |
% \end{quote} |
| 732 |
% |
| 733 |
% \subsection{Package installation} |
| 734 |
% |
| 735 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 736 |
% \docstrip\ archive. The files are extracted by running the |
| 737 |
% \xfile{.dtx} through \plainTeX: |
| 738 |
% \begin{quote} |
| 739 |
% \verb|tex rotchiffre.dtx| |
| 740 |
% \end{quote} |
| 741 |
% |
| 742 |
% \paragraph{TDS.} Now the different files must be moved into |
| 743 |
% the different directories in your installation TDS tree |
| 744 |
% (also known as \xfile{texmf} tree): |
| 745 |
% \begin{quote} |
| 746 |
% \def\t{^^A |
| 747 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 748 |
% rotchiffre.sty & tex/generic/oberdiek/rotchiffre.sty\\ |
| 749 |
% rotchiffre.pdf & doc/latex/oberdiek/rotchiffre.pdf\\ |
| 750 |
% rotchiffre.dtx & source/latex/oberdiek/rotchiffre.dtx\\ |
| 751 |
% \end{tabular}^^A |
| 752 |
% }^^A |
| 753 |
% \sbox0{\t}^^A |
| 754 |
% \ifdim\wd0>\linewidth |
| 755 |
% \begingroup |
| 756 |
% \advance\linewidth by\leftmargin |
| 757 |
% \advance\linewidth by\rightmargin |
| 758 |
% \edef\x{\endgroup |
| 759 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 760 |
% }\x |
| 761 |
% \def\lwbox{^^A |
| 762 |
% \leavevmode |
| 763 |
% \hbox to \linewidth{^^A |
| 764 |
% \kern-\leftmargin\relax |
| 765 |
% \hss |
| 766 |
% \usebox0 |
| 767 |
% \hss |
| 768 |
% \kern-\rightmargin\relax |
| 769 |
% }^^A |
| 770 |
% }^^A |
| 771 |
% \ifdim\wd0>\lw |
| 772 |
% \sbox0{\small\t}^^A |
| 773 |
% \ifdim\wd0>\linewidth |
| 774 |
% \ifdim\wd0>\lw |
| 775 |
% \sbox0{\footnotesize\t}^^A |
| 776 |
% \ifdim\wd0>\linewidth |
| 777 |
% \ifdim\wd0>\lw |
| 778 |
% \sbox0{\scriptsize\t}^^A |
| 779 |
% \ifdim\wd0>\linewidth |
| 780 |
% \ifdim\wd0>\lw |
| 781 |
% \sbox0{\tiny\t}^^A |
| 782 |
% \ifdim\wd0>\linewidth |
| 783 |
% \lwbox |
| 784 |
% \else |
| 785 |
% \usebox0 |
| 786 |
% \fi |
| 787 |
% \else |
| 788 |
% \lwbox |
| 789 |
% \fi |
| 790 |
% \else |
| 791 |
% \usebox0 |
| 792 |
% \fi |
| 793 |
% \else |
| 794 |
% \lwbox |
| 795 |
% \fi |
| 796 |
% \else |
| 797 |
% \usebox0 |
| 798 |
% \fi |
| 799 |
% \else |
| 800 |
% \lwbox |
| 801 |
% \fi |
| 802 |
% \else |
| 803 |
% \usebox0 |
| 804 |
% \fi |
| 805 |
% \else |
| 806 |
% \lwbox |
| 807 |
% \fi |
| 808 |
% \else |
| 809 |
% \usebox0 |
| 810 |
% \fi |
| 811 |
% \end{quote} |
| 812 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 813 |
% TDS installing feature, then some files can already be in the right |
| 814 |
% place, see the documentation of \docstrip. |
| 815 |
% |
| 816 |
% \subsection{Refresh file name databases} |
| 817 |
% |
| 818 |
% If your \TeX~distribution |
| 819 |
% (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh |
| 820 |
% these. For example, \TeX\,Live\ users run \verb|texhash| or |
| 821 |
% \verb|mktexlsr|. |
| 822 |
% |
| 823 |
% \subsection{Some details for the interested} |
| 824 |
% |
| 825 |
% \paragraph{Unpacking with \LaTeX.} |
| 826 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 827 |
% \begin{description} |
| 828 |
% \item[\plainTeX:] Run \docstrip\ and extract the files. |
| 829 |
% \item[\LaTeX:] Generate the documentation. |
| 830 |
% \end{description} |
| 831 |
% If you insist on using \LaTeX\ for \docstrip\ (really, |
| 832 |
% \docstrip\ does not need \LaTeX), then inform the autodetect routine |
| 833 |
% about your intention: |
| 834 |
% \begin{quote} |
| 835 |
% \verb|latex \let\install=y\input{rotchiffre.dtx}| |
| 836 |
% \end{quote} |
| 837 |
% Do not forget to quote the argument according to the demands |
| 838 |
% of your shell. |
| 839 |
% |
| 840 |
% \paragraph{Generating the documentation.} |
| 841 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 842 |
% the documentation. The process can be configured by the |
| 843 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put this |
| 844 |
% line into this file, if you want to have A4 as paper format: |
| 845 |
% \begin{quote} |
| 846 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 847 |
% \end{quote} |
| 848 |
% An example follows how to generate the |
| 849 |
% documentation with pdf\LaTeX: |
| 850 |
% \begin{quote} |
| 851 |
%\begin{verbatim} |
| 852 |
%pdflatex rotchiffre.dtx |
| 853 |
%makeindex -s gind.ist rotchiffre.idx |
| 854 |
%pdflatex rotchiffre.dtx |
| 855 |
%makeindex -s gind.ist rotchiffre.idx |
| 856 |
%pdflatex rotchiffre.dtx |
| 857 |
%\end{verbatim} |
| 858 |
% \end{quote} |
| 859 |
% |
| 860 |
% \begin{thebibliography}{9} |
| 861 |
% \raggedright |
| 862 |
% |
| 863 |
% \bibitem{fontspecthread} |
| 864 |
% Stephan Hennig et.\,al.: |
| 865 |
% \textit{fontspec: no ligatures with Times New Roman}; |
| 866 |
% newsgroup \xnewsgroup{comp.text.tex}, |
| 867 |
% \url{news:[email protected]}, |
| 868 |
% 2010-11-11.\\ |
| 869 |
% {\small |
| 870 |
% \url{https://groups.google.com/group/comp.text.tex/browse_thread/thread/6266f98e998ce333/d7b32e9dcc610c87}} |
| 871 |
% |
| 872 |
% \bibitem{rot13modern} |
| 873 |
% Stephan Hennig: |
| 874 |
% \textit{Re: fontspec: no ligatures with Times New Roman}; |
| 875 |
% newsgroup \xnewsgroup{comp.text.tex}, |
| 876 |
% \url{news:[email protected]}, |
| 877 |
% 2010-11-11.\\ |
| 878 |
% {\small |
| 879 |
% \url{https://groups.google.com/group/comp.text.tex/msg/d7b32e9dcc610c87}} |
| 880 |
% |
| 881 |
% \bibitem{rot13robin} |
| 882 |
% Robin Fairbairns: |
| 883 |
% \textit{Re: fontspec: no ligatures with Times New Roman}; |
| 884 |
% newsgroup \xnewsgroup{comp.text.tex}, |
| 885 |
% \url{news:[email protected]}, |
| 886 |
% 2010-11-12.\\ |
| 887 |
% {\small |
| 888 |
% \url{https://groups.google.com/group/comp.text.tex/msg/7c03e91407144704}} |
| 889 |
% |
| 890 |
% \bibitem{wiki:rot13:de} |
| 891 |
% Wikipedia/German: |
| 892 |
% \textit{ROT13}; |
| 893 |
% 2010-10-26. |
| 894 |
% {\small |
| 895 |
% \url{https://de.wikipedia.org/wiki/ROT13}} |
| 896 |
% |
| 897 |
% \bibitem{wiki:rot13:en} |
| 898 |
% Wikipedia/English: |
| 899 |
% \textit{ROT13}; |
| 900 |
% 2010-11-11. |
| 901 |
% {\small |
| 902 |
% \url{https://en.wikipedia.org/wiki/ROT13}} |
| 903 |
% |
| 904 |
% \bibitem{cf:rot18} |
| 905 |
% Computerfreak/German: \textit{ROT-18}; |
| 906 |
% 2010-04-12.\\ |
| 907 |
% {\small |
| 908 |
% \url{http://www.compufreak.info/2010/04/12/rot-18/}} |
| 909 |
% |
| 910 |
% \bibitem{lazydog} |
| 911 |
% Wikipedia/English: \textit{The quick brown fox jumps over the lazy dog}; |
| 912 |
% 2010-11-09.\\ |
| 913 |
% {\small |
| 914 |
% \url{https://en.wikipedia.org/wiki/The_quick_brown_fox_jumps_over_the_lazy_dog}} |
| 915 |
% |
| 916 |
% \end{thebibliography} |
| 917 |
% |
| 918 |
% \begin{History} |
| 919 |
% \begin{Version}{2010/11/12 v1.0} |
| 920 |
% \item |
| 921 |
% First version. |
| 922 |
% \end{Version} |
| 923 |
% \begin{Version}{2016/05/16 v1.1} |
| 924 |
% \item |
| 925 |
% Documentation updates. |
| 926 |
% \end{Version} |
| 927 |
% \end{History} |
| 928 |
% |
| 929 |
% \PrintIndex |
| 930 |
% |
| 931 |
% \Finale |
| 932 |
\endinput |