From ee53eac199e12fb91859fd18a43dd506ff75e3a9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 20 Apr 2009 22:50:28 +0000 Subject: nicetext update (20apr09) git-svn-id: svn://tug.org/texlive/trunk@12766 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/nicetext/CHANGE.LOG | 33 + Master/texmf-dist/doc/latex/nicetext/NNOUNCE.TXT | 25 + Master/texmf-dist/doc/latex/nicetext/README | 73 +- Master/texmf-dist/doc/latex/nicetext/README.txt | 90 +++ .../doc/latex/nicetext/doclog/fifinddo.doc | 807 +++++++++++++++++++++ .../doc/latex/nicetext/doclog/makedoc.doc | 442 +++++++++++ .../doc/latex/nicetext/doclog/mdcorr.doc | 25 + .../doc/latex/nicetext/doclog/niceverb.doc | 283 ++++++++ .../doc/latex/nicetext/docsrc/WIKICHEA.TEX | 148 ---- .../doc/latex/nicetext/docsrc/makedoc.tex | 82 --- .../doc/latex/nicetext/docsrc/niceverb.tex | 261 ------- Master/texmf-dist/doc/latex/nicetext/fifinddo.pdf | Bin 0 -> 250201 bytes Master/texmf-dist/doc/latex/nicetext/makedoc.pdf | Bin 0 -> 210492 bytes Master/texmf-dist/doc/latex/nicetext/niceverb.pdf | Bin 138688 -> 184077 bytes .../texmf-dist/source/latex/nicetext/fifinddo.tex | 290 ++++++++ .../texmf-dist/source/latex/nicetext/makedoc.cfg | 57 ++ .../texmf-dist/source/latex/nicetext/makedoc.tex | 214 ++++++ Master/texmf-dist/source/latex/nicetext/mdcorr.cfg | 15 + .../texmf-dist/source/latex/nicetext/mkfddoc.tex | 21 + .../texmf-dist/source/latex/nicetext/niceverb.tex | 331 +++++++++ .../texmf-dist/source/latex/nicetext/wikicheat.tex | 148 ++++ Master/texmf-dist/tex/latex/nicetext/fifinddo.sty | 676 +++++++++++++++++ Master/texmf-dist/tex/latex/nicetext/makedoc.sty | 367 ++++++++++ Master/texmf-dist/tex/latex/nicetext/niceverb.sty | 111 +-- 24 files changed, 3946 insertions(+), 553 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/nicetext/CHANGE.LOG create mode 100644 Master/texmf-dist/doc/latex/nicetext/NNOUNCE.TXT create mode 100644 Master/texmf-dist/doc/latex/nicetext/README.txt create mode 100644 Master/texmf-dist/doc/latex/nicetext/doclog/fifinddo.doc create mode 100644 Master/texmf-dist/doc/latex/nicetext/doclog/makedoc.doc create mode 100644 Master/texmf-dist/doc/latex/nicetext/doclog/mdcorr.doc create mode 100644 Master/texmf-dist/doc/latex/nicetext/doclog/niceverb.doc delete mode 100644 Master/texmf-dist/doc/latex/nicetext/docsrc/WIKICHEA.TEX delete mode 100644 Master/texmf-dist/doc/latex/nicetext/docsrc/makedoc.tex delete mode 100644 Master/texmf-dist/doc/latex/nicetext/docsrc/niceverb.tex create mode 100644 Master/texmf-dist/doc/latex/nicetext/fifinddo.pdf create mode 100644 Master/texmf-dist/doc/latex/nicetext/makedoc.pdf create mode 100644 Master/texmf-dist/source/latex/nicetext/fifinddo.tex create mode 100644 Master/texmf-dist/source/latex/nicetext/makedoc.cfg create mode 100644 Master/texmf-dist/source/latex/nicetext/makedoc.tex create mode 100644 Master/texmf-dist/source/latex/nicetext/mdcorr.cfg create mode 100644 Master/texmf-dist/source/latex/nicetext/mkfddoc.tex create mode 100644 Master/texmf-dist/source/latex/nicetext/niceverb.tex create mode 100644 Master/texmf-dist/source/latex/nicetext/wikicheat.tex create mode 100644 Master/texmf-dist/tex/latex/nicetext/fifinddo.sty create mode 100644 Master/texmf-dist/tex/latex/nicetext/makedoc.sty (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/nicetext/CHANGE.LOG b/Master/texmf-dist/doc/latex/nicetext/CHANGE.LOG new file mode 100644 index 00000000000..cb8826d2ff2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/nicetext/CHANGE.LOG @@ -0,0 +1,33 @@ +______________________________________________________________________ +nicetext RELEASE 0.2 2009/04/15 add `fifinddo' and `makedoc' for + txt -> latex preprocessing + +- README 2009/04/15 updated + CHANGE.LOG 2009/04/15 new + +- fifinddo.sty v0.3 2009/04/15 first CTAN release + fifinddo.pdf 2009/04/15 + mkfddoc.tex 2009/04/15 + +- makedoc.sty v0.2 2009/04/13 first CTAN release + makedoc.pdf 2009/04/15 + makedoc.cfg 2009/04/15 + mdcorr.cfg 2009/04/15 + +- niceverb.sty v0.2 2009/04/15 strengthened \SimpleVerb, + \sf detection after `(', + more for \niceverbNoVerList + niceverb.pdf 2009/04/15 adjusted to new doc generation + method, mentioning it, + motivation extended, + more examples + +______________________________________________________________________ +nicetext RELEASE 0.1 2009/02/23: first CTAN releases of + `niceverb' and `wiki' + +- niceverb.sty v0.1 2009/02/21 + niceverb.pdf 2009/02/23 + +- wiki.sty v0.2 2008/07/02 + wikicheat.pdf 2009/01/17 diff --git a/Master/texmf-dist/doc/latex/nicetext/NNOUNCE.TXT b/Master/texmf-dist/doc/latex/nicetext/NNOUNCE.TXT new file mode 100644 index 00000000000..4d3c83272a0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/nicetext/NNOUNCE.TXT @@ -0,0 +1,25 @@ +'fifinddo' & 'makedoc' -- string substitution and "txt->TeX" by LaTeX +====================================================================== +The NICETEXT bundle offers ``minimal'' markup syntax for restricted +kinds of text: There should not be much more characters typed than +printed! (though keeping LaTeX quality.) No more backslashes, +technical terms, and curly braces! (so clumsy on PC keyboards) ... + +Main focus now is easy *documentation of LaTeX packages*. +Preprocessing by 'Perl' or so is replaced by TeX macros +(reviving/generalizing the 'docstrip' idea). + +'fifinddo.sty' provides setup for txt -> TeX preprocessing macros +including *expandable* sequences of safe, correct string substitions. +'fifinddo.pdf' mathematically characterizes wrong substring +detection by 'substr.sty' as well as by LaTeX's internal `\in@'. + +There is a script language for detecting package code and +documentation and for supplying plain text with typographical markup +('makedoc.sty', 'mdcorr.cfg'). +______________________________________________________________________ +CATALOGUE: These packages might be compared with: +- easylatex, txt2latex, txt2tex + (typographical and TeX input enhancement); +- doc, gmdoc, lineno (\DocInput); +- substr, datatool, xstring, stringstrings, makematch, ... (parsing) diff --git a/Master/texmf-dist/doc/latex/nicetext/README b/Master/texmf-dist/doc/latex/nicetext/README index 171fd1d339f..b2b7811b975 100644 --- a/Master/texmf-dist/doc/latex/nicetext/README +++ b/Master/texmf-dist/doc/latex/nicetext/README @@ -2,14 +2,22 @@ (c) 2009 Uwe Lueck http://contact-ednotes.sty.de.vu + == General Idea == -The NICETEXT bundle offers ``minimal'' markup syntax for rather +The NICETEXT bundle supports ``minimal'' markup syntax for rather simple kinds of text. The code you type should show little more characters than are printed, though you get LaTeX quality. We try to do away with backslashes, technical terms, and curly braces (which also are so clumsy to type on PC keyboards). +Main focus is easy documentation of LaTeX packages. Preprocessing +by Perl or so is replaced by TeX macros (reviving/generalizing the +'docstrip' idea), including expandable, safe, correct string +substitution and typographical enhancements of plain text for +LaTeX input. + + == Packages == 'wiki.sty' addresses general kinds of texts. 'niceverb.sty' is @@ -23,37 +31,60 @@ you just type \foo[]{} !-) - == Comparison == +'fifinddo.sty' provides basic setup for text filtering, especially +string substitution. 'makedoc.sty' extends it to provide a simple +script language for transforming plain text package files into LaTeX +input files [manual!?]. One LaTeX run can perform preprocessing and +typesetting. + + + == Comparisons == -One source of inspiration is the markup syntax that is used in -editing Wikipedia pages. The package 'wiki.sty' of the bundle -offers a very similar syntax as a LaTeX front-end. It suffices for -italics, boldface, sectioning, and certain list-like environments. -This is also similar to 'easylatex', +One source of inspiration is the markup syntax of editing Wikipedia +pages. 'wiki.sty' of the bundle offers something similar as a LaTeX +front-end for italics, boldface, sectioning, and certain list-like +environments. This is also similar to 'easylatex', http.//www.ctan.org/pkg/easylatex -which is more powerful and uses Perl. 'wiki.sty', by contrast, is -just a LaTeX package, working on any TeX installation. +which is more powerful and uses Perl. NICETEXT, by contrast, consists +just of LaTeX packages, working on any TeX installation [!? note +restrictions in 'fifinddo.pdf']. Cf. also preprocessor packages +'txt2tex' and 'txt2latex'. + +Concerning ``self-documentation,'' there is a difference to current +`\DocInput', similar ideas are in 'gmdoc' and 'lineno.sty', +see 'niceverb.pdf' and 'makedoc.pdf'. Standard 'doc.sty' and +'contrib' extensions of it are rather avoided. + +There are several *LaTeX macro* packages for processing text or +databases or for editing TeX's input stream while typesetting +-- see 'fifinddo.pdf'. What seems to be new here is +*expandable string substitution* and safe, correct detection of +substrings -- discussed in 'fifinddo.pdf'. + == Documentation == +'fifinddo.pdf' describes 'fifinddo.sty', typeset from 'fifinddo.tex'. +'makedoc.pdf' describes 'makedoc.sty', typeset from 'makedoc.tex'. +'niceverb.pdf' describes 'niceverb.sty', typeset from 'niceverb.tex'. + +Typesetting them anew (for customizing printout) requires +'makedoc.cfg', 'mdcorr.cfg', 'mkfddoc.tex' and the *.sty files +in the working directory (no special guarantee that your hacks will +work!) Cf. provided *.log files for what was input for *.pdf. + 'wikicheat.pdf' is a one-page manual of 'wiki.sty'. The file -'wiki.sty' contains additional documentation as ASCII text. -'niceverb.pdf' describes 'niceverb.sty'. Note that certain -features must be activated by commands in the document environment. +'wiki.sty' contains additional documentation as plain text. +Note that certain features must be activated by commands in the +document environment. + == What is missing == -1. 'niceverb' should extend 'wiki', yet their font switchings are -incompatible at present. 2. 'niceverb' should typeset the ASCII -documentation of 'wiki.sty' ... This upload is for reference and -for proving that I am not just dreaming. I think repairing needs -only few hours, yet I must do something different right now. See -more on what's missing in 'niceverb.pdf'. +A lot, see niceverb.pdf and fifinddo.pdf. -3. I have a package 'nicedots' for controlling horizontal spacing -with ellipses which may go here. ________________________________ - [This file 2009/02/23 Uwe Lueck] + [This file 2009/04/15 Uwe Lueck] diff --git a/Master/texmf-dist/doc/latex/nicetext/README.txt b/Master/texmf-dist/doc/latex/nicetext/README.txt new file mode 100644 index 00000000000..b2b7811b975 --- /dev/null +++ b/Master/texmf-dist/doc/latex/nicetext/README.txt @@ -0,0 +1,90 @@ + The NICETEXT bundle + + (c) 2009 Uwe Lueck http://contact-ednotes.sty.de.vu + + + == General Idea == + +The NICETEXT bundle supports ``minimal'' markup syntax for rather +simple kinds of text. The code you type should show little more +characters than are printed, though you get LaTeX quality. We try +to do away with backslashes, technical terms, and curly braces +(which also are so clumsy to type on PC keyboards). + +Main focus is easy documentation of LaTeX packages. Preprocessing +by Perl or so is replaced by TeX macros (reviving/generalizing the +'docstrip' idea), including expandable, safe, correct string +substitution and typographical enhancements of plain text for +LaTeX input. + + + == Packages == + +'wiki.sty' addresses general kinds of texts. 'niceverb.sty' is +made for documenting LaTeX packages. 'niceverb.sty' especially +offers [almost-]WYSIWIG for meta-variables (macro arguments) and +for referring to commands (and their syntax) in footnotes, +section titles etc. E.g., to get the syntax description + + \foo[]{} +you just type + \foo[]{} +!-) + +'fifinddo.sty' provides basic setup for text filtering, especially +string substitution. 'makedoc.sty' extends it to provide a simple +script language for transforming plain text package files into LaTeX +input files [manual!?]. One LaTeX run can perform preprocessing and +typesetting. + + + == Comparisons == + +One source of inspiration is the markup syntax of editing Wikipedia +pages. 'wiki.sty' of the bundle offers something similar as a LaTeX +front-end for italics, boldface, sectioning, and certain list-like +environments. This is also similar to 'easylatex', + + http.//www.ctan.org/pkg/easylatex + +which is more powerful and uses Perl. NICETEXT, by contrast, consists +just of LaTeX packages, working on any TeX installation [!? note +restrictions in 'fifinddo.pdf']. Cf. also preprocessor packages +'txt2tex' and 'txt2latex'. + +Concerning ``self-documentation,'' there is a difference to current +`\DocInput', similar ideas are in 'gmdoc' and 'lineno.sty', +see 'niceverb.pdf' and 'makedoc.pdf'. Standard 'doc.sty' and +'contrib' extensions of it are rather avoided. + +There are several *LaTeX macro* packages for processing text or +databases or for editing TeX's input stream while typesetting +-- see 'fifinddo.pdf'. What seems to be new here is +*expandable string substitution* and safe, correct detection of +substrings -- discussed in 'fifinddo.pdf'. + + + == Documentation == + +'fifinddo.pdf' describes 'fifinddo.sty', typeset from 'fifinddo.tex'. +'makedoc.pdf' describes 'makedoc.sty', typeset from 'makedoc.tex'. +'niceverb.pdf' describes 'niceverb.sty', typeset from 'niceverb.tex'. + +Typesetting them anew (for customizing printout) requires +'makedoc.cfg', 'mdcorr.cfg', 'mkfddoc.tex' and the *.sty files +in the working directory (no special guarantee that your hacks will +work!) Cf. provided *.log files for what was input for *.pdf. + +'wikicheat.pdf' is a one-page manual of 'wiki.sty'. The file +'wiki.sty' contains additional documentation as plain text. +Note that certain features must be activated by commands in the +document environment. + + + == What is missing == + +A lot, see niceverb.pdf and fifinddo.pdf. + + + ________________________________ + [This file 2009/04/15 Uwe Lueck] diff --git a/Master/texmf-dist/doc/latex/nicetext/doclog/fifinddo.doc b/Master/texmf-dist/doc/latex/nicetext/doclog/fifinddo.doc new file mode 100644 index 00000000000..7178ee20640 --- /dev/null +++ b/Master/texmf-dist/doc/latex/nicetext/doclog/fifinddo.doc @@ -0,0 +1,807 @@ +\ProvidesFile{fifinddo.doc}[2009/04/16 automatically generated with makedoc.sty] +\begin{packagecode} +%% Macro package `fifinddo.sty' for LaTeX2e, %% FIDO, FIND! +%% copyright (C) 2009 Uwe L\"uck, +%% http://www.contact-ednotes.sty.de.vu +%% -- author-maintained in the sense of LPPL below -- +%% for processing tex(t) files +%% (checking, filtering, converting, substituting, expanding, ...) + +\def\fileversion{0.3} \def\filedate{2009/04/15} + +%% This file can be redistributed and/or modified under +%% the terms of the LaTeX Project Public License; either +%% version 1.3a of the License, or any later version. +%% The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% We did our best to help you, but there is NO WARRANTY. +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +%% For the full documentation, look for `fifinddo.pdf'. +%% Its source starts in `fifinddo.tex'. +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Format and package version \unskip } + +\begin{packagecode} +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +% 1994/12/01: \newcommand* etc. +\ProvidesPackage{fifinddo}[\filedate\space v\fileversion\space + filtering TeX(t) files by TeX (UL)] +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Category codes \unskip } + + +We use the ``underscore'' as ``compound identifier.'' +\begin{packagecode} +\catcode`\_=11 %% underscore used in control words +\end{packagecode} +|\MakeOther| is a synonym for `\@makeother', needed for matching +special characters from the input file. It is exemplified by +|\fdPatternCodes| which is the default of |\PatternCodes|. +The latter is used in setup macros for reading patterns. +\begin{packagecode} +\@ifundefined{MakeOther}{\let\MakeOther\@makeother}{} +\newcommand*{\fdPatternCodes}{\MakeOther\&\MakeOther\$} +\newcommand*{\PatternCodes}{} \let\PatternCodes\fdPatternCodes + %% TODO adding/removing +\end{packagecode} +It would be bad to have `\MakeOther\%' and `\MakeOther\ ' here in +that this may have unexpected, weird effects with arguments of +setup macros. Therefore neither `\dospecials' nor `\@sanitize' are +used. Curly braces remain untouched as default delimiters in setup +macros. For matching them, you must use `\MakeOther\{' and +`\MakeOther' in your `\PatternCodes', or |\Delimiters| to introduce +new ones at the same time, e.g., `\Delimiters\[\]': +\begin{packagecode} +\newcommand*{\Delimiters}[2]{% + \MakeOther\{\MakeOther\}\catcode`#1=1\catcode`#2=2\relax} +\end{packagecode} +For replacing strings or for defining other strings of ``other'' +characters by `\edef', you can use some \LaTeX\ constructs---here +are copies |\PercentChar| and |\BackslashChar| of them +(do you need more?): +\begin{packagecode} +\newcommand*{\PercentChar}{} \let\PercentChar\@percentchar +\newcommand*{\BackslashChar}{} \let\BackslashChar\@backslashcar +\end{packagecode} + +\section{\hspace{1sp}\ignorespaces File handling \unskip } + +\begin{packagecode} +\newwrite\result_file %% or write to \@mainaux!? +\end{packagecode} +|\ResultFile{}| opens (and empties) a file + to be written into. +\begin{packagecode} +\newcommand*{\ResultFile}[1]{% + \def\result_file_name{#1}% + \immediate\openout\result_file=#1} +\end{packagecode} +|\WriteResult{}| writes a line into + (or more lines with `^^J'). +\begin{packagecode} +\newcommand*{\WriteResult}[1]{% + \immediate\write\result_file{#1}} +\end{packagecode} +|\WriteProvides| writes a `\ProvidesFile' command to the +opened file. This should be used when +is made as \LaTeXe\ input. +\begin{packagecode} +\newcommand*{\WriteProvides}{% + \WriteResult{% + \string\ProvidesFile{\result_file_name}% + [\the\year/\two@digits\month/\two@digits\day\space + automatically generated with fifinddo.sty]}}% +\end{packagecode} +|\ProcessFileWith{}{}| opens a file +and runs a loop on its lines the main body of which is . +When it starts, a new line of is stored as macro +|\fdInputLine|. +\begin{packagecode} +\newcommand*{\ProcessFileWith}[2]{% + \openin\@inputcheck=#1% +% \ifeof\@inputcheck %% bad `exists?' test +% \PackageError{fifinddo}{File `#1' not here}% +% {Mistyped?}% +% \else + \global\c@fdInputLine=\z@ %% line counter reset + \begingroup + \MakeOther\{\MakeOther\}\@sanitize + %% from docstrip.tex: + % \MakeOther\^^A\MakeOther\^^K%% irrelevant, not LaTeX + \endlinechar\m@ne + %% <- cf. TeXbook "extended keyboards" up-/downarrow + %% -> "math specials", cf. "space specials" + \MakeOther\^^I% ASCII horizontal tab -- guessed!? ^^L!? + \loop \ifeof\@inputcheck \else + \read\@inputcheck to \fdInputLine + \ignorespaces #2% + \repeat + \endgroup +% \fi + \closein\@inputcheck} +\end{packagecode} +|\CloseResultFile| closes . +\begin{packagecode} +\newcommand*{\CloseResultFile}{\immediate\closeout\result_file} +\end{packagecode} +Peter Wilson's 'newfile' provides more powerful file handling. +% <- TODO relevant? 2009/04/12 + +\pagebreak %% TODO move theory to fifinddo.tex 2009/04/12 + +\section{\hspace{1sp}\ignorespaces Basic handling of substring conditionals \unskip } + +\label{sec:theory} + +\subsection{\hspace{1sp}\ignorespaces ``Substring Theory'' \unskip } + +\begin{flushright}\it +I wished I could study string theory,\\ +but I only could study substring theory. +\end{flushright} +A \TeX\ macro, say, `\find' whose parameter text +(cf.\ \TeX book p.~203) +starts with `#1#2&' stops \TeX\ with an error if it does +not find and then `&'. Otherwise we have a situation +`\find&', and `\find' reads as +#1 and as #2. An important point to note is that +will not contain , but possibly has more +occurrences in . In this sense, `\find' uses the +\emph{first} occurrence of it finds in order to delimit #1. +Finding the \emph{last} occurrence of therefore needs a +special idea. + +In order to use `\find' for a test whether is in +, we build a ``sandbox'' |\find&|, where +contains \emph{and additionally} ---as a +``dummy;'' so `&' delimits the search and `\find' finds + either in or somewhere else before `&'. + +Consider the simple sandbox |\find&|. +We can test #1 and #2 on being empty by `\ifx$#1$' and `\ifx$#2$'. +If #2 is empty, is \emph{not} in . +If #1 is empty at the same time, is empty. +If #1 is empty and #2 is not, \emph{starts} ! +This can be used to implement +Wikipedia-like lists %% TODO 2009/04/11 +and to distinguish package code from comments in 'makedoc'. + +If #2 is \emph{not} empty, occurs in ---or this once +was \emph{thought}, some time in developping the present package, +as well as in the version of 'substr.sty' marked +`2005-11-29',\footnote{\hspace{1sp}'substr' does not change + category codes + % as 'fifinddo' does + and uses \cs{@nil} as delimiter instead of our &&.} try +\[`\IfSubStringInString{}{}{YES}{NO}'\] +which works \emph{verbatim} as well as considering and + \emph{placeholders}, e.g., for +\begin{center} + `\IfSubStringInString{day after day}{day after }{YES}{NO}'\footnote{% + Likewise \texttt{t\string\^ete-\string\`a-t\string\^te} $\dots$}\\ + `\IfSubStringInString{AMSTERDAM}{AMSTERD}{YES}{NO}'\\ + `\IfSubStringInString{TORONTO}{TORON}{YES}{NO}'\\ + `\IfSubStringInString{bonbon}{bon}{YES}{NO}'\footnote{% + Polynesian: `aku aku', `rongorongo', `wiki wiki' $\dots$}\\ + `\IfSubStringInString{bonobo}{bono}{YES}{NO}' + (an ape) +\end{center} +or `\IfSubStringInString{ionization}{ionizat}{YES}{NO}'.\footnote{% + Read 'substr.sty' or try ``normal'' things to convince yourself + that the syntax indeed is + &\IfSubStringInString{}{}{}{}.} +Same with \LaTeX's internal `\in@': +\[`\makeatletter \in@{bonbon}{bon}\ifin@ YES\else NO\fi \makeatother'\] +%% \makeatletter \in@{bonbon}{bon}\ifin@ YES\else NO\fi \makeatother +%% \IfSubStringInString{ionization}{ionizat}{YES}{NO} + +In general, the previous approach \emph{fails if and exactly if} + has a \emph{period} $p$---less than its length---in the sense of that +the $p$th token to the right or left of each token in +is the \emph{same} token. +`AMSTERDAM' has a period 8, `day after day' 10, `bonbon' 3, `bonobo' 4. +There is a counterexample of length $p$ iff + has period $p$, namely the first substring of +having length $p$. If the length of exceeds a multiple +$mp$ of its period, the first $mp$ tokens of form +a counterexample . + +Therefore, a sandbox must have something between and +. We choose |\find~$&| as standard. +The `$' will be used as an argument delimiter to get rid of the dummy + in , as well as to decide whether the match was +in or in the dummy part of the sandbox. +The `$' can be replaced by another tilde `~' in order to +test whether \emph{ends} on a , defining a macro +like `\findatend' whose parameter text starts with `#1~#2&'. + + +\subsection{\hspace{1sp}\ignorespaces Plan for proceeding \unskip } + +When we check a file for several patterns, we seem to need +\emph{two} macros for each pattern: one that has the pattern +in its parameter text and one that stores the pattern for building +the sandbox.\footnote{If it were for the pattern only, the parsing + macro might suffice and the macro calling it might extract the + pattern from a ``dummy expansion.'' Somewhat too much for me now; + on the other hand the calling macro also hands some ``current'' + informations to the parsing macro---oh, even this could be + handled by a general ``calling'' macro \dots} + %% TODO 2009/04/15 +We use a separate \emph{``name space''} for each of +both kinds. The parsing macro and the macro building the sandbox +will have a common \emph{``identifier''} by which the user or +programmer calls them. Actually, she will usually (first) call +the sandbox box builder. The sandbox builder calls the parsing +macro. When \emph{all} occurrences of a pattern in the target are +looked for, the parser may call itself. + +Actually, the parsing macro will execute certain actions +depending on what it finds in the sandbox, so we call it a +\emph{``substring conditional''}. It may read additional arguments +after the sandbox that store information gathered before. +This is especially useful for designing \emph{``expandable''} +chains (sequences) of conditionals where macros cannot store information in +macros. The macro setting up the sandbox will initialize such +extra arguments at the same time. + +It may be more efficient \emph{not} to use the following setup +macros but to type the macros yourself, just using the following +as templates. The setup macros are especially useful with patterns +that contain ``special characters,'' as when you are looking for +lines that might be package comments. + + +\subsection{\hspace{1sp}\ignorespaces Set up conditionals \unskip } + +`substr_cond' is the ``name space'' for substring conditionals. +A colon separates it from \emph{``job identifiers''} in the actual +macro names. +\begin{packagecode} +\def\substr_cond{substr_cond:} +\end{packagecode} +|\MakeSubstringConditional{}[]{}| +starts the definition of a conditional with \emph{identifier} +and pattern . optionally add commands to +be executed after `\PatternCodes' in a local group. +It may be more safe to redefine `\PatternCodes' instead. +\begin{packagecode} +\newcommand*{\MakeSubstringConditional}{% + \afterassignment\mk_substr_cond_san \def\cond_id} +\newcommand*{\mk_substr_cond_san}[1][]{% + \begingroup \PatternCodes #1\mk_substr_cond} + %% #1 more changes +\end{packagecode} +`\begingroup' |\mk_substr_cond{}| +can be directly called by other programmer setup commands when +`\cond_id' and have been read. +\begin{packagecode} +\def\mk_substr_cond #1{%% #1 pattern string + \endgroup \@namedef{\substr_cond \cond_id}##1#1##2&} +\end{packagecode} +This really is not \LaTeX. We are starting defining a macro +`\substr_cond:' in primitive \TeX\ with `\def' in the form +\[`\def\substr_cond:#1#2&'\] +where `\csname' etc.\ render \lq`:'\rq\ part of the macro name. +The user or programmer macro produces the part of the definition +until the delimiter `&' to match the sandbox. You have to add +(maybe) #3 etc.\ and the `{}' +just as with primitive \TeX. + + +\subsection{\hspace{1sp}\ignorespaces Set up sandboxes \unskip } + +There was a \emph{question:} will we rather see +\emph{string macros} or \emph{strings from macro arguments}? +The input file content always comes +as `\fdInputLine' first, so we at least \emph{must account} for +the possibility of string macros as input. + +One easy way to apply several checks and substitutions to +`\fdInputLine' before the result is written to is +`\let\OutputString\fdInputLine' and then let `\OutputString' +be to what each job refers as \emph{its} +input and output, finally `\WriteResult{\OutputString}'. +(`\fdInputLine' might better not be touched, it could be used +for a final test whether any change applied for some message on +screen, even with an entirely expandable chain of actions.) +This way each job, indeed each recursive substitution of a single +string must start with expanding `\OutputString'. + +On the other hand, there is the idea of \emph{``expandable'' +chains of substitutions}. We may, e.g., define a macro, say, +`\manysubstitutions{}', such that +`\WriteResult{\manysubstitutions{\fdInputLine}}' +writes to the result of applying many expandable +substitutions to `\fdInputLine'. +Such a macro `\manysubstitutions' may read `\fdInputLine', +but it must not redefine any macros. +Instead, the substitution macros it calls must read results +of previous substitutions as \emph{arguments}. + +Another aspect: +the order of substitutions should be easy to +change. Therefore expanding of string macros should rather be +controlled by the way a job is \emph{called}, not right here +at the \emph{definition} of the job. For this reason, +a variant of the sandbox builder expanding some macro was given up. + +`setup_substr_cond' is the name space for macros that build +sandboxes and initialize arguments for conditional macros. +\begin{packagecode} +\def\setup_substr_cond{setup_substr_cond:} +\end{packagecode} +|\MakeSetupSubstringCondition{}[]{}{}| +% <- TODO allow `%' and ` ' for breaking code lines. +---same , , as for +`\MakeSubstringConditional' (this is bad, there may be +|\MakeSubstringConditional*{}|)---creates the +% <- TODO: store args in \Make$\dots$Conditional +corresponding sandbox, by default without tilde wrap. + may contain `{#1}' to store the string that was tested, +also `{}' for calling repetitions and `{}' for screen +or log informations. +\begin{packagecode} +\newcommand*{\MakeSetupSubstringCondition}{% + \afterassignment\mk_setup_substr_cond_san \def\cond_id} +\newcommand*{\mk_setup_substr_cond_san}[1][]{% + \begingroup \PatternCodes #1\mk_setup_substr_cond} +\end{packagecode} +`\begingroup' |\mk_setup_substr_cond{}{}| +can be directly called by other programmer setup commands after +`\cond_id' and have been read: +\begin{packagecode} +\def\mk_setup_substr_cond #1#2{%% #1 pattern string, + %% #2 additional arguments, e.g., `{#1}' to keep tested string + \endgroup + \expandafter \edef + \csname \setup_substr_cond \cond_id \endcsname ##1{% +% \expandafter \noexpand +% \csname \substr_cond \cond_id \endcsname %% 2009/04/10: + \make_not_expanding_cs{\substr_cond \cond_id}% +\end{packagecode} +By `\edef', the name of the substring conditional is stored here +as a single token. The rest of the sandbox follows. +\begin{packagecode} + ##1\noexpand~#1\dollar_tilde}% + \let\dollar_tilde\sandbox_dollar} +\end{packagecode} +If a tilde `~' has been used instead of `$', the default +is restored. +\begin{packagecode} +\def\sandbox_dollar{$} +\let\dollar_tilde\sandbox_dollar +\end{packagecode} +The following general tool |\make_not_expanding_cs| has been used +(many definitions in 'latex.ltx' could have used it): %% 2009/04/10 +\begin{packagecode} +\def\make_not_expanding_cs#1{% + \expandafter \noexpand \csname #1\endcsname} +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Getting rid of the tildes \unskip } + +|\let~\TildeGobbles| can be used to suppress dummy patterns +(contained in ) +in `\write'ing or with `\edef'. $\dots$ will probably become obsolete +$\dots$ however, it is helpful in that you needn't care +whether there is a dummy wrap left at all. (2009/04/13) +\begin{packagecode} +\newcommand{\TildeGobbles}{} \def\TildeGobbles#1${} +\end{packagecode} +|\RemoveDummyPattern| is used to remove the dummy pattern +\emph{immediately}, not waiting for `\write'ing +or other ``total'' expansion: %% 2009/04/13 +\begin{packagecode} +\newcommand{\RemoveDummyPattern}{} \def\RemoveDummyPattern#1~#2${#1} +\end{packagecode} +|\RemoveDummyPatternArg{}| executes +`\RemoveDummyPattern' in the next argument: +\begin{packagecode} +\newcommand*{\RemoveDummyPatternArg}[2]{% + \expandafter #1\expandafter {\RemoveDummyPattern #2}} +\end{packagecode} +|\RemoveTilde| is used to remove the tilde that separated +the dummy pattern from . +\begin{packagecode} +% %% An alternative policy is to pass +% %% (as an argument) to the parsing macro. +\newcommand{\RemoveTilde}{} \def\RemoveTilde#1~{#1} +\end{packagecode} +|\RemoveTildeArg{}| executes `\RemoveTilde' +in the next argument: +\begin{packagecode} +\newcommand*{\RemoveTildeArg}[2]{% + \expandafter #1\expandafter {\RemoveTilde #2}} +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Calling conditionals \unskip } + +|\ProcessStringWith{}{}| builds the sandbox +to search for the associated with the +parser-conditional that is identified by , the sandbox then +calls the parser. +\begin{packagecode} +\newcommand*{\ProcessStringWith}[2]{% + \csname \setup_substr_cond #2\endcsname{#1}} +\end{packagecode} +|\ProcessExpandedWith{}{}| does the same but with +a \emph{macro} (like `\fdInputLine' or `\OutputString') in which +the string to be tested is stored. +\begin{packagecode} +\newcommand*{\ProcessExpandedWith}[2]{% + \csname \setup_substr_cond #2\expandafter \endcsname + \expandafter{#1}} +\end{packagecode} +I would have preferred the reversed order of arguments which seems +to be more natural, but the present is more efficient. +Macros with reversed order are currently stored after `\endinput' +in section~\ref{sec:pondered}, may be they once return. + +Anyway, most desired will be |\ProcessInputWith{}| just +applying to `\fdInputLine': +\begin{packagecode} +\newcommand*{\ProcessInputWith}[1]{% + \csname \setup_substr_cond #1\expandafter \endcsname + \expandafter{\fdInputLine}} +\end{packagecode} +(Definition almost copied for efficiency.) +\begin{packagecode} + %% TODO: error when undefined 2009/04/07 +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Copy jobs \unskip } + +A job identifier may also be considered a mere \emph{hook}, +a \emph{placeholder} for a parsing job. What function actually is +called may depend on conditions that change while reading the + file. %%% On a certain condition, +|\CopyFDconditionFromTo{}{}| +\emph{creates or redefines a sandbox builder} with identifier +that afterwards behaves like the sandbox builder . +So you can store a certain behaviour as in advance in order +once to change the behaviour of into that of . +\begin{packagecode} +\newcommand*{\CopyFDconditionFromTo}[2]{% + \expandafter \let + \csname \setup_substr_cond #2\expandafter \endcsname + \csname \setup_substr_cond #1\endcsname} +\end{packagecode} +(Only the \emph{sandbox} is copied here---what about +changing conditionals?) %% TODO + +An ``almost'' example is typesetting documentation from a package +file where the ``Legalese'' header might be typeset verbatim +although it is marked as ``comment.'' (The present %% 2009/04/07 +example changes ``hand-made'' macros instead.) + +This feature could have been placed more below as a ``programming +tool.'' + + +\section{\hspace{1sp}\ignorespaces Programming tools \unskip } + + +\subsection{\hspace{1sp}\ignorespaces Tails of conditionals \unskip } + +\label{sec:tails} +When creating complex \emph{expandable} conditionals, +this may amount to have primitive `\if' $\dots$ `\fi' conditionals +nested quite deeply, once perhaps too deep for \TeX's memory. +To avoid this, you can apply the common `\expandafter' trick +which finishes the current `\if' $\dots$ `\fi' before an inside +macro is executed (cf.\ \TeX book p.~219 on ``tail recursion''). + +Internally tests whether certain strings are present at certain +places will be carried out by tests on emptiness or +onwards) on starting with `~'. E.g., +``#1~=~ empty'' indicates that either the +starts a line or the line is empty altogether (this must be +decided by another test). + +|\IfFDempty{}{}{}| +is used to test on emptyness (without expanding it): +\begin{packagecode} +\newcommand*{\IfFDempty}[1]{% + \ifx$#1$\expandafter \@firstoftwo \else + \expandafter \@secondoftwo \fi} +\end{packagecode} +|\IfFDinputEmpty{}{}| is a variant of +the previous to execute if the loop processing +finds an empty line---otherwise . +\begin{packagecode} +\newcommand*{\IfFDinputEmpty}{% + \ifx\fdInputLine\@empty \expandafter \@firstoftwo \else + \expandafter \@secondoftwo \fi} +\end{packagecode} +|\IfFDdollar{}{}{}| +is another variant, testing for being `$', +main indicator of there is a match anywhere in +(as opposed to starting or ending match): +\begin{packagecode} +\newcommand*{\IfFDdollar}[1]{% + \ifx$#1\expandafter \@firstoftwo \else + \expandafter \@secondoftwo \fi} +\end{packagecode} +It is exemplified and explained in section~\ref{sec:replchain}. +(The whole policy requires that `~' remains active in any + testing macros here!) + +However, you might always just type the replacement text +(in one line) instead of +such an `\If'\,$\dots$ (for efficiency \dots) + +If expandability is not desired, you can just chain macros that +rework (so re-define) `\OutputString' or so. + +2009/04/11: tending towards combining $\dots$ +Keeping empty input and empty arguments apart is useful in that +\emph{one} test of emptiness per input line should suffice---it +may be left open whether this should be the first of all tests +\dots + + +\subsection{\hspace{1sp}\ignorespaces Line counter \unskip } + +A \LaTeX\ counter |fdInputLine| may be useful for screen or log +messages, moreover you can use it to control processing of the + file ``from outside,'' not dependent on what the parsing +macros find. The header of the file might be typeset verbatim, +but we may be too lazy to define the ``header'' in terms of +what is in the file. We just decide that the first $\dots$ lines +are the ``header,'' even without counting just trying whether +the output is fine. It may be necessary to change that number +manually when the header changes. + +You also can insert lines in +which have no counterpart in ---if you know what you are +doing. With 'makedoc', there is a hook `\EveryComment' that can +be used to issue commands ``from outside'' at a place where +executing the command is safe or appropriate. +\begin{packagecode} +\newcounter{fdInputLine} +\end{packagecode} +You then must insert |\CountInputLines| in the second argument +of `\ProcessFileWith' (or in a macro called from there) +so that the counter is stepped. %% TODO!? 2009/04/07 +\begin{packagecode} +\newcommand*{\CountInputLines}{\global\advance\c@fdInputLine\@ne} +\end{packagecode} +At present %% 2009/04/07 TODO +the counter is reset by `\ProcessFileWith', this may change. + +|\IfInputLine{}{}{}|, when called +from the processing loop (second argument of `\ProcessFileWith') +issues commands if `\value{fdInputLine}' +is true, otherwise . may usually be just `='. +\begin{packagecode} +\newcommand*{\IfInputLine}[1]{% + \ifnum\c@fdInputLine#1\relax \expandafter \@firstoftwo + \else \expandafter \@secondoftwo \fi} +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces The ``identity job'' `LEAVE' \unskip } + +\label{sec:LEAVE} +The job with identifier |LEAVE| +\emph{leaves} an (expandable) chain of jobs +(as expandable replacement in section~\ref{sec:replchain}) +and \emph{leaves} the processed string without changing it +and without the braces enclosing it: +\begin{packagecode} +\expandafter \let + \csname \setup_substr_cond LEAVE\endcsname \@firstofone +\end{packagecode} +I.e., `\ProcessStringWith{}{LEAVE}' expands to +$\dots$ \ProcessStringWith{(Indeed!)}{LEAVE} + + +\section{\hspace{1sp}\ignorespaces Setup for expandable chains of replacements \unskip } + +\label{sec:replchain}%% TODO makedoc: provide less visible label/ref 2009/04/11 +By the following means, you can create macros +(`\Transform' among them) such that, e.g., +\[`\edef\OutputString{\Transform{}}'\] renders `\OutputString' +the result of applying a chain (sequence) of stringwise replacements +to . +You can even write a transformed input to a file +without defining anything anything after `\read to'\,.\,.\,. +In this case however, you don't get any statistical message +about what happened or not. With `\edef\OutputString' you can at +least issue some `changed!' or `left!' (maybe `\message{!}' vs.\ +`\message{.}'). +There is an application in 'makedoc' for ``typographical upgrading'' +from plain text to \TeX\ input. + +|\repl_all_chain_expandable| will be the backbone of the +replacements. It is called by some parsing macro +and receives from the latter ~=~#1 and ~=~#2. +#3 is the result of what happened so far. +\begin{packagecode} +\def\repl_all_chain_expandable#1#2#3#4#5#6{% + %% #1, #2 splits, #3 past, #4 substitute, + %% #5 repeat parser, #6 pass to +% \ifx~#2\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi +\end{packagecode} +The previous line would be somewhat faster, but let us exemplify +`\IfFDdollar' from section~\ref{sec:tails} instead: +\begin{packagecode} + \IfFDdollar{#2}% +\end{packagecode} +If #2 starts with `$'---with category code 3, ``math shift''!, +it \emph{is} `$', due to not reading `$' +from input with its standard category code 3 +and the sandbox construction (where `$' appears with its standard +category code). %% TODO might be explained earlier 2009/04/11 + %% or refer to here. +And this is the case \emph{exactly} when the from + didn't match, again due to the input category codes. +Now on \emph{no} match, the sandbox builder #6 is called +with target string #3#1 where the last tested string is attached +to previous results. The ending `~' is removed, #6 inserts a new +wrap for the new dummy pattern. +\begin{packagecode} + {\RemoveTildeArg #6{#3#1}}% +\end{packagecode} +Otherwise $\dots$ the \emph{sandbox builder} +(that will be shown below) that called +initialized #5 to be that itself. ( otherwise +wouldn't know who it is.) So calls itself with another sandbox +`#2&'. Note that #2 contains \lq`~$'\rq\ due to the initial + building. +\begin{packagecode} + {#5#2&{#3#1#4}{#4}#5#6}} +\end{packagecode} +#4 is the replacement string that passed to . +The first argument after the `&' is previous stuff plus +the recently skipped +plus #4 replacing the string that was matched. + +Finally, #5 and #6 again ``recall'' and the sandbox +builder to which to change in case of no other match. + +% TODO move following up!? 2009/04/11 +|\MakeExpandableAllReplacer{}{}{}{}| +creates sandbox and parser with common identifier and search +pattern . Each occurrence of will be replaced by +. When is not found, the sandbox builder for + is called. This may be another replacing macro of the +same kind. To return the result without further transformations, +call job `LEAVE' (section~\ref{sec:LEAVE}). +\begin{packagecode} +\newcommand*{\MakeExpandableAllReplacer}{% + \afterassignment\mk_setup_xpdbl_all_repl_san + \def\cond_id} +\end{packagecode} +$\dots$ usual intermezzo for reading patterns with non-standard +category codes, this time we read \emph{two} patterns \dots +\begin{packagecode} +\newcommand*{\mk_setup_xpdbl_all_repl_san}[1][]{% + \begingroup \PatternCodes #1\mk_setup_xpdbl_all_repl} +\end{packagecode} +Here comes the real work. +\begin{packagecode} +\newcommand*{\mk_setup_xpdbl_all_repl}[3]{% + %% #1 pattern, #2 substitute, #3 pass to + \endgroup +\end{packagecode} +We take pains to call next jobs by single +command strings and store them this way, not by `\csname', +as `\ProcessStringWith' would do it. `\edef\@tempa' +is used for this purpose, but \dots +\begin{packagecode} + \edef\@tempa{% + \noexpand\mk_setup_substr_cond{#1}{% + {}{#2}% + \noexpand\noexpand +\end{packagecode} +That `\edef\@tempa' must \emph{not expand} the controll +words after they have been computed from `\csname' etc. +Moreover, expansion of the parser commands +must be avoided another time, when `\@tempa' is executed. +\begin{packagecode} + \make_not_expanding_cs{\substr_cond\cond_id}% + \noexpand\noexpand + \make_not_expanding_cs{\setup_substr_cond #3}}}% +\end{packagecode} +Those internal setup commands start with `\endgroup' to switch back +to standard category codes. We must match them here by +`\begingroup'. +\begin{packagecode} + \begingroup \@tempa + \begingroup \mk_substr_cond{#1}{% + \repl_all_chain_expandable{##1}{##2}}} +\end{packagecode} +The final command is the one that we explained first. %% TODO 2009/04/11 + +Support for dozens of replacements in one sequence +and for screen messages +must wait for another release, sorry! %% TODO 2009/04/11 + + +\section{\hspace{1sp}\ignorespaces Leave package mode \unskip } + +We restore the underscore `_' for math subscripts. +(This might better depend on something \dots) %% TODO 2009/04/07 +\begin{packagecode} +\catcode`\_=8 %% restores underscore use for subscripts + +\endinput +\end{packagecode} +\TeX\ ignores the rest of the file when it is \emph{input} +``in the sense of `\input''', as opposed to just reading +the file line by line to a macro like `\fdInputLine'. + + +\section{\hspace{1sp}\ignorespaces Pondered \unskip } + +\label{sec:pondered} +\begin{packagecode} + %% TODO abbreviated commands (aliases) \MkSubstrCond... + %% TODO \@onlypreamble!? +\newcommand*{\ApplySubstringConditional}[1]{% + %% #1 identifier; text to be searched expected next + \csname setup_substr_cond:#1\endcsname} +\newcommand*{\ApplySubstringConditionalToExpanded}[1]{% 2009/03/31+ + \csname setup_substr_cond:#1\expandafter \endcsname \expandafter} +\newcommand*{\ApplySubstringConditionalToInputString}[1]{% 2009/03/31+ + \csname setup_substr_cond:#1\expandafter \endcsname + \expandafter {\fdInputLine}} + %% TODO or `\OutputString', even `\read' to `\OutputString'!? +% \newcommand*{\ApplySubstringConditionalToExpanded}[2]{% +% %% note: without assignments, robust! +% %% BUT the `\csname ... \expandafter \endcsname' method is faster +% \expandafter \reversed_apply_substr_cond +% \expandafter {#2}{#1}} +% \newcommand*{\reversed_apply_substr_cond}[2]{% +% \ApplySubstringConditional{#2}{#1}} + %% ODER: +% \newcommand*{\expand_attach_arg}[2]{%% 2009/03/31 +% %% #1 command with previous args, TODO cf. LaTeX3 +% \expandafter \attach_arg \expandafter {#1}{#2}} +% %% actually #1 may contain more than one token, +% %% only first expanded +% \newcommand*{\attach_arg}[2]{#2{#1}} +% \newcommand*{\ApplySubstringConditionalToExpanded}[2]{% +% \expandafter \attach_arg \expandafter +% {#2}{\ApplySubstringConditional{#1}}} +\end{packagecode} + +\section{\hspace{1sp}\ignorespaces VERSION HISTORY \unskip } + + +\begin{packagecode} +v0.1 2009/04/03 very first version, tested on morgan.sty +v0.2 2009/04/05 counter fdInputLine, \ProvidesFile moved from + \ProcessFile to \ResultFile, \CopyFD..., + category section first, more sectioning, + suppressing empty code lines before section + titles; discussion, \Delimiters + 2009/04/06 more discussion + 2009/04/07 more discussion, factored \WriteProvides out from + \ResultFile, \ProcessExpandedWith corrected + 2009/04/08 \InputString -> \fdInputline; + removed \ignorespaces + 2009/04/09 \WhenInputLine[2] -> \IfInputline[3], + \ProcessInputWith, typos, + \WriteProvides message `with' + 2009/04/10 \make_not_expanding_cs + DISCOVERED ``IF SUBSTRING'' ALGORITHM WRONG + ( in ) +v0.3 2009/04/11 SOME THINGS GIVEN UP EARLIER WILL BE REMOVED, + TO BE STORED IN THE COPY AS OF 2009/04/10 + mainly: sandbox setup (tilde/dollar) + REAL ADDITION: setup for expandable replacing + 2009/04/12 played with `chain' vs. `sequence'; + plain `...', `cf.', `etc.' for `mdcorr.cfg' + 2009/04/13 \RemoveTilde... + 2009/04/15 reworked text, same mistake \in@ + +\end{packagecode} diff --git a/Master/texmf-dist/doc/latex/nicetext/doclog/makedoc.doc b/Master/texmf-dist/doc/latex/nicetext/doclog/makedoc.doc new file mode 100644 index 00000000000..ab4c7dc7370 --- /dev/null +++ b/Master/texmf-dist/doc/latex/nicetext/doclog/makedoc.doc @@ -0,0 +1,442 @@ +\ProvidesFile{makedoc.doc}[2009/04/16 automatically generated with makedoc.sty] +\begin{packagecode} +%% Macro package `makedoc.sty' for LaTeX2e, +%% copyright (C) 2009 Uwe L\"uck, +%% http://www.contact-ednotes.sty.de.vu +%% -- author-maintained in the sense of LPPL below -- +%% for preparing documentations from packages. + +\def\fileversion{0.2} \def\filedate{2009/04/13} + +%% This file can be redistributed and/or modified under +%% the terms of the LaTeX Project Public License; either +%% version 1.3a of the License, or any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% We did our best to help you, but there is NO WARRANTY. +%% +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +% 1994/12/01: \newcommand* etc. +\ProvidesPackage{makedoc}[\filedate\space v\fileversion\space + TeX input from *.sty (UL)] +\end{packagecode} +|\PackageCodeTrue| and |\PackageCodeFalse| set `\ifPackageCode' +globally, so redefinition of `~' may be kept local. Note the +capital `T' and `F'! +\begin{packagecode} +\newcommand*{\PackageCodeTrue} {\global\let\ifPackageCode\iftrue} +\newcommand*{\PackageCodeFalse}{\global\let\ifPackageCode\iffalse} +\end{packagecode} +|\ifPackageCode| is used to determine whether a listing environment +must be `\beg'un or `\end'ed. You may also want to suppress empty +code lines, while empty lines should issue a `\par' break in +``comment'' mode. + +Since `\newif' is not used, `\ifPackageCode' must be declared +explicitly. Declaration of new `\if's must be early in case +they occur in code that is skipped by another `\if'\dots +\begin{packagecode} +\PackageCodeFalse +\end{packagecode} +'makedoc' is an extension of 'fifinddo' on which it depends. +\begin{packagecode} +\RequirePackage{fifinddo}[2009/04/13] +\end{packagecode} +Both 'fifinddo' and 'makedoc' use the ``underscore'' as ``private +letter'' and make it ``other'' at their end (functionality as with +``at'' and `\RequirePackage' is missing here). So after loading +'fifinddo', I must restore the new private letter. +\begin{packagecode} +\catcode`\_=11 %% underscore used in control words +\end{packagecode} +\subsection{&\MakeDocCorrectHook} +|\MakeDocCorrectHook| is predefined to leave its argument without +the enclosing braces, otherwise unchanged: +\begin{packagecode} +\let\MakeDocCorrectHook\@firstofone +\end{packagecode} +Less efficiently, the same could have been set up as +\begin{packagecode} +% \newcommand*{\MakeDocCorrectHook}[1]{\ProcessStringWith{#1}{LEAVE}} +\end{packagecode} +according to 'fifinddo'. + +It may be \emph{redefined} in a \emph{configuration} file like +'makedoc.cfg' or the 'makedoc' script file applying to a single +package file in order to, e.g., converting plain text to \TeX\ input +conforming to typographical conventions, making `$\dots$' from +`$\dots$', e.g. +Replace `LEAVE' in the previous suggestion by an identifier +whose job you have defined before, and use `\renewcommand' +in place of `\newcommand'. +See an example in 'makedoc.cfg'. + +You can \emph{test} your own `\MakeDocCorrectHook' by +\[`\typeout{\MakeDocCorrectHook{}}'\] +$\dots$ provided (sometimes) `\MakeOther\ ' $\dots$ +You can even change it using `\IfInputLine' from 'fifinddo' in the +midst of preprocessing a package documentation. + +\subsection{Distinguish package code from comments}%% <- wiki style breaks in self-doc. +Use of comment marks is a matter of personal style. Only lines +starting with the sequence `%% ' are typeset in \TeX\ quality +under the present release. Lines just containing `%%' +(without the space) are used to suppress empty code lines +preceding section titles (while keeping some visual space +in the package file). There is a preferable way to do this, +however not in the present release \dots + +The parsing macros must be set up reading `%' and ` ' as ``other'' +characters. Using the optional arguments for this creates +difficulties that can be somewhat avoided by redefining +|\PatternCodes|. +\begin{packagecode} +\renewcommand*{\PatternCodes}{\MakeOther\%\MakeOther\ }%% 2009/04/02 +\end{packagecode} +Look here: the line became too long and could not be broken. +Must we really introduce new comment marks? +\begin{packagecode} +% \MakeSetupSubstringCondition{comment}[\MakeOther\%\MakeOther\ ] +\end{packagecode} +The next line sets the ``sandbox'' for the detecting macro, as it +is coined in the documentation of 'fifinddo', with ``identifier'' +|PPScomment|. +\begin{packagecode} +\MakeSetupSubstringCondition{PPScomment}{%% }{{#1}} +\end{packagecode} +The last argument stores the expanded input line for reference by +macros called. The next line is a test whether the setup works. +\begin{packagecode} +% \expandafter \show \csname \setup_substr_cond PPScomment\endcsname +\end{packagecode} +Here comes the definition of the corresponding testing macro. +#3 is the expanded input line from above. The `\If'\dots commands, +`\fdInputLine', `\fdInputLine', and `\RemoveDummyPatternArg' +are from 'fifinddo'. +\begin{packagecode} +% \MakeSubstringConditional{comment}[\MakeOther\%\MakeOther\ ] +\MakeSubstringConditional{PPScomment}{%% }#3{%% #3 entire test string + \IfFDinputEmpty{\OnEmptyInputLine}{% +\end{packagecode} +The empty line test comes early to offer control with +`\OnEmptyInputLine' both code and comment mode. +Maybe it should always? %% TODO 2009/04/13 +\begin{packagecode} + \IfFDempty{#1}%% + {\TreatAsComment{% + \RemoveDummyPatternArg\MakeDocCorrectHook{#2}}}% + {\ifx\fdInputLine\PPstring + \ifPackageCode\else \WriteResult{}\fi%% 2009/04/05 + %% <- allow paragraphs in comments + \else \TreatAsCode{#3}\fi}}} +% \expandafter \show \csname \substr_cond PPScomment\endcsname +\end{packagecode} +|\PPstring| stores the line suppressing empty code lines. +\begin{packagecode} +\newcommand*{\PPstring}{} \xdef\PPstring{\PercentChar\PercentChar} +\end{packagecode} +|comment| will be a ``generic'' identifier to call a comment line +detector. It might be predefined to issue an ``undifined'' error; +however this release predefines it to behave like `PPScomment'. +\begin{packagecode} +\CopyFDconditionFromTo{PPScomment}{comment} +\end{packagecode} +Alternative still to be considered: +\begin{packagecode} +% \@namedef{\setup_substr_cond comment}{% +% \PackageError{makedoc}{Job `comment' not defined}% +% {Use \string\CopyFDconditionFromTo{comment}}} +\end{packagecode} +\subsection{Dealing with comments} +|\TreatAsComment{}| writes to the documentation +file. If we had ``package code'' (were in ``code mode'') so far, +the listing environment is ended first. +\begin{packagecode} +\newcommand*{\TreatAsComment}[1]{% + \ifPackageCode + \WriteResult{\string\end{packagecode\@empty}}% +\end{packagecode} +The `\@empty' here is a lazy trick to save self-documentation +fighting 'verbatim''s ``highlight'' of finding ends of listings +(to be improved). %% + +We always use `\string' to prevent macro expansion in `\write'ing +in place of \LaTeX's `\protect', +as long as 'fifinddo' simply uses the primitive `\write' in place +of \LaTeX's `\proteced@write' \dots %% todo 2009/04/08 +\begin{packagecode} + \PackageCodeFalse + \EveryComment +% \_empty_code_lines_false + \fi + \WriteResult{#1}} +\end{packagecode} +Here, |\EveryComment| is a macro hook for inserting material that should +not appear in a listing environment. +\begin{packagecode} +\global\let\EveryComment\relax %% should be changed globally. +\end{packagecode} +\subsection{Sectioning} +\label{sec:secparsers} +We provide a facility from 'wiki.sty' that imitates the sectioning +syntax used in editing \emph{Wikipedia} pages, in a different +implementation (better compatibility) and in a more general way. +On Wikipedia, `== Definition ==' works similar as +`\section{Definition}' does with \LaTeX. With the present +implementation, you can type, e.g., +\[`%%%%%%%%%%%%%%%%%%%%%% == Definition == %%%%%%%%%%%%%%%%%%%%%%'\] +to get a similar result. The number of `%' characters doesn't +matter, and there can be other stuff, however: additional `=' +symbols may harm. Three sectioning levels are supported, through +`====', `======', and `========' (deepest). + +There are three detector macros made for programmers. +The most general one is +In the following definitions, there is a single tilde to prevent +`=' symbols being gobbled by the test (realized by accident). +%% 2009/04/13 +|\SectionLevelThreeParseInput|: +\begin{packagecode} +\newcommand*{\SectionLevelThreeParseInput}{% + \expandafter \test_sec_level_iii \fdInputLine ~========&} +\end{packagecode} +|\SectionLevelTwoParseInput| +\begin{packagecode} +\newcommand*{\SectionLevelTwoParseInput}{% + \expandafter \test_sec_level_ii \fdInputLine ~======&} +\end{packagecode} +and |\SectionLevelOneParseInput| +\begin{packagecode} +\newcommand*{\SectionLevelOneParseInput}{% + \expandafter \test_sec_level_i \fdInputLine ~====&} +\end{packagecode} +allow skipping deeper levels for efficiency. +% TODO in fifinddo: setup for 2 strings in 1 line 2009/04/13 + +In the terminology of the 'fifinddo' documentation, the previous +three commands are ``sandbox builders.'' The following three +commands are the corresponding ``substring conditionals.'' +However, 'fifinddo' so far %% todo 2009/04/08 +only deals with \emph{single} substrings, while here we are +dealing with \emph{pairs} of substrings. We are not using +general setup macros, but define the parsing macros ``manually,'' +as it is typical in many other macros in 'latex.ltx' and other +\LaTeX\ packages. You can fool our macros easily, there is +no syntax check. %% todo 2009/04/08 +\begin{packagecode} +\def\test_sec_level_iii#1====#2====#3&{% + \IfFDempty{#2}% + {\test_sec_level_ii #1======&}% + {\WriteSection\mdSectionLevelThree{#2}}} +\def\test_sec_level_ii#1===#2===#3&{% + \IfFDempty{#2}% + {\test_sec_level_i #1====&}% + {\WriteSection\mdSectionLevelTwo{#2}}} +\def\test_sec_level_i#1==#2==#3&{% + \IfFDempty{#2}% + {\RemoveTildeArg \ProcessStringWith{#1}{comment}}% + {\WriteSection\mdSectionLevelOne{#2}}} +\end{packagecode} +`\ProcessStringWith' here passes the expanded `\fdInputLine' +to the general comment detector. + +|\WriteSection{}{}| replaces an input line +with a line \[`{\hspace{1sp}\ignorespaces \unskip }'\] +in the documentation file and switches into ``comment mode.'' +`\hspace{1sp}' ensures that 'niceverb''s package name feature works. +`\ignorespaces' and `\unskip' undo the spaces between title text and +the `=' symbols that usually are typed for readability. +\begin{packagecode} +\newcommand*{\WriteSection}[2]{% + \TreatAsComment{% + ^^J#1{\string\hspace{1sp}\ignorespaces + \MakeDocCorrectHook{#2}\unskip}^^J}} +\end{packagecode} +We insert `\section' using |\mdSectionLevelOne| etc.\ +which the programmer can redefine, e.g., when the +documentation is part of a `\section' (or even deeper) +according to the ``documentation driver'' file. +\begin{packagecode} +\newcommand*\mdSectionLevelOne {\string\section} +\newcommand*\mdSectionLevelTwo {\string\subsection} +\newcommand*\mdSectionLevelThree{\string\subsubsection} +\end{packagecode} +This sectioning feature is not used in 'makedoc.sty' since the +\emph{definitions} of the parsing macros fool the same macros \dots + +\subsection{Commented code} +|\TreatAsCode{}| is the opposite to `\TreatAsComment{}': +\begin{packagecode} +\newcommand*{\TreatAsCode}[1]{% + \ifPackageCode +% \_empty_code_lines_true + \else + \WriteResult{\string\begin{packagecode}}% + \PackageCodeTrue + \fi + \WriteResult{#1}% +% \WriteResult{\maybe_result_empty_line #1}% +% \let\maybe_result_empty_line\empty +} +\end{packagecode} +\subsection{Dealing with empty input lines} +|\OnEmptyInputLine| is a default setting (or hook) for what to do +with empty lines in the input file. The default is to insert an +empty line in the output file: +\begin{packagecode} +\newcommand*{\OnEmptyInputLine}{\WriteResult{}} +\end{packagecode} +|\NoEmptyCodeLines| changes the setting to suppressing empty code +lines, while in ``comment mode'' an empty input line \emph{does} +insert an empty line, for starting a new paragraph: +\begin{packagecode} +\newcommand*{\NoEmptyCodeLines}{%% suppress empty code lines + \renewcommand*{\OnEmptyInputLine}{% + \ifPackageCode \else \WriteResult{}\fi}} +\end{packagecode} +There is a better policy---didn't work so far \dots + +\subsection{Bundling typical things: script commands} +\label{sec:script} +First practical experiences suggest the following shorthands. +They should simplify matters so much that the 'makedoc' script +for a single package really should need about five lines only, +%% <- TODO check 2009/04/08 +and even \emph{they} should be so simple that you should hardly +spend a minute about them. + +|\LaTeXresultFile{}| saves you the extra line for inserting +the `\ProvidesFile' line $\dots$ no, actually it is 'makedoc' +that wants to be mentioned with `\ProvidesFile' $\dots$ +(otherwise copied from 'fifinddo') \dots +\begin{packagecode} +\newcommand*{\LaTeXresultFile}[1]{% + \ResultFile{#1}%%% \WriteProvides} + \WriteResult{% + \string\ProvidesFile{\result_file_name}% + [\the\year/\two@digits\month/\two@digits\day\space + automatically generated with makedoc.sty]}}% +\end{packagecode} +|\MakeDoc{}| preprocesses to render input for +\LaTeX, considering what is typical for a \LaTeX\ package as the + one here: +\begin{packagecode} +\newcommand*{\MakeDoc}[1]{% +\end{packagecode} +In case of a ``header'' (see below) we change into ``code mode'': +\begin{packagecode} + \ifnum\header_lines>\z@ + \WriteResult{\string\begin{packagecode}}% + \PackageCodeTrue %% TODO both lines makedoc command!? + %% 2009/04/08 + \else \PackageCodeFalse \fi +\end{packagecode} +The loop follows. There is a placeholder `\makd_doc_line_body' +that is predefined below and can be changed while processing the + file. +\begin{packagecode} + \ProcessFileWith{#1}{% + \CountInputLines %% stepping line counter is standard + \make_doc_line_body + \process_line_message}% +\end{packagecode} +Currently the ``VERSION HISTORY'' is typeset verbatim +(for ``tabbing''), we then must leave ``code mode'' here: +\begin{packagecode} + \ifPackageCode + \WriteResult{\string\end{packagecode\@empty}}%% self-doc-trick + \PackageCodeFalse %% TODO both lines makedoc command!? 2009/04/08 + \fi +\end{packagecode} +When the file has been processed, certain default settings +might be restored---in case another file is processed for the +same documentation document: +\begin{packagecode} +% \HeaderLines{0}% +% \MainDocParser{\SectionLevelThreeParseInput}%% TODO!? 2009/04/08 +} +\end{packagecode} +\subsubsection{File preamble} +A \LaTeX\ package typically has a ``header'' or ``preamble'' +(automatically inserted by 'docstrip') with very scarce information +on which file it is and what it provides, and with much more Legalese. +Typesetting it in \TeX\ quality may be more misleading than +typesetting it \emph{verbatim}. So we typeset it \emph{verbatim}. +Now: where does the ``header'' end? +`\NeedsTeXFormat' might be considered the border.---Yet it seems +to be more simple and reliable just to act in terms of the +\emph{number of lines} +that the header should be long. This length is declared by +|\HeaderLines{}|: +\begin{packagecode} +\newcommand*{\HeaderLines}{\def\header_lines} +\HeaderLines{0} +\end{packagecode} +So the default is that there aren't any header lines, unless +another `\HeaderLines' is issued before some `\MakeDoc'. +The way input is parsed after the ``header'' is set by +|\MainDocParser{}|. +\begin{packagecode} +\newcommand*{\MainDocParser}{\def\main_doc_parser} +\end{packagecode} +`\SectionLevelThreeParseInput' from section~\ref{sec:secparsers} +is the default, two alternatives are defined there, another one is +`\ProcessInputWith{comment}' from 'fifinddo'. +\begin{packagecode} +\MainDocParser{\SectionLevelThreeParseInput} +\end{packagecode} +Here is how `\HeaderLines' and `\MainDocParser' act: +\begin{packagecode} +\def\make_doc_line_body{% + \IfInputLine{>\header_lines}% + {\let\make_doc_line_body\main_doc_parser + \make_doc_line_body}% %% switch to deciding + {\TreatAsCode{\fdInputLine}}} %% header verbatim +\end{packagecode} +|\ProcessLineMessage{}| is designed to define a screen +(or log) message . +% A simple setting may be \[`\ProcessLineMessage{\message{.}}'\] with +`\ProcessLineMessage{\message{.}}' has a result like with 'docstrip'. +You just get one dot on screen per input line +as a simple confirmation that +the program is not hung up. %% TODO phrase!? 2009/04/08 +However, the message may slow down a run considerably +(if so, choose `\ProcessLineMessage{}' in the script). +% , you really have to +% wait about a second while you hardly notice the 'makedoc' run +% without screen messages. Therefore, the default is \emph{not} +% to issue any screen message.%% TODO more complex procedures!? 2009/04/08 +%---No! +But it is better for beginner users of the package, +so made default. %% 2009/04/09 +\begin{packagecode} +\newcommand*{\ProcessLineMessage}{\def\process_line_message} +% % \ProcessLineMessage{} %% no, still more efficient: +% \let\process_line_message\relax +\ProcessLineMessage{\message{.}} +\end{packagecode} +\subsection{Leave the package} +\begin{packagecode} +\catcode`\_=8 %% restores underscore use for subscripts + +\endinput +\end{packagecode} +\subsection{VERSION HISTORY} + +\begin{packagecode} +v0.1 2009/04/03 very first version, tested on morgan.sty +v0.2 2009/04/05 \OnEmptyInputLine, \NoEmptyCodeLines + comment -> PPScomment, \IfFDinputEmpty, + \EveryComment, \PPstring may be par break + 2009/04/08 \InputString -> \fdInputLine, + \section -> \subsection; documentation! + 2009/04/08f. \MakeDoc + 2009/04/12 ``line too long'' w/o redefining \PatternCodes; + \MakeDocCorrectHook + 2009/04/13 tilde with sectioning + +\end{packagecode} diff --git a/Master/texmf-dist/doc/latex/nicetext/doclog/mdcorr.doc b/Master/texmf-dist/doc/latex/nicetext/doclog/mdcorr.doc new file mode 100644 index 00000000000..e63659b5e22 --- /dev/null +++ b/Master/texmf-dist/doc/latex/nicetext/doclog/mdcorr.doc @@ -0,0 +1,25 @@ +\ProvidesFile{mdcorr.doc}[2009/04/16 automatically generated with makedoc.sty] +\begin{packagecode} +\ProvidesFile{mdcorr.cfg}[2009/04/15 + local typographical corrections with makedoc.sty] +\end{packagecode} +Also demonstrates 'niceverb.sty'. +\begin{packagecode} +\renewcommand*{\PatternCodes}{\MakeOther\\\MakeOther\ } +\renewcommand*{\MakeDocCorrectHook}[1]{\ProcessStringWith{#1}{dots}} +\end{packagecode} +|\MakeExpandableAllReplacer{}{}{}{}|% +\footnote{Yes, +&\MakeExpandableAllReplacer{}{}{}{}.} +\begin{packagecode} +\MakeExpandableAllReplacer{dots}{...}{$\dots$}{cf} +\MakeExpandableAllReplacer{cf}{cf.}{cf.\ }{etc} +\MakeExpandableAllReplacer{etc}{etc. }{etc.\ }{LEAVE} +\end{packagecode} +So you can keep inter-sentence space after `etc.' +by a code line break +\begin{packagecode} +\renewcommand*{\PatternCodes}{\fdPatternCodes} +\end{packagecode} +$\dots$ restores 'fifinddo' default. + diff --git a/Master/texmf-dist/doc/latex/nicetext/doclog/niceverb.doc b/Master/texmf-dist/doc/latex/nicetext/doclog/niceverb.doc new file mode 100644 index 00000000000..6acb7eada6f --- /dev/null +++ b/Master/texmf-dist/doc/latex/nicetext/doclog/niceverb.doc @@ -0,0 +1,283 @@ +\ProvidesFile{niceverb.doc}[2009/04/16 automatically generated with makedoc.sty] +\begin{packagecode} +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{niceverb}[2009/04/15 v0.2 + minimize \string\verb\space code (UL)] + +%% Copyright (C) 2009 Uwe Lueck, +%% http://www.contact-ednotes.sty.de.vu +%% -- author-maintained in the sense of LPPL below -- +%% +%% This file can be redistributed and/or modified under +%% the terms of the LaTeX Project Public License; either +%% version 1.3a of the License, or any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% We did our best to help you, but there is NO WARRANTY. +%% +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Switching category codes \unskip } + +\begin{packagecode} +\providecommand{\CatCode}{\catcode`} +% \providecommand*{\MakeActive}[1]{\CatCode#1\active} +\providecommand*{\MakeAlign} [1]{\CatCode#14\relax} +\providecommand*{\MakeLetter}[1]{\CatCode#111\relax} +\providecommand*{\MakeOther} [1]{\CatCode#112\relax} +\providecommand*{\MakeSub} [1]{\CatCode#18\relax} + +\newcommand*{\MakeActiveLet}[2]{%% cf. \@sverb & \do@noligs + \CatCode#1\active + \begingroup + \lccode`\~`#1\relax \lowercase{\endgroup \let~#2}} + +\MakeLetter\_ + +% \newcommand*{\make_iii_other}{\MakeOther\\\MakeOther\{\MakeOther\}} + %% <- replaced 2009/04/05 +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Sloppy variant of &\verb \unskip } + +\begin{packagecode} +\newcommand*{\begin_min_verb}{% + \relax \ifmmode \hbox \else \leavevmode\null \fi + %% <- standard, for $$...$$ + \bgroup \tt %%%\let\do\MakeOther \dospecials + \MakeLetter\_\MakeLetter\@} +\newcommand*{\SimpleVerb}[1]{% +\end{packagecode} +Mainly avoid `\verb''s noligs list which overrides definitions +of some active characters, while 'cmtt' doesn't have any +ligatures anyway. +\begin{packagecode} + \ifx\protect\@typeset@protect + \begin_min_verb %%%\make_iii_other %% much usual 2009/04/05 + \let\do\MakeOther \dospecials %% 2009/04/06 + \MakeOther\|%% probably 'niceverb' + \MakeActiveLet#1\niceverb_egroup %% 2009/04/11 + \verb@eol@error %% TODO change message 2009/04/09 + \else \string\SimpleVerb \string#1\fi} +\end{packagecode} +2009/04/11: about `etc.' +\begin{packagecode} +\newcommand*{\niceverb_egroup}{\egroup\ifmmode\else\@\fi} +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Single quotes typeset meta-code \unskip } + +\begin{packagecode} +\newcommand*{\lq_verb}{% + \ifx\protect\@typeset@protect + \expandafter \lq_double_test + \else \lq \fi} +% \ifcat\noexpand'\noexpand~% +% \expandafter\expandafter\expandafter +% \protect_corresp_quotes +% \else +% \rq_verb +% \fi +% \fi} +\newcommand*{\lq_double_test}{% + %% test settles next catcode, better switch to ``other'' + %% in advance: + \begingroup \let\do\MakeOther \dospecials + \futurelet\let_token \lq_double_decide} +\newcommand*{\lq_double_decide}{% + \ifx\let_token\lq_verb + \endgroup + \lq\lq \expandafter \@gobble +\end{packagecode} +Corresponding right quotes will become ``other'' due to +having no space at the left. +\begin{packagecode} + %%TODO to be changed with 'wiki.sty'. + \else + \endgroup +% \expandafter \rq_verb + \expandafter \SimpleVerb \expandafter \'% + \fi} +% \newcommand*{\rq_verb}{\SimpleVerb\'} +% \AtBeginDocument{\MakeActiveLet\`\rq_verb} +\AtBeginDocument{\MakeActiveLet\`\lq_verb} + %% Strings referred to will be code + %% TODO to be changed with wiki.sty +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Ampersand typesets meta-code \unskip } + +\begin{packagecode} +\newcommand*{\CmdSyntaxVerb}{% + \ifx\protect\@typeset@protect + \expandafter \cmd_syntax_verb + \else %% thinking of .aux only + \string\CmdSyntaxVerb \expandafter \string + \fi} +\newcommand*{\cmd_syntax_verb}[1]{% + \begin_min_verb \string#1\futurelet\let_token \after_cs} + +\AtBeginDocument{\MakeActiveLet\&\CmdSyntaxVerb} + %% not needed with \Auto... OTHERWISE useful in args! + %% TODO \MakeAmpCmdSyntax + %% TODO \let\endcell& (wie \endline, \endgraf) \MakeEndCell +\newcommand*{\after_cs}{% + \ifcat\noexpand\let_token a\egroup \space + \else \expandafter \decide_verb \fi} +\newcommand*{\test_more_verb}{\futurelet\let_token \decide_verb} +\newcommand*{\decide_verb}{% +% \show\let_token + \jumpteg_on_with\bgroup\braces_verb + \jumpteg_on_with[\brackets_verb + \jumpteg_on_with*\star_verb + \egroup} + %% CAUTION/TODO wrong before (... if cmd without arg + %% use \ then or choose usual verb... + %% or \MakeLetter\( etc. ... or \xspace +\newcommand*{\jumpteg_on_with}[2]{% + \ifx\let_token#1\do_jumpteg_with#2\fi} + %% TODO cf. xfor, xspace (break@loop); + %% \DoOrBranch#1...#1 or so +\def\do_jumpteg_with#1#2\egroup{\fi#1} +\def\braces_verb#1{\string{#1\string}\test_more_verb} +\def\brackets_verb[#1]{[#1]\test_more_verb} +\def\star_verb*{*\test_more_verb} +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Escape character typesets meta-code \unskip } + +\begin{packagecode} +\DeclareRobustCommand*{\BuildCsSyntax}{% + \futurelet\let_token \build_cs_syntax_sp} +\newcommand*{\build_cs_syntax_sp}{% + \ifx\let_token\@sptoken \else %% TODO ^^M!? + \expandafter \start_build_cs_syntax + \fi} +\newcommand*{\start_build_cs_syntax}[1]{% + \edef\string_built{\string#1}%% #1 may be active + \MakeLetter\_\MakeLetter\@%% CAUTION, cf. ... + \test_more_cs} +\newcommand*{\test_more_cs}{% + \futurelet\let_token \decide_more_cs} +\newcommand*{\decide_more_cs}{% + \ifcat\noexpand\let_token a\expandafter \add_to_cs + \else + \MakeSub\_\MakeOther\@% + \expandafter \in@ \expandafter + {\csname \string_built \expandafter \endcsname + \expandafter}\expandafter{\niceverbNoVerbList}% + \ifin@ + \csname \string_built + \expandafter\expandafter\expandafter \endcsname + \else + \begin_min_verb \@backslashchar\string_built + \expandafter\expandafter\expandafter \test_more_verb + \fi + \fi} + %% TODO such \if nestings with ifthen!? + %% cf.: +% \let\let_token,\typeout{\meaning\let_token} + %% TEST TODO fuer xspace!? (\ifin@) +\newcommand*{\add_to_cs}[1]{% + \edef\string_built{\string_built#1}\test_more_cs} +\newcommand*{\AutoCmdSyntaxVerb}{\MakeActiveLet\\\BuildCsSyntax} + %% TODO or \niceverbswitch... + +\newcommand*{\EndAutoCmdSyntaxVerb}{\CatCode\\\z@} +\newcommand*{\NormalCommand}{} \let\NormalCommand\@nameuse + %% Were tests: +% \futurelet\LetToken\relax \relax +% \show\LetToken \typeout{\ifcat\noexpand\LetToken aa\else x\fi} + +\newcommand*{\niceverbNoVerbList}{% + \begin\end\item\verb\EndAutoCmdSyntaxVerb\NormalCommand + \section\subsection\subsubsection}%% TODO!? +\providecommand*{\AddToMacro}[1]{% + \expandafter \def \expandafter #1\expandafter} +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Meta-variables \unskip } + +\begin{packagecode} +\def\niceverb_meta#1>{% + \mbox{\normalfont\itshape $\langle$#1\/$\rangle$}} + %% TODO offer without angles as well +\AtBeginDocument{\MakeActiveLet\<\niceverb_meta} + %% difference to ltxguide.cls: also outside verbatim +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Hash mark is code \unskip } + +\begin{packagecode} +\newcommand*{\param_verb}[1]{{\tt\##1}} +\AtBeginDocument{\MakeActiveLet\#\param_verb} +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Single right quote for &\textsf \unskip } + +\begin{packagecode} +\newcommand*{\niceverb_rq_sf}{% +% \relax %% in case of \hskip1sp 2009/04/08 + %% but spoils ligature 2009/04/09 + \ifx\protect\@typeset@protect + \expandafter \niceverb_rq_sf_test + \else \rq \fi} +\end{packagecode} +Another macro just to avoid more sequences of `\expandafter': +\begin{packagecode} +\newcommand*{\niceverb_rq_sf_test}{% + \ifhmode + \ifdim\lastskip>\z@ + \expandafter\expandafter\expandafter \niceverb_rq_sf_exec + \else + \ifnum\spacefactor=1001 %% in parentheses 2009/04/10 + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter + \niceverb_rq_sf_exec + \else \rq \fi +% \rq + \fi + \else \ifvmode + \expandafter\expandafter\expandafter \niceverb_rq_sf_exec + \else \rq \fi + \fi} +\sfcode`\(=1001 %% enable in parentheses 2009/04/10 +{\CatCode\'\active \gdef\niceverb_rq_sf_exec#1'{\textsf{#1}}} + %% TODO to be changed with wiki.sty: +\AtBeginDocument{\MakeActiveLet\'\niceverb_rq_sf} + + %% TODO \niceverbswitch{}{} (bzw. Doku ohne {}) +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces Leave package mode \unskip } + +\begin{packagecode} +\MakeSub\_ + +\endinput +\end{packagecode} + +\subsection{\hspace{1sp}\ignorespaces VERSION HISTORY \unskip } + + +\begin{packagecode} +v0.1 2009/02/21 very first, sent to CTAN +v0.2 2009/04/04 ...NoVerbList: \subsubsection, \AddToMacro, + 2009/04/05 \SimpleVerb makes more other than iii + 2009/04/06 just uses \dospecials + 2009/04/08 debugging code for rq/sf, +\relax + 2009/04/09 +\verb@eol@error, prepared for new doc method, + removed spurious \makeat..., -\relax (ligature), + 2009/04/10 ('-trick + 2009/04/11 \@ after \SimpleVerb + 2009/04/14 noted TODO below + 2009/04/15 change v0.1 to 2009/02/21 + +TODO: choose expansions of active characters by options 2009/04/10 +TODO: &\@tempa and &\_tempa fail 2009/04/14 + +\end{packagecode} diff --git a/Master/texmf-dist/doc/latex/nicetext/docsrc/WIKICHEA.TEX b/Master/texmf-dist/doc/latex/nicetext/docsrc/WIKICHEA.TEX deleted file mode 100644 index e56bff99120..00000000000 --- a/Master/texmf-dist/doc/latex/nicetext/docsrc/WIKICHEA.TEX +++ /dev/null @@ -1,148 +0,0 @@ -\ProvidesFile{wikicheat}[2008/07/10 Cheatsheet for wiki.sty] -% \def\title{Cheatsheet for the \textsf{wiki} Package} -\def\title{\textbf{Cheatsheet} for the \textbf{\textsf{wiki}} Package} -\def\author{Uwe L\"uck} -\documentclass[12pt,a4paper]{article} -\nofiles -\pagestyle{empty} -\makeatletter -\@ifundefined{UndeclareTextCommand}{}{\usepackage{upquote}} %% 2008/07/02 -\makeatother -\usepackage{wiki} -% \let\WE\relax \let\WF\relax \let\WH\relax -\let\WE\wikiEnvironments -\let\WF\wikiFonts -\let\WH\wikiHeadings -\def\SP#1{\multicolumn{3}{\VR c\VR}{% -% \parbox{11cm}{% - \parbox{13cm}{% - \footnotesize\it\sloppy\SU#1\SD}}} -\def\SL{/\hskip.16667em} -% \setbox0\hbox{(}\showthe\ht0\showthe\dp0 %% height = 3x depth -\def\SU{\rule{0pt}{.99em}}%%%{1.1em}} -\def\HSU{\rule{0pt}{.75em}} -\def\SD{\rule[-.33em]{0pt}{0pt}}%%%45em]{0pt}{0pt}} -% \def\CS#1{{\tt\textbackslash #1}} %% 2008/07/02 -{\makeatletter \gdef\CS#1{{\tt\@backslashchar#1}}} -\let\VR| \catcode`\|\active \def|{\verb|} -\begin{document} -% \maketitle - -\enlargethispage{3\normalbaselineskip} -\vspace*{-\topmargin} %% !? -\vspace*{-\headheight}\vspace*{-\headsep}\vspace*{-\topsep}\vspace*{-\partopsep} -\begin{center} -\large \title\\[.4ex] \normalsize -Some \LaTeX-Markup through some Wiki-Markup\\[.8ex] - \author, \today -% \end{center} - -\vspace{\topsep} -\vspace*{\partopsep} -% \vspace{1.5ex} -% \vspace{1ex} -% \hrule -% \vspace{1ex} - -% \begin{center} -\leavevmode\kern-1em -\begin{tabular}{\VR l\VR l\VR l\VR} -\hline\hline -\SU\SD\bf Code for \textsf{wiki.sty}&\bf What you get& \bf like \LaTeX-code\\ -\hline\hline -|''italic''|&\WF ''italic''&|\textit{italic}|\SU\\ -|'''bold'''|&\WF '''bold'''&|\textbf{bold}|%%%\\ -\SD\\ -% |'''''bf+it'''''|&\WF '''''bf+it''''' -% &|\textbf{\textit{bf+it}}|\SD\\ -% |'''''B+I'''''|&\WF '''''B+I''''' &|\textbf{\textit{B+I}}|\SD\\ -\hline -\SP{``Italic'' and ``bold'' may be combined, nested, overlap. -% Automatic italic correction cannot be suppressed by \CS{nocorr}. -% Implementation uses \LaTeX\ internals; no groups are formed. -Quotation marks -% (even German) -usually are not -affected.---Turn -% {\tt '\string{\string}''} may help with -% apostrophes.---Turn -font feature on/off by \CS{wikiFonts}\SL\CS{nowikiFonts}; disable feature -entirely by package option {\tt noFonts}.}\\ -\hline\hline -|== Level 1 ==|&\Large\bf\HSU 1\quad Level 1&|\section{Level 1}|\SU\\ -|=== Level 2 ===|&\large\bf 1.1\quad Level 2&|\subsection{Level 2}|\SU\\ -|==== Level 3 ====|&\bf 1.1.1\quad Level 3&|\subsubsection{Level 3}|\\ -|===== Level 4 =====|&\bf Level 4 &|\paragraph{Level 4}|\SD\\ -|====== Level 5 ======|&\bf Level 5 &|\subparagraph{Level 5}|\SD\\ -\hline -\SP{Turn heading feature on/off by \CS{wikiHeadings}\SL\CS{nowikiHeadings}; -disable feature entirely by package option {\tt noHeadings}.}\\ -\hline\hline -&&|\begin{itemize}|\SU\\ -|* One|&\textbullet\hspace\labelsep One &|\item One|\\[2\parsep] -|* Two|&\textbullet\hspace\labelsep Two &|\item Two|\\ -&&|\end{itemize}|\SD\\ -\hline -&&|\begin{enumerate}|\SU\\ -|# One|&1.\hspace\labelsep One &|\item One|\\[2\parsep] -|# Two|&2.\hspace\labelsep Two &|\item Two|\\ -&&|\end{enumerate}|\SD\\ -\hline -&&|\begin{description}|\SU\\ -|;[club] explain|&\textbf{club}\hspace\labelsep explain - &|\item[club] explain|\\[2\parsep] -|;[widow] explain|&\textbf{widow}\hspace\labelsep explain - &|\item[widow] explain|\\ -&&|\end{description}|\SD\\ -\hline - & &|She wrote:|\SU\\ -|She wrote:|&\smash{\raisebox{\topsep}{She wrote:}}&|\begin{quote}|\\ -|:Indeed| &\hspace\leftmargini Indeed&|Indeed|\\ - & &|\end{quote}|\SD\\ -\hline - & &|Type|\SU\\ -|Type| &\smash{\raisebox{\topsep}{Type}}&|\begin{verbatim}|\\ -| \typeout{OK!}| &|\typeout{OK!}|&|\typeout{OK!}|\\ - & &|\end{verbatim}|\SD\\ -\hline -\SP{A \CS{begin} is executed when {\tt*} etc.\ is first character of a -code line; an indent starts {\tt verbatim}. -\CS{end} is executed at code line without indent and not beginning with -{\tt*} etc.---Turn this feature on by \CS{wikiEnvironments}; turn off by -\CS{nowikiEnvironments}, e.g., to get around incompatibilities -(lists feature is most dangerous). -Disable feature entirely by package option {\tt noEnvironments}. -Package option {\tt noVerbatim} instead may usually suffice, -if you don't want to have any {\tt verbatim}.}\\ -\hline -\end{tabular} -\kern-1em -\end{center} - -% \section{Test}\subsection{Sub-Test}\subsubsection{Subsub-Test} -% \paragraph{Para}\subparagraph{Sub-Para} - -\footnotesize -% \vspace{2ex} -\sloppy -\noindent \WE\WF %%% '''Please note:''' -''Note:'' -% * -Explicit '''turning on''' by %%% one of -% \[|\wikiEnvironments|,\quad |\wikiFonts|,\quad |\wikiHeadings|\] -|\wikiEnvironments| %%% , |\wikiFonts|, |\wikiHeadings|, -etc.\ -% or by |\wikimarkup| (which executes the former three) is ''required''; -is '''required'''; -e.g., after %%% |\maketitle| and -|\tableofcontents|. -|\wikimarkup| '''activates ''all''''' the features. -% * -|\nowikimarkup| %%% executes all of -% \[|\nowikiEnvironments|,\quad |\nowikiFonts|,\quad |\nowikiHeadings|.\] -% |\nowikiEnvironments|, |\nowikiFonts|, |\nowikiHeadings|. -% Use them to get around incompatible code. -'''''dis''ables all''' of them, e.g., to get around incompatibilities. - -\end{document} - diff --git a/Master/texmf-dist/doc/latex/nicetext/docsrc/makedoc.tex b/Master/texmf-dist/doc/latex/nicetext/docsrc/makedoc.tex deleted file mode 100644 index 65beb83f9f1..00000000000 --- a/Master/texmf-dist/doc/latex/nicetext/docsrc/makedoc.tex +++ /dev/null @@ -1,82 +0,0 @@ -\ProvidesPackage{makedoc.tex}[2009/02/21 (UL)] -%% make packagecode environments and remove percents starting lines - -\makeatletter \catcode`\_=11 - -\openin\@inputcheck=niceverb.sty %% JUST HERE -\newwrite\result_file - \immediate\openout \result_file=niceverb.doc %% JUST HERE - -\newif\if_package_code_ \_package_code_false -% \newif\if_empty_code_lines_ \_empty_code_lines_false - %% <- FAILED SO FAR -% \let\maybe_result_empty_line\empty -% \def\result_empty_line{^^J} - -\def\write_result{\immediate\write\result_file} - -\def\process_file{% - %% This macro here to avoid category changes - %% affecting the present code - \begingroup - \let\do\@makeother \dospecials - %% from docstrip.tex: - \@makeother\^^A\@makeother\^^K\endlinechar\m@ne - %% <- cf. TeXbook "extended keyboards" up-/downarrow - %% -> "math specials", cf. "space specials" - \@makeother\^^I% ASCII horizontal tab -- guessed!? ^^L!? -% \tracingmacros=1 - \loop \ifeof\@inputcheck \else - \read\@inputcheck to \InputLine - \expandafter \process_line \InputLine ======&%% primitive version - \repeat - \endgroup} - -\def\process_line#1===#2===#3&{%% may be preferable to wiki.sty - \ifx$#2$% - \ifx$#1$% -% \show\InputLine - \if_package_code_ -% \if_empty_code_lines_ -% \write_result{}\_empty_code_lines_false -% \fi - \else - \write_result{}% -% \let\maybe_result_empty_line\result_empty_line - \fi - \else -% \show\InputLine - \if_package_code_ -% \_empty_code_lines_true - \else - \write_result{\string\begin{packagecode}}% - \_package_code_true - \fi - \write_result{#1}% -% \write_result{\maybe_result_empty_line #1}% -% \let\maybe_result_empty_line\empty - \fi - \else - \write_result{% - \string\end{packagecode}^^J^^J% - \string\subsection{\ignorespaces#2\unskip}^^J}% - \_package_code_false -% \_empty_code_lines_false - \fi} - -\process_file - -\write_result{\string\end{packagecode}} -\closein\@inputcheck \immediate\closeout\result_file - -\endinput - -\stop - %% TODO or \ThankYou; which NICEVERB.TEX may redefine into \endinput - %% or \ThankYou issues \endinput if jobname ... - %% the whole file may be enclosed in \begingroup ... \endgroup - %% ... this is a "driver file"!? - -TODO make own listing environment like this -- own linewise processing, - without verbatim.sty - diff --git a/Master/texmf-dist/doc/latex/nicetext/docsrc/niceverb.tex b/Master/texmf-dist/doc/latex/nicetext/docsrc/niceverb.tex deleted file mode 100644 index be4c19e3e43..00000000000 --- a/Master/texmf-dist/doc/latex/nicetext/docsrc/niceverb.tex +++ /dev/null @@ -1,261 +0,0 @@ -\ProvidesFile{niceverb.tex}[2009/02/23 documenting niceverb.sty] -\title{\textsf{niceverb.sty}\\---\\Minimizing - Markup\\for Documenting \LaTeX\ packages\thanks{This - manual describes package version - version 0.1 as of February 23, 2009%%%\fileversion\ as of \filedate\ - .}}%%%of the package.}} -\author{Uwe L\"uck\\{\tt http://contact-ednotes.sty.de.vu}} -\input{makedoc} -\documentclass[12pt,a4paper]{article} -\usepackage{niceverb} -\usepackage{moreverb} -% \usepackage{verbatim} -\newenvironment{packagecode} - {\PackageCode} - {\endPackageCode} - \gdef\PackageCode{\listing[5]{1}} - \gdef\endPackageCode{% - \endlisting - \global\let\PackageCode\listingcont - \global\let\endPackageCode\endlistingcont} -\begin{document} -\maketitle - -\tableofcontents - -\section{Presenting 'niceverb'} -\subsection{Purpose} -% \begin{abstract}\noindent -% The 'nicetext' bundle provides ``minimal'' markup -The 'niceverb' package provides ``minimal'' markup for documenting \LaTeX\ -packages, reducing the number of keystrokes/visible characters needed -% .\,.\,. %%% ... %% TODO nicedots -(kind of poor man's WYSIWYG).\footnote{``What you see is what you -get.'' Novices are always warned that WYSIWYG is essentially -impossible with \LaTeX.} -% One feature---\verb'&\foo'%%% badly self-documenting, `&' fails -It conveniently handles command names in arguments of macros -such as &\footnote or even of sectioning commands. -% (`.aux'/`.toc' entries). -% -% This is done by making some characters active. -% 'niceverb.sty' thus resembles 'wiki.sty'; both are siblings. -% \end{abstract} -Commands for typesetting a package's code are inserted -automatically (just using \TeX). %%%\footnote{Stephan I. B\"ottcher used -%%%'AWK' instead to typeset the documentation of his 'lineno.sty'.} -As opposed to tools that are rather common on UNIX/Linux, this -operation should work at any \TeX\ installation, irrespective of -platform. - -The package may at least be useful while working at a very new package -and may suffice with small, simple packages. After having edited your -package's code (typically in a `.sty' file), you just ``{`latex'}'' the -manual file (maybe some `.tex' file) and get instantly the corresponding -refreshed documentation. - -'niceverb' may also help to generate without much effort documentations -of nowadays commonly expected typographical quality for packages that -so far only had ASCII documentations. - -\subsection{Acknowledgement/Basic Ideas} -Three ideas of Stephan I. B\"ottcher's in documenting his 'lineno.sty' -inspired the present work: -\begin{enumerate} -\item -The markup and its definitions are short and simple, -markup commands are placed at the right ``margin'' -of the ASCII file, -so you hardly see them in reading the source file, -you rather just read the text that will be printed. -\item -An 'AWK' script removes the `%'s starting \emph{documentation} lines -and inserts the commands for typesetting the package's \emph{code} -(you don't see them in the source). -\item -An active character (\lq`|'\rq) issues a `\string' \emph{and} switches -to typewriter typeface for typesetting a command verbatim---so this -works without changing category codes (which is the usual idea of -typesetting code), therefore it works even in macro arguments. -\end{enumerate} - -\subsection{The Commands and Features of 'niceverb'} - -Single quotes \verb|`|, \verb|'|, ``less than'' \verb|<| (accompanied -with \verb|>|), the hash mark \verb|#|, ampersand \verb|&|, and in an -extended ``auto mode'' even backslash \verb|\| become &\active -characters with ``special effects.'' - -The package mainly aims at typesetting commands and descriptions of their -syntax \emph{if the latter is ``standard \LaTeX-like''}, -using ``meta-variables.'' A string to be -typeset ``verbatim'' thus is assumed to start with a single command like -&\foo, maybe followed by stars (\lq`*'\rq) and pairs of -square brackets (`['.\,.\,.`]') or -curly braces (\verb'{'.\,.\,.\verb'}'), -where those pairs contain strings indicating the typical -kinds of contents for the respective arguments of that command. -A typical example is this: -$$&\foo*[]{}$$ -This was achieved by typing \verb'&\foo*[]{}'. -In ``auto mode'' of the package, even typing -$$\verb|\foo*[]{}|$$ - %% angle brackets feature to be suppressed here! -would have sufficed---WYSIWYG! (I call such mixtures of -\emph{verbatim} and ``meta-variables'' \textit{\lq meta-code\rq}.) - -Now for the details: -\begin{description} - -\item[``Meta-variables:''] {\sloppy The package supports the ``angle -brackets'' style of ``meta-variables'' (as with ). -You just type \lq\verb''\rq\ to get \lq\rq.\par} - -This works due to a sloppy variant &\SimpleVerb of &\verb -which doesn't care about possible ligatures and definitions of active -characters. Instead, it assumes that the ``verbatim'' font doesn't -contain ligatures anyway. \lq\verb'\verb||'\rq, by contrast, just -yields \lq\verb''\rq. - -Almost the same feature is offered by 'ltxguide.cls' which formats the -basic guides from the \LaTeX\ Project Team. The present feature, -however, also works in plain text outside verbatim mode. -% On the other hand: without << feature - -\item[Single quotes (left/right) for ``short verb:''] -{\sloppy The package ``assumes'' that \emph{quoting} refers to -\emph{code}, therefore \lq\verb|`foo'|\rq\ is typeset as -\lq`foo'\rq. This somewhat resembles the &\MakeShortVerb feature of -'doc.sty'.\par} - -It will typically fail when you try to typeset commands (and their -syntax) in \emph{macro arguments}---e.g., -$$\verb|\footnote{`\bar' is a celebrated fake example!}|$$ -will try to \emph{execute} &\bar instead of typesetting it, giving -an ``undefined'' error so. -\verb|\verb| fails in the same situation, for the same reason. -\lq\verb|&|\rq\ (&\footnote{&&&\bar}) or -``auto mode'' (see below) may then work better. - -Double quotes and apostrophes should still work the usual way; -otherwise you could control the parsing mechanisms using curly braces -(outside and inside don't interact). -To get usual single quotes, you can use their standard substitutes -`\lq' and `\rq'. -You can ``abuse'' this ``single quotes'' feature just to get typewriter -typeface.\footnote{In macro arguments this requires that the right -single quote &' is &\active.} -For difficult cases, you can still use the standard `\verb' -command from \LaTeX. - -\item[Single right quotes for &\textsf:] -{\sloppy Package names are (by some unwritten convention!?) -typeset with `\textsf'; -it was natural to use a remaining case of using single quotes -for replacing &\textsf{} by \SimpleVerb|''|.\footnote{% -Font switching by sequences of single quotes is a feature of the -syntax for editing Wikipedia pages and of 'wiki.sty'.}\par} -%% TODO fails in parentheses due to preserving apostrophes - -This idea of switching fonts continues font switching of 'wiki.sty' -which uses the syntax for editing Wikipedia pages. - -\item[Ampersand \lq&&\rq\ typesets command syntax even in arguments:] -\hfil e.g., type \lq\verb|&\foo{}|\rq\ to get -\lq`\foo{}'\rq. This may be even more convenient for typing than -the single quotes method, although looking somewhat strange. -However, `&' may terminate \textit{verbatim} unexpectedly, being -designed for displaying ``\LaTeX-like command syntax'' in the first -instance.\footnote{Moreover, && currently has a limited 'xspace' -functionality only.}\footnote{You can even use && for referring to -active characters like && in footnotes etc.!} - -\begin{sloppypar} -This choice of `&' rests on the assumption that there won't be many -tables in the documenation. You can restore the usual meaning of `&' -by \verb|\MakeAlign\&| and turn the present special meaning on again by -$$\verb|\MakeActiveLet\&\CmdSyntaxVerb|.$$ -You could also -redefine (&\renewcommand) &\descriptionlabel using `\CmdSyntaxVerb' -(the ``normal command'' equivalent to `&') so \verb|\item[\foo]| works -as wanted. -\end{sloppypar} - -\item[``Auto mode'' typesets commands verbatim unless .\,.\,.] -{\sloppy -\hfil In~``auto mode'', the backslash \lq`\'\rq\ is an active character that -builds a command name from the ensuing letters and typesets the -command (and its syntax, allowing meta-variables) verbatim. -However, there are some exceptions, which are collected in a macro -&\niceverbNoVerbList. &\begin, &\end, and &\item belong to this list, -you can redefine (`\renewcommand') it. -There is also a command &\NormalCommand{} \emph{issuing} the -command `\' instead of typesetting it. -Since auto mode is somewhat dangerous, you have to start it explicitly -by &\AutoCmdSyntaxVerb. You can end it by &\EndAutoCmdSyntaxVerb.\par} - -Auto mode is motivated by the observation that there are package files -containing their documentation as pure (well-readable) ASCII -text---containing the names of the new commands without any kind of -quotation marks or verbatim commands. -Auto mode should typeset such documentation just from the same ASCII -text. - -\item[Hash mark &# comes verbatim.] -No macro definitions are expected in the `document' -environment.\footnote{This idea recently appeared on the 'latex-l' -mailing list. It may be wrong, not sure at the moment, think of -'latexa.ltx' .\,.\,.} -Rather, \lq`#'\rq\ is an active character for taking the next -character (assuming it is a digit) to form a reference to a -\emph{macro parameter}---\lq`#1'\rq\ becomes \lq#1\rq\ (WYSIWYG -indeed!). -\end{description} - -\subsection{What is Wrong with the Present Version} -\begin{enumerate} -\item -'niceverb.sty' should be an extension of 'wiki.sty'; -yet their font selection mechanisms are currently not compatible. -\item -Font switching or horizontal spacing may fail in certain situations with -parentheses. (You can correct spacing by \lq`\ '\rq.) -\item -The feature of mixing high-quality-typeset comments into the -package code listing is implemented in a very rudimentary way only. -% just allowing for `\subsection's. -The ``comment detector'' detects Wikipedia-style subsection titles -instead of lines beginning with percent characters.\footnote{% -Percent characters will definitely not be ``ignored'' as with &\DocInput, -rather they will hide rests of \emph{documentation} lines as usually, -while they will be typeset verbatim in \emph{package code} lines.} -% Switching between plain and verbatim typesetting in the package -% listings isn't settled yet, since there are different styles of using -% percent symbols. I have sometimes used double percent symbols -% (\lq\verb|%%|\rq) -% for commenting text and single ones just for ``reversible deletion of -% code,'' while usually single percent symbols indicate commenting text -% indeed. Double percent symbols may, by contrast, mean that the text remains -% visible in the `.sty' file only, suppressed in the typeset -% documentation ('lineno.sty'). -% For a while, it may be necessary to provide replacing macros for each -% package separately instead of providing a single macro package -% managing all of them. -\item -The code listing currently uses the `listing' and `listingcont' -environments of 'moreverb.sty'; -the code font and the line numbers may be too large. -\item -The ``vertical'' character \lq`|'\rq\ should be active and provide a -version of the `decl' environment of 'ltxguide.cls'. -\end{enumerate} - -\section{Implementation of the Markup Syntax} -% \verbatiminput{niceverb.sty} -% \listinginput[5]{1}{niceverb.sty} -\input{niceverb.doc} - -\section{Code Preparing Source for Typesetting} -This is at present in a file `makedoc.tex'. -\listinginput[5]{1}{makedoc} -\end{document} diff --git a/Master/texmf-dist/doc/latex/nicetext/fifinddo.pdf b/Master/texmf-dist/doc/latex/nicetext/fifinddo.pdf new file mode 100644 index 00000000000..7c4dfcb9a1d Binary files /dev/null and b/Master/texmf-dist/doc/latex/nicetext/fifinddo.pdf differ diff --git a/Master/texmf-dist/doc/latex/nicetext/makedoc.pdf b/Master/texmf-dist/doc/latex/nicetext/makedoc.pdf new file mode 100644 index 00000000000..b9f4bb18ce2 Binary files /dev/null and b/Master/texmf-dist/doc/latex/nicetext/makedoc.pdf differ diff --git a/Master/texmf-dist/doc/latex/nicetext/niceverb.pdf b/Master/texmf-dist/doc/latex/nicetext/niceverb.pdf index 51bd438d453..8ca92c6249d 100644 Binary files a/Master/texmf-dist/doc/latex/nicetext/niceverb.pdf and b/Master/texmf-dist/doc/latex/nicetext/niceverb.pdf differ diff --git a/Master/texmf-dist/source/latex/nicetext/fifinddo.tex b/Master/texmf-dist/source/latex/nicetext/fifinddo.tex new file mode 100644 index 00000000000..d41904d3558 --- /dev/null +++ b/Master/texmf-dist/source/latex/nicetext/fifinddo.tex @@ -0,0 +1,290 @@ +\ProvidesFile{fifinddo.tex}[2009/04/15 documentation for `fifinddo'] +\title{\textsf{fifinddo}\\---\\Filtering \TeX(t) Files by \TeX} +\author{Uwe L\"uck\,---\,{\tt http://contact-ednotes.sty.de.vu}} +\listfiles +\RequirePackage{fifinddo} %% otherwise it may remain local +\input{mkfddoc} +\documentclass{article} +\usepackage{substr} %% for failure examples +\input{makedoc.cfg} +\begin{document} +\maketitle + +\begin{flushright}\small\it FIDO, FIND!\\or:\\FIND FIDO!\\oder:\\FIFI, + SUCH!\end{flushright} +\begin{abstract}\noindent\hspace{1sp}%% for niceverb-apostrophe +'fifinddo' starts implementing parsing of plain text or \TeX\ files +using \TeX, generalizing the philosophy behind 'docstrip', +based on how \TeX\ reads macro arguments. +Rather than typsetting the edited input stream immediately, +results are written to another file, +in the first instance as input for \TeX. +Rather than presenting a ``complete study'' of a computer-scientific +idea, it aims at practical applications. +The main one at present is '\mbox{makedoc}' which removes certain comment +marks from package files and inserts listing commands. +Parsing macros are not defined anew at every input chunk, +but once before a file is processed. +This also allows for \emph{expandable} sequences of replacements, +e.g., with `txt'$\to$\TeX\ functionality. +The method of testing for substrings is carefully discussed, +revealing an earlier mistake shared with 'substr.sty' +and \LaTeX's internal `\in@'. +\end{abstract} +\tableofcontents + +\section{Introduction: The Gnome of the Aim} +\subsection{Parsing by \TeX---are you mad?} +The package name 'fifinddo' is a &\listfiles-compatible abbreviation +of \lq file-find-do\rq\footnote{\lq file\rq\ possibly for ``searching + \TeX(t) files'' (I don't remember my thoughts!), + while there were requests for doing replacements on + \LaTeX\ \emph{environments} on 'texhax'. However, the package might + be enhanced in this direction $\dots$ so the name may be wrong + $\dots$ but now I like it so much .\,.\,. Or the reason was that + results are written to a \emph{separate file}, not typeset + immediately.---Let me also mention that \emph{\lq Fifi\rq} (as the + package name starts) is a kind of German equivalent to the + ``English'' \emph{\lq Fido\rq}, or may have been.} +(or think of \lq if found do\rq). +'fifinddo' implements (or aims at) general parsing +(extracting, replacing [converting], expanding, \dots) +using \TeX\ where 'texhax' posters strongly urge to use 'sed', +'awk', or 'Perl'. +'fifinddo''s opposed rationales are: +\begin{itemize} +\item It works instantly on any \TeX\ installation. + (\emph{Restrictions:} Some \TeX\ versions &\write certain hex + codes for certain characters, cf.\ \TeX book p.~45, + I have seen this with PC\TeX. However, some applications of + 'fifinddo' are nothing but technical steps where you will read + the result files rarely anyway. And I have not yet explored + extended encodings.) +\item You can apply and customize it like any \TeX\ macros, knowing + just \TeX\ (or even only the documentation of some user-friendly + extension of 'fifinddo'), without the need of learning any + additional script language. +\item The syntax of usual utilities (e.g., ``wildcards'') + is sometimes difficult with \emph{\TeX} files + with all their backslashes, square brackets, stars, + question marks \dots +\end{itemize} +% +At least the first item is just the philosophy of the 'docstrip' program, +standard for installing \TeX\ packages; +and while I am typing this, I find at least 14 other similar packages +in J\"urgen Fenn's \emph{Topic Index} of the \emph{\TeX\ Catalogue:} +% \begin{quote}\small +\[\texttt{%%%\small + http://mirror.ctan.org/help/Catalogue/bytopic.html\string#parsingfiles}\] +% \end{quote} +(Some of them may have been \emph{reactance} to 'texhax' and other +postings urging not to try something like this; some seem just to be +celebrations of the power of \TeX---yes, celebrate!) + +Actually, \TeX's mechanism of collecting macro arguments is hard-wired +parsing at quite a high level. \LaTeX\ hides this from +``simple-minded'' users by a convention \emph{not} to use that full +power of \TeX\ for \emph{end-user macros}. +\emph{Internally}, \LaTeX\ \emph{does} use it in reading +lists of options and file dates as well as to implement certain +`FOR'- and `WHILE'-like loop programming structures. +\LaTeX's `\in@'/`\ifin@' construction is an implementation of a +`` occurs in '' test. More packages seem to use +this idea for extracting file informations, like 'texshade'. + +However, such packages don't make much ado about parsing, +there seems to be no general setup mechanism as are presented by +'fifinddo'. Indeed, tayloring parsing macros to specific applications +may often be more efficient than a general approach. + +\subsection{Useful for \dots} +My main application of 'fifinddo' at present is typesetting +documentations of packages using 'makedoc' which removes certain +percent marks and inserts listing commands, so you edit a package file +with as little documentation markup as possible. +This may be extended to other kinds of documents as an alternative +to 'easylatex' or 'wiki' (the approach of which is dangerous and +incompatible with certain other things). + +I have used a similar own package 'txtproc' successfully, +where more features were implemented for practical purposes +than are here so far, yet I don't like its implementation, want to +improve it here. This package also \emph{created batch files}, e.g., +to remove temporary files. +This could be used for package handling: +typset the documentation at the desired place in the tree, +write the packages to another, write a batch file to remove +files that are not needed any more after installation +(cf.\ 'make'). %%% !? cf. Wiki `Make (software) 2009/04/11 + +I used 'txtproc' also for \emph{large-scale substitutions} +(it had been decided to change the orthography in a part of a book). +Other large-scale substitutions may be: +\begin{itemize} +\item inserting &\index commands; +\item inserting (soft) hyphenation commands near accents; +\item manual umlaut-conversion.\footnote{If you know the ``names'' + of the encodings, Heiko Oberdiek's 'stringenc' may be + preferable.} +\item typographical (or even orthographical) corrections (same mistake + many times on each of hundreds of pages). + You may turn `...' into `$\dots$' and `etc.' into `etc.\' + etc.\footnote{But what when a new sentence is starting indeed? + Well, `cf.' is an easier example.---`etc.' even showed + a problem in 'niceverb'. 'mdcorr.cfg' replaces `etc. ' + only, so you can keep the extra space by a code line break + (2009/04/11)} + This could replace packages like 'easylatex', 'txt2latex', + 'txt2tex' in a customizable way, using, e.g., the ``correct'' + hook from 'makedoc.sty' as exemplified in 'mdcorr.cfg' + (2009/04/12, see examples section of 'makedoc.pdf'). + Section~\ref{sec:replchain} provides setup for such macros. +\item as to 'easylatex' again, \emph{lists} could be detected and + transformed into \LaTeX\ list commands. This could re-implement + the lists functionality of 'wiki.sty' that is somewhat + dangerous. %% TODO 2009/04/15 +\item introduce your own \emph{shorthands} to be expanded not as \TeX\ macros, + but by text substitution; +\item in EPS files, copy the bounding box to the top two lines + for the 'graphics' bundle. +\end{itemize} +% +In certain cases, insertions deteriorate readability, hyphenation +corrections even make text search difficult. +It is therefore suggested to +\begin{enumerate} +\item keep editing the file without the insertions, +\item run the script (commands based on 'fifinddo') for insertions + in the preamble of the main file + (```\jobname.tex''', maybe &\input the script file) and +\item &\input the result file within the `document' environment. +\end{enumerate} + +In general, differences to ``manual'' replacing by the substitution +function of your \emph{text editor} is that +\begin{itemize} +\item you first keep the original version, +\item you can check the resulting file before you replace the original + file by it, +\item you can store the replacement script in order to check for + mistakes at a later stage of your work, +\item you can do \emph{all} the replacements in \emph{one run} + (by \emph{one} script to check for mistakes), +\item you can store replacement scripts for future applications, + so you needn't type the patterns and replacement strings anew. +\end{itemize} + + +\subsubsection{Missing} +% \subsection{To implement or not to implement \dots} %% TODO!? 2009/04/13 +% Actually, 'fifinddo' doesn't implement very much, and this possibly +% won't change, even if I am lucky. ``Practical applications'' tend to +% show (in my view) that there is a very complex space of possibilities +% what parsing macros could do. If I try to ``attack'' 'Perl' or so, +% cf.\ 'CPAN'\@. If I am lucky and become famous, 'fifinddo' will get many +% extensions in separate packages, cf.\ 'pstricks'. I also like it when +% you can choose among packages for similar purposes, and this may apply +% to extensions of 'fifinddo' as well. +% +% What \emph{really} is missing very badly at present is matching +% \emph{sequences} of strings. However, 'makedoc' contains a practical +% application of this for the case that both strings appear \emph{in the same +% line}. A better algorithm would have to read more lines from the input +% file etc. +% +% As it just comes to my frightened mind, there is even a problem with +% ``strings''/``patterns'' that are \emph{phrases} of words, containing +% spaces \dots +% +% Clearly much comfort concerning \emph{routine} jobs is missing now, +% 'txtproc' has more. Please sponsor (or otherwise support) the work for +% improving this. +% +It should be noted (perhaps here) that the present approach to parsing +is a quite \emph{simple} one and in this respect much different to the +string handling mechanisms of 'stringstrings', 'ted', 'xstrings' (as I +understand them, perhaps also 'coolstr') which are \emph{much more +powerful} than what is offered here---but perhaps slow and for +practical applications possibly replaceable by the present approach. +\emph{Expandable replacement} seems not to exist outside 'fifinddo' +(2009/04/13). + +Much is missing, I know.\footnote{There + is more in my badly implemented 'txtproc.sty'.} +I am just implementing what I actually need +and what could show that this approach is worth being pursued. +It may need being sponsored or otherwise supported. + +\subsection{For insiders} + +\emph{Warning:} You may (at least at the present state of the work) +have little success with this package, if you don't know about +\TeX's category codes and how \TeX\ macros are defined. +The package rather provides tools for package writers. +You may, however, be able to run other packages which just load +'fifinddo' as required background. + +That 'fifinddo' acts on ``\TeX(t)'' files or so means that +(at present) I think of applications on ``plain text'' files which +will usually be \TeX\ input files. ``At present'' they are read +without ``special characters,'' so essentially category codes of input +characters are either 11 (``letter'') or 12 (``other''). +This way some things are easier than with usual \TeX\ applications: +\begin{enumerate} +\item You can ``look into'' curly braces and ``behind'' comment characters. +\item There are exact or safe tests especially of \emph{empty macro arguments} + that are ``expandable,'' i.e., they are ``robust,'' + don't need assignments, can be executed in `\write'ing and in + `\edef' definitions. ``Usually,'' the safe way to test emptiness + is storing a macro argument as a macro, say `\tempo', in order + to test `\ifx\tempo\empty' where `\empty' has been defined + by `\def\empty{}' in the format. But this requires some + `\def\tempo{#}' which breaks in ``mere expanding'' + (\TeX\ \emph{evaluates} `\tempo' instead of defining it). + An \emph{expandable} test on emptiness is, e.g. `\ifx$#$', + where we hope that it becomes `\iftrue' just if macro argument + `#' is empty indeed. However, ``usually'' it may \emph{also} + become `\iftrue' when `#' starts with `$'---if the latter + has category code 3 (``math shift''). But 'fifinddo' does + not assign category code 3 to any character from the input file! + Therefore `\ifx$#$' is `\iftrue' \emph{exactly} if `#' is + empty. +\item You can avoid interference with packages that are needed for + typesetting. You can do the ``preprocessing'' in one run with + typesetting, but you should do the preprocessing before you + load packages needed for typesetting. One may even try to keep + the macros and settings for preprocessing local to a group. +\end{enumerate} +% +Once there may be an option to read input with some usual \TeX\ +category codes as well, it may be useful to (some of) +\begin{itemize} +\item avoid matching substrings of control words, +\item skip blank spaces as \TeX\ does it usually, +\item catch \emph{balanced} input pieces, +\item ignore comments, +\item ignore certain characters. +\end{itemize} + +The essential approach of 'fifinddo' to looking for single strings is +described in some detail in section~\ref{sec:theory}. + +The implementation of 'fifinddo' is as follows. +User commands are specially highlighted (boxed\slash coloured), +together with their syntax description. + +% \end{document} + +\section{Preliminaries} +\subsection{Head of file (Legalese)} + \sloppy %% 2009/04/06 +\input{fifinddo.doc} +\end{document} + +%% TODO cf. Kastrup 'makematch' and others 2009/04/09 + +%% 2009/04/10: title break, by -> with(!?); `boxed/coloured' +%% 2009/04/12: useful: own shorthands +%% 2009/04/13: substr.sty, \emph{expandable}, w/o `implement'!? +%% 2009/04/15: same with \in@ diff --git a/Master/texmf-dist/source/latex/nicetext/makedoc.cfg b/Master/texmf-dist/source/latex/nicetext/makedoc.cfg new file mode 100644 index 00000000000..6d4a9780294 --- /dev/null +++ b/Master/texmf-dist/source/latex/nicetext/makedoc.cfg @@ -0,0 +1,57 @@ +\ProvidesFile{makedoc.cfg}[2009/04/15 + local settings for `makedoc.sty' etc.] + +\RequirePackage{moreverb} +\newenvironment{packagecode} + {\PackageCode} + {\endPackageCode} +\gdef\PackageCode{% + \small +%% Get rid of 'niceverb' stuff: + % \MakeOther\`\MakeOther\'%% probably OK with moreverb + \MakeOther<\MakeOther\|% + %% <- TODO should be 'niceverb' command 2009/04/08 + \listing{1}} +\gdef\endPackageCode{% + \endlisting + \global\def\PackageCode{% + \small + % \MakeOther\`\MakeOther\'%% probably OK with moreverb + \MakeOther<\MakeOther\|% niceverb + \listingcont}% + \global\let\endPackageCode\endlistingcont} +\renewcommand*{\listinglabel}[1]{% + \llap{\scriptsize\rmfamily\the#1}\hskip\listingoffset\relax} + +\RequirePackage{niceverb}[2009/04/11] %% (' and ''; `etc.'\@ +\DeclareRobustCommand{\cs}[1]{\texttt{\char`\\#1}} + %% <- `&\@tempa' and `&\_tempa' fail 2009/04/14 +\RequirePackage{color} + +%% TODO rather in 'niceverb' 2009/04/06: +\CatCode\|\active +\newcommand*{\CmdBox}{% + \ifvmode \pagebreak[1]\fi %% TODO!? 2009/04/06 + \begingroup \let\do\MakeOther \dospecials \tt \TypesetCmdBox} +\def\TypesetCmdBox#1|{%% redefine for changing design +% \fboxrule=.6pt \fboxsep=-\fboxrule +% \fcolorbox[cmyk]{0,0,0,1}{.1,0,.2,.1}{% +% \kern2pt\strut\CmdSyntaxVerb#1\kern2pt}}} +% \kern2pt\strut#1\kern2pt}%% \dospecials version +% \fboxrule=.6pt \fboxsep=.2pt +% \fbox{% +% \fboxrule=0pt \fboxsep=-1pt + \fboxrule=0pt \fboxsep=0pt +% \kern.2pt + \colorbox[cmyk]{.1,0,.2,.05}{% + \kern1.6pt\strut#1\kern1.6pt}% +% \kern.2pt +% }% + \endgroup + \nopagebreak[3]} %% TODO!? 2009/04/06 +\let|\CmdBox + +\pagestyle{headings} + +\endinput + diff --git a/Master/texmf-dist/source/latex/nicetext/makedoc.tex b/Master/texmf-dist/source/latex/nicetext/makedoc.tex new file mode 100644 index 00000000000..6808f391b50 --- /dev/null +++ b/Master/texmf-dist/source/latex/nicetext/makedoc.tex @@ -0,0 +1,214 @@ +\ProvidesFile{makedoc.tex}[2009/04/15 documentation for `makedoc.sty'] +\title{\textsf{makedoc}---Preprocessing documentation by \TeX} + %% 2009/04/10: \\---\\\ breaks TOC +\author{Uwe L\"uck\,---\,{\tt http://contact-ednotes.sty.de.vu}} +\listfiles + \begingroup %% generate makedoc.doc and mdcorr.doc +\RequirePackage{makedoc} +\input{mdcorr.cfg} +\LaTeXresultFile{makedoc.doc} +\HeaderLines{22} +\MainDocParser{\ProcessInputWith{comment}} +\MakeDoc{makedoc.sty} +\CloseResultFile + +\LaTeXresultFile{mdcorr.doc} +\HeaderLines{0} +\MainDocParser{\ProcessInputWith{comment}} +\MakeDoc{mdcorr.cfg} +\CloseResultFile + \endgroup %% makedoc.doc and mdcorr.doc ready +\documentclass{article} +\input{makedoc.cfg} +\begin{document} +\maketitle +\begin{abstract}\noindent\hspace{1sp}%% for niceverb-apostrophe +'makedoc' provides commands for generating \LaTeX\ input from a +package file in order to typeset documentation of the latter +(somewhat similar and opposite to 'docstrip'). +Certain comment marks are removed, and listing commands are inserted. +This continues the policy of 'niceverb' to minimize documentation +markup in package files. 'makedoc' extends and exemplifies the parsing +package 'fifinddo'. After an edit (and test) of your package, +you get the new documentation in one run (or two or three runs---for +labels and TOC, as usual) of the documentation driver file.---This +is an \emph{alternative} to the standard 'doc' package and its +`\DocInput'. The present approach provides \emph{less} than 'doc' +does, rather deliberately. It may be helpful at least for the +development of small packages, or at least at early stages. +\end{abstract} +\tableofcontents +\section{Introduction} +The abstract will not be repeated in this section. Let me add instead +that I was in dire need of such a package, I got stuck with my packages +because I lost orientation in them, and I was unhappy with the forms +of documentations of my other packages, and documenting them with the +'doc' system was not attractive for me (neither considered helpful). +I also worked on \emph{Windows} until September 2008, and I find a system +like the present one still more attractive then using (learning!\@) +other filtering utilities (see below on 'awk'). And I may work on +\emph{Windows} once again and don't want to depend on installing some $\dots$ +there. + +\subsection{Prior work and what is new} +It is, of course, not a new idea to get around comment marks `%' to +typeset the documentation. 'doc''s `\DocInput' does this by making `%' +an ``ignored'' character. This way you cannot use `%' for commenting +comments (so 'doc' offers a ``new comment mark'' `^^A'). +You also cannot use `%' for commenting out code (that you are +pondering or use for debugging only). + +Moreover, 'doc' requires enclosing package code explicitly by +environment commands (behind comment marks). Stephan I. B\"ottcher +with his 'lineno.sty' and Grzegorz Murzynowski in 'gmdoc' aimed at +doing away with this requirement. 'lineno.sty' contains 'awk' scripts +to remove starting comment marks and to insert listing commands. +A file 'lineno.tex' is generated that typesets the documentation. +By the way, 'lineno.sty' is full of discussions, but it is not +'docstrip'ped---the maintainers never have received a complaint +that inputting 'lineno.sty' were too slow. + +'gmdoc' seems to get around comment marks and insert listing commands +\emph{while typesetting} by a refined version of `\DocInput', +through some careful detecting and analysing comment marks, +the approach resembles detection of lists in 'wiki.sty'.\footnote{See + 'gmdoc.pdf' on &\DocInput. You can learn a lot from this 220 pages + document! I also find 'pauldoc' and 'xdoc' inspiring.} +And this is a matter of principles---comparing the approaches of +\emph{preprocessing} ('lineno.sty') and \emph{``smart typesetting''} +('gmdoc', 'wiki'). Sometimes preprocessing seems to be simpler, +sometimes detecting while typesetting. (Another example is the +preprocessor 'easylatex' of which 'wiki.sty' is a much reduced +``while typesetting'' variant.) ``While typesetting'' may be easier +when single characters or sequences of two or three encode markup +information---but such detection can badly interfere with other +packages etc. ``Preprocessing'' may be easier when entire ``strings'' +of characters decide, which may be anywhere in a file line. + +'makedoc' chooses \emph{preprocessing}, as 'lineno.sty', but by +\emph{\TeX}. There is a general discussion of this choice in the +documentation of 'fifinddo'. Preprocessing here can be done in the +same \LaTeX\ run as typesetting, though you can avoid +incompatabilities with packages needed for typesetting +(by inputting them only \emph{after} preprocessing). + +'lineno.sty' exemplifies why preprocessing with \emph{\TeX} may be +preferable to preprocessing with other utilities: +When I took over maintenance of 'lineno.sty', +I needed hard work to get the 'awk' script running. +The \emph{Munich} 'awk' seemed \emph{not} to behave as the \emph{Kiel} +'awk' (I chose a Munich 'nawk' and reworked the script a little). +\TeX\ seems to have better fixed functionality than other utilities! + +%% TODO Paul Isambert's (CTAN recently) 2009/04/08 + +\subsection{Basics on using 'makedoc'} +At least in the long run, using 'makedoc' should not imply commitment +to a certain design or to certain \LaTeX\ packages for typesetting +listings and documentations. Therefore, 'makedoc.cfg' (currently) +contains \emph{local} or \emph{personal choices}, but also +\emph{experiments} with future features of 'niceverb'. +Especially, (at present) the `packagecode' +environment that 'makedoc' `\write's must be chosen. +Currently this is the `listing' environment from 'moreverb' +with some modifications or extra settings. +It may be vital to `\MakeOther' the active characters from 'niceverb' +in the setup of `packagecode'. See the \emph{example} in +section~\ref{sec:fifinddo}. + +Finally, each package file to be typeset will need its own +\emph{script} of 'makedoc' commands. It should fit into the preamble +of the main file for documenting the package (currently %% 2009/04/09 + just 5 commands seem to suffice, see the \emph{example} in + section~\ref{sec:fifinddo} and section~\ref{sec:script} + on typical ``bundling'' \emph{script commands}). +As an alternative, you may prefer to have ``content only'' (as much as +possible) in the main typesetting file and in its preamble only +`\input' a separate script file. + +Yes, the idea of documenting a package \emph{here} is to have a +separate ``driver'' file for typsetting the documentation. +It may contain an introduction and a guide for users. +The documentation of the package code that has been prepared by the +'makedoc' script will be `\input'. Alternatively, the ``driver file'' +could have title etc.\ only, or preamble and a minimal `document' +environment only. + +So there may be many files, which may look confusing, especially as +compared with the 'doc' procedure. However, +\begin{enumerate} +\item ``One file distribution'' still is possible thanks to the + `filecontents' environment. +\item The 'makedoc' script can create a batch file (fitting the + system, maybe using Will Robertson's 'ifplatform', or + 'texsys.cfg', or \dots) + that removes certain auxiliary files or moves them to a + certain directory. +\item I find it helpful to have rather little ``contentual'' text + in the package file. +\item The procedure now runs very smoothly, once the stumbling blocks + have been overcome.\footnote{\hspace{1sp}%% TODO help in 'niceverb'! + 'niceverb' v0.1 was too sloppy with + some things, and self-documentation of 'makedoc.sty' was + difficult---its parsing and that from 'verbatim' cannot + distinguish between markup code and typeset code.} +\end{enumerate} + +\subsection{Examples} +The documentations of 'fifinddo' and of 'makedoc' itself are typeset +using 'makedoc' (\hspace{1sp}'niceverb.pdf' as well, yet comments +remained scarce). 'fifinddo.pdf' documents 'fifinddo.sty', typeset +from 'fifinddo.tex', likewise 'makedoc.pdf'. +Section~\ref{sec:fifinddo} contains listings of 'makedoc.cfg' and the +'makedoc' script file 'mkfddoc.tex' especially made for 'fifinddo.pdf'. +'fifinddo.doc', 'makedoc.doc', and 'niceverb.doc' are the \TeX\ input +files that were made with 'makedoc.sty'---I have only looked at them +when something was wrong (often syntax mistakes in typing). + +The Wikipedia syntax feature `%% === subsubsection ===' is only used in +'fifinddo.sty' and 'niceverb.sty'. + +\section{Implementation} +\subsection{Preliminaries} +Head of file (Legalese): +\sloppy +\input{makedoc.doc} +The previous empty code line is the one \TeX\ insists to add at every +end of a file it writes. %% todo TeXbook where? 2009/04/08 + +\section{Examples: documentation of 'fifinddo'}\label{sec:fifinddo} + +\subsection{\hspace{1sp}'makedoc.cfg'} +'fifinddo.pdf' and 'makedoc.pdf' were typeset with the following +configuration file 'makedoc.cfg': +\begingroup \MakeOther\|\MakeOther\`\MakeOther\'\MakeOther\< + %% <- TODO should be 'niceverb' command 2009/04/08 + \listinginput[5]{1}{makedoc.cfg} +\endgroup + +\subsection{\hspace{1sp}'mkfddoc.tex'} +'fifinddo.pdf' was typeset with the following 'makedoc' script file +'mkfddoc.tex': +\begingroup \MakeOther\|\MakeOther\`\MakeOther\'\MakeOther\< +\listinginput[5]{1}{mkfddoc.tex} +\endgroup + +\subsection{\hspace{1sp}'mdcorr.cfg'} +'fifinddo.pdf' and 'makedoc.pdf' were typeset with the following +typographical corrections in 'mdcorr.cfg': +\strut\hrule +\begingroup \MakeOther\|\MakeOther\`\MakeOther\'\MakeOther\< +\listinginput[5]{1}{mdcorr.cfg} +\endgroup +\hrule\strut +This code also exemplifies the syntax 'niceverb' provides for writing +about \LaTeX\ macros. It is typeset here with 'makedoc.sty' again +and then looks thus: +\strut\hrule +\input{mdcorr.doc} +\strut\hrule + +\end{document} + +2009/04/12: more on examples +2009/04/15: exemplification of niceverb.sty by mdcorr.cfg diff --git a/Master/texmf-dist/source/latex/nicetext/mdcorr.cfg b/Master/texmf-dist/source/latex/nicetext/mdcorr.cfg new file mode 100644 index 00000000000..44e21e0ae80 --- /dev/null +++ b/Master/texmf-dist/source/latex/nicetext/mdcorr.cfg @@ -0,0 +1,15 @@ +\ProvidesFile{mdcorr.cfg}[2009/04/15 + local typographical corrections with makedoc.sty] +%% Also demonstrates 'niceverb.sty'. +\renewcommand*{\PatternCodes}{\MakeOther\\\MakeOther\ } +\renewcommand*{\MakeDocCorrectHook}[1]{\ProcessStringWith{#1}{dots}} +%% |\MakeExpandableAllReplacer{}{}{}{}|% +%% \footnote{Yes, +%% &\MakeExpandableAllReplacer{}{}{}{}.} +\MakeExpandableAllReplacer{dots}{...}{$\dots$}{cf} +\MakeExpandableAllReplacer{cf}{cf.}{cf.\ }{etc} +\MakeExpandableAllReplacer{etc}{etc. }{etc.\ }{LEAVE} +%% So you can keep inter-sentence space after `etc.' +%% by a code line break +\renewcommand*{\PatternCodes}{\fdPatternCodes} +%% ... restores 'fifinddo' default. diff --git a/Master/texmf-dist/source/latex/nicetext/mkfddoc.tex b/Master/texmf-dist/source/latex/nicetext/mkfddoc.tex new file mode 100644 index 00000000000..c4a4937a963 --- /dev/null +++ b/Master/texmf-dist/source/latex/nicetext/mkfddoc.tex @@ -0,0 +1,21 @@ +\ProvidesFile{mkfddoc.tex}[2009/04/15 + prepare typesetting fifinddo.sty] + + \begingroup %% generate fifinddo.doc +\RequirePackage{makedoc}[2009/04/13] +\input{mdcorr.cfg} + +% \NoEmptyCodeLines %% TODO +\ProcessLineMessage{} +\LaTeXresultFile{fifinddo.doc} +\HeaderLines{23} +\MainDocParser{% +% \IfInputLine{=33}{\tracingmacros=1 }{} +% \IfInputLine{=35}{\tracingmacros=0 }{} + \SectionLevelTwoParseInput} +% \tracingmacros=1 +\MakeDoc{fifinddo.sty} +\CloseResultFile + \endgroup %% fifinddo.doc ready +\endinput + diff --git a/Master/texmf-dist/source/latex/nicetext/niceverb.tex b/Master/texmf-dist/source/latex/nicetext/niceverb.tex new file mode 100644 index 00000000000..629d240c458 --- /dev/null +++ b/Master/texmf-dist/source/latex/nicetext/niceverb.tex @@ -0,0 +1,331 @@ +\ProvidesFile{niceverb.tex}[2009/04/15 documenting niceverb.sty] +\title{\textsf{niceverb.sty}\\---\\Minimizing + Markup\\for Documenting \LaTeX\ packages%%% \thanks{This +% manual describes package version +% version 0.2 as of April 09, 2009%%%\fileversion\ as of \filedate\ +% .}}%%%of the package.}% +} +\author{Uwe L\"uck\\{\tt http://contact-ednotes.sty.de.vu}} +\listfiles + \begingroup %% build niceverb.doc + \RequirePackage{makedoc} + \LaTeXresultFile{niceverb.doc} + \HeaderLines{19} + \MainDocParser{\SectionLevelTwoParseInput} + \MakeDoc{niceverb.sty} + \CloseResultFile + \endgroup +% \input{mknvdoc.tex} +\documentclass{article}%% TODO paper dimensions!? +\input{makedoc.cfg}\MakeOther\|%% TODO \verb| 2009/04/09 +%% removed 2009/04/09 for makedoc.sty: +% \usepackage{niceverb} +% \usepackage{moreverb} +% \usepackage{verbatim} +% \newenvironment{packagecode} +% {\PackageCode} +% {\endPackageCode} +% \gdef\PackageCode{\small \listing[5]{1}} +% \gdef\endPackageCode{% +% \endlisting +% \global\def\PackageCode{\small \listingcont}% +% \global\let\endPackageCode\endlistingcont} +% \renewcommand*{\listinglabel}[1]{% +% \llap{\footnotesize\rmfamily\the#1}\hskip\listingoffset\relax} + +\begin{document} +\maketitle + +\begin{abstract}\noindent\hspace{1sp}%% exemplifies a problem +'niceverb.sty' provides very decent syntax for describing \LaTeX\ +packages and the syntax of macros conforming to \LaTeX\ syntax +conventions. +\end{abstract} +\tableofcontents + + %% TODO table listing active characters +\section{Presenting 'niceverb'} +\subsection{Purpose} +% \begin{abstract}\noindent +% The 'nicetext' bundle provides ``minimal'' markup +The 'niceverb' package provides ``minimal'' markup for documenting \LaTeX\ +packages, reducing the number of keystrokes/visible characters needed +% .\,.\,. %%% ... %% TODO nicedots +(kind of poor man's WYSIWYG).\footnote{``What you see is what you +get.'' Novices are always warned that WYSIWYG is essentially +impossible with \LaTeX.} +% One feature---\verb'&\foo'%%% badly self-documenting, `&' fails +It conveniently handles command names in arguments of macros +such as &\footnote or even of sectioning commands. +% (`.aux'/`.toc' entries). +% +% This is done by making some characters active. +% 'niceverb.sty' thus resembles 'wiki.sty'; both are siblings. +% \end{abstract} +If you use 'makedoc.sty' additionally, commands for typesetting a +package's code are inserted automatically (just using \TeX). +%%% \footnote{Stephan I. B\"ottcher used +%%% 'awk' instead to typeset the documentation of his 'lineno.sty'.} +As opposed to tools that are rather common on UNIX/Linux, this +operation should work at any \TeX\ installation, irrespective of +platform. + +Both packages may at least be useful while working at a very new package +and may suffice with small, simple packages. After having edited your +package's code (typically in a `.sty' file), you just ``{`latex'}'' the +manual file (maybe some `.tex' file) and get instantly the corresponding +refreshed documentation. + +'niceverb' and 'makedoc' may also help to generate without much effort +documentations of nowadays commonly expected typographical quality for +packages that so far only had plain text documentations. + +\subsection{Acknowledgement/Basic Ideas} +Three ideas of Stephan I. B\"ottcher's in documenting his 'lineno.sty' +inspired the present work: +\begin{enumerate} +\item +The markup and its definitions are short and simple, +markup commands are placed at the right ``margin'' +of the ASCII file, +so you hardly see them in reading the source file, +you rather just read the text that will be printed. +\item +An 'awk' script removes the `%'s starting \emph{documentation} lines +and inserts the commands for typesetting the package's \emph{code} +(you don't see them in the source). +\item +An active character (\lq&|\rq) issues a `\string' \emph{and} switches +to typewriter typeface for typesetting a command verbatim---so this +works without changing category codes (which is the usual idea of +typesetting code), therefore it works even in macro arguments. +\end{enumerate} + +\subsection{The Commands and Features of 'niceverb'} + +Single quotes \verb|`|, \verb|'|, ``less than'' \verb|<| (accompanied +with \verb|>|), the hash mark \verb|#|, ampersand \verb|&|, and in an +extended ``auto mode'' even backslash \verb|\| become &\active +characters with ``special effects.'' \lq`|'\,.\,.\,.\,`|'\rq\ +should highlight descriptions of user commands and their syntax. + +The package mainly aims at typesetting commands and descriptions of their +syntax \emph{if the latter is ``standard \LaTeX-like''}, +using ``meta-variables.'' A string to be +typeset ``verbatim'' thus is assumed to start with a single command like +&\foo, maybe followed by stars (\lq`*'\rq) and pairs of +square brackets (`['.\,.\,.`]') or +curly braces (\verb'{'.\,.\,.\verb'}'), +where those pairs contain strings indicating the typical +kinds of contents for the respective arguments of that command. +A typical example is this: +\[&\foo*[]{}\] +This was achieved by typing \[\verb'&\foo*[]{}'\] +In ``auto mode'' of the package, even typing +\[\verb|\foo*[]{}|\] + %% angle brackets feature to be suppressed here! +would have sufficed---WYSIWYG! (I call such mixtures of +\emph{verbatim} and ``meta-variables'' \textit{\lq meta-code\rq}.) + +Now for the details: +\begin{description} + +\item[``Meta-variables:''] {\sloppy The package supports the ``angle +brackets'' style of ``meta-variables'' (as with ). +You just type \lq\verb''\rq\ to get \lq\rq.\par} + +This works due to a sloppy variant &\SimpleVerb of &\verb +which doesn't care about possible ligatures and definitions of active +characters. Instead, it assumes that the ``verbatim'' font doesn't +contain ligatures anyway. \lq\verb'\verb||'\rq, by contrast, just +yields \lq\verb''\rq. + +Almost the same feature is offered by 'ltxguide.cls' which formats the +basic guides from the \LaTeX\ Project Team. The present feature, +however, also works in plain text outside verbatim mode. +% On the other hand: without << feature + +\item[Single quotes (left/right) for ``short verb:''] +{\sloppy The package ``assumes'' that \emph{quoting} refers to +\emph{code}, therefore \lq\verb|`foo'|\rq\ is typeset as +\lq`foo'\rq. This somewhat resembles the &\MakeShortVerb feature of +'doc.sty'.\par} + +It will typically fail when you try to typeset commands (and their +syntax) in \emph{macro arguments}---e.g., +$$\verb|\footnote{`\bar' is a celebrated fake example!}|$$ +will try to \emph{execute} &\bar instead of typesetting it, giving +an ``undefined'' error so. +\verb|\verb| fails in the same situation, for the same reason. +\lq\verb|&|\rq\ (&\footnote{&&&\bar}) or +``auto mode'' (see below) may then work better. + +Double quotes and apostrophes should still work the usual way; +otherwise you could control the parsing mechanisms using curly braces +(outside and inside don't interact). +To get usual single quotes, you can use their standard substitutes +`\lq' and `\rq'. +You can ``abuse'' this ``single quotes'' feature just to get typewriter +typeface.\footnote{In macro arguments this requires that the right +single quote &' is &\active.} +For difficult cases, you can still use the standard `\verb' +command from \LaTeX. + +\item[Single right quotes for &\textsf:] +{\sloppy Package names are (by some unwritten convention!?) +typeset with `\textsf'; +it was natural to use a remaining case of using single quotes +for abbreviating &\textsf{} by \SimpleVerb|''|.\footnote{% +Font switching by sequences of single quotes is a feature of the +syntax for editing Wikipedia pages and of 'wiki.sty'.}\par} +%% TODO fails in parentheses due to preserving apostrophes + +This idea of switching fonts continues font switching of 'wiki.sty' +which uses the syntax for editing Wikipedia pages. + +\item[Ampersand \lq&&\rq\ typesets command syntax even in arguments:] +\hfil e.g., type \lq\verb|&\foo{}|\rq\ to get +\lq`\foo{}'\rq. This may be even more convenient for typing than +the single quotes method, although looking somewhat strange. +However, `&' may terminate \textit{verbatim} unexpectedly, being +designed for displaying ``\LaTeX-like command syntax'' in the first +instance.\footnote{Moreover, && currently has a limited 'xspace' +functionality only.}\footnote{You can even use && for referring to + active characters like && in footnotes etc.!} + +\begin{sloppypar} +This choice of `&' rests on the assumption that there won't be many +tables in the documenation. You can restore the usual meaning of `&' +by \verb|\MakeAlign\&| and turn the present special meaning on again by +$$\verb|\MakeActiveLet\&\CmdSyntaxVerb|.$$ +You could also +redefine (&\renewcommand) &\descriptionlabel using `\CmdSyntaxVerb' +(the ``normal command'' equivalent to `&') so \verb|\item[\foo]| works +as wanted. +\end{sloppypar} + +\item[``Auto mode'' typesets commands verbatim unless .\,.\,.] +{\sloppy +\hfil In~``auto mode'', the backslash \lq`\'\rq\ is an active character that +builds a command name from the ensuing letters and typesets the +command (and its syntax, allowing meta-variables) verbatim. +However, there are some exceptions, which are collected in a macro +&\niceverbNoVerbList. &\begin, &\end, and &\item belong to this list, +you can redefine (`\renewcommand') it. +There is also a command &\NormalCommand{} \emph{issuing} the +command `\' instead of typesetting it. +Since auto mode is somewhat dangerous, you have to start it explicitly +by &\AutoCmdSyntaxVerb. You can end it by &\EndAutoCmdSyntaxVerb.\par} + +Auto mode is motivated by the observation that there are package files +containing their documentation as pure (well-readable) ASCII +text---contain\-ing the names of the new commands without any kind of +quotation marks or verbatim commands. +Auto mode should typeset such documentation just from the same ASCII +text. + +\item[Hash mark &# comes verbatim.] +No macro definitions are expected in the `document' +environment.\footnote{This idea recently appeared on the 'latex-l' +mailing list. It may be wrong, not sure at the moment, think of +'latexa.ltx' .\,.\,.} +Rather, \lq`#'\rq\ is an active character for taking the next +character (assuming it is a digit) to form a reference to a +\emph{macro parameter}---\lq`#1'\rq\ becomes \lq#1\rq\ (WYSIWYG +indeed!). +\end{description} + +\subsection{Examples} +The local configuration file 'mdcorr.cfg' documents itself using +'niceverb' syntax. Its code and the documentation that is typeset from +it are at the end of the \lq examples\rq\ section of 'makedoc.pdf'. +(2009/04/15) + +Moreover, the documentation 'niceverb.pdf' of 'niceverb.sty' was +typeset from 'niceverb.tex' and 'niceverb.sty' using 'niceverb' +syntax, likewise 'fifinddo.pdf' and 'makedoc.pdf'. +The example of 'niceverb' shows the most frequent use of the `&' +feature. + +It seems to me that I could type so many pages on 'fifinddo' and +'makedoc' in little more than a week +% (2009/04/12, much of which was needed for debugging and reworking concepts) +only due to the ``minimal'' \emph{verbatim} and syntax-display syntax. + +\subsection{What is Wrong with the Present Version} +\begin{enumerate} +\item 'niceverb.sty' should be an extension of 'wiki.sty'; + yet their font selection mechanisms are currently not compatible. +\item Font switching or horizontal spacing may fail in certain situations + (parentheses, titles, footnotes; you can correct spacing by + \lq`\ '\rq). + %% TODO 2009/04/10 redefine \noindent, \footnote ... + %% or use correcting function with 'fifinddo' +% \item +% The feature of mixing high-quality-typeset comments into the +% package code listing is implemented in a very rudimentary way only. +% % just allowing for `\subsection's. +% The ``comment detector'' detects Wikipedia-style subsection titles +% instead of lines beginning with percent characters.\footnote{% +% Percent characters will definitely not be ``ignored'' as with &\DocInput, +% rather they will hide rests of \emph{documentation} lines as usually, +% while they will be typeset verbatim in \emph{package code} lines.} +% Switching between plain and verbatim typesetting in the package +% listings isn't settled yet, since there are different styles of using +% percent symbols. I have sometimes used double percent symbols +% (\lq\verb|%%|\rq) +% for commenting text and single ones just for ``reversible deletion of +% code,'' while usually single percent symbols indicate commenting text +% indeed. Double percent symbols may, by contrast, mean that the text remains +% visible in the `.sty' file only, suppressed in the typeset +% documentation ('lineno.sty'). +% For a while, it may be necessary to provide replacing macros for each +% package separately instead of providing a single macro package +% managing all of them. +% \item +% The code listing currently uses the `listing' and `listingcont' +% environments of 'moreverb.sty'; +% the code font and the line numbers may be too large. +\item The ``vertical'' character \lq&|\rq\ was planned to be active + and provide a version of the `decl' environment of + 'ltxguide.cls'. Currently 'makedoc.cfg' installs inline, + coloured\slash framed boxes instead (2009/04/09). They have + their merits! See 'fifinddo.pdf' and 'makedoc.pdf'. However, + they badly deal with long command names and many arguments + .\,.\,. (They could also issue an `\index' command!)---Doubled + verticals could make the difference, calling a `decl' table + indeed. +\item ``Auto mode'' has not been tested on a serious application yet. +\item 'niceverb''s font switching tricks sometimes turn against their + inventor (and other users?). There must be some switching + ``off'' (and ``on'' again).% + \footnote{\hspace{1sp}'fifinddo'\slash\hspace{1sp}'makedoc' + %% <- TODO oh, oh! 2009/04/11 + allow inserting such commands from a driver script, + invisible in the file that contains the ``contentual'' + documentation.} + Also, there might better help with weird errors, + some syntax checks might intercept earlier. + + Similarly, some choices reflect a + personal style and should be modifiable, especially by package + options.\footnote{Please sponsor the project or support it + otherwise!} +\end{enumerate} + +\pagebreak[3] %% 2009/04/15 +\section{Implementation of the Markup Syntax} +% \verbatiminput{niceverb.sty} +% \listinginput[5]{1}{niceverb.sty} +\input{niceverb.doc} + +%% removed 2009/04/09 for makedoc.sty: +% \section{Code Preparing Source for Typesetting} +% This is at present in a file `mknvdoc.tex'. +% \listinginput[5]{1}{mknvdoc} +\end{document} + +2009/04/09: adjusted to new doc-generation method +2009/04/12: examples, 'awk' lower-case +2009/04/15: example 'mdcorr.cfg', abstract, + \pagebreak to implementation diff --git a/Master/texmf-dist/source/latex/nicetext/wikicheat.tex b/Master/texmf-dist/source/latex/nicetext/wikicheat.tex new file mode 100644 index 00000000000..e56bff99120 --- /dev/null +++ b/Master/texmf-dist/source/latex/nicetext/wikicheat.tex @@ -0,0 +1,148 @@ +\ProvidesFile{wikicheat}[2008/07/10 Cheatsheet for wiki.sty] +% \def\title{Cheatsheet for the \textsf{wiki} Package} +\def\title{\textbf{Cheatsheet} for the \textbf{\textsf{wiki}} Package} +\def\author{Uwe L\"uck} +\documentclass[12pt,a4paper]{article} +\nofiles +\pagestyle{empty} +\makeatletter +\@ifundefined{UndeclareTextCommand}{}{\usepackage{upquote}} %% 2008/07/02 +\makeatother +\usepackage{wiki} +% \let\WE\relax \let\WF\relax \let\WH\relax +\let\WE\wikiEnvironments +\let\WF\wikiFonts +\let\WH\wikiHeadings +\def\SP#1{\multicolumn{3}{\VR c\VR}{% +% \parbox{11cm}{% + \parbox{13cm}{% + \footnotesize\it\sloppy\SU#1\SD}}} +\def\SL{/\hskip.16667em} +% \setbox0\hbox{(}\showthe\ht0\showthe\dp0 %% height = 3x depth +\def\SU{\rule{0pt}{.99em}}%%%{1.1em}} +\def\HSU{\rule{0pt}{.75em}} +\def\SD{\rule[-.33em]{0pt}{0pt}}%%%45em]{0pt}{0pt}} +% \def\CS#1{{\tt\textbackslash #1}} %% 2008/07/02 +{\makeatletter \gdef\CS#1{{\tt\@backslashchar#1}}} +\let\VR| \catcode`\|\active \def|{\verb|} +\begin{document} +% \maketitle + +\enlargethispage{3\normalbaselineskip} +\vspace*{-\topmargin} %% !? +\vspace*{-\headheight}\vspace*{-\headsep}\vspace*{-\topsep}\vspace*{-\partopsep} +\begin{center} +\large \title\\[.4ex] \normalsize +Some \LaTeX-Markup through some Wiki-Markup\\[.8ex] + \author, \today +% \end{center} + +\vspace{\topsep} +\vspace*{\partopsep} +% \vspace{1.5ex} +% \vspace{1ex} +% \hrule +% \vspace{1ex} + +% \begin{center} +\leavevmode\kern-1em +\begin{tabular}{\VR l\VR l\VR l\VR} +\hline\hline +\SU\SD\bf Code for \textsf{wiki.sty}&\bf What you get& \bf like \LaTeX-code\\ +\hline\hline +|''italic''|&\WF ''italic''&|\textit{italic}|\SU\\ +|'''bold'''|&\WF '''bold'''&|\textbf{bold}|%%%\\ +\SD\\ +% |'''''bf+it'''''|&\WF '''''bf+it''''' +% &|\textbf{\textit{bf+it}}|\SD\\ +% |'''''B+I'''''|&\WF '''''B+I''''' &|\textbf{\textit{B+I}}|\SD\\ +\hline +\SP{``Italic'' and ``bold'' may be combined, nested, overlap. +% Automatic italic correction cannot be suppressed by \CS{nocorr}. +% Implementation uses \LaTeX\ internals; no groups are formed. +Quotation marks +% (even German) +usually are not +affected.---Turn +% {\tt '\string{\string}''} may help with +% apostrophes.---Turn +font feature on/off by \CS{wikiFonts}\SL\CS{nowikiFonts}; disable feature +entirely by package option {\tt noFonts}.}\\ +\hline\hline +|== Level 1 ==|&\Large\bf\HSU 1\quad Level 1&|\section{Level 1}|\SU\\ +|=== Level 2 ===|&\large\bf 1.1\quad Level 2&|\subsection{Level 2}|\SU\\ +|==== Level 3 ====|&\bf 1.1.1\quad Level 3&|\subsubsection{Level 3}|\\ +|===== Level 4 =====|&\bf Level 4 &|\paragraph{Level 4}|\SD\\ +|====== Level 5 ======|&\bf Level 5 &|\subparagraph{Level 5}|\SD\\ +\hline +\SP{Turn heading feature on/off by \CS{wikiHeadings}\SL\CS{nowikiHeadings}; +disable feature entirely by package option {\tt noHeadings}.}\\ +\hline\hline +&&|\begin{itemize}|\SU\\ +|* One|&\textbullet\hspace\labelsep One &|\item One|\\[2\parsep] +|* Two|&\textbullet\hspace\labelsep Two &|\item Two|\\ +&&|\end{itemize}|\SD\\ +\hline +&&|\begin{enumerate}|\SU\\ +|# One|&1.\hspace\labelsep One &|\item One|\\[2\parsep] +|# Two|&2.\hspace\labelsep Two &|\item Two|\\ +&&|\end{enumerate}|\SD\\ +\hline +&&|\begin{description}|\SU\\ +|;[club] explain|&\textbf{club}\hspace\labelsep explain + &|\item[club] explain|\\[2\parsep] +|;[widow] explain|&\textbf{widow}\hspace\labelsep explain + &|\item[widow] explain|\\ +&&|\end{description}|\SD\\ +\hline + & &|She wrote:|\SU\\ +|She wrote:|&\smash{\raisebox{\topsep}{She wrote:}}&|\begin{quote}|\\ +|:Indeed| &\hspace\leftmargini Indeed&|Indeed|\\ + & &|\end{quote}|\SD\\ +\hline + & &|Type|\SU\\ +|Type| &\smash{\raisebox{\topsep}{Type}}&|\begin{verbatim}|\\ +| \typeout{OK!}| &|\typeout{OK!}|&|\typeout{OK!}|\\ + & &|\end{verbatim}|\SD\\ +\hline +\SP{A \CS{begin} is executed when {\tt*} etc.\ is first character of a +code line; an indent starts {\tt verbatim}. +\CS{end} is executed at code line without indent and not beginning with +{\tt*} etc.---Turn this feature on by \CS{wikiEnvironments}; turn off by +\CS{nowikiEnvironments}, e.g., to get around incompatibilities +(lists feature is most dangerous). +Disable feature entirely by package option {\tt noEnvironments}. +Package option {\tt noVerbatim} instead may usually suffice, +if you don't want to have any {\tt verbatim}.}\\ +\hline +\end{tabular} +\kern-1em +\end{center} + +% \section{Test}\subsection{Sub-Test}\subsubsection{Subsub-Test} +% \paragraph{Para}\subparagraph{Sub-Para} + +\footnotesize +% \vspace{2ex} +\sloppy +\noindent \WE\WF %%% '''Please note:''' +''Note:'' +% * +Explicit '''turning on''' by %%% one of +% \[|\wikiEnvironments|,\quad |\wikiFonts|,\quad |\wikiHeadings|\] +|\wikiEnvironments| %%% , |\wikiFonts|, |\wikiHeadings|, +etc.\ +% or by |\wikimarkup| (which executes the former three) is ''required''; +is '''required'''; +e.g., after %%% |\maketitle| and +|\tableofcontents|. +|\wikimarkup| '''activates ''all''''' the features. +% * +|\nowikimarkup| %%% executes all of +% \[|\nowikiEnvironments|,\quad |\nowikiFonts|,\quad |\nowikiHeadings|.\] +% |\nowikiEnvironments|, |\nowikiFonts|, |\nowikiHeadings|. +% Use them to get around incompatible code. +'''''dis''ables all''' of them, e.g., to get around incompatibilities. + +\end{document} + diff --git a/Master/texmf-dist/tex/latex/nicetext/fifinddo.sty b/Master/texmf-dist/tex/latex/nicetext/fifinddo.sty new file mode 100644 index 00000000000..1f03ae4c4ab --- /dev/null +++ b/Master/texmf-dist/tex/latex/nicetext/fifinddo.sty @@ -0,0 +1,676 @@ +%% Macro package `fifinddo.sty' for LaTeX2e, %% FIDO, FIND! +%% copyright (C) 2009 Uwe L\"uck, +%% http://www.contact-ednotes.sty.de.vu +%% -- author-maintained in the sense of LPPL below -- +%% for processing tex(t) files +%% (checking, filtering, converting, substituting, expanding, ...) + +\def\fileversion{0.3} \def\filedate{2009/04/15} + +%% This file can be redistributed and/or modified under +%% the terms of the LaTeX Project Public License; either +%% version 1.3a of the License, or any later version. +%% The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% We did our best to help you, but there is NO WARRANTY. +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +%% For the full documentation, look for `fifinddo.pdf'. +%% Its source starts in `fifinddo.tex'. +%% +%% === Format and package version === +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +% 1994/12/01: \newcommand* etc. +\ProvidesPackage{fifinddo}[\filedate\space v\fileversion\space + filtering TeX(t) files by TeX (UL)] +%% +%% === Category codes === +%% +%% We use the ``underscore'' as ``compound identifier.'' +\catcode`\_=11 %% underscore used in control words +%% +%% |\MakeOther| is a synonym for `\@makeother', needed for matching +%% special characters from the input file. It is exemplified by +%% |\fdPatternCodes| which is the default of |\PatternCodes|. +%% The latter is used in setup macros for reading patterns. +\@ifundefined{MakeOther}{\let\MakeOther\@makeother}{} +\newcommand*{\fdPatternCodes}{\MakeOther\&\MakeOther\$} +\newcommand*{\PatternCodes}{} \let\PatternCodes\fdPatternCodes + %% TODO adding/removing +%% It would be bad to have `\MakeOther\%' and `\MakeOther\ ' here in +%% that this may have unexpected, weird effects with arguments of +%% setup macros. Therefore neither `\dospecials' nor `\@sanitize' are +%% used. Curly braces remain untouched as default delimiters in setup +%% macros. For matching them, you must use `\MakeOther\{' and +%% `\MakeOther' in your `\PatternCodes', or |\Delimiters| to introduce +%% new ones at the same time, e.g., `\Delimiters\[\]': +\newcommand*{\Delimiters}[2]{% + \MakeOther\{\MakeOther\}\catcode`#1=1\catcode`#2=2\relax} +%% For replacing strings or for defining other strings of ``other'' +%% characters by `\edef', you can use some \LaTeX\ constructs---here +%% are copies |\PercentChar| and |\BackslashChar| of them +%% (do you need more?): +\newcommand*{\PercentChar}{} \let\PercentChar\@percentchar +\newcommand*{\BackslashChar}{} \let\BackslashChar\@backslashcar +%% +%% == File handling == +\newwrite\result_file %% or write to \@mainaux!? +%% |\ResultFile{}| opens (and empties) a file +%% to be written into. +\newcommand*{\ResultFile}[1]{% + \def\result_file_name{#1}% + \immediate\openout\result_file=#1} +%% |\WriteResult{}| writes a line into +%% (or more lines with `^^J'). +\newcommand*{\WriteResult}[1]{% + \immediate\write\result_file{#1}} +%% |\WriteProvides| writes a `\ProvidesFile' command to the +%% opened file. This should be used when +%% is made as \LaTeXe\ input. +\newcommand*{\WriteProvides}{% + \WriteResult{% + \string\ProvidesFile{\result_file_name}% + [\the\year/\two@digits\month/\two@digits\day\space + automatically generated with fifinddo.sty]}}% +%% |\ProcessFileWith{}{}| opens a file +%% and runs a loop on its lines the main body of which is . +%% When it starts, a new line of is stored as macro +%% |\fdInputLine|. +\newcommand*{\ProcessFileWith}[2]{% + \openin\@inputcheck=#1% +% \ifeof\@inputcheck %% bad `exists?' test +% \PackageError{fifinddo}{File `#1' not here}% +% {Mistyped?}% +% \else + \global\c@fdInputLine=\z@ %% line counter reset + \begingroup + \MakeOther\{\MakeOther\}\@sanitize + %% from docstrip.tex: + % \MakeOther\^^A\MakeOther\^^K%% irrelevant, not LaTeX + \endlinechar\m@ne + %% <- cf. TeXbook "extended keyboards" up-/downarrow + %% -> "math specials", cf. "space specials" + \MakeOther\^^I% ASCII horizontal tab -- guessed!? ^^L!? + \loop \ifeof\@inputcheck \else + \read\@inputcheck to \fdInputLine + \ignorespaces #2% + \repeat + \endgroup +% \fi + \closein\@inputcheck} +%% |\CloseResultFile| closes . +\newcommand*{\CloseResultFile}{\immediate\closeout\result_file} +%% Peter Wilson's 'newfile' provides more powerful file handling. +%% % <- TODO relevant? 2009/04/12 +%% +%% \pagebreak %% TODO move theory to fifinddo.tex 2009/04/12 +%% == Basic handling of substring conditionals == +%% \label{sec:theory} +%% === ``Substring Theory'' === +%% \begin{flushright}\it +%% I wished I could study string theory,\\ +%% but I only could study substring theory. +%% \end{flushright} +%% A \TeX\ macro, say, `\find' whose parameter text +%% (cf. \TeX book p.~203) +%% starts with `#1#2&' stops \TeX\ with an error if it does +%% not find and then `&'. Otherwise we have a situation +%% `\find&', and `\find' reads as +%% #1 and as #2. An important point to note is that +%% will not contain , but possibly has more +%% occurrences in . In this sense, `\find' uses the +%% \emph{first} occurrence of it finds in order to delimit #1. +%% Finding the \emph{last} occurrence of therefore needs a +%% special idea. +%% +%% In order to use `\find' for a test whether is in +%% , we build a ``sandbox'' |\find&|, where +%% contains \emph{and additionally} ---as a +%% ``dummy;'' so `&' delimits the search and `\find' finds +%% either in or somewhere else before `&'. +%% +%% Consider the simple sandbox |\find&|. +%% We can test #1 and #2 on being empty by `\ifx$#1$' and `\ifx$#2$'. +%% If #2 is empty, is \emph{not} in . +%% If #1 is empty at the same time, is empty. +%% If #1 is empty and #2 is not, \emph{starts} ! +%% This can be used to implement +%% Wikipedia-like lists %% TODO 2009/04/11 +%% and to distinguish package code from comments in 'makedoc'. +%% +%% If #2 is \emph{not} empty, occurs in ---or this once +%% was \emph{thought}, some time in developping the present package, +%% as well as in the version of 'substr.sty' marked +%% `2005-11-29',\footnote{\hspace{1sp}'substr' does not change +%% category codes +%% % as 'fifinddo' does +%% and uses \cs{@nil} as delimiter instead of our &&.} try +%% \[`\IfSubStringInString{}{}{YES}{NO}'\] +%% which works \emph{verbatim} as well as considering and +%% \emph{placeholders}, e.g., for +%% \begin{center} +%% `\IfSubStringInString{day after day}{day after }{YES}{NO}'\footnote{% +%% Likewise \texttt{t\string\^ete-\string\`a-t\string\^te} ...}\\ +%% `\IfSubStringInString{AMSTERDAM}{AMSTERD}{YES}{NO}'\\ +%% `\IfSubStringInString{TORONTO}{TORON}{YES}{NO}'\\ +%% `\IfSubStringInString{bonbon}{bon}{YES}{NO}'\footnote{% +%% Polynesian: `aku aku', `rongorongo', `wiki wiki' ...}\\ +%% `\IfSubStringInString{bonobo}{bono}{YES}{NO}' +%% (an ape) +%% \end{center} +%% or `\IfSubStringInString{ionization}{ionizat}{YES}{NO}'.\footnote{% +%% Read 'substr.sty' or try ``normal'' things to convince yourself +%% that the syntax indeed is +%% &\IfSubStringInString{}{}{}{}.} +%% Same with \LaTeX's internal `\in@': +%% \[`\makeatletter \in@{bonbon}{bon}\ifin@ YES\else NO\fi \makeatother'\] +%% %% \makeatletter \in@{bonbon}{bon}\ifin@ YES\else NO\fi \makeatother +%% %% \IfSubStringInString{ionization}{ionizat}{YES}{NO} +%% +%% In general, the previous approach \emph{fails if and exactly if} +%% has a \emph{period} $p$---less than its length---in the sense of that +%% the $p$th token to the right or left of each token in +%% is the \emph{same} token. +%% `AMSTERDAM' has a period 8, `day after day' 10, `bonbon' 3, `bonobo' 4. +%% There is a counterexample of length $p$ iff +%% has period $p$, namely the first substring of +%% having length $p$. If the length of exceeds a multiple +%% $mp$ of its period, the first $mp$ tokens of form +%% a counterexample . +%% +%% Therefore, a sandbox must have something between and +%% . We choose |\find~$&| as standard. +%% The `$' will be used as an argument delimiter to get rid of the dummy +%% in , as well as to decide whether the match was +%% in or in the dummy part of the sandbox. +%% The `$' can be replaced by another tilde `~' in order to +%% test whether \emph{ends} on a , defining a macro +%% like `\findatend' whose parameter text starts with `#1~#2&'. +%% +%% === Plan for proceeding === +%% When we check a file for several patterns, we seem to need +%% \emph{two} macros for each pattern: one that has the pattern +%% in its parameter text and one that stores the pattern for building +%% the sandbox.\footnote{If it were for the pattern only, the parsing +%% macro might suffice and the macro calling it might extract the +%% pattern from a ``dummy expansion.'' Somewhat too much for me now; +%% on the other hand the calling macro also hands some ``current'' +%% informations to the parsing macro---oh, even this could be +%% handled by a general ``calling'' macro \dots} +%% %% TODO 2009/04/15 +%% We use a separate \emph{``name space''} for each of +%% both kinds. The parsing macro and the macro building the sandbox +%% will have a common \emph{``identifier''} by which the user or +%% programmer calls them. Actually, she will usually (first) call +%% the sandbox box builder. The sandbox builder calls the parsing +%% macro. When \emph{all} occurrences of a pattern in the target are +%% looked for, the parser may call itself. +%% +%% Actually, the parsing macro will execute certain actions +%% depending on what it finds in the sandbox, so we call it a +%% \emph{``substring conditional''}. It may read additional arguments +%% after the sandbox that store information gathered before. +%% This is especially useful for designing \emph{``expandable''} +%% chains (sequences) of conditionals where macros cannot store information in +%% macros. The macro setting up the sandbox will initialize such +%% extra arguments at the same time. +%% +%% It may be more efficient \emph{not} to use the following setup +%% macros but to type the macros yourself, just using the following +%% as templates. The setup macros are especially useful with patterns +%% that contain ``special characters,'' as when you are looking for +%% lines that might be package comments. +%% +%% === Set up conditionals === +%% `substr_cond' is the ``name space'' for substring conditionals. +%% A colon separates it from \emph{``job identifiers''} in the actual +%% macro names. +\def\substr_cond{substr_cond:} +%% |\MakeSubstringConditional{}[]{}| +%% starts the definition of a conditional with \emph{identifier} +%% and pattern . optionally add commands to +%% be executed after `\PatternCodes' in a local group. +%% It may be more safe to redefine `\PatternCodes' instead. +\newcommand*{\MakeSubstringConditional}{% + \afterassignment\mk_substr_cond_san \def\cond_id} +\newcommand*{\mk_substr_cond_san}[1][]{% + \begingroup \PatternCodes #1\mk_substr_cond} + %% #1 more changes +%% `\begingroup' |\mk_substr_cond{}| +%% can be directly called by other programmer setup commands when +%% `\cond_id' and have been read. +\def\mk_substr_cond #1{%% #1 pattern string + \endgroup \@namedef{\substr_cond \cond_id}##1#1##2&} +%% This really is not \LaTeX. We are starting defining a macro +%% `\substr_cond:' in primitive \TeX\ with `\def' in the form +%% \[`\def\substr_cond:#1#2&'\] +%% where `\csname' etc. render \lq`:'\rq\ part of the macro name. +%% The user or programmer macro produces the part of the definition +%% until the delimiter `&' to match the sandbox. You have to add +%% (maybe) #3 etc. and the `{}' +%% just as with primitive \TeX. +%% +%% === Set up sandboxes === +%% There was a \emph{question:} will we rather see +%% \emph{string macros} or \emph{strings from macro arguments}? +%% The input file content always comes +%% as `\fdInputLine' first, so we at least \emph{must account} for +%% the possibility of string macros as input. +%% +%% One easy way to apply several checks and substitutions to +%% `\fdInputLine' before the result is written to is +%% `\let\OutputString\fdInputLine' and then let `\OutputString' +%% be to what each job refers as \emph{its} +%% input and output, finally `\WriteResult{\OutputString}'. +%% (`\fdInputLine' might better not be touched, it could be used +%% for a final test whether any change applied for some message on +%% screen, even with an entirely expandable chain of actions.) +%% This way each job, indeed each recursive substitution of a single +%% string must start with expanding `\OutputString'. +%% +%% On the other hand, there is the idea of \emph{``expandable'' +%% chains of substitutions}. We may, e.g., define a macro, say, +%% `\manysubstitutions{}', such that +%% `\WriteResult{\manysubstitutions{\fdInputLine}}' +%% writes to the result of applying many expandable +%% substitutions to `\fdInputLine'. +%% Such a macro `\manysubstitutions' may read `\fdInputLine', +%% but it must not redefine any macros. +%% Instead, the substitution macros it calls must read results +%% of previous substitutions as \emph{arguments}. +%% +%% Another aspect: +%% the order of substitutions should be easy to +%% change. Therefore expanding of string macros should rather be +%% controlled by the way a job is \emph{called}, not right here +%% at the \emph{definition} of the job. For this reason, +%% a variant of the sandbox builder expanding some macro was given up. + +%% `setup_substr_cond' is the name space for macros that build +%% sandboxes and initialize arguments for conditional macros. +\def\setup_substr_cond{setup_substr_cond:} +%% |\MakeSetupSubstringCondition{}[]{}{}| +%% % <- TODO allow `%' and ` ' for breaking code lines. +%% ---same , , as for +%% `\MakeSubstringConditional' (this is bad, there may be +%% |\MakeSubstringConditional*{}|)---creates the +%% % <- TODO: store args in \Make...Conditional +%% corresponding sandbox, by default without tilde wrap. +%% may contain `{#1}' to store the string that was tested, +%% also `{}' for calling repetitions and `{}' for screen +%% or log informations. +\newcommand*{\MakeSetupSubstringCondition}{% + \afterassignment\mk_setup_substr_cond_san \def\cond_id} +\newcommand*{\mk_setup_substr_cond_san}[1][]{% + \begingroup \PatternCodes #1\mk_setup_substr_cond} +%% `\begingroup' |\mk_setup_substr_cond{}{}| +%% can be directly called by other programmer setup commands after +%% `\cond_id' and have been read: +\def\mk_setup_substr_cond #1#2{%% #1 pattern string, + %% #2 additional arguments, e.g., `{#1}' to keep tested string + \endgroup + \expandafter \edef + \csname \setup_substr_cond \cond_id \endcsname ##1{% +% \expandafter \noexpand +% \csname \substr_cond \cond_id \endcsname %% 2009/04/10: + \make_not_expanding_cs{\substr_cond \cond_id}% +%% By `\edef', the name of the substring conditional is stored here +%% as a single token. The rest of the sandbox follows. + ##1\noexpand~#1\dollar_tilde}% + \let\dollar_tilde\sandbox_dollar} +%% If a tilde `~' has been used instead of `$', the default +%% is restored. +\def\sandbox_dollar{$} +\let\dollar_tilde\sandbox_dollar +%% The following general tool |\make_not_expanding_cs| has been used +%% (many definitions in 'latex.ltx' could have used it): %% 2009/04/10 +\def\make_not_expanding_cs#1{% + \expandafter \noexpand \csname #1\endcsname} +%% +%% === Getting rid of the tildes === +%% |\let~\TildeGobbles| can be used to suppress dummy patterns +%% (contained in ) +%% in `\write'ing or with `\edef'. ... will probably become obsolete +%% ... however, it is helpful in that you needn't care +%% whether there is a dummy wrap left at all. (2009/04/13) +\newcommand{\TildeGobbles}{} \def\TildeGobbles#1${} +%% |\RemoveDummyPattern| is used to remove the dummy pattern +%% \emph{immediately}, not waiting for `\write'ing +%% or other ``total'' expansion: %% 2009/04/13 +\newcommand{\RemoveDummyPattern}{} \def\RemoveDummyPattern#1~#2${#1} +%% |\RemoveDummyPatternArg{}| executes +%% `\RemoveDummyPattern' in the next argument: +\newcommand*{\RemoveDummyPatternArg}[2]{% + \expandafter #1\expandafter {\RemoveDummyPattern #2}} +%% |\RemoveTilde| is used to remove the tilde that separated +%% the dummy pattern from . +% %% An alternative policy is to pass +% %% (as an argument) to the parsing macro. +\newcommand{\RemoveTilde}{} \def\RemoveTilde#1~{#1} +%% |\RemoveTildeArg{}| executes `\RemoveTilde' +%% in the next argument: +\newcommand*{\RemoveTildeArg}[2]{% + \expandafter #1\expandafter {\RemoveTilde #2}} +%% +%% === Calling conditionals === +%% |\ProcessStringWith{}{}| builds the sandbox +%% to search for the associated with the +%% parser-conditional that is identified by , the sandbox then +%% calls the parser. +\newcommand*{\ProcessStringWith}[2]{% + \csname \setup_substr_cond #2\endcsname{#1}} +%% |\ProcessExpandedWith{}{}| does the same but with +%% a \emph{macro} (like `\fdInputLine' or `\OutputString') in which +%% the string to be tested is stored. +\newcommand*{\ProcessExpandedWith}[2]{% + \csname \setup_substr_cond #2\expandafter \endcsname + \expandafter{#1}} +%% I would have preferred the reversed order of arguments which seems +%% to be more natural, but the present is more efficient. +%% Macros with reversed order are currently stored after `\endinput' +%% in section~\ref{sec:pondered}, may be they once return. +%% +%% Anyway, most desired will be |\ProcessInputWith{}| just +%% applying to `\fdInputLine': +\newcommand*{\ProcessInputWith}[1]{% + \csname \setup_substr_cond #1\expandafter \endcsname + \expandafter{\fdInputLine}} +%% (Definition almost copied for efficiency.) + %% TODO: error when undefined 2009/04/07 +%% +%% === Copy jobs === +%% A job identifier may also be considered a mere \emph{hook}, +%% a \emph{placeholder} for a parsing job. What function actually is +%% called may depend on conditions that change while reading the +%% file. %%% On a certain condition, +%% |\CopyFDconditionFromTo{}{}| +%% \emph{creates or redefines a sandbox builder} with identifier +%% that afterwards behaves like the sandbox builder . +%% So you can store a certain behaviour as in advance in order +%% once to change the behaviour of into that of . +\newcommand*{\CopyFDconditionFromTo}[2]{% + \expandafter \let + \csname \setup_substr_cond #2\expandafter \endcsname + \csname \setup_substr_cond #1\endcsname} +%% (Only the \emph{sandbox} is copied here---what about +%% changing conditionals?) %% TODO +%% +%% An ``almost'' example is typesetting documentation from a package +%% file where the ``Legalese'' header might be typeset verbatim +%% although it is marked as ``comment.'' (The present %% 2009/04/07 +%% example changes ``hand-made'' macros instead.) +%% +%% This feature could have been placed more below as a ``programming +%% tool.'' +%% +%% == Programming tools == +%% === Tails of conditionals === +%% \label{sec:tails} +%% When creating complex \emph{expandable} conditionals, +%% this may amount to have primitive `\if' ... `\fi' conditionals +%% nested quite deeply, once perhaps too deep for \TeX's memory. +%% To avoid this, you can apply the common `\expandafter' trick +%% which finishes the current `\if' ... `\fi' before an inside +%% macro is executed (cf. \TeX book p.~219 on ``tail recursion''). +%% +%% Internally tests whether certain strings are present at certain +%% places will be carried out by tests on emptiness or +%% onwards) on starting with `~'. E.g., +%% ``#1~=~ empty'' indicates that either the +%% starts a line or the line is empty altogether (this must be +%% decided by another test). +%% +%% |\IfFDempty{}{}{}| +%% is used to test on emptyness (without expanding it): +\newcommand*{\IfFDempty}[1]{% + \ifx$#1$\expandafter \@firstoftwo \else + \expandafter \@secondoftwo \fi} +%% |\IfFDinputEmpty{}{}| is a variant of +%% the previous to execute if the loop processing +%% finds an empty line---otherwise . +\newcommand*{\IfFDinputEmpty}{% + \ifx\fdInputLine\@empty \expandafter \@firstoftwo \else + \expandafter \@secondoftwo \fi} +%% |\IfFDdollar{}{}{}| +%% is another variant, testing for being `$', +%% main indicator of there is a match anywhere in +%% (as opposed to starting or ending match): +\newcommand*{\IfFDdollar}[1]{% + \ifx$#1\expandafter \@firstoftwo \else + \expandafter \@secondoftwo \fi} +%% It is exemplified and explained in section~\ref{sec:replchain}. +%% (The whole policy requires that `~' remains active in any +%% testing macros here!) +%% +%% However, you might always just type the replacement text +%% (in one line) instead of +%% such an `\If'\,... (for efficiency \dots) +%% +%% If expandability is not desired, you can just chain macros that +%% rework (so re-define) `\OutputString' or so. +%% +%% 2009/04/11: tending towards combining ... +%% Keeping empty input and empty arguments apart is useful in that +%% \emph{one} test of emptiness per input line should suffice---it +%% may be left open whether this should be the first of all tests +%% \dots +%% +%% === Line counter === +%% A \LaTeX\ counter |fdInputLine| may be useful for screen or log +%% messages, moreover you can use it to control processing of the +%% file ``from outside,'' not dependent on what the parsing +%% macros find. The header of the file might be typeset verbatim, +%% but we may be too lazy to define the ``header'' in terms of +%% what is in the file. We just decide that the first ... lines +%% are the ``header,'' even without counting just trying whether +%% the output is fine. It may be necessary to change that number +%% manually when the header changes. +%% +%% You also can insert lines in +%% which have no counterpart in ---if you know what you are +%% doing. With 'makedoc', there is a hook `\EveryComment' that can +%% be used to issue commands ``from outside'' at a place where +%% executing the command is safe or appropriate. +\newcounter{fdInputLine} +%% You then must insert |\CountInputLines| in the second argument +%% of `\ProcessFileWith' (or in a macro called from there) +%% so that the counter is stepped. %% TODO!? 2009/04/07 +\newcommand*{\CountInputLines}{\global\advance\c@fdInputLine\@ne} +%% At present %% 2009/04/07 TODO +%% the counter is reset by `\ProcessFileWith', this may change. +%% +%% |\IfInputLine{}{}{}|, when called +%% from the processing loop (second argument of `\ProcessFileWith') +%% issues commands if `\value{fdInputLine}' +%% is true, otherwise . may usually be just `='. +\newcommand*{\IfInputLine}[1]{% + \ifnum\c@fdInputLine#1\relax \expandafter \@firstoftwo + \else \expandafter \@secondoftwo \fi} +%% +%% === The ``identity job'' `LEAVE' === +%% \label{sec:LEAVE} +%% The job with identifier |LEAVE| +%% \emph{leaves} an (expandable) chain of jobs +%% (as expandable replacement in section~\ref{sec:replchain}) +%% and \emph{leaves} the processed string without changing it +%% and without the braces enclosing it: +\expandafter \let + \csname \setup_substr_cond LEAVE\endcsname \@firstofone +%% I.e., `\ProcessStringWith{}{LEAVE}' expands to +%% ... \ProcessStringWith{(Indeed!)}{LEAVE} + +%% == Setup for expandable chains of replacements == +%% \label{sec:replchain}%% TODO makedoc: provide less visible label/ref 2009/04/11 +%% By the following means, you can create macros +%% (`\Transform' among them) such that, e.g., +%% \[`\edef\OutputString{\Transform{}}'\] renders `\OutputString' +%% the result of applying a chain (sequence) of stringwise replacements +%% to . +%% You can even write a transformed input to a file +%% without defining anything anything after `\read to'\,.\,.\,. +%% In this case however, you don't get any statistical message +%% about what happened or not. With `\edef\OutputString' you can at +%% least issue some `changed!' or `left!' (maybe `\message{!}' vs.\ +%% `\message{.}'). +%% There is an application in 'makedoc' for ``typographical upgrading'' +%% from plain text to \TeX\ input. +%% +%% |\repl_all_chain_expandable| will be the backbone of the +%% replacements. It is called by some parsing macro +%% and receives from the latter ~=~#1 and ~=~#2. +%% #3 is the result of what happened so far. +\def\repl_all_chain_expandable#1#2#3#4#5#6{% + %% #1, #2 splits, #3 past, #4 substitute, + %% #5 repeat parser, #6 pass to +% \ifx~#2\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi +%% The previous line would be somewhat faster, but let us exemplify +%% `\IfFDdollar' from section~\ref{sec:tails} instead: + \IfFDdollar{#2}% +%% If #2 starts with `$'---with category code 3, ``math shift''!, +%% it \emph{is} `$', due to not reading `$' +%% from input with its standard category code 3 +%% and the sandbox construction (where `$' appears with its standard +%% category code). %% TODO might be explained earlier 2009/04/11 +%% %% or refer to here. +%% And this is the case \emph{exactly} when the from +%% didn't match, again due to the input category codes. +%% Now on \emph{no} match, the sandbox builder #6 is called +%% with target string #3#1 where the last tested string is attached +%% to previous results. The ending `~' is removed, #6 inserts a new +%% wrap for the new dummy pattern. + {\RemoveTildeArg #6{#3#1}}% +%% Otherwise ... the \emph{sandbox builder} +%% (that will be shown below) that called +%% initialized #5 to be that itself. ( otherwise +%% wouldn't know who it is.) So calls itself with another sandbox +%% `#2&'. Note that #2 contains \lq`~$'\rq\ due to the initial +%% building. + {#5#2&{#3#1#4}{#4}#5#6}} +%% #4 is the replacement string that passed to . +%% The first argument after the `&' is previous stuff plus +%% the recently skipped +%% plus #4 replacing the string that was matched. +%% +%% Finally, #5 and #6 again ``recall'' and the sandbox +%% builder to which to change in case of no other match. +%% +%% % TODO move following up!? 2009/04/11 +%% |\MakeExpandableAllReplacer{}{}{}{}| +%% creates sandbox and parser with common identifier and search +%% pattern . Each occurrence of will be replaced by +%% . When is not found, the sandbox builder for +%% is called. This may be another replacing macro of the +%% same kind. To return the result without further transformations, +%% call job `LEAVE' (section~\ref{sec:LEAVE}). +\newcommand*{\MakeExpandableAllReplacer}{% + \afterassignment\mk_setup_xpdbl_all_repl_san + \def\cond_id} +%% ... usual intermezzo for reading patterns with non-standard +%% category codes, this time we read \emph{two} patterns \dots +\newcommand*{\mk_setup_xpdbl_all_repl_san}[1][]{% + \begingroup \PatternCodes #1\mk_setup_xpdbl_all_repl} +%% Here comes the real work. +\newcommand*{\mk_setup_xpdbl_all_repl}[3]{% + %% #1 pattern, #2 substitute, #3 pass to + \endgroup +%% We take pains to call next jobs by single +%% command strings and store them this way, not by `\csname', +%% as `\ProcessStringWith' would do it. `\edef\@tempa' +%% is used for this purpose, but \dots + \edef\@tempa{% + \noexpand\mk_setup_substr_cond{#1}{% + {}{#2}% + \noexpand\noexpand +%% That `\edef\@tempa' must \emph{not expand} the controll +%% words after they have been computed from `\csname' etc. +%% Moreover, expansion of the parser commands +%% must be avoided another time, when `\@tempa' is executed. + \make_not_expanding_cs{\substr_cond\cond_id}% + \noexpand\noexpand + \make_not_expanding_cs{\setup_substr_cond #3}}}% +%% Those internal setup commands start with `\endgroup' to switch back +%% to standard category codes. We must match them here by +%% `\begingroup'. + \begingroup \@tempa + \begingroup \mk_substr_cond{#1}{% + \repl_all_chain_expandable{##1}{##2}}} +%% The final command is the one that we explained first. %% TODO 2009/04/11 +%% +%% Support for dozens of replacements in one sequence +%% and for screen messages +%% must wait for another release, sorry! %% TODO 2009/04/11 +%% +%% == Leave package mode == +%% We restore the underscore `_' for math subscripts. +%% (This might better depend on something \dots) %% TODO 2009/04/07 +\catcode`\_=8 %% restores underscore use for subscripts + +\endinput +%% \TeX\ ignores the rest of the file when it is \emph{input} +%% ``in the sense of `\input''', as opposed to just reading +%% the file line by line to a macro like `\fdInputLine'. +%% +%% == Pondered == +%% \label{sec:pondered} + %% TODO abbreviated commands (aliases) \MkSubstrCond... + %% TODO \@onlypreamble!? +\newcommand*{\ApplySubstringConditional}[1]{% + %% #1 identifier; text to be searched expected next + \csname setup_substr_cond:#1\endcsname} +\newcommand*{\ApplySubstringConditionalToExpanded}[1]{% 2009/03/31+ + \csname setup_substr_cond:#1\expandafter \endcsname \expandafter} +\newcommand*{\ApplySubstringConditionalToInputString}[1]{% 2009/03/31+ + \csname setup_substr_cond:#1\expandafter \endcsname + \expandafter {\fdInputLine}} + %% TODO or `\OutputString', even `\read' to `\OutputString'!? +% \newcommand*{\ApplySubstringConditionalToExpanded}[2]{% +% %% note: without assignments, robust! +% %% BUT the `\csname ... \expandafter \endcsname' method is faster +% \expandafter \reversed_apply_substr_cond +% \expandafter {#2}{#1}} +% \newcommand*{\reversed_apply_substr_cond}[2]{% +% \ApplySubstringConditional{#2}{#1}} + %% ODER: +% \newcommand*{\expand_attach_arg}[2]{%% 2009/03/31 +% %% #1 command with previous args, TODO cf. LaTeX3 +% \expandafter \attach_arg \expandafter {#1}{#2}} +% %% actually #1 may contain more than one token, +% %% only first expanded +% \newcommand*{\attach_arg}[2]{#2{#1}} +% \newcommand*{\ApplySubstringConditionalToExpanded}[2]{% +% \expandafter \attach_arg \expandafter +% {#2}{\ApplySubstringConditional{#1}}} +%% +%% +%% +%% == VERSION HISTORY == +%% +v0.1 2009/04/03 very first version, tested on morgan.sty +v0.2 2009/04/05 counter fdInputLine, \ProvidesFile moved from + \ProcessFile to \ResultFile, \CopyFD..., + category section first, more sectioning, + suppressing empty code lines before section + titles; discussion, \Delimiters + 2009/04/06 more discussion + 2009/04/07 more discussion, factored \WriteProvides out from + \ResultFile, \ProcessExpandedWith corrected + 2009/04/08 \InputString -> \fdInputline; + removed \ignorespaces + 2009/04/09 \WhenInputLine[2] -> \IfInputline[3], + \ProcessInputWith, typos, + \WriteProvides message `with' + 2009/04/10 \make_not_expanding_cs + DISCOVERED ``IF SUBSTRING'' ALGORITHM WRONG + ( in ) +v0.3 2009/04/11 SOME THINGS GIVEN UP EARLIER WILL BE REMOVED, + TO BE STORED IN THE COPY AS OF 2009/04/10 + mainly: sandbox setup (tilde/dollar) + REAL ADDITION: setup for expandable replacing + 2009/04/12 played with `chain' vs. `sequence'; + plain `...', `cf.', `etc.' for `mdcorr.cfg' + 2009/04/13 \RemoveTilde... + 2009/04/15 reworked text, same mistake \in@ diff --git a/Master/texmf-dist/tex/latex/nicetext/makedoc.sty b/Master/texmf-dist/tex/latex/nicetext/makedoc.sty new file mode 100644 index 00000000000..7fb78c662a1 --- /dev/null +++ b/Master/texmf-dist/tex/latex/nicetext/makedoc.sty @@ -0,0 +1,367 @@ +%% Macro package `makedoc.sty' for LaTeX2e, +%% copyright (C) 2009 Uwe L\"uck, +%% http://www.contact-ednotes.sty.de.vu +%% -- author-maintained in the sense of LPPL below -- +%% for preparing documentations from packages. + +\def\fileversion{0.2} \def\filedate{2009/04/13} + +%% This file can be redistributed and/or modified under +%% the terms of the LaTeX Project Public License; either +%% version 1.3a of the License, or any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% We did our best to help you, but there is NO WARRANTY. +%% +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +% 1994/12/01: \newcommand* etc. +\ProvidesPackage{makedoc}[\filedate\space v\fileversion\space + TeX input from *.sty (UL)] +%% +%% |\PackageCodeTrue| and |\PackageCodeFalse| set `\ifPackageCode' +%% globally, so redefinition of `~' may be kept local. Note the +%% capital `T' and `F'! +\newcommand*{\PackageCodeTrue} {\global\let\ifPackageCode\iftrue} +\newcommand*{\PackageCodeFalse}{\global\let\ifPackageCode\iffalse} +%% |\ifPackageCode| is used to determine whether a listing environment +%% must be `\beg'un or `\end'ed. You may also want to suppress empty +%% code lines, while empty lines should issue a `\par' break in +%% ``comment'' mode. +%% +%% Since `\newif' is not used, `\ifPackageCode' must be declared +%% explicitly. Declaration of new `\if's must be early in case +%% they occur in code that is skipped by another `\if'\dots +\PackageCodeFalse +%% +%% 'makedoc' is an extension of 'fifinddo' on which it depends. +\RequirePackage{fifinddo}[2009/04/13] +%% Both 'fifinddo' and 'makedoc' use the ``underscore'' as ``private +%% letter'' and make it ``other'' at their end (functionality as with +%% ``at'' and `\RequirePackage' is missing here). So after loading +%% 'fifinddo', I must restore the new private letter. +\catcode`\_=11 %% underscore used in control words +%% +%% \subsection{&\MakeDocCorrectHook} +%% |\MakeDocCorrectHook| is predefined to leave its argument without +%% the enclosing braces, otherwise unchanged: +\let\MakeDocCorrectHook\@firstofone +%% Less efficiently, the same could have been set up as +% \newcommand*{\MakeDocCorrectHook}[1]{\ProcessStringWith{#1}{LEAVE}} +%% according to 'fifinddo'. +%% +%% It may be \emph{redefined} in a \emph{configuration} file like +%% 'makedoc.cfg' or the 'makedoc' script file applying to a single +%% package file in order to, e.g., converting plain text to \TeX\ input +%% conforming to typographical conventions, making `$\dots$' from +%% `...', e.g. +%% Replace `LEAVE' in the previous suggestion by an identifier +%% whose job you have defined before, and use `\renewcommand' +%% in place of `\newcommand'. +%% See an example in 'makedoc.cfg'. +%% +%% You can \emph{test} your own `\MakeDocCorrectHook' by +%% \[`\typeout{\MakeDocCorrectHook{}}'\] +%% ... provided (sometimes) `\MakeOther\ ' ... +%% You can even change it using `\IfInputLine' from 'fifinddo' in the +%% midst of preprocessing a package documentation. +%% +%% \subsection{Distinguish package code from comments}%% <- wiki style breaks in self-doc. +%% Use of comment marks is a matter of personal style. Only lines +%% starting with the sequence `%% ' are typeset in \TeX\ quality +%% under the present release. Lines just containing `%%' +%% (without the space) are used to suppress empty code lines +%% preceding section titles (while keeping some visual space +%% in the package file). There is a preferable way to do this, +%% however not in the present release \dots +%% +%% The parsing macros must be set up reading `%' and ` ' as ``other'' +%% characters. Using the optional arguments for this creates +%% difficulties that can be somewhat avoided by redefining +%% |\PatternCodes|. +\renewcommand*{\PatternCodes}{\MakeOther\%\MakeOther\ }%% 2009/04/02 +%% Look here: the line became too long and could not be broken. +%% Must we really introduce new comment marks? +% \MakeSetupSubstringCondition{comment}[\MakeOther\%\MakeOther\ ] +%% The next line sets the ``sandbox'' for the detecting macro, as it +%% is coined in the documentation of 'fifinddo', with ``identifier'' +%% |PPScomment|. +\MakeSetupSubstringCondition{PPScomment}{%% }{{#1}} +%% The last argument stores the expanded input line for reference by +%% macros called. The next line is a test whether the setup works. +% \expandafter \show \csname \setup_substr_cond PPScomment\endcsname +%% Here comes the definition of the corresponding testing macro. +%% #3 is the expanded input line from above. The `\If'\dots commands, +%% `\fdInputLine', `\fdInputLine', and `\RemoveDummyPatternArg' +%% are from 'fifinddo'. +% \MakeSubstringConditional{comment}[\MakeOther\%\MakeOther\ ] +\MakeSubstringConditional{PPScomment}{%% }#3{%% #3 entire test string + \IfFDinputEmpty{\OnEmptyInputLine}{% +%% The empty line test comes early to offer control with +%% `\OnEmptyInputLine' both code and comment mode. +%% Maybe it should always? %% TODO 2009/04/13 + \IfFDempty{#1}%% + {\TreatAsComment{% + \RemoveDummyPatternArg\MakeDocCorrectHook{#2}}}% + {\ifx\fdInputLine\PPstring + \ifPackageCode\else \WriteResult{}\fi%% 2009/04/05 + %% <- allow paragraphs in comments + \else \TreatAsCode{#3}\fi}}} +% \expandafter \show \csname \substr_cond PPScomment\endcsname +%% |\PPstring| stores the line suppressing empty code lines. +\newcommand*{\PPstring}{} \xdef\PPstring{\PercentChar\PercentChar} +%% |comment| will be a ``generic'' identifier to call a comment line +%% detector. It might be predefined to issue an ``undifined'' error; +%% however this release predefines it to behave like `PPScomment'. +\CopyFDconditionFromTo{PPScomment}{comment} +%% Alternative still to be considered: +% \@namedef{\setup_substr_cond comment}{% +% \PackageError{makedoc}{Job `comment' not defined}% +% {Use \string\CopyFDconditionFromTo{comment}}} +%% +%% \subsection{Dealing with comments} +%% |\TreatAsComment{}| writes to the documentation +%% file. If we had ``package code'' (were in ``code mode'') so far, +%% the listing environment is ended first. +\newcommand*{\TreatAsComment}[1]{% + \ifPackageCode + \WriteResult{\string\end{packagecode\@empty}}% +%% The `\@empty' here is a lazy trick to save self-documentation +%% fighting 'verbatim''s ``highlight'' of finding ends of listings +%% (to be improved). %% +%% +%% We always use `\string' to prevent macro expansion in `\write'ing +%% in place of \LaTeX's `\protect', +%% as long as 'fifinddo' simply uses the primitive `\write' in place +%% of \LaTeX's `\proteced@write' \dots %% todo 2009/04/08 + \PackageCodeFalse + \EveryComment +% \_empty_code_lines_false + \fi + \WriteResult{#1}} +%% Here, |\EveryComment| is a macro hook for inserting material that should +%% not appear in a listing environment. +\global\let\EveryComment\relax %% should be changed globally. +%% +%% \subsection{Sectioning} +%% \label{sec:secparsers} +%% We provide a facility from 'wiki.sty' that imitates the sectioning +%% syntax used in editing \emph{Wikipedia} pages, in a different +%% implementation (better compatibility) and in a more general way. +%% On Wikipedia, `== Definition ==' works similar as +%% `\section{Definition}' does with \LaTeX. With the present +%% implementation, you can type, e.g., +%% \[`%%%%%%%%%%%%%%%%%%%%%% == Definition == %%%%%%%%%%%%%%%%%%%%%%'\] +%% to get a similar result. The number of `%' characters doesn't +%% matter, and there can be other stuff, however: additional `=' +%% symbols may harm. Three sectioning levels are supported, through +%% `====', `======', and `========' (deepest). +%% +%% There are three detector macros made for programmers. +%% The most general one is +%% In the following definitions, there is a single tilde to prevent +%% `=' symbols being gobbled by the test (realized by accident). +%% %% 2009/04/13 +%% |\SectionLevelThreeParseInput|: +\newcommand*{\SectionLevelThreeParseInput}{% + \expandafter \test_sec_level_iii \fdInputLine ~========&} +%% |\SectionLevelTwoParseInput| +\newcommand*{\SectionLevelTwoParseInput}{% + \expandafter \test_sec_level_ii \fdInputLine ~======&} +%% and |\SectionLevelOneParseInput| +\newcommand*{\SectionLevelOneParseInput}{% + \expandafter \test_sec_level_i \fdInputLine ~====&} +%% allow skipping deeper levels for efficiency. +%% % TODO in fifinddo: setup for 2 strings in 1 line 2009/04/13 +%% +%% In the terminology of the 'fifinddo' documentation, the previous +%% three commands are ``sandbox builders.'' The following three +%% commands are the corresponding ``substring conditionals.'' +%% However, 'fifinddo' so far %% todo 2009/04/08 +%% only deals with \emph{single} substrings, while here we are +%% dealing with \emph{pairs} of substrings. We are not using +%% general setup macros, but define the parsing macros ``manually,'' +%% as it is typical in many other macros in 'latex.ltx' and other +%% \LaTeX\ packages. You can fool our macros easily, there is +%% no syntax check. %% todo 2009/04/08 +\def\test_sec_level_iii#1====#2====#3&{% + \IfFDempty{#2}% + {\test_sec_level_ii #1======&}% + {\WriteSection\mdSectionLevelThree{#2}}} +\def\test_sec_level_ii#1===#2===#3&{% + \IfFDempty{#2}% + {\test_sec_level_i #1====&}% + {\WriteSection\mdSectionLevelTwo{#2}}} +\def\test_sec_level_i#1==#2==#3&{% + \IfFDempty{#2}% + {\RemoveTildeArg \ProcessStringWith{#1}{comment}}% + {\WriteSection\mdSectionLevelOne{#2}}} +%% `\ProcessStringWith' here passes the expanded `\fdInputLine' +%% to the general comment detector. +%% +%% |\WriteSection{}{}| replaces an input line +%% with a line \[`{\hspace{1sp}\ignorespaces \unskip }'\] +%% in the documentation file and switches into ``comment mode.'' +%% `\hspace{1sp}' ensures that 'niceverb''s package name feature works. +%% `\ignorespaces' and `\unskip' undo the spaces between title text and +%% the `=' symbols that usually are typed for readability. +\newcommand*{\WriteSection}[2]{% + \TreatAsComment{% + ^^J#1{\string\hspace{1sp}\ignorespaces + \MakeDocCorrectHook{#2}\unskip}^^J}} +%% We insert `\section' using |\mdSectionLevelOne| etc.\ +%% which the programmer can redefine, e.g., when the +%% documentation is part of a `\section' (or even deeper) +%% according to the ``documentation driver'' file. +\newcommand*\mdSectionLevelOne {\string\section} +\newcommand*\mdSectionLevelTwo {\string\subsection} +\newcommand*\mdSectionLevelThree{\string\subsubsection} +%% +%% This sectioning feature is not used in 'makedoc.sty' since the +%% \emph{definitions} of the parsing macros fool the same macros \dots +%% +%% \subsection{Commented code} +%% |\TreatAsCode{}| is the opposite to `\TreatAsComment{}': +\newcommand*{\TreatAsCode}[1]{% + \ifPackageCode +% \_empty_code_lines_true + \else + \WriteResult{\string\begin{packagecode}}% + \PackageCodeTrue + \fi + \WriteResult{#1}% +% \WriteResult{\maybe_result_empty_line #1}% +% \let\maybe_result_empty_line\empty +} +%% +%% \subsection{Dealing with empty input lines} +%% |\OnEmptyInputLine| is a default setting (or hook) for what to do +%% with empty lines in the input file. The default is to insert an +%% empty line in the output file: +\newcommand*{\OnEmptyInputLine}{\WriteResult{}} +%% |\NoEmptyCodeLines| changes the setting to suppressing empty code +%% lines, while in ``comment mode'' an empty input line \emph{does} +%% insert an empty line, for starting a new paragraph: +\newcommand*{\NoEmptyCodeLines}{%% suppress empty code lines + \renewcommand*{\OnEmptyInputLine}{% + \ifPackageCode \else \WriteResult{}\fi}} +%% There is a better policy---didn't work so far \dots +%% +%% \subsection{Bundling typical things: script commands} +%% \label{sec:script} +%% First practical experiences suggest the following shorthands. +%% They should simplify matters so much that the 'makedoc' script +%% for a single package really should need about five lines only, +%% %% <- TODO check 2009/04/08 +%% and even \emph{they} should be so simple that you should hardly +%% spend a minute about them. +%% +%% |\LaTeXresultFile{}| saves you the extra line for inserting +%% the `\ProvidesFile' line ... no, actually it is 'makedoc' +%% that wants to be mentioned with `\ProvidesFile' ... +%% (otherwise copied from 'fifinddo') \dots +\newcommand*{\LaTeXresultFile}[1]{% + \ResultFile{#1}%%% \WriteProvides} + \WriteResult{% + \string\ProvidesFile{\result_file_name}% + [\the\year/\two@digits\month/\two@digits\day\space + automatically generated with makedoc.sty]}}% +%% |\MakeDoc{}| preprocesses to render input for +%% \LaTeX, considering what is typical for a \LaTeX\ package as the +%% one here: +\newcommand*{\MakeDoc}[1]{% +%% In case of a ``header'' (see below) we change into ``code mode'': + \ifnum\header_lines>\z@ + \WriteResult{\string\begin{packagecode}}% + \PackageCodeTrue %% TODO both lines makedoc command!? + %% 2009/04/08 + \else \PackageCodeFalse \fi +%% The loop follows. There is a placeholder `\makd_doc_line_body' +%% that is predefined below and can be changed while processing the +%% file. + \ProcessFileWith{#1}{% + \CountInputLines %% stepping line counter is standard + \make_doc_line_body + \process_line_message}% +%% Currently the ``VERSION HISTORY'' is typeset verbatim +%% (for ``tabbing''), we then must leave ``code mode'' here: + \ifPackageCode + \WriteResult{\string\end{packagecode\@empty}}%% self-doc-trick + \PackageCodeFalse %% TODO both lines makedoc command!? 2009/04/08 + \fi +%% When the file has been processed, certain default settings +%% might be restored---in case another file is processed for the +%% same documentation document: +% \HeaderLines{0}% +% \MainDocParser{\SectionLevelThreeParseInput}%% TODO!? 2009/04/08 +} +%% \subsubsection{File preamble} +%% A \LaTeX\ package typically has a ``header'' or ``preamble'' +%% (automatically inserted by 'docstrip') with very scarce information +%% on which file it is and what it provides, and with much more Legalese. +%% Typesetting it in \TeX\ quality may be more misleading than +%% typesetting it \emph{verbatim}. So we typeset it \emph{verbatim}. +%% Now: where does the ``header'' end? +%% `\NeedsTeXFormat' might be considered the border.---Yet it seems +%% to be more simple and reliable just to act in terms of the +%% \emph{number of lines} +%% that the header should be long. This length is declared by +%% |\HeaderLines{}|: +\newcommand*{\HeaderLines}{\def\header_lines} +\HeaderLines{0} +%% So the default is that there aren't any header lines, unless +%% another `\HeaderLines' is issued before some `\MakeDoc'. +%% The way input is parsed after the ``header'' is set by +%% |\MainDocParser{}|. +\newcommand*{\MainDocParser}{\def\main_doc_parser} +%% `\SectionLevelThreeParseInput' from section~\ref{sec:secparsers} +%% is the default, two alternatives are defined there, another one is +%% `\ProcessInputWith{comment}' from 'fifinddo'. +\MainDocParser{\SectionLevelThreeParseInput} +%% Here is how `\HeaderLines' and `\MainDocParser' act: +\def\make_doc_line_body{% + \IfInputLine{>\header_lines}% + {\let\make_doc_line_body\main_doc_parser + \make_doc_line_body}% %% switch to deciding + {\TreatAsCode{\fdInputLine}}} %% header verbatim +%% |\ProcessLineMessage{}| is designed to define a screen +%% (or log) message . +%% % A simple setting may be \[`\ProcessLineMessage{\message{.}}'\] with +%% `\ProcessLineMessage{\message{.}}' has a result like with 'docstrip'. +%% You just get one dot on screen per input line +%% as a simple confirmation that +%% the program is not hung up. %% TODO phrase!? 2009/04/08 +%% However, the message may slow down a run considerably +%% (if so, choose `\ProcessLineMessage{}' in the script). +%% % , you really have to +%% % wait about a second while you hardly notice the 'makedoc' run +%% % without screen messages. Therefore, the default is \emph{not} +%% % to issue any screen message.%% TODO more complex procedures!? 2009/04/08 +%% %---No! +%% But it is better for beginner users of the package, +%% so made default. %% 2009/04/09 +\newcommand*{\ProcessLineMessage}{\def\process_line_message} +% % \ProcessLineMessage{} %% no, still more efficient: +% \let\process_line_message\relax +\ProcessLineMessage{\message{.}} +%% +%% \subsection{Leave the package} +\catcode`\_=8 %% restores underscore use for subscripts + +\endinput +%% +%% \subsection{VERSION HISTORY} + +v0.1 2009/04/03 very first version, tested on morgan.sty +v0.2 2009/04/05 \OnEmptyInputLine, \NoEmptyCodeLines + comment -> PPScomment, \IfFDinputEmpty, + \EveryComment, \PPstring may be par break + 2009/04/08 \InputString -> \fdInputLine, + \section -> \subsection; documentation! + 2009/04/08f. \MakeDoc + 2009/04/12 ``line too long'' w/o redefining \PatternCodes; + \MakeDocCorrectHook + 2009/04/13 tilde with sectioning diff --git a/Master/texmf-dist/tex/latex/nicetext/niceverb.sty b/Master/texmf-dist/tex/latex/nicetext/niceverb.sty index c82ae3deaa0..4ea1d7fda1d 100644 --- a/Master/texmf-dist/tex/latex/nicetext/niceverb.sty +++ b/Master/texmf-dist/tex/latex/nicetext/niceverb.sty @@ -1,5 +1,5 @@ \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{niceverb}[2009/02/21 +\ProvidesPackage{niceverb}[2009/04/15 v0.2 minimize \string\verb\space code (UL)] %% Copyright (C) 2009 Uwe Lueck, @@ -32,23 +32,29 @@ \MakeLetter\_ -\newcommand*{\make_iii_other}{\MakeOther\\\MakeOther\{\MakeOther\}} - -%% === Parsimonious version of &\verb === +% \newcommand*{\make_iii_other}{\MakeOther\\\MakeOther\{\MakeOther\}} + %% <- replaced 2009/04/05 +%% === Sloppy variant of &\verb === \newcommand*{\begin_min_verb}{% \relax \ifmmode \hbox \else \leavevmode\null \fi - %% standard, for $$...$$ + %% <- standard, for $$...$$ \bgroup \tt %%%\let\do\MakeOther \dospecials \MakeLetter\_\MakeLetter\@} \newcommand*{\SimpleVerb}[1]{% - %% mainly avoid \verb's noligs list which overrides definitions - %% of some active characters, while cmtt doesn't have any - %% ligatures anyway. +%% Mainly avoid `\verb''s noligs list which overrides definitions +%% of some active characters, while 'cmtt' doesn't have any +%% ligatures anyway. \ifx\protect\@typeset@protect - \begin_min_verb \make_iii_other \MakeActiveLet#1\egroup + \begin_min_verb %%%\make_iii_other %% much usual 2009/04/05 + \let\do\MakeOther \dospecials %% 2009/04/06 + \MakeOther\|%% probably 'niceverb' + \MakeActiveLet#1\niceverb_egroup %% 2009/04/11 + \verb@eol@error %% TODO change message 2009/04/09 \else \string\SimpleVerb \string#1\fi} - -%% === Single quotes make code === +%% 2009/04/11: about `etc.' +\newcommand*{\niceverb_egroup}{\egroup\ifmmode\else\@\fi} +%% +%% === Single quotes typeset meta-code === \newcommand*{\lq_verb}{% \ifx\protect\@typeset@protect \expandafter \lq_double_test @@ -57,7 +63,7 @@ % \expandafter\expandafter\expandafter % \protect_corresp_quotes % \else -% \RqVerb +% \rq_verb % \fi % \fi} \newcommand*{\lq_double_test}{% @@ -69,21 +75,21 @@ \ifx\let_token\lq_verb \endgroup \lq\lq \expandafter \@gobble - %% corresponding right quotes will become ``other'' due to - %% having no space at the left. TODO to be changed with - %% wiki.sty +%% Corresponding right quotes will become ``other'' due to +%% having no space at the left. + %%TODO to be changed with 'wiki.sty'. \else \endgroup % \expandafter \rq_verb \expandafter \SimpleVerb \expandafter \'% \fi} % \newcommand*{\rq_verb}{\SimpleVerb\'} -% \AtBeginDocument{\MakeActiveLet\`\RqVerb} +% \AtBeginDocument{\MakeActiveLet\`\rq_verb} \AtBeginDocument{\MakeActiveLet\`\lq_verb} %% Strings referred to will be code %% TODO to be changed with wiki.sty - -%% === Single mark for reference to commands === +%% +%% === Ampersand typesets meta-code === \newcommand*{\CmdSyntaxVerb}{% \ifx\protect\@typeset@protect \expandafter \cmd_syntax_verb @@ -118,11 +124,8 @@ \def\braces_verb#1{\string{#1\string}\test_more_verb} \def\brackets_verb[#1]{[#1]\test_more_verb} \def\star_verb*{*\test_more_verb} - - -\makeatletter - -%% === Escape makes meta-code === +%% +%% === Escape character typesets meta-code === \DeclareRobustCommand*{\BuildCsSyntax}{% \futurelet\let_token \build_cs_syntax_sp} \newcommand*{\build_cs_syntax_sp}{% @@ -161,50 +164,76 @@ \newcommand*{\EndAutoCmdSyntaxVerb}{\CatCode\\\z@} \newcommand*{\NormalCommand}{} \let\NormalCommand\@nameuse -%% Were tests: + %% Were tests: % \futurelet\LetToken\relax \relax % \show\LetToken \typeout{\ifcat\noexpand\LetToken aa\else x\fi} \newcommand*{\niceverbNoVerbList}{% \begin\end\item\verb\EndAutoCmdSyntaxVerb\NormalCommand - \section\subsection}%% TODO!? - + \section\subsection\subsubsection}%% TODO!? +\providecommand*{\AddToMacro}[1]{% + \expandafter \def \expandafter #1\expandafter} +%% %% === Meta-variables === \def\niceverb_meta#1>{% \mbox{\normalfont\itshape $\langle$#1\/$\rangle$}} %% TODO offer without angles as well \AtBeginDocument{\MakeActiveLet\<\niceverb_meta} %% difference to ltxguide.cls: also outside verbatim - -%% === Hash mark must be code === +%% +%% === Hash mark is code === \newcommand*{\param_verb}[1]{{\tt\##1}} \AtBeginDocument{\MakeActiveLet\#\param_verb} - -%% === Single right quote for &\sf === -%% TODO fails in parentheses due to preserving apostrophes +%% +%% === Single right quote for &\textsf === \newcommand*{\niceverb_rq_sf}{% +% \relax %% in case of \hskip1sp 2009/04/08 + %% but spoils ligature 2009/04/09 \ifx\protect\@typeset@protect \expandafter \niceverb_rq_sf_test \else \rq \fi} - %% introduced another macro just to avoid more sequences - %% of \expandafter ... +%% Another macro just to avoid more sequences of `\expandafter': \newcommand*{\niceverb_rq_sf_test}{% - \ifhmode \ifdim\lastskip>\z@ - \expandafter\expandafter\expandafter \niceverb_rq_sf_exec - %% TODO but after `('!? make \( active, also for \after_cs!? - \else \rq \fi + \ifhmode + \ifdim\lastskip>\z@ + \expandafter\expandafter\expandafter \niceverb_rq_sf_exec + \else + \ifnum\spacefactor=1001 %% in parentheses 2009/04/10 + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter + \niceverb_rq_sf_exec + \else \rq \fi +% \rq + \fi \else \ifvmode \expandafter\expandafter\expandafter \niceverb_rq_sf_exec \else \rq \fi \fi} +\sfcode`\(=1001 %% enable in parentheses 2009/04/10 {\CatCode\'\active \gdef\niceverb_rq_sf_exec#1'{\textsf{#1}}} -%% TODO to be changed with wiki.sty: + %% TODO to be changed with wiki.sty: \AtBeginDocument{\MakeActiveLet\'\niceverb_rq_sf} -%% TODO \niceverbswitch{}{} (bzw. Doku ohne {}) - + %% TODO \niceverbswitch{}{} (bzw. Doku ohne {}) +%% %% === Leave package mode === -\makeatother \MakeSub\_ \endinput +%% +%% === VERSION HISTORY === + +v0.1 2009/02/21 very first, sent to CTAN +v0.2 2009/04/04 ...NoVerbList: \subsubsection, \AddToMacro, + 2009/04/05 \SimpleVerb makes more other than iii + 2009/04/06 just uses \dospecials + 2009/04/08 debugging code for rq/sf, +\relax + 2009/04/09 +\verb@eol@error, prepared for new doc method, + removed spurious \makeat..., -\relax (ligature), + 2009/04/10 ('-trick + 2009/04/11 \@ after \SimpleVerb + 2009/04/14 noted TODO below + 2009/04/15 change v0.1 to 2009/02/21 + +TODO: choose expansions of active characters by options 2009/04/10 +TODO: &\@tempa and &\_tempa fail 2009/04/14 -- cgit v1.2.3