diff options
author | Karl Berry <karl@freefriends.org> | 2012-09-21 22:32:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-09-21 22:32:42 +0000 |
commit | 58643c9c7849421f436ead6fb2d83111fe4606b2 (patch) | |
tree | 7629ad412b39e828b9c584df12ce253f43ad702a /Master/texmf-dist | |
parent | 2116b098967c4ac8c5c341b24ece64007d46d45f (diff) |
new generic package catcodes (21sep12)
git-svn-id: svn://tug.org/texlive/trunk@27763 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/generic/catcodes/README | 54 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/catcodes/SrcFILEs.txt | 12 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/catcodes/catcodes.pdf | bin | 0 -> 357846 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/generic/catcodes/catcodes.tex | 109 | ||||
-rw-r--r-- | Master/texmf-dist/source/generic/catcodes/srcfiles.tex | 16 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/catcodes/actcodes.sty | 146 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/catcodes/catchdq.sty | 133 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/catcodes/catcodes.RLS | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/catcodes/stacklet.sty | 119 |
9 files changed, 591 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/catcodes/README b/Master/texmf-dist/doc/generic/catcodes/README new file mode 100644 index 00000000000..18ac9ae658e --- /dev/null +++ b/Master/texmf-dist/doc/generic/catcodes/README @@ -0,0 +1,54 @@ + + README for the `catcodes' bundle + (C) Uwe Lueck 2012/09/20 + +The `catcodes' bundle deals with category code switching. +The contained packages should work with LaTeX as well as without +(based on the `plainpkg' package). The important cases of category +codes are +(a) "private letters" for internal package commands and +(b) active characters. +`stacklet.sty' deals with (a), `actcodes.sty' with (b). +There also is +(c) `catchdq.sty', an application of (b), +for automatic insertion of typographical double quotes +when the user only enters ASCII double quotes. What is +"typographical" differs between languages, the new `langcode' +package completes `catchdq''s functionality in this respect. + +The documentation for the three package files is contained +in the file `catcodes.pdf'. + +REQUIRED PACKAGES: plainpkg, stacklet + +RELATED PACKAGES: catoptions, pcatcode (amsrefs), texapi, csquotes + +KEYWORDs: macro programming, category codes, private letters, + active characters, double quotes + +The package files `actcodes.sty', `catchdq.sty', and +`stacklet.sty', together with the documentation files +`catcodes.pdf' and `catcodes.tex', can be redistributed and/or +modified under the terms of the LaTeX Project Public License; +either version 1.3c of the License, or any later version, see + + http://www.latex-project.org/lppl.txt + +There is NO WARRANTY, actually all of this still is a little +experimental. + +The `catcodes' bundle is author-maintained in the sense of +the license. + +The latest public version of the bundle is available at + + http://mirror.ctan.org/macros/generic/catcodes/ + +A TDS version of the package is available as + + http://mirror.ctan.org/install/macros/generic/catcodes.tds.zip + +Please report bugs, problems, and suggestions via + + http://www.contact-ednotes.sty.de.vu + diff --git a/Master/texmf-dist/doc/generic/catcodes/SrcFILEs.txt b/Master/texmf-dist/doc/generic/catcodes/SrcFILEs.txt new file mode 100644 index 00000000000..d10662cdb6b --- /dev/null +++ b/Master/texmf-dist/doc/generic/catcodes/SrcFILEs.txt @@ -0,0 +1,12 @@ + + *File List* +actcodes.sty 2012/09/19 v0.2 active characters (UL) +stacklet.sty 2012/08/27 v0.3 private letters (UL) + catchdq.sty 2012/09/20 v0.2 simple typographic dqs (UL) +catcodes.tex 2012/09/20 -- documenting catcodes files +catcodes.RLS 2012/09/20 r0.1 initial release + *********** + + List made at 2012/09/20, 13:00 + from script file srcfiles.tex + diff --git a/Master/texmf-dist/doc/generic/catcodes/catcodes.pdf b/Master/texmf-dist/doc/generic/catcodes/catcodes.pdf Binary files differnew file mode 100644 index 00000000000..8ac97a2df83 --- /dev/null +++ b/Master/texmf-dist/doc/generic/catcodes/catcodes.pdf diff --git a/Master/texmf-dist/source/generic/catcodes/catcodes.tex b/Master/texmf-dist/source/generic/catcodes/catcodes.tex new file mode 100644 index 00000000000..8f38766e4b3 --- /dev/null +++ b/Master/texmf-dist/source/generic/catcodes/catcodes.tex @@ -0,0 +1,109 @@ +\ProvidesFile{catcodes.tex}[2012/09/20 documenting catcodes files] +\title{\pkg{catcodes}\\---\\``Generic" Switching of Category Codes} +% \listfiles +{ \RequirePackage{makedoc} \ProcessLineMessage{} + \renewcommand\mdSectionLevelOne {\string\subsection} + \renewcommand\mdSectionLevelTwo {\string\subsubsection} + \MainDocParser{\SectionLevelTwoParseInput} + \HeaderLines{18} %% 18 2012/08/26 + \MakeSingleDoc{stacklet.sty} + \MakeSingleDoc{actcodes.sty} %% 2012/08/26 + \MakeSingleDoc{catchdq.sty} %% 2012/09/16 +} +\documentclass[fleqn]{article}%% TODO paper dimensions!? +\input{makedoc.cfg} %% shared formatting settings +% \ReadPackageInfos{stacklet} +\MDkeywords{Macro programming, category codes, private letters, + active characters, double quotes} +\newcommand*{\headersec}{% + \subsection{Package File Header---\pkg{plainpkg} and Legalese}} +\usepackage{ngerman} \originalTeX +\usepackage{catchdq} +\sloppy +\begin{document} +\maketitle +\begin{MDabstract} +The 'catcodes' bundle provides small packages for switching +category codes, usable both with \LaTeX\ and without. \ +(i)\enspace \pkg{stacklet.sty} maintains stacks for ``private letters," +needed for 'plainpkg.tex''s minimal framework for ``generic" +packages. \ +(ii)\enspace \pkg{actcodes.sty} deals with ``active characters," +switching their category codes and assigning meanings to +``active-character tokens." \ +(iii)\enspace +%% 2012/09/16: +\pkg{catchdq.sty} uses the ``double quote" as an active character +for simplified access to typographical double quotes.---These +packages are ``generic" in the sense that they should +be usable at least both with \LaTeX\ and Plain \TeX, +based on 'plainpkg.tex'. + +\MDaddtoabstract{Required Packages} +\ctanpkgref{plainpkg}, 'stacklet' +\MDaddtoabstract{Related Packages} +\ctanpkgref{catoptions}, 'pcatcode' from \ctanpkgref{amsrefs}, +\ctanpkgref{texapi}, +\ctanpkgref{csquotes}. %% 2012/09/16 +\end{MDabstract} +\tableofcontents + +\section{Shared Features of Usage} +%%% rm. 2012/09/17: +% \section{General Background---Usage, Required} +% The packages of this bundle are part of a certain family of +% ``generic" packages: They should work \emph{with} \LaTeX\ +% as well as \emph{without} \LaTeX, aiming at +% ``independency of format"---actully too much now~... +% most importantly, they require \ctanpkgref{plainpkg}. +%%% rm 2012/09/16: +% , +% and the latter's documentation should tell you about +% how to use the present packages. +% +All the packages of the bundle are ``\pkg{plainpkg} packages" +in the sense of the +\ctanpkgref{plainpkg}\foothttpurlref{ctan.org/pkg/plainpkg} +documentation that exhibits details of what is summarized here. +Therefore: +\begin{itemize} + \item All of them require that \TeX\ finds `plainpkg.tex' + as well as `stackrel.sty'. + \item In order to load `<catcodes>.sty' + (where <catcodes> is `stacklet', `actcodes', or `catchdq'), + type \ |\usepackage{<catcodes>}| \ within a \LaTeX\ document + preamble, \ |\RequirePackage{<catcodes>}| \ in a + ``\pkg{plainpkg} package", or \ |\input <catcodes>.sty| \ + $\dots$ \ or perhaps `\input{<catcodes>.sty}'? +\end{itemize} + +\pagebreak +\section{'stacklet.sty'---Private Letters} +See Section~\ref{sec:stacklet-cmds} for the commands provided. +\headersec +\input{stacklet.doc} + +\pagebreak +\section{'actcodes.sty'---Active Characters} +See Section~\ref{sec:actcodes-cmds} for the commands provided. +\headersec +\input{actcodes.doc} + +\section{'catchdq.sty'---Proper Double Quotes by Toggling} +See Section~\ref{sec:catchdq-cmds} for the commands provided. +Note that the \ctanpkgref{csquotes} provides more comprehensive +functionality. +\headersec +\input{catchdq.doc} + +\end{document} + +VERSION HISTORY + +2012/08/24 for stacklet v0.1 very first +2012/08/26 for stacklet v0.2 increased \HeaderLines, abstract; + for actcodes v0.1 added ... +2012/09/16f. for catchdq v0.2 added ... +2012/09/19 "plainpkg packages", \pagebreaks, + Roman numbers in abstract, \headersec +2012/09/19 trying ngerman.sty diff --git a/Master/texmf-dist/source/generic/catcodes/srcfiles.tex b/Master/texmf-dist/source/generic/catcodes/srcfiles.tex new file mode 100644 index 00000000000..22951400e16 --- /dev/null +++ b/Master/texmf-dist/source/generic/catcodes/srcfiles.tex @@ -0,0 +1,16 @@ +\ProvidesFile{srcfiles.tex}[2012/09/20 file infos -> SrcFILEs.txt] +\RequirePackage[r]{nicefilelist} +\MFfieldtemplate{f-base}{catcodes} +\RequirePackage{myfilist} +\EmptyFileList %%% [readprov.sty,myfilist.sty] +%% packages: +\ReadPackageInfos{actcodes,catchdq,stacklet} +%% documentation: +\ReadFileInfos{catcodes} +%% documentation settings and auxiliaries: +% \ReadPackageInfos{fifinddo,makedoc,niceverb} +% \ReadFileInfos{makedoc.cfg,mdoccorr.cfg,srcfiles} +% \ReadFileInfos{srcfiles} +\ReadFileInfos{catcodes.RLS} +\ListInfos[SrcFILEs.txt] + diff --git a/Master/texmf-dist/tex/generic/catcodes/actcodes.sty b/Master/texmf-dist/tex/generic/catcodes/actcodes.sty new file mode 100644 index 00000000000..3e6f516592f --- /dev/null +++ b/Master/texmf-dist/tex/generic/catcodes/actcodes.sty @@ -0,0 +1,146 @@ + \input plainpkg +\ProvidesPackage{actcodes}[2012/09/19 v0.2 active characters (UL)] +%% +%% Copyright (C) 2012 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.3c of the License, or any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% There is NO WARRANTY (actually somewhat experimental). +%% +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +%% == Purpose and Usage == +%% The package derives from switching category codes +%% in the 'nicetext' and 'morehype' bundles and should +%% improve them. +%% +%% === Installing and Calling === +%% The file `actcodes.sty' is provided ready, +%% installation only requires +%% putting it somewhere where \TeX\ finds it +%% (which may need updating the filename data +%% base).\urlfoot{ukfaqref}{inst-wlcf} +%% However, the files `plainpkg.tex' and `stacklet.sty' %% stacklet 2012/09/19 +%% must be installed likewise. +%% +%% \emph{With} \LaTeX, the file should be loaded by `\RequirePackage{actcodes}' +%% or `\usepackage{actcodes}'. +%% +%% \emph{Without} \LaTeX, load it by `\input actcodes.sty'. +%% +%% As explained in `plainpgk-doc.pdf', however, ``generic" +%% packages based on 'plainpkg' should load 'actcodes' by +%% `\RequirePackage{actcodes}'. +%% +%% === Commands and Syntax === +%% \label{sec:actcodes-cmds} +%% 'actcodes.sty' provides \ |\MakeActive|, |\MakeActiveAss|, +%% |\MakeActiveDef|, |\MakeActiveLet|, +%% |\MakeOther|, |\MakeActiveOther| \ with rather obvious +%% syntax---you find more detailed descriptions +%% mixed with implementation below ... TODO +%% ---Without \LaTeX, the latter's internal |\@gobble<arg>| +%% is provided as well. +%% +%% == The Code == +%% === Our Private Letters === +\PushCatMakeLetterAt +%% +%% === The Core === +%% |\MakeActiveAss<ass-fun>\<char><ass-args>| ``activates" <char> +%% and then applies assignment function <ass-fun> with arguments +%% <ass-args> to it. The code derives from \LaTeX's +%% `\@sverb' and `\do@noligs' and was also discussed +%% on the \acro{LATEX-L} mailing list September 2010 +%% (Will Robertson; Heiko Oberdiek). +%% The present definition generalizes +%% `\MakeActiveDef' and `\MakeActiveLet' of my earlier packages. +\gdef\MakeActiveAss#1#2{% + \MakeActive#2% + \begingroup \lccode`\~`#2\relax \lowercase{\endgroup #1~}} +%% I was reluctant to provide |\MakeActive\<char>|, +%% but with 'catchdq.sty', it would be better ... %% 2012/09/16 +\gdef\MakeActive#1{\catcode`#1\active} +%% ... it just ``revives" the meaning that the corresponding +%% active-character token last time ... +%% +%% === \cs{def} and \cs{let} === +%% |\MakeActiveDef\<char><parameters>{<replace>}| +%% has been employed in 'fifinddo' and 'blog' +%% (which is based on 'fifinddo') so far. +\gdef\MakeActiveDef{\MakeActiveAss\def} +%% W.r.t.\ the definition of this `\MakeActiveDef', +%% Heiko Oberdiek remarked that it allows \emph{macro parameters}, +%% as opposed to my earlier definition in 'fifinddo'. +%% Without parameters, this kind of macro has been used for +%% conversion of text encodings ('atari.fdf', +%% and I thought this was the idea of \ctanpkgref{stringenc} ...). +%% +%% |\MakeActiveLet\<char><cmd>| has been provided in 'niceverb' so far. +%% The present package has been made in order to have +%% `\MakeActiveLet' with 'blog.sty' as well, it was too annoying +%% to use `\MakeActiveDef' there so often. +\gdef\MakeActiveLet{\MakeActiveAss\let} +%% +%% === Switching Back \textellipsis === +%% Sometimes, the ``active" behaviour of <char> is too difficult, +%% and you may want to switch bach to its ``simple" way ... +%% This may work by |\MakeOther\<char>| ... +%% with \LaTeX, `\MakeOther' just is `\@makeother' ... +\ifltx \global\let\MakeOther\@makeother +\else \gdef\MakeOther#1{\catcode`#112\relax} +\fi +%% But within a macro (or other) argument, you can't change the `\catcode'. +%% (I~lost some time by not realizing that it was within a large argument +%% where I tried to switch the `\catcode'.) +%% Anyway or in certain cases, it may be better to keep a character +%% ``active" throughout a document and just to change the \emph{expansion} +%% of the ``active-character token." This can be done with +%% `\MakeActiveLet' and `\MakeActiveDef' in certain cases already. +%% E.g., when the \emph{``blank space"} has been ``activated" by +%% `\obeylines', `\MakeActiveLet\ \space' ``undoes" this half-way, +%% while it does not restore ``argument skipping" and +%% ``compressing blank spaces." +%% +%% When character <char> should be ``active" for some time, +%% but for certain moments you prefer that it behaves like an +%% ``other character", you can switch to its ``other" expansion by +%% |\MakeActiveOther\<char>|: +\gdef\MakeActiveOther#1{% + \MakeActiveAss\edef#1{\expandafter\@gobble\string#1}} +%% `\MakeActiveOther' uses \LaTeX's |\@gobble<arg>|, +%% \emph{without} \LaTeX, 'actcodes' provides it: +\ifltx\else \long\gdef\@gobble#1{} \fi +% \show_ \MakeActiveOther\_ \show_ \expandafter\show_ +%% I am \emph{not} providing a version \emph{without} +%% the `\catcode' change, although the latter is superfluous here +%% TODO ... +%% +%% `niceverb' also provides `\MakeNormal\<char>', it may migrate +%% to here in the future, and there may be |\MakeActiveNormal\<char>| +%% extending the above `\MakeActiveOther' TODO ... +%% +%% Also, a \emph{stack} might be used as in 'stacklet', +%% even to switch \emph{meanings} of active-character tokens ... +%% not sure TODO ... +%% +%% \ctanpkgref{babel} does similar things, but I never have ... TODO +%% +%% === Leaving and Version History === +\PopLetterCatAt +\endinput +%% +%% VERSION HISTORY + +v0.1 2012/08/26 started, almost completed + 2012/08/27 completed; realizing \Push...At ..., bug fixes +v0.2 2012/08/28 \global\let, \def -> \gdef + 2012/09/16 \MakeActive + 2012/09/19 doc: stacklet diff --git a/Master/texmf-dist/tex/generic/catcodes/catchdq.sty b/Master/texmf-dist/tex/generic/catcodes/catchdq.sty new file mode 100644 index 00000000000..f98ddf717f9 --- /dev/null +++ b/Master/texmf-dist/tex/generic/catcodes/catchdq.sty @@ -0,0 +1,133 @@ + \input plainpkg +\ProvidesPackage{catchdq}[2012/09/20 v0.2 simple typographic dqs (UL)] +%% +%% Copyright (C) 2012 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.3c of the License, or any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% There is NO WARRANTY (actually somewhat experimental). +%% +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +%% == Purpose and Usage == +%% +%% === Installing and Calling === +%% The file `catchdq.sty' is provided ready, +%% installation only requires +%% putting it somewhere where \TeX\ finds it +%% (which may need updating the filename data +%% base).\urlfoot{ukfaqref}{inst-wlcf} +%% However, the files `plainpkg.tex' and `stacklet.sty' %% stacklet 2012/09/19 +%% must be installed likewise. +%% +%% \emph{With} \LaTeX, the file should be loaded by `\RequirePackage{catchdq}' +%% or `\usepackage{catchdq}'. +%% +%% \emph{Without} \LaTeX, load it by `\input catchdq.sty'. +%% +%% As explained in `plainpgk-doc.pdf', however, ``generic" +%% packages based on 'plainpkg' should load 'catchdq' by +%% `\RequirePackage{catchdq}'. +%% +%% === Commands and Syntax === +%% \label{sec:catchdq-cmds} +%% 'catchdq.sty' (indirectly) allows using |"<no-dqs>"| +%% for surrounding <no-dqs> with typographical quotation marks, +%% using that double quote |"| as an active character. +%% As rendering that `"' active during defining macros can +%% corrupt the latter, the user (or package writer) must +%% activate that `"' explicitly by |\catchdqs|. +%% +%% Further difficulties may arise after `\catchdqs', +%% various ways to get around them are described in the remaing sections. +%% +%% == The Code == +%% === Required === +%% The package is an application (of ideas of) 'actcodes.sty': +\RequirePackage{actcodes} +%% +%% === The Core: \cs{catchdq} === +%% % \label{sec:catchdq-core} +%% |\catchdq<no-dqs>"| will expand to |\dqtd{<no-dqs>}|, +%% provided the \acro{ASCII} double quote is an active character: +{\MakeActive\"\gdef\catchdq#1"{\dqtd{#1}}} +%% +%% === What Double Quotes Actually Are === +%% |\dqtd| in turn is a kind of ``variable." 'blog.sty' offered +%% |\endqtd| for English typographical double quotes, +%% |\dedqtd| for German ones, and |\asciidqtd| for ``non-typographical" +%% double quotes (as needed for \acro{XML} attributes). +%% |\asciidq| accesses a single \acro{ASCII} double quote, +%% |\enldq| a single English typographical left one, +%% |\enrdq| a single English typographical right one. +%% (It may be useful to access them indepentently of each other, +%% in certain complex situations ...) +%% 'blog.sty', dealing with \acro{HTML}, of course has different ideas +%% about them TODO. +\gdef\asciidq{"} +\gdef\asciidqtd#1{"#1"} +%% We allow loading 'catchdq' \emph{after} another package +%% (such as 'blog.sty') has chosen meanings for `\endqtd' and the +%% like (difficult TODO) +\ifx\enldq \undefined \gdef\enldq{``} \fi +\ifx\enrdq \undefined \global\let\enrdq\asciidq \fi +\ifx\endqtd\undefined \gdef\endqtd#1{\enldq#1\enrdq} \fi +%% Typographical alternatives to `\endqtd' may be obtained +%% from \CtanPkgRef{ngerman}{ngerman.sty} or so, if you are smart ... +%% %% <- 2012/09/20 -> +%% (see Section~\ref{sec:sw} for how it works): +\ifx\dedqtd\undefined \gdef\dedqtd#1{\glqq#1\grqq} \fi +%% 'blog.sty', dealing with \acro{HTML}, had a different idea +%% about `\endqtd' of course. It has also used the mechanism of +%% the \ctanpkgref{langcode} package that allows using `\dqtd' and other +%% language-depended constructs with an ``implicit" choice according +%% to the ``current language code," which should appear soon. +%% +%% === Switching === +%% \label{sec:sw} +%% 'blog.sty' usually does a single switch which gets a new name now: +%% |\catchdqs|. +\gdef\catchdqs{\MakeActiveLet\"\catchdq} +%% After this, |"<no-dqs>"| will expand to `\dqtd{#1}'. +%% The default expansion for |\dqtd| will be |\endqtd|: +\ifx\dqtd\undefined \global\let\dqtd\endqtd \fi +%% Might be done by |\endqs|---when there are alternatives, +%% but 'blog.sty' and 'langcode.sty' do this in a different way ... TODO +% \gdef\endqs{\let\dqtd\endqtd} +% \ifx\dqtd\undefined \global\endqs \fi +%% \catchdqs Actually, here is a little "Tessst"~... +%% \let\dqtd\dedqtd \ and here with "doytshe doppleta anf..." $\dots$ \ +%% This has been achieved by +%% \[`\usepackage{ngerman} \originalTeX'\] +%% \MakeOther\" +%% +%% |\MakeOther\"| may switch off catching mode (---done just before, +%% as \ctanpkgref{niceverb} at present doesn't render it verbatim). +%% 'actcodes' suggests +%% a different way to return from the `\catchdqs' state: +%% Let the character active and change its meaning only, let it +%% \emph{expand} to its ``other" version---by |\activeasciidqs|? +%% |\MakeActiveOther\"| and \catchdqs +%% \let"\asciidq +%% |\let"\asciidq| (it works!) or |\MakeActiveLet\"\asciidq| +%% (abbreviate as `\activeasciidqs'?) ... In 'blog.sty', there never +%% was a need for switching back. We must rework interaction with +%% 'niceverb' and can perhaps simplify the latter, ... TODO +%% +%% === Leaving and Version History === +\endinput +%% +%% VERSION HISTORY + +v0.1 2010/11/13 in texblog.fdf +v0.2 2012/09/17 own file, new ideas ... + 2012/09/19 doc: stacklet + 2012/09/20 \dedqtd conditionally; reworked doc., + tested ngerman.sty diff --git a/Master/texmf-dist/tex/generic/catcodes/catcodes.RLS b/Master/texmf-dist/tex/generic/catcodes/catcodes.RLS new file mode 100644 index 00000000000..7a74abb475a --- /dev/null +++ b/Master/texmf-dist/tex/generic/catcodes/catcodes.RLS @@ -0,0 +1,2 @@ +\ProvidesFile{catcodes.RLS} %% RELEASE INFO + [2012/09/20 r0.1 initial release] diff --git a/Master/texmf-dist/tex/generic/catcodes/stacklet.sty b/Master/texmf-dist/tex/generic/catcodes/stacklet.sty new file mode 100644 index 00000000000..3324a8391e3 --- /dev/null +++ b/Master/texmf-dist/tex/generic/catcodes/stacklet.sty @@ -0,0 +1,119 @@ + \input plainpkg +\ProvidesPackage{stacklet}[2012/08/27 v0.3 private letters (UL)] +%% +%% Copyright (C) 2012 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.3c of the License, or any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% There is NO WARRANTY (actually somewhat experimental). +%% +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +%% == Usage == +%% === Installing and Calling === +%% The file `stacklet.sty' is provided ready, +%% installation only requires +%% putting it somewhere where \TeX\ finds it +%% (which may need updating the filename data +%% base).\urlfoot{ukfaqref}{inst-wlcf} +%% However, the file `plainpkg.tex' must be installed likewise. +%% +%% \emph{With} \LaTeX, the file should be loaded by `\RequirePackage{stacklet}' +%% or `\usepackage{stacklet}'. +%% +%% \emph{Without} \LaTeX, both `\input stacklet.sty' and +%% `\input plainpkg' load `stacklet.sty'. +%% +%% === Commands and Syntax === +%% \label{sec:stacklet-cmds} +%% 'stacklet.sty' provides +%% \[|\PushCatMakeLetter\<char>| +%% \quad \textit{and}\quad +%% |\PopLetterCat\<char>|\] +%% for getting ``private letters" and giving them back +%% their previous category code +%% in package files with or without \LaTeX. +%% As \LaTeX\ has its own stack for `@', there are also +%% \[|\PushCatMakeLetterAt| +%% \quad \textit{and}\quad +%% |\PopLetterCatAt|\] +%% that care for `@''s category code \emph{without} \LaTeX\ only. +%% +%% == The Code == +%% === Name Space === +%% Each ``private letter" <char> gets its own stack, +%% in some name space, determined by |\cat_stack| +%% (`\withcsname' is from 'plainpkg.tex'): +\withcsname\xdef cat_stack\endcsname{% + \noexpand\string \withcsname\noexpand cat_stack\endcsname + \noexpand\string} +%% I.e., ?`cat_stack' will expand to +%% \[?`string'\,?`cat_stack'\,?`string'\] +%% in the notation of the \ctanpkgref{dowith} package. +% \withcsname\show cat_stack\endcsname +%% +%% === Pushing === +%% |\PushCatMakeLetter\<char>| ... +\xdef\PushCatMakeLetter#1{% + \noexpand\withcsname + \withcsname\noexpand pushcat_makeletter\endcsname + \withcsname\noexpand cat_stack\endcsname#1\endcsname#1} +% \show\PushCatMakeLetter +\withcsname\gdef pushcat_makeletter\endcsname#1#2{% +%% #1 is the stack token, #2 is the ``quoted" character. Pushing~... + \xdef#1{\the\catcode`#2\relax% +%% ... the new entry. `\relax' separates entries, +%% braces instead tend to get lost in popping ... +%% If the stack has existed before, +%% its previous content is appended: + \ifx#1\relax \else #1\fi}% +%% I thought of storing `\catcode's hexadecimally (without braces) +%% using \LaTeX's `\hexnumber', but the latter has so many tokens~... +%% Finally rendering <char> a ``letter": + \catcode`#211\relax} +%% Now we can use a ``private letter stack" for our own package: +\PushCatMakeLetter\_ +%% +%% === Popping === +%% |\PopLetterCat\<char>| passes `\<char>', the corresponding +%% stack token, and the latter's expansion to `\popcat_'. +%% `\end' serves as argument delimiter for the end of the stack only: +\gdef\PopLetterCat#1{% + \expandafter\expandafter\expandafter + \popcat_\csname\cat_stack#1\expandafter\endcsname + \expandafter \end \csname\cat_stack#1\endcsname#1} +%% `\popcat_' parses the expansion, assigns the old +%% category code and and stores the reduced stack: +\gdef\popcat_#1\relax#2\end#3#4{\catcode`#4#1\gdef#3{#2}} +%% ... check existence? TODO +%% +%% === No `@' Stack with \LaTeX === +%% |\PushCatMakeLetterAt| is like `\PushCatMakeLetter\@' +%% except that it has no effect under \LaTeX: +\gdef\PushCatMakeLetterAt{\ifltx\else\PushCatMakeLetter\@\fi} +%% |\PopLetterCatAt| by analogy ... +\gdef\PopLetterCatAt{\ifltx\else\PopLetterCat\@\fi} +%% +%% === Leaving the Package File === +%% ... in our new way: +\PopLetterCat\_ +\endinput +%% +%% === VERSION HISTORY === + +v0.1 2012/08/24 started + 2012/08/25 completed + 2012/08/26 extending doc.; \def\withcsname removed +v0.2 2012/08/26 \with_catstack containing \endcsname and with + three popping macros replaced by \csname + content \cat_stack, cf. memory.tex; + restructured + 2012/08/27 \PushCatMakeLetterAt fixed +v0.3 2012/08/27 def.s global |