summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/mdwtools
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-09 00:49:07 +0000
committerKarl Berry <karl@freefriends.org>2006-01-09 00:49:07 +0000
commit007f67a693e4d031fd3d792df8e4d5f43e2cb2e7 (patch)
tree90d17e00e572ecb1e24764b6f29c80e098b08d29 /Master/texmf-dist/doc/latex/mdwtools
parent950209b26f70aa87ed07c54f82a95b6f03b7c3a0 (diff)
doc/latex
git-svn-id: svn://tug.org/texlive/trunk@84 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/mdwtools')
-rw-r--r--Master/texmf-dist/doc/latex/mdwtools/doafter.tex113
-rw-r--r--Master/texmf-dist/doc/latex/mdwtools/gpl.tex444
-rw-r--r--Master/texmf-dist/doc/latex/mdwtools/mathenv.tex212
-rw-r--r--Master/texmf-dist/doc/latex/mdwtools/mdwtools.tex1212
4 files changed, 1981 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/mdwtools/doafter.tex b/Master/texmf-dist/doc/latex/mdwtools/doafter.tex
new file mode 100644
index 00000000000..2e9cabbb57f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/mdwtools/doafter.tex
@@ -0,0 +1,113 @@
+%%
+%% This is file `doafter.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% doafter.dtx (with options: `package,plain')
+%%
+%% IMPORTANT NOTICE
+%%
+%% doafter package -- insert a token really after a group
+%% Copyright (c) 1996 Peter Schmitt and Mark Wooding
+%%
+%% 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.
+%%
+%% 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.
+%%
+%% 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.
+%%
+%% \CharacterTable
+%% {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
+%% 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
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%%
+\catcode`\@=11
+\let\@@aftergroup\aftergroup
+\def\doafter#1{%
+ \def\@tempa{\@@aftergroup#1}%
+ \afterassignment\doafter@i\let\@let@token%
+}
+\def\doafter@i{%
+ \@let@token%
+ \let\aftergroup\@my@aftergroup%
+ \@@aftergroup\@prepare@after\@tempa%
+}
+\def\ag@cnt@local{0 }
+\let\ag@cnt@global\ag@cnt@local
+\def\@my@aftergroup{%
+ \begingroup%
+ \count@\ag@cnt@local%
+ \advance\count@\@ne%
+ \xdef\ag@cnt@global{\the\count@\space}%
+ \endgroup%
+ \let\ag@cnt@local\ag@cnt@global%
+ \@@aftergroup\@after@token\@@aftergroup%
+}
+\def\@after@token{%
+ \@start@after@group%
+ \@after@token%
+}
+\def\@start@after@group{%
+ \begingroup%
+ \count@\ag@cnt@global%
+ \clubpenalty\ag@cnt@local%
+ \let\@after@token\@after@token@i%
+}
+\def\@after@token@i{%
+ \advance\count@\m@ne%
+ \ifnum\count@=\clubpenalty%
+ \global\let\ag@cnt@global\ag@cnt@local%
+ \expandafter\@after@aftertoken\expandafter\@after@all%
+ \else%
+ \expandafter\@@aftergroup%
+ \fi%
+}
+\let\@after@all\endgroup
+\def\@prepare@after{%
+ \ifx\ag@cnt@local\ag@cnt@global\else%
+ \expandafter\@prepare@after@i%
+ \fi%
+}
+\def\@prepare@after@i#1{%
+ \@start@after@group%
+ \def\@after@all{\@@aftergroup#1\endgroup}%
+}
+\def\@after@aftertoken#1{%
+ \let\bgroup\relax\let\egroup\relax%
+ \toks@{#1}%
+ \futurelet\@let@token\@after@aftertoken@i%
+}
+\def\@after@aftertoken@i{%
+ \ifcat\noexpand\@let@token{%
+ \@@aftergroup{%
+ \else\ifcat\noexpand\@let@token}%
+ \@@aftergroup}%
+ \else%
+ \def\@tempa##1{\@@aftergroup##1\the\toks@}%
+ \expandafter\expandafter\expandafter\@tempa%
+ \fi\fi%
+}
+\catcode`\@=12
+\endinput
+%%
+%% End of file `doafter.tex'.
diff --git a/Master/texmf-dist/doc/latex/mdwtools/gpl.tex b/Master/texmf-dist/doc/latex/mdwtools/gpl.tex
new file mode 100644
index 00000000000..b0d1915e5ff
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/mdwtools/gpl.tex
@@ -0,0 +1,444 @@
+% \iffalse <meta-comment>
+%
+% $Id: gpl.tex,v 1.1 1996/11/19 20:51:14 mdw Exp $
+%
+% The GNU General Public Licence as a LaTeX section
+%
+% (c) 1989, 1991 Free Software Foundation, Inc.
+% LaTeX markup and minor formatting changes by Mark Wooding
+%
+
+%----- Revision history -----------------------------------------------------
+%
+% $Log: gpl.tex,v $
+% Revision 1.1 1996/11/19 20:51:14 mdw
+% Initial revision
+%
+
+% --- Chapter heading ---
+%
+% We don't know whether this ought to be a section or a chapter. Easy.
+% We'll see if chapters are possible.
+%
+% \fi
+
+\begingroup
+\makeatletter
+
+\edef\next#1#2#3{\relax
+ \ifx\chapter\@@undefined
+ \ifx\documentclass\@notprerr#2\else#3\fi
+ \else#1\fi
+}
+
+\expandafter\endgroup\next
+{
+ \let\gpltoplevel\chapter
+ \let\gplsec\section
+ \let\gplend\endinput
+}{
+ \let\gpltoplevel\section
+ \let\gplsec\subsection
+ \let\gplend\endinput
+}{
+ \documentclass[a4paper]{article}
+ \def\gpltoplevel#1{%
+ \vspace*{1in}%
+ \hbox to\hsize{\hfil\LARGE\bfseries#1\hfil}%
+ \vspace{1in}%
+ }
+ \let\gplsec\section
+ \def\gplend{\end{document}}
+ \advance\textwidth1in
+ \advance\oddsidemargin-.5in
+ \sloppy
+ \begin{document}
+}
+
+%^^A-------------------------------------------------------------------------
+\gpltoplevel{The GNU General Public Licence}
+
+
+The following is the text of the GNU General Public Licence, under the terms
+of which this software is distrubuted.
+
+\vspace{12pt}
+
+\begin{center}
+\textbf{GNU GENERAL PUBLIC LICENSE} \\
+Version 2, June 1991
+\end{center}
+
+\begin{center}
+Copyright (C) 1989, 1991 Free Software Foundation, Inc. \\
+675 Mass Ave, Cambridge, MA 02139, USA
+
+Everyone is permitted to copy and distribute verbatim copies \\
+of this license document, but changing it is not allowed.
+\end{center}
+
+
+\gplsec{Preamble}
+
+The licenses for most software are designed to take away your freedom to
+share and change it. By contrast, the GNU General Public License is intended
+to guarantee your freedom to share and change free software---to make sure
+the software is free for all its users. This General Public License applies
+to most of the Free Software Foundation's software and to any other program
+whose authors commit to using it. (Some other Free Software Foundation
+software is covered by the GNU Library General Public License instead.) You
+can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the freedom
+to distribute copies of free software (and charge for this service if you
+wish), that you receive source code or can get it if you want it, that you
+can change the software or use pieces of it in new free programs; and that
+you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to
+deny you these rights or to ask you to surrender the rights. These
+restrictions translate to certain responsibilities for you if you distribute
+copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or
+for a fee, you must give the recipients all the rights that you have. You
+must make sure that they, too, receive or can get the source code. And you
+must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2)
+offer you this license which gives you legal permission to copy, distribute
+and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If
+the software is modified by someone else and passed on, we want its
+recipients to know that what they have is not the original, so that any
+problems introduced by others will not reflect on the original authors'
+reputations.
+
+Finally, any free program is threatened constantly by software patents. We
+wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program
+proprietary. To prevent this, we have made it clear that any patent must be
+licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+
+\gplsec{Terms and conditions for copying, distribution and modification}
+
+\begin{enumerate}
+
+\makeatletter \setcounter{\@listctr}{-1} \makeatother
+
+\item [0.] This License applies to any program or other work which contains a
+ notice placed by the copyright holder saying it may be distributed
+ under the terms of this General Public License. The ``Program'',
+ below, refers to any such program or work, and a ``work based on the
+ Program'' means either the Program or any derivative work under
+ copyright law: that is to say, a work containing the Program or a
+ portion of it, either verbatim or with modifications and/or translated
+ into another language. (Hereinafter, translation is included without
+ limitation in the term ``modification''.) Each licensee is addressed
+ as ``you''.
+
+ Activities other than copying, distribution and modification are not
+ covered by this License; they are outside its scope. The act of
+ running the Program is not restricted, and the output from the Program
+ is covered only if its contents constitute a work based on the Program
+ (independent of having been made by running the Program). Whether that
+ is true depends on what the Program does.
+
+\item [1.] You may copy and distribute verbatim copies of the Program's
+ source code as you receive it, in any medium, provided that you
+ conspicuously and appropriately publish on each copy an appropriate
+ copyright notice and disclaimer of warranty; keep intact all the
+ notices that refer to this License and to the absence of any warranty;
+ and give any other recipients of the Program a copy of this License
+ along with the Program.
+
+ You may charge a fee for the physical act of transferring a copy, and
+ you may at your option offer warranty protection in exchange for a fee.
+
+\item [2.] You may modify your copy or copies of the Program or any portion
+ of it, thus forming a work based on the Program, and copy and
+ distribute such modifications or work under the terms of Section 1
+ above, provided that you also meet all of these conditions:
+
+ \begin{enumerate}
+
+ \item [(a)] You must cause the modified files to carry prominent
+ notices stating that you changed the files and the date of any
+ change.
+
+ \item [(b)] You must cause any work that you distribute or publish,
+ that in whole or in part contains or is derived from the Program
+ or any part thereof, to be licensed as a whole at no charge to
+ all third parties under the terms of this License.
+
+ \item [(c)] If the modified program normally reads commands
+ interactively when run, you must cause it, when started running
+ for such interactive use in the most ordinary way, to print or
+ display an announcement including an appropriate copyright notice
+ and a notice that there is no warranty (or else, saying that you
+ provide a warranty) and that users may redistribute the program
+ under these conditions, and telling the user how to view a copy
+ of this License. (Exception: if the Program itself is
+ interactive but does not normally print such an announcement,
+ your work based on the Program is not required to print an
+ announcement.)
+
+ \end{enumerate}
+
+ These requirements apply to the modified work as a whole. If
+ identifiable sections of that work are not derived from the Program,
+ and can be reasonably considered independent and separate works in
+ themselves, then this License, and its terms, do not apply to those
+ sections when you distribute them as separate works. But when you
+ distribute the same sections as part of a whole which is a work based
+ on the Program, the distribution of the whole must be on the terms of
+ this License, whose permissions for other licensees extend to the
+ entire whole, and thus to each and every part regardless of who wrote
+ it.
+
+ Thus, it is not the intent of this section to claim rights or contest
+ your rights to work written entirely by you; rather, the intent is to
+ exercise the right to control the distribution of derivative or
+ collective works based on the Program.
+
+ In addition, mere aggregation of another work not based on the Program
+ with the Program (or with a work based on the Program) on a volume of a
+ storage or distribution medium does not bring the other work under the
+ scope of this License.
+
+\item [3.] You may copy and distribute the Program (or a work based on it,
+ under Section 2) in object code or executable form under the terms of
+ Sections 1 and 2 above provided that you also do one of the following:
+
+ \begin{enumerate}
+
+ \item [(a)] Accompany it with the complete corresponding
+ machine-readable source code, which must be distributed under the
+ terms of Sections 1 and 2 above on a medium customarily used for
+ software interchange; or,
+
+ \item [(b)] Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ \item [(c)] Accompany it with the information you received as to the
+ offer to distribute corresponding source code. (This alternative
+ is allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+ \end{enumerate}
+
+ The source code for a work means the preferred form of the work for
+ making modifications to it. For an executable work, complete source
+ code means all the source code for all modules it contains, plus any
+ associated interface definition files, plus the scripts used to control
+ compilation and installation of the executable. However, as a special
+ exception, the source code distributed need not include anything that
+ is normally distributed (in either source or binary form) with the
+ major components (compiler, kernel, and so on) of the operating system
+ on which the executable runs, unless that component itself accompanies
+ the executable.
+
+ If distribution of executable or object code is made by offering access
+ to copy from a designated place, then offering equivalent access to
+ copy the source code from the same place counts as distribution of the
+ source code, even though third parties are not compelled to copy the
+ source along with the object code.
+
+\item [4.] You may not copy, modify, sublicense, or distribute the Program
+ except as expressly provided under this License. Any attempt otherwise
+ to copy, modify, sublicense or distribute the Program is void, and will
+ automatically terminate your rights under this License. However,
+ parties who have received copies, or rights, from you under this
+ License will not have their licenses terminated so long as such parties
+ remain in full compliance.
+
+\item [5.] You are not required to accept this License, since you have not
+ signed it. However, nothing else grants you permission to modify or
+ distribute the Program or its derivative works. These actions are
+ prohibited by law if you do not accept this License. Therefore, by
+ modifying or distributing the Program (or any work based on the
+ Program), you indicate your acceptance of this License to do so, and
+ all its terms and conditions for copying, distributing or modifying the
+ Program or works based on it.
+
+\item [6.] Each time you redistribute the Program (or any work based on the
+ Program), the recipient automatically receives a license from the
+ original licensor to copy, distribute or modify the Program subject to
+ these terms and conditions. You may not impose any further
+ restrictions on the recipients' exercise of the rights granted herein.
+ You are not responsible for enforcing compliance by third parties to
+ this License.
+
+\item [7.] If, as a consequence of a court judgment or allegation of patent
+ infringement or for any other reason (not limited to patent issues),
+ conditions are imposed on you (whether by court order, agreement or
+ otherwise) that contradict the conditions of this License, they do not
+ excuse you from the conditions of this License. If you cannot
+ distribute so as to satisfy simultaneously your obligations under this
+ License and any other pertinent obligations, then as a consequence you
+ may not distribute the Program at all. For example, if a patent
+ license would not permit royalty-free redistribution of the Program by
+ all those who receive copies directly or indirectly through you, then
+ the only way you could satisfy both it and this License would be to
+ refrain entirely from distribution of the Program.
+
+ If any portion of this section is held invalid or unenforceable under
+ any particular circumstance, the balance of the section is intended to
+ apply and the section as a whole is intended to apply in other
+ circumstances.
+
+ It is not the purpose of this section to induce you to infringe any
+ patents or other property right claims or to contest validity of any
+ such claims; this section has the sole purpose of protecting the
+ integrity of the free software distribution system, which is
+ implemented by public license practices. Many people have made
+ generous contributions to the wide range of software distributed
+ through that system in reliance on consistent application of that
+ system; it is up to the author/donor to decide if he or she is willing
+ to distribute software through any other system and a licensee cannot
+ impose that choice.
+
+ This section is intended to make thoroughly clear what is believed to
+ be a consequence of the rest of this License.
+
+\item [8.] If the distribution and/or use of the Program is restricted in
+ certain countries either by patents or by copyrighted interfaces, the
+ original copyright holder who places the Program under this License may
+ add an explicit geographical distribution limitation excluding those
+ countries, so that distribution is permitted only in or among countries
+ not thus excluded. In such case, this License incorporates the
+ limitation as if written in the body of this License.
+
+\item [9.] The Free Software Foundation may publish revised and/or new
+ versions of the General Public License from time to time. Such new
+ versions will be similar in spirit to the present version, but may
+ differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the Program
+ specifies a version number of this License which applies to it and
+ ``any later version'', you have the option of following the terms and
+ conditions either of that version or of any later version published by
+ the Free Software Foundation. If the Program does not specify a
+ version number of this License, you may choose any version ever
+ published by the Free Software Foundation.
+
+\item [10.] If you wish to incorporate parts of the Program into other free
+ programs whose distribution conditions are different, write to the
+ author to ask for permission. For software which is copyrighted by the
+ Free Software Foundation, write to the Free Software Foundation; we
+ sometimes make exceptions for this. Our decision will be guided by the
+ two goals of preserving the free status of all derivatives of our free
+ software and of promoting the sharing and reuse of software generally.
+
+\begin{center}
+NO WARRANTY
+\end{center}
+
+\bfseries
+
+\item [11.] Because the Program is licensed free of charge, there is no
+ warranty for the Program, to the extent permitted by applicable law.
+ except when otherwise stated in writing the copyright holders and/or
+ other parties provide the program ``as is'' without warranty of any
+ kind, either expressed or implied, including, but not limited to, the
+ implied warranties of merchantability and fitness for a particular
+ purpose. The entire risk as to the quality and performance of the
+ Program is with you. Should the Program prove defective, you assume
+ the cost of all necessary servicing, repair or correction.
+
+\item [12.] In no event unless required by applicable law or agreed to in
+ writing will any copyright holder, or any other party who may modify
+ and/or redistribute the program as permitted above, be liable to you
+ for damages, including any general, special, incidental or
+ consequential damages arising out of the use or inability to use the
+ program (including but not limited to loss of data or data being
+ rendered inaccurate or losses sustained by you or third parties or a
+ failure of the Program to operate with any other programs), even if
+ such holder or other party has been advised of the possibility of such
+ damages.
+
+\end{enumerate}
+
+\begin{center}
+\textbf{END OF TERMS AND CONDITIONS}
+\end{center}
+
+
+\gplsec{Appendix: How to Apply These Terms to Your New Programs}
+
+If you develop a new program, and you want it to be of the greatest possible
+use to the public, the best way to achieve this is to make it free software
+which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to
+attach them to the start of each source file to most effectively convey the
+exclusion of warranty; and each file should have at least the ``copyright''
+line and a pointer to where the full notice is found.
+
+\begin{verbatim}
+<one line to give the program's name and a brief idea of what it does.>
+Copyright (C) 19yy <name of author>
+
+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.
+
+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.
+
+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.
+\end{verbatim}
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when
+it starts in an interactive mode:
+
+\begin{verbatim}
+Gnomovision version 69, Copyright (C) 19yy name of author
+Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+\end{verbatim}
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may be
+called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a ``copyright disclaimer'' for the program, if
+necessary. Here is a sample; alter the names:
+
+\begin{verbatim}
+Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+`Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+<signature of Ty Coon>, 1 April 1989
+Ty Coon, President of Vice
+\end{verbatim}
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General Public
+License instead of this License.
+
+\gplend
diff --git a/Master/texmf-dist/doc/latex/mdwtools/mathenv.tex b/Master/texmf-dist/doc/latex/mdwtools/mathenv.tex
new file mode 100644
index 00000000000..5c8d80ae1e6
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/mdwtools/mathenv.tex
@@ -0,0 +1,212 @@
+\documentclass{article}
+\usepackage{mdwtab}
+
+\errorcontextlines 999
+
+\showboxbreadth\maxdimen
+\showboxdepth=2
+
+\makeatletter
+
+% --- Switch allocations ---
+
+\newif\if@fleqn
+\newif\if@leqno
+
+% --- Dimen allocations ---
+
+\newdimen\eqa@thiscolwd
+\newdimen\eqa@maxcolwd
+\newdimen\eqa@maxeqwd
+\newdimen\eqa@maxcoleqwd
+
+% --- Main environments ---
+
+\def\equations{%
+ \def\eqa@defnumber{(\theequation)\stepcounter{equation}}%
+ \let\eqa@defmarker\eqa@fullmarker%
+ \eqa@equations%
+}
+
+\def\endequations{%
+ \\%
+ \noalign{\global\dimen@i\prevdepth}%
+ \multispan\tab@columns\hfill\vrule\@depth\dimen@i\cr%
+ \egroup%
+ \eqa@offsetcalc%
+ \egroup%
+ \eqa@restore%
+ {\scrollmode\showbox\z@}%
+}
+
+\def\eqa@equations#1{%
+%
+% Set up restoring of things.
+%
+ \toks@\expandafter{\eqa@number}%
+ \toks\tw@\expandafter{\eqa@marker}%
+ \edef\eqa@restore{%
+ \gdef\noexpand\eqa@number{\the\toks@}%
+ \gdef\noexpand\eqa@marker{\the\toks\tw@}%
+ \eqa@maxcolwd\the\eqa@maxcolwd%
+ \eqa@maxcoleqwd\the\eqa@maxcoleqwd%
+ \eqa@maxeqwd\the\eqa@maxeqwd%
+ }%
+%
+% Initialise numbering things.
+%
+ \global\let\eqa@number\eqa@defnumber%
+ \global\let\eqa@marker\eqa@defmarker%
+ \let\eqa@markpen\@ne%
+%
+% Parse the preamble string. Put measuring things in the right places.
+%
+ \tab@initread%
+ \def\tab@tabtext{&\tabskip\z@skip}%
+ \if@leqno%
+ \tab@append\tab@preamble{\let\eqa@measure\eqa@domeasure}%
+ \fi%
+ \def\eqa@seteqcol##1{%
+ \def\eqa@eqcol{##1}
+ \if@leqno\let\eqa@seteqcol\relax\fi%
+ }%
+ \colset{equations}%
+ \tab@doreadpream{#1}%
+ \if@leqno\else%
+ \tab@prepend\tab@pretext{\let\eqa@measure\eqa@domeasure}%
+ \fi%
+ \tab@readpreamble{}%
+%
+% Setting the newline command and some other initialisation.
+%
+ \let\\\eqa@cr%
+ \global\eqa@maxcolwd\z@%
+ \global\eqa@maxcoleqwd\z@%
+ \global\eqa@maxeqwd\z@%
+%
+% Start the box. Hacking to make \prevdepth work properly.
+%
+ \setbox\z@\vbox\expandafter\bgroup%
+ \expandafter\prevdepth\the\prevdepth%
+ \relax%
+%
+% And now the alignment.
+%
+ \tabskip\z@skip%
+ \halign\expandafter\bgroup\the\tab@preamble\cr%
+}
+
+% --- Column building things ---
+
+\def\eqa@aligncol#1#2#3{%
+ \eqa@seteqcol{#1}%
+ \ifx l#1\eqa@aligncol@i{#2#3}{#2\hfil}\else%
+ \ifx c#1\eqa@aligncol@i{\hfil#2#3}{#3#2\hfil}\else%
+ \ifx r#1\eqa@aligncol@i{\hfil#2}{#3#2}%
+ \fi\fi\fi%
+}
+\def\eqa@aligncol@i#1#2{%
+ \tabcoltype%
+ {\setbox\z@\hbox\bgroup#1}%
+ {#2\egroup\eqa@measure}%
+}
+
+\colpush{equations}
+
+\coldef l{\eqa@aligncol l${{}}}
+\coldef c{\eqa@aligncol c${{}}}
+\coldef r{\eqa@aligncol r${{}}}
+
+\coldef M#1{\eqa@aligncol{#1}${{}}}
+\coldef T#1{\eqa@aligncol{#1}{}{}}
+
+\colpop
+
+% --- Equation measuring macros ---
+
+\let\eqa@number\relax
+\let\eqa@marker\relax
+
+\def\eqnumber#1{%
+ \global\let\eqa@marker\eqa@fullmarker%
+ \gdef\eqa@number{#1}%
+}
+
+\def\nonumber{%
+ \global\let\eqa@marker\eqa@nonummarker%
+ \global\let\eqa@number\@empty%
+}
+
+\def\eqa@measure{\unhbox\z@}
+\def\eqa@domeasure{%
+ \global\eqa@thiscolwd\wd\z@%
+ \ifdim\eqa@maxcolwd<\eqa@thiscolwd%
+ \global\eqa@maxcolwd\eqa@thiscolwd%
+ \fi%
+ \unhbox\z@%
+}
+
+% --- The newline command ---
+
+\def\eqa@cr{\tab@cr\eqa@cr@i\z@\@M}
+\def\eqa@cr@i#1#2{%
+ \cr%
+ \noalign{%
+ \eqa@marker{#1}{#2}%
+ \global\let\eqa@number\eqa@defnumber%
+ \global\let\eqa@marker\eqa@defmarker%
+ \penalty\eqa@markpen%
+ }%
+}
+
+\def\eqa@fullmarker#1#2{%
+ \dimen@\prevdepth%
+ \vskip\eqa@thiscolwd%
+ \penalty#2%
+ \skip@#1\advance\skip@\jot%
+ \vskip\skip@%
+ \setbox\z@\hbox{\eqa@number}%
+ \dimen@\eqa@thiscolwd\advance\dimen@\wd\z@%
+ \ifdim\dimen@\eqa@maxcoleqwd<\dimen@%
+ \global\eqa@maxcoleqwd\dimen@%
+ \global\eqa@maxeqwd\wd\z@%
+ \fi%
+ \nointerlineskip\hb@xt@\z@{\hbox{\eqa@number}}%
+ \prevdepth\dimen@%
+}
+
+\def\eqa@nonummarker#1#2{%
+ \penalty#2%
+ \skip@#1\advance\skip@\jot%
+ \vskip\skip@%
+ \penalty\eqa@markpen%
+}
+
+% --- Offset calculation ---
+%
+% This stuff is sort of like the standard offset calculation, only it's
+% different.
+
+\def\eqa@offsetcalc{%
+ \setbox\z@\lastbox%
+ \unskip%
+ \csname eqa@calc:\eqa@eqcol\expandafter\noexpand\if@leqno\endcsname%
+}
+
+\@namedef{eqa@calc:l\noexpand\iffalse}{%
+
+
+% --- Test document ---
+
+\makeatother
+
+\begin{document}
+
+\setcounter{equation}{23}
+
+\begin{equations}{rrl}
+ x &= y^2 +& z^2 \\
+x-y &= 3y^2 -& 2z^2
+\end{equations}
+
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/mdwtools/mdwtools.tex b/Master/texmf-dist/doc/latex/mdwtools/mdwtools.tex
new file mode 100644
index 00000000000..63abfc4acf4
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/mdwtools/mdwtools.tex
@@ -0,0 +1,1212 @@
+% \begin{meta-comment}
+%
+% $Id: mdwtools.tex,v 1.4 1996/11/19 20:55:55 mdw Exp $
+%
+% Common declarations for mdwtools.dtx files
+%
+% (c) 1996 Mark Wooding
+%
+%----- Revision history -----------------------------------------------------
+%
+% $Log: mdwtools.tex,v $
+% Revision 1.4 1996/11/19 20:55:55 mdw
+% Entered into RCS
+%
+%
+% \end{meta-comment}
+%
+% \begin{meta-comment} <general public licence>
+%%
+%% mdwtools common declarations
+%% Copyright (c) 1996 Mark Wooding
+%%
+%% 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.
+%%
+%% 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.
+%%
+%% 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.
+%%
+% \end{meta-comment}
+%
+% \begin{meta-comment} <file preamble>
+%<*mdwtools>
+\ProvidesFile{mdwtools.tex}
+ [1996/05/10 1.4 Shared definitions for mdwtools .dtx files]
+%</mdwtools>
+% \end{meta-comment}
+%
+% \CheckSum{668}
+%% \CharacterTable
+%% {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
+%% 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
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%%
+%
+% \section{Introduction and user guide}
+%
+% This file is really rather strange; it gets |\input| by other package
+% documentation files to set up most of the environmental gubbins for them.
+% It handles almost everything, like loading a document class, finding any
+% packages, and building and formatting the title.
+%
+% It also offers an opportunity for users to customise my nice documentation,
+% by using a |mdwtools.cfg| file (not included).
+%
+%
+% \subsection{Declarations}
+%
+% A typical documentation file contains something like
+% \begin{listinglist} \listingsize \obeylines
+% |\input{mdwtools}|
+% \<declarations>
+% |\mdwdoc|
+% \end{listinglist}
+% The initial |\input| reads in this file and sets up the various commands
+% which may be needed. The final |\mdwdoc| actually starts the document,
+% inserting a title (which is automatically generated), a table of
+% contents etc., and reads the documentation file in (using the |\DocInput|
+% command from the \package{doc} package.
+%
+% \subsubsection{Describing packages}
+%
+% \DescribeMacro{\describespackage}
+% \DescribeMacro{\describesclass}
+% \DescribeMacro{\describesfile}
+% \DescribeMacro{\describesfile*}
+% The most important declarations are those which declare what the
+% documentation describes. Saying \syntax{"\\describespackage{<package>}"}
+% loads the \<package> (if necessary) and adds it to the auto-generated
+% title, along with a footnote containing version information. Similarly,
+% |\describesclass| adds a document class name to the title (without loading
+% it -- the document itself must do this, with the |\documentclass| command).
+% For files which aren't packages or classes, use the |\describesfile| or
+% |\describesfile*| command (the $*$-version won't |\input| the file, which
+% is handy for files like |mdwtools.tex|, which are already input).
+%
+% \DescribeMacro{\author}
+% \DescribeMacro{\date}
+% \DescribeMacro{\title}
+% The |\author|, |\date| and |\title| declarations work slightly differently
+% to normal -- they ensure that only the \emph{first} declaration has an
+% effect. (Don't you play with |\author|, please, unless you're using this
+% program to document your own packages.) Using |\title| suppresses the
+% automatic title generation.
+%
+% \DescribeMacro{\docdate}
+% The default date is worked out from the version string of the package or
+% document class whose name is the same as that of the documentation file.
+% You can choose a different `main' file by saying
+% \syntax{"\\docdate{"<file>"}"}.
+%
+% \subsubsection{Contents handling}
+%
+% \DescribeMacro{\addcontents}
+% A documentation file always has a table of contents. Other
+% contents-like lists can be added by saying
+% \syntax{"\\addcontents{"<extension>"}{"<command>"}"}. The \<extension>
+% is the file extension of the contents file (e.g., \lit{lot} for the
+% list of tables); the \<command> is the command to actually typeset the
+% contents file (e.g., |\listoftables|).
+%
+% \subsubsection{Other declarations}
+%
+% \DescribeMacro{\implementation}
+% The \package{doc} package wants you to say
+% \syntax{"\\StopEventually{"<stuff>"}"}' before describing the package
+% implementation. Using |mdwtools.tex|, you just say |\implementation|, and
+% everything works. It will automatically read in the licence text (from
+% |gpl.tex|, and wraps some other things up.
+%
+%
+% \subsection{Other commands}
+%
+% The |mdwtools.tex| file includes the \package{syntax} and \package{sverb}
+% packages so that they can be used in documentation files. It also defines
+% some trivial commands of its own.
+%
+% \DescribeMacro{\<}
+% Saying \syntax{"\\<"<text>">" is the same as "\\synt{"<text>"}"}; this
+% is a simple abbreviation.
+%
+% \DescribeMacro{\smallf}
+% Saying \syntax{"\\smallf" <number>"/"<number>} typesets a little fraction,
+% like this: \smallf 3/4. It's useful when you want to say that the default
+% value of a length is 2 \smallf 1/2\,pt, or something like that.
+%
+%
+% \subsection{Customisation}
+%
+% You can customise the way that the package documentation looks by writing
+% a file called |mdwtools.cfg|. You can redefine various commands (before
+% they're defined here, even; |mdwtools.tex| checks most of the commands that
+% it defines to make sure they haven't been defined already.
+%
+% \DescribeMacro{\indexing}
+% If you don't want the prompt about whether to generate index files, you
+% can define the |\indexing| command to either \lit{y} or \lit{n}. I'd
+% recommend that you use |\providecommand| for this, to allow further
+% customisation from the command line.
+%
+% \DescribeMacro{\mdwdateformat}
+% If you don't like my date format (maybe you're American or something),
+% you can redefine the |\mdwdateformat| command. It takes three arguments:
+% the year, month and date, as numbers; it should expand to something which
+% typesets the date nicely. The default format gives something like
+% `10 May 1996'. You can produce something rather more exotic, like
+% `10\textsuperscript{th} May \textsc{\romannumeral 1996}' by saying
+%\begin{listing}
+%\newcommand{\mdwdateformat}[3]{%
+% \number#3\textsuperscript{\numsuffix{#3}}\ %
+% \monthname{#2}\ %
+% \textsc{\romannumeral #1}%
+%}
+%\end{listing}
+% \DescribeMacro{\monthname}
+% \DescribeMacro{\numsuffix}
+% Saying \syntax{"\\monthname{"<number>"}"} expands to the name of the
+% numbered month (which can be useful when doing date formats). Saying
+% \syntax{"\\numsuffix{"<number>"}"} will expand to the appropriate suffix
+% (`th' or `rd' or whatever) for the \<number>. You'll have to superscript
+% it yourself, if this is what you want to do. Putting the year number
+% in roman numerals is just pretentious |;-)|.
+%
+% \DescribeMacro{\mdwhook}
+% After all the declarations in |mdwtools.tex|, the command |\mdwhook| is
+% executed, if it exists. This can be set up by the configuration file
+% to do whatever you want.
+%
+% There are lots of other things you can play with; you should look at the
+% implementation section to see what's possible.
+%
+% \implementation
+%
+% \section{Implementation}
+%
+% \begin{macrocode}
+%<*mdwtools>
+% \end{macrocode}
+%
+% The first thing is that I'm not a \LaTeX\ package or anything official
+% like that, so I must enable `|@|' as a letter by hand.
+%
+% \begin{macrocode}
+\makeatletter
+% \end{macrocode}
+%
+% Now input the user's configuration file, if it exists. This is fairly
+% simple stuff.
+%
+% \begin{macrocode}
+\@input{mdwtools.cfg}
+% \end{macrocode}
+%
+% Well, that's the easy bit done.
+%
+%
+% \subsection{Initialisation}
+%
+% Obviously the first thing to do is to obtain a document class. Obviously,
+% it would be silly to do this if a document class has already been loaded,
+% either by the package documentation or by the configuration file.
+%
+% The only way I can think of for finding out if a document class is already
+% loaded is by seeing if the |\documentclass| command has been redefined
+% to raise an error. This isn't too hard, really.
+%
+% \begin{macrocode}
+\ifx\documentclass\@twoclasseserror\else
+ \documentclass[a4paper]{ltxdoc}
+ \ifx\doneclasses\mdw@undefined\else\doneclasses\fi
+\fi
+% \end{macrocode}
+%
+% As part of my standard environment, I'll load some of my more useful
+% packages. If they're already loaded (possibly with different options),
+% I'll not try to load them again.
+%
+% \begin{macrocode}
+\@ifpackageloaded{doc}{}{\usepackage{doc}}
+\@ifpackageloaded{syntax}{}{\usepackage[rounded]{syntax}}
+\@ifpackageloaded{sverb}{}{\usepackage{sverb}}
+% \end{macrocode}
+%
+%
+% \subsection{Some macros for interaction}
+%
+% I like the \LaTeX\ star-boxes, although it's a pain having to cope with
+% \TeX's space-handling rules. I'll define a new typing-out macro which
+% makes spaces more significant, and has a $*$-version which doesn't put
+% a newline on the end, and interacts prettily with |\read|.
+%
+% First of all, I need to make spaces active, so I can define things about
+% active spaces.
+%
+% \begin{macrocode}
+\begingroup\obeyspaces
+% \end{macrocode}
+%
+% Now to define the main macro. This is easy stuff. Spaces must be
+% carefully rationed here, though.
+%
+% I'll start a group, make spaces active, and make spaces expand to ordinary
+% space-like spaces. Then I'll look for a star, and pass either |\message|
+% (which doesn't start a newline, and interacts with |\read| well) or
+% |\immediate\write 16| which does a normal write well.
+%
+% \begin{macrocode}
+\gdef\mdwtype{%
+\begingroup\catcode`\ \active\let \space%
+\@ifstar{\mdwtype@i{\message}}{\mdwtype@i{\immediate\write\sixt@@n}}%
+}
+\endgroup
+% \end{macrocode}
+%
+% Now for the easy bit. I have the thing to do, and the thing to do it to,
+% so do that and end the group.
+%
+% \begin{macrocode}
+\def\mdwtype@i#1#2{#1{#2}\endgroup}
+% \end{macrocode}
+%
+%
+% \subsection{Decide on indexing}
+%
+% A configuration file can decide on indexing by defining the |\indexing|
+% macro to either \lit{y} or \lit{n}. If it's not set, then I'll prompt
+% the user.
+%
+% First of all, I want a switch to say whether I'm indexing.
+%
+% \begin{macrocode}
+\newif\ifcreateindex
+% \end{macrocode}
+%
+% Right: now I need to decide how to make progress. If the macro's not set,
+% then I want to set it, and start a row of stars.
+%
+% \begin{macrocode}
+\ifx\indexing\@@undefined
+ \mdwtype{*****************************}
+ \def\indexing{?}
+\fi
+% \end{macrocode}
+%
+% Now enter a loop, asking the user whether to do indexing, until I get
+% a sensible answer.
+%
+% \begin{macrocode}
+\loop
+ \@tempswafalse
+ \if y\indexing\@tempswatrue\createindextrue\fi
+ \if Y\indexing\@tempswatrue\createindextrue\fi
+ \if n\indexing\@tempswatrue\createindexfalse\fi
+ \if N\indexing\@tempswatrue\createindexfalse\fi
+ \if@tempswa\else
+ \mdwtype*{* Create index files? (y/n) *}
+ \read\sixt@@n to\indexing%
+\repeat
+% \end{macrocode}
+%
+% Now, based on the results of that, display a message about the indexing.
+%
+% \begin{macrocode}
+\mdwtype{*****************************}
+\ifcreateindex
+ \mdwtype{* Creating index files *}
+ \mdwtype{* This may take some time *}
+\else
+ \mdwtype{* Not creating index files *}
+\fi
+\mdwtype{*****************************}
+% \end{macrocode}
+%
+% Now I can play with the indexing commands of the \package{doc} package
+% to do whatever it is that the user wants.
+%
+% \begin{macrocode}
+\ifcreateindex
+ \CodelineIndex
+ \EnableCrossrefs
+\else
+ \CodelineNumbered
+ \DisableCrossrefs
+\fi
+% \end{macrocode}
+%
+% And register lots of plain \TeX\ things which shouldn't be indexed.
+% This contains lots of |\if|\dots\ things which don't fit nicely in
+% conditionals, which is a shame. Still, it doesn't matter that much,
+% really.
+%
+% \begin{macrocode}
+\DoNotIndex{\def,\long,\edef,\xdef,\gdef,\let,\global}
+\DoNotIndex{\if,\ifnum,\ifdim,\ifcat,\ifmmode,\ifvmode,\ifhmode,%
+ \iftrue,\iffalse,\ifvoid,\ifx,\ifeof,\ifcase,\else,\or,\fi}
+\DoNotIndex{\box,\copy,\setbox,\unvbox,\unhbox,\hbox,%
+ \vbox,\vtop,\vcenter}
+\DoNotIndex{\@empty,\immediate,\write}
+\DoNotIndex{\egroup,\bgroup,\expandafter,\begingroup,\endgroup}
+\DoNotIndex{\divide,\advance,\multiply,\count,\dimen}
+\DoNotIndex{\relax,\space,\string}
+\DoNotIndex{\csname,\endcsname,\@spaces,\openin,\openout,%
+ \closein,\closeout}
+\DoNotIndex{\catcode,\endinput}
+\DoNotIndex{\jobname,\message,\read,\the,\m@ne,\noexpand}
+\DoNotIndex{\hsize,\vsize,\hskip,\vskip,\kern,\hfil,\hfill,\hss}
+\DoNotIndex{\m@ne,\z@,\z@skip,\@ne,\tw@,\p@}
+\DoNotIndex{\dp,\wd,\ht,\vss,\unskip}
+% \end{macrocode}
+%
+% Last bit of indexing stuff, for now: I'll typeset the index in two columns
+% (the default is three, which makes them too narrow for my tastes).
+%
+% \begin{macrocode}
+\setcounter{IndexColumns}{2}
+% \end{macrocode}
+%
+%
+% \subsection{Selectively defining things}
+%
+% I don't want to tread on anyone's toes if they redefine any of these
+% commands and things in a configuration file. The following definitions
+% are fairly evil, but should do the job OK.
+%
+% \begin{macro}{\@gobbledef}
+%
+% This macro eats the following |\def|inition, leaving not a trace behind.
+%
+% \begin{macrocode}
+\def\@gobbledef#1#{\@gobble}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\tdef}
+% \begin{macro}{\tlet}
+%
+% The |\tdef| command is a sort of `tentative' definition -- it's like
+% |\def| if the control sequence named doesn't already have a definition.
+% |\tlet| does the same thing with |\let|.
+%
+% \begin{macrocode}
+\def\tdef#1{
+ \ifx#1\@@undefined%
+ \expandafter\def\expandafter#1%
+ \else%
+ \expandafter\@gobbledef%
+ \fi%
+}
+\def\tlet#1#2{\ifx#1\@@undefined\let#1=#2\fi}
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsection{General markup things}
+%
+% Now for some really simple things. I'll define how to typeset package
+% names and environment names (both in the sans serif font, for now).
+%
+% \begin{macrocode}
+\tlet\package\textsf
+\tlet\env\textsf
+% \end{macrocode}
+%
+% I'll define the |\<|\dots|>| shortcut for syntax items suggested in the
+% \package{syntax} package.
+%
+% \begin{macrocode}
+\tdef\<#1>{\synt{#1}}
+% \end{macrocode}
+%
+% And because it's used in a few places (mainly for typesetting lengths),
+% here's a command for typesetting fractions in text.
+%
+% \begin{macrocode}
+\tdef\smallf#1/#2{\ensuremath{^{#1}\!/\!_{#2}}}
+% \end{macrocode}
+%
+%
+% \subsection{A table environment}
+%
+% \begin{environment}{tab}
+%
+% Most of the packages don't use the (obviously perfect) \package{mdwtab}
+% package, because it's big, and takes a while to load. Here's an
+% environment for typesetting centred tables. The first (optional) argument
+% is some declarations to perform. The mandatory argument is the table
+% preamble (obviously).
+%
+% \begin{macrocode}
+\@ifundefined{tab}{%
+ \newenvironment{tab}[2][\relax]{%
+ \par\vskip2ex%
+ \centering%
+ #1%
+ \begin{tabular}{#2}%
+ }{%
+ \end{tabular}%
+ \par\vskip2ex%
+ }
+}{}
+% \end{macrocode}
+%
+% \end{environment}
+%
+%
+% \subsection{Commenting out of stuff}
+%
+% \begin{environment}{meta-comment}
+%
+% Using |\iffalse|\dots|\fi| isn't much fun. I'll define a gobbling
+% environment using the \package{sverb} stuff.
+%
+% \begin{macrocode}
+\ignoreenv{meta-comment}
+% \end{macrocode}
+%
+% \end{environment}
+%
+%
+% \subsection{Float handling}
+%
+% This gubbins will try to avoid float pages as much as possible, and (with
+% any luck) encourage floats to be put on the same pages as text.
+%
+% \begin{macrocode}
+\def\textfraction{0.1}
+\def\topfraction{0.9}
+\def\bottomfraction{0.9}
+\def\floatpagefraction{0.7}
+% \end{macrocode}
+%
+% Now redefine the default float-placement parameters to allow `here' floats.
+%
+% \begin{macrocode}
+\def\fps@figure{htbp}
+\def\fps@table{htbp}
+% \end{macrocode}
+%
+%
+% \subsection{Other bits of parameter tweaking}
+%
+% Make \env{grammar} environments look pretty, by indenting the left hand
+% sides by a large amount.
+%
+% \begin{macrocode}
+\grammarindent1in
+% \end{macrocode}
+%
+% I don't like being told by \TeX\ that my paragraphs are hard to linebreak:
+% I know this already. This lot should shut \TeX\ up about most problems.
+%
+% \begin{macrocode}
+\sloppy
+\hbadness\@M
+\hfuzz10\p@
+% \end{macrocode}
+%
+% Also make \TeX\ shut up in the index. The \package{multicol} package
+% irritatingly plays with |\hbadness|. This is the best hook I could find
+% for playing with this setting.
+%
+% \begin{macrocode}
+\expandafter\def\expandafter\IndexParms\expandafter{%
+ \IndexParms%
+ \hbadness\@M%
+}
+% \end{macrocode}
+%
+% The other thing I really don't like is `Marginpar moved' warnings. This
+% will get rid of them, and lots of other \LaTeX\ warnings at the same time.
+%
+% \begin{macrocode}
+\let\@latex@warning@no@line\@gobble
+% \end{macrocode}
+%
+% Put some extra space between table rows, please.
+%
+% \begin{macrocode}
+\def\arraystretch{1.2}
+% \end{macrocode}
+%
+% Most of the code is at guard level one, so typeset that in upright text.
+%
+% \begin{macrocode}
+\setcounter{StandardModuleDepth}{1}
+% \end{macrocode}
+%
+%
+% \subsection{Contents handling}
+%
+% I use at least one contents file (the main table of contents) although
+% I may want more. I'll keep a list of contents files which I need to
+% handle.
+%
+% There are two things I need to do to contents files here:
+% \begin{itemize}
+% \item I must typeset the table of contents at the beginning of the
+% document; and
+% \item I want to typeset tables of contents in two columns (using the
+% \package{multicol} package).
+% \end{itemize}
+%
+% The list consists of items of the form
+% \syntax{"\\do{"<extension>"}{"<command>"}"}, where \<extension> is the
+% file extension of the contents file, and \<command> is the command to
+% typeset it.
+%
+% \begin{macro}{\docontents}
+%
+% This is where I keep the list of contents files. I'll initialise it to
+% just do the standard contents table.
+%
+% \begin{macrocode}
+\def\docontents{\do{toc}{\tableofcontents}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\addcontents}
+%
+% By saying \syntax{"\\addcontents{"<extension>"}{"<command>"}"}, a document
+% can register a new table of contents which gets given the two-column
+% treatment properly. This is really easy to implement.
+%
+% \begin{macrocode}
+\def\addcontents#1#2{%
+ \toks@\expandafter{\docontents\do{#1}{#2}}%
+ \edef\docontents{\the\toks@}%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \subsection{Finishing it all off}
+%
+% \begin{macro}{\finalstuff}
+%
+% The |\finalstuff| macro is a hook for doing things at the end of the
+% document. Currently, it inputs the licence agreement as an appendix.
+%
+% \begin{macrocode}
+\tdef\finalstuff{\appendix\part*{Appendix}\input{gpl}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\implementation}
+%
+% The |\implementation| macro starts typesetting the implementation of
+% the package(s). If we're not doing the implementation, it just does
+% this lot and ends the input file.
+%
+% I define a macro with arguments inside the |\StopEventually|, which causes
+% problems, since the code gets put through an extra level of |\def|fing
+% depending on whether the implementation stuff gets typeset or not. I'll
+% store the code I want to do in a separate macro.
+%
+% \begin{macrocode}
+\def\implementation{\StopEventually{\attheend}}
+% \end{macrocode}
+%
+% Now for the actual activity. First, I'll do the |\finalstuff|. Then, if
+% \package{doc}'s managed to find the \package{multicol} package, I'll add
+% the end of the environment to the end of each contents file in the list.
+% Finally, I'll read the index in from its formatted |.ind| file.
+%
+% \begin{macrocode}
+\tdef\attheend{%
+ \finalstuff%
+ \ifhave@multicol%
+ \def\do##1##2{\addtocontents{##1}{\protect\end{multicols}}}%
+ \docontents%
+ \fi%
+ \PrintIndex%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \subsection{File version information}
+%
+% \begin{macro}{\mdwpkginfo}
+%
+% For setting up the automatic titles, I'll need to be able to work out
+% file versions and things. This macro will, given a file name, extract
+% from \LaTeX\ the version information and format it into a sensible string.
+%
+% First of all, I'll put the original string (direct from the
+% |\Provides|\dots\ command). Then I'll pass it to another macro which can
+% parse up the string into its various bits, along with the original
+% filename.
+%
+% \begin{macrocode}
+\def\mdwpkginfo#1{%
+ \edef\@tempa{\csname ver@#1\endcsname}%
+ \expandafter\mdwpkginfo@i\@tempa\@@#1\@@%
+}
+% \end{macrocode}
+%
+% Now for the real business. I'll store the string I build in macros called
+% \syntax{"\\"<filename>"date", "\\"<filename>"version" and
+% "\\"<filename>"info"}, which store the file's date, version and
+% `information string' respectively. (Note that the file extension isn't
+% included in the name.)
+%
+% This is mainly just tedious playing with |\expandafter|. The date format
+% is defined by a separate macro, which can be modified from the
+% configuration file.
+%
+% \begin{macrocode}
+\def\mdwpkginfo@i#1/#2/#3 #4 #5\@@#6.#7\@@{%
+ \expandafter\def\csname #6date\endcsname%
+ {\protect\mdwdateformat{#1}{#2}{#3}}%
+ \expandafter\def\csname #6version\endcsname{#4}%
+ \expandafter\def\csname #6info\endcsname{#5}%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\mdwdateformat}
+%
+% Given three arguments, a year, a month and a date (all numeric), build a
+% pretty date string. This is fairly simple really.
+%
+% \begin{macrocode}
+\tdef\mdwdateformat#1#2#3{\number#3\ \monthname{#2}\ \number#1}
+\def\monthname#1{%
+ \ifcase#1\or%
+ January\or February\or March\or April\or May\or June\or%
+ July\or August\or September\or October\or November\or December%
+ \fi%
+}
+\def\numsuffix#1{%
+ \ifnum#1=1 st\else%
+ \ifnum#1=2 nd\else%
+ \ifnum#1=3 rd\else%
+ \ifnum#1=21 st\else%
+ \ifnum#1=22 nd\else%
+ \ifnum#1=23 rd\else%
+ \ifnum#1=31 st\else%
+ th%
+ \fi\fi\fi\fi\fi\fi\fi%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\mdwfileinfo}
+%
+% Saying \syntax{"\\mdwfileinfo{"<file-name>"}{"<info>"}"} extracts the
+% wanted item of \<info> from the version information for file \<file-name>.
+%
+% \begin{macrocode}
+\def\mdwfileinfo#1#2{\mdwfileinfo@i{#2}#1.\@@}
+\def\mdwfileinfo@i#1#2.#3\@@{\csname#2#1\endcsname}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \subsection{List handling}
+%
+% There are several other lists I need to build. These macros will do
+% the necessary stuff.
+%
+% \begin{macro}{\mdw@ifitem}
+%
+% The macro \syntax{"\\mdw@ifitem"<item>"\\in"<list>"{"<true-text>"}"^^A
+% "{"<false-text>"}"} does \<true-text> if the \<item> matches any item in
+% the \<list>; otherwise it does \<false-text>.
+%
+% \begin{macrocode}
+\def\mdw@ifitem#1\in#2{%
+ \@tempswafalse%
+ \def\@tempa{#1}%
+ \def\do##1{\def\@tempb{##1}\ifx\@tempa\@tempb\@tempswatrue\fi}%
+ #2%
+ \if@tempswa\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\mdw@append}
+%
+% Saying \syntax{"\\mdw@append"<item>"\\to"<list>} adds the given \<item>
+% to the end of the given \<list>.
+%
+% \begin{macrocode}
+\def\mdw@append#1\to#2{%
+ \toks@{\do{#1}}%
+ \toks\tw@\expandafter{#2}%
+ \edef#2{\the\toks\tw@\the\toks@}%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\mdw@prepend}
+%
+% Saying \syntax{"\\mdw@prepend"<item>"\\to"<list>} adds the \<item> to the
+% beginning of the \<list>.
+%
+% \begin{macrocode}
+\def\mdw@prepend#1\to#2{%
+ \toks@{\do{#1}}%
+ \toks\tw@\expandafter{#2}%
+ \edef#2{\the\toks@\the\toks\tw@}%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\mdw@add}
+%
+% Finally, saying \syntax{"\\mdw@add"<item>"\\to"<list>} adds the \<item>
+% to the list only if it isn't there already.
+%
+% \begin{macrocode}
+\def\mdw@add#1\to#2{\mdw@ifitem#1\in#2{}{\mdw@append#1\to#2}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \subsection{Described file handling}
+%
+% I'l maintain lists of packages, document classes, and other files
+% described by the current documentation file.
+%
+% First of all, I'll declare the various list macros.
+%
+% \begin{macrocode}
+\def\dopackages{}
+\def\doclasses{}
+\def\dootherfiles{}
+% \end{macrocode}
+%
+% \begin{macro}{\describespackage}
+%
+% A document file can declare that it describes a package by saying
+% \syntax{"\\describespackage{"<package-name>"}"}. I add the package to
+% my list, read the package into memory (so that the documentation can
+% offer demonstrations of it) and read the version information.
+%
+% \begin{macrocode}
+\def\describespackage#1{%
+ \mdw@ifitem#1\in\dopackages{}{%
+ \mdw@append#1\to\dopackages%
+ \usepackage{#1}%
+ \mdwpkginfo{#1.sty}%
+ }%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\describesclass}
+%
+% By saying \syntax{"\\describesclass{"<class-name>"}"}, a document file
+% can declare that it describes a document class. I'll assume that the
+% document class is already loaded, because it's much too late to load
+% it now.
+%
+% \begin{macrocode}
+\def\describesclass#1{\mdw@add#1\to\doclasses\mdwpkginfo{#1.cls}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\describesfile}
+%
+% Finally, other `random' files, which don't have the status of real \LaTeX\
+% packages or document classes, can be described by saying \syntax{^^A
+% "\\describesfile{"<file-name>"}" or "\\describesfile*{"<file-name>"}"}.
+% The difference is that the starred version will not |\input| the file.
+%
+% \begin{macrocode}
+\def\describesfile{%
+ \@ifstar{\describesfile@i\@gobble}{\describesfile@i\input}%
+}
+\def\describesfile@i#1#2{%
+ \mdw@ifitem#2\in\dootherfiles{}{%
+ \mdw@add#2\to\dootherfiles%
+ #1{#2}%
+ \mdwpkginfo{#2}%
+ }%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \subsection{Author and title handling}
+%
+% I'll redefine the |\author| and |\title| commands so that I get told
+% whether I need to do it myself.
+%
+% \begin{macro}{\author}
+%
+% This is easy: I'll save the old meaning, and then redefine |\author| to
+% do the old thing and redefine itself to then do nothing.
+%
+% \begin{macrocode}
+\let\mdw@author\author
+\def\author{\let\author\@gobble\mdw@author}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\title}
+%
+% And oddly enough, I'll do exactly the same thing for the title, except
+% that I'll also disable the |\mdw@buildtitle| command, which constructs
+% the title automatically.
+%
+% \begin{macrocode}
+\let\mdw@title\title
+\def\title{\let\title\@gobble\let\mdw@buildtitle\relax\mdw@title}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\date}
+%
+% This works in a very similar sort of way.
+%
+% \begin{macrocode}
+\def\date#1{\let\date\@gobble\def\today{#1}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\datefrom}
+%
+% Saying \syntax{"\\datefrom{"<file-name>"}"} sets the document date from
+% the given filename.
+%
+% \begin{macrocode}
+\def\datefrom#1{%
+ \protected@edef\@tempa{\noexpand\date{\csname #1date\endcsname}}%
+ \@tempa%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\docfile}
+%
+% Saying \syntax{"\\docfile{"<file-name>"}"} sets up the file name from which
+% documentation will be read.
+%
+% \begin{macrocode}
+\def\docfile#1{%
+ \def\@tempa##1.##2\@@{\def\@basefile{##1.##2}\def\@basename{##1}}%
+ \edef\@tempb{\noexpand\@tempa#1\noexpand\@@}%
+ \@tempb%
+}
+% \end{macrocode}
+%
+% I'll set up a default value as well.
+%
+% \begin{macrocode}
+\docfile{\jobname.dtx}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \subsection{Building title strings}
+%
+% This is rather tricky. For each list, I need to build a legible looking
+% string.
+%
+% \begin{macro}{\mdw@addtotitle}
+%
+% By saying
+%\syntax{"\\mdw@addtotitle{"<list>"}{"<command>"}{"<singular>"}{"<plural>"}"}
+% I can add the contents of a list to the current title string in the
+% |\mdw@title| macro.
+%
+% \begin{macrocode}
+\tdef\mdw@addtotitle#1#2#3#4{%
+% \end{macrocode}
+%
+% Now to get to work. I need to keep one `lookahead' list item, and a count
+% of the number of items read so far. I'll keep the lookahead item in
+% |\@nextitem| and the counter in |\count@|.
+%
+% \begin{macrocode}
+ \count@\z@%
+% \end{macrocode}
+%
+% Now I'll define what to do for each list item. The |\protect| command is
+% already set up appropriately for playing with |\edef| commands.
+%
+% \begin{macrocode}
+ \def\do##1{%
+% \end{macrocode}
+%
+% The first job is to add the previous item to the title string. If this
+% is the first item, though, I'll just add the appropriate \lit{The } or
+% \lit{ and the } string to the title (this is stored in the |\@prefix|
+% macro).
+%
+% \begin{macrocode}
+ \edef\mdw@title{%
+ \mdw@title%
+ \ifcase\count@\@prefix%
+ \or\@nextitem%
+ \else, \@nextitem%
+ \fi%
+ }%
+% \end{macrocode}
+%
+% That was rather easy. Now I'll set up the |\@nextitem| macro for the
+% next time around the loop.
+%
+% \begin{macrocode}
+ \edef\@nextitem{%
+ \protect#2{##1}%
+ \protect\footnote{%
+ The \protect#2{##1} #3 is currently at version %
+ \mdwfileinfo{##1}{version}, dated \mdwfileinfo{##1}{date}.%
+ }\space%
+ }%
+% \end{macrocode}
+%
+% Finally, I need to increment the counter.
+%
+% \begin{macrocode}
+ \advance\count@\@ne%
+ }%
+% \end{macrocode}
+%
+% Now execute the list.
+%
+% \begin{macrocode}
+ #1%
+% \end{macrocode}
+%
+% I still have one item left over, unless the list was empty. I'll add
+% that now.
+%
+% \begin{macrocode}
+ \edef\mdw@title{%
+ \mdw@title%
+ \ifcase\count@%
+ \or\@nextitem\space#3%
+ \or\ and \@nextitem\space#4%
+ \fi%
+ }%
+% \end{macrocode}
+%
+% Finally, if $|\count@| \ne 0$, I must set |\@prefix| to \lit{ and the }.
+%
+% \begin{macrocode}
+ \ifnum\count@>\z@\def\@prefix{ and the }\fi%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\mdw@buildtitle}
+%
+% This macro will actually do the job of building the title string.
+%
+% \begin{macrocode}
+\tdef\mdw@buildtitle{%
+% \end{macrocode}
+%
+% First of all, I'll open a group to avoid polluting the namespace with
+% my gubbins (although the code is now much tidier than it has been in
+% earlier releases).
+%
+% \begin{macrocode}
+ \begingroup%
+% \end{macrocode}
+%
+% The title building stuff makes extensive use of |\edef|. I'll set
+% |\protect| appropriately. (For those not in the know,
+% |\@unexpandable@protect| expands to `|\noexpand\protect\noexpand|',
+% which prevents expansion of the following macro, and inserts a |\protect|
+% in front of it ready for the next |\edef|.)
+%
+% \begin{macrocode}
+ \let\@@protect\protect\let\protect\@unexpandable@protect%
+% \end{macrocode}
+%
+% Set up some simple macros ready for the main code.
+%
+% \begin{macrocode}
+ \def\mdw@title{}%
+ \def\@prefix{The }%
+% \end{macrocode}
+%
+% Now build the title. This is fun.
+%
+% \begin{macrocode}
+ \mdw@addtotitle\dopackages\package{package}{packages}%
+ \mdw@addtotitle\doclasses\package{document class}{document classes}%
+ \mdw@addtotitle\dootherfiles\texttt{file}{files}%
+% \end{macrocode}
+%
+% Now I want to end the group and set the title from my string. The
+% following hacking will do this.
+%
+% \begin{macrocode}
+ \edef\next{\endgroup\noexpand\title{\mdw@title}}%
+ \next%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \subsection{Starting the main document}
+%
+% \begin{macro}{\mdwdoc}
+%
+% Once the document preamble has done all of its stuff, it calls the
+% |\mdwdoc| command, which takes over and really starts the documentation
+% going.
+%
+% \begin{macrocode}
+\def\mdwdoc{%
+% \end{macrocode}
+%
+% First, I'll construct the title string.
+%
+% \begin{macrocode}
+ \mdw@buildtitle%
+ \author{Mark Wooding}%
+% \end{macrocode}
+%
+% Set up the date string based on the date of the package which shares
+% the same name as the current file.
+%
+% \begin{macrocode}
+ \datefrom\@basename%
+% \end{macrocode}
+%
+% Set up verbatim characters after all the packages have started.
+%
+% \begin{macrocode}
+ \shortverb\|%
+ \shortverb\"%
+% \end{macrocode}
+%
+% Start the document, and put the title in.
+%
+% \begin{macrocode}
+ \begin{document}
+ \maketitle%
+% \end{macrocode}
+%
+% This is nasty. It makes maths displays work properly in demo environments.
+% \emph{The \LaTeX\ Companion} exhibits the bug which this hack fixes. So
+% ner.
+%
+% \begin{macrocode}
+ \abovedisplayskip\z@%
+% \end{macrocode}
+%
+% Now start the contents tables. After starting each one, I'll make it
+% be multicolumnar.
+%
+% \begin{macrocode}
+ \def\do##1##2{%
+ ##2%
+ \ifhave@multicol\addtocontents{##1}{%
+ \protect\begin{multicols}{2}%
+ \hbadness\@M%
+ }\fi%
+ }%
+ \docontents%
+% \end{macrocode}
+%
+% Input the main file now.
+%
+% \begin{macrocode}
+ \DocInput{\@basefile}%
+% \end{macrocode}
+%
+% That's it. I'm done.
+%
+% \begin{macrocode}
+ \end{document}
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \subsection{And finally\dots}
+%
+% Right at the end I'll put a hook for the configuration file.
+%
+% \begin{macrocode}
+\ifx\mdwhook\@@undefined\else\expandafter\mdwhook\fi
+% \end{macrocode}
+%
+% That's all the code done now. I'll change back to `user' mode, where
+% all the magic control sequences aren't allowed any more.
+%
+% \begin{macrocode}
+\makeatother
+%</mdwtools>
+% \end{macrocode}
+%
+% Oh, wait! What if I want to typeset this documentation? Aha. I'll cope
+% with that by comparing |\jobname| with my filename |mdwtools|. However,
+% there's some fun here, because |\jobname| contains category-12 letters,
+% while my letters are category-11. Time to play with |\string| in a messy
+% way.
+%
+% \begin{macrocode}
+%<*driver>
+\makeatletter
+\edef\@tempa{\expandafter\@gobble\string\mdwtools}
+\edef\@tempb{\jobname}
+\ifx\@tempa\@tempb
+ \describesfile*{mdwtools.tex}
+ \docfile{mdwtools.tex}
+ \makeatother
+ \expandafter\mdwdoc
+\fi
+\makeatother
+%</driver>
+% \end{macrocode}
+%
+% That's it. Done!
+%
+% \hfill Mark Wooding, \today
+%
+% \Finale
+%
+\endinput