Remove the redundant file headers.
[mdwtools] / at.dtx
CommitLineData
86f6a31e 1% \begin{meta-comment} <general public licence>
2%%
3%% at package -- support for `@' commands'
4%% Copyright (c) 1996 Mark Wooding
5%%
6%% This program is free software; you can redistribute it and/or modify
7%% it under the terms of the GNU General Public License as published by
8%% the Free Software Foundation; either version 2 of the License, or
9%% (at your option) any later version.
10%%
11%% This program is distributed in the hope that it will be useful,
12%% but WITHOUT ANY WARRANTY; without even the implied warranty of
13%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14%% GNU General Public License for more details.
15%%
16%% You should have received a copy of the GNU General Public License
17%% along with this program; if not, write to the Free Software
18%% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19%%
20% \end{meta-comment}
21%
22% \begin{meta-comment} <Package preamble>
23%<+package>\NeedsTeXFormat{LaTeX2e}
24%<+package>\ProvidesPackage{at}
8995c091 25%<+package> [1996/05/02 1.3 @-command support]
86f6a31e 26% \end{meta-comment}
27%
28% \CheckSum{355}
29%% \CharacterTable
30%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
31%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
32%% Digits \0\1\2\3\4\5\6\7\8\9
33%% Exclamation \! Double quote \" Hash (number) \#
34%% Dollar \$ Percent \% Ampersand \&
35%% Acute accent \' Left paren \( Right paren \)
36%% Asterisk \* Plus \+ Comma \,
37%% Minus \- Point \. Solidus \/
38%% Colon \: Semicolon \; Less than \<
39%% Equals \= Greater than \> Question mark \?
40%% Commercial at \@ Left bracket \[ Backslash \\
41%% Right bracket \] Circumflex \^ Underscore \_
42%% Grave accent \` Left brace \{ Vertical bar \|
43%% Right brace \} Tilde \~}
44%%
45%
46% \begin{meta-comment} <driver>
47%
48%<*driver>
49\input{mdwtools}
50\describespackage{at}
1ae155da
MW
51\def\atsign{@}
52\def\athyphen{@\mbox{-}}
86f6a31e 53\aton
54\atlet p=\package
55\atdef at{\package{at}}
56\atdef={\mbox{-}}
57\atdef-{@@@=}
58\atlet.=\syntax
59\mdwdoc
60%</driver>
61%
62% \end{meta-comment}
63%
64% \section{User guide}
65%
66% The @at\ package is an attempt to remove a lot of tedious typing that
67% ends up in \LaTeX\ documents, by expanding the number of short command
68% names available. The new command names begin with the `|@|' character,
69% rather than the conventional `|\|', so you can tell them apart.
70%
71% The package provides some general commands for defining @-commands, and
72% then uses them to define some fairly simple ones which will be useful to
73% most people.
74%
75% The rules for @-command names aren't terribly complex:
76% \begin{itemize}
77% \item If the first character of the name is a letter, then the command name
78% consists of all characters up to, but not including, the first
79% nonletter. Spaces following the command name are ignored.
80% \item If the first character of the name is a backslash, then the @-command
81% name consists of the control sequence introduced by the backslash.
82% \item Otherwise, the command name consists only of that first character.
83% Spaces following the name are not ignored, unless that character
84% was itself a space character.
85% \end{itemize}
86%
87% Usually, digits are not considered to be letters. However, the
88% \package{at} package will consider digits to be letters if you give it the
89% \textsf{digits} option in the |\usepackage| command. (Note that this
90% only affects the \package{at} package; it won't change the characters
91% allowed in normal command names.)
92%
93% \DescribeMacro{\atallowdigits}
94% \DescribeMacro{\atdisallowdigits}
95% You can enable and disable digits being considered as letters dynamically.
96% The |\atallowdigits| command allows digits to be used as letters;
97% |\atdisallowdigits| prevents this. Both declarations follow \LaTeX's
98% usual scoping rules. Both of these commands have corresponding
99% environments with the same names (without the leading `|\|', obviously).
100%
1ae155da 101% \subsection{Defining \athyphen commands}
86f6a31e 102%
103% \DescribeMacro{\newatcommand}
104% \DescribeMacro{\renewatcommand}
105% The |\newatcommand| command will define a new @-command using a syntax
106% similar to |\newcommand|. For example, you could define
107% \begin{listing}
108%\newatcommand c[1]{\chapter{#1}}
109% \end{listing}
110% to make @.{"@c{"<name>"}"} equivalent to @.{"\\chapter{"<name>"}"}.
111%
112% A |\renewatcommand| is also provided to redefine existing commands, should
113% the need arise.
114%
115% \DescribeMacro{\atdef}
116% For \TeX\ hackers, the |\atdef| command defines @-commands using a syntax
e8e9e5d8 117% similar to \TeX's built-in |\def|.
86f6a31e 118%
119% As an example, the following command makes @.{"@/"<text>"/"} write its
120% argument \<text> in italics:
121% \begin{listing}
122%\atdef/#1/{\textit{#1}}
123% \end{listing}
124% The real implementation of the |@/|\dots|/| command is a bit more
125% complex, and is given in the next section.
126%
127% You can use all of \TeX's features for defining the syntax of your
128% command. (See chapter~20 of @/The \TeX book/ for more details.)
129%
130% \DescribeMacro{\atlet}
131% Since |\atdef| is provided to behave similarly to |\def|, @at\ provides
132% |\atlet| which works similarly to |\let|. For example you can say
133% \begin{listing}
134%\atlet!=\index
135% \end{listing}
136% to allow the short |@!| to behave exactly like |\index|.
137%
138% Note that all commands defined using these commands are robust even if you
139% use fragile commands in their definitions. Unless you start doing very
140% strange things, @-commands never need |\protect|ing.
141%
1ae155da 142% \subsection{Predefined \athyphen commands}
86f6a31e 143%
144% A small number of hopefully useful commands are provided by default.
145% These are described in the table below:
146%
147% \bigskip \begin{center} \begin{tabular}{lp{3in}} \hline
148% \bf Command & \bf Meaning \\ \hline
149% @.{"@@"} & Typesets an `@@' character. \\
150% @.{"@/"<text>"/"} & In text (LR or paragraph) mode, typesets its
151% argument emphasised. In maths mode, it
152% always chooses italics. \\
153% @.{"@*"<text>"*"} & Typesets its argument \<text> in bold. \\
154% @.{"@i{"<text>"}"} & Equivalent to `@.{"\\index{"<text>"}"}'. \\
155% @.{"@I{"<text>"}"} & As for |@i|, but also writes its argument
156% to the document. \\ \hline
157% \end{tabular} \end{center} \bigskip
158%
159% Package writers should not rely on any predefined @-commands -- they're
160% provided for users, and users should be able to redefine them without
161% fear of messing anything up. (This includes the `standard' commands
162% provided by the @at\ package, by the way. They're provided in the vague
163% hope that they might be useful, and as examples.)
164%
165% \implementation
166%
167% \section{Implementation}
168%
169% \begin{macrocode}
170%<*package>
171% \end{macrocode}
172%
173% \subsection{Options handling}
174%
175% We need a switch to say whether digits should be allowed. Since this
176% is a user thing, I'll avoid |\newif| and just define the thing by hand.
177%
178% \begin{macrocode}
179\def\atallowdigits{\let\ifat@digits\iftrue}
180\def\atdisallowdigits{\let\ifat@digits\iffalse}
181% \end{macrocode}
182%
183% Now define the options.
184%
185% \begin{macrocode}
186\DeclareOption{digits}{\atallowdigits}
187\DeclareOption{nodigits}{\atdisallowdigits}
188\ExecuteOptions{nodigits}
189\ProcessOptions
190% \end{macrocode}
191%
192% \subsection{How the commands work}
193%
194% Obviously we make the `@@' character active. It inspects the next
195% character (or argument, actually -- it can be enclosed in braces for
196% longer commands, although this is a bit futile), and builds the command
197% name from that.
198%
199% The |\at| command is equivalent to the active `@@' character always.
200%
201%
202% \subsection{Converting command names}
203%
204% We need to be able to read an @-command name, and convert it to a normal
205% \TeX\ control sequence. First, we declare some control sequences for
206% braces, which we need later.
207%
208% \begin{macrocode}
209\begingroup
210\catcode`\<1
211\catcode`\>2
212\catcode`\{12
213\catcode`\}12
214\gdef\at@lb<{>
215\gdef\at@rb<}>
216\gdef\at@spc< >
217\endgroup
218% \end{macrocode}
219%
220% I'll set up some helper routines now, to help me read the command
221% names. The way this works is that we |\futurelet| the token into
222% |\@let@token|. These routines will then sort out what to do next.
223%
224% \begin{macro}{\at@test}
225%
226% Given an |\if|\dots\ test, does its first or second argument.
227%
228% \begin{macrocode}
229\def\at@test#1\then{%
230 #1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi%
231}
232% \end{macrocode}
233%
234% \end{macro}
235%
236% \begin{macro}{\at@ifcat}
237%
238% Checks the category code of the current character. If it matches the
239% argument, it does its second argument, otherwise it does the third.
240%
241% \begin{macrocode}
242\def\at@ifcat#1{\at@test\ifcat#1\noexpand\@let@token\then}
243% \end{macrocode}
244%
245% \end{macro}
246%
247% \begin{macro}{\at@ifletter}
248%
249% This routine tests the token to see if it's a letter, and if so adds
250% it to the token list and does the first argument; otherwise it does the
251% second argument. It accepts digits as letters if the switch is turned
252% on.
253%
254% There's some fun later, so I'll describe this slowly. First, we compare
255% the category code to a letter, and if we have a match, we know we're done;
256% we need to pick up the letter as an argument. If the catcode is `other',
257% we must compare with numbers to see if it's in range.
258%
259% \begin{macrocode}
260\def\at@ifletter#1#2{%
261 \at@ifcat x%
262 {\at@ifletter@ii{#1}}%
263 {\at@ifcat 0%
264 {\at@ifletter@i{#1}{#2}}%
265 {#2}%
e8e9e5d8 266 }%
86f6a31e 267}
268% \end{macrocode}
269%
270% Right. It's `other' (so it's safe to handle as a macro argument) and we
271% need to know if it's a digit. This is a little tricky: I use |\if| to
272% compare two characters. The first character is~`1' or~`0' depending on the
273% `digit' switch; the second is~`1' or~`x' depending on whether it's actually
274% a digit. They'll only match if everything's worked out OK.
275%
276% \begin{macrocode}
277\def\at@ifletter@i#1#2#3{%
278 \at@test\if%
279 \ifat@digits1\else0\fi%
280 \ifnum`#3<`0x\else\ifnum`#3>`9x\else1\fi\fi%
281 \then%
282 {\at@ifletter@ii{#1}{#3}}%
283 {#2#3}%
284}
285% \end{macrocode}
286%
287% Right; we have the character, so add it to the list and carry on.
288%
289% \begin{macrocode}
290\def\at@ifletter@ii#1#2{\toks@\expandafter{\the\toks@#2}#1}
291% \end{macrocode}
292%
293% \end{macro}
294%
295% Now we define the command name reading routines. We have @/almost/ the
296% same behaviour as \TeX, although we can't support `|%|' characters for
297% reasons to do with \TeX's tokenising algorithm.
298%
299% \begin{macro}{\at@read@name}
300%
301% The routine which actually reads the command name works as follows:
302% \begin{enumerate}
303% \item Have a peek at the next character. If it's a left or right brace,
304% then use the appropriate character.
305% \item If the character is not a letter, just use the character (or whole
306% control sequence.
307% \item Finally, if it's a letter, keep reading letters until we find one
308% that wasn't.
309% \end{enumerate}
310%
311% First, we do some setting up and read the first character
312%
313% \begin{macrocode}
314\def\at@read@name#1{%
315 \let\at@next=#1%
316 \toks@{}%
317 \futurelet\@let@token\at@rn@i%
318}
319% \end{macrocode}
320%
321% Next, sort out what to do, based on the category code.
322%
323% \begin{macrocode}
324\def\at@rn@i{%
325 \def\@tempa{\afterassignment\at@rn@iv\let\@let@token= }%
326 \at@ifletter%
327 {\futurelet\@let@token\at@rn@iii}%
328 {\at@ifcat\bgroup%
329 {\toks@\expandafter{\at@lb}\@tempa}%
330 {\at@ifcat\egroup%
331 {\toks@\expandafter{\at@rb}\@tempa}%
332 {\at@ifcat\at@spc%
333 {\toks@{ }\@tempa}%
334 {\at@rn@ii}%
335 }%
336 }%
337 }%
338}
339% \end{macrocode}
340%
341% Most types of tokens can be fiddled using |\string|.
342%
343% \begin{macrocode}
344\def\at@rn@ii#1{%
345 \toks@\expandafter{\string#1}%
346 \at@rn@iv%
347}
348% \end{macrocode}
349%
350% We've found a letter, so we should check for another one.
351%
352% \begin{macrocode}
353\def\at@rn@iii{%
354 \at@ifletter%
355 {\futurelet\@let@token\at@rn@iii}%
356 {\@ifnextchar.\at@rn@iv\at@rn@iv}%
357}
358% \end{macrocode}
359%
360% Finally, we need to pass the real string, as an argument, to the
361% macro. We make |\@let@token| relax, since it might be something which will
362% upset \TeX\ later, e.g., a |#| character.
363%
364% \begin{macrocode}
365\def\at@rn@iv{%
366 \let\@let@token\relax%
367 \expandafter\at@next\csname at.\the\toks@\endcsname%
368}
369% \end{macrocode}
370%
371% \end{macro}
372%
373% \begin{macro}{\at@cmdname}
374%
375% Given a control sequence, work out which @-command it came from.
376%
377% \begin{macrocode}
378\def\at@cmdname#1{\expandafter\at@cmdname@i\string#1\@@foo}
379% \end{macrocode}
380%
381% Now extract the trailing bits.
382%
383% \begin{macrocode}
384\def\at@cmdname@i#1.#2\@@foo{#2}
385% \end{macrocode}
386%
387% \end{macro}
388%
389% \begin{macro}{\at@decode}
390%
391% The |\at@decode| macro takes an extracted @-command name, and tries to
392% execute the correct control sequence derived from it.
393%
394% \begin{macrocode}
395\def\at@decode#1{%
396 \at@test\ifx#1\relax\then{%
397 \PackageError{at}{Unknown @-command `@\at@cmdname#1'}{%
398 The @-command you typed wasn't recognised, so I've ignored it.
399 }%
400 }{%
401 #1%
402 }%
403}
404% \end{macrocode}
405%
406% \end{macro}
407%
408% \begin{macro}{\@at}
409%
410% We'd like a measure of compatibility with @p{amsmath}. The @-commands
411% provided by @p{amsmath} work only in maths mode, so this gives us a way of
412% distinguishing. If the control sequence |\Iat| is defined, and we're in
413% maths mode, we'll call that instead of doing our own thing.
414%
415% \begin{macrocode}
416\def\@at{%
417 \def\@tempa{\at@read@name\at@decode}%
418 \ifmmode\ifx\Iat\not@@defined\else%
419 \let\@tempa\Iat%
420 \fi\fi%
421 \@tempa%
422}
423% \end{macrocode}
424%
425% \end{macro}
426%
427%
428% \subsection{Defining new commands}
429%
430% \begin{macro}{\at@buildcmd}
431%
432% First, we define a command to build these other commands:
433%
434% \begin{macrocode}
435\def\at@buildcmd#1#2{%
436 \expandafter\def\csname\expandafter
437 \@gobble\string#1@decode\endcsname##1{#2##1}%
438 \edef#1{%
439 \noexpand\at@read@name%
440 \expandafter\noexpand%
441 \csname\expandafter\@gobble\string#1@decode\endcsname%
442 }%
443}
444% \end{macrocode}
445%
446% \end{macro}
447%
448% \begin{macro}{\newatcommand}
449% \begin{macro}{\renewatcommand}
450% \begin{macro}{\provideatcommand}
451% \begin{macro}{\atdef}
452% \begin{macro}{\atshow}
453%
454% Now we define the various operations on @-commands.
455%
456% \begin{macrocode}
457\at@buildcmd\newatcommand\newcommand
458\at@buildcmd\renewatcommand\renewcommand
459\at@buildcmd\provideatcommand\providecommand
460\at@buildcmd\atdef\def
461\at@buildcmd\atshow\show
462% \end{macrocode}
463%
464% \end{macro}
465% \end{macro}
466% \end{macro}
467% \end{macro}
468% \end{macro}
469%
470% \begin{macro}{\atlet}
471%
472% |\atlet| is rather harder than the others, because we want to allow people
473% to say things like @.{"\\atlet"<name>"=@"<name>}. The following hacking
474% does the trick. I'm trying very hard to duplicate |\let|'s behaviour with
475% respect to space tokens here, to avoid any surprises, although there
476% probably will be some differences. In particular, |\afterassignment|
477% won't work in any sensible way.
478%
479% First, we read the name of the @-command we're defining. We also open
480% a group, to stop messing other people up, and make `@@' into an `other'
481% token, so that it doesn't irritatingly look like its meaning as a control
482% sequence.
483%
484% \begin{macrocode}
485\def\atlet{%
486 \begingroup%
487 \@makeother\@%
488 \at@read@name\atlet@i%
489}
490% \end{macrocode}
491%
492% Put the name into a scratch macro for later use. Now see if there's an
493% equals sign up ahead. If not, this will gobble any spaces in between the
494% @-command name and the argument.
495%
496% \begin{macrocode}
497\def\atlet@i#1{%
498 \def\at@temp{#1}%
499 \@ifnextchar=\atlet@ii{\atlet@ii=}%
500}
501% \end{macrocode}
502%
503% Now we gobble the equals sign (whatever catcode it is), and peek at the
504% next token up ahead using |\let| with no following space.
505%
506% \begin{macrocode}
507\def\atlet@ii#1{\afterassignment\atlet@iii\global\let\at@gnext=}
508% \end{macrocode}
509%
510% The control sequence |\at@gnext| is now |\let| to be whatever we want the
511% @-command to be, unless it's picked up an `@@' sign. If it has, we've
512% eaten the |@| token, so just read the name and pass it on. Otherwise,
513% we can |\let| the @-command directly to |\at@gnext|. There's some
514% nastiness here to make |\the\toks@| expand before we close the group and
515% restore its previous definition.
516%
517% \begin{macrocode}
518\def\atlet@iii{%
519 \if @\noexpand\at@gnext%
520 \expandafter\at@read@name\expandafter\atlet@iv%
521 \else%
522 \expandafter\endgroup%
523 \expandafter\let\at@temp= \at@gnext%
524 \fi%
525}
526% \end{macrocode}
527%
528% We've read the source @-command name, so just copy the definitions over.
529%
530% \begin{macrocode}
531\def\atlet@iv#1{%
532 \expandafter\endgroup%
533 \expandafter\let\at@temp=#1%
534}
535% \end{macrocode}
536%
537% \end{macro}
538%
539%
1ae155da 540% \subsection{Robustness of \athyphen commands}
86f6a31e 541%
542% We want all @-commands to be robust. We could leave them all being
543% fragile, although making robust @-commands would then be almost impossible.
544% There are two problems which we must face:
545%
546% \begin{itemize}
547%
548% \item The `|\@at|' command which scans the @-command name is (very)
549% fragile. I could have used |\DeclareRobustCommand| for it (and in
550% fact I did in an earlier version), but that doesn't help the other
551% problem at all.
552%
553% \item The `name' of the @-command may contain active characters or control
554% sequences, which will be expanded at the wrong time unless we do
555% something about it now.
556%
557% \end{itemize}
558%
559% We must also be careful not to introduce extra space characters into any
560% files written, because spaces are significant in @-commands. Finally,
561% we have a minor problem in that most auxiliary files are read in with
562% the `@@' character set to be a letter.
563%
564% \begin{macro}{\at}
565%
566% Following the example of \LaTeX's `short' command handling, we'll define
567% |\at| to decide what to do depending on what |\protect| looks like. If
568% we're typesetting, we just call |\@at| (above) and expect it to cope.
569% Otherwise we call |\at@protect|, which scoops up the |\fi| and the |\@at|,
570% and inserts other magic.
571%
572% \begin{macrocode}
573\def\at{\ifx\protect\@typeset@protect\else\at@protect\fi\@at}
574% \end{macrocode}
575%
576% \end{macro}
577%
578% \begin{macro}{\at@protect}
579%
e8e9e5d8
MW
580% Since we gobbled the |\fi| from the above, we must put that back. We then
581% need to do things which are more complicated. If |\protect| is behaving
86f6a31e 582% like |\string|, then we do one sort of protection. Otherwise, we assume
583% that |\protect| is being like |\noexpand|.
584%
585% \begin{macrocode}
586\def\at@protect\fi#1{%
587 \fi%
588 \ifx\protect\string%
589 \expandafter\at@protect@string%
590 \else%
591 \expandafter\at@protect@noexpand%
592 \fi%
593}
594% \end{macrocode}
595%
596% \end{macro}
597%
598% \begin{macro}{\at@protect@string}
599%
600% When |\protect| is |\string|, we don't need to be able to recover the
601% original text particularly accurately -- it's for the user to look at.
602% Therefore, we just output a $|@|_{11}$ and use |\string| on the next
603% token. This must be sufficient, since we only allow multi-token command
604% names if the first token is a letter (code~11).
605%
606% \begin{macrocode}
607\def\at@protect@string{@\string}
608% \end{macrocode}
609%
610% \end{macro}
611%
612% \begin{macro}{\at@protect@noexpand}
613%
614% This is a little more complex, since we're still expecting to be executed
615% properly at some stage. However, there's a cheeky dodge we can employ
616% since the |\at| command is thoroughly robustified (or at least it will be
617% by the time we've finished this). All |\@unexpandable@protect| does
618% is confer repeated robustness on a fragile command. Since our command
619% is robust, we don't need this and we can get away with just using a
620% single |\noexpand|, both for the |\@at@| command and the following token
621% (which we must robustify, because no-one else can do it for us -- if
622% anyone tries, they end up using the |@\protect| command which is rather
623% embarassing).
624%
625% I'll give the definition, and then examine how this expands in various
626% cases.
627%
628% \begin{macrocode}
629\def\at@protect@noexpand{\noexpand\@at@ @\noexpand}
630\def\@at@#1{\at}
631% \end{macrocode}
632%
633% A few points, before we go into the main examination of the protection.
634% I've inserted a $|@|_{11}$ token, which is gobbled by |\@at@| when the
635% thing is finally expanded fully. This prevents following space tokens
636% in an |\input| file from being swallowed because they follow a control
637% sequence. (I can't use the normal $|@|_{13}$ token, because when files
638% like the |.aux| file are read in, |@| is given code~11 by
639% |\makeatletter|.)
640%
641% \setbox0\hbox{|@at@|}
642% Now for a description of why this works. When |\at| is expanded, it works
643% out that |\protect| is either |\noexpand| or |\@unexpandable@protect|, and
644% becomes |\at@protect@noexpand|. Because of the |\noexpand| tokens, this
645% stops being expanded once it reaches $\fbox{\box0}\,|@|_{11}\,x$ (where
646% $x$ is the token immediately following the $|@|_{13}$ character). If this
647% is expanded again, for example in another |\edef|, or in a |\write| or a
648% |\mark|, the |\@at@| wakes up, gobbles the following |@| (whatever catcode
649% it is -- there may be intervening |\write| and |\input| commands) and
650% becomes |\at|, and the whole thing can start over again.
651%
652% \end{macro}
653%
654%
655% \subsection{Enabling and disabling @-commands}
656%
657% \begin{macro}{\aton}
658%
659% We define the |\aton| command to enable all of our magic. We store
660% the old catcode in the |\atoff| command, make `@@' active, and make it
661% do the stuff.
662%
663% \begin{macrocode}
664\def\aton{%
665 \ifnum\catcode`\@=\active\else%
666 \edef\atoff{\catcode`\noexpand\@\the\catcode`\@}%
667 \catcode`\@\active%
668 \lccode`\~`\@%
669 \lowercase{\let~\at}%
670 \fi%
671}
672% \end{macrocode}
673%
674% \end{macro}
675%
676% \begin{macro}{\atoff}
677%
678% The |\atoff| command makes `@@' do the stuff it's meant to. We remember
679% the old catcode and revert to it. This is largely unnecessary.
680%
681% \begin{macrocode}
682\def\atoff{\catcode`\@12}
683% \end{macrocode}
684%
685% \end{macro}
686%
687% \begin{macro}{\makeatother}
688%
689% Now we make our active `@@' the default outside of package files.
690%
691% \begin{macrocode}
692\let\makeatother\aton
693% \end{macrocode}
694%
695% \end{macro}
696%
697% And we must make sure that the user can use all of our nice commands.
698% Once the document starts, we allow @-commands.
699%
700% \begin{macrocode}
701\AtBeginDocument{\aton}
702% \end{macrocode}
703%
704% \begin{macro}{\dospecials}
705% \begin{macro}{\@sanitize}
706%
707% We must add the `@@' character to the various specials lists.
708%
709% \begin{macrocode}
710\expandafter\def\expandafter\dospecials\expandafter{\dospecials\do\@}
711\expandafter\def\expandafter\@sanitize\expandafter{%
712 \@sanitize\@makeother\@}
713% \end{macrocode}
714%
715% \end{macro}
716% \end{macro}
717%
1ae155da 718% \subsection{Default \athyphen commands}
86f6a31e 719%
720% We define some trivial examples to get the user going.
721%
722% \begin{macrocode}
723\expandafter\chardef\csname at.@\endcsname=`\@
724\atdef*#1*{\ifmmode\mathbf{#1}\else\textbf{#1}\fi}
725\atdef/#1/{\ifmmode\mathit{#1}\else\emph{#1}\fi}
726\atlet i=\index
727\atdef I#1{#1\index{#1}}
728%</package>
729% \end{macrocode}
730%
731% \hfill Mark Wooding, \today
732%
733% \Finale
734%
735\endinput