summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/pdcmac/maamac.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/plain/contrib/pdcmac/maamac.dtx')
-rw-r--r--macros/plain/contrib/pdcmac/maamac.dtx627
1 files changed, 627 insertions, 0 deletions
diff --git a/macros/plain/contrib/pdcmac/maamac.dtx b/macros/plain/contrib/pdcmac/maamac.dtx
new file mode 100644
index 0000000000..9ddde3ee83
--- /dev/null
+++ b/macros/plain/contrib/pdcmac/maamac.dtx
@@ -0,0 +1,627 @@
+% maamac.dtx -- documentation & source for maamac.tex -*-tex-*-
+
+%%%@TeX-document-file {
+%%% title = "MAAMAC -- Malvern A Macros",
+%%% filename = "$texmf/doc/plain/pdcmac/maamac.dtx",
+%%% version = "$Revision: 1.5 $",
+%%% package = "pdcmac 1.0",
+%%% date = "$Date: 1995/04/06 13:33:44 $",
+%%% author = "P. Damian Cugley",
+%%% email = "damian.cugley@comlab.ox.ac.uk",
+%%% address = "Oxford University Computing Laboratory,"
+%%% Parks Road, Oxford OX1 3QD, UK",
+%%% abstract = "This document describes and is the source code for
+%%% the TeX definitions file maamac.tex.
+%%% Running plain TeX on this file produces both the
+%%% definitions file and the printed documentation.",
+%%% copyright = "Copyright (c) 1991-1995 P. Damian Cugley",
+%%% copying = "This program is free software; you can redistribute
+%%% it and/or modify it under the terms of the GNU
+%%% General Public License as published by the Free
+%%% Software Foundation; either version 2 of the License,
+%%% or (at your option) any later version.",
+%%% notice = "This program is distributed in the hope that it will
+%%% be useful, but WITHOUT ANY WARRANTY; without even the
+%%% implied warranty of MERCHANTABILITY or FITNESS FOR A
+%%% PARTICULAR PURPOSE. See the GNU General Public
+%%% License for more details.",
+%%% notice = "You should have received a copy of the GNU General
+%%% Public License along with this program; if not, write
+%%% to the Free Software Foundation, Inc., 675 Mass Ave,
+%%% Cambridge, MA 02139, USA.",
+%%% codetable = "USASCII",
+%%% dependencies = "pdccode.tex"
+%%%}
+
+%{{{ maamac
+%{{{ preamble
+
+\relax
+\input pdccode
+
+\document
+\rcs$Id: maamac.dtx,v 1.5 1995/04/06 13:33:44 pdc Exp $\endrcs
+
+\newcount\chcda \newcount\chcdc \newcount\chcdn
+\def\changecodes#1#2#3#4{%
+ \chcda#2\relax \chcdc#3\relax \chcdn#4\relax
+ \loop \ifnum\chcdn>0
+ #1\chcda\chcdc
+ \advance\chcda1 \advance\chcdc1 \advance\chcdn-1
+ \repeat
+}
+\changecodes\mathcode{`a}{"7461}{26}
+
+\codefile{maamac.tex}
+%}}} preamble
+%{{{ introduction
+
+\author{P. Damian Cugley}
+\title{MAAMAC---Malvern A Macros}
+\advance\seccount-1
+\section{Introduction}
+
+ This document describes |maamac.tex|, a collection of formatting
+ macros for plain \TeX\ documents using fonts with the Malvern~A
+ encoding. For example, it defines commands for making composite
+ letters and special symbols.
+
+\subsec{About this document}
+
+ The definitions file and this printed documentation are both in
+ |maamac.dtx|, a `documented \TeX\ macros' file\footnote*{The
+ \LaTeX~2e distribution uses files with the `|dtx|' suffix for
+ similar purposes.} which, when processed by plain \TeX,
+ generates a fresh copy of |maamac.tex| in the current directory
+ in addition to the |dvi| file. This ensures that the printed
+ documentation and the code it describes are identical. The
+ |dtx| file uses the macros in |pdccode.tex|.
+
+\subsec{What is in MAAMAC?}
+
+ The definitions in |maamac.tex| fall into three sections:
+\smallskip
+\item{\S1} Building {\it composite letters} like `\'e' from {\it
+ marks} like `\'{}' and {\it base letters} like `e'. This gives
+ new definitions for commands like |\'| and |\"|.
+\item{\S2} Symbols and special letters: replacements for existing
+ commands like |\P| (\P) and |\ae| (\ae), and new commands like
+ |\registered| and |\pounds|.
+\item{\S3} Switching between alphabets. The Malvern~A encoding includes
+ separate small capital and medium capital alphabets in addition
+ to the usual capitals and lower case. This section defines
+ commands for transliterating a list of tokens from one alphabet
+ to another.
+
+\smallskip\noindent
+ The first two sections make changes to commands described in
+ {\it\TeX book} Chapter~9 (and a few maths symbols from
+ Chapter~16) and defined in Appendix~B.
+
+%}}} introduction
+%{{{ File identification
+\subsec{File identification}
+
+ Nowadays, macro files start with some comments identifying the
+ file.
+
+\code
+ \|\% maamac.tex \fileversion~\filedate~-- Malvern A Macros
+ |
+ |%%%@TeX-definition-file {
+ |%%% filename = "$texmf/tex/plain/pdcmac/maamac.tex",
+ \|\%\%\% version~~~~~~~~= "\fileversion",
+ \|\%\%\% date~~~~~~~~~~~= "\filedate",
+ |%%% package = "pdcmac 1.0",
+ |%%% author = "P. Damian Cugley",
+ |%%% email = "damian.cugley@comlab.ox.ac.uk",
+ |%%% address = "Oxford University Computing Laboratory,
+ |%%% Parks Road, Oxford OX1 3QD, UK",
+ |%%% codetable = "USASCII",
+ |%%% keywords = "TeX, plain TeX, macros",
+ |%%% supported = "Maybe",
+ |%%% abstract = "Macros for using the Malvern-A font coding
+ |%%% scheme in plain TeX documents.
+ |%%% This file was generated by running
+ \|\%\%\%~~~~~~~~~~~~~~~~~~~plain TeX on \jobname.dtx",
+ |%%% copyright = "Copyright (c) 1991-1995 P. Damian Cugley",
+ |%%% copying = "DO NOT DISTRIBUTE THIS FILE.
+ \|\%\%\%~~~~~~~~~~~~~~~~~~~Distribute \jobname.dtx only as part of the
+ |%%% package it came in.",
+ |%%% dependencies = "",
+ |%%% }
+ |
+ \|\\message\{\fileversion~<pdc \filedate>\}
+ |
+\endcode
+
+%}}}
+%{{{ building composite letters
+\section{Building composite letters}
+
+ THis section redefines commands listed at the start of Chapter~9
+ of the {\it\TeX book}: |\'|, |\"|, etc. The main difference is
+ that these now use `medium capitals' and differently-drawn marks
+ to make composite capital letters.
+
+ I~also define \<chardef tokens> called |\acuteglyph|,
+ |\twodotsglyph| which may be used to print these marks in a
+ document: `the acute mark ``\'{}''\dots' might be typeset with
+ `|the acute mark ``\acuteglyph''|\dots'. Also, if you don't
+ like the way my macros look, you can say `|\accent\acuteglyph
+ E|' rather than having to look up its glyph number.
+
+%{{{ utility macros
+
+\subsec{Utility macros}
+
+ First some nicknames for scratch registers.
+\code
+ |\dimendef\dimena0 \dimendef\dimenb2
+ |\toksdef\toksa0
+ |\countdef\counta255
+ |\ifx\countb\UNDEFINED \csname newcount\endcsname\countb \fi
+ |\ifx\countc\UNDEFINED \csname newcount\endcsname\countc \fi
+\endcode
+
+ A macro to find the code in \TeX's internal encoding for a
+ character. The character might be represented by (1)~a
+ character with category code~11 or~12, (2)~a token defined with
+ |\chardef|, or (3)~the token |\char| followed by a \<number>.
+\code
+ |\def\code#1{%
+ | \ifcat#1a%
+ | `#1
+ | \else\ifcat#1+%
+ | `#1
+ | \else\ifx\char#1
+\endcode
+\hbox{\hskip6\fontdimen6\tentt
+ \% If the first token is |\char| the rest is the
+ \<number> we want.}
+\code
+ | \else
+ | #1%
+ | \fi\fi\fi
+ |}
+\endcode
+
+ So as to make conditional macros that can be skipped over if
+ they appear nested inside another conditional, we make include
+ the token |\then| amongst the arguments, making this the `if-'
+ token to match the |\else| and |\fi| following it. This way we
+ write, for example
+$$\hbox{|\ifcap|\<character> |\then| \<true text>
+ |\else| \<false text> |\fi|}$$
+\code
+ |\let\then=\iffalse
+\smallbreak
+ |\def\ifcap#1\then{\expandafter\ifcapnum\code{#1}\then}
+ |\def\ifcapnum#1\then{\ifnum\lccode#1=#1}
+\smallbreak
+ |\def\iflower#1\then{\expandafter\iflowernum\code{#1}\then}
+ |\def\iflowernum#1\then{\ifnum\uccode#1=#1}
+\endcode
+
+ A macro to extract the slant-per-point parameter of a font in
+ toe form of a \TeX\ \<factor>.
+\code
+ |\def\fontslant#1{\expandafter\stripPT\the\fontdimen1#1}
+\smallbreak
+ |\begingroup \uccode`2=`p \uccode`3=`t \uppercase{\toksa{\endgroup
+ | \def\\#123{#1}
+ |}} \the\toksa
+ |\let\stripPT=\\
+\endcode
+%}}} utility macros
+%{{{ macros for placing marks
+
+\subsec{Macros for placing marks}
+
+ This simple macro places the text |#3| at displaced
+ $(\hbox{|#1|},\hbox{|#2|})$ from current position:
+\code
+ |\def\putxy#1#2#3{\leavevmode\rlap{\hskip#1\raise#2\hbox{#3}}}
+\endcode
+
+ Now we have a generic mark-placement macro. It is similar to
+ the |\accent| primitive, but takes two extra parameters:
+$$
+ \hbox{|\putmarkxy|\arg{$xf$}\arg{$dy$}\arg{$mark$}\arg{$base$}}
+$$
+ The horizontal position $xf$ of the optical centre of the base
+ letter (ignoring slant) is expressed as a \<factor> (i.e.,
+ decimal fraction of the width of the base glyph). The vertical
+ displacement $dy$ is expressed as a fragment of \TeX\ code that
+ will calculate $dy$. The code is expanded after setting box~0
+ to contain the base glyph, and must put the result in |\dimena|.
+ For example, we could define
+$$
+ \hbox{|\def\fakeaccent{\putmarkxy{0.5}{\dimena\ht0
+ \advance\dimena-1ex }}|}
+$$
+ This produces an approximation to the primitive |\accent|
+ command.
+
+ Given the $x$-factor $xf$, a base glyph with width $wd$, a font
+ with slant $s$, the horizontal displacement $dx$ is given by
+$$
+ dx = xf \times wd + s \times dy\quad.
+$$
+ In this macro it is stored in |\dimenb|.
+\code
+ |\def\putmarkxy#1#2#3#4{{%
+ | \setbox0=\hbox{#4}#2\relax
+ | \dimenb#1\wd0 \advance\dimenb\fontslant\font\dimena
+ | \leavevmode
+ | \putxy{\dimenb}{\dimena}{\hbox to 0pt{\hss\char#3\hss}}%
+ | \box0
+ |}}
+\smallbreak
+ |\def\putmarky{\putmarkxy{0.5}}
+\endcode
+%}}} macros for placing marks
+%{{{ type I marks
+
+\subsec{Type~I Marks}
+
+ A Type~I mark is one which does not have any scope for being
+ `squashed' to go over capital letters---for example, the
+ two-dots mark `\"{}' and macron `\={}'.
+
+ Here's a macro for placing a Type~I mark given by |#1| (a
+ \<number>) over base glyph |#2| (which is anything that |\code|
+ understands). The difference between this macro and simply
+ using |\accent| is (1)~if presented with a capital letter it
+ will use the corresponding medium capital letter and (2)~the the
+ mark is raised by an amount intended to centre it vertically
+ between the top of the base letter and the top of the
+ body-height---assuming it was original centered between
+ body-height and $x$-height.
+
+ If $H$ is the body height, $h$ the height of the base glyph,
+$$ \mathcode`/="202F
+ \eqalign{dy &= { H + h \over 2 } - { H + 1\,{\rm
+ ex} \over 2}\cr
+ &= \textstyle { 1\over2}h - {1\over2}\,{\rm ex}\cr}
+$$
+\code
+ |\def\typeImark#1#2{{%
+ | \setbox2=\hbox{#2}%
+ | \ifdim \ht2=1ex
+ | \accent#1\relax#2%
+ | \else
+ | \counta\code{#2}%
+ | \ifnum\counta>64 \ifnum\counta<96
+ | \advance\counta 128
+ | \fi \fi
+ | \putmarky{\dimena0.5\ht0 \advance\dimena-0.5ex }
+ | {#1}{\char\counta}%
+ | \fi
+ |}}
+\endcode
+
+ Finally we define the composite-letter-building commands.
+\code
+ |\chardef\dotglyph22 \def\.{\typeImark\dotglyph}
+ |\chardef\twodotsglyph23 \def\"{\typeImark\twodotsglyph}
+ |\chardef\macronglyph150 \def\={\typeImark\macronglyph}
+ |\chardef\longmacronglyph151
+ | \def\longmacronmark{\typeImark\longmacronglyph}
+\endcode
+%}}} type I marks
+%{{{ type II marks
+
+\subsec{Type~II Marks}
+
+ These marks have an alternative glyph for use of capital and
+ medium capital letters. As with |\typeImark|, |#1| is a
+ \<number> and |#2| is anything understood by |\code|.
+\code
+ |\def\typeIImark#1#2{{%
+ | \counta#1\relax \countb\code{#2}%
+ | \ifcap{#2}\then
+ | \ifnum \counta<128 \advance\counta 128 \fi
+ | \ifnum \countb<128 \advance\countb 128 \fi
+ | \fi
+ | \accent\counta \char\countb
+ |}}
+\smallbreak
+ |\chardef\acuteglyph8 \def\'{\typeIImark\acuteglyph}
+ |\chardef\graveglyph9 \def\`{\typeIImark\graveglyph}
+ |\chardef\circumglyph10 \def\^{\typeIImark\circumglyph}
+ |\chardef\tildeglyph11 \def\~{\typeIImark\tildeglyph}
+ |\chardef\ringglyph12 \def\ringmark{\typeIImark\ringglyph}
+ |\chardef\caronglyph13 \def\v{\typeIImark\caronglyph}
+ |\chardef\breveglyph14 \def\u{\typeIImark\breveglyph}
+ |\chardef\hungarglyph15 \def\H{\typeIImark\hungarglyph}
+\endcode
+ I have abbreviated `circumflex' as `circum' (consistent with
+ Adobe's `|asciicircum|'). I~have called the hook `\v{}'
+ `|caron|' because that is its name as used by ISO and Adobe.
+ I~have called the long Hungarian umlaut `\H{}' `|hungar|' for
+ want of a better name (it's shorter than |hungarumlaut|)..
+%}}} type II marks
+%{{{ cedilla ogonek
+
+\subsec{Cedilla and ogonek}
+
+ The cedilla and ogonek each have a variant intended for capital
+ letters (in this case the variant is larger not smaller).
+\code
+ |\def\cedillalike#1#2#3{{%
+ | \setbox0=\hbox{#3}%
+ | \ifdim\ht0>1ex
+ | \ooalign{\hidewidth\char#2\relax\hidewidth\crcr\unhbox0 }%
+ | \else
+ | \accent#1 #3%
+ | \fi
+ |}}
+\smallbreak
+ |\chardef\cedillaglyph6 \chardef\Cedillaglyph134
+ |\def\c{\cedillalike\cedillaglyph\Cedillaglyph}
+\smallbreak
+ |\chardef\ogonekglyph7 \chardef\Ogonekglyph135
+ |\def\k{\cedillalike\ogonekglyph\Ogonekglyph}
+\endcode
+%}}} cedilla ogonek
+%}}}
+%{{{ symbols
+\section{Symbols and special letters}
+%{{{ special letters
+
+\subsec{Special letters}
+
+ The letters defined here that are not included in Chapter~9 of
+ the {\it\TeX book} are the Icelandic thorn (|\TH|, |\th|) and
+ eth\footnote*{Also called `edh'.} (|\DH|, |\dh|), the Polish
+ {\it a} and {\it e} with ogonek (|\A|, |\a|, |\E|, |\e|), and
+ the Sami eng\footnote\dag{Also called `ing' or `ng'.} (|\NG|,
+ |\ng|).
+
+ We also give replacements for {\it d}, {\it t} and {\it l} with
+ hook (which are usually drawn with a apostrophe-like mark), and
+ the Esperanto letter {\it hho} (\^h).
+\code
+ |\chardef\TH"00 \chardef\th"10 \chardef\DH"04 \chardef\dh"14
+ |\chardef\A "01 \chardef\a "11 \chardef\E "05 \chardef\e "15
+ |\chardef\NG"02 \chardef\ng"12 \chardef\L "03 \chardef\l "13
+ |\chardef\AE"5E \chardef\ae"7E \chardef\OE"5F \chardef\oe"7F
+ |\chardef\O "5C \chardef\o "7C
+\smallbreak
+ |\chardef\vd"9C \chardef\vt"9D \chardef\h "9E \chardef\vl"9F
+ |\chardef\ss"18 \chardef\i "19 \chardef\j "1A
+\smallbreak
+ |\def\aa{\ringmark a} \def\AA{\ringmark A}
+\endcode
+
+\code
+\smallbreak
+ |\chardef\orda"98 \chardef\ordo"99 \def\No{N\ordo} \def\no{n\ordo}
+ |\chardef\csuperior"98 \def\Mc{M\csuperior}
+\endcode
+ The command |\Mc| is used for forming names like
+ M\flushtop{\the\scriptfont\fam \b c}Donald.
+%}}} special letters
+%{{{ text syms
+
+\subsec{Other symbols used in text}
+
+ There are several new symbols here. Note that |\trademark| is
+ what you will get if you use the ASCII double quote character
+ `|"|' in your manuscript.
+\code
+ |\chardef\trademark "22
+ |\chardef\copyright "FB \chardef\registered"FD
+ |\chardef\careof "9A \chardef\Box "A0
+ |\chardef\cents "A2 \chardef\pounds "A3
+ |\chardef\currency "A4 \chardef\permille "A5
+ |\chardef\yen "A8 \chardef\florin "A9
+ |\chardef\dag "AA \chardef\ddag "AB
+ |\chardef\gbdecimal "AE \chardef\minus "AF
+ |\chardef\S "BA \chardef\P "BB
+ |\chardef\degrees "C0
+ |\chardef\lguillemet"BC \chardef\rguillemet"BE
+\endcode
+ The |\careof| sign ($\rm ^c\!/\!_o$) is an abbreviation for
+ `care of' in English-language addresses (actually, Australians
+ traditionally write `$\rm ^c\!/\!_-$'). The raised dot
+ |\gbdecimal| is the British decimal point (I~usually do
+ |\mathcode`.=\gbdecimal| and let maths mode do all the work).
+ The |\degrees| sign replaces \TeX's |$^\circ$|.
+
+ The guillemets can also be obtained with the ligatures |<<| and
+ |>>|.
+
+
+%}}} text syms
+%{{{ maths syms
+
+\subsec{Symbols used in maths}
+
+ I have stuck with the plain \TeX\ conventions as much as
+ possible---even though |\bullet| is more often used in text than
+ maths.
+\code
+ |\mathcode`\,"602C \mathcode`\-"20AF
+ |\mathcode`\."002E \mathcode`\/"002F
+\smallbreak
+ |\mathchardef\bullet "2020 \mathchardef\times "20A6
+ |\mathchardef\backslash"005B \mathchardef\setminus "205B
+ |\mathchardef\cdot "20AE \mathchardef\cdotp "60AE
+\smallbreak
+ |\def\langle{\delimiter"40DB30A } \delcode`\<"0DB30A
+ |\def\rangle{\delimiter"50DD30B } \delcode`\>"0DD30B
+ |\def\lbrace{\delimiter"407B308 } \let\{\lbrace \mathcode`\{"407B
+ |\def\rbrace{\delimiter"507D309 } \let\}\rbrace \mathcode`\}"407D
+\endcode
+
+%}}} maths syms
+%}}} symbols
+%{{{ switching alphabets
+\section{Switching between alphabets}
+
+ This is one of the strange ideas that went into the design of
+ the Malvern font---I wanted to have small capitals and medium
+ capitals treated as separate alphabets rather than as a
+ different style, just as I treat old-style and ranging numerals
+ as separate symbols. These extra alphabets are present in all
+ Malvern~A encodings\footnote*{Fonts with the Malvern~A encoding
+ but made from normal PostScript fonts will have medium capitals
+ replaced with full capitals, and old-style numerals replaced
+ with ranging numerals.}
+
+ These extra alphabets are obtained by transliterating a sequence
+ of letters using the |\uppercase| and |\lowercase|
+ commands.\footnote\dag{Alas! this task would be so much easier
+ and more efficient if it were possible to declare new
+ alphabet-switching tables styled after the |\uccode| and
+ |\lccode| tables which make |\uppercase| and |\lowercase| work.
+ Then all this nonsense could happen in \TeX's mouth, which has
+ some advantages. I~can imagine commands |\newchartable| (used
+ to create a token which can be used in the same way as
+ |\uccode|) and |\usechartable| (used to defined macros that work
+ like |\uppercase|). E\TeX\ hackers take note!} For example, to
+ transliterate capitals into small capitals (the |\sc| command),
+ we first make assignments so that, for example, |\lccode`a| is
+ set to the code for small-capital $\scriptstyle A$, then apply
+ |\lowercase| to the token list.
+
+\subsec{Setting upper and lower case codes for special letters}
+
+ These entries in the |\uucode| and |\lccode| tables are used by
+ the composite-letter-building commands rather then the
+ alphabet-switchign commands, but they are included here to be
+ near the other code-hackery.
+
+\code
+ |\uccode\th\TH \lccode\TH\th \uccode\TH\TH \lccode\th\th
+ |\uccode\a \A \lccode\A \a \uccode\A \A \lccode\a \a
+ |\uccode\ng\NG \lccode\NG\ng \uccode\NG\NG \lccode\ng\ng
+ |\uccode\l \L \lccode\L \l \uccode\L \L \lccode\l \l
+ |\uccode\dh\DH \lccode\DH\dh \uccode\DH\DH \lccode\dh\dh
+ |\uccode\e \E \lccode\E \e \uccode\E \E \lccode\e \e
+ |\uccode\o \O \lccode\O \o \uccode\O \O \lccode\o \o
+ |\uccode\ae\AE \lccode\AE\ae \uccode\AE\AE \lccode\ae\ae
+ |\uccode\oe\OE \lccode\OE\oe \uccode\OE\OE \lccode\oe\oe
+\smallbreak
+ |\uccode\i`I \uccode\j`J \lccode\i\i \lccode\j\j
+ |\uccode\csuperior`C
+\endcode
+
+
+\subsec{A macro for changing character codes}
+
+ The |\changecodes| command is used to change those segments of
+ character tables that are contiguous and map onto a contiguous
+ segment in the range. It is invoked as
+$$
+ \hbox{\it |\changecodes| command x y n}
+$$
+ (where $\it command$ is a token like |\uccode| or |\mathcode|
+ and $x$, $y$, and $n$ are \<number>s), and does the equivalent
+ of
+$$
+ {\it command}\;i\mathrel{\hbox{\tt=}}
+ j\qquad \hbox{for all $\cases{x \le i < x + n\cr
+ y \le j < y + n\cr}$}
+$$
+
+\code
+ |\def\changecodes#1#2#3#4{%
+ | \counta#2\relax \countb#3\relax \countc#4\relax
+ | \loop
+ | \ifnum\countc>0
+ | #1\counta\countb
+ | \advance\counta 1
+ | \advance\countb 1
+ | \advance\countc-1
+ | \repeat
+ |}
+\endcode
+
+ We can use this immediately to arrange that lowercasing medium caps
+ makes lower case, and uppercasing small caps makes full caps:
+\code
+ |\changecodes\uccode{"E1}{`A}{26}
+ |\changecodes\uccode{"C1}{"C1}{26}
+ |\changecodes\lccode{"E1}{"E1}{26}
+ |\changecodes\lccode{"C1}{`a}{26}
+\endcode
+
+ We also make old-style numerals behave as lower case for ranging
+ numerals, and also arrange that maths mode uses ranging figures.
+\code
+ |\changecodes\lccode{"B0}{`0}{10}
+ |\changecodes\uccode{`0}{"B0}{10}
+\endcode
+
+ In maths mode (1)~we use text italic for letters, since CM MAth
+ Italic will not match the body text and (2)~we use ranging
+ figures.
+\code
+ |\changecodes\mathcode{`a}{"7461}{26}
+ |\changecodes\mathcode{`A}{"7441}{26}
+ |\changecodes\mathcode{`0}{"70B0}{10}
+\endcode
+
+\subsec{Changing the alphabet for special letters got with commands}
+
+ When applying |\uppercase| or |\lowercase| to a token list,
+ macros will be unaffected (|\ae| will still generate `ae'). To
+ get around this we define macros that redefine these control
+ sequences. They each take as parameters hex digits used to make
+ character codes.
+\code
+ |\def\capspecials#1#2{%
+ | \chardef\TH"#10 \chardef\A "#11 \chardef\NG"#12
+ | \chardef\L "#13 \chardef\DH"#14 \chardef\E "#15
+ | \chardef\O "#2C \chardef\AE"#2E \chardef\OE"#2F
+ |}
+\smallbreak
+ |\def\lcspecials#1#2#3{%
+ | \chardef\th"#10 \chardef\a "#11 \chardef\ng"#12
+ | \chardef\l "#13 \chardef\dh"#14 \chardef\e "#15
+ | \chardef\o "#2C \chardef\ae"#2E \chardef\oe"#2F
+ | \def\ss{\char"#23 \char"#23 }\chardef\i"#39 \chardef\j"#3A
+ |}
+\endcode
+\subsec{Pulling it all together}
+ Now we can define the user macros that do the work. These take
+ one argument, a piece of text to transliterate: |\sc{OX1~3QD}|
+ produces a small-capital `${\rm\scriptstyle OX}{\mit 1\
+ 3}{\rm\scriptstyle QD}$';
+ |\csc{ABCdef}| produces caps and small caps
+ `ABC{\the\scriptfont0 DEF}'.
+\code
+ |\def\sc#1{{%
+ | \changecodes\lccode{`A}{"E1}{26}\capspecials9F\lowercase{#1}%
+ |}}
+\smallbreak
+ |\def\mc#1{{%
+ | \changecodes\lccode{`A}{"C1}{26}\capspecials8D\lowercase{#1}%
+ |}}
+\smallbreak
+ |\def\csc#1{{%
+ | \changecodes\uccode{`a}{"E1}{26}\lcspecials9FE\uppercase{#1}%
+ |}}
+\smallbreak
+ |\def\allcaps#1{{%
+ | \lcspecials054\uppercase{#1}%
+ |}}
+\smallbreak
+ |\def\alllc#1{{%
+ | \capspecials17\lowercase{#1}%
+ |}}
+\endcode
+%}}} switching alphabets
+\endcodefile
+\enddocument
+\bye
+%}}} maamac
+
+
+% Local variables:
+% fold-folded-p: t
+% fill-prefix: "\t"
+% End: