| 1 | %% |
| 2 | %% This is file `doafter.tex', |
| 3 | %% generated with the docstrip utility. |
| 4 | %% |
| 5 | %% The original source files were: |
| 6 | %% |
| 7 | %% doafter.dtx (with options: `package,plain') |
| 8 | %% |
| 9 | %% IMPORTANT NOTICE |
| 10 | %% |
| 11 | %% doafter package -- insert a token really after a group |
| 12 | %% Copyright (c) 1996 Peter Schmitt and Mark Wooding |
| 13 | %% |
| 14 | %% This program is free software; you can redistribute it and/or modify |
| 15 | %% it under the terms of the GNU General Public License as published by |
| 16 | %% the Free Software Foundation; either version 2 of the License, or |
| 17 | %% (at your option) any later version. |
| 18 | %% |
| 19 | %% This program is distributed in the hope that it will be useful, |
| 20 | %% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | %% GNU General Public License for more details. |
| 23 | %% |
| 24 | %% You should have received a copy of the GNU General Public License |
| 25 | %% along with this program; if not, write to the Free Software |
| 26 | %% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 27 | %% |
| 28 | %% \CharacterTable |
| 29 | %% {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 |
| 30 | %% 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 |
| 31 | %% Digits \0\1\2\3\4\5\6\7\8\9 |
| 32 | %% Exclamation \! Double quote \" Hash (number) \# |
| 33 | %% Dollar \$ Percent \% Ampersand \& |
| 34 | %% Acute accent \' Left paren \( Right paren \) |
| 35 | %% Asterisk \* Plus \+ Comma \, |
| 36 | %% Minus \- Point \. Solidus \/ |
| 37 | %% Colon \: Semicolon \; Less than \< |
| 38 | %% Equals \= Greater than \> Question mark \? |
| 39 | %% Commercial at \@ Left bracket \[ Backslash \\ |
| 40 | %% Right bracket \] Circumflex \^ Underscore \_ |
| 41 | %% Grave accent \` Left brace \{ Vertical bar \| |
| 42 | %% Right brace \} Tilde \~} |
| 43 | %% |
| 44 | \catcode`\@=11 |
| 45 | \let\@@aftergroup\aftergroup |
| 46 | \def\doafter#1{% |
| 47 | \def\@tempa{\@@aftergroup#1}% |
| 48 | \afterassignment\doafter@i\let\@let@token% |
| 49 | } |
| 50 | \def\doafter@i{% |
| 51 | \@let@token% |
| 52 | \let\aftergroup\@my@aftergroup% |
| 53 | \@@aftergroup\@prepare@after\@tempa% |
| 54 | } |
| 55 | \def\ag@cnt@local{0 } |
| 56 | \let\ag@cnt@global\ag@cnt@local |
| 57 | \def\@my@aftergroup{% |
| 58 | \begingroup% |
| 59 | \count@\ag@cnt@local% |
| 60 | \advance\count@\@ne% |
| 61 | \xdef\ag@cnt@global{\the\count@\space}% |
| 62 | \endgroup% |
| 63 | \let\ag@cnt@local\ag@cnt@global% |
| 64 | \@@aftergroup\@after@token\@@aftergroup% |
| 65 | } |
| 66 | \def\@after@token{% |
| 67 | \@start@after@group% |
| 68 | \@after@token% |
| 69 | } |
| 70 | \def\@start@after@group{% |
| 71 | \begingroup% |
| 72 | \count@\ag@cnt@global% |
| 73 | \clubpenalty\ag@cnt@local% |
| 74 | \let\@after@token\@after@token@i% |
| 75 | } |
| 76 | \def\@after@token@i{% |
| 77 | \advance\count@\m@ne% |
| 78 | \ifnum\count@=\clubpenalty% |
| 79 | \global\let\ag@cnt@global\ag@cnt@local% |
| 80 | \expandafter\@after@aftertoken\expandafter\@after@all% |
| 81 | \else% |
| 82 | \expandafter\@@aftergroup% |
| 83 | \fi% |
| 84 | } |
| 85 | \let\@after@all\endgroup |
| 86 | \def\@prepare@after{% |
| 87 | \ifx\ag@cnt@local\ag@cnt@global\else% |
| 88 | \expandafter\@prepare@after@i% |
| 89 | \fi% |
| 90 | } |
| 91 | \def\@prepare@after@i#1{% |
| 92 | \@start@after@group% |
| 93 | \def\@after@all{\@@aftergroup#1\endgroup}% |
| 94 | } |
| 95 | \def\@after@aftertoken#1{% |
| 96 | \let\bgroup\relax\let\egroup\relax% |
| 97 | \toks@{#1}% |
| 98 | \futurelet\@let@token\@after@aftertoken@i% |
| 99 | } |
| 100 | \def\@after@aftertoken@i{% |
| 101 | \ifcat\noexpand\@let@token{% |
| 102 | \@@aftergroup{% |
| 103 | \else\ifcat\noexpand\@let@token}% |
| 104 | \@@aftergroup}% |
| 105 | \else% |
| 106 | \def\@tempa##1{\@@aftergroup##1\the\toks@}% |
| 107 | \expandafter\expandafter\expandafter\@tempa% |
| 108 | \fi\fi% |
| 109 | } |
| 110 | \catcode`\@=12 |
| 111 | \endinput |
| 112 | %% |
| 113 | %% End of file `doafter.tex'. |