diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/generic/catcodes |
Initial commit
Diffstat (limited to 'macros/generic/catcodes')
-rw-r--r-- | macros/generic/catcodes/README | 63 | ||||
-rw-r--r-- | macros/generic/catcodes/doc/SrcFILEs.txt | 14 | ||||
-rw-r--r-- | macros/generic/catcodes/doc/catcodes.RLS | 4 | ||||
-rw-r--r-- | macros/generic/catcodes/doc/catcodes.pdf | bin | 0 -> 541845 bytes | |||
-rw-r--r-- | macros/generic/catcodes/docsrc/catcodes.tex | 204 | ||||
-rw-r--r-- | macros/generic/catcodes/docsrc/fdatechk.tex | 14 | ||||
-rw-r--r-- | macros/generic/catcodes/docsrc/makedoc.cfg | 150 | ||||
-rw-r--r-- | macros/generic/catcodes/docsrc/mdoccorr.cfg | 61 | ||||
-rw-r--r-- | macros/generic/catcodes/docsrc/srcfiles.tex | 20 | ||||
-rw-r--r-- | macros/generic/catcodes/use/actcodes.sty | 147 | ||||
-rw-r--r-- | macros/generic/catcodes/use/catchdq.sty | 142 | ||||
-rw-r--r-- | macros/generic/catcodes/use/stacklet.sty | 123 |
12 files changed, 942 insertions, 0 deletions
diff --git a/macros/generic/catcodes/README b/macros/generic/catcodes/README new file mode 100644 index 0000000000..60766636f5 --- /dev/null +++ b/macros/generic/catcodes/README @@ -0,0 +1,63 @@ + + README for the `catcodes' bundle + (C) Uwe Lueck 2015/11/14 + +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 + +The file `catcodes.RLS' summarizes bundle releases. With the +`typeoutfileinfo' package, the command + + typeoutfileinfo catcodes.RLS + +tells which release is installed on your system. Similar packages +are `ltxfileinfo' by Wybo Dekker and `latexfileversion' by Harald +Harders. + +Please report bugs, problems, and suggestions via + + http://www.contact-ednotes.sty.de.vu + diff --git a/macros/generic/catcodes/doc/SrcFILEs.txt b/macros/generic/catcodes/doc/SrcFILEs.txt new file mode 100644 index 0000000000..168e0295a7 --- /dev/null +++ b/macros/generic/catcodes/doc/SrcFILEs.txt @@ -0,0 +1,14 @@ + + *File List* +catcodes.RLS 2015/11/14 r0.2 catchdq v0.21 proper definedness test +actcodes.sty 2012/11/07 v0.2a active characters (UL) +stacklet.sty 2012/11/07 v0.3a private letters (UL) + catchdq.sty 2015/05/22 v0.21 typographic dqs (UL) +catcodes.tex 2015/11/14 -- documenting catcodes files + makedoc.cfg 2013/03/25 -- documentation settings +mdoccorr.cfg 2012/11/13 -- `makedoc' local typographical corrections + *********** + + List made at 2015/11/14, 21:19 + from script file srcfiles.tex + diff --git a/macros/generic/catcodes/doc/catcodes.RLS b/macros/generic/catcodes/doc/catcodes.RLS new file mode 100644 index 0000000000..e4cabcf9e3 --- /dev/null +++ b/macros/generic/catcodes/doc/catcodes.RLS @@ -0,0 +1,4 @@ +\ProvidesFile{catcodes.RLS} %% RELEASE INFO + [2015/11/14 r0.2 catchdq v0.21 proper definedness test] + [2012/11/07 r0.1a documentation corrected/extended] + [2012/09/20 r0.1 initial release] diff --git a/macros/generic/catcodes/doc/catcodes.pdf b/macros/generic/catcodes/doc/catcodes.pdf Binary files differnew file mode 100644 index 0000000000..d1d4de26f5 --- /dev/null +++ b/macros/generic/catcodes/doc/catcodes.pdf diff --git a/macros/generic/catcodes/docsrc/catcodes.tex b/macros/generic/catcodes/docsrc/catcodes.tex new file mode 100644 index 0000000000..cb3494d880 --- /dev/null +++ b/macros/generic/catcodes/docsrc/catcodes.tex @@ -0,0 +1,204 @@ +\ProvidesFile{catcodes.tex}[2015/11/14 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 +} +% \RequirePackage[ir]{inputtrc} %% 2015/11/14 +\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} %% try it more often! TODO 2012/11/07 +\usepackage{langcode} %% 2012/11/07 +\usepackage{filedate} %% 2012/11/06 +\sloppy +% \flushbottom %% 2012/11/07 +\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 +``\acro{ASCII} %% 2012/11/06 +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{Overview} +Sorry, \dots, the abstract and the table of contents +must suffice for today (2012-11-07) \TODO + +\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: +\pagebreak[2] %% 2012/11/07 +\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} + +\section{'actcodes.sty'---Active Characters} +%% intro 2012/11/07: +\subsection{Introduction} +Active characters can simplify syntax often, i.e., the code +may be very pleasant to type and read. But sometimes something +may fail. See Section~\ref{sec:actcodes-cmds} for how to cope +with possibilities and difficulties. +\headersec +\input{actcodes.doc} + +\section{'catchdq.sty'---Typographical Double Quotes} +%% <- TODO cf. morgan.sty 2012/11/06 -> +% \section{'catchdq.sty'---Automatic Typographical Double Quotes by Toggling} +% \section{'catchdq.sty'---Proper Double Quotes by Toggling} +%% <- morgan.sty 2012/11/06 -> +\subsection{Introduction} +\catchdqs +The 'catchdq' package allows getting typographical double quotes +by just using the "\acro{ASCII} double quote" |"|. A more precise overview: +\begin{enumerate} + \item Typically, "typographical" quotation marks mean distinguishing + between "opening" and "closing" quotation marks. + Usually, you must enter different characters or commands for + the distinction, such as |``| for "opening" and |''| for + \emph{closing}---in \emph{English} with \emph{\TeX}. + For \emph{English} with \emph{Plain~\TeX}, even |"| suffices for "closing." + \item There are much different conventions especially for \emph{German} + and \emph{French}. They require different characters or \TeX~commands + than for \emph{English}. The packages \ctanpkgref{german}, + \ctanpkgref{ngerman}, and \ctanpkgref{babel} have dealt with + such conventions. + \item Understanding the ideas mentioned before has been difficult + for a long time, probably because typewriter and computer \emph{keyboards} + never have offered the appropriate keys. Rather, they only offered + the "\acro{ASCII} double quote" that produced an approximation + ("neutral quotation marks") + \emph{not} making the difference. Many users and readers + have not realized the difference, they have not realized + how their screen or printer output differed from double quotes + in books and newspapers. Cf.~the + \wikienref{Quotation mark}{Wikipedia article}\footnote{% + \urlhttpref{en.wikipedia.org/wiki/Quotation mark}} + \item The idea of the 'catchdq' package is that the user indeed should + not worry about that difference and just type + "\acro{ASCII} double quotes", and they should be "converted" + into the appropriate typographical quotation marks \emph{automatically}. + This should work by "toggling," i.e., the first + "\acro{ASCII} double quote" is interpreted as "opening," + the second as "closing," the next one as "opening"~\dots + ---Word processors have provided this feature (as an option) + as well. + \item Language-dependency of the feature currently is managed + through the \ctanpkgref{langcode} package. + \item The feature may cause problems sometimes. + Therefore, explicit switching the feature "on" + and "off" is required. + \item The \ctanpkgref{csquotes} package addresses the issue + in a more comprehensive and perhaps more stable way. +\end{enumerate} +See Section~\ref{sec:catchdq-cmds} for +% the commands provided. +% Note that the \ctanpkgref{csquotes} +% provides more comprehensive functionality. +additional details. %% 2012/11/06 +\MakeOther\" %% TODO 2012/11/06 + +\headersec +\input{catchdq.doc} + +\pagebreak +\section{'stacklet.sty'---Private Letters} +\subsection{Introduction} +\catchdqs %% 2012/11/07 +\uselangcode{en} %% 2012/11/07, \dedqtd above +"Private letters" \emph{here} are meant to be +characters that belong to the "letter" +category only within packages. A package typically provides +user commands as well as internal commands, and the latter +are characterized by containing funny letters in commands such +as `\@gobble.' This is to avoid conflicts. +See Section~\ref{sec:stacklet-cmds} for the commands provided. +\MakeOther\" %% 2012/11/07 +\headersec +\input{stacklet.doc} + +%% 'filedate' check 2012/11/06: +\noNiceVerb +\input{fdatechk.tex} +\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 + + UPLOADED with `catcodes' r0.1 2012-09-20 + +2012/11/06 supplementing missing word; + TODO on catchdq, `filedate' checks, + typeset with recent `niceverb'; + more accurate about `catchdq', + long introduction +2012/11/07 final formatting, some more info on + `stacklet' and `actcodes', TODOs, + some \catchdqs, `Overview', + 2 more \subsec...Intro... + + UPLOADED with `catcodes' r0.1a 2012-11-07 + +2015/11/14 for catchdq v0.21 debugging diff --git a/macros/generic/catcodes/docsrc/fdatechk.tex b/macros/generic/catcodes/docsrc/fdatechk.tex new file mode 100644 index 0000000000..74778a6acb --- /dev/null +++ b/macros/generic/catcodes/docsrc/fdatechk.tex @@ -0,0 +1,14 @@ +\ProvidesFile{fdatechk.tex}[2015/05/22 `filedate' checks] +%% TODO short notation +\UseReferenceDate{\thepdfmoddate} +\ModDates +\ReadFileInfos{catcodes.RLS,srcfiles} +\CheckDateOfGiven{actcodes.sty} +\CheckDateOfGiven{catchdq.sty} +%\DatesDiffWarnings +\CheckDateOfGiven{stacklet.sty} +%\DatesDiffErrors +\CheckDateOfGiven{catcodes.tex} +\CheckDateOfGiven{fdatechk.tex} +\CheckDateOfGiven{srcfiles.tex} +\CheckDateOfToday{catcodes.RLS} diff --git a/macros/generic/catcodes/docsrc/makedoc.cfg b/macros/generic/catcodes/docsrc/makedoc.cfg new file mode 100644 index 0000000000..666c87706e --- /dev/null +++ b/macros/generic/catcodes/docsrc/makedoc.cfg @@ -0,0 +1,150 @@ +\ProvidesFile{makedoc.cfg}[{2013/03/25 documentation settings}] +%% +\author{Uwe L\"uck\thanks{% + \url{http://contact-ednotes.sty.de.vu}}} +%% +%% 'hyperref': +\RequirePackage{ifpdf} +\usepackage[% + \ifpdf +% bookmarks=false, %% 2010/12/22 +% bookmarksnumbered, + bookmarksopen, %% 2011/01/24!? + bookmarksopenlevel=2, %% 2011/01/23 +% pdfpagemode=UseNone, +% pdfstartpage=10, + pdfstartview=FitH, %% 2012/11/26 again +% pdfstartview=0 0 100, %% 2011/08/22 +% pdfstartview={XYZ null null 1}, %% 2011/08/25 +% pdfstartview={XYZ null null null},%% 2011/08/25 +% pdfstartview={XYZ null null .5}, %% 2011/08/26 +% pdffitwindow=true, %% 2011/08/22 + citebordercolor={ .6 1 .6}, + filebordercolor={1 .6 1}, + linkbordercolor={1 .9 .7}, + urlbordercolor={ .7 1 1}, %% playing 2011/01/24 + \else + draft + \fi +]{hyperref} +\hypersetup{% + pdfauthor={Uwe L\374ck}% +} +%% metadata, |\MDkeywords{<text>}|, |\MDkeywordsstring|: +%% %% 2011/08/22: +\makeatletter + \newcommand*{\MDkeywords}[1]{% + \gdef\MDkeywordsstring{#1}% + \hypersetup{pdfkeywords=\MDkeywordsstring}%% TODO!? + } + \@onlypreamble\MDkeywords +%% |\MDaddtoabstract{<par-head>}|, `:' added: + \newcommand*{\MDaddtoabstract}[1]{% %% 2012/05/10 + \par\smallskip\noindent + \strong{#1:}\quad\ignorespaces} +%% \pagebreak[2] +%% |\printMDkeywords|: + \newcommand*{\printMDkeywords}{% + \MDaddtoabstract{Keywords}% + \MDkeywordsstring +% \global\let\MDkeywordsstring\relax %% `%' 2012/11/12 + } +%% The previous definitions mainly are useful with a variant +%% |\begin{MDabstract}| of \LaTeX's `{abstract}' environment: + \newenvironment{MDabstract} + {\abstract\noindent + \hspace{1sp}%% for niceverb + \ignorespaces} + {\@ifundefined{MDkeywordsstring}% + {}% + {\printMDkeywords}% + \global\let\MDabstract\relax %% 2012/11/12 + \global\let\endMDabstract\relax %% 2012/11/12 + \endabstract} +%% |\[MD]docnewline| 2012/11/12 from `readprov.tex': + \newcommand*{\MDdocnewline}{\leavevmode\@normalcr[\topsep]} +%% <- `\leavevmode' for use with `\paragraph'. +%% Sometimes needs to be preceded by a space. +%% +%% |\MDfinaldatechecks[<tex-script>]| with \ctanpkgref{filedate}: + \newcommand*{\MDfinaldatechecks}[1][fdatechk]{% + \AtEndDocument{% +% \clearpage %% 2013/03/25 no avail -- with `filedate'! + \def\@pkgextension{sty}% + \def\NeedsTeXFormat##1[##2]{}% + \noNiceVerb %% 2013/03/22 + \input{#1}% + }} + \@onlypreamble\MDfinaldatechecks +\makeatother +%% Use other packages: +\RequirePackage{niceverb}[2011/01/24] +\RequirePackage{readprov} %% 2010/12/08 +\RequirePackage{hypertoc} %% 2011/01/23 +\RequirePackage{texlinks} %% 2011/01/24 +\RequirePackage{relsize} %% 2011/06/27 +\RequirePackage{color} %% 2011/08/06 +\RequirePackage{lmodern} %% 2012/10/29 +\RequirePackage{filedate} %% 2012/11/12 +\RequirePackage{filesdo} %% 2013/03/22 +%% \pagebreak[3] +%% Logical markup:\qquad |\strong{<chars>}|, |\meta{<chars>}|, +%% |\acro{<chars>}|, |\pkg{<chars>}|, +%% |\code{<chars>}|, |\file{<chars>}|:{\sloppy\par} +\makeatletter + \def\do#1#2{\@ifdefinable#1{\let#1#2}}%% 2012/07/13 + \do\strong\textbf \do\file\texttt \do\acro\textsmaller + %% <- wrong tests before 2012/07/13 + \do\meta\textit \do \pkg\textsf \do\code\texttt + \ifpdf + \pdfstringdefDisableCommands{% + \let\acro\textrm + \let\file\textrm %% 2011/11/09 + \let\code\textrm %% 2011/11/20 + \let\pkg \textrm %% 2012/03/23 + } + \fi + %% TODO 2011/07/22 -> `htlogml.sty' +\makeatother +%% |\qtdcode{<text>}|: 2012/10/24: + \newcommand*{\qtdcode}[1]{`\code{#1}'} +%% |\pkgtitle{<package-name>}{<caption>}| +\newcommand*{\pkgtitle}[2]{% %% 2012/07/13 + \global\let\pkgtitle\relax + \pkg{\huge #1}\\---\\#2\thanks{This + document describes version + \textcolor{blue}{\UseVersionOf{\jobname.sty}} + of \textsf{\jobname.sty} as of \UseDateOf{\jobname.sty}.}} +%% TODO: %% |\TODO| bad with `mdoccorr.cfg' +\newcommand*{\TODO}{\textcolor{blue}{\acro{TODO}}} %% 2012/11/06 +%% `\MDsampleinput[{<file>}' was added 2012/11/06. +%% Problems with `myfilist.tex' were due to 'parskip.sty' +%% there. On 2012/11/12, we change the former simple macro to a +%% much more complex +%% |\MDsamplecodeinput[<add-hfuss>]{<file>}| +\newcommand*{\MDsamplecodeinput}[2][]{% + \begingroup + \vskip\bigskipamount \hrule + \nobreak\vskip-\parskip +% \nobreak\vskip\medskipamount +%% Previous mistake (same below) due to manual change +%% of `\topsep' in the file `myfilist.tex' (2012/11/30). + \ifx\\#1\\\else + \hfuzz=\textwidth \advance\hfuzz#1\relax + \fi + \noNiceVerb \verbatiminput{#2}% +% \nobreak\vskip\medskipamount + \hrule \vskip-\parskip + \bigskip %%% \bigbreak +%% `\bigbreak' made much larger space in `myfilist.tex'. + \endgroup +} +%% |\ctanpkgdref{<pkg-id>}| adds the printed link to +%% `ctan.org/pkg' as a footnote. There is a little space +%% for coloured link borders: +\newcommand*{\ctanpkgdref}[1]{% + \ctanpkgref{#1}\,\urlfoot{CtanPkgRef}{#1}} +\errorcontextlines=4 +\pagestyle{headings} + +\endinput diff --git a/macros/generic/catcodes/docsrc/mdoccorr.cfg b/macros/generic/catcodes/docsrc/mdoccorr.cfg new file mode 100644 index 0000000000..6a6a701229 --- /dev/null +++ b/macros/generic/catcodes/docsrc/mdoccorr.cfg @@ -0,0 +1,61 @@ +\ProvidesFile{mdoccorr.cfg}[2012/11/13 + `makedoc' local typographical corrections] +%% ... also demonstrates 'niceverb.sty'---see the typeset +%% documentation of the present file in `makedoc.pdf'. +%% +%% |\SetPatternCodes{<commands>}| redefines +%% `\PatternCodes' to be used in parsing and replacing +%% (some ``sanitizing"). %% improved line breaks 2010/03/29 +\SetPatternCodes{\MakeOther\\\MakeOther\ } +%% |\StartPrependingChain| initializes setup of a replacement +%% chain: +\StartPrependingChain +%% |\PrependExpandableAllReplacer*{<find>}{<subst>}|: +\PrependExpandableAllReplacer*{etc. }{etc.\ } +%% ... you can keep inter-sentence space after `etc.' +%% by a code line break.---Now we use |\do| as a shorthand: +\renewcommand*{\do}{\PrependExpandableAllReplacer*} +\do{Cf. }{Cf.\ } %% 2011/01/12 +\do{cf. }{cf.\ } %% corr. 2010/03/23 +%% ... but think of `cf.~'. Don't leave `cf.' at code line end! +\do{->}{$\to$} %% 2010/11/06 +\do{<-}{$\gets$} %% 2010/11/06 +% \PrependExpandableAllReplacer{...}{...}{$\dots$} +%% Allow extra space at line end (bug fix `{}' 2011/12/03): +\do{...}{\textellipsis\unkern{}} +%% 2011/10/13: original `\dots' correct before punctuation: +% \PrependExpandableAllReplacer{dots,}{...,}{\dots,} +\do{...)}{\dots)} %% 2011/10/25 +\do{...:}{\dots:} %% 2012/11/07 +\do{... }{\textellipsis\unkern\ } +\do{TODO}{\TODO{}} +%% ... chain starts here, and here |\MakeDocCorrectHook| +%% (silently) enters through a default variant +%% |\SetCorrectHookJobLast| of |\SetCorrectHookJob{<id>}|: +\SetCorrectHookJobLast +%% |\ResetPatternCodes| resets `\PatternCodes' to their default +%% value (which is `\fdPatternCodes'): +\ResetPatternCodes +%% ... restores 'fifinddo' default. +\endinput + +HISTORY +2009/04/05 with makedoc v0.2 +2010/03/11 broke some too long code lines +2010/03/16 rendered `mdoccorr.cfg' +2010/03/22 try \Prepend... +2010/03/23 corrected `cf' +2010/03/29 use \SetPatternCodes etc. +2010/11/06 <- and -> +2010/11/24 `...' ``symmetric variant" of `\textellipsis'; + \StartPrependingChain, no more + \MakeExpandableAllreplacer +2011/01/27 blue "TODO" +2011/09/13 \providecommand for dialogues +2011/10/13 \MDtwodots, without \PXAR, `...,' `...:' +2011/10/25 \textellipsis\unkern from csquotes instead, `...)' +2011/11/13 \PrependExpandableAllReplacer* +2011/12/03 bug fix for 2011/10/25 at line ends +2012/11/07 TODO -> \TODO{} +2012/11/12 using \do +2012/11/13 shorter code lines diff --git a/macros/generic/catcodes/docsrc/srcfiles.tex b/macros/generic/catcodes/docsrc/srcfiles.tex new file mode 100644 index 0000000000..170e77c41d --- /dev/null +++ b/macros/generic/catcodes/docsrc/srcfiles.tex @@ -0,0 +1,20 @@ + \ProvidesFile{srcfiles.tex}[2015/11/14 file infos -> SrcFILEs.txt] +%\ProvidesFile{srcfiles.tex}[2012/11/07 file infos -> SrcFILEs.txt] +\RequirePackage[r,wrap]{nicefilelist} +\RequirePackage{filedate} +\MaxBaseEmptyList* %%% [readprov.sty,myfilist.sty] +\ReadFileInfos{catcodes.RLS} +%% packages: +\ReadPackageInfos{actcodes,catchdq,stacklet} +%% documentation: +\ReadFileInfos{catcodes} +%% documentation settings and auxiliaries: +% \ReadPackageInfos{fifinddo,makedoc,niceverb} +% \ReadFileInfos{makedoc.cfg,mdoccorr.cfg,srcfiles} +% \ReadFileInfos{srcfiles} +% \FileListRemark[ -- ]{---USED.---} +\ReadFileInfos{makedoc.cfg,mdoccorr.cfg} +\NoStopListInfos[SrcFILEs.txt] +\EqualityMessages +\input{fdatechk} +\stop diff --git a/macros/generic/catcodes/use/actcodes.sty b/macros/generic/catcodes/use/actcodes.sty new file mode 100644 index 0000000000..f868dec158 --- /dev/null +++ b/macros/generic/catcodes/use/actcodes.sty @@ -0,0 +1,147 @@ + \input plainpkg +\ProvidesPackage{actcodes}[2012/11/07 v0.2a 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 %% |...| 2012/11/07 +%% 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 +v0.2a 2012/11/07 doc.: |...| on \MakeNormal diff --git a/macros/generic/catcodes/use/catchdq.sty b/macros/generic/catcodes/use/catchdq.sty new file mode 100644 index 0000000000..4004ca7cd2 --- /dev/null +++ b/macros/generic/catcodes/use/catchdq.sty @@ -0,0 +1,142 @@ + \input plainpkg +\ProvidesPackage{catchdq}[2015/05/22 v0.21 typographic dqs (UL)] +%% %% rm. "simple" -- too long -- 2015/05/22 +%% +%% Copyright (C) 2012 2015 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. Before v0.21, definedness was tested by +%% `\ifx'...`\undefined', which two times fell +%% prey to some earlier `\@ifundefined'. So now: +\begingroup \escapechar=-1 +\def\provass#1#2#3{% + \expandafter\ifx\csname \string#2\endcsname\relax #1#2#3\fi} +\provass \gdef \enldq {{``}} +\provass {\global\let} \enrdq \asciidq +\provass \gdef \endqtd {#1{\enldq#1\enrdq}} +%% Typographical alternatives to `\endqtd' may be obtained +%% from \ctanpkgstyref{ngerman} or so, if you are smart ... +%% %% <- 2012/09/20 -> +%% (see Section~\ref{sec:sw} for how it works): +\provass \gdef \dedqtd {#1{\glqq#1\grqq}} +%% '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|: +\provass {\global\let} \dqtd \endqtd +%% 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 +\endgroup +%% \catchdqs Actually, here is a little "Tessst"~... +%% \let\dqtd\dedqtd \ and here with "doytshe doppleta unf..." $\dots$ \ +%% %% anf -> unf 2015/05/22 +%% The latter 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 +v0.21 2015/05/22 better test for undefinedness diff --git a/macros/generic/catcodes/use/stacklet.sty b/macros/generic/catcodes/use/stacklet.sty new file mode 100644 index 0000000000..b2f3ee4cf6 --- /dev/null +++ b/macros/generic/catcodes/use/stacklet.sty @@ -0,0 +1,123 @@ + \input plainpkg +\ProvidesPackage{stacklet}[2012/11/07 v0.3a 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'. +%% +%% \filbreak %% 2012/11/07 +%% === 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 +%% documentation. %% 2012/11/06 +% \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 +v0.3a 2012/11/06 doc.: "documentation" + 2012/11/07 \filbreak |