From 9228b615de0e4c6c44702480360569c4129f550c Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 31 Mar 2013 19:42:38 +0200 Subject: descend into vboxes; update manual --- doc/context/third/enigma/enigma_manual.tex | 70 ++++++++++++---------- .../third/enigma/examples/enigma-example-latex.tex | 8 +-- .../third/enigma/examples/enigma-example-plain.tex | 8 +-- tex/context/third/enigma/enigma.lua | 2 +- tex/plain/enigma/enigma.tex | 15 +++-- 5 files changed, 56 insertions(+), 47 deletions(-) diff --git a/doc/context/third/enigma/enigma_manual.tex b/doc/context/third/enigma/enigma_manual.tex index efef2fd..4331521 100644 --- a/doc/context/third/enigma/enigma_manual.tex +++ b/doc/context/third/enigma/enigma_manual.tex @@ -85,15 +85,14 @@ As such they naturally belong inside the preamble (if you chose to use \modulename{Enigma} with \LATEX, that is). - It follows that the correct and only meaningful order is to - \texmacro{defineenigma} an enigma machine first and then - \texmacro{setupenigma} it. - The former takes a single, the latter a double argument. + The correct order is to \texmacro{defineenigma} an enigma machine + first and then \texmacro{setupenigma} it. + The definition takes a single, setups a double mandatory argument. Thus, \type{\defineenigma{encrypt}} creates a new environment - consisting of the macros \texmacro{startencrypt} and - \texmacro{stopencrypt}.% + consisting of the macros \texmacro{beginencrypt} and + \texmacro{endencrypt}.% \footnote{% - \CONTEXT-users will have noticed that there is no simple macro + \CONTEXT-users will have noticed that there is no direct macro \type{\encrypt{foo}}. The reason for this is that the callback which the module relies on operates on node-level. This means that for the Enigma encryption to have an effect it will @@ -104,8 +103,18 @@ portions of text, please send a feature request to the maintainer (\ichdparameter{email}). } - However, these are not usable right away, as we still have to set the - initial state of the machine. + These correspond to \texmacro{startencrypt}/\texmacro{stopencrypt} in + the \CONTEXT\ interface. + The \CONTEXT-examples below are easily translated to + Plain/\LATEX-syntax by replacing curly brackets (groups) with + square brackets and substituting environment prefixes: + \type{\start} becomes \type{\begin} and + \type{\stop} becomes \type{\end}. + Except for those conventions the syntax, even in key-value + assignments, is identical. + + However, the environment is not usable right away, as we still have + to set the initial state of the machine. This is achieved by the second meta-macro, \type{\setupenigma{encrypt}{}}, where \type{} is a placeholder for a list of \emph{assignments}, i.\,e. pairs of @@ -126,9 +135,16 @@ At the moment, the \texmacro{setupenigma} macro in any format accepts the following parameters. % \startpostponing[+2]%% messes up floats -- why? - \placefigure[right]{Usage example for the \PLAIN\ format.}{ + \startplacefigure[ + location={right,high}, + title={Usage example for the \PLAIN\ format.}, + ] % \framed[align=right,frameoffset=1em]{% - \framed[align=right,frameoffset=1em,frame=off]{% + \startframed[ + align=right, + frameoffset=1em, + frame=off, + ]% \startlatextyping[before=,after=,] \input {enigma} %% Definition ··········· %% @@ -143,19 +159,19 @@ the following parameters. verbose = 1, } %% Usage ················ %% - \startencryption + \beginencryption aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa - \stopencryption - \startencryption + \endencryption + \beginencryption Nobody in Poland is going to be able to read this, har har! - \stopencryption + \endencryption \bye \stoplatextyping - } - } + \stopframed + \stopplacefigure % \stoppostponing \startitemize \setuptolerance[tolerant]%% it’s crowded in here due to the float @@ -236,21 +252,11 @@ key but supposed to be chosen at random by the operating signal officer. The output can be automatically grouped into sequences of five -characters, delimited by spaces. This does not only conform with -traditional crypto-style, but also allows for the resulting text to be -sanely broken into lines by \TEX. +characters, delimited by spaces (option \identifier{spacing}). This +does not only conform with traditional crypto-style, but also allows +for the resulting text to be sanely broken into lines by \TEX. %%% other_chars -% The option \identifier{other_chars} determines how the machine -- in -% our Unicode-aware times -- should behave when it encounters a -% non-Latin letter. For the time being it can either remove them from -% the input (value \emph{no}) or pass them through unmodified -% (\emph{yes}). Note that this is independent of the -% \emph{preprocessing} of characters like punctuation and umlauts, -% which is done automatically. -% (See below \at{page}[listing:preproc] for the internal substitution -% list.) - Most documents don’t naturally adhere to the machine-imposed restriction to the 26 letters of the Latin alphabet. The original encipherment directives comprised substitution tables to compensate for @@ -375,9 +381,9 @@ document as follows: } \begin{document} -\startdecryption +\begindecryption usbatbwcaajhzgeyzkqskupzbmdhbdepccgeh -\stopdecryption +\enddecryption \end{document} \stoplatextyping diff --git a/doc/context/third/enigma/examples/enigma-example-latex.tex b/doc/context/third/enigma/examples/enigma-example-latex.tex index f2113c1..ea825cf 100644 --- a/doc/context/third/enigma/examples/enigma-example-latex.tex +++ b/doc/context/third/enigma/examples/enigma-example-latex.tex @@ -31,10 +31,10 @@ %%····································································% %% Ciphertext in the PDF. Rely on the addressee to decrypt the document %% externally. -\startencryption +\beginencryption Never underestimate the amount of money, time, and effort someone will expend to thwart a security system. -\stopencryption +\endencryption %%····································································% %% Input string generated with: @@ -45,9 +45,9 @@ %% --text="Never underestimate the amount of money,\ %% time, and effort someone will expend to\ %% thwart a security system." -\startdecryption +\begindecryption aqsnwyxgqarpuzrdktscbslaqmdhyonywxkwhcdgphvuqsspfjwhlszahygjbzmfpcpbniahvfcuradntepxsfchnn -\stopdecryption +\enddecryption %%····································································% \end{document} % vim:ft=tex:tw=71:expandtab:ts=2:sw=2 diff --git a/doc/context/third/enigma/examples/enigma-example-plain.tex b/doc/context/third/enigma/examples/enigma-example-plain.tex index ba2157d..bd50c93 100644 --- a/doc/context/third/enigma/examples/enigma-example-plain.tex +++ b/doc/context/third/enigma/examples/enigma-example-plain.tex @@ -27,10 +27,10 @@ %%····································································% %% encryption of plain text %%····································································% -\startencryption +\beginencryption Never underestimate the amount of money, time, and effort someone will expend to thwart a security system. -\stopencryption +\endencryption %%····································································% %% decryption of ciphertext @@ -43,8 +43,8 @@ %% --text="Never underestimate the amount of money,\ %% time, and effort someone will expend to\ %% thwart a security system." -\startdecryption +\begindecryption aqsnwyxgqarpuzrdktscbslaqmdhyonywxkwhcdgphvuqsspfjwhlszahygjbzmfpcpbniahvfcuradntepxsfchnn -\stopdecryption +\enddecryption %%·····································································% \bye diff --git a/tex/context/third/enigma/enigma.lua b/tex/context/third/enigma/enigma.lua index 4aacf53..9da4288 100644 --- a/tex/context/third/enigma/enigma.lua +++ b/tex/context/third/enigma/enigma.lua @@ -1542,7 +1542,7 @@ local new_callback = function (machine, name) end end noderemove(head, n) - elseif nid == HLIST_NODE then + elseif nid == HLIST_NODE or nid == VLIST_NODE then if nodelength(n.list) > 0 then n.list = aux(n.list, recurse + 1) end diff --git a/tex/plain/enigma/enigma.tex b/tex/plain/enigma/enigma.tex index 2b4fb8e..d18b72f 100644 --- a/tex/plain/enigma/enigma.tex +++ b/tex/plain/enigma/enigma.tex @@ -76,14 +76,17 @@ %D \startdocsection[title=Encoding Macros] %D \startparagraph -%D The environment of \texmacro{start} and -%D \texmacro{stop} allow enabling of Enigma encoding in -%D different parts of the document. +%D The environment of \texmacro{begin} and +%D \texmacro{end} toggles Enigma encoding. +%D (Regarding environment delimiters we adhere to Knuth’s +%D practice of prefixing with \type{begin}/\type{end}.) %D \stopparagraph +\def\e!start{begin} %{start} +\def \e!stop{end} %{stop} \edef\c!pre_linebreak_filter{pre_linebreak_filter} \def\do_define_enigma#1{% - \@EA\gdef\csname start\current_enigma_id\endcsname{% + \@EA\gdef\csname \e!start\current_enigma_id\endcsname{% \endgraf \bgroup% \directlua{% @@ -99,7 +102,7 @@ end }% }% - \@EA\gdef\csname stop\current_enigma_id\endcsname{% + \@EA\gdef\csname \e!stop\current_enigma_id\endcsname{% \endgraf \directlua{ luatexbase.remove_from_callback( @@ -124,4 +127,4 @@ \catcode`\_=8 % \popcatcodes \catcode`\!=12 % reserved according to source2e \ifenigmaisrunningplain\catcode`\@=12\fi -% vim:ft=tex:sw=2:ts=2:expandtab:tw=71 +% vim:ft=plaintex:sw=2:ts=2:expandtab:tw=71 -- cgit v1.2.3