summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/relenc
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/relenc
Initial commit
Diffstat (limited to 'macros/latex/contrib/relenc')
-rw-r--r--macros/latex/contrib/relenc/2sidedoc.sty360
-rw-r--r--macros/latex/contrib/relenc/README139
-rw-r--r--macros/latex/contrib/relenc/reldemo.tex440
-rw-r--r--macros/latex/contrib/relenc/relenc.dtx1549
-rw-r--r--macros/latex/contrib/relenc/relenc.ins15
-rw-r--r--macros/latex/contrib/relenc/relenc.tex1285
-rw-r--r--macros/latex/contrib/relenc/t1renc.dtx998
-rw-r--r--macros/latex/contrib/relenc/t1rzcm.fdd273
-rw-r--r--macros/latex/contrib/relenc/zcmr8d.tfmbin0 -> 5840 bytes
-rw-r--r--macros/latex/contrib/relenc/zcmr8d.vfbin0 -> 3132 bytes
-rw-r--r--macros/latex/contrib/relenc/zcmr8d.vf2bin0 -> 3132 bytes
-rw-r--r--macros/latex/contrib/relenc/zcmr8d.vf3bin0 -> 3128 bytes
-rw-r--r--macros/latex/contrib/relenc/zcmra.tfmbin0 -> 5432 bytes
-rw-r--r--macros/latex/contrib/relenc/zcmra.vfbin0 -> 3196 bytes
-rw-r--r--macros/latex/contrib/relenc/zcmra.vf2bin0 -> 3196 bytes
-rw-r--r--macros/latex/contrib/relenc/zcmra.vf3bin0 -> 3192 bytes
16 files changed, 5059 insertions, 0 deletions
diff --git a/macros/latex/contrib/relenc/2sidedoc.sty b/macros/latex/contrib/relenc/2sidedoc.sty
new file mode 100644
index 0000000000..64c4f523d3
--- /dev/null
+++ b/macros/latex/contrib/relenc/2sidedoc.sty
@@ -0,0 +1,360 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{2sidedoc}[1999/01/24]
+
+\newif\ifTSD@setpdimens \TSD@setpdimensfalse
+\let\TSD@showdimen=\@gobble
+
+\DeclareOption{setpagedimens}{\TSD@setpdimenstrue}
+\DeclareOption{showdimens}{%
+ \def\TSD@showdimen#1{%
+ \dimen@=0.35146#1%
+ \immediate\write\sixt@@n{#1: \strip@pt\dimen@ mm}%
+ }%
+}
+
+\ProcessOptions\relax
+
+\if@twoside
+ \normalmarginpar
+ \@mparswitchtrue
+
+ \ifTSD@setpdimens
+ % The total width of the part of the page on which text should be
+ % allowed to appear is the width of 94 characters in the current
+ % \MacroFont. (20 in the margin, 72 in the main text (whose width
+ % is \textwidth), and 2 separating them.)
+ \ifdim\z@>\textwidth
+ % If the \textwidth is negative at this point, the negation of
+ % that value is used, to allow for further configuration.
+ \setlength\textwidth{-\textwidth}%
+ % \marginparsep is left unchanged.
+ \else
+ \ifcase\@ptsize
+ % 10pt, computed using cmtt9 at 9pt
+ \setlength\textwidth{340.2pt}
+ \setlength\marginparsep{9.4499pt} % 2*4.72495pt
+ \or
+ % 11pt, computed using cmtt10 at 10pt
+ \setlength\textwidth{378.0pt}
+ \setlength\marginparsep{10.4999pt} % 2*5.24995pt
+ \or
+ % 12pt, computed using cmtt10 at 10.95pt
+ \setlength\textwidth{414pt}
+ \setlength\marginparsep{11.49738pt} % 2*5.74869pt
+ \else
+ % Assume \@ptsize is the main font size, but compute the width
+ % as if \MacroFont includes a \small setting which reduces the
+ % size of everything by "\magstep-0.5" (that is, by a factor
+ % 1.2^{-0.5}, and assume the metrics of the font coincide with
+ % those of cmtt8.
+ \setlength\textwidth{34.91781pt}
+ \setlength\textwidth{\@ptsize\textwidth}
+ \setlength\marginparsep{0.96994pt}
+ \setlength\marginparsep{\@ptsize\marginparsep}
+ \fi
+ \fi
+ \ifdim 3truecm>\paperwidth
+ \PackageError{twosidedoc}{Your \protect\paperwidth\space is %
+ ridiculously small}\@ehd
+ \dimen@=2truecm
+ \advance\dimen@ \marginparsep
+ \ifdim \dimen@<\paperwidth \else
+ \PackageError{twosidedoc}{You have an infinite loop ahead}%
+ {You really should type X to quit now.}
+ \fi
+ \fi
+ \dimen@ii=\p@
+ \loop
+ \dimen@=\paperwidth
+ \advance\dimen@ -\marginparsep
+ \advance\dimen@ -1.27778\textwidth
+ \ifdim 2truecm<\dimen@ \else
+ % This gets dangerously close to the physical margins. Shrink
+ % the \textwidth by 5%.
+ \setlength\textwidth{0.95\textwidth}
+ \dimen@ii=0.95\dimen@ii
+ \repeat
+ \ifdim\dimen@ii<\p@
+ \dimen@=72\dimen@
+ \dimen@ii=100\dimen@ii
+ \ifdim\dimen@ii<90\p@
+ \expandafter\PackageWarningNoLine
+ \else
+ \expandafter\PackageInfo
+ \fi{twosidedoc}{%
+ The width of the text has been shrunk\MessageBreak
+ to \strip@pt\dimen@ii\@percentchar\space of its original %
+ size.\MessageBreak
+ This is approximately \strip@pt\dimen@\space characters.%
+ }
+ \fi
+ % Now at last \textwidth is established. The other values follow easily.
+ \setlength\marginparwidth{0.27778\textwidth}
+ % Margins are calculated as follows: 1 cm is reserved at each side
+ % and what remains is split 1:2 between inner and outer margin.
+ \dimen@=\paperwidth
+ \advance\dimen@ -\textwidth
+ \advance\dimen@ -\marginparsep
+ \advance\dimen@ -\marginparwidth
+ \advance\dimen@ -2truecm
+ \divide\dimen@ \thr@@
+ \setlength\oddsidemargin{\dimen@}
+ \setlength\evensidemargin{2\dimen@}
+ \advance\oddsidemargin 1truecm
+ \advance\oddsidemargin -1truein
+ \advance\evensidemargin \marginparsep
+ \advance\evensidemargin \marginparwidth
+ \advance\evensidemargin 1truecm
+ \advance\evensidemargin -1truein
+ \else
+ % Otherwise only the margins are changed.
+ \setlength\evensidemargin{\oddsidemargin}
+ \setlength\oddsidemargin{\paperwidth}
+ \advance\oddsidemargin -\textwidth
+ \advance\oddsidemargin -2truein
+ \advance\oddsidemargin -\evensidemargin
+ \advance\marginparsep 5\p@
+ \dimen@=\evensidemargin
+ \advance\dimen@ 1truein
+ \advance\dimen@ -1truecm
+ \advance\dimen@ -\marginparsep
+ \setlength\marginparwidth{\dimen@}
+ \fi
+\else
+ \advance\marginparsep 5\p@
+ \dimen@=\oddsidemargin
+ \advance\dimen@ 1truein
+ \advance\dimen@ -1truecm
+ \advance\dimen@ -\marginparsep
+ \setlength\marginparwidth{\dimen@}
+\fi
+
+\TSD@showdimen\textwidth
+\TSD@showdimen\oddsidemargin
+\TSD@showdimen\evensidemargin
+\TSD@showdimen\marginparwidth
+\TSD@showdimen\marginparsep
+\TSD@showdimen\marginparpush
+\TSD@showdimen\jot
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Modifications of macro etc.
+%
+\newcount\macro@line@cnt
+\macro@line@cnt=\z@
+ % \macro@cnt keeps track of how many macro names have been printed.
+ % \macro@line@cnt keeps track of how many lines it has taken.
+\def\TSD@prevgraf{1}
+ % The last stored value of \prevgraf.
+\newif\ifTSD@rightmargin@
+ % Should macro/environment name be formatted for printing in the
+ % right margin? (false = for left margin).
+
+\def\PrintMacroName#1{%
+ \expandafter\TSD@print@name \expandafter{\string#1}%
+}
+\def\PrintDescribeMacro#1{%
+ \expandafter\TSD@print@name \expandafter{\expandafter\strut
+ \string#1\strut}%
+}
+\def\PrintEnvName#1{\TSD@print@name{#1}}
+\def\PrintDescribeEnv#1{\TSD@print@name{\strut#1\strut}}
+
+
+\def\TSD@print@name#1{%
+ \raise 1ex\hbox{%
+ \MacroFont
+ \lower 1ex\vtop{%
+ \everypar={}% Very important!!!!
+ \hsize=\marginparwidth
+ \parindent=\z@
+ \parskip=\z@skip
+ \baselineskip=\normalbaselineskip
+ \lineskiplimit=-\maxdimen
+ \ifTSD@rightmargin@
+ \TSD@macro@format@right{#1}%
+ \else
+ \TSD@macro@format@left{#1}%
+ \fi
+ \xdef\TSD@prevgraf{\the\prevgraf}%
+ }%
+ }%
+}
+% #1 is the macro/enviroment; it has already been \string:ed.
+\def\TSD@macro@format@right#1{%
+ \leftskip=\z@\@plus 1fill\relax
+ \hskip-\leftskip
+ \rightskip=\z@\@plus\fontdimen\tw@\font\relax
+ \parfillskip=\z@\@plus 1fil\relax
+ \TSD@one@letter@words{#1}%
+ \@@par
+}
+\def\TSD@macro@format@left#1{%
+ \hskip\z@\@plus 1fill\relax
+ \leftskip=\z@skip
+ \rightskip=\z@\@plus\fontdimen\tw@\font\relax
+ \parfillskip=\z@\@plus 1fil\relax
+ \TSD@one@letter@words{#1}%
+ \@@par
+}
+\def\TSD@letter@space{\hskip\z@skip}
+\def\TSD@one@letter@words#1{\TSD@one@letter@words@i#1\relax}
+\def\TSD@one@letter@words@i#1{%
+ \ifx#1\relax\else
+ #1\TSD@letter@space
+ \expandafter\TSD@one@letter@words@i
+ \fi
+}
+
+\newcounter{MacroEnvironment}
+\setcounter{MacroEnvironment}{0}
+
+\def\TSD@correct@side{%
+ \begingroup
+ \edef\@tempa{%
+ \write\@auxout{%
+ \if@twoside
+ \ifodd\c@page
+ \noexpand\TSD@correct@odd
+ \else
+ \noexpand\TSD@correct@even
+ \fi
+ \else
+ \noexpand\TSD@correct@even
+ \fi{\the\c@MacroEnvironment}%
+ }%
+ }%
+ \@tempa
+ \endgroup
+}
+\def\TSD@correct@odd#1{%
+ \if@twoside
+ \ifodd\c@page
+ \@percentchar
+ \else
+ \string\TSD@nameglet{TSD@#1}\string\@secondoftwo
+ \fi
+ \else
+ \string\TSD@nameglet{TSD@#1}\string\@secondoftwo
+ \fi
+}
+\def\TSD@correct@even#1{%
+ \if@twoside
+ \ifodd\c@page
+ \string\TSD@nameglet{TSD@#1}\string\@firstoftwo
+ \else
+ \@percentchar
+ \fi
+ \else
+ \@percentchar
+ \fi
+}
+\def\TSD@nameglet#1{\global\expandafter\let\csname#1\endcsname}
+
+
+\long\def\m@cro@#1#2{\endgroup
+ \topsep\MacroTopsep
+ \trivlist
+ \setlength\labelsep{\z@}%
+ \refstepcounter{MacroEnvironment}%
+ \@ifundefined{TSD@\the\c@MacroEnvironment}{%
+ \if@twoside
+ \ifodd\c@page
+ \TSD@rightmargin@true
+ \else
+ \TSD@rightmargin@false
+ \fi
+ \else
+ \TSD@rightmargin@false
+ \fi
+ }{%
+ \@nameuse{TSD@\the\c@MacroEnvironment}%
+ \TSD@rightmargin@true \TSD@rightmargin@false
+ }%
+ \edef\saved@macroname{\string#2}%
+ \if@inlabel
+ \def\@tempa{{%
+ \noexpand\MacroFont
+ \dimen@=\macro@line@cnt\baselineskip
+ \advance\dimen@ \macro@cnt\jot
+ \vskip\dimen@
+ }}%
+ \else
+ \let\@tempa\@empty
+ \macro@cnt\z@
+ \fi
+ \edef\makelabel##1{%
+ \noexpand\hb@xt@\z@{%
+ \ifTSD@rightmargin@
+ \hskip\textwidth\hskip\marginparsep
+ \else
+ \hss
+ \fi
+ \vtop to\z@{\noexpand\null
+ \vskip-\baselineskip\@tempa
+ \hbox{\noexpand\TSD@correct@side##1}%
+ \vss
+ }%
+ \ifTSD@rightmargin@
+ \hss
+ \else
+ \hskip\marginparsep
+ \fi
+ }%
+ }%
+ \edef\@tempa{%
+ \noexpand\item[%
+ #1%
+ \noexpand\PrintMacroName
+ \else
+ \noexpand\PrintEnvName
+ \fi
+ {\string#2}%
+ ]%
+ }%
+ \@tempa
+ \advance\macro@cnt \@ne
+ \advance\macro@line@cnt \TSD@prevgraf\relax
+ \global\advance\c@CodelineNo\@ne
+ #1%
+ \SpecialMainIndex{#2}\nobreak
+ \DoNotIndex{#2}%
+ \else
+ \SpecialMainEnvIndex{#2}\nobreak
+ \fi
+ \global\advance\c@CodelineNo\m@ne
+ \ignorespaces
+}
+
+
+\def\Describe@Macro#1{\endgroup
+ \marginpar%
+ [%
+ \TSD@rightmargin@false\noindent
+ \PrintDescribeMacro{#1}]%
+ {%\tracingmacros=\@ne
+ \TSD@rightmargin@true\noindent
+ \PrintDescribeMacro{#1}}%
+ \SpecialUsageIndex{#1}%
+ \@esphack\ignorespaces
+}
+\def\Describe@Env#1{\endgroup
+ \marginpar%
+ [\TSD@rightmargin@false\noindent
+ \PrintDescribeEnv{#1}]%
+ {\TSD@rightmargin@true\noindent
+ \PrintDescribeEnv{#1}}%
+ \SpecialEnvIndex{#1}%
+ \@esphack\ignorespaces
+}
+% The \noindent:s are necessary, since \marginpar forms a \vtop, not an
+% \hbox. This is important if \PrintDescribeMacro/Env starts with \raise.
+
+
+\let\ifTSD@setpdimens\relax
+\let\TSD@setpdimenstrue\relax
+\let\TSD@setpdimensfalse\relax
+
+\endinput \ No newline at end of file
diff --git a/macros/latex/contrib/relenc/README b/macros/latex/contrib/relenc/README
new file mode 100644
index 0000000000..a2db7e2a85
--- /dev/null
+++ b/macros/latex/contrib/relenc/README
@@ -0,0 +1,139 @@
+This relenc package is released under the LaTeX Project Public
+License, version 1 or (at your option) any later version.
+
+ABSTRACT:
+What in my opinion is one of the most irritating limitations with the
+standard encodings used with LaTeX today is that they either have very
+few slots available for ligatures or offer no way in which LaTeX can make
+use all those accented character glyphs that fonts usually come equipped
+with. The relenc package makes it possible to get around this by
+introducing the concept of a relaxed encoding. Unlike normal encodings,
+relaxed encodings give the font designer (or whoever is setting up the
+font for use with LaTeX) a saying on what the author commands setting text
+from the fonts should really do to get their work done. This can be used
+to make more slots available for ligatures without more than marginally
+changing the visible result of any command.
+
+One such relaxed encoding is included with the relenc package: the T1R
+encoding. It behaves like T1 to the author, but allows the font designer to
+include some 60 ligatures in the font (T1 only allows seven). Note however
+that it is up to the font designer to decide how those 60 slots should be
+used, so any subset of them can just as well be used for accented letters.
+
+The package also comes with a font family called zcm, which exists only to
+provide an example of what can be done with the relenc package. This
+example can be viewed if you typeset the file reldemo.tex, but before you
+do that you need to have docstrip generate some other files. That will be
+done automatically if you run LaTeX on relenc.ins.
+
+
+The distribution of the package roughly consists of four logical parts:
+The first part is the package itself and its documentation, the second is
+the T1R encoding, the third is the zcm font family, and the fourth consists
+of files related to the distribution in general. The files in all four
+parts are listed and described below. All these files should be present in
+the distribution. If you recieve only some of these files from someone,
+then complain.
+
+The files in the fourth part are:
+
+README This file
+relenc.ins The docstrip installation script for the package and
+ accompanying files. This script extracts files for parts
+ one, two, and three from their respective documented source
+ files.
+
+The files in the first part are:
+
+relenc.dtx The documented source file for the relenc package.
+relenc.tex The complete documentation. The appendices of this document
+ even contain the documentation for the T1R encoding and zcm
+ font family, but that text is located in the files
+ t1renc.dtx and t1rzcm.fdd.
+2sidedoc.sty A LaTeX2e package used when typesetting relenc.tex and
+ relenc.dtx. See [1] below.
+
+
+The file in the second part is:
+
+t1renc.dtx The specification of the T1R encoding and the documented
+ source for its encoding definition file.
+
+The files in the third part are:
+
+t1rzcm.fdd A short description of the zcm font family and the
+ documented source for its font definition file.
+reldemo.tex A file that generates an example of what can be done with
+ the relenc package.
+zcmr8d.tfm \ The actual font files for the zcm font family.
+zcmr8d.vf | PLEASE NOTE: These files are binary files and must be
+zcmr8d.vf2 | transferred as such. If TeX, while typesetting
+zcmr8d.vf3 \ reldemo.tex, stops and complains about "Bad metric (TFM)
+zcmra.tfm / file" then these files have most likely been damaged in
+zcmra.vf | some way. This sort of thing is usually caused by the
+zcmra.vf2 | files being FTPed as text files instead of binary
+zcmra.vf3 / files. ALSO NOTE: You only need four of these for any
+ given TeX installation, but different installations need
+ different subsets of them. See the documentation (typeset
+ relenc.tex or t1rzcm.fdd) for more information.
+
+The files docstrip generate from the documented source files above are:
+
+relenc.sty This is the relenc package itself.
+t1renc.def This is the encoding definition file for the T1R encoding.
+t1rzcm.fd This is the font definition file for the zcm font family
+ under the T1R encoding.
+ecsubzcm.sty This is a helper package, that may be useful for those who
+ uses the T1R encoding but prefer not to have the zcm font
+ family around.
+
+A simple installation:
+
+ Files to put in some TeX inputs directory:
+ relenc.sty
+ t1renc.def
+ t1rzcm.fd
+
+ Files to put in some directory where TeX and DVI drivers looks for
+ TeX font metric (TFM) files:
+ zcmr8d.tfm
+ zcmra.tfm
+
+ Files to put in some directory where DVI drivers looks for virtual font
+ (VF) files:
+ zcmr8d.vf
+ zcmra.vf
+
+
+
+[1] The usage of the 2sidedoc package here is merely to split some of my
+ overlong macro names on more than one line, but I originally wrote it
+ to get a better layout on files documented with the doc package when
+ printing them in twoside mode. 2sidedoc sees to that the macro and
+ environment names printed in the margin by the commands in doc always
+ end up in the outer margin (instead of the left margin as with the
+ naked doc package) when the class operates in twoside mode.
+
+ One funny thing about the package is that it writes information in the
+ aux file to help it figure out (for each piece of marginal material)
+ which margin is the outer. Due to this you may have to typeset a
+ document more than one time before the placing gets correct
+ everywhere, but that is the same kind of problem you'll be used to
+ get with incorrect page references, so we all know we can live with it.
+
+ I intend to make a proper release of the 2sidedoc package sometime,
+ but first I will have to do something about the placement of codeline
+ numbers as well. As it turns out, the codeline numbers will assume the
+ role of an optical axis on the page; marking the boundary between the
+ body text and marginal material parts of the paper. This means that
+ these codeline numbers will have to change side depending on whether
+ the page is odd or even as well, just like the marginal material, and
+ I haven't gotten round to implementing a mechanism for this yet.
+
+ Still, there is no harm in using the package as it is. If you put its
+ \usepackage somewhere after that of doc, then it will modify the doc
+ macros that needs to be modified. You don't notice much of it however,
+ unless you are typesetting with twosided printing active.
+
+
+Lars Hellström
diff --git a/macros/latex/contrib/relenc/reldemo.tex b/macros/latex/contrib/relenc/reldemo.tex
new file mode 100644
index 0000000000..c918a90030
--- /dev/null
+++ b/macros/latex/contrib/relenc/reldemo.tex
@@ -0,0 +1,440 @@
+\documentclass{article}
+
+\usepackage{relenc}
+\usepackage[T1R,OT1]{fontenc}
+ % ot1enc.def is inputed since I still want OT1 to be the default
+ % encoding in this document.
+
+
+\makeatletter
+
+% General font parameters:
+\newdimen\demofontem \newdimen\demofontex \newskip\demofontspace
+
+ % This macro sets the font parameters for the current font, using
+ % default values if the \fontdimen values are too strange (probably
+ % because the font is a raw font not meant for typesetting).
+\def\setfontparams{%
+% \sbox{\letterbox}{a}% Make sure the font really is loaded (?)
+ \ifdim 0.1pt<\fontdimen6\font % Quad width
+ \setlength\demofontem{1em}%
+ \else
+ \demofontem=\f@size\p@
+ \fi
+ \ifdim0.1pt<\fontdimen5\font % x-height
+ \setlength\demofontex{1ex}%
+ \else
+ \demofontex=0.4\demofontem
+ \fi
+ \ifdim0.1pt<\fontdimen2\font % Interword space natural width
+ \setlength\demofontspace{\fontdimen2\font plus\fontdimen3\font
+ minus\fontdimen4\font
+ }%
+ \else
+ \setlength\demofontspace{0.2222\demofontem
+ plus0.1111\demofontem minus0.05555\demofontem
+ }%
+ \fi
+}
+
+% Generating the font table:
+\newcount\slotnbr \newcount\rownbr \newcount\colnbr
+\newdimen\thinlinesize \newdimen\thicklinesize \newdimen\squarewidth
+\newsavebox\letterbox
+\setlength\thinlinesize{0.24pt}
+\setlength\thicklinesize{0.75pt}
+\mathchardef\tablecolumns=16
+
+\def\linespreadstrut{\vrule height2.5\demofontex depth1.5\demofontex width0pt}
+\def\emptyrowrule{\rlap{\vrule height2.5\demofontex depth-2\demofontex
+ width\thinlinesize}\vrule height-1\demofontex depth1.5\demofontex
+ width\thinlinesize
+}
+\def\stdtext#1{{\normalfont#1}}
+\def\tttext#1{{\normalfont\ttfamily#1}}
+ % Used on things that should not be typeset in the demo font.
+
+\def\nextslot{%
+ \sbox{\letterbox}{\unhbox\letterbox
+ \hb@xt@\squarewidth{\hss\linespreadstrut\char\slotnbr\hss}%
+ \vrule width\thinlinesize
+ }%
+ \global\advance \slotnbr \@ne
+}
+\def\rowheading{%
+ \hb@xt@1.5\demofontem{\hss
+ \linespreadstrut
+ \stdtext{\strut\the\slotnbr}\hskip0.2\demofontem
+ }%
+}
+\def\makebodyrow{\colnbr=\z@
+ \sbox{\letterbox}{%
+ \rowheading
+ \vrule width\thicklinesize
+ }%
+ \loop
+ \nextslot
+ \advance \colnbr \@ne
+ \ifnum \tablecolumns>\colnbr \repeat
+ \box\letterbox
+}
+\def\emptybodyrow{%
+ \hbox{%
+ \sbox\letterbox{%
+ \colnbr=\z@
+ \loop
+ \hskip\squarewidth
+ \advance \colnbr \@ne
+ \ifnum \tablecolumns>\colnbr
+ \vrule width\thinlinesize height\demofontex depth\z@
+ \repeat
+ }%
+ \tabskip=\z@skip
+ \valign{\vfil##\vfil\cr
+ \rowheading\cr
+ \noalign{\vrule width\thicklinesize}%
+ \relax\offinterlineskip
+ \halign{\hfil##\hfil\cr \copy\letterbox\cr
+ \noalign{\vfill}\stdtext{\strut These slots are empty}\cr
+ \noalign{\vfill}\box\letterbox\cr
+ }\cr
+ \noalign{\vrule width\thinlinesize}%
+ \cr
+ }%
+ }%
+ \global\advance \slotnbr \tablecolumns
+}
+\def\bodyrow{%
+ \setbox\letterbox=\hbox{%
+ \colnbr=\z@
+ \penalty\@ne
+ \loop
+ \char\slotnbr
+ \advance \slotnbr \@ne %Note: Non-global advancement
+ \advance \colnbr \@ne
+ \ifnum \tablecolumns>\colnbr \repeat
+ \ifnum \@ne=\lastpenalty % Are all characters in the row missing?
+ \def\next{iffalse}% Yes
+ \else
+ \def\next{iftrue}% No
+ \fi
+ \expandafter
+ }%
+ \csname\next\endcsname % Will be either \iftrue or \iffalse.
+ \makebodyrow
+ \else
+ \emptybodyrow
+ \fi
+ \hrule height\thinlinesize
+}
+\def\toprow{%
+ \colnbr=\z@
+ \sbox{\letterbox}{%
+ \hb@xt@1.5\demofontem{\hss\linespreadstrut}%
+ \vrule width\thicklinesize
+ }%
+ \loop
+ \sbox{\letterbox}{%
+ \unhbox\letterbox
+ \hb@xt@\squarewidth{\hss\linespreadstrut
+ \stdtext{\the\colnbr}\hss
+ }%
+ \vrule width\thinlinesize
+ }%
+ \advance \colnbr \@ne
+ \ifnum \tablecolumns>\colnbr \repeat
+ \box\letterbox
+ \hrule height\thicklinesize
+}
+\def\MakeFontTable{%
+ \medskip
+ \setlength{\squarewidth}{1.6\demofontem}%
+ \hb@xt@\linewidth{\hss
+ \vbox{%
+ \tracinglostchars=\z@
+ \global\slotnbr=\z@
+ \toprow
+ \rownbr=\z@
+ \loop
+ \begingroup\bodyrow\endgroup
+ \advance \rownbr \@ne
+ \ifnum 16>\rownbr \repeat
+ }%
+ \hss
+ }
+ \par\bigskip
+}
+
+
+% Lists of symbols:
+
+% A list of symbols consists of a sequence of \do{<symbol>} units,
+% where <symbol> can be one (or possibly several) of the following:
+% a category 11 or 12 token, such as `a' or `!'; a \chardef control
+% sequence such as `\&'; a LaTeX symbol command such as \textsterling.
+% (You can actually use a lot of stupid things in a <symbol> and still
+% have it work, but don't be surprised if it won't for something
+% that does not fit the above description.)
+
+\newcommand\AddToList[2]{%
+ \relax % Can't hurt.
+ \ifx\relax#1
+ \def#1{\do{#2}}%
+ \else
+ \expandafter\def \expandafter#1\expandafter{#1\do{#2}}%
+ \fi
+}
+
+\def\OTOneBasicLettersListUC{%
+ \do{A}\do{B}\do{C}\do{D}\do{E}\do{F}\do{G}\do{H}\do{I}\do{J}\do{K}%
+ \do{L}\do{M}\do{N}\do{O}\do{P}\do{Q}\do{R}\do{S}\do{T}\do{U}\do{V}%
+ \do{W}\do{X}\do{Y}\do{Z}\do{\AE}\do{\OE}\do{\O}%
+}
+\let\TOneBasicLettersListUC=\OTOneBasicLettersListUC
+\AddToList\TOneBasicLettersListUC{\DH}
+\AddToList\TOneBasicLettersListUC{\DJ}
+\AddToList\TOneBasicLettersListUC{\L}
+\AddToList\TOneBasicLettersListUC{\NG}
+\AddToList\TOneBasicLettersListUC{\SS}
+\AddToList\TOneBasicLettersListUC{\TH}
+
+\def\OTOneBasicLettersListLC{%
+ \do{a}\do{b}\do{c}\do{d}\do{e}\do{f}\do{g}\do{h}\do{i}\do{j}\do{k}%
+ \do{l}\do{m}\do{n}\do{o}\do{p}\do{q}\do{r}\do{s}\do{t}\do{u}\do{v}%
+ \do{w}\do{x}\do{y}\do{z}\do{\ae}\do{\i}\do{\j}\do{\oe}\do{\o}%
+ \do{\ss}%
+}
+\let\TOneBasicLettersListLC=\OTOneBasicLettersListLC
+\AddToList\TOneBasicLettersListLC{\dh}
+\AddToList\TOneBasicLettersListLC{\dj}
+\AddToList\TOneBasicLettersListLC{\l}
+\AddToList\TOneBasicLettersListLC{\ng}
+\AddToList\TOneBasicLettersListLC{\th}
+
+\def\OTOneAccentsList{%
+ \do{\@firstofone}% This is a "no accent" accent.
+ \do{\`}\do{\'}\do{\^}\do{\~}\do{\"}\do{\H}\do{\r}%
+ \do{\v}\do{\u}\do{\=}\do{\.}\do{\b}\do{\c}\do{\d}%
+}
+\let\TOneAccentsList=\OTOneAccentsList
+\AddToList\TOneAccentsList{\k}
+
+\newcommand\ApplyListToList[3]{%
+ % The first list here, which is given as #1, should really be a list
+ % of one-parameter commands. The second list, which should be given
+ % as #2, should be a normal list of symbols. Each command of the first
+ % list is applied to the symbols in the second list. #3 is inserted
+ % after every such application.
+ \def\do##1{{\def\do####1{##1{####1}#3}#2}}%
+ #1%
+}
+
+\newcommand\MakeTOneAccentedTable{%
+ \medskip
+ \ApplyListToList{\TOneAccentsList}{%
+ \TOneBasicLettersListLC\par\TOneBasicLettersListUC\par
+ }{\-}%
+ \bigskip
+}
+\newcommand\MakeOTOneAccentedTable{%
+ \medskip
+ \ApplyListToList{\OTOneAccentsList}{%
+ \OTOneBasicLettersListLC\par\OTOneBasicLettersListUC\par
+ }{\-}%
+ \bigskip
+}
+
+
+\let\TOneLeftGlyphsListLC=\TOneBasicLettersListLC
+\AddToList\TOneLeftGlyphsListLC{ff}
+
+\let\OTOneLeftGlyphsListLC=\OTOneBasicLettersListLC
+\AddToList\OTOneLeftGlyphsListLC{ff}
+
+\newcommand\ListTimesList[3]{%
+ % This "generates" the Cartesian product of two lists: For each \do in
+ % the first list a copy of the second list appears, and for each \do
+ % in the second list the current element from the first list is
+ % inserted. As with \ApplyListToList, #3 is inserted at the end of each
+ % \do from the second list.
+ \def\do##1{{\def\do####1{##1####1#3}#2}}%
+ #1%
+}
+
+\newcommand\MakeTOnePairsTable{%
+ \medskip
+ \ListTimesList{\TOneLeftGlyphsListLC}{\TOneBasicLettersListLC\par}{%
+ \hskip\demofontspace
+ }%
+ \smallskip
+ \ListTimesList{\TOneBasicLettersListUC}{\TOneBasicLettersListLC\par}{%
+ \hskip\demofontspace
+ }%
+ \smallskip
+ \ListTimesList{\TOneBasicLettersListUC}{\TOneBasicLettersListUC\par}{%
+ \hskip\demofontspace
+ }%
+ \bigskip
+}
+
+\newcommand\MakeOTOnePairsTable{%
+ \medskip
+ \ListTimesList{\OTOneLeftGlyphsListLC}{\OTOneBasicLettersListLC\par}{%
+ \hskip\demofontspace
+ }%
+ \smallskip
+ \ListTimesList{\OTOneBasicLettersListUC}{\OTOneBasicLettersListLC\par}{%
+ \hskip\demofontspace
+ }%
+ \smallskip
+ \ListTimesList{\OTOneBasicLettersListUC}{\OTOneBasicLettersListUC\par}{%
+ \hskip\demofontspace
+ }%
+ \bigskip
+}
+
+
+\def\OTOneSymbolsList{\do{\textemdash}\do{\textendash}%
+ \do{\textexclamdown}\do{\textquestiondown}\do{\textquotedblleft}%
+ \do{\textquotedblright}\do{\textquoteleft}\do{\textquoteright}%
+ \do{\textdollar}\do{\textsterling}%
+}
+\let\TOneSymbolsList=\OTOneSymbolsList
+\AddToList\TOneSymbolsList{\guillemotleft}
+\AddToList\TOneSymbolsList{\guillemotright}
+\AddToList\TOneSymbolsList{\guilsinglleft}
+\AddToList\TOneSymbolsList{\guilsinglright}
+\AddToList\TOneSymbolsList{\quotedblbase}
+\AddToList\TOneSymbolsList{\quotesinglbase}
+\AddToList\TOneSymbolsList{\textasciicircum}
+\AddToList\TOneSymbolsList{\textasciitilde}
+\AddToList\TOneSymbolsList{\textbackslash}
+\AddToList\TOneSymbolsList{\textbar}
+\AddToList\TOneSymbolsList{\textbraceleft}
+\AddToList\TOneSymbolsList{\textbraceright}
+\AddToList\TOneSymbolsList{\textcompwordmark}
+\AddToList\TOneSymbolsList{\textgreater}
+\AddToList\TOneSymbolsList{\textless}
+\AddToList\TOneSymbolsList{\textperthousand}
+\AddToList\TOneSymbolsList{\textpertenthousand}
+\AddToList\TOneSymbolsList{\textquotedbl}
+\AddToList\TOneSymbolsList{\textsection}
+\AddToList\TOneSymbolsList{\textunderscore}
+\AddToList\TOneSymbolsList{\textvisiblespace}
+
+
+\newcommand\MakeOTOneSymbolsTable{\MakeSymbolsTable\OTOneSymbolsList}
+\newcommand\MakeTOneSymbolsTable{\MakeSymbolsTable\TOneSymbolsList}
+\newcommand\MakeSymbolsTable[1]{%
+ \begingroup
+ \def\do##1{\tttext{\string##1}&##1\cr}%
+ \tabskip=\hideskip
+ \halign to\linewidth{##\hfil \tabskip=\ht\strutbox&
+ \hfil##\hfil \tabskip=\hideskip\cr
+ \stdtext{\TeX\ code}&\stdtext{Symbol}\cr
+ #1%
+ }%
+ \endgroup
+ \par\bigskip
+}
+
+
+% Combining it all
+
+\newcommand\DemoTOneLaTeXFont[4]{%
+ \vfil\penalty0\vfilneg
+ \markright{\stdtext{Demo of \LaTeX\ font \ttfamily #1/#2/#3/#4}\hss}%
+ \begingroup
+ \usefont{#1}{#2}{#3}{#4}%
+ \setfontparams
+ \noindent\stdtext{\textbf{Font table}}\par
+ \MakeFontTable
+ \noindent\stdtext{\textbf{Accents/letters table}}\par
+ \MakeTOneAccentedTable
+ \noindent\stdtext{\textbf{Pairs tables}}\par
+ \MakeTOnePairsTable
+ \noindent\stdtext{\textbf{Symbols table}}\par
+ \MakeTOneSymbolsTable
+ \ifx \TOneDemoText\@undefined \else
+ \medskip\TOneDemoText\medskip
+ \fi
+ \endgroup
+}
+\newcommand\DemoOTOneLaTeXFont[4]{
+ \vfil\penalty0\vnegfil
+ \markright{\stdtext{Demo of \LaTeX\ font \ttfamily #1/#2/#3/#4}\hss}%
+ \begingroup
+ \usefont{#1}{#2}{#3}{#4}%
+ \setfontparams
+ \noindent\stdtext{\textbf{Font table}}\par
+ \MakeFontTable
+ \noindent\stdtext{\textbf{Accents/letters table}}\par
+ \MakeOTOneAccentedTable
+ \noindent\stdtext{\textbf{Pairs tables}}\par
+ \MakeOTOnePairsTable
+ \noindent\stdtext{\textbf{Symbols table}}\par
+ \MakeOTOneSymbolsTable
+ \ifx \OTOneDemoText\@undefined \else
+ \medskip\OTOneDemoText\medskip
+ \fi
+ \endgroup
+}
+\newcommand\DemoRawTeXFont[1]{\begingroup
+ \font\demofont=#1\relax
+ \demofont
+ \setfontparams
+ \MakeFontTable
+ \endgroup
+}
+
+\makeatother
+
+\pagestyle{myheadings}
+
+\begin{document}
+\errorcontextlines=999\relax
+
+You should at least read Appendix C of the package documentation
+before viewing this example, but if you prefer not to then I must at
+least point out that the fonts in the \texttt{zcm} family are mainly
+\texttt{cmr10} that has been completed with various ``faked''
+characters. As a result, many of the characters does not look very
+good and some look downright ugly, but there is no particular harm in
+that since the \texttt{zcm} fonts are not intended to be used in any
+serious typesetting anyway.
+
+The first font in the \texttt{zcm} family---the \texttt{T1R}\slash
+\texttt{zcm}\slash\texttt{m}\slash\texttt{n} font---has a coding scheme
+identical to that used for fonts in the \texttt{T1} encoding. It
+shows the default setup for the \texttt{T1R} encoding.
+
+The font table shows the contents of each slot. The accents/letters
+table shows the result of the non-accented letters as they are and
+their appearence after having been subjected to each accenting command
+in turn. The pairs tables shows all the ligatures and the symbols
+table finally shows the symbol commands and their effect.
+
+\bigskip
+\DemoTOneLaTeXFont{T1R}{zcm}{m}{n}
+
+The second font in the \texttt{zcm} family---the \texttt{T1R}\slash
+\texttt{zcm}\slash\texttt{m}\slash\texttt{a} font---has four extra
+ligatures: ct, fj, ffj, and st. These appear in the font table at
+positions 128, 130, 131, and 161. Despite the fact that four of the
+characaters that were used for making accented letters in the
+\texttt{T1R}\slash\texttt{zcm}\slash\texttt{m}\slash\texttt{n} font are
+missing however, the accents/letters table for the \texttt{T1R}\slash
+\texttt{zcm}\slash\texttt{m}\slash\texttt{a} font display the same accented
+letters as the ditto table for the \texttt{T1R}\slash\texttt{zcm}\slash
+\texttt{m}\slash\texttt{n} font did. Under the \texttt{T1} encoding,
+the result would instead have been that some of the accented letters
+would incorrectly have been replaced by the ligatures.
+
+The pairs tables show that the four extra ligatures work as ligatures
+and the symbols table looks exactly as for the \texttt{T1R}\slash
+\texttt{zcm}\slash\texttt{m}\slash\texttt{n} font.
+
+\bigskip
+\DemoTOneLaTeXFont{T1R}{zcm}{m}{a}
+
+\end{document}
diff --git a/macros/latex/contrib/relenc/relenc.dtx b/macros/latex/contrib/relenc/relenc.dtx
new file mode 100644
index 0000000000..28700b68fb
--- /dev/null
+++ b/macros/latex/contrib/relenc/relenc.dtx
@@ -0,0 +1,1549 @@
+%% \CheckSum{724}
+% \iffalse (Comment)
+% This is the code for the relenc package, with doc style comments.
+% \fi
+%
+% \iffalse (Driver code)
+% (The driver is enclosed in a macrocode environment, even though the
+% iffalse will make \TeX\ skip past it, just in case.)
+% \begin{macrocode}
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{2sidedoc}
+\newcommand\B{\penalty300\relax}
+\newcommand\package[1]{\textsf{#1}}
+\title{\texttt{relenc.dtx}}
+\author{Lars Hellstr\"om%
+ \thanks{E-mail: \texttt{Lars.Hellstrom@math.umu.se}}%
+}
+\date{1999/01/23}
+\begin{document}
+\maketitle
+\DocInput{relenc.dtx}
+\begin{thebibliography}{99}
+%
+\bibitem{ltoutenc}
+ Johannes Braams, David Carlisle, Alan Jeffrey, Frank Mittelbach,
+ Chris Rowley, Rainer Sch\"opf: \texttt{ltoutenc.dtx} (part of the
+ \LaTeXe\ base distribution).
+%
+\bibitem{fontinst}
+ Alan Jeffrey, Rowland McDonnell (manual), Sebastian Rahtz,
+ Ulrik Vieth: \emph{The fontinst utility} (v\,1.8),
+ \texttt{fontinst.dtx}, in CTAN at \texttt{ftp:/\slash
+ ftp.tex.ac.uk\slash tex-archive\slash fonts\slash utilities\slash
+ fontinst\slash}\textellipsis
+%
+\bibitem{fntguide}
+ \LaTeX3 Project Team: \emph{\LaTeXe\ font selection},
+ \texttt{fntguide.tex} (part of the \LaTeXe\ base distribution).
+%
+\bibitem{encguide}
+ Frank Mittelbach [et al. ?]: \texttt{encguide.tex}. To appear as
+ part of the \LaTeXe\ base distribution. Sometime. Or at least, that
+ is the intention.
+%
+\end{thebibliography}
+\end{document}
+%</driver>
+% \end{macrocode}
+% \fi
+%
+% \StopEventually{}
+%
+% \section{Implementation}
+% \label{Implementation}
+%
+% \iffalse (Comment)
+% The following code really belong in the preamble, but since there
+% are two documents which contain the text in this file, I prefer to
+% put the code in one place instead.
+% \fi
+% \makeatletter
+% \def\gobble@zeroX#10X{}
+% \newcommand\St@rtShowGeneric[1]{^^A
+% \begin{list}{}{^^A
+% \@beginparpenalty=\predisplaypenalty
+% \@endparpenalty=\postdisplaypenalty
+% \@itempenalty=100\relax
+% \setlength\leftmargin\z@
+% \setlength\rightmargin\z@
+% \setlength\listparindent\z@
+% \setlength\parsep\z@skip
+% \setlength\itemsep\z@skip
+% \MacroFont
+% \frenchspacing
+% }^^A
+% \ifnum#1<\@ne\else
+% \item[]\leavevmode
+% \rlap{
+% \count@=\z@
+% \loop
+% \ \advance\count@\@ne
+% \if \expandafter\gobble@zeroX \the\count@ X0XXX^^A
+% ^^A \the\count@ does not end with 0.
+% \else
+% \hb@xt@\z@{{\hss\normalfont\tiny\the\count@\hss}}^^A
+% \fi
+% \ifnum\count@<#1\relax\repeat
+% \llap{\strut\vrule}^^A
+% }^^A
+% \fi
+% \def\mynewline{\unskip\hfil\penalty-\@M\vadjust{}}
+% \set@display@protect
+% }
+% \newcommand\ShowGenericError[5][0]{^^A
+% \St@rtShowGeneric{#1}^^A
+% \item[]^^A
+% \def\MessageBreak{\mynewline#2}^^A
+% ! #3.\mynewline\mynewline
+% #4\mynewline
+% Type H <return> for immediate help\mynewline
+% \ ...\mynewline\mynewline
+% I.100\mynewline\mynewline
+% \item[]^^A
+% \def\MessageBreak{\mynewline}^^A
+% ? h\mynewline
+% #5\mynewline
+% \end{list}^^A
+% }
+% \newcommand{\ShowGenericWarningOrInfo}[3][0]{^^A
+% \St@rtShowGeneric{#1}^^A
+% \item[]^^A
+% \def\MessageBreak{\mynewline#2}^^A
+% #3.\par
+% \end{list}
+% }
+% \newcommand{\ShowPackageError}[4][0]{^^A
+% \ShowGenericError[#1]{^^A
+% (#2)\@spaces\@spaces\@spaces\@spaces
+% }{^^A
+% Package #2 Error: #3^^A
+% }{^^A
+% See the #2 package documentation for explanation.^^A
+% }{#4}^^A
+% }
+% \newcommand\ShowPackageWarning[3][0]{^^A
+% \ShowGenericWarningOrInfo[#1]{^^A
+% (#2)\@spaces\@spaces\@spaces\@spaces
+% }{^^A
+% Package #2 Warning: #3^^A
+% }^^A
+% }
+% \newcommand\ShowPackageInfo[3][0]{^^A
+% \ShowGenericWarningOrInfo[#1]{^^A
+% (#2) \@spaces\@spaces\@spaces
+% }{^^A
+% Package #2 Info: #3^^A
+% }^^A
+% }
+% \makeatother
+%
+%
+% \subsection{Initial stuff}
+% The obligatory header code for a \LaTeXe\ package.
+% \begin{macrocode}
+%<*package>
+\NeedsTeXFormat{LaTeX2e}[1994/06/01]
+\ProvidesPackage{relenc}[1999/01/23]
+% \end{macrocode}
+% \bigskip
+%
+% At the moment, there are no options for the \package{relenc} package.
+%
+%
+% \subsection{Variables and similar things}
+%
+% \begin{macro}{\RE@temptoks}
+% |\RE@temptoks| is used by the basic search mechaism to store
+% the part of the search path that has not yet been used.
+% \begin{macrocode}
+\newtoks\RE@temptoks
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\RE@garbage}
+% The |\RE@garbage| macro is used as a target for some assignments that
+% really shouldn't be made, but where a mechanism for detecting this
+% would not be worth the cost. It is also used as a temporary storage
+% by some definition commands.
+% \end{macro}
+% \begin{macro}{\RE@first@search@item}
+% During a search, the |\RE@first@search@item| macro will expand the
+% first item in the search path. This is needed for the define first
+% mechanism to work.
+% \end{macro}
+% \begin{macro}{\RE@define@first}
+% The |\RE@define@first| macro works like a switch. If it is
+% |\RE@active@define|\B|@first| then the define first mechanism is
+% active: If the search does not find anything on the first try but
+% finds something later then the first command in the search path gets
+% |\let| to whatever the search finds. If |\RE@define@first| is
+% |\@gobbletwo| then the define first mechanism is inactive and nothing
+% happens. This construction allows for other possibilities as well.
+%
+% The initial setting is |\@gobbletwo|, i.e., off.
+% \begin{macrocode}
+\let\RE@define@first\@gobbletwo
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Search mechanisms for variable commands}
+%
+% Variable commands are intended to be used as definitions of
+% encoding-specific commands or compositions of such. Thus variable
+% commands are actually instances of some user level command, which is
+% not the same \TeX\ control sequence as the variable command itself.
+%
+% A variable command is defined to be a parameterless macro whose
+% expansion consists of two tokens. The first is |\RE@text@variable| if
+% the command is not a composition and it is |\RE@text@comp@variable| if
+% the command is a composition. The second token is the user level
+% command itself; this command will not be expanded, its name is merely
+% used as a word-stem from which names of possible variants are formed.
+% Thus if the definition of the user level command |\foo| in the
+% \texttt{T1R} encoding (which would be stored in the control sequence
+% |\T1R\foo|) would be a variable command, that definition would be
+% \begin{quote}
+% |\RE@text@variable|\,|\foo|
+% \end{quote}
+%
+%
+% \subsubsection{Identifying the search path and initiating the search}
+% \begin{macro}{\RE@text@variable}
+% \begin{macro}{\RE@text@comp@variable}
+% \begin{macro}{\RE@spath@unavailable}
+% \begin{macro}{\RE@spath@available}
+% The first thing |\RE@text@variable| must do is to find the
+% search path to use. It might be either a family-specific search
+% path, in which case it is stored in the macro
+% |\|\meta{encoding}|/|\meta{family}\texttt{-path},
+% or the general search path for the entire encoding, in which case
+% it is stored in the macro |\|\meta{encoding}\texttt{-path}.
+% If the family-specific search path exists, it is chosen. If neither
+% exists, this is an error which is reported.
+%
+% The second thing |\RE@text@variable| does is setting up the
+% search along the search path. This is by expanding to
+% \begin{quote}
+% |\RE@first@read@spath|\,\meta{search path}\,^^A
+% |\RE@read@spath|
+% \end{quote}
+% which starts the next phase of the search.
+%
+% \begin{macrocode}
+\def\RE@text@variable{%
+ \expandafter\ifx \csname\cf@encoding/\f@family-path\endcsname \relax
+ \expandafter\ifx \csname\cf@encoding-path\endcsname \relax
+ \RE@spath@unavailable
+ \else
+ \RE@spath@available\RE@first@read@spath\RE@read@spath
+ \fi
+ \else
+ \expandafter\expandafter \expandafter\RE@first@read@spath
+ \csname\cf@encoding/\f@family-path\expandafter\endcsname
+ \expandafter\RE@read@spath
+ \fi
+}
+% \end{macrocode}
+% Hackers may find a few things in the definition a little strange.
+% To begin with, I use |\cf@encoding|\label{Why cf@encoding}
+% for the name of the current
+% encoding, although \cite{fntguide} says that |\f@encoding|
+% is defined as precisely that. I too find this a little odd, but the
+% corresponding routines in the \LaTeXe\ kernel use |\cf@encoding|
+% (see~\cite{ltoutenc}) so I suppose that is safer, for some
+% reason. I believe the only time at which |\cf@encoding| and
+% |\f@encoding| are different is during a font change, but I might
+% be mistaken about that.
+%
+% The usage of |\RE@spath@unavailable| and |\RE@spath@available|
+% might also be confusing, but the alternative to this is heavily
+% nested |\expandafter| sequences, and those things are not easy to
+% read. Besides, |\RE@spath@unavailable| must do something with the
+% initial command token anyway, because |\RE@text|\B|@variable| does
+% not move it.
+%
+% |\RE@spath@available| have two real arguments: The initial search
+% command header (which can be |\RE@first@read@spath| or
+% |\RE@first@comp@read|\B|@spath|) and the initial search command tail
+% (which can be |\RE@read@spath| or |\RE@comp@read@spath|). The other
+% arguments are ``dummys'' used to remove unvanted tokens.
+%
+% All arguments of |\RE@spath@unavailable| are such dummys.
+%
+% \begin{macrocode}
+\def\RE@spath@available#1#2#3\fi#4\fi{\fi\fi
+ \expandafter\expandafter \expandafter#1%
+ \csname\cf@encoding-path\endcsname#2%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\RE@spath@unavailable#1\fi#2\fi#3{%
+ \fi\fi
+ \PackageError{relenc}{%
+ There is no search path for relaxed encoding \cf@encoding%
+ }\@eha
+}
+% \end{macrocode}
+%
+% Example error message:
+% \ShowPackageError{relenc}{There is no search path for relaxed
+% encoding XX}{\csname @eha\endcsname}
+%
+% The reason that |\RE@text@comp@variable| and |\RE@text@variable|
+% exist as separate macros is that there are separate commands
+% |\RE@first@comp|\B|@read|\B|@spath| and |\RE@first@read@spath| at
+% the next stage of the search process.
+%
+% \begin{macrocode}
+\def\RE@text@comp@variable{%
+ \expandafter\ifx \csname\cf@encoding/\f@family-path\endcsname \relax
+ \expandafter\ifx \csname\cf@encoding-path\endcsname \relax
+ \RE@spath@unavailable
+ \else
+ \RE@spath@available\RE@first@comp@read@spath\RE@comp@read@spath
+ \fi
+ \else
+ \expandafter\expandafter \expandafter\RE@first@comp@read@spath
+ \csname\cf@encoding/\f@family-path\expandafter\endcsname
+ \expandafter\RE@comp@read@spath
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsubsection{Performing the search}
+%
+% Between the steps of the second stage of the search, the initial
+% font-dependent command (|\foo| say) will have expanded to
+% \begin{quote}
+% \meta{search header}\,\meta{remaining search path}\,^^A
+% \meta{search tail}\,|\foo|
+% \end{quote}
+% The \meta{search header} can be one of |\RE@read@spath|,
+% |\RE@first@read@spath|, |\RE@comp@read@spath|, and
+% |\RE@first@comp@read@spath|. The \meta{search tail} can be either
+% |\RE@read@spath| or |\RE@comp@read@spath|.
+%
+% The \meta{search path} consists mainly of a sequence of blocks that
+% looks as follows
+% \begin{quote}
+% |{| \meta{character tokens, macros} |}|
+% \end{quote}
+% The macros should also expand to character tokens. At each step, the
+% first of these blocks is extracted as the |#1| argument of the search
+% header. The remaining blocks are put in the |#2| argument and if no
+% definition is found then these will be the \meta{remaining search path}
+% to use when setting up for the next step. For the moment, it is put
+% away in the token list register |\RE@temptoks|.
+%
+% Argument |#1| is first checked for whether the
+% control sequence formed by expanding
+% \begin{quote}
+% |\csname|\,|#1|\,|\string|\,|#3|\,|\endcsname|
+% \end{quote}
+% (|#3| is the control sequence named |\foo| above) exists. If it does,
+% it is assumed to be the definition of |\foo| for the current font,
+% otherwise everything is set up for the next step using the
+% \meta{remaining search path} as search path.
+%
+% There is no check to see if |#2| is empty, so if the entire search path
+% consisted of blocks like the one above, using a font-dependent command
+% for which no definition has been given would cause an infinite loop.
+% There is however a hack which prevents this: When a search path is set
+% using the proper command, the control sequence |\RE@var@not@found| is
+% appended to the search path. Primarily, this macro is a hack that
+% prevents the search loop from going haywire, but it also has the
+% advantage of stopping the expansion of the search header from stripping
+% off the braces around the last group prematurely (when
+% \begin{quote}
+% |\RE@read@spath|\,|{a}|\,|{b}|\,|{cd}|\,|\RE@read@spath|\,|\foo|
+% \end{quote}
+% is expanded |#1| will be |a| and |#2| will be |{b}|\,|{cd}|, but when
+% \begin{quote}
+% |\RE@read@spath|\,|{b}|\,|{cd}|\,|\RE@read@spath|\,|\foo|
+% \end{quote}
+% is expanded |#1| will be |b| and |#2| will be |cd|, so the next time
+% round, |#1| will be |c| and |#2| will be |d|---the last group has been
+% split---but if the last item in the search path is not a group, but a
+% single token, there is no group to split).
+%
+% \begin{macro}{\RE@read@spath}
+% \begin{macro}{\RE@first@read@spath}
+% \begin{macro}{\RE@comp@read@spath}
+% \begin{macro}{\RE@first@comp@read@spath}
+% Considering their usage only, the difference between |\RE@read@spath|
+% and |\RE@comp|\B|@read|\B|@spath| is that |\RE@read@spath| is used
+% for actual font-dependent commands while |\RE@comp@read@spath| is
+% used for compositions of a font-dependent command and its argument.
+% In that case, the third argument will not be |\foo| but rather
+% something like |\\foo-a| (a single control sequence, the first
+% backslash is the escape character and the second is part of the
+% actual name); this particular case occurs when the user has written
+% |\foo|\,|{a}|).
+%
+% If, on the other hand, their definitions are looked at, the
+% difference is that while |\RE@read@spath| checks if the expansion of
+% \begin{quote}
+% |\csname|\,|#1|\,|\string|\,|#3|\,|\endcsname|
+% \end{quote}
+% is defined, |\RE@comp@read@spath| checks if the expansion of
+% \begin{quote}
+% |\csname|\,|#1|\,|\@empty\|\,|string|\,|#3|\,|\endcsname|
+% \end{quote}
+% is defined. In most cases, these expand to the same thing (since
+% |\@empty| is a parameterless macro which expands to nothing), but
+% sometimes one needs to write a |#1| which gives somewhat different
+% results depending on whether |#3| is a command or a composition.
+% These blocks in the search path can now simply test whether the token
+% after the parameter is |\@empty| or |\string|. The two macros that
+% currently do this are |\RE@var@not@found| and |\RE@convert@nfss|.
+%
+% The difference between |\RE@read@spath| and |\RE@first@read@spath|
+% is that the latter is used in the first step, while the former is
+% used in all the other steps. This difference exists because of the
+% define first mechanism: If |\RE@first|\B|@read|\B|@spath| finds a
+% definition in the first step, there is no need to call the mechanism
+% no matter what the value of |\RE@define@first| is, but if
+% |\RE@first@read@spath| does not find a definition then it must store
+% the first block of the search path for a possible future use by
+% |\RE@active@define@first|. |\RE@read@spath|, on the other hand,
+% should never store a search path block, but if it finds a
+% definition then it should call |\RE@define@first| since the define
+% first mechanism might be active.
+%
+% Quite naturally, |\RE@comp@read@spath| relates to
+% |\RE@first@comp@read@spath| as |\RE@read@spath| to
+% |\RE@first@read@spath| and |\RE@first@comp@read@spath| relates to
+% |\RE@first@read@spath| as |\RE@comp@read@spath| to |\RE@read@spath|
+% [phew!].
+%
+% \begin{macrocode}
+\def\RE@read@spath#1#2\RE@read@spath#3{%
+ \RE@temptoks={#2}%
+ \expandafter\ifx \csname#1\string#3\endcsname \relax
+ \expandafter\RE@read@spath \the\expandafter\RE@temptoks
+ \expandafter\RE@read@spath \expandafter#3%
+ \else
+ \RE@define@first{#1}{#3}%
+ \csname#1\string#3\expandafter\endcsname
+ \fi
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\RE@first@read@spath#1#2\RE@read@spath#3{%
+ \RE@temptoks={#2}%
+ \expandafter\ifx \csname#1\string#3\endcsname \relax
+ \def\RE@first@search@item{#1}%
+ \expandafter\RE@read@spath \the\expandafter\RE@temptoks
+ \expandafter\RE@read@spath \expandafter#3%
+ \else
+ \csname#1\string#3\expandafter\endcsname
+ \fi
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\RE@comp@read@spath#1#2\RE@comp@read@spath#3{%
+ \RE@temptoks={#2}%
+ \expandafter\ifx \csname#1\@empty\string#3\endcsname \relax
+ \expandafter\RE@comp@read@spath \the\expandafter\RE@temptoks
+ \expandafter\RE@comp@read@spath \expandafter#3%
+ \else
+ \RE@define@first{#1\@empty}{#3}%
+ \csname#1\@empty\string#3\expandafter\endcsname
+ \fi
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\RE@first@comp@read@spath#1#2\RE@comp@read@spath#3{%
+ \RE@temptoks={#2}%
+ \expandafter\ifx \csname#1\@empty\string#3\endcsname \relax
+ \def\RE@first@search@item{#1\@empty}%
+ \expandafter\RE@comp@read@spath \the\expandafter\RE@temptoks
+ \expandafter\RE@comp@read@spath \expandafter#3%
+ \else
+ \csname#1\@empty\string#3\expandafter\endcsname
+ \fi
+}
+% \end{macrocode}
+%
+% The definition of |\RE@read@spath| is not quite trivial. It must
+% not leave any |\fi| up ahead, since everything should eventually
+% expand to the actual definition of the searched-for command, and
+% this is very likely to have parameters. There must be no surplus
+% tokens between this command and its arguments; this is why
+%\begin{verbatim}
+% \def\RE@read@spath#1#2\RE@read@spath#3{%
+% \RE@temptoks={#2}%
+% \expandafter\ifx \csname#1\string#3\endcsname \relax
+% \expandafter\RE@read@spath\the\RE@temptoks\RE@read@spath#3%
+% \else
+% \RE@define@first{#1}{#3}%
+% \csname#1\string#3\endcsname
+% \fi
+% }
+%\end{verbatim}
+% would not do as a definition of |\RE@read@spath|.
+%
+% A definition that would work is
+%\begin{verbatim}
+% \def\RE@read@spath#1#2\RE@read@spath#3{%
+% \expandafter\ifx \csname#1\string#3\endcsname \relax
+% \expandafter\@firstoftwo
+% \else
+% \expandafter\@secondoftwo
+% \fi{%
+% \RE@read@spath#2\RE@read@spath#3%
+% }{%
+% \RE@define@first{#1}{#3}%
+% \csname#1\string#3\endcsname
+% }%
+% }
+%\end{verbatim}
+% but I prefer the ``save away'' definition since it makes a few
+% additional features possible; the most important perhaps being that
+% it gives a chance to peek in afterwards and see where the search
+% ended (using |\ShowVariantSearchResult|).
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsubsection{Miscellaneous search-related macros}
+%
+% \begin{macro}{\RE@active@define@first}
+% \begin{macro}{\RE@again@read@spath}
+% |\RE@active@define@first| is the macro which performs the actual
+% assignments done by the define first mechanism, if it is active.
+% The macro simply expands to the suitable global assignment; |#1| is
+% the block from the search path that found a definition (with
+% |\@empty| added if the search was for a composition) and |#2| is the
+% command or composition whose definition was searched.
+%
+% \begin{macrocode}
+\def\RE@active@define@first#1#2{%
+ \global\expandafter\let
+ \csname\RE@first@search@item\string#2\expandafter\endcsname
+ \csname#1\string#2\endcsname
+}
+% \end{macrocode}
+% In some cases, the scan of the search path is resumed after a
+% variant has been found. This is made possible by the fact that the
+% remaining serach path is stored in |\RE@temptoks|, but the define
+% first mechanism adds a complication. It cannot be allowed to copy a
+% variant other than the first in the search path as that could
+% actually change the effect of a command.
+%
+% The typical case here (the only one possible to define using user
+% level commands of \package{relenc}) is that a command has two
+% variants, one of which is composed and one which is not. The
+% composed occurs before the noncomposed and the default definition of
+% the composed is to resume the scan of the search path. If the
+% command is executed for an argument for which there is no
+% composition, an active define first mechanism will hide all
+% composite definitions!
+%
+% Thus the define first mechanism must be temporarily disabled.
+% One way to do this is to put a dummy value in
+% |\RE@first@search@item|, and this solution is implemented in
+% |\RE@again@read@spath|.\label{RE@again@read@spath}
+% \begin{macrocode}
+\def\RE@again@read@spath{%
+ \def\RE@first@search@item##1\expandafter\endcsname{%
+ RE@garbage\expandafter\endcsname
+ }%
+ \expandafter\RE@read@spath \the\RE@temptoks \RE@read@spath
+}
+% \end{macrocode}
+% \end{macro}\end{macro}
+%
+%
+% \begin{macro}{\RE@var@not@found}
+% \begin{macro}{\RE@gobble@readspath}
+% \begin{macro}{\RE@text@comp@unavail}
+% These macros put a graceful end to a search that has found
+% nothing. When |\RE@var@not@found|, which should be the very last token
+% in every search path (it is automatically added by
+% |\SetEncodingSearchPath| and |\SetFamilySearchPath|), is expanded
+% it should appear in the following context
+% \begin{quote}
+% |\expandafter|\,|\ifx|\,|\csname|\,|\RE@var@not@found|\,^^A
+% \meta{optional \cs{@empty}}\\
+% |\string|\,\meta{command or composition}\,|\endcsname|
+% \end{quote}
+% As |\RE@var@not@found| inserts an additional |\endcsname| and |\fi|
+% when expanded by the |\csname|, the entire |\ifx| is finished
+% before \TeX{} gets to |\RE@gobble|\B|@readspath|. There are however
+% a lot of mismatched tokens left over by |\RE@var@not@found|, some of
+% which will be used in composing the error message.
+%
+% \begin{macrocode}
+\def\RE@var@not@found{relax\endcsname\relax\fi
+ \RE@gobble@readspath
+}
+% \end{macrocode}
+%
+% When |\RE@gobble@readspath| is expanded, it is in the context
+% \begin{quote}
+% |\RE@gobble@readspath|\,\meta{optional \cs{@empty}}\,^^A
+% |\string|\\ \meta{command or composition}\,^^A
+% |\endcsname|\,\meta{some text}\,|\fi|
+% \end{quote}
+% The |\fi| is the |\fi| that originally matched the |\ifx| mensioned
+% above.
+%
+% The |\@empty| is there iff \meta{command or composition} is a
+% composition. If it is, this composition is |\string|ed and the
+% first backslash is thrown away. Then the remaining `other' tokens
+% are given to |\RE@text@comp@unavail| which will figure out what is
+% the original command and what is its argument. If it is not a
+% composition, the command is given to |\TextSymbolUnavailable|. In
+% any case, everything up to and including the |\fi| disappears.
+%
+% \begin{macrocode}
+\def\RE@gobble@readspath#1\string#2\endcsname#3\fi{%
+ \ifx\@empty#1%
+% \end{macrocode}
+% If |#2| is a composition then
+% \begin{macrocode}
+ \expandafter\expandafter \expandafter\RE@text@comp@unavail
+ \expandafter\@gobble \string#2\RE@text@comp@unavail
+ \else
+ \TextSymbolUnavailable{#2}%
+ \fi
+}
+% \end{macrocode}
+%
+% As there is a hyphen between the original command and its argument,
+% |\RE@text@comp@unavail| splits the name of the composition at the
+% first hyphen. This is the right thing to do as long as |-| is not
+% used as part of the name of the original command (unlikely, as
+% \LaTeX\ does not define |\-| as an encoding-specific command).
+%
+% \begin{macrocode}
+\def\RE@text@comp@unavail#1-#2\RE@text@comp@unavail{%
+ \PackageError{relenc}{%
+ The composition of command #1 with #2\MessageBreak is declared %
+ in encoding \cf@encoding,\MessageBreak but no definition could %
+ be found%
+ }\@eha
+}
+% \end{macrocode}
+%
+% Example error text:
+% \iffalse Some editing is necessary to compensate for the \catcode
+% differences.\fi
+%
+% \ShowPackageError{relenc}{The composition of command
+% \protect\foo\space with A\MessageBreak is declared in encoding
+% XXX,\MessageBreak but no definition could be found}
+% {\csname@eha\endcsname}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsection{Making variable text commands}
+%
+% \subsubsection{Miscellaneous support macros}
+%
+% \begin{macro}{\RE@empty@is@qmark}
+% Expands to its argument if that is nonempty, otherwise it expands
+% to |?|. This macro is primarily meant to be used inside a |\csname|
+% \textellipsis\ |\endcsname| block. As always, an ingenious fool might
+% break it, but a category 3 |^^M| is extremely unlikely (and hard to
+% type), so it should work for any reasonable argument.
+% \begin{macrocode}
+\begingroup
+ \lccode`\$=13\relax
+ \lowercase{%
+ \gdef\RE@empty@is@qmark#1{\ifx$#1$?\else#1\fi}%
+ }
+\endgroup
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RE@font@spec}
+% This macro concatenates the four parameters \meta{encoding},
+% \meta{family}, \meta{series}, and \meta{shape} into
+% \package{relenc}'s name for this font, i.e., puts slashes between
+% the arguments and replaces every empty argument with a question mark.
+% \begin{macrocode}
+\def\RE@font@spec#1#2#3#4{%
+ \RE@empty@is@qmark{#1}/\RE@empty@is@qmark{#2}/%
+ \RE@empty@is@qmark{#3}/\RE@empty@is@qmark{#4}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RE@bsl@string}
+% One thing which complicates the definition of the definition commands
+% (which must work even if they appear in a font definition file) is
+% that \LaTeX\ has the naughty habit of changing the \TeX\ parameter
+% |\escapechar| when it is defing a new font (loading the
+% corresponding font definition file). The |\escapechar| parameter
+% decides which character, if any, should be put in front of a control
+% sequence name which is |\string|ed or written to the log file as
+% part of some |\tracing|\textellipsis\ operation. (To see this effect
+% yourself, set |\tracingmacros| positive just before a font change
+% that loads a new font definition file (better reset it to zero
+% after the font change though) and have a look at the log
+% file---throughout a large chunk of logged macro expansions there
+% are no backslashes on the command names!) The reason I don't
+% like this is that (i) it doesn't achieve anything that couldn't just
+% as well be achieved by a combination of |\expandafter| and gobbling
+% of unwanted tokens and (ii) some font definition files are read by
+% \LaTeX\ having |\escapechar| set to its normal value, so you can't
+% trust it either way!
+%
+% Still, that is how \LaTeX\ does it and this must somehow be coped
+% with. The |\RE@bsl@string| macro acts like |\string| but inserts a
+% backslash in front of control sequence names even when |\string|
+% wouldn't insert anything there. It is used instead of |\string| in
+% all defining commands.
+%
+% \begin{macrocode}
+\def\RE@bsl@string{%
+ \ifnum \escapechar<\z@ \@backslashchar \fi
+ \string
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsubsection{Declaration commands}
+%
+% \begin{macro}{\DeclareTextVariableCommand}
+% \begin{macro}{\DeclareTextVariableCommandNoDefault}
+% \begin{macro}{\DeclareTextVariableSymbol}
+% Two of these are the obvious counterparts of |\DeclareTextCommand|
+% and |\Declare|\B|TextSymbol|. The parameters are the same, and the
+% actual declaring (from the \LaTeXe\ kernel's point of view) is done
+% by |\DeclareTextCommand|.
+%
+% |\DeclareTextVariableCommandNoDefault| is a new possibility that
+% exists since a relaxed encoding definition file need not actually
+% specify the definition of any font-dependent command. It can, for
+% example, specify that ``Unless otherwise stated, use the definition
+% from encoding \textellipsis{} ''.
+%
+% As the ordinary counterparts of these commands are preamble
+% commands, I have made these preamble commands as well.
+% \begin{macrocode}
+\newcommand\DeclareTextVariableCommand{\RE@dec@text@varcmd\newcommand}
+\@onlypreamble\DeclareTextVariableCommand
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\DeclareTextVariableCommandNoDefault{%
+ \RE@dec@text@varcmd\@gobble
+}
+\@onlypreamble\DeclareTextVariableCommandNoDefault
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\DeclareTextVariableSymbol[3]{%
+ \RE@dec@text@varcmd\chardef#1{#2}#3\relax
+}
+\@onlypreamble\DeclareTextVariableSymbol
+% \end{macrocode}
+% \begin{macrocode}
+\def\RE@dec@text@varcmd#1#2#3{%
+ \DeclareTextCommand{#2}{#3}{\RE@text@variable#2}%
+ \expandafter#1\csname#3/?/?/?\string#2\endcsname
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\ProvideTextVariableCommand}
+% This is the variable counterpart of |\ProvideTextCommand|, and it
+% has the same set of parameters. Its definition is a bit more
+% complicated than that of the earlier commands for declaring variable
+% font-dependent commands, partly because |\ProvideTextCommand| does
+% not tell whether the definition it provided was used, but also
+% becuase this command need not be meaningless even if the
+% font-dependent command it should declare already was declared.
+%
+% If the font-dependent command is not declared (the
+% |\|\meta{encoding}|\|\meta{command} control sequence is |\relax|),
+% |\ProvideTextCommand| is used to declare it and |\providecommand|
+% is used to give an encoding level definition. If the font-dependent
+% command was declared and variable, then |\providecommand| is still
+% called, to give an encoding-level definition of the command in
+% case there wasn't already one. Otherwise
+% it must have been declared as a non-variable font-dependent command
+% and the following info message is given:
+% \ShowPackageInfo{relenc}{You have provided a declaration of
+% \protect\foo\space in\MessageBreak encoding T1R as a
+% variable command, but it was\MessageBreak already declared
+% as a non-variable command.\MessageBreak Your declaration
+% has been ignored}
+% In this case, the slight problem of the left-over definition
+% remains. This is taken care of by giving it to |\providecommand| as
+% a definition of |\RE@garbage| (which was introduced for this kind
+% of tasks).
+%
+% |\ProvideTextCommand| is not a preamble-only command, so I have
+% left |\ProvideTextVariableCommand| free to use anywhere too, although
+% I cannot see why it should be needed after |\begin|\,|{document}|.
+% \begin{macrocode}
+\newcommand\ProvideTextVariableCommand[2]{%
+ \expandafter\ifx \csname#2\string#1\endcsname \relax
+ \ProvideTextCommand#1#2{\RE@text@variable#1}%
+ \expandafter\providecommand
+ \csname#2/?/?/?\string#1\expandafter\endcsname
+ \else
+ \long\def\RE@garbage{\RE@text@variable#1}%
+ \expandafter\ifx \csname#2\string#1\endcsname \RE@garbage
+ \expandafter\providecommand
+ \csname#2/?/?/?\string#1\expandafter\expandafter
+ \expandafter\endcsname
+ \else
+ \PackageInfo{relenc}{You have provided a declaration of
+ \protect#1 in\MessageBreak encoding #2 as a variable
+ command, but it was\MessageBreak already declared as a
+ non-variable command.\MessageBreak Your declaration has
+ been ignored}%
+ \expandafter\providecommand
+ \csname RE@garbage\expandafter\expandafter
+ \expandafter\endcsname
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \iffalse
+% A command that was later scrapped, as it turned out it wasn't needed:
+% % \newcommand{\DeclareTextComposableVariable}[3]{%
+% % \DeclareTextCommand{#1}{#2}[1]{\RE@text@variable#1{##1}}%
+% % \expandafter\newcommand \csname#2/?/?/?\string#1\endcsname [1]{#3}%
+% % }
+% % \@onlypreamble\DeclareTextComposableVariable
+% \fi
+%
+% \begin{macro}{\DeclareTextVariableAccent}
+% This is the variable counterpart of |\DeclareTextAccent|, and again
+% this counterpart has the same parameters as its non-variable model.
+% Also, it is a preamble-only command, just as its model.
+% \begin{macrocode}
+\newcommand{\DeclareTextVariableAccent}[3]{%
+ \DeclareTextCommand{#1}{#2}{\RE@text@variable#1}%
+ \expandafter\newcommand \csname#2/?/?/?\string#1\endcsname
+ {\add@accent{#3}}%
+}
+\@onlypreamble\DeclareTextVariableAccent
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Definition commands}
+%
+% There is an important difference between the declaration commands and
+% the definition commands, and this has to do with when they are
+% executed. A definition command usually appears in a \texttt{.fd}
+% file, which is read in inside a group (usually several, but that is
+% irrelevant), but the definitions it makes should be in force after the
+% group has ended. Therefore the definitions must be global, but the
+% |\newcommand| family of \LaTeX\ definition commands only make local
+% definitions. Because of this, I have chosen to primarily use the
+% \TeX\ primitive |\gdef| and its relatives in the definition commands,
+% although in several cases \LaTeX-style alternatives are available as
+% well.
+%
+% \begin{macro}{\DefineTextCommandVariant}
+% The basic defintion command, |\gdef| style. As simple as it can
+% be, but note that the \meta{parameter text} does not become one of
+% the arguments of the macro. This has some consequences for when
+% spaces are ignored.
+% \begin{macrocode}
+\newcommand{\DefineTextCommandVariant}[5]{%
+ \expandafter\gdef
+ \csname\RE@font@spec{#2}{#3}{#4}{#5}\RE@bsl@string#1\endcsname
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DefineTextSymbolVariant}
+% The basic command for defining a text symbol command.
+% \begin{macrocode}
+\newcommand{\DefineTextSymbolVariant}[6]{%
+ \global\expandafter\chardef
+ \csname\RE@font@spec{#2}{#3}{#4}{#5}\RE@bsl@string#1\endcsname
+ =#6\relax
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DefineTextAccentVariant}
+% The basic command for defining an accent command. Very much a
+% special case of |\DefineTextCommandVariant|.
+% \begin{macrocode}
+\newcommand{\DefineTextAccentVariant}[6]{%
+ \expandafter\gdef
+ \csname\RE@font@spec{#2}{#3}{#4}{#5}\RE@bsl@string#1\endcsname
+ {\add@accent{#6}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NewTextCommandVariant}
+% \begin{macro}{\RenewTextCommandVariant}
+% \begin{macro}{\ProvideTextCommandVariant}
+% \begin{macro}{\RE@make@text@cmd@variant}
+% \begin{macro}{\RE@make@text@cmd@var@x}
+% These commands are the \LaTeX-style commands to define variable
+% font-dependent commands. As the \LaTeX\ commands they are built on is
+% not really meant to be used for global definitions, this involves
+% some hacking (using the \LaTeX\ core's private control sequences to
+% do things they are not meant to do, for example). Everything would
+% have been much simpler if the autoload format hook |\aut@global| had
+% been available in all \LaTeX\ formats, but it is not. The purpose of
+% |\RE@make@text@cmd@variant| is to save some |\csname| \ldots\
+% |\endcsname| pairs, the real defining is done by
+% |\RE@make@text@cmd@var@x|.
+% \begin{macrocode}
+\CheckCommand*{\newcommand}{\@star@or@long\new@command}
+\newcommand{\NewTextCommandVariant}
+ {\RE@make@text@cmd@variant\new@command}
+% \end{macrocode}
+% \begin{macrocode}
+\CheckCommand*{\renewcommand}{\@star@or@long\renew@command}
+\newcommand{\RenewTextCommandVariant}
+ {\RE@make@text@cmd@variant\renew@command}
+% \end{macrocode}
+% \begin{macrocode}
+\CheckCommand*{\providecommand}{\@star@or@long\provide@command}
+\newcommand{\ProvideTextCommandVariant}
+ {\RE@make@text@cmd@variant\provide@command}
+% \end{macrocode}
+% \begin{macrocode}
+\def\RE@make@text@cmd@variant#1#2#3#4#5#6{%
+ \expandafter\RE@make@text@cmd@var@x
+ \csname\RE@font@spec{#3}{#4}{#5}{#6}\RE@bsl@string#2\endcsname
+ {#1}%
+}
+% \end{macrocode}
+% Instead of |\aut@global|, |\l@ngrel@x| is used as a hook. |\l@ngrel@x|
+% is defined to be a macro whose last action is to execute |\global|. As
+% |\l@ngrel@x| appears just before the central |\def|, this makes that
+% definition global in exactly those cases where the definition is made.
+% This requires that the topmost layer of |\newcommand| (and its cousins),
+% the one in which the |*|-processing takes place, is stepped over.
+% Otherwise the definition of |\l@ngrel@x| would be reset.
+%
+% If the command has an optional argument, however, a simple
+%\begin{verbatim}
+% \def\l@ngrel@x{\global}
+%\end{verbatim}
+% is not sufficient. In that case the command the user issues is only a
+% preparation that inserts the default optional argument if none is
+% present and issues the real command (the name of the real command is
+% the name of the user command with an extra backslash prepended to it).
+%
+% The real command will be globally defined, thanks to the |\global|
+% at the end of |\l@ngrel@x|, but the preparation command is at the time
+% of |\l@ngrel@x| only locally defined. This is why |\l@ngrel@x| |\let|s
+% the preparation command to itself globally, this preserves the
+% definition but makes it global. If the command does not have an optional
+% argument, this does no harm as the incorrect definition is overwritten
+% with the correct just after |\l@ngrel@x|.
+%
+% Finally, |\l@ngrel@x| resets itself to |\relax|, in case something
+% expects it to be |\long| or |\relax|. As |\l@ngrel@x| is not reset
+% if no command definition takes place, there is a slight chance of
+% error in that case, but at least all \LaTeX\ core user commands reset
+% it before using so the hack should not have any side-effects.
+% \begin{macrocode}
+\def\RE@make@text@cmd@var@x#1#2{%
+ \def\l@ngrel@x{%
+ \global\let#1#1%
+ \let\l@ngrel@x\relax
+ \global
+ }%
+ #2#1%
+}
+% \end{macrocode}
+% To examine sometime: Can |\globaldefs=1| be used instead here? As
+% that makes all assignments global, there is a definite chance it
+% might break something else.
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \iffalse
+% An auxillary command that has been scrapped.
+% % \begin{macro}{\RE@globalize@if@defined}
+% % This command globally |\let|s its argument to itself, if it is
+% % defined. This makes the definition of the argument global,
+% % regardless of whether the definition was local or global earlier.
+% % \begin{macrocode}
+% \def\RE@globalize@if@defined#1{%
+% \ifx#1\relax\else
+% \global\let#1#1%
+% \fi
+% }
+% % \end{macrocode}
+% % \end{macro}
+% \fi
+%
+%
+% \subsection{Making compositions of font-dependent commands}
+
+% \begin{macro}{\RE@if@composed}
+% This is a general test to see if a macro is a command that is set
+% up for having compositions, i.e., if the expansion of the macro
+% begins with |\@text@composite|. This is the same test as is used in
+% |\DeclareTextCompositeCommand|.
+%
+% The syntax is as follows:
+% \begin{quote}
+% |\RE@if@composed|\,\meta{command}\,\marg{then-text}\,^^A
+% \marg{else-text}
+% \end{quote}
+% expands to \meta{then-text} if \meta{command} can have
+% compositions and to \meta{else-text} otherwise.
+% \begin{macrocode}
+\def\RE@if@composed#1{%
+ \expandafter\expandafter \expandafter\ifx
+ \expandafter\@car #1\relax\relax\@nil \@text@composite
+% \end{macrocode}
+% If it is composite then \textellipsis
+% \begin{macrocode}
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Commands for compositions that are variable}
+%
+% The \LaTeXe\ kernel's method of forming the names of compositions is
+% to |\string| the name of the base command and append |-|\meta{argument}
+% to that, all of which is then |\csname|d. This generates names like
+% \begin{quote}
+% |\\T1\foo-a|
+% \end{quote}
+% for the command |\foo|'s composition with the argument |a| in the |T1|
+% encoding. As the \LaTeXe\ kernel's mechanism for checking for
+% compositions is used for compositions that have variable definitions
+% as well, the names of these commands are formed using the same
+% procedure.
+%
+% Should then the names of the variants of the composition be generated
+% from names as the above, then these names would be things like
+% \begin{quote}
+% |\T1R/zcm/m/n\\T1R\foo-a|
+% \end{quote}
+% which is a bit longish, even for my taste. Therefore the names of the
+% variants are formed from a base consisting only of the name of the
+% font-dependent command and its argument, which is |\\foo-a| in the above
+% example. This reduces the above to
+% \begin{quote}
+% |\T1R/zcm/m/n\\foo-a|
+% \end{quote}
+% saving two to four characters. This difference in naming does however
+% have some consequences for the usage of definitions from a non-relaxed
+% encoding.
+%
+%
+% If, for example, |{T1}| is included in the current search path and a
+% definition of the composition |\foo|\,|{a}| is looked for, a possible
+% definition of this in the |T1| encoding will not be found! This is
+% because the name tried is |\T1\\foo-a|, but the command is called
+% |\\T1\foo-a|. This is the reason for the macro |\RE@convert@nfss|,
+% which looks ahead to see if a composition or a plain command is
+% currently looked for. Had instead |{\RE@convert@nfss|\,|{T1}}| been
+% included, |\T1\\foo-a| would have been changed to |\\T1\foo-a|.
+%
+% \begin{macro}{\DeclareVariableTextComposition}
+% \begin{macro}{\RE@dec@var@text@comp}
+% This is the variable analog of \LaTeX's |\DeclareTextCompositeCommand|,
+% although it is somewhat less as it does not make a default
+% definition for the composition. Thus it is also an analog of
+% |\DeclareTextVariableCommandNoDefault| for compositions.
+% \begin{macrocode}
+\newcommand{\DeclareVariableTextComposition}[3]{%
+ \expandafter\RE@dec@var@text@comp
+ \csname\string#1-#3\expandafter\endcsname
+ \csname\@backslashchar#2\string#1-#3\endcsname
+ {#1}{#2}{#3}%
+}
+% \end{macrocode}
+% As |\DeclareVariableTextComposition| merely make a few combinations of
+% its arguments and then call |\RE@dec@var@text@comp|, the arguments of
+% the latter are worth an explanation. Continuing the above example of
+% |\foo|\,|{a}| in the |T1R| encoding, the arguments will be
+% \begin{quote}
+% \begin{tabular}{r@{ is }l r@{ is }l r@{ is }l}
+% |#1|&|\\foo-a|& |#2|&|\\T1R\foo-a| &\omit\span\omit\\
+% |#3|&|\foo|& |#4|&|T1R|& |#5|&|a|
+% \end{tabular}
+% \end{quote}
+%
+% Should the composition already have been declared, but the
+% definition is not variable, that definition is made the encoding
+% level definition and the composition is made variable. If the
+% definition is variable, an info message is given and the
+% definition is not changed.
+% \begin{macrocode}
+\def\RE@dec@var@text@comp#1#2#3#4#5{%
+ \ifx#2\relax
+% \end{macrocode}
+% If this composition has not been declared then \textellipsis
+% \begin{macrocode}
+ \DeclareTextCompositeCommand{#3}{#4}{#5}%
+ {\RE@text@comp@variable#1}%
+ \else
+ \expandafter\expandafter \expandafter\ifx
+ \expandafter\@car#2\@nil
+ \RE@text@variable
+% \end{macrocode}
+% If this composition is variable then \textellipsis
+% \begin{macrocode}
+ \PackageInfo{relenc}{Redundant \protect
+ \DeclareVariableTextComposition.\MessageBreak
+ The composition of \protect#3 with #5 is\MessageBreak
+ already declared as a variable command\MessageBreak
+ in encoding #4%
+ }%
+ \else
+ \expandafter\let \csname#4/?/?/?\string#1\endcsname #2
+ \def#2{\RE@text@comp@variable#1}%
+ \fi
+ \fi
+}
+% \end{macrocode}
+% Example message:
+% \ShowPackageInfo{relenc}{Redundant \protect
+% \DeclareVariableTextComposition.\MessageBreak
+% The composition of \protect\foo\space with a is\MessageBreak
+% already declared as a variable command\MessageBreak
+% in encoding T1R}
+% \end{macro}\end{macro}
+%
+%
+% \begin{macro}{\DefineTextCompositionVariant}
+% \begin{macro}{\DefineTextCompositionVariantCommand}
+% \begin{macro}{\RE@def@text@comp@var}
+% These are the commands that actually define variants of compositions.
+% The first makes the variant a chardef token, the second
+% makes it a parameterless macro.
+%
+% The arguments for |\RE@def@text@comp@var| should be the following
+% things: The command that does the defining (|\chardef| or |\gdef|),
+% the base user command, the relevant encoding, family, series, and
+% shape, and finally the argument for the composition. Note that the
+% actual definition (slot number or replacement text, respectively)
+% is not among the arguments of |\RE@def@text@comp@var|.
+% \begin{macrocode}
+\newcommand\DefineTextCompositionVariant[7]{%
+ \global \RE@def@text@comp@var\chardef{#1}{#2}{#3}{#4}{#5}{#6}%
+ #7\relax
+}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\DefineTextCompositionVariantCommand{%
+ \RE@def@text@comp@var\gdef
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\RE@def@text@comp@var#1#2#3#4#5#6#7{%
+ \expandafter#1%
+ \csname
+ \RE@font@spec{#3}{#4}{#5}{#6}\@backslashchar
+ \RE@bsl@string#1-#6%
+ \endcsname
+}
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\DefineTextUncomposedVariant}
+% \begin{macro}{\RE@def@text@uncmp}
+% \begin{macro}{\RE@def@text@uncmp@x}
+% |\DefineTextUncomposedVariant| extracts the definition used for
+% arguments that does not have definitions, inserts the given
+% argument, and makes the resulting token sequence the definition of
+% the variant at hand. Doing this requires that the definition of
+% the command that the \LaTeXe\ kernel sees is taken apart, so it
+% might be worth describing how it is contructed.
+%
+% If |\foo| is composite in the |T1| encoding, |\T1\foo| is a macro
+% which expands to
+% \begin{quote}
+% |\@text@composite|\,|\T1\foo|\,|#1|\,|\@empty|\,^^A
+% |\@text@composite|\\
+% |{|\,\meta{noncomposite definition}\,|}|
+% \end{quote}
+% where \meta{noncomposite definition} is what is needed here. The
+% stuff before checks if the composition is defined, but in this case
+% things are best if that part is never expanded further that this.
+%
+% The actual ``work'' is done by |\RE@def@text@uncmp@x|, as this macro
+% contains the |\gdef| which is the only command in this that \TeX's
+% stomach sees; everything else just expands in one way or another
+% (unless the warning is issued, that of course contains some stomach
+% stuff too). |\DefineTextUncomposedVariant| makes two |\csname|s: The
+% name of the macro from which the definition is to be extracted and
+% the name of the macro to define.
+%
+% |\RE@def@text@uncmp| checks if the macro to extract from really is
+% composed, and if it is then it expands it \emph{one level}, feeding
+% it the \meta{argument} as argument. Then |\RE@def@text@uncmp@x| is
+% given this one level expansion, and the |\@text@composite|s and
+% everything between them is thrown away. The
+% \meta{noncomposite definition} is made the replacement text of a
+% |\gdef| defining the macro to be defined. If the macro to extract a
+% definition from is not composed however, a warning is given.
+%
+% As this command refers to a specific encoding's definition of a
+% command, the \meta{encoding} argument mustn't be empty.
+% \begin{macrocode}
+\newcommand\DefineTextUncomposedVariant[6]{%
+ \expandafter\RE@def@text@uncmp
+ \csname#2\RE@bsl@string#1\expandafter\endcsname
+ \csname#2/\RE@empty@is@qmark{#3}/\RE@empty@is@qmark{#4}/%
+ \RE@empty@is@qmark{#5}\@backslashchar\RE@bsl@string#1-#6%
+ \endcsname
+ {#6}{#1}{#2}%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\RE@def@text@uncmp#1#2#3#4#5{%
+ \RE@if@composed#1{%
+ \expandafter\RE@def@text@uncmp@x #1{#3}{#2}%
+ }{%
+ \PackageWarning{relenc}{There are no compositions for %
+ \protect#4 in\MessageBreak the #5 encoding. %
+ \protect\DefineTextUncomposedVariant\MessageBreak
+ makes no sense here%
+ }%
+ }%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\RE@def@text@uncmp@x\@text@composite#1\@text@composite#2#3{%
+ \gdef#3{#2}%
+}
+% \end{macrocode}
+% Example warning:
+% \ShowPackageWarning{relenc}{There are no compositions for ^^A
+% \string\foo\space in\MessageBreak the T1 encoding. ^^A
+% \string\DefineTextUncomposedVariant\MessageBreak
+% makes no sense here}
+% \end{macro}\end{macro}\end{macro}
+%
+%
+% \subsubsection{Commands for variants with compositions}
+%
+% The \package{relenc} package offers another way in which a command can
+% be defined relative to both argument and font, and that is to allow
+% variants of font-dependent commands to have compositions. It is pretty
+% similar to the usual making of composite commands in \LaTeX.
+%
+% \begin{macro}{\DefineTextVariantComposition}
+% \begin{macro}{\DefineTextVariantCompositionCommand}
+% These commands define the composition and make the variant a
+% command with compositions, if it is not already. The mechanism used
+% for compositions uses |\@text@composite|, exactly like the
+% compositions made by commands in the \LaTeXe\ kernel.
+%
+% |\DefineTextVariantComposition| makes the final definition a
+% chardef token. |\DefineTextVariantCompositionCommand| makes the
+% final definition a macro without parameters.
+%
+% An interesting point about these commands is that a variant need not
+% be defined before a composition of it is made! If this happens then
+% of course technicaly the variant gets defined, but its definition
+% for the case when that composition is not found is simply to set things
+% up for a continued scan of the search path. What makes this possible
+% is that the remaining search path is stored in |\RE@temptoks|.
+%
+% \begin{macrocode}
+\newcommand\DefineTextVariantComposition[7]{%
+ \RE@def@text@var@comp\chardef{#1}{#2}{#3}{#4}{#5}{#6}#7\relax
+}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\DefineTextVariantCompositionCommand{%
+ \RE@def@text@var@comp\gdef
+}
+% \end{macrocode}
+%
+% \begin{macro}{\RE@def@text@var@comp}
+% \begin{macro}{\RE@make@text@comp}
+% These are the macros that do the actual work. The parameters of
+% |\RE@def@text|\B|@var@comp| are the user level command, the
+% encoding, family, series, and shape in question, the argument for
+% the composition, the assignment command
+% that should define the composition, and finally
+% the text that should be put after the control sequnce of the
+% composition to complete the assignment. When the assignment command
+% is |\chardef|, as is the case when |\DefineTextVariantComposition|
+% makes the call, this is simply a \meta{number}---the slot. The extra
+% |\relax| is to stop \TeX\ from reading ahead too
+% far when looking for the end of the \meta{number}.
+%
+% The first thing |\RE@def@text@var@comp| does is to check if the
+% variant the user wants do define a composition of is defined.
+% \begin{macrocode}
+\def\RE@def@text@var@comp#1#2#3#4#5#6#7{%
+ \expandafter\let \expandafter\RE@garbage
+ \csname\RE@font@spec{#3}{#4}{#5}{#6}\RE@bsl@string#2\endcsname
+ \ifx \RE@garbage\relax
+% \end{macrocode}
+% This means the variant has not been defined. The default definition
+% given sets up a continued scan along the search path. The key macro
+% here is |\RE@again@read@spath| (the definition of which is found on
+% page \pageref{RE@again@read@spath}). It temporarily disables the
+% define first mechanism and then it expands to
+% \begin{quote}
+% |\expandafter|\,|\RE@read@spath|\,|\the|\,|\RE@temptoks|\,^^A
+% |\RE@read@spath|
+% \end{quote}
+% As the |##1| below has become |#1| when |\RE@make@text@comp| is
+% expanded, this will act as a normal |#1| in the definition
+% |\RE@make@text@comp| expands to.
+% \begin{macrocode}
+ \expandafter\RE@make@text@comp\csname
+ \RE@font@spec{#3}{#4}{#5}{#6}\RE@bsl@string#2%
+ \endcsname {\RE@again@read@spath#2{##1}}%
+% \end{macrocode}
+% Otherwise it must be checked if the variant is composed. If it is,
+% then everything is fine, if it isn't, then the current definition
+% is made the default definition.
+% \begin{macrocode}
+ \else
+ \RE@if@composed\RE@garbage{}{%
+ \expandafter\RE@make@text@comp
+ \csname
+ \RE@font@spec{#3}{#4}{#5}{#6}\RE@bsl@string#2%
+ \expandafter\endcsname
+ \expandafter{\RE@garbage{##1}}%
+ }%
+ \fi
+% \end{macrocode}
+% Then it is finally time to define the composition. This is pretty
+% straight off.
+% \begin{macrocode}
+ \global\expandafter#1\csname
+ \@backslashchar\RE@font@spec{#3}{#4}{#5}{#6}\RE@bsl@string#2-#7%
+ \endcsname
+}
+% \end{macrocode}
+% |\RE@make@text@comp| makes |#1| a composed command, with |#2| as
+% the default definition. This is exactly what the corresponding
+% command in standard \LaTeX\ does, but for some reason \LaTeX\ ^^A
+% defines this command of the fly each time it is needed.
+% \begin{macrocode}
+\def\RE@make@text@comp#1#2{%
+ \gdef#1##1{\@text@composite#1##1\@empty\@text@composite{#2}}%
+}
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}
+%
+%
+% \subsection{Miscellanenous commands}
+%
+% \subsubsection{Search paths}
+%
+% A very important thing about search paths is that they are
+% responsible for ending a search that has found nothing, as the macros
+% which actually perform the search contain no mechanism for this. The
+% easiest way to ensure this is to append the token |\RE@var@not@found|
+% to every search path set, and this is exactly what the standard
+% commands for setting search paths do. Anyone who does not use these
+% commands for setting a search path must be aware that if a search
+% path does not contain any block that ends the search then some tiny errors
+% are likely to start infinite loops.
+%
+% \begin{macro}{\SetEncodingSearchPath}
+% \begin{macro}{\SetFamilySearchPath}
+% \begin{macro}{\RE@set@spath}
+% \begin{macro}{\RE@spath@catcodes}
+% These are all fairly standard. |\RE@set@spath| does the actual
+% setting of a search path while |\SetEncodingSearchPath| and
+% |\SetFamilySearchPath| merely form the name of the macro that will
+% store the search path and temporarily change some |\catcode|s to make
+% typing the search path somewhat easier. The |\catcode|s are changed
+% by |\RE@spath@catcodes|.
+%
+% \begin{macrocode}
+\newcommand{\SetEncodingSearchPath}[1]{%
+ \begingroup
+ \RE@spath@catcodes
+ \expandafter\RE@set@spath \csname#1-path\endcsname
+}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\SetFamilySearchPath}[2]{%
+ \begingroup
+ \RE@spath@catcodes
+ \expandafter\RE@set@spath \csname#1/#2-path\endcsname
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\RE@set@spath#1#2{%
+ \gdef#1{#2\RE@var@not@found}%
+ \endgroup
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\RE@spath@catcodes{%
+ \catcode`\ =9\relax
+ \catcode`\^^I=9\relax
+ \catcode`\^^M=9\relax
+ \catcode`\@=11\relax
+ \catcode`\/=12\relax
+ \catcode`\?=12\relax
+}
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\RE@convert@nfss}
+% For some relaxed encodings, one wants the definition of a
+% font-dependent command to be identical to the definition of the command
+% in a non-relaxed encoding (this is the case with \texttt{T1R}, which
+% is designed to be a relaxed version of \texttt{T1}). As there are
+% slight differences in how the names of compositions are generated
+% between the \LaTeXe\ kernel and \package{relenc}, it would not be
+% sufficient to simply include |{T1}| in the search path of the
+% \texttt{T1R} encoding to make it use \texttt{T1}'s definitions of
+% compositions as variants of that composition. The purpose of
+% |\RE@convert@nfss| is to overcome this by changing the names of the
+% variants of compositions where required. Including
+% |\RE@convert@nfss|\,|{T1}| in the search path of \texttt{T1R} gives
+% the intended effect.
+% \begin{macrocode}
+\def\RE@convert@nfss#1#2{%
+ \ifx\@empty#2%
+ \@backslashchar#1\expandafter\expandafter \expandafter\@gobble
+ \else
+ #1\expandafter#2%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{The define first mechanism}
+%
+% \begin{macro}{\ActivateDefineFirst}
+% \begin{macro}{\DeactivateDefineFirst}
+% These commands can be used to turn the define first mechanism on and
+% off. I am not sure at the moment whether implementing it was a good
+% idea, but as it exists it might as well stay so it can be evaluated.
+%
+% It could be worth pointing out that these commands act locally. The
+% define first mechanism, on the other hand, acts globally.
+% \begin{macrocode}
+\newcommand\ActivateDefineFirst{%
+ \let\RE@define@first\RE@active@define@first
+}
+\newcommand\DeactivateDefineFirst{%
+ \let\RE@define@first\@gobbletwo
+}
+% \end{macrocode}
+% \end{macro}\end{macro}
+%
+% \subsection{Debugging}
+%
+% \begin{macro}{\ShowVariantSearchResult}
+% This command offers a way to peek into the search mechanism, and in
+% particular to see where it stopped. This command has a potential to
+% come in real handy, but note that it is the \emph{remaining search
+% path} that is shown. You do not see the block that was actually
+% used, you see all blocks that come after it.
+% \begin{macrocode}
+\newcommand{\ShowVariantSearchResult}{%
+ \immediate\write\sixt@@n{Encoding: \cf@encoding}%
+ \immediate\write\sixt@@n{Family: \f@family}%
+ \immediate\write\sixt@@n{Series: \f@series}%
+ \immediate\write\sixt@@n{Shape: \f@shape}%
+ \immediate\write\sixt@@n
+ {Remaining search path:\MessageBreak\the\RE@temptoks}%
+ \show\RE@first@search@item
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Fix for a bug in \LaTeX}
+%
+% The definition of the control sequence |\@text@composite@x| in
+% \LaTeX{}es released 1998 and earlier has a bug (number 2930 in the
+% \LaTeX\ bugs database). The definition in question is
+%\begin{verbatim}
+% \def\@text@composite@x#1#2{%
+% \ifx#1\relax
+% \expandafter#2%
+% \else
+% #1%
+% \fi}
+%\end{verbatim}
+% The problem with this definition is the |\expandafter|. According to
+% \cite{ltoutenc}, it was ``added so that less chaos ensues from the
+% misuse of this code with commands that take several arguments'', but
+% unfortunately, it was placed in a position where it can do no good.
+% |#2| is in all reasonable cases a sequence of more than one token,
+% hence the |\expandafter| will not expand the following |\else|, but
+% some token in |#2| instead! I suspect that the |\expandafter| was
+% really meant to be placed in front of the |#1|, which actually is just
+% a single token.
+%
+% As it happens, the above bug can cause some serious problems when the
+% non-composite definition of a composite command happens to be
+% variable, since the above |\expandafter| will then expand a control
+% sequence which should \emph{not} be expanded.
+%
+% \begin{macro}{\@text@composite@x}
+% The following code fixes the above bug if the \LaTeX\ used is
+% one with that bug. This is done as a curtesy to all those \LaTeX\
+% users which (like myself) are not always updating \LaTeX\ as soon
+% as a new release appears. The definition of |\@text@composite@x| is
+% checked and, if it matches the above, replaced with the fixed
+% definition.
+% \begin{macrocode}
+\def\RE@garbage#1#2{%
+ \ifx#1\relax
+ \expandafter#2%
+ \else
+ #1%
+ \fi}
+\ifx \@text@composite@x\RE@garbage
+ \def\@text@composite@x#1{%
+ \ifx #1\relax
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi
+ #1%
+ }
+\fi
+\let\RE@garbage\relax
+%</package>
+% \end{macrocode}
+% \end{macro}
+%
+\endinput
+
+
+
+
+
+
+
+
+
+
diff --git a/macros/latex/contrib/relenc/relenc.ins b/macros/latex/contrib/relenc/relenc.ins
new file mode 100644
index 0000000000..5f1678d2e3
--- /dev/null
+++ b/macros/latex/contrib/relenc/relenc.ins
@@ -0,0 +1,15 @@
+% Installation script for the relenc package and related files.
+\input docstrip
+
+% \postamble
+% ^^J\endinput
+% \endpostamble
+
+\generate{
+ \file{relenc.sty}{\from{relenc.dtx}{package}}
+ \file{t1renc.def}{\from{t1renc.dtx}{encoding}}
+ \file{t1rzcm.fd}{\from{t1rzcm.fdd}{fd}}
+ \file{ecsubzcm.sty}{\from{t1rzcm.fdd}{package}}
+}
+
+\endbatchfile \ No newline at end of file
diff --git a/macros/latex/contrib/relenc/relenc.tex b/macros/latex/contrib/relenc/relenc.tex
new file mode 100644
index 0000000000..4fda9e8d64
--- /dev/null
+++ b/macros/latex/contrib/relenc/relenc.tex
@@ -0,0 +1,1285 @@
+\documentclass[a4paper]{article}
+
+\usepackage{doc}
+% Stuff more or less from ltxdoc.cls:
+\DeclareFontShape{OT1}{cmtt}{bx}{n}{<-> ssub * cmtt/m/n}{}
+\DeclareFontShape{OT1}{cmss}{m}{it}{<->ssub*cmss/m/sl}{}
+\DeclareFontFamily{OMS}{cmtt}{\skewchar\font'60}
+\DeclareFontShape{OMS}{cmtt}{m}{n}{<-> ssub * cmsy/m/n}{}
+\DeclareFontShape{OMS}{cmtt}{bx}{n}{<-> ssub * cmsy/b/n}{}
+
+\setlength{\textwidth}{355pt}
+\addtolength\marginparwidth{30pt}
+\addtolength\oddsidemargin{20pt}
+\addtolength\evensidemargin{20pt}
+
+\makeatletter
+\def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}}
+\def\cmd@to@cs#1#2{\char\number`#2\relax}
+\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
+\makeatother
+
+\setcounter{StandardModuleDepth}{1}
+
+
+\usepackage{2sidedoc}
+
+\newcommand\B{\penalty300\relax}
+\DeclareTextFontCommand{\textcmtt}{\usefont{OT1}{cmtt}{m}{n}}
+\newcommand\package[1]{\textsf{#1}}
+\CodelineNumbered
+
+
+\makeatletter
+\newenvironment{cmdusage}{%
+ \setbox\z@=\vbox\bgroup
+ \color@begingroup
+ \hsize=0.75\textwidth
+ \parindent=-1em%
+ \everypar={\hangindent=1em\hangafter=0}%
+ \rightskip=\z@ \@plus 1fil\relax
+ \let\par\@@par
+}{%
+ \color@endgroup
+ \egroup
+ \@@par
+ \medskip
+ \noindent
+ \fbox{\usebox\z@}\@@par
+ \medskip
+}
+\makeatother
+
+\newcommand*{\marg}[1]{%
+ \begingroup\MacroFont\char`\{\endgroup
+ \meta{#1}%
+ \begingroup\MacroFont\char`\}\endgroup
+}
+\newcommand*{\oarg}[1]{%
+ \begingroup\MacroFont\char`\[\endgroup
+ \meta{#1}%
+ \begingroup\MacroFont\char`\]\endgroup
+}
+
+\MakeShortVerb{\|}
+
+
+\title{The \package{relenc} package}
+\author{Lars Hellstr\"om%
+ \thanks{E-mail: \texttt{Lars.Hellstrom@math.umu.se}}%
+}
+
+\begin{document}
+
+\maketitle
+
+\tableofcontents
+
+\section{Motivation}
+\label{Motivation}
+%
+This paper is about some shortcomings that, in my humble opinion,
+exists in the way \LaTeX\ handles fonts. I also point out a way in
+which these shortcomings can be overcome.
+
+The primary problem is ligatures, but as there are a few different
+ligature concepts that are of interest, let me begin with specifying
+my terms. A \emph{ligature} is a sequence of characters
+(almost always letters) that have been given an appearance somewhat
+different from the one the characters would have if simply put side to
+side, almost always because they would otherwise not look very
+pleasing to the eye. Despite this difference in appearence, it is
+still meant to be read as the entire character sequence, not as a
+completely new character. The canonical example of this is the `fi'
+ligature.
+
+In \TeX\ fonts, there is a special mechanism to implement this, and
+everything that is implemented using this mechanism will be
+called \emph{font ligatures}. It is almost always the case however,
+that some font ligartures are not ligatures as defined above, but
+simply a handy way to type characters that are hard or impossible to
+type using a standard keyboard; the canonical example of this is the
+`\texttt{--}' (two hyphens) to `--' (endash) conversion that is
+present in most \TeX\ fonts. Such nonproper ligatures will be called
+\emph{syntactic ligatures}, and proper ligatures will sometimes be
+called \emph{aestetic ligatures} to stress their origin.
+
+A \emph{font-dependent command} in \LaTeX\ is a command whose
+actions depend directly or indirectly on which font is the current. (I
+would not consider a command |\foo| defined by
+\begin{verbatim}
+ \def\foo{\char65 }
+\end{verbatim}
+as a font-dependent command since it always does the same thing.
+The results need not always be identical, but that is because
+the command is executed under different conditions.) An example of a
+font-dependent command is |\"|, which is (roughly) |\accent 127| when
+the current font is \texttt{OT1}-encoded and |\accent 4| when the
+current font is \texttt{T1}-encoded. (The dependence is indirect since
+the command directly depends on a macro which is set during the font
+selection process, but there is a dependence.)
+
+For the purposes of this paper, if would also suffice to define a
+font-dependent command as a command that is defined by some of the
+commands |\DeclareTextCommand|, |\ProvideTextCommand|,
+|\DeclareTextSymbol|, |\Declare|\B|Text|\B|Command|\B|Default|,
+|\Provide|\B|Text|\B|Command|\B|Default|, or |\Declare|\B|TextAccent|.
+\LaTeX\ documentation uses the term `encoding-specific command' for
+these, but for reasons that will soon be appearent, that term would be
+somewhat inappropriate here.
+
+Thus, with these definitions taken care of, it is now time to get to
+the point.
+
+The recommended latin font encoding these days is the
+\texttt{T1}/`Cork'\slash`Extended \TeX\ text'
+encoding, and this is rightfully so. It is clearly superior to the old
+\texttt{OT1} encoding, as it adds more than a hundred accented
+characters to those which can be used to form a word that \TeX\ can
+automatically hyphenate, but there is at least one case in which the
+\texttt{OT1} encoding is preferable. This case is when the font has many
+ligatures.
+
+In the \texttt{T1} encoding, there are seven slots available
+for ligatures, and these have been assigned to the `ff', `fi', `fl',
+`ffi', `ffl', `IJ', and `ij' ligatures. Since all slots have been
+assigned to something, there is no place to put an additional ligature,
+even if it is needed. Thus the conclusion is that if a font is to be
+\texttt{T1} encoded, it cannot contain any ligatures in addition to the
+aforemensioned; to put it the other way, if a font design requires the
+presence of a ligature other than the aforemensioned, it cannot be
+\texttt{T1} encoded.
+
+In the \texttt{OT1} encoding, there are only five slots assigned to
+ligatures, but there are 128 unassigned slots that can be used for
+anything the font designer wants. Thus having more than five ligatures
+in an \texttt{OT1} encoded font is no problem, but a recourse to using
+\texttt{OT1} is not a very good option, as it leaves the hyphenation
+problem unsolved. The solution, then, would seem to be the creation of
+a new encoding, and part of it will, but this will not be quite
+sufficient for reasons I will shortly describe.
+
+For the moment though, let us, as an intellectual experiment, assume
+that we shall solve this problem with \texttt{T1} having too few slots
+for ligatures by creating a new encoding for a hypothetical font that
+would need more than seven ligatures. Let us also assume that the new
+encoding shall be a modified version of the \texttt{T1} encoding, where
+some accented characters will have been left out to make room for the
+ligatures. Finally, let us assume that we want to be as international
+as possible and include as many of the accented characters as we can
+squeeze in. These are three simple assumptions, and there are good
+reasons for all of them.
+
+How \emph{many} slots do we need to assign to ligatures, then? This
+varies, of course, between different font families, but it might vary
+\emph{even more} between fonts in the same family. The \texttt{it}
+shapes might need a few more than the \texttt{n} shapes, while the
+\texttt{sc} shapes might not need any at all (`\textsc{fi}' (|fi|) and
+`\textsc{f{}i}' (|f{}i|) look exactly the same in most font families).
+Instead, there are some accents which are harder to put on in the
+\texttt{sc} shapes (in many font families the ring on \textsc{a} in
+\textsc{\r{a}} should touch the main letter; this is not what the
+default definition does), so it appears that the optimal thing to do
+would be to have slightly different encodings for different fonts, even
+if they belong to the same family. This is theoretically no problem;
+\TeX's macro facilities are flexible enough to allow user level
+commands that do different things in different fonts. It becomes,
+however, a problem to do this in a reasonably universal way, so that
+the macros produced work in general and not only for a single font
+family.
+
+Standard \LaTeX\ has a mechanism for doing precisely this. Using the
+commands |\DeclareTextCommand|, |\DeclareTextSymbol|,
+|\DeclareTextAccent|, or one of their relatives, one can give a
+definition of a command that is used with one particular font encoding
+and not with any other. The problem with using this mechanism here is
+that one might have to have the normal and italic variants declared
+as having different encoding attributes (as well as different
+shapes), so one would have to either device a whole new set of font
+changing commands or redefine \LaTeX's own high-level font changing
+commands (such as |\textit|) to change encoding as well as shape or
+series. Neither alternative is good, and one can expect several
+incompability problems to arise for both of them.
+
+A better solution starts with recognizing that there are actually two
+different `encoding' concepts that can be found here. One is the
+attribute by which fonts are selected in \LaTeX, the other is the
+actual layout of a font. I will call this latter concept a
+\emph{coding scheme} and reserve \emph{encoding} for the former.
+(Formally, one may start by defining a \emph{slot} to be an integer in
+the range 0--255 and a \emph{glyph} to be a pattern (usually
+recognicable as a letter, digit, punctuation mark, or some other part
+of written language, but it need not always be). A coding scheme can
+then be defined as a mapping of slots to classes of glyphs. A font
+complies to a particular coding scheme if, for every slot $n$ in the
+domain of the coding scheme, the glyph occupying slot $n$ of the font
+is a member of the class that the encoding scheme maps $n$ to. But I
+digress.) As far as I know, there is no strict defintion of what an
+encoding is, apart from the operational given in \cite{fntguide} as
+something that is part of the specification of a font. (The canonical
+source for such a definition would be \cite{encguide}, but that paper
+is, according to its author, ``still in an embryo state''.) In font
+discussions, an encoding is often taken to imply a specific coding
+scheme, and many encoding definition files seem to be all about listing
+the coding scheme, but is this implication suitable? I would claim that
+in this case, it is not.
+
+A more constructive definition would be to see an encoding as a
+specification of which font-dependent commands are available to the
+author. An encoding definition file, on the other hand, is a
+specification of the interface between \LaTeX\ macros and the
+information in a \TeX\ font. It does not matter to the author whether
+\H{o} is |\char174| of the current font, generated as |\accent125o|
+by \TeX, or whatever. The only thing that matters is that when the
+author types |Erd\H{o}s|, it comes out as Erd\H{o}s.
+
+Consequently, there is really no need for the font-dependent commands in
+\LaTeX\ to do the same thing for any two fonts with the same encoding
+attribute, it is merely the case that standard \LaTeX\ does not offer
+an interface for defining font-dependent commands in any other way. The
+natural remedy for this then, would be to write a package which offers
+such an interface. This is what I have done; the package is called
+\package{relenc} and this paper is its documentation. Its usage and
+implementation are described in the following sections, and the
+appendices describe some accompanying files.
+
+I shall however conclude this section by an attempt to elaborate the
+above view on what an encoding is, or perhaps rather, what it should be.
+
+The encoding property of a font is a set of rules that determines how
+the author's manuscript is interpreted---the input character
+\texttt{q} for example has not the same interpretation in a
+\texttt{T1} encoded font (where it is the letter `q') as in an
+\texttt{OT2} encoded font (where it is a cyrillic letter whose closest
+latin equivalent is the Czech `\v{c}'). An encoding specification should
+therefore be a formalization of an agreement between the font designer
+on one hand and the author on the other---it specifies which rules each
+side must comply with and which results that can then be expected. An
+example of the author's rules may be to refrain from writing \TeX\ code
+like |\char 166|, because the font designer may have an option on what
+to put in that slot. If the author breaks the rules, he or she may find
+that the manuscript produced contains text whose meaning is not the same
+if typeset with two different fonts even if they do have the same
+encoding property. In practice, the author's rules for the standard text
+encodings are pretty much the same as the rules on how write \TeX\ code
+we find in every elementary book on the subject, so they are hardly new
+to us.
+
+An example of the font designer's rules may be to put an exclamation
+mark in slot 33, so that \texttt{!} actually print as one, or to
+include a font ligature that converts two consequtive hyphens to an
+endash, so that |--| actually will print as an endash, which the
+author by tradition expects it to do. If the font designer breaks the
+rules then authors who follow their rules might find that they do not
+get the right results anyway and such a font designer is likely to get
+complaints from authors about this. In practice however, the font
+designer rules are often vaugely specified if specified at all and
+hence there are gray areas for most encodings where there are no rights
+and wrongs. The \texttt{OT1} encoding is probably the one most plauged
+by these; the dollar versus sterling problem (an excellent example of
+how changing the glyph of a single slot many completely alter the
+interpretation of a text) is a classic. One of my intentions with
+writing this text is to work for that these gray areas are shrunken
+or even completely eliminated, although I do not think there is
+anything that can be done for the \texttt{OT1} encoding---its
+irregularities are much too well known and exploited.
+
+Now if an encoding is (a formalization of) an agreement, how do the
+parties agree to it? On the font designer's side this happens when
+the font designer gives a font a specific encoding by writing a font
+definition file that defines that font with that encoding. On the
+author's side this happens when the author selects a font with that
+encoding property.
+
+So far the informal description, now it is time to get to the
+formalization. Which exactly are the rules for the author and for the
+font designer? This varies between different encodings, but only in
+the details. The areas the encoding specification must cover can be
+listed and are:
+\begin{itemize}
+ \item
+ Which input characters that can be used directly to produce
+ some of the font's glyphs in the output and what they will
+ generate. This pertains to the author, who shouldn't use other
+ input characters. The allowed ones do however have well-defined
+ results.
+ \item
+ Which coding scheme the font must comply with. The pertains to
+ the font designer. There are no direct restrictions on the use of
+ slots not listed in this coding scheme.\footnote{There may be
+ indirect restrictions, see below.}
+ \item
+ Which the required syntactic ligatures are. This pertains to both
+ author and font designer. The author cannot trust any in addition
+ to these, the font designer must include them.\footnote{It could
+ well be that there \emph{should not} be any syntactic ligatures
+ in addition to these. I know of no situation where there would be
+ an advantage in adding syntactic ligatures.}
+ \item
+ Which the font-dependent commands are and what they will generate.
+ This pertains to the author in the same manner as does the input
+ character rules.
+ \item
+ Which the required font dimensions are and what they stand for.
+ This pertains to both the author and the font designer in the same
+ manner as does the syntactic ligature rules.\footnote{Even though
+ very few physical authors access any font dimensions, the same
+ does not hold for packages, and these also count as authors in
+ this context.}
+\end{itemize}
+After these have been specified, the grey areas should be very small
+indeed! There are however a few additional twists that must be sorted
+out.
+
+If the required coding scheme listed in the encoding specification does
+not cover all the 256 slots, then one must be aware that in particular
+the required syntactic ligatures, but also the font-dependent commands,
+may impose some restrictions on the font's coding scheme in
+addition to those expressed by the given coding scheme that the font
+must comply with. These restrictions are then of the form that a
+glyph from a specific class must be assigned to some slot, but the
+font designer may freely choose exactly which slot. Thus any single
+slot not specified by the required coding scheme may be used for just
+about anything.
+
+The use of the \package{relenc} package requires that the following
+area has to be added the ones listed above.
+\begin{itemize}
+ \item
+ The font designer must see to that for every combination of a
+ variable command and a font, there is a variant that will give the
+ specified result.\footnote{The terms \emph{variable command} and
+ \emph{variant} are explained in Subsubsection~\ref{Tekn.bakgr.}.}
+\end{itemize}
+% With encodings that depend on the \package{relenc} package (I call
+% such encodings \emph{relaxed}),
+Hyphentation patterns do also offer theoretical problems to the use of
+the \package{relenc} package, as these refer explicitly to the coding
+scheme of the font. Problems with these can however not result in
+anything worse than bad hyphenation, so the interpretation of a text
+should not be affected. It is furthermore the case that in practice
+the problems can often be avoided (see Subsection~\ref{Hyph}).
+
+Finally, there are two font parameters---|\hyphenchar| and
+|\skewchar|---that do explicitly relate to the coding scheme of the
+font and which are not stored in the font itself. It is possible that
+the value of at least one of these should be specified in an
+encoding specification, but that particular question is not of
+immediate interest to the \package{relenc} package, as \LaTeX\ itself
+already provides the font designer with the ability to set these for
+each font individually (using the sixth argument of
+|\Declare|\B|Font|\B|Shape|).
+
+
+
+\section{Usage}
+
+\subsection{Author usage}
+
+All the author has to do to use fonts with a relaxed encoding, as
+opposed to fonts with for example the \texttt{T1} encoding, is to
+include the command
+\begin{verbatim}
+ \usepackage{relenc}
+\end{verbatim}
+in the preamble and load the encoding definition file, for example
+using the \package{fontenc} package. It is however important that the
+\package{relenc} package is loaded \emph{before} the encoding
+definition file, as the latter uses commands defined in the former.
+
+
+\subsection{Font designer usage}
+
+For a font designer, it is important to know at least in broad
+outline how the mechanisms made available through the \package{relenc}
+package work, which is why this subsection starts with a description of
+that. There is however a convention followed in the remainder of this
+paper that the reader should be aware of and this convention has to do
+with how control sequences are written.
+
+In this paper, there are many control sequences with ``strange''
+names, meaning names that mixes letters and non-letters in pretty
+arbitrary ways, so that these names cannot be read as one normally
+reads \TeX\ code. Therefore thin spaces are inserted around names of
+control sequences, regardless of whether a space character at that
+place would automatically be skipped by \TeX\ while it is reading the
+code or not. A space character that is really meant to ``be there'' will
+be written as a visible space (\textvisiblespace). All control sequences
+will, as usual, be written with an opening backslash, but this
+backslash is not part of the name of the control sequence.
+
+Excepted from the above convention about spaces is the actual \TeX\ %
+source code for that appear in Section~\ref{Implementation} and onwards
+(the lines of this is numbered, so it should be easily distinguishable)
+and some pieces of ``alternative'' source code in the same sections.
+These exceptions should be easy to recognise for the readers who are
+interested in that particular material.
+
+
+\subsubsection{Some technical background}
+\label{Tekn.bakgr.}
+
+The main feature added by the \package{relenc} package is that of
+the \emph{variable commands}; it is through making commands variable
+that their definition may depend on which font is the current. This is
+not how \TeX\ would see it, since the definition of a variable
+command (as a \TeX\ control sequence) actually does not change after
+the command has been made variable! Rather, a variable command is a
+macro which expands to different things depending on which the current
+font is.
+
+With overwhelming probability, this is something you have encountered
+before, although you might not have realised it. Under \LaTeXe, all
+accenting commands and all commands for letters other than a--z (such
+as \ae, \o, and \ss) are like this. The only difference lies is what
+will affect the eventual outcome of the command. The \LaTeXe\ kernel
+only supports dependence on which the current encoding is. The variable
+command concept makes dependence on the current family, series, and
+shape possible as well.
+
+Both systems are quite similar in that they rely on |\csname| lookups.
+What happens to, for example, the command |\foo| is the following:
+First it gets |\string|ed. This converts the single control sequence token
+to the sequence of character tokens which would form the name of the
+command; in this case to |\|, |f|, |o|, and |o|. Then a piece of text
+is put in front of that character sequence, and finally the result of
+that is taken to be the name of a new control sequence. This process
+mainly generates control sequnces with very peculiar names; if the bit
+of text is, say, |T1| then the new control sequnce will be |\T1\foo|
+(this is \emph{one} control sequence). Such names are impossible to type
+without a lot of trickery, but that is deliberate, since they should
+not be accessed directly. If the control sequence thus formed is defined,
+then the definition of that control sequence will be taken as the intended
+definition of the control sequence |\foo| it all started with.
+
+The systems differ in what pieces of text they put before the name of
+the command and what they do if the control sequence formed is not
+defined. The \LaTeXe\ kernel starts by using the name of the current
+encoding as the prefix text. If that fails, it tries with |?| instead.
+If that fails too, an error message is issued. The variable commands
+defined using the \package{relenc} package have a more general approach.
+
+This approach relies on the concept of a \emph{search path}, about
+the structure of which more will be said later. For the moment, it is
+sufficient to say that it consists of a sequence of \emph{blocks} of
+text. The looking up process consists of a loop in which the following
+is done: The first block is removed from the search path, and the text
+it contains is used to form the name of a control sequence, as described
+above. The rest of the search path is saved away as the \emph{remaining
+search path}. If the control sequence formed is defined, then it is used
+as the definition of the command, and if it is not, then the process
+is repeated. When the process is repeated however, it starts by
+removing the first block of the remaining search path, which is the
+second (or third, or fourth, depending on which iteration of the loop
+is the current) block of the entire search path, while once again
+saving the rest as the new remaining search path. Not until the
+entire search path has been scanned in this way will an error message
+be issued.
+
+This means arbitrarily many possibilities can be tested in searching
+for the definition of a command, but about six is probably a
+realistic upper bound on how many there will be in practical
+applications. In many cases it will be even fewer.
+
+What has been mensioned so far does not mean there necessarily is any
+dependence on the current font, but it opens the possibility. The
+trick is that the pieces of text, which are the blocks in the search
+path, can contain not only characters but also macros (and other
+expandable stuff)---as long as everything eventually expands to
+character tokens, everything is fine. The point here is that the
+control sequences that contains the names of the current encoding,
+family, series, and shape---|\f@encoding|\footnote{For technical
+reasons, it is probably better to use \cs{cf@encoding} instead. See page
+\pageref{Why cf@encoding} for a discussion of this.}, |\f@family|,
+|\f@series|, and |\f@shape| respectively---are of this kind. Thus
+making the definition of a variable command depend on these attributes
+of the current font is simply a matter of making the corresponding
+control sequences part of the texts in the search path.
+
+The above might give the impression that the variable commands are
+ment to be used instead of the encoding-specific commands of standard
+\LaTeX, but that is not the case. What actually happens is that the
+control sequences of type |\T1\foo| that the \LaTeXe\ kernel looks up
+will themselves be variable commands. This means that to \LaTeX, the
+commands in a relaxed encoding whose definitions depend on the current
+font are just normal encoding-specific commands, even though they do a
+lot of peculiar things before they actually generate any typeset
+material, but on the other hand \LaTeX\ doesn't care what they do, as
+long as it finds a definition.\footnote{It also saves me a lot of
+work, since I won't have to bother with trying to make the variable
+commands robust---\LaTeX\ already makes the encoding-specific commands
+robust.}
+
+This has probably been a bit abstract, so an explicit example might be
+in place. Let's say that the current encoding is \texttt{T1R} (this is
+an existing relaxed encoding), the current family is \texttt{zcm}
+(this is an example family\footnote{The \texttt{zcm} font family is
+described in Appendix \ref{zcm-family}.}), the current series is
+\texttt{m}, and the current shape is \texttt{n}. Furthermore let's say
+the user has just issued the font-dependent command |\foo| (this is not
+really a font-dependent command, but let's assume it is). What will happen?
+
+\begin{enumerate}
+\item
+ The actual control sequence |\foo| causes the \LaTeXe\ kernel to start
+ look for a definition. It first tries |\T1R\foo|, then |\?\foo|, and
+ if neither is defined then an error message is given. The case of
+ interest here is that |\T1R\foo| is defined, because then the
+ \LaTeXe\ kernel is content and \TeX\ will act as if |\T1R\foo| was
+ issued instead.
+\item
+ If the final definition of |\foo| is to depend on family\slash
+ series\slash shape then |\T1R\foo| must be a variable command. The
+ first thing which happens then is that \package{relenc} starts
+ looking for a search path to use. Search paths are stored in
+ macros, and the names of these macros are formed in a manner
+ similar to that in which the other lookup names here are formed.
+
+ The two macros which can contain the search path are
+ |\T1R/zcm-path| and |\T1R-path| (these are still only single
+ control sequences), and they are tried in that order. If none of
+ them exists, then an error message is given. The second of the two
+ is common to all fonts using the \texttt{T1R} encoding and must be
+ defined by the encoding designer. A font designer can choose to
+ define a search path of his or hers own, and that will then be named
+ as the first of the two above. A family specific search path
+ completely overrides the encoding specific (the latter is in that
+ case not even considered), but in many cases the encoding specific
+ will do just fine.
+
+ Let's assume that |\T1R/zcm-path| is defined and consists of
+ \begin{verse}
+ |{|\meta{enc}|/|\meta{family}|/|\meta{series}|/|\meta{shape}|}|\\
+ |{|\meta{enc}|/|\meta{family}|/?/|\meta{shape}|}|\\
+ |{|\meta{enc}|/|\meta{family}|/?/?}|\\
+ |{|\meta{enc}|/?/?/?}|
+ \end{verse}
+ (Each block is written on a separate line. The text of the block is
+ everything between (but not including) the braces, which act as
+ delimiters of the block. \meta{enc}, \meta{family}, \meta{series}, and
+ \meta{shape} denote the \LaTeX\ macros listed above which contain the
+ names of the current encoding, family, series, and shape respectively.)
+\item
+ Once the search path is found, it is scanned. In this particular
+ case this means that the control sequences |\T1R/zcm/m/n\foo|,
+ |\T1R/zcm/?/n\foo|, |\T1R/zcm/?/?\foo|, and |\T1R/?/?/?\foo| are
+ tried in that order. If none of them is defined, an error message is
+ given, but let's assume that |\T1R/zcm/?/?\foo| is defined and
+ neither |\T1R/zcm/m/n\foo| nor |\T1R/zcm/?/n\foo| are. This
+ corresponds to the case that there is a definition of the variable
+ command that is specific for the family, but not any specific for
+ the shape or series.
+\item
+ The final stage is that |\T1R/zcm/?/?\foo| gets executed.
+\end{enumerate}
+
+There are now only a few more things to sort out before the
+description of the commands a font designer has available can commence.
+Firstly, control sequences like the above |\T1R/zcm/?/?\foo|, that hold
+an actual definition of a variable command, are called \emph{variants}
+of that command. The processing during the scan of the search path that
+is connected to one block in the search path is called a \emph{step} in
+that scan.
+
+Secondly, there is another thing which might affect the definition of a
+command, viz.\ the first argument of the command. Commands for which
+the first argument is checked before the actual definition is determined
+are called \emph{composite commands}, or are said to be \emph{composed}.
+The alternative definitions of them are called \emph{compositions}. Each
+composition is used for exactly one value of the argument, and the main
+composite command contains a definition which is used for all values for
+which there is no composition.
+
+This too is a mechanism that is present in the \LaTeXe\ kernel, what
+\package{relenc} does is that it introduces some commands to make
+variable commands composed or vice versa. Very much like variable
+commands, composite commands rely on |\csname| lookups, but instead of
+adding a prefix to the command name, the composition mechanism adds a
+suffix consisting of a hyphen (|-|) and the first token of the first
+argument (as a precaution, this token is |\string|ed beforehand, to
+convert it to character tokens if it was not already).
+
+An example of this, from the \texttt{T1} encoding, is the acute accent
+command |\'|. The command that actually is composed is |\T1\'|, which
+holds the definition of |\'| in the \texttt{T1} encoding, and one of
+its compositions are |\\T1\'-a|. This is a macro which expands to the
+letter \'{a}, which is the expected result of |\'{a}|. There is no
+composition for the argument |\ae| in the \texttt{T1} encoding, so if
+the user issues |\'{\ae}| the lookup mechanism finds nothing and the
+default definition is used, yielding `\'{\ae}'. Had there been a
+composition however, it would have called |\\T1\'-\ae|. Cases like
+these are why the |\string|ing precaution is necessary; most
+commands generate errors when \TeX\ meets with them inside a |\csname|
+\textellipsis\ |\endcsname| pair.
+
+With that description completed, it is now time to describe the usage
+and purpose of the commands available to the font designer. It should
+perhaps be pointed out that most of them are about defining variants
+of commands, as making a command variable lies within the powers of
+the encoding designer.
+
+
+\subsubsection{Defining variants of font-dependent commands}
+
+Among the arguments of every variant defining command is the sequence
+\marg{encoding}\B\marg{family}\B\marg{series}\B\marg{shape},
+which specifies which variant of a command is being defined. The
+arguments should consist of letters and\slash or figures, but any
+combination of these parameter fields might be left empty. A field
+left empty signifies that the intended variant may be used regardless
+of what value that attribute may take. Thus |{T1R}{zcm}{m}{n}| is used
+when defining a variant specific to this encoding, family, series, and
+shape, whilst |{T1R}{zcm}{}{}| is used when defining a variant that
+applies for every font in the \texttt{T1R}-encoded \texttt{zcm} family.
+Technically, a field left empty will be filled with a question mark.
+Thus the |{T1R}{zcm}{}{}| variant of |\foo| will be stored in the
+control sequence |\T1R/zcm/?/?\foo|.
+
+\DescribeMacro\DefineTextSymbolVariant
+\DescribeMacro\DefineTextAccentVariant
+|\DefineTextSymbolVariant| and |\DefineTextAccentVariant| are the two
+simplest commands for defining a variant. The former makes the variant
+output a single character, whose slot in the font is given as the
+argument \meta{slot}. The latter should be used for variants of accent
+commands, as an accenting command is precisely what it defines. The
+character used for the accent is the one with slot number
+\meta{slot}. |\DefineTextSymbolVariant| and
+|\DefineTextAccentVariant| parallell the commands |\DeclareTextSymbol|
+and |\DeclareTextAccent| respectively that are found in standard
+\LaTeX.
+
+\DescribeMacro\DefineTextCommandVariant
+If the above are not sufficient for the definition of a variant of
+some command (they are not, for example, general enough to define any
+of the accents put \emph{under} letters), complete generality is
+offered through the |\DefineTextCommandVariant| command, which can be
+used to define any \TeX\ macro. (It consists simply of a |\gdef| to
+the control sequence that stores the variant in question.) This means
+the \meta{parameter text} should be formated as for the |\def|
+command, without any surrounding braces or such. Also notice that every
+token in the \meta{parameter text} counts, including spaces and end of
+lines.
+
+Apart from the arguments mensioned, all the above commands have an
+argument \meta{cmd}. This is the name of the base font-dependent command of
+which you want to define a variant. It is not the name of the actual
+variable command, so you should write |\foo|, not |\T1R\foo|.
+The syntaxes of the commands are as follows:
+\begin{cmdusage}
+ |\DefineTextSymbolVariant| \marg{cmd}
+ \marg{encoding} \marg{family} \marg{series} \marg{shape}
+ \marg{slot}
+
+ |\DefineTextAccentVariant| \marg{cmd}
+ \marg{encoding} \marg{family} \marg{series} \marg{shape}
+ \marg{slot}
+
+ |\DefineTextCommandVariant| \marg{cmd}
+ \marg{encoding} \marg{family} \marg{series} \marg{shape}
+ \meta{parameter~text}~|{|~\meta{replacement~text}~|}|
+\end{cmdusage}
+\medskip
+
+\DescribeMacro\NewTextCommandVariant
+\DescribeMacro\RenewTextCommandVariant
+\DescribeMacro\ProvideTextCommandVariant
+\package{relenc} does also offer some |\newcommand|-style commands for
+defining variants of font-dependent commands, for font designers who prefer
+that. They do offer some additional functionality, as they can make
+commands which take an optional argument, but I am not currently aware
+of any font-dependent command that uses this feature. One reason the
+feature is offered is that variable command processing comes before
+optional argument processing, hence if a variable font-dependent command
+can have an optional argument then all its variants must be able to cope
+with that argument when it is present.
+
+Technically the commands boil down to an application of
+|\newcommand|, |\renewcommand|, or |\providecommand| respectively
+(the starred forms, to be exact). Thus you may get error messages
+if the variant is already defined or not defined, depending on which
+command you use. As the error messages are the standard \LaTeX\ %
+error messages, they may be somewhat confusing. Still, a somewhat
+confusing error message may be better than none at all.
+\begin{cmdusage}
+ |\NewTextCommandVariant| \marg{cmd}
+ \marg{encoding} \marg{family} \marg{series} \marg{shape}
+ \oarg{numargs} \oarg{default} \marg{replacement text}
+
+ |\RenewTextCommandVariant| \marg{cmd}
+ \marg{encoding} \marg{family} \marg{series} \marg{shape}
+ \oarg{numargs} \oarg{default} \marg{replacement text}
+
+ |\ProvideTextCommandVariant| \marg{cmd}
+ \marg{encoding} \marg{family} \marg{series} \marg{shape}
+ \oarg{numargs} \oarg{default} \marg{replacement text}
+\end{cmdusage}
+\medskip
+
+
+\subsubsection{Defining variants of compositions}
+\label{Var. of comp.}
+
+As compositions can be variable, there are commands for defining
+variants of them. The situation here is simpler than for font-dependent
+commands in general since compositions cannot have any arguments,
+consequently there is no need to provide such a large variety of
+definition commands as for defining command variants.
+
+\DescribeMacro\DefineTextCompositionVariant
+\DescribeMacro\DefineTextCompositionVariantCommand
+The most important is |\DefineTextCompositionVariant| which
+corresponds to |\DefineTextSymbolVariant|---it makes a variant which
+simply typesets one of the characters in the font. The most general
+command is |\DefineText|\B|Composition|\B|VariantCommand| which defines
+the variant to be a parameterless macro without other restictions.
+
+\DescribeMacro\DefineTextUncomposedVariant
+A special, but probably rather common macro to define a variant of a
+composition to be, is the macro consisting of the noncomposite
+definition applied on the argument for the composition, because
+defining the variant this way is probably the easiest way to free a slot
+in the font for other purposes. Hence there is a special command for
+doing this: |\DefineTextUncomposedVariant|. It resembles the other
+two, but there is of course no argument that gives the definition of
+the variant and there is a special restriction, namely that
+the \meta{encoding} argument must not be empty!
+
+The arguments of these commands are as for the commands for defining
+variants of font-dependent commands, except for one designated
+\marg{argument}. This is the argument which is passed to the
+font-dependent command that corresponds to the current composition---the
+composition of which a variant is to be defined.
+
+\begin{cmdusage}
+ |\DefineTextCompositionVariant| \marg{cmd}
+ \marg{encoding} \marg{family} \marg{series} \marg{shape}
+ \marg{argument} \marg{slot}
+
+ |\DefineTextCompositionVariantCommand| \marg{cmd}
+ \marg{encoding} \marg{family} \marg{series} \marg{shape}
+ \marg{argument} \marg{replacement text}
+
+ |\DefineTextUncomposedVariant| \marg{cmd}
+ \marg{encoding} \marg{family} \marg{series} \marg{shape}
+ \marg{argument}
+\end{cmdusage}
+
+
+\subsubsection{Defining compositions of variants}
+\label{Comp av var}
+%
+Things can be done the other way round too---a variant of a font-dependent
+command may have compositions. These compositions are then completely
+independent of any compositions of the base font-dependent command. Unlike
+compositions of a font-dependent command (which must be \emph{declared}
+in the encoding definition file and are common to all fonts in a
+particular encoding), compositions of a variant can be \emph{defined}
+whenever a variant can be defined. Thus making compositions of variants
+lies within the powers of the font designer.
+
+\DescribeMacro\DefineTextVariantComposition
+\DescribeMacro\DefineTextVariantCompositionCommand
+There are two commands for defining compositions of variants:
+|\Define|\B|Text|\B|Variant|\B|Composition| and
+|\Define|\B|Text|\B|Variant|\B|Composition|\B|Command|. The difference
+between them is simply that the latter command defines the composition
+to be a macro with the given replacement text, while the former defines
+it to be a chardef token for the given slot. What is more interesting is
+what these commands do if the variant they are to make a composition of
+is not defined, because in this case they define the default definition
+to be a macro that resumes the scan of the search path. This means that
+the font designer can choose to specify some compositions early in the
+search path and others later---and perhaps more importantly---can give
+special definitions for some compositions early in the search path
+without having to copy the default definition to that level.
+
+As it happens, the names of the control sequences, in which the
+definitions of compositions of variants and variants of compositions
+respectively are stored, are slightly different (a backslash appears
+at different positions). Hence it is possible to have both for exactly
+the same \meta{encoding} \meta{family} \meta{series} \meta{shape}
+\meta{argument} combination for a composition of variant and variant
+of composition without having them overwriting each other, although
+there is hardly any point in having things set up this way.
+
+\begin{cmdusage}
+ |\DefineTextVariantComposition| \marg{cmd}
+ \marg{encoding} \marg{family} \marg{series} \marg{shape}
+ \marg{argument} \marg{slot}
+
+ |\DefineTextVariantCompositionCommand| \marg{cmd}
+ \marg{encoding} \marg{family} \marg{series} \marg{shape}
+ \marg{argument} \marg{replacement text}
+\end{cmdusage}
+
+
+\subsubsection{Setting the family search path}
+
+Setting the family search path is pretty straightforward: The search
+path is the last argument, encoding and family in question the two
+other. A useful feature here is that inside the search path argument,
+|@| will be a letter and all spaces and newlines are ignored. This
+means the example search path from Subsubsection \ref{Tekn.bakgr.} can
+be set even by a command call as spaced out as the following
+\begin{verbatim}
+ \SetFamilySearchPath{T1R}{zcm}{
+ { \cf@encoding / \f@family / \f@series / \f@shape }
+ { \cf@encoding / \f@family / ? / \f@shape }
+ { \cf@encoding / \f@family / ? / ? }
+ { \cf@encoding / ? / ? / ? }
+ }
+\end{verbatim}
+and even if it appears in the preamble of a document (this is handy when
+debugging a font family).
+
+Search paths \emph{must} be set using the |\SetFamilySearchPath| or
+|\SetEncoding|\B|SearchPath| commands, otherwise the case that no
+definition of a variable command is found cannot be handled
+correctly, with the effect that \TeX\ gets hung in an infinite loop.
+
+\begin{cmdusage}
+ |\SetFamilySearchPath| \marg{encoding} \marg{family}
+ \marg{search~path}
+\end{cmdusage}
+
+
+\subsubsection{Where to put it all}
+%
+One topic that has not been delt with above is where the font designer
+is to put all these commands for defining variants and setting search
+path. In my opinion, there is only one possible place---the font
+definition file\footnote{I am well aware of the rules for which
+commands may be used in font definition files that are described in
+\cite{fntguide}. I have however chosen to disregard from these rules
+in the case of commands defined by the \package{relenc} package, as
+this case could hardly have been foreseen by the prescribers of these
+rules.}. This is also the logical place to put the commands,
+since this is the file in which the font designer describes his or her
+font family to \LaTeX. In particular, one cannot expect full
+functionality if the commands are put in a package, since it is
+perfectly possible to select a font without using a standard package
+for this.
+
+Of course, definition commands can also appear in an encoding
+definition file and anything that can appear in an encoding definition
+file may also appear in a package file, even though packages containing
+such code are often of a rather special nature.
+
+% There is however a complication of a technical nature with using
+% commands from the \package{relenc} package in font definition files.
+% Most of the commands defined in the \package{relenc} package assume
+% that the value of the \TeX\ parameter |\escapechar| is $92$, denoting
+% the backslash character (|\|). This is normally the case in \LaTeX,
+% but unfortunately this is not always the case when a font definition
+% file is loaded. \LaTeX\ locally sets |\escapechar| to $-1$ during some
+% important operations, most notably the loading of a new font done in
+% |\define@newfont|, and it is often at this time that font definition
+% files get loaded.
+%
+% To work around this, include the line
+% \begin{verbatim}
+% \begingroup \escapechar=`\\
+% \end{verbatim}
+% somewhere in every font definition file using commands from the
+% \package{relenc} package and put it before the first such command; also
+% include the line
+% \begin{verbatim}
+% \endgroup
+% \end{verbatim}
+% somewhere after the last such command. This temporarily resets
+% |\escapechar| to its normal value. I believe the group is necessary
+% (and it doesn't harm), since the value of |\escapechar| is not
+% neccessarily $-1$ at the time a font definition file is loaded. Sigh.
+%
+% IMHO, the best way to fix this would be to change \LaTeX\ itself so
+% that it doesn't change |\escapechar| at this particular
+% time\footnote{One could easily achieve the same results using a
+% combination of \cs{expandafter}s and \cs{@gobble}s. This would also
+% have the positive effect that backslashes will appear where one is
+% used to see them in the tracing messages \TeX\ writes out if
+% \cs{tracingcommands} or \cs{tracingmacros} are positive, instead of
+% being missing inside a neighbourhood of every font change.}, but that
+% is of course for the \LaTeX3 project team to decide.
+
+
+\subsection{Encoding designer usage}
+%
+The encoding designer's work in making a relaxed encoding is very
+much like the work in making a normal encoding. There are only two
+additional steps: It must be decided which commands and compositions
+that should be variable, and an encoding search path must be set. Both
+of these are more a matter of planning than writing \TeX\ code, but it
+seems best to treat the coding first.
+
+Each of the commands for declaring a variable font-dependent command or
+composition corresponds to a command for declaring a non-variable
+font-dependent command which is part of standard \LaTeX, as is shown in the
+following table. The correspondence is not one to one, but it is pretty
+close.
+
+\begin{center}
+ \small\DeleteShortVerb{\|}
+ \begin{tabular}{|ll|}
+ \hline
+ Standard declaration command& Variable declaration command%
+ \\[-0.9\ht\strutbox]
+ \hrulefill&\hrulefill\\
+ \relax\MakeShortVerb{\|}|\DeclareTextCommand|&
+ \relax|\DeclareTextVariableCommand|\\
+ \relax|\DeclareTextCommand|&
+ \relax|\DeclareTextVariableCommandNoDefault|\\
+ \relax|\ProvideTextCommand|&
+ \relax|\ProvideTextVariableCommand|\\
+ \relax|\DeclareTextSymbol|&
+ \relax|\DeclareTextVariableSymbol|\\
+ \relax|\DeclareTextAccent|&
+ \relax|\DeclareTextVariableAccent|\\
+ \relax|\DeclareTextComposite|&
+ \relax|\DeclareVariableTextComposition|\\
+ \relax|\DeclareTextCompositeCommand|&
+ \relax|\DeclareVariableTextComposition|\\
+ \hline
+ \end{tabular}
+\end{center}
+
+\DescribeMacro\DeclareTextVariableSymbol
+\DescribeMacro\DeclareTextVariableCommand
+\DescribeMacro\ProvideTextVariableCommand
+\DescribeMacro\DeclareTextVariableAccent
+The difference between on one hand the commands |\Declare|\B|Text|\B
+|Variable|\B|Symbol|, |\Declare|\B|Text|\B|Variable|\B|Command|,
+|\Provide|\B|Text|\B|Variable|\B|Command|, and |\Declare|\B|Text|\B
+|Variable|\B|Accent| and their non-variable counterparts on the other is
+that the font-dependent command they declare will become a variable
+command, while the definitions given will be used to define the
+encoding-level variant of the command. The arguments are exactly the
+same as for the commands' non-variable counterparts of standard \LaTeX.
+
+\DescribeMacro\DeclareTextVariableCommandNoDefault
+The |\DeclareTextVariableCommandNoDefault| command only declares a
+font-dependent command and makes it variable, but does not define any of
+its variants. This can actually be useful if one is writing an encoding
+that is a relaxed version of another encoding, such as the \texttt{T1R}
+encoding, since many commands will have the same encoding-level
+definition in both encodings. It is then possible to include the name of
+that other encoding in the search path, so that the same control
+sequence will hold the definition of a command in two different
+encodings.
+
+\DescribeMacro\DeclareVariableTextComposition
+The |\DeclareVariableTextComposition| command declares a composition of
+a command, like |\Declare|\B|Text|\B|Composite| or
+|\DeclareTextCompositeCommand|, and makes that composition variable.
+But it is also like |\Declare|\B|Variable|\B|Text|\B|CommandNo|\B|Default|
+in that it does not define any variant of the composition. To define a
+variant, one of the commands in Subsection \ref{Var. of comp.} must be
+used as well\footnote{I am not sure that this is a good way to organise
+it. Perhaps there should be commands combining these functions.}.
+|\DeclareVariableTextComposition| takes three arguments: the command,
+the encoding, and the argument for which a composition is to be
+declared.
+
+\begin{cmdusage}
+ |\DeclareTextVariableSymbol| \marg{cmd} \marg{encoding}
+ \marg{slot}
+
+ |\DeclareTextVariableCommand| \marg{cmd} \marg{encoding}
+ \oarg{arguments} \oarg{default} \marg{replacement~text}
+
+ |\DeclareTextVariableCommandNoDefault| \marg{cmd} \marg{encoding}
+
+ |\ProvideTextVariableCommand| \marg{cmd} \marg{encoding}
+ \oarg{arguments} \oarg{default} \marg{replacement~text}
+
+ |\DeclareTextVariableAccent| \marg{cmd} \marg{encoding}
+ \marg{slot}
+
+ |\DeclareVariableTextComposition| \marg{cmd} \marg{encoding}
+ \marg{argument}
+\end{cmdusage}
+\bigskip
+
+\DescribeMacro\SetEncodingSearchPath
+This is very much like |\SetFamilySearchPath|; the main difference to
+setting a family search path is that a relaxed encoding \emph{must} set
+its encoding search path.
+
+\begin{cmdusage}
+ |\SetEncodingSearchPath| \marg{encoding} \marg{search~path}
+\end{cmdusage}
+
+\medskip
+
+Now to the part which is not coding. As noone, at the time this is
+written, is particularly experienced in the creation of relaxed
+encodings, this is not a guide of how to do that. This is only a
+collection of some observations I made when I created the
+\texttt{T1R} encoding and the \package{relenc} package.
+
+\begin{itemize}
+ \item
+ When making a relaxed encoding: If you mainly want to free some
+ slots, so that you can include some new set of glyphs (for example
+ additional ligatures) in the font, the obvious place to start is to
+ reduce the number of slots that are assigned to compositions, by
+ implementing these in a variable way.
+ \item
+ When relaxing a composition, there are two ways of doing this:
+ making the composition variable, or making the command variable
+ and defining a composition of some variant. The cost (i.e., the
+ number of special definitions you have to make) is connected to
+ different things in these methods.
+
+ In the case of a composition of a variant, there is a cost
+ connected to having a composition. In the case of a variable
+ composition, the cost is rather connected to not using the default
+ definition for the composition. In the usual case that one either
+ uses a special glyph for a composition or uses the default
+ definition of the accenting command, this means that composition of
+ variant is cheaper if a minority of the compositions uses the
+ default definition and variable composition is cheaper if a
+ majority uses the default definition.
+ \item
+ In some cases, the default definition of an accenting command
+ tends to be suitable for some font families, but inappropriate
+ for others. An example from the \texttt{OT1} encoding is that the
+ definition of |\c| starts by looking at the \emph{height} (!!!) of
+ the character it is to put a cedilla under. If the height is
+ exactly $1\,\textrm{ex}$ then the |\accent| primitive is used,
+ otherwise the accent is put in place using a |\vtop| construction.
+ This works fine (I suppose, trusting DEK to have known what he was
+ doing) for fonts with idealized heights and depths of characters,
+ such as the Computer Modern family of fonts, but is a pure waste
+ of time if the heights and depths are computed from the bounding
+ boxes of the glyphs (like \textit{fontinst} \cite{fontinst} does).
+
+ The conclusion of all this is that it might be a good idea to
+ make accenting commands that have such a specific default definition
+ variable, regardless of how any compositions of these commands might
+ be implemented, so that font designers can override the definitions
+ in case they want to.
+
+\end{itemize}
+
+Apart from this, there is not much advice I can give. It is however
+likely to be a good idea to try to make a specification of the
+encoding---like described in Section \ref{Motivation} or in some other
+way, detailed or only in loose sketches---before starting to do the
+coding.
+
+
+\subsection{Power user commands}
+%
+This subsection treats some commands that may be useful to advanced
+users of the \package{relenc} package (this includes all font and
+encoding designers); in any case, the novice author users can do
+perfectly well without using the commands described here.
+
+\subsubsection{Debugging assistance}
+%
+\DescribeMacro\ShowVariantSearchResult
+As the way from user level command to definition given is quite long
+if the command is variable, there are many instances in which things
+can go wrong. |\ShowVariantSearchResult| may help in sorting out what
+exactly happened. Its primary function is to print the contents of
+all internal variables in \package{relenc} on the terminal and then
+wait for a command, just like after the primitive \TeX\ command |\show|.
+As an extra service, |\ShowVariantSearchResult| also prints the current
+encoding, family, series, and shape.
+
+As most of the processing in \package{relenc} is done in \TeX's mouth,
+there is not very much left to show. The most important piece of data
+there is is the \emph{remaining search path}. This is the part of the
+search path that was \emph{not} scanned in looking for a definition;
+by comparing it to the whole of the search path used, one can
+determine at which stage a definition was found. The other thing shown
+is the definition of |\RE@first@search@item|, which normally is
+defined to be a parameterless macro that expands to the first block
+in the search path most recently used. There are however two cases
+when it is not: (i) If a definition was found in the first stage
+of the most recent search, |\RE@first@search@item| is not altered.
+(ii) If the search has been restarted (see Subsubsection \ref
+{Comp av var}) then |\RE@first@search@item| is a macro with a
+parameter.
+
+Despite these reservations, |\ShowVariantSearchResult| provides about
+all the information there is to get about what a search has found. It
+might also be instructive if you want to understand the inner workings
+of the \package{relenc} package in more detail.
+
+\begin{cmdusage}
+ |\ShowVariantSearchResult|
+\end{cmdusage}
+
+Should |\ShowVariantSearchResult| not give you enough information, you
+can of course always set |\tracingmacros| to 1 and |\tracingcommands|
+to 2 for the time it takes to execute the command you are trying to
+debug, this will give you the whole picture of what \package{relenc}
+does. Before attempting this drastic action however, you should
+familiarise yourself with the implementation of the \package{relenc}
+package.
+
+
+\subsubsection{The `define first' mechanism}
+%
+The `define first' mechanism, which has not been mensioned until now
+because it is not really related to anything else in the package, is
+something very few users should ever have to bother with. It can
+however speed up the typesetting process, as demonstrated in Table
+\ref{Tab:Tid}.
+
+\begin{table}
+ \begin{center}
+ \DeleteShortVerb{\|}
+ \begin{tabular}{|rr@{.}lr@{.}lr@{.}l|}
+ \hline
+ &\multicolumn{6}{c|}{Default encoding}\\[-0.9\ht\strutbox]
+ &\multicolumn{6}{c|}{\hrulefill}\\
+ & \multicolumn{2}{c}{\texttt{OT1}}&\multicolumn{2}{c}{\texttt{T1}}&
+ \multicolumn{2}{c|}{\texttt{T1R}}
+ \\[-0.9\ht\strutbox]
+ & \multicolumn{2}{c}{\hrulefill}& \multicolumn{2}{c}{\hrulefill}&
+ \multicolumn{2}{c|}{\hrulefill}\\
+ \parbox[c]{0.3\columnwidth}{Time taken using \texttt{T1}}&
+ 253&4\,s& 197&5\,s& 255&2\,s\\[1ex]
+ \parbox[c]{0.3\columnwidth}{Time taken using \texttt{T1R}\\
+ (DFM on, no FSP)}&
+ 339&7\,s& 349&5\,s& 294&2\,s\\[2ex]
+ \parbox[c]{0.3\columnwidth}{Time taken using \texttt{T1R}\\
+ (DFM off, no FSP)}&
+ 446&4\,s& 458&3\,s& 400&5\,s\\[2ex]
+ \parbox[c]{0.3\columnwidth}{Time taken using \texttt{T1R}\\
+ (DFM off, has FSP)}&
+ 334&4\,s& 350&9\,s& 293&2\,s\\[2ex]
+ \parbox[c]{0.3\columnwidth}{Time taken using \texttt{T1R}\\
+ (DFM on, has FSP)}&
+ 316&7\,s& 327&5\,s& 269&9\,s\\[2ex]
+ \hline
+ \end{tabular}%
+ \MakeShortVerb{\|}
+ \end{center}\medskip
+
+ \begingroup\footnotesize \parindent=1em
+ DFM = Define First Mechanism
+
+ FSP = Family Search Path. The family search path used was
+ optimised to examine only the levels at which there actually
+ existed some variant.
+
+ The `default encoding' in this table is the encoding whose
+ encoding definition file was read in last. As explained in
+ \cite{ltoutenc}, this means that all commands declared in that
+ encoding will execute somewhat faster when that encoding is the
+ current.
+
+ The test text used consisted of all non-accented letters declared
+ in the \texttt{T1} encoding (a--z, as well as \ae, \ss, \i, and a
+ few others) in both upper and lower case, as they are as well as
+ accented with every accent command available (|\`|, |\'|, |\^|, |\~|,
+ |\"|, |\H|, |\r|, |\v|, |\u|, |\=|, |\.|, |\b|, |\c|, |\d|, and
+ |\k|). These 32 lines were then repeated 100 times, to reduce the
+ relaive amount of time taken to start the process.\par
+ \endgroup
+
+ \caption{A comparision of typesetting speed}\label{Tab:Tid}
+\end{table}
+
+What the define first mechanism (DFM) does, when it is active, is
+that if a definition is not found in the first step of the search
+path scan and a definition is found in some later step, then that
+definition is copied to the control sequence scanned in the first step.
+Thus the next time that the same command is issued, the scan of the
+search path will find a definition in the first step.
+
+This can speed up the search considerably, but there is a price to pay:
+More control sequnces gets defined, meaning more of \TeX's memory is
+being used for storing definitions of variable commands.\footnote{Or
+so it would appear \textellipsis\ Some things I've recently learnt
+about how \TeX's internal tables work has made me wonder about whether
+it really takes more memory, so I am currently not sure. Perhaps
+someone competent in the area of \TeX's memory management will
+volunteer to sort things out for me?} If you run out of memory while
+typesetting a document with the DFM on, turning it off will lower the
+memory requirements. If your \TeX\ is generally low on memory however,
+you should probably not be using relaxed encodings at all, since the
+basic deal of the entire package is to loosen the restrictions on fonts
+for a particular encoding by increasing the number of control sequences
+needed for the typesetting process.
+
+But these differences should be seen for what they really are,
+differences in speed for one of the many things \TeX\ have to do to
+typeset something. \TeX\ does no linebreaking during the tests in
+Table \ref{Tab:Tid} (hence no hyphentaing either), does not read any
+input after the first five seconds (the entire text is generated through
+expanding macros), has a very simple job pagebreaking, and so forth.
+In addition, the percentage of letters generated through font-dependent
+commands is much greater in the test text than what one would find in
+a normal \TeX\ manuscript. This circumstance also reduces the effect
+that the tabulated differences in speed will have on the overall
+typesetting speed for a normal \TeX\ manuscript.
+
+If you have not noticed that your document is being typeset slower due
+to the fact that the encoding used is not the encoding whose definition
+file was read in last, then chances are you would not notice any drop
+in speed if it was typeset using a relaxed encoding either.
+
+\medskip
+
+\DescribeMacro\ActivateDefineFirst
+\DescribeMacro\DeactivateDefineFirst
+The DFM is turned on and off using the commands
+|\ActivateDefineFirst| and |\DeactivateDefineFirst|, none of which
+have any parameters. As it is currently implemented, the activation
+state of the DFM is affected by grouping, but the defining it does
+is global.
+
+\begin{cmdusage}
+ |\ActivateDefineFirst|
+
+ |\DeactivateDefineFirst|
+\end{cmdusage}
+
+
+% The implementation
+% \part{\texttt{relenc.dtx}}
+\DocInput{relenc.dtx}\Finale
+
+
+\appendix
+
+\part*{The \texttt{T1R} encoding}
+\addcontentsline{toc}{part}{The \texttt{T1R} encoding}
+\DocInput{t1renc.dtx}\Finale
+
+\part*{The \texttt{zcm} example font family}
+\addcontentsline{toc}{part}{The \texttt{zcm} example font family}
+\DocInput{t1rzcm.fdd}\Finale
+
+
+\begin{thebibliography}{99}
+%
+\bibitem{ltoutenc}
+ Johannes Braams, David Carlisle, Alan Jeffrey, Frank Mittelbach,
+ Chris Rowley, Rainer Sch\"opf: \texttt{ltoutenc.dtx} (part of the
+ \LaTeXe\ base distribution).
+%
+\bibitem{fontinst}
+ Alan Jeffrey, Rowland McDonnell (manual), Sebastian Rahtz,
+ Ulrik Vieth: \emph{The fontinst utility} (v\,1.8),
+ \texttt{fontinst.dtx}, in CTAN at \texttt{ftp:/\slash
+ ftp.tex.ac.uk\slash tex-archive\slash fonts\slash utilities\slash
+ fontinst\slash}\textellipsis
+%
+\bibitem{fntguide}
+ \LaTeX3 Project Team: \emph{\LaTeXe\ font selection},
+ \texttt{fntguide.tex} (part of the \LaTeXe\ base distribution).
+%
+\bibitem{encguide}
+ Frank Mittelbach [et al. ?]: \texttt{encguide.tex}. To appear as
+ part of the \LaTeXe\ base distribution. Sometime. Or at least, that
+ is the intention.
+%
+\end{thebibliography}
+
+
+\end{document}
diff --git a/macros/latex/contrib/relenc/t1renc.dtx b/macros/latex/contrib/relenc/t1renc.dtx
new file mode 100644
index 0000000000..2e4f293d8d
--- /dev/null
+++ b/macros/latex/contrib/relenc/t1renc.dtx
@@ -0,0 +1,998 @@
+%% \CheckSum{474}
+% \iffalse (Comment)
+% This file contains the specification of the T1R encoding, as well
+% as the actual code for its encoding definition file.
+% \fi
+% \iffalse (Driver code)
+%<*driver>
+\documentclass{ltxdoc}
+\DeclareTextFontCommand{\textcmtt}{\usefont{OT1}{cmtt}{m}{n}}
+\newcommand\package[1]{\textsf{#1}}
+\title{The \texttt{T1R} encoding}
+\author{Lars Hellstr\"om%
+ \thanks{E-mail: \texttt{Lars.Hellstrom@math.umu.se}}%
+}
+\begin{document}
+\maketitle
+\DocInput{t1renc.dtx}\Finale
+\begin{thebibliography}{99}
+%
+\bibitem{fontinst}
+ Alan Jeffrey, Rowland McDonnell (manual), Sebastian Rahtz,
+ Ulrik Vieth: \emph{The fontinst utility} (v\,1.8),
+ \texttt{fontinst.dtx}, in CTAN at \texttt{ftp:/\slash
+ ftp.tex.ac.uk\slash tex-archive\slash fonts\slash utilities\slash
+ fontinst\slash}\textellipsis
+%
+\end{thebibliography}
+\end{document}
+%</driver>
+% \fi
+%
+% \iffalse (Comment)
+% Definitions needed for the documentation of the encoding. I know
+% they really belong in the preamble, but I prefer having them in one
+% place (this text is used in two different documents, with different
+% preambles).
+% \fi
+% \makeatletter
+% \begingroup
+% \lccode`\$=13\relax
+% \lowercase{^^A
+% \gdef\ifempty#1{\ifx$#1$^^A
+% \expandafter\@firstoftwo
+% \else
+% \expandafter\@secondoftwo
+% \fi
+% }
+% }
+% \endgroup
+% \makeatother
+%
+% \newcommand\glyph[2]{^^A
+% \ifempty{#1}{^^A
+% \textit{#2}^^A
+% }{^^A
+% `\textcmtt{#1}' \ifempty{#2}{}{(\textit{#2})}^^A
+% }^^A
+% }
+% \newcommand\LIG[6]{\glyph{#1}{#2} $+$ \glyph{#3}{#4} $\mapsto$
+% \glyph{#5}{#6}}
+% \newcommand\tLIG[6]{\glyph{#1}{#2}&$+$&\glyph{#3}{#4}&$\mapsto$&%
+% \glyph{#5}{#6}}
+%
+% \makeatletter
+% \newcount\count@q
+% \newcommand\octbase[1]{^^A
+% \count@=#1\relax
+% \count@q=\count@
+% \divide \count@q 64\relax
+% \ifnum 0<\count@q
+% \the\count@q
+% \multiply \count@q 64^^A
+% \advance \count@ -\count@q
+% \fi
+% \count@q=\count@
+% \divide \count@q 8\relax
+% \ifnum 0<\count@q
+% \the\count@q
+% \multiply \count@q 8^^A
+% \advance \count@ -\count@q
+% \fi
+% \the\count@
+% }
+% \newcommand\hexbase[1]{^^A
+% \count@=#1\relax
+% \count@q=\count@
+% \divide \count@q 16\relax
+% \hexnumber@\count@q
+% \multiply \count@q 16^^A
+% \advance \count@ -\count@q
+% \hexnumber@\count@
+% }
+% \newcommand\spreadfourthrow[1]{^^A
+% \count@=#1\relax
+% \count@q=\count@
+% \divide \count@q 4^^A
+% \multiply \count@q 4^^A
+% \advance \count@ -\count@q
+% \ifnum 3=\count@
+% \vrule width\z@ depth1.4\dp\strutbox \relax
+% \fi
+% }
+% \makeatother
+% \newcommand\inbases[1]{^^A
+% {\small\octbase{#1}}&^^A
+% #1\spreadfourthrow{#1}&^^A
+% \texttt{\small\hexbase{#1}^^A
+% }%
+% }
+%
+%
+% \section{Specification}
+%
+% The \texttt{T1R} encoding is meant to be (almost) equivalent to the
+% \texttt{T1} encoding from the author's point of view but offer
+% larger flexibility to font designers than the \texttt{T1} encoding
+% does---especially the flexibility to include additional ligatures. It
+% is thus what I call a \emph{relaxed} version of the \texttt{T1}
+% encoding, which is also the reason for its name.
+%
+% Its basic derivation from \texttt{T1} can be easily described: Slots
+% 0--63, 64--127, and 192--255 have exactly the same contents as in the
+% \texttt{T1} encoding, whilst slots 128--191 can be used in any way
+% the font designer wants; the set of commands, syntactic ligatures,
+% and directly usable characters is exactly the same as in the
+% \texttt{T1} encoding. The result of my intention to give a formal
+% description of the encoding might of course be that this description
+% deviates slightly from the above, but it lines out the basic ideas.
+%
+% The reasons for choosing this basis are pretty arbitrary, especially
+% in terms of the assignment of slots. To begin with it gives a simple
+% rule (the 256 slots in the font are divided into four continuous blocks
+% of 64 slots each) and secondly almost all glyphs in slot ranges 0--63,
+% 64--127, and 192--255 can be found in many popular fonts, but most of
+% the glyphs in the slot range 128--191 are hard to find. Hence these
+% glyphs will very frequently have to be made somehow anyway, the question
+% is only at what time this will happen: At the time \TeX\ is running, or
+% afterwards, when a virtual font is interpreted? The character usually
+% looks the same.
+%
+% That is not the same thing as saying that it does not matter which,
+% because it may well do. \TeX\ will not automatically hyphenate words
+% containing letters that are not a single character in the font, so some
+% care is necessary. It is however the case that documents that both use and
+% require hyphenation of all the accented characters that appear in
+% slots 128--191 are extremely few (or do no exist at all---yet), so
+% there are usually plenty of slots available for the font designer to
+% put, for example, additional ligatures in. It might however well be that
+% two different implementations of the same font (presumably made on
+% different locations) have kept different sets of characters, due to
+% the fact that the two implementors speak different languages and hence
+% need hyphentation of different sets of accented letters. This causes no
+% problems (unless the implementors are exchanging \texttt{dvi} files), as
+% the code in the font definition files would mirror this difference and
+% set up the variable commands correctly anyhow, so that exchanging
+% \texttt{.tex} manuscripts does not cause problems.
+%
+% Now for the more formal description, with reservation for that (i) I
+% might have missed some point about the \texttt{T1} encoding, lacking a
+% formal definition of that and (ii) the current version of the
+% \texttt{T1R} encoding is only a beta, so some details may well change
+% in the future. In particular, the decisions about whether a
+% composition should be a composition of a variant or a composition of
+% the main variable command were usually pretty randomly made, so if
+% someone should present me with a good reason why it should not be as
+% it currently is, then there is a good chance I would change
+% it\footnote{Unless too many people's code have already come to depend
+% on it. But in that case, there is always the possibility to make new
+% encoding that differs from \texttt{T1R} only in a few such points and
+% recommend people to use that instead.}.
+%
+%
+% \subsection{The coding scheme}
+%
+% \begin{table}
+% \DeleteShortVerb{\|}
+% \begin{center}
+% \begin{tabular}{|rrrl|rrrl|}
+% \hline
+% \multicolumn{3}{|c}{Slot}& \multicolumn{1}{c}{Glyph}&
+% \multicolumn{3}{|c}{Slot}& \multicolumn{1}{c|}{Glyph}%
+% \\[-0.9\ht\strutbox]
+% \multicolumn{3}{|c}{\hrulefill}&\hrulefill&
+% \multicolumn{3}{|c}{\hrulefill}&\hrulefill\\
+% \underline{Oct.}& \underline{Dec.}& \underline{Hex.}&&
+% \underline{Oct.}& \underline{Dec.}& \underline{Hex.}&\\
+% \inbases{0}&\glyph{\`{}}{grave accent}&
+% \inbases{32}&\glyph{\textvisiblespace}{visible space}\\
+% \inbases{1}&\glyph{\'{}}{acute accent}&
+% \inbases{33}&\glyph{!}{}\\
+% \inbases{2}&\glyph{\^{}}{circumflex accent}&
+% \inbases{34}&\glyph{"}{quotedbl}\\
+% \inbases{3}&\glyph{\~{}}{tilde accent}&
+% \inbases{35}&\glyph{\#}{}\\
+% \inbases{4}&\glyph{\"{}}{dieresis}&
+% \inbases{36}&\glyph{\$}{}\\
+% \inbases{5}&\glyph{}{Hungarian umlaut}&
+% \inbases{37}&\glyph{\%}{}\\
+% \inbases{6}&\glyph{\r{}}{ring accent}&
+% \inbases{38}&\glyph{\&}{}\\
+% \inbases{7}&\glyph{\v{}}{caron accent}&
+% \inbases{39}&\glyph{'}{quoteright}\\
+% \inbases{8}&\glyph{\u{}}{breve accent}&
+% \inbases{40}&\glyph{(}{}\\
+% \inbases{9}&\glyph{\={}}{macron accent}&
+% \inbases{41}&\glyph{)}{}\\
+% \inbases{10}&\glyph{}{dot accent}&
+% \inbases{42}&\glyph{*}{asterisk}\\
+% \inbases{11}&\glyph{\char24}{cedilla accent}&
+% \inbases{43}&\glyph{+}{}\\
+% \inbases{12}&\glyph{}{ogonek accent}&
+% \inbases{44}&\glyph{,}{comma}\\
+% \inbases{13}&\glyph{}{quotesinglbase}&
+% \inbases{45}&\glyph{-}{hyphen}\\
+% \inbases{14}&\glyph{}{guilsinglleft}&
+% \inbases{46}&\glyph{.}{}\\
+% \inbases{15}&\glyph{}{guilsinglright}&
+% \inbases{47}&\glyph{/}{slash}\\
+% \inbases{16}&\glyph{}{quotedblleft}&
+% \inbases{48}&\glyph{0}{zero}\\
+% \inbases{17}&\glyph{}{quotedblright}&
+% \inbases{49}&\glyph{1}{}\\
+% \inbases{18}&\glyph{}{quotedblbase}&
+% \inbases{50}&\glyph{2}{}\\
+% \inbases{19}&\glyph{}{guillemotleft}&
+% \inbases{51}&\glyph{3}{}\\
+% \inbases{20}&\glyph{}{guillemotright}&
+% \inbases{52}&\glyph{4}{}\\
+% \inbases{21}&\glyph{}{endash}&
+% \inbases{53}&\glyph{5}{}\\
+% \inbases{22}&\glyph{}{emdash}&
+% \inbases{54}&\glyph{6}{}\\
+% \inbases{23}&\glyph{}{compwordmark}&
+% \inbases{55}&\glyph{7}{}\\
+% \inbases{24}&\glyph{}{perthousandzero}&
+% \inbases{56}&\glyph{8}{}\\
+% \inbases{25}&\glyph{\i}{dotlessi}&
+% \inbases{57}&\glyph{9}{}\\
+% \inbases{26}&\glyph{\j}{dotlessj}&
+% \inbases{58}&\glyph{:}{}\\
+% \inbases{27}&not specified&
+% \inbases{59}&\glyph{;}{}\\
+% \inbases{28}&not specified&
+% \inbases{60}&\glyph{<}{}\\
+% \inbases{29}&not specified&
+% \inbases{61}&\glyph{=}{}\\
+% \inbases{30}&not specified&
+% \inbases{62}&\glyph{>}{}\\
+% \inbases{31}&not specified&
+% \inbases{63}&\glyph{?}{}\\
+% \hline
+% \end{tabular}
+% \end{center}
+% \caption{The coding scheme for the \texttt{T1R} encoding,
+% slots 0--63}
+% \label{Block0}
+% \MakeShortVerb{\|}
+% \end{table}
+% \begin{table}
+% \DeleteShortVerb{\|}
+% \begin{center}
+% \begin{tabular}{|rrrl|rrrl|}
+% \hline
+% \multicolumn{3}{|c}{Slot}& \multicolumn{1}{c}{Glyph}&
+% \multicolumn{3}{|c}{Slot}& \multicolumn{1}{c|}{Glyph}%
+% \\[-0.9\ht\strutbox]
+% \multicolumn{3}{|c}{\hrulefill}&\hrulefill&
+% \multicolumn{3}{|c}{\hrulefill}&\hrulefill\\
+% \underline{Oct.}& \underline{Dec.}& \underline{Hex.}&&
+% \underline{Oct.}& \underline{Dec.}& \underline{Hex.}&\\
+% \inbases{64}&\glyph{@}{}& \inbases{96}&\glyph{`}{quoteleft}\\
+% \inbases{65}&\glyph{A}{}& \inbases{97}&\glyph{a}{}\\
+% \inbases{66}&\glyph{B}{}& \inbases{98}&\glyph{b}{}\\
+% \inbases{67}&\glyph{C}{}& \inbases{99}&\glyph{c}{}\\
+% \inbases{68}&\glyph{D}{}& \inbases{100}&\glyph{d}{}\\
+% \inbases{69}&\glyph{E}{}& \inbases{101}&\glyph{e}{}\\
+% \inbases{70}&\glyph{F}{}& \inbases{102}&\glyph{f}{}\\
+% \inbases{71}&\glyph{G}{}& \inbases{103}&\glyph{g}{}\\
+% \inbases{72}&\glyph{H}{}& \inbases{104}&\glyph{h}{}\\
+% \inbases{73}&\glyph{I}{}& \inbases{105}&\glyph{i}{}\\
+% \inbases{74}&\glyph{J}{}& \inbases{106}&\glyph{j}{}\\
+% \inbases{75}&\glyph{K}{}& \inbases{107}&\glyph{k}{}\\
+% \inbases{76}&\glyph{L}{}& \inbases{108}&\glyph{l}{}\\
+% \inbases{77}&\glyph{M}{}& \inbases{109}&\glyph{m}{}\\
+% \inbases{78}&\glyph{N}{}& \inbases{110}&\glyph{n}{}\\
+% \inbases{79}&\glyph{O}{}& \inbases{111}&\glyph{o}{}\\
+% \inbases{80}&\glyph{P}{}& \inbases{112}&\glyph{p}{}\\
+% \inbases{81}&\glyph{Q}{}& \inbases{113}&\glyph{q}{}\\
+% \inbases{82}&\glyph{R}{}& \inbases{114}&\glyph{r}{}\\
+% \inbases{83}&\glyph{S}{}& \inbases{115}&\glyph{s}{}\\
+% \inbases{84}&\glyph{T}{}& \inbases{116}&\glyph{t}{}\\
+% \inbases{85}&\glyph{U}{}& \inbases{117}&\glyph{u}{}\\
+% \inbases{86}&\glyph{V}{}& \inbases{118}&\glyph{v}{}\\
+% \inbases{87}&\glyph{W}{}& \inbases{119}&\glyph{w}{}\\
+% \inbases{88}&\glyph{X}{}& \inbases{120}&\glyph{x}{}\\
+% \inbases{89}&\glyph{Y}{}& \inbases{121}&\glyph{y}{}\\
+% \inbases{90}&\glyph{Z}{}& \inbases{122}&\glyph{z}{}\\
+% \inbases{91}&\glyph{[}{}& \inbases{123}&\glyph{\char`\{}{}\\
+% \inbases{92}&\glyph{\char`\\}{}&
+% \inbases{124}&\glyph{|}{}\\
+% \inbases{93}&\glyph{]}{}& \inbases{125}&\glyph{\char`\}}{}\\
+% \inbases{94}&\glyph{\char`\^}{circumflex character}&
+% \inbases{126}&\glyph{\char`\~}{tilde character}\\
+% \inbases{95}&\glyph{\_}{}& \inbases{127}&\glyph{}{hyphenchar}\\
+% \hline
+% \end{tabular}
+% \end{center}
+% \caption{The coding scheme for the \texttt{T1R} encoding,
+% slots 64--127}
+% \label{Block1}
+% \MakeShortVerb{\|}
+% \end{table}
+% \begin{table}
+% \DeleteShortVerb{\|}
+% \begin{center}
+% \begin{tabular}{|rrrl|rrrl|}
+% \hline
+% \multicolumn{3}{|c}{Slot}& \multicolumn{1}{c}{Glyph}&
+% \multicolumn{3}{|c}{Slot}& \multicolumn{1}{c|}{Glyph}%
+% \\[-0.9\ht\strutbox]
+% \multicolumn{3}{|c}{\hrulefill}&\hrulefill&
+% \multicolumn{3}{|c}{\hrulefill}&\hrulefill\\
+% \underline{Oct.}& \underline{Dec.}& \underline{Hex.}&&
+% \underline{Oct.}& \underline{Dec.}& \underline{Hex.}&\\
+% \inbases{192}&\glyph{\`A}{}& \inbases{224}&\glyph{\`a}{}\\
+% \inbases{193}&\glyph{\'A}{}& \inbases{225}&\glyph{\'a}{}\\
+% \inbases{194}&\glyph{\^A}{}& \inbases{226}&\glyph{\^a}{}\\
+% \inbases{195}&\glyph{\~A}{}& \inbases{227}&\glyph{\~a}{}\\
+% \inbases{196}&\glyph{\"A}{}& \inbases{228}&\glyph{\"a}{}\\
+% \inbases{197}&\glyph{\r{A}}{}& \inbases{229}&\glyph{\r{a}}{}\\
+% \inbases{198}&\glyph{\AE}{}& \inbases{230}&\glyph{\ae}{}\\
+% \inbases{199}&\glyph{\c{C}}{}& \inbases{231}&\glyph{\c{c}}{}\\
+% \inbases{200}&\glyph{\`E}{}& \inbases{232}&\glyph{\`e}{}\\
+% \inbases{201}&\glyph{\'E}{}& \inbases{233}&\glyph{\'e}{}\\
+% \inbases{202}&\glyph{\^E}{}& \inbases{234}&\glyph{\^e}{}\\
+% \inbases{203}&\glyph{\"E}{}& \inbases{235}&\glyph{\"e}{}\\
+% \inbases{204}&\glyph{\`I}{}& \inbases{236}&\glyph{\`\i}{}\\
+% \inbases{205}&\glyph{\'I}{}& \inbases{237}&\glyph{\'\i}{}\\
+% \inbases{206}&\glyph{\^I}{}& \inbases{238}&\glyph{\^\i}{}\\
+% \inbases{207}&\glyph{\"I}{}& \inbases{239}&\glyph{\"\i}{}\\
+% \inbases{208}&\glyph{}{Eth}& \inbases{240}&\glyph{}{eth}\\
+% \inbases{209}&\glyph{\~N}{}& \inbases{241}&\glyph{\~n}{}\\
+% \inbases{210}&\glyph{\`O}{}& \inbases{242}&\glyph{\`o}{}\\
+% \inbases{211}&\glyph{\'O}{}& \inbases{243}&\glyph{\'o}{}\\
+% \inbases{212}&\glyph{\^O}{}& \inbases{244}&\glyph{\^o}{}\\
+% \inbases{213}&\glyph{\~O}{}& \inbases{245}&\glyph{\~o}{}\\
+% \inbases{214}&\glyph{\"O}{}& \inbases{246}&\glyph{\"o}{}\\
+% \inbases{215}&\glyph{\OE}{OE}& \inbases{247}&\glyph{\oe}{}\\
+% \inbases{216}&\glyph{\O}{}& \inbases{248}&\glyph{\o}{}\\
+% \inbases{217}&\glyph{\`U}{}& \inbases{249}&\glyph{\`u}{}\\
+% \inbases{218}&\glyph{\'U}{}& \inbases{250}&\glyph{\'u}{}\\
+% \inbases{219}&\glyph{\^U}{}& \inbases{251}&\glyph{\^u}{}\\
+% \inbases{220}&\glyph{\"U}{}& \inbases{252}&\glyph{\"u}{}\\
+% \inbases{221}&\glyph{\'Y}{}& \inbases{253}&\glyph{\'y}{}\\
+% \inbases{222}&\glyph{}{Thorn}& \inbases{254}&\glyph{}{thorn}\\
+% \inbases{223}&\glyph{}{SS}&
+% \inbases{255}&\glyph{\ss}{germandbls}\\
+% \hline
+% \end{tabular}
+% \end{center}
+% \caption{The coding scheme for the \texttt{T1R} encoding,
+% slots 192--255}
+% \label{Block3}
+% \MakeShortVerb{\|}
+% \end{table}
+%
+% Every coding scheme for a \texttt{T1R} encoded font should comply to what
+% is specified in Tables \ref{Block0}, \ref{Block1}, and \ref{Block3}.
+% The corresponding table for slots 128--191 would read ``not specified''
+% in every entry in the glyph columns, so it has been omitted. `not
+% specified' means that the contents of that slot is not specified, so it
+% is completely up to the font designer to decide, although there is always
+% a default glyph even for the unassigned slots (viz.\ the same glyph as
+% in the \texttt{T1} encoding). In most cases, there must be some
+% font-dependent command variant definitions in the font definition file for
+% each slot that deviates from the default.
+%
+% The author is guaranteed to be able to access the characters in slots
+% 32--126 simply through character tokens.
+%
+%
+% \subsection{The syntactic ligatures}
+% %
+% \begin{table}
+% \begin{center}
+% \DeleteShortVerb{\|}
+% \begin{tabular}{|lclcl|}
+% \hline
+% \tLIG{-}{hyphen}{-}{hyphen}{}{endash}\\
+% \tLIG{}{endash}{-}{hyphen}{}{emdash}\\
+% \tLIG{!}{}{`}{}{!`}{}\\
+% \tLIG{'}{}{'}{}{}{quotedblright}\\
+% \tLIG{,}{}{,}{}{}{quotedblbase}\\
+% \tLIG{-}{hyphen}{}{hyphenchar}{}{hyphenchar}\\
+% \tLIG{<}{}{<}{}{}{guillemotleft}\\
+% \tLIG{>}{}{>}{}{}{guillemotright}\\
+% \tLIG{?}{}{`}{}{?`}{}\\
+% \tLIG{`}{}{`}{}{}{quotedblleft}\\
+% \hline
+% \end{tabular}
+% \MakeShortVerb{\|}
+% \end{center}
+% \caption{The required syntactic ligatures in the \texttt{T1R}
+% encoding}
+% \label{Ligatures}
+% \end{table}
+% The required syntactic ligatures in the \texttt{T1R} encoding are
+% listed in Table \ref{Ligatures}. Actually, the
+% \LIG{-}{hyphen}{}{hyphenchar}{}{hyphenchar} ligature is a kind of
+% ``semi-aestetic'' ligature, as it might have an aestetic function as
+% well as a syntactic. When \TeX\ hyphenates a word, a
+% \glyph{}{hyphenchar} is automatically inserted at the hyphenation point,
+% but when the hyphenation point falls immediately after an explicit
+% hyphen, this would result in two hyphens in the printed output, if it
+% was not for this ligature. If you know what you do, you may change or
+% even leave this ligature out, but be prepared that such an action must
+% be attuned to, amongst other things, the hyphenation patterns and the
+% current value of the \TeX\ font parameter |\hyphenchar|.
+%
+%
+% \subsection{The font dimensions}
+% %
+% \begin{table}
+% \begin{center}
+% \DeleteShortVerb{\|}
+% \begin{tabular}{|rl|rl|}
+% \hline
+% No.& Meaning& No.& Meaning\\[-0.9\ht\strutbox]
+% \hrulefill&\hrulefill&\hrulefill&\hrulefill\\
+% 1& Slant per pt& 5& x-height (size of 1\thinspace ex)\\
+% 2& Interword space& 6& Quad width (size of 1\thinspace em)\\
+% 3& Interword stretch& 7& Extra space\\
+% 4& Interword shrink&&\\
+% \hline
+% \end{tabular}
+% \MakeShortVerb{\|}
+% \end{center}
+% \caption{Required \cs{fontdimen}s in an \texttt{T1R} encoded font}
+% \label{fontdimens}
+% \end{table}
+% %
+% As for the required font dimensions, I have chosen to only require
+% the seven font dimensions that all \TeX\ fonts have in common. These
+% are listed in Table \ref{fontdimens}. As both the \texttt{ec} family
+% of fonts and the \texttt{T1} encoded fonts made by \textit{fontinst}
+% (as of v\,1.8, see~\cite{fontinst}) have seven more however, it seems
+% like that set of fourteen font dimensions should be considered the
+% current \texttt{T1} standard. I will probably have added the other seven
+% by the time I get to the first non-beta release, but I have refrained
+% from including them in this release since I do not feel sure enough
+% about what they are to write a formal specification for them. It should
+% be noted, though, that the specification only lists a minimal set of
+% font dimensions---therefore including the other seven in a font is most
+% likely only good.
+%
+%
+% \subsection{The font-dependent commands}
+% %
+% The font-dependent commands of the \texttt{T1R} encoding fall into two
+% categories: symbol commands and accenting commands. The symbol
+% commands simply typeset one symbol. The accenting commands take one
+% argument and typesets the result of accenting the material that the
+% argument would typeset.
+%
+% \begin{table}
+% \vspace*{0pt minus 1.5cm}
+% \begin{center}
+% \small
+% \DeleteShortVerb{\|}
+% \begin{tabular}{|l l l|}
+% \hline \MakeShortVerb{\|}^^A
+% Command& Action& Remark\\[-0.9\ht\strutbox]
+% \hrulefill&\hrulefill&\hrulefill\\
+% |\AE|& Typeset \glyph{\AE}{}&\\
+% |\ae|& Typeset \glyph{\ae}{}&\\
+% |\DH|& Typeset \glyph{}{Eth}&\\
+% |\dh|& Typeset \glyph{}{eth}&\\
+% |\DJ|& Typeset \glyph{}{Eth}&\\
+% |\dj|& Typeset \glyph{}{dbar}& Variable\\
+% |\guillemotleft|& Typeset \glyph{}{guillemotleft}&\\
+% |\guillemotright|& Typeset \glyph{}{guillemotright}&\\
+% |\guilsinglleft|& Typeset \glyph{}{guilsinglleft}&\\
+% |\guilsinglright|& Typeset \glyph{}{guilsinglright}&\\
+% |\i|& Typeset \glyph{\i}{dotlessi}&\\
+% |\j|& Typeset \glyph{\j}{dotlessj}&\\
+% |\L|& Typeset \glyph{}{Lslash}& Variable\\
+% |\l|& Typeset \glyph{}{lslash}& Variable\\
+% |\NG|& Typeset \glyph{}{Eng}& Variable\\
+% |\ng|& Typeset \glyph{}{eng}& Variable\\
+% |\OE|& Typeset \glyph{\OE}{OE}&\\
+% |\oe|& Typeset \glyph{\oe}{}&\\
+% |\O|& Typeset \glyph{\O}{}&\\
+% |\o|& Typeset \glyph{\o}{}&\\
+% |\quotedblbase|& Typeset \glyph{}{quotedblbase}&\\
+% |\quotesinglbase|& Typeset \glyph{}{quotesinglbase}&\\
+% |\SS|& Typeset \glyph{}{SS}& Variable\\
+% |\ss|& Typeset \glyph{\ss}{}&\\
+% |\textasciicircum|& Typeset \glyph{\char`\^}{circumflex character}&\\
+% |\textasciitilde|& Typeset \glyph{\char`\~}{tilde character}&\\
+% |\textbackslash|& Typeset \glyph{\char`\\}{}&\\
+% |\textbar|& Typeset \glyph{\char`\|}{}&\\
+% |\textbraceleft|& Typeset \glyph{\char`\{}{}&\\
+% |\textbraceright|& Typeset \glyph{\char`\}}{}&\\
+% |\textcompwordmark|& Typeset \glyph{}{compwordmark}&\\
+% |\textdollar|& Typeset \glyph{\$}{}&\\
+% |\textemdash|& Typeset \glyph{}{emdash}&\\
+% |\textendash|& Typeset \glyph{}{endash}&\\
+% |\textexclamdown|& Typeset \glyph{!`}{}& Variable\\
+% |\textgreater|& Typeset \glyph{>}{}&\\
+% |\textless|& Typeset \glyph{<}{}&\\
+% |\textperthousand|& Typeset \glyph{\%}{} followed by
+% one \glyph{}{perthousandzero}&\\
+% |\textpertenthousand|& Typeset \glyph{\%}{} followed by
+% two \glyph{}{perthousandzero}&\\
+% |\textquestiondown|& Typeset \glyph{?`}{}& Variable\\
+% |\textquotedblleft|& Typeset \glyph{}{quotedblleft}&\\
+% |\textquotedblright|& Typeset \glyph{}{quotedblright}&\\
+% |\textquotedbl|& Typeset \glyph{"}{quotedbl}&\\
+% |\textquoteleft|& Typeset \glyph{`}{}&\\
+% |\textquoteright|& Typeset \glyph{'}{}&\\
+% |\textsection|& Typeset \glyph{}{section}& Variable\\
+% |\textsterling|& Typeset \glyph{}{sterling}& Variable\\
+% |\textunderscore|& Typeset \glyph{\_}{}&\\
+% |\textvisiblespace|& Typeset \glyph{\char`\ }{}&\\
+% |\TH|& Typeset \glyph{}{Thorn}&\\
+% |\th|& Typeset \glyph{}{thorn}&\\
+% \hline
+% \end{tabular}
+% \end{center}
+% \caption{The symbol commands of the \texttt{T1R} encoding}
+% \label{SymbolCommands}
+% \end{table}
+% \begin{table}
+% \begin{center}
+% \DeleteShortVerb{\|}
+% \begin{tabular}{|c p{0.35\linewidth} p{0.4\linewidth}|}
+% \hline \MakeShortVerb{\|}^^A
+% Command& Action& Remark\\[-0.9\ht\strutbox]
+% \hrulefill&\hrulefill&\hrulefill\\
+% |\`|& Typeset the argument with a grave accent above it&
+% Compositions for |A|, |a|, |E|, |e|, |I|, |i|, |\i|, |O|, |o|,
+% |U|, and |u|\\
+% |\'|& Typeset the argument with an acute accent above it&
+% Compositions for |A|, |a|, |C| (var.), |c| (var.), |E|, |e|, |I|,
+% |i|, |\i|, |L| (var.), |l| (var.), |N| (var.), |n| (var.), |O|,
+% |o|, |R| (var.), |r| (var.), |S| (var.), |s| (var.), |U|, |u|,
+% |Y|, |y|, |Z| (var.), and |z| (var.)\\
+% |\^|& Typeset the argument with a circumflex accent above it&
+% Compositions for |A|, |a|, |E|, |e|, |I|, |i|, |\i|, |O|, |o|,
+% |U|, and |u|\\
+% |\~|& Typeset the argument with a tilde accent above it&
+% Compositions for |A|, |a|, |N|, |n|, |O|, and |o|\\
+% |\"|& Typeset the argument with a dieresis accent above it&
+% Compositions for |A|, |a|, |E|, |e|, |I|, |i|, |\i|, |O|, |o|,
+% |U|, |u|, |Y| (var.), and |y| (var.)\\
+% |\H|& Typeset the argument with a Hungarian umlaut above it&
+% Variable; compositions of the encoding level variant for |O|,
+% |o|, |U|, and |u|\\
+% |\r|& Typeset the argument with a ring accent above it&
+% Compositions for |A|, |a|, |U| (var.), and |u| (var.)\\
+% |\v|& Typeset the argument with a caron accent above it&
+% Variable; compositions of the encoding level variant for |C|,
+% |c|, |D|, |d|, |E|, |e|, |L|, |l|, |N|, |n|, |R|, |r|, |S|, |s|,
+% |T|, |t|, |Z|, and |z|\\
+% |\u|& Typeset the argument with a breve accent above it&
+% Variable; compositions of the encoding level variant for |A|,
+% |a|, |G|, and |g|\\
+% |\=|& Typeset the argument with a macron accent above it&\\
+% |\.|& Typeset the argument with a dot accent above it&
+% Variable; compositions of the encoding level variant for |I|,
+% |i|, |Z|, and |z|\\
+% |\b|& Typeset the argument with a macron accent under it&\\
+% |\c|& Typeset the argument with a cedilla accent under it&
+% Variable; compositions for |C|, |c|, |S| (var.), |s| (var.),
+% |T| (var.), and |t| (var.)\\
+% |\d|& Typeset the argument with a dot accent under it&\\
+% |\k|& Typeset the argument with an ogonek accent under it&
+% Variable; compositions of the encoding level variant for |A|,
+% |a|, |E|, and |e|\\
+% \hline
+% \end{tabular}
+% \end{center}
+% \caption{The accenting commands of the \texttt{T1R} encoding}
+% \label{AccentCommands}
+% \end{table}
+%
+% A list of the symbol commands of the \texttt{T1R} encoding can be found
+% in Table~\ref{SymbolCommands}. One thing worth noticing about this table
+% is that it lists some glyphs, for example \glyph{}{sterling}, that are
+% not listed in the required coding scheme, yet the font designer is required
+% to provide the author with these. Normally this would be done by simply
+% including the glyph in the font in the same slot as in the \texttt{T1}
+% encoding, but if a large number of slots must be used for other
+% glyphs, such as ligatures, then this may not be possible. In such
+% cases the symbol command could instead typeset a symbol in
+% \emph{another} font. This could be done with a definition such as
+% \begin{list}{\labelitemi\MacroFont
+% \csname @beginparpenalty\endcsname=\predisplaypenalty
+% \csname @endparpenalty\endcsname=\postdisplaypenalty
+% }{}
+% \item[]
+% |\DefineTextCommandVariant|\,|{\textsterling}|\,|{T1R}|\,|{zcm}|\,^^A
+% |{}|\,|{}|\,|%|\\
+% | {|\,|\UseTextSymbol|\,|{T1}|\,|{\textsterling}|\,|}|
+% \clubpenalty=10000
+% \end{list}
+% In order to make this particular piece of code work, the font designer
+% would of course need to set up an entire family of \texttt{T1}-encoded
+% fonts in parallell with the main \texttt{T1R}-encoded font family.
+% Alternatively, one could instead collect all these miscellaneous
+% glyphs from an entire family in one font (that would probably become
+% \texttt{U}-encoded), but then one needs to define a lot more variants.
+% In any case, this trick of implementing a command as using a glyph in
+% another font cannot be used for \glyph{!`}{} and \glyph{?`}{}, as these
+% need to be accessible through syntactic ligatures as well. What's
+% more, font designers to be should be aware that one cannot have kerns
+% between two glyphs in different fonts.
+%
+% A list of the accenting commands of the \texttt{T1R} encoding can be
+% found in Table~\ref{AccentCommands}. It is hardly exciting, but the
+% font designer should find the information in the `Remark' column
+% interesting; it lists all the compositions of the accenting commands
+% and whether they are implemented as compositions of the main command
+% or compositions of some variant.
+%
+%
+% \subsection{On hyphenation patterns for the \texttt{T1R} encoding}
+% \label{Hyph}
+% %
+% \TeX\ is constructed so that the hyphenation patterns must match the
+% coding scheme of the font used for the text that is to be hyphenated.
+% It is therefore possible that hyphenation patterns made for use with
+% the \texttt{T1} encoding does not always work with the \texttt{T1R}
+% encoding. They will work, however, with a font whose coding scheme
+% deviates from that of the \texttt{T1} encoding only in that some
+% ligatures (or possibly some symbols that never occur as part of a
+% word) has replaced some letters. This is because when \TeX\ hyphenates
+% a word, it treats a ligature as the sequence of letters it is composed
+% from and not as the single character it may be in the font. It does
+% not matter whether there is a hyphenation pattern mensioning character
+% $n$ or not when character $n$ occurs in the output only as a ligature
+% of other characters.
+%
+% Even in other cases, there is a good chance that hyphenation
+% patterns made for use with the \texttt{T1} encoding will work without
+% modification for a font with the \texttt{T1R} encoding. The main
+% reason for this is that one usually does not have hyphenation patterns
+% involving letters of which one does not intend to form automatically
+% hyphenatable words active. If one wants hyphenation of words containing
+% a certain character, one also wants it to have a slot of its own in the
+% coding scheme of the font. In most cases, this means that the character
+% is in the same slot as in the \texttt{T1} encoding.
+%
+%
+%
+% \section{Implementation}
+% \StopEventually{}
+% First the file announces itself.
+%
+% \begin{macrocode}
+%<*encoding>
+\ProvidesFile{t1renc.def}
+ [1998/12/17 Relaxed TeX latin text encoding, version 1.00 (beta)]
+% \end{macrocode}
+%
+% Then there is a check for if the \package{relenc} package has been read.
+% If it hasn't, there is no point in contiuing.
+% \begin{macrocode}
+\@ifundefined{RE@text@variable}{%
+ \PackageError{T1R encoding}{%
+ The definition of the T1R encoding requires that\MessageBreak
+ the `relenc' package is loaded first}%
+ {The T1R encoding cannot be defined.\MessageBreak
+ If you continue, you will most likely face further errors.%
+ \MessageBreak The best option is to type `x' and fix your
+ manuscript.}%
+ \endinput
+}{}
+% \end{macrocode}
+%
+% The encoding declares itself and its font substitution.
+% \begin{macrocode}
+\DeclareFontEncoding{T1R}{}{}
+\DeclareFontSubstitution{T1R}{zcm}{m}{n}
+% \end{macrocode}
+%
+% The search path is set; this is something only relaxed encodings do.
+% The most noteworthy point about this search path is that it includes
+% searching for definitions from the \texttt{T1} encoding. Thanks to
+% this, the \texttt{T1R} encoding can do without definitions of its own
+% for many variable commands (saving some memory), so the lines defining
+% these have been commented out below.
+% \begin{macrocode}
+\SetEncodingSearchPath{T1R}{
+ {\cf@encoding/\f@family/\f@series/\f@shape}
+ {\cf@encoding/\f@family/?/\f@shape}
+ {\cf@encoding/\f@family/?/?}
+ {\cf@encoding/?/?/?}
+ {\RE@convert@nfss{T1}}
+ {\RE@convert@nfss{?}}
+}
+% \end{macrocode}
+%
+% The accenting commands are declared. I have choosen to use the same
+% default definitions as in the \texttt{T1} encoding, despite the fact
+% that the definitions used for |\c| and |\k| do not always do what
+% they should (accents are positioned in curious places). These commands
+% are declared to be variable though, so a font designer can override
+% them with ones that are better suited for the font family in question.
+% \begin{macrocode}
+\DeclareTextAccent{\`}{T1R}{0}
+\DeclareTextAccent{\'}{T1R}{1}
+\DeclareTextAccent{\^}{T1R}{2}
+\DeclareTextAccent{\~}{T1R}{3}
+\DeclareTextAccent{\"}{T1R}{4}
+\DeclareTextVariableAccent{\H}{T1R}{5}
+\DeclareTextAccent{\r}{T1R}{6}
+\DeclareTextVariableAccent{\v}{T1R}{7}
+\DeclareTextVariableAccent{\u}{T1R}{8}
+\DeclareTextAccent{\=}{T1R}{9}
+\DeclareTextVariableAccent{\.}{T1R}{10}
+\DeclareTextCommand{\b}{T1R}[1]
+ {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{29}%
+ \vbox to.2ex{\hbox{\char9}\vss}\hidewidth}}}
+\DeclareTextVariableCommand{\c}{T1R}[1]
+ {\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent11 #1%
+ \else{\ooalign{\hidewidth\char11\hidewidth
+ \crcr\unhbox\z@}}\fi}
+\DeclareTextCommand{\d}{T1R}[1]
+ {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{10}.\hidewidth}}}
+\DeclareTextVariableCommand{\k}{T1R}[1]
+ {\oalign{\null#1\crcr\hidewidth\char12}}
+% \end{macrocode}
+%
+% The symbol commands are declared. These are pretty straightforward,
+% but \glyph{}{SS} is a bit of a special case. The command |\SS| must
+% exist as the upper case equivalent of |\ss|, but is there any case
+% where the \glyph{}{SS} glyph is different from two S's?\footnote{I am
+% currently thinking about removing the \glyph{}{SS} glyph from the
+% required coding scheme, so if anyone has any opinions on this
+% particular matter, please share them with me.}
+% \begin{macrocode}
+\DeclareTextSymbol{\AE}{T1R}{198}
+\DeclareTextSymbol{\DH}{T1R}{208}
+\DeclareTextSymbol{\DJ}{T1R}{208}
+\DeclareTextVariableSymbol{\L}{T1R}{138}
+\DeclareTextVariableSymbol{\NG}{T1R}{141}
+\DeclareTextSymbol{\OE}{T1R}{215}
+\DeclareTextSymbol{\O}{T1R}{216}
+\DeclareTextVariableSymbol{\SS}{T1R}{223}
+\DeclareTextSymbol{\TH}{T1R}{222}
+\DeclareTextSymbol{\ae}{T1R}{230}
+\DeclareTextSymbol{\dh}{T1R}{240}
+\DeclareTextVariableSymbol{\dj}{T1R}{158}
+\DeclareTextSymbol{\guillemotleft}{T1R}{19}
+\DeclareTextSymbol{\guillemotright}{T1R}{20}
+\DeclareTextSymbol{\guilsinglleft}{T1R}{14}
+\DeclareTextSymbol{\guilsinglright}{T1R}{15}
+\DeclareTextSymbol{\i}{T1R}{25}
+\DeclareTextSymbol{\j}{T1R}{26}
+\DeclareTextVariableSymbol{\l}{T1R}{170}
+\DeclareTextVariableSymbol{\ng}{T1R}{173}
+\DeclareTextSymbol{\oe}{T1R}{247}
+\DeclareTextSymbol{\o}{T1R}{248}
+\DeclareTextSymbol{\quotedblbase}{T1R}{18}
+\DeclareTextSymbol{\quotesinglbase}{T1R}{13}
+\DeclareTextSymbol{\ss}{T1R}{255}
+\DeclareTextSymbol{\textasciicircum}{T1R}{`\^}
+\DeclareTextSymbol{\textasciitilde}{T1R}{`\~}
+\DeclareTextSymbol{\textbackslash}{T1R}{`\\}
+\DeclareTextSymbol{\textbar}{T1R}{`\|}
+\DeclareTextSymbol{\textbraceleft}{T1R}{`\{}
+\DeclareTextSymbol{\textbraceright}{T1R}{`\}}
+\DeclareTextSymbol{\textcompwordmark}{T1R}{23}
+\DeclareTextSymbol{\textdollar}{T1R}{`\$}
+\DeclareTextSymbol{\textemdash}{T1R}{22}
+\DeclareTextSymbol{\textendash}{T1R}{21}
+\DeclareTextVariableSymbol{\textexclamdown}{T1R}{189}
+\DeclareTextSymbol{\textgreater}{T1R}{`\>}
+\DeclareTextSymbol{\textless}{T1R}{`\<}
+\DeclareTextCommand{\textperthousand}{T1R}{\%\char 24 }
+\DeclareTextCommand{\textpertenthousand}{T1R}{\%\char 24\char 24 }
+\DeclareTextVariableSymbol{\textquestiondown}{T1R}{190}
+\DeclareTextSymbol{\textquotedblleft}{T1R}{16}
+\DeclareTextSymbol{\textquotedblright}{T1R}{17}
+\DeclareTextSymbol{\textquotedbl}{T1R}{`\"}
+\DeclareTextSymbol{\textquoteleft}{T1R}{`\`}
+\DeclareTextSymbol{\textquoteright}{T1R}{`\'}
+\DeclareTextVariableSymbol{\textsection}{T1R}{159}
+\DeclareTextVariableSymbol{\textsterling}{T1R}{191}
+\DeclareTextSymbol{\textunderscore}{T1R}{95}
+\DeclareTextSymbol{\textvisiblespace}{T1R}{32}
+\DeclareTextSymbol{\th}{T1R}{254}
+% \end{macrocode}
+%
+% The last thing to declare are all the compositions. It starts with
+% the compositions from block 2 (slots 128--191), which are all in some
+% way variable.
+%
+% $128 = {}$\texttt{"80}.
+% \begin{macrocode}
+\DefineTextVariantComposition{\.}{T1R}{}{}{}{i}{`\i}
+\DefineTextVariantComposition{\u}{T1R}{}{}{}{A}{128}
+\DefineTextVariantComposition{\k}{T1R}{}{}{}{A}{129}
+\DeclareVariableTextComposition{\'}{T1R}{C}
+% \DefineTextCompositionVariant{\'}{T1R}{}{}{}{C}{130}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{C}{131}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{D}{132}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{E}{133}
+\DefineTextVariantComposition{\k}{T1R}{}{}{}{E}{134}
+\DefineTextVariantComposition{\u}{T1R}{}{}{}{G}{135}
+% \end{macrocode}
+%
+% $136 = {}$\texttt{"88}.
+% \begin{macrocode}
+\DeclareVariableTextComposition{\'}{T1R}{L}
+% \DefineTextCompositionVariant{\'}{T1R}{}{}{}{L}{136}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{L}{137}
+\DeclareVariableTextComposition{\'}{T1R}{N}
+% \DefineTextCompositionVariant{\'}{T1R}{}{}{}{N}{139}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{N}{140}
+\DefineTextVariantComposition{\H}{T1R}{}{}{}{O}{142}
+\DeclareVariableTextComposition{\'}{T1R}{R}
+% \DefineTextCompositionVariant{\'}{T1R}{}{}{}{R}{143}
+% \end{macrocode}
+%
+% $144 = {}$\texttt{"90}.
+% \begin{macrocode}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{R}{144}
+\DeclareVariableTextComposition{\'}{T1R}{S}
+% \DefineTextCompositionVariant{\'}{T1R}{}{}{}{S}{145}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{S}{146}
+\DeclareVariableTextComposition{\c}{T1R}{S}
+% \DefineTextCompositionVariant{\c}{T1R}{}{}{}{S}{147}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{T}{148}
+\DeclareVariableTextComposition{\c}{T1R}{T}
+% \DefineTextCompositionVariant{\c}{T1R}{}{}{}{T}{149}
+\DefineTextVariantComposition{\H}{T1R}{}{}{}{U}{150}
+\DeclareVariableTextComposition{\r}{T1R}{U}
+% \DefineTextCompositionVariant{\r}{T1R}{}{}{}{U}{151}
+% \end{macrocode}
+%
+% $152 = {}$\texttt{"98}.
+% \begin{macrocode}
+\DeclareVariableTextComposition{\"}{T1R}{Y}
+% \DefineTextCompositionVariant{\"}{T1R}{}{}{}{Y}{152}
+\DeclareVariableTextComposition{\'}{T1R}{Z}
+% \DefineTextCompositionVariant{\'}{T1R}{}{}{}{Z}{153}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{Z}{154}
+\DefineTextVariantComposition{\.}{T1R}{}{}{}{Z}{155}
+\DefineTextVariantComposition{\.}{T1R}{}{}{}{I}{157}
+% \end{macrocode}
+%
+% $160 = {}$\texttt{"A0}.
+% \begin{macrocode}
+\DefineTextVariantComposition{\u}{T1R}{}{}{}{a}{160}
+\DefineTextVariantComposition{\k}{T1R}{}{}{}{a}{161}
+\DeclareVariableTextComposition{\'}{T1R}{c}
+% \DefineTextCompositionVariant{\'}{T1R}{}{}{}{c}{162}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{c}{163}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{d}{164}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{e}{165}
+\DefineTextVariantComposition{\k}{T1R}{}{}{}{e}{166}
+\DefineTextVariantComposition{\u}{T1R}{}{}{}{g}{167}
+% \end{macrocode}
+%
+% $168 = {}$\texttt{"A8}.
+% \begin{macrocode}
+\DeclareVariableTextComposition{\'}{T1R}{l}
+% \DefineTextCompositionVariant{\'}{T1R}{}{}{}{l}{168}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{l}{169}
+\DeclareVariableTextComposition{\'}{T1R}{n}
+% \DefineTextCompositionVariant{\'}{T1R}{}{}{}{n}{171}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{n}{172}
+\DefineTextVariantComposition{\H}{T1R}{}{}{}{o}{174}
+\DeclareVariableTextComposition{\'}{T1R}{r}
+% \DefineTextCompositionVariant{\'}{T1R}{}{}{}{r}{175}
+% \end{macrocode}
+%
+% $176 = {}$\texttt{"B0}.
+% \begin{macrocode}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{r}{176}
+\DeclareVariableTextComposition{\'}{T1R}{s}
+% \DefineTextCompositionVariant{\'}{T1R}{}{}{}{s}{177}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{s}{178}
+\DeclareVariableTextComposition{\c}{T1R}{s}
+% \DefineTextCompositionVariant{\c}{T1R}{}{}{}{s}{179}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{t}{180}
+\DeclareVariableTextComposition{\c}{T1R}{t}
+% \DefineTextCompositionVariant{\c}{T1R}{}{}{}{t}{181}
+\DefineTextVariantComposition{\H}{T1R}{}{}{}{u}{182}
+\DeclareVariableTextComposition{\r}{T1R}{u}
+% \DefineTextCompositionVariant{\r}{T1R}{}{}{}{u}{183}
+% \end{macrocode}
+%
+% $184 = {}$\texttt{"B8}.
+% \begin{macrocode}
+\DeclareVariableTextComposition{\"}{T1R}{y}
+% \DefineTextCompositionVariant{\"}{T1R{}{}{}}{y}{184}
+\DeclareVariableTextComposition{\'}{T1R}{z}
+% \DefineTextCompositionVariant{\'}{T1R{}{}{}}{z}{185}
+\DefineTextVariantComposition{\v}{T1R}{}{}{}{z}{186}
+\DefineTextVariantComposition{\.}{T1R}{}{}{}{z}{187}
+% \end{macrocode}
+%
+% Here follows the compositions in block 3 (slots 192--255). They are
+% exactly the same as in the \texttt{T1} encoding.
+%
+% $192 = {}$\texttt{"C0}.
+% \begin{macrocode}
+\DeclareTextComposite{\`}{T1R}{A}{192}
+\DeclareTextComposite{\'}{T1R}{A}{193}
+\DeclareTextComposite{\^}{T1R}{A}{194}
+\DeclareTextComposite{\~}{T1R}{A}{195}
+\DeclareTextComposite{\"}{T1R}{A}{196}
+\DeclareTextComposite{\r}{T1R}{A}{197}
+\DeclareTextComposite{\c}{T1R}{C}{199}
+% \end{macrocode}
+%
+% $200 = {}$\texttt{"C8}.
+% \begin{macrocode}
+\DeclareTextComposite{\`}{T1R}{E}{200}
+\DeclareTextComposite{\'}{T1R}{E}{201}
+\DeclareTextComposite{\^}{T1R}{E}{202}
+\DeclareTextComposite{\"}{T1R}{E}{203}
+\DeclareTextComposite{\`}{T1R}{I}{204}
+\DeclareTextComposite{\'}{T1R}{I}{205}
+\DeclareTextComposite{\^}{T1R}{I}{206}
+\DeclareTextComposite{\"}{T1R}{I}{207}
+% \end{macrocode}
+%
+% $208 = {}$\texttt{"D0}.
+% \begin{macrocode}
+\DeclareTextComposite{\~}{T1R}{N}{209}
+\DeclareTextComposite{\`}{T1R}{O}{210}
+\DeclareTextComposite{\'}{T1R}{O}{211}
+\DeclareTextComposite{\^}{T1R}{O}{212}
+\DeclareTextComposite{\~}{T1R}{O}{213}
+\DeclareTextComposite{\"}{T1R}{O}{214}
+% \end{macrocode}
+%
+% $216 = {}$\texttt{"D8}.
+% \begin{macrocode}
+\DeclareTextComposite{\`}{T1R}{U}{217}
+\DeclareTextComposite{\'}{T1R}{U}{218}
+\DeclareTextComposite{\^}{T1R}{U}{219}
+\DeclareTextComposite{\"}{T1R}{U}{220}
+\DeclareTextComposite{\'}{T1R}{Y}{221}
+% \end{macrocode}
+%
+% $224 = {}$\texttt{"E0}.
+% \begin{macrocode}
+\DeclareTextComposite{\`}{T1R}{a}{224}
+\DeclareTextComposite{\'}{T1R}{a}{225}
+\DeclareTextComposite{\^}{T1R}{a}{226}
+\DeclareTextComposite{\~}{T1R}{a}{227}
+\DeclareTextComposite{\"}{T1R}{a}{228}
+\DeclareTextComposite{\r}{T1R}{a}{229}
+\DeclareTextComposite{\c}{T1R}{c}{231}
+% \end{macrocode}
+%
+% $232 = {}$\texttt{"E8}.
+% \begin{macrocode}
+\DeclareTextComposite{\`}{T1R}{e}{232}
+\DeclareTextComposite{\'}{T1R}{e}{233}
+\DeclareTextComposite{\^}{T1R}{e}{234}
+\DeclareTextComposite{\"}{T1R}{e}{235}
+\DeclareTextComposite{\`}{T1R}{i}{236}
+\DeclareTextComposite{\`}{T1R}{\i}{236}
+\DeclareTextComposite{\'}{T1R}{i}{237}
+\DeclareTextComposite{\'}{T1R}{\i}{237}
+\DeclareTextComposite{\^}{T1R}{i}{238}
+\DeclareTextComposite{\^}{T1R}{\i}{238}
+\DeclareTextComposite{\"}{T1R}{i}{239}
+\DeclareTextComposite{\"}{T1R}{\i}{239}
+% \end{macrocode}
+%
+% $240 = {}$\texttt{"F0}.
+% \begin{macrocode}
+\DeclareTextComposite{\~}{T1R}{n}{241}
+\DeclareTextComposite{\`}{T1R}{o}{242}
+\DeclareTextComposite{\'}{T1R}{o}{243}
+\DeclareTextComposite{\^}{T1R}{o}{244}
+\DeclareTextComposite{\~}{T1R}{o}{245}
+\DeclareTextComposite{\"}{T1R}{o}{246}
+% \end{macrocode}
+%
+% $248 = {}$\texttt{"F8}.
+% \begin{macrocode}
+\DeclareTextComposite{\`}{T1R}{u}{249}
+\DeclareTextComposite{\'}{T1R}{u}{250}
+\DeclareTextComposite{\^}{T1R}{u}{251}
+\DeclareTextComposite{\"}{T1R}{u}{252}
+\DeclareTextComposite{\'}{T1R}{y}{253}
+%</encoding>
+% \end{macrocode}
+%
+\endinput
diff --git a/macros/latex/contrib/relenc/t1rzcm.fdd b/macros/latex/contrib/relenc/t1rzcm.fdd
new file mode 100644
index 0000000000..2be089ec31
--- /dev/null
+++ b/macros/latex/contrib/relenc/t1rzcm.fdd
@@ -0,0 +1,273 @@
+%% \CheckSum{26}
+% \iffalse (Comment)
+% This file contains a breif description of the T1R/zcm font family,
+% the code for its font definition file, and the code the ecsubzcm
+% package.
+% \fi
+%
+% \iffalse (Skip the driver code when DocInputting.)
+% (The driver code is still enclosed in a macrocode environment, just
+% in case.)
+% \begin{macrocode}
+%<*driver>
+\documentclass{ltxdoc}
+\newcommand\package[1]{\textsf{#1}}
+\title{The \texttt{zcm} example font family}
+\author{Lars Hellstr\"om%
+ \thanks{E-mail: \texttt{Lars.Hellstrom@math.umu.se}}%
+}
+\begin{document}
+\maketitle
+\DocInput{t1rzcm.fdd}\Finale
+\begin{thebibliography}{9}
+\bibitem{ltoutenc}
+ Johannes Braams, David Carlisle, Alan Jeffrey, Frank Mittelbach,
+ Chris Rowley, Rainer Sch\"opf: \texttt{ltoutenc.dtx} (part of the
+ \LaTeXe\ base distribution).
+\end{thebibliography}
+\end{document}
+%</driver>
+% \end{macrocode}
+% \fi
+%
+% \section{The \texttt{zcm} font family and \texttt{reldemo.tex}}
+% \label{zcm-family}
+% %
+% The \texttt{zcm} family of fonts consists of only two fonts and it is
+% meant to accompany the \package{relenc} package documentation. These
+% fonts are really just combinations of glyphs taken from other fonts,
+% primarily the Computer Modern fonts (hence the \texttt{cm}), but
+% there are also some glyphs which are taken from some \LaTeX\ symbol
+% fonts (\texttt{lasy10} and \texttt{lcircle10}).
+%
+% The primary reason these fonts exist is that I felt I needed an example
+% of what can be done with the \package{relenc} package. As one really
+% cannot expect that people will have any font that is not either a
+% Computer Modern or a \LaTeX\ font, such an example has to be made
+% using these fonts. I am well aware that some of the glyphs look
+% terrible, but the \texttt{zcm} family is not intended to be used
+% for any serious typesetting.
+%
+% The font family consists of two fonts: \texttt{zcmr8d} and
+% \texttt{zcmra}. The first of these is declared as
+% \texttt{T1R}\slash\texttt{zcm}\slash\texttt{m}\slash\texttt{n} and its
+% coding scheme is identical to that of the \texttt{T1} encoding. The
+% second is declared as \texttt{T1R}\slash\texttt{zcm}\slash
+% \texttt{m}\slash\texttt{a} and its coding scheme deviates from that of
+% the \texttt{T1} encoding in four slots, which have been reassigned to
+% contain ligatures instead of accented letters.
+%
+% A demonstration of these fonts is generated by typesetting
+% \texttt{reldemo.tex}; this document contains a font table listing the
+% contents of each slot, a demonstration of all the symbol commands, a
+% demonstration of the effects of applying the accenting commands to the
+% non-accented letters, and a comprehensive list of character pairs, for
+% both fonts. The reason I have put it in a separate file is (i) that
+% the \package{relenc} package will have to be installed before these
+% fonts can be viewed (the files needed are \texttt{relenc.sty},
+% \texttt{t1renc.def}, and \texttt{t1rzcm.fd}) and (ii) that there
+% might be some problems connected to viewing these fonts.
+%
+% To begin with, both fonts are virtual fonts and some DVI drivers cannot
+% handle these. If you only have such drivers, you should get one that
+% can (not just for the sake of the \package{relenc} package---virtual
+% fonts are in general neat to be able to use).
+%
+% One of the fonts used to make these virtaul fonts---the
+% \texttt{lcircle10} font---occurs under two other names as well:
+% \texttt{circle10} and \texttt{lcirc10}. Unfortunately, one cannot
+% expect that there is more than one of these in any given \TeX\ ^^A
+% installation. Thus you will get some problems if your installation
+% uses another name for this font. Some DVI drivers will translate the
+% name used in the virtual font to that of the font names which actually
+% occurs in the system, and in this case there is no problem, but if not
+% then you will have to intervene yourself.
+%
+% The easiest way to do this is simply to rename a few virtual font
+% files, since there are such files accompanying the \package{relenc}
+% package for using the \texttt{lcircle10} font under any one of these
+% names. What you have to see too is that the ones which use the font
+% under the name on your system are the ones which are named
+% \texttt{zcmr8d.vf} and \texttt{zcmra.vf} respectively. The following
+% table shows what the file names are and which font it uses
+% $$
+% \mbox{^^A
+% \begin{tabular}{cc}
+% Virtual font file& \texttt{lcircle10} name used^^A
+% \\[-0.9\ht\strutbox]
+% \hrulefill&\hrulefill\\
+% \texttt{zcmr8d.vf}& \texttt{lcricle10}\\
+% \texttt{zcmra.vf}& \texttt{lcricle10}\\
+% \texttt{zcmr8d.vf2}& \texttt{cricle10}\\
+% \texttt{zcmra.vf2}& \texttt{cricle10}\\
+% \texttt{zcmr8d.vf3}& \texttt{lcric10}\\
+% \texttt{zcmra.vf3}& \texttt{lcric10}
+% \end{tabular}^^A
+% }
+% $$
+% Note that all the above files are virtual font files. The reason
+% only two have been given the correct suffix \texttt{.vf} is that there
+% really are no more than two fonts, so they should not take up any more
+% font name space than that either.
+%
+% Finally, there is one other use for the \texttt{T1R}\slash
+% \texttt{zcm}\slash\texttt{m}\slash\texttt{n} font---it is the final
+% substitution font in the \texttt{T1R} encoding. \LaTeX\ requires that
+% there is such a font, so it might as well be this one. This means that
+% you should see to that the files which are this font (\texttt{zcmr8d.tfm}
+% and \texttt{zcmr8d.vf}) are put in such locations that \TeX\ and its
+% helper programs (DVI drivers etc.) will find them if they are needed.
+% You should not need to move them before you typeset \texttt{reldemo.tex}
+% for the first time, however, as these fonts are initially in the same
+% directory as this and \TeX\ looks for files there first.
+%
+% If you do have the \texttt{ec} family of fonts however, you may (quite
+% understandably) want to use one of them as final substitution font for
+% the \texttt{T1R} encoding instead. There is a package called
+% \package{ecsubzcm} that is installed with \package{relenc}. This
+% package declares the \texttt{zcm} family in encoding \texttt{T1R} and
+% \texttt{ecrm1000} under the encoding\slash family\slash series\slash
+% shape combination \texttt{T1R}\slash\texttt{zcm}\slash\texttt{m}\slash
+% \texttt{n}. After loading this package, \LaTeX\ will not bother to
+% input the font definition file \texttt{t1rzcm.fd}, so the ``real''
+% \texttt{zcm} fonts will not get involved.
+%
+% \section{Implementation}
+% \subsection{Font definition file}
+%
+% \StopEventually{}
+%
+% As is the custom, the file starts by announcing itself.
+% \begin{macrocode}
+%<*fd>
+\ProvidesFile{t1rzcm.fd}[1999/01/19 Font definitions for T1R/zcm.]
+% \end{macrocode}
+%
+% Then the family is declared. So far, there is nothing out of the
+% ordinary.
+% \begin{macrocode}
+\DeclareFontFamily{T1R}{zcm}{}
+% \end{macrocode}
+%
+% Next the shapes are declared. There is nothing strange about this
+% either.
+% \begin{macrocode}
+\DeclareFontShape{T1R}{zcm}{m}{n}{
+ <-> zcmr8d
+}{}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareFontShape{T1R}{zcm}{m}{a}{
+ <-> zcmra
+}{}
+% \end{macrocode}
+%
+% That would be all in a normal font definition file. This file does
+% however go on with defining some variants of commands and
+% compositions, to compensate for the differences between the coding
+% scheme of the \texttt{zcmra} font and the default coding scheme.
+%
+% Slot number 128 is used for a ligature instead of the default `\u{A}',
+% so this has to be compensated for. In this case it is done by making
+% another default definition of the |\u| command and defining all the
+% other compositions of that command again.
+% \begin{macrocode}
+\DefineTextAccentVariant{\u}{T1R}{zcm}{}{a}{8}
+\DefineTextVariantComposition{\u}{T1R}{zcm}{}{a}{G}{135}
+\DefineTextVariantComposition{\u}{T1R}{zcm}{}{a}{a}{160}
+\DefineTextVariantComposition{\u}{T1R}{zcm}{}{a}{g}{167}
+% \end{macrocode}
+% It should be noted at this point that this font definition file is
+% not set up in the most efficient way. Normally, one would want to
+% minimize the number of variants that needs to be defined---something
+% which the above most certainly does not do---and one often achieves
+% this by trying to affect as few accenting commands as possible. The
+% four extra ligatures of the \texttt{zcmra} font could have been put in
+% slots 128, 135, 160, and 167---that would have made it possible to
+% get by with the single variant definition
+%\begin{verbatim}
+% \DefineTextAccentVariant{\u}{T1R}{zcm}{}{a}{8}
+%\end{verbatim}
+% although a font designer who frequently use the |\u| command will
+% probably prefer to use slots for compositions of some other
+% command---but \texttt{zcmra} has been set up more to show what is
+% possible than what is optimal.
+%
+% The same problem occurs with slot 131, which does not contain the
+% `\v{C}' glyph that the encoding-level composition of |\v| with |C|
+% assumes it does. Another solution to the problem is to give an
+% explicit definition of the composition at a lower level, as in
+% \begin{macrocode}
+\DefineTextVariantCompositionCommand{\v}{T1R}{zcm}{}{a}{C}{%
+ \add@accent{7}{C}%
+}
+% \end{macrocode}
+% |\add@accent| is standard \LaTeX\ and its definition can be found
+% in~\cite{ltoutenc}. This solution gets by using only two variants (the
+% \texttt{T1R}\slash\texttt{zcm}\slash\texttt{?}\slash\texttt{a} variant
+% of |\v|, and the compositon of that variant with |C|). Had instead
+% the first solution been used here, it would have required the code
+%\begin{verbatim}
+%\DefineTextAccentVariant{\v}{T1R}{zcm}{}{a}{7}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{D}{132}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{E}{133}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{L}{137}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{N}{140}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{R}{144}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{S}{146}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{T}{148}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{Z}{154}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{c}{163}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{d}{164}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{e}{165}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{l}{169}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{n}{172}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{r}{176}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{s}{178}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{t}{180}
+%\DefineTextVariantComposition{\v}{T1R}{zcm}{}{a}{z}{186}
+%\end{verbatim}
+% which defines another 18 control sequences. The |\v| command sure has
+% many compositions, hasn't it?
+%
+% Things are a bit different when the slot is used for a variant of a
+% composition, instead of a composition of a variant. In the former case,
+% there is a special command that can be used to extract the default
+% definition of the accenting command.
+% \begin{macrocode}
+\DefineTextUncomposedVariant{\'}{T1R}{zcm}{}{a}{C}
+% \end{macrocode}
+%
+% Finally, another example like |\v|.
+% \begin{macrocode}
+\DefineTextVariantCompositionCommand{\k}{T1R}{zcm}{}{a}{a}%
+ {a\llap{\char12\kern-0.07em}}
+%</fd>
+% \end{macrocode}
+% This definition demonstrates that there is absolutely no need to base
+% the definition of a composition on the default definition; using that
+% in this case would (i) be much longer, (ii) be unstable, as the default
+% definition of |\k| positions the accent incorrectly if not both the
+% height of the accent and the depth of the letter is zero or less,
+% and (iii) probably not kern particularly good (at least this definition
+% kerns like `a' to the left, the default does not kern at all).
+%
+%
+% \subsection{The \package{ecsubzcm} package}
+%
+% \begin{macrocode}
+%<*package>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{ecsubzcm}[1999/01/19]
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareFontFamily{T1R}{zcm}{}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareFontShape{T1R}{zcm}{m}{n}{
+ <-> ecrm1000
+}{}
+%</package>
+% \end{macrocode}
+\endinput
+
diff --git a/macros/latex/contrib/relenc/zcmr8d.tfm b/macros/latex/contrib/relenc/zcmr8d.tfm
new file mode 100644
index 0000000000..5c2ef1a352
--- /dev/null
+++ b/macros/latex/contrib/relenc/zcmr8d.tfm
Binary files differ
diff --git a/macros/latex/contrib/relenc/zcmr8d.vf b/macros/latex/contrib/relenc/zcmr8d.vf
new file mode 100644
index 0000000000..aa60c6f31c
--- /dev/null
+++ b/macros/latex/contrib/relenc/zcmr8d.vf
Binary files differ
diff --git a/macros/latex/contrib/relenc/zcmr8d.vf2 b/macros/latex/contrib/relenc/zcmr8d.vf2
new file mode 100644
index 0000000000..dcb47e3f0d
--- /dev/null
+++ b/macros/latex/contrib/relenc/zcmr8d.vf2
Binary files differ
diff --git a/macros/latex/contrib/relenc/zcmr8d.vf3 b/macros/latex/contrib/relenc/zcmr8d.vf3
new file mode 100644
index 0000000000..89eea24009
--- /dev/null
+++ b/macros/latex/contrib/relenc/zcmr8d.vf3
Binary files differ
diff --git a/macros/latex/contrib/relenc/zcmra.tfm b/macros/latex/contrib/relenc/zcmra.tfm
new file mode 100644
index 0000000000..8e13bc29d4
--- /dev/null
+++ b/macros/latex/contrib/relenc/zcmra.tfm
Binary files differ
diff --git a/macros/latex/contrib/relenc/zcmra.vf b/macros/latex/contrib/relenc/zcmra.vf
new file mode 100644
index 0000000000..95e2cee017
--- /dev/null
+++ b/macros/latex/contrib/relenc/zcmra.vf
Binary files differ
diff --git a/macros/latex/contrib/relenc/zcmra.vf2 b/macros/latex/contrib/relenc/zcmra.vf2
new file mode 100644
index 0000000000..17cb9f92a1
--- /dev/null
+++ b/macros/latex/contrib/relenc/zcmra.vf2
Binary files differ
diff --git a/macros/latex/contrib/relenc/zcmra.vf3 b/macros/latex/contrib/relenc/zcmra.vf3
new file mode 100644
index 0000000000..d4541686a6
--- /dev/null
+++ b/macros/latex/contrib/relenc/zcmra.vf3
Binary files differ