mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 11:29:24 +02:00
Initial implementation
This commit is contained in:
parent
11ca840361
commit
cfa519dbe9
4163
docs/packages/listings/listings.dtx
Normal file
4163
docs/packages/listings/listings.dtx
Normal file
File diff suppressed because it is too large
Load Diff
59
docs/packages/listings/listings.ins
Normal file
59
docs/packages/listings/listings.ins
Normal file
@ -0,0 +1,59 @@
|
||||
%%
|
||||
%% Installation file: Listings package for LaTeX2e
|
||||
%% (w)(c) 1996-1997 by Carsten Heinz
|
||||
%%
|
||||
\def\batchfile{listings.ins}
|
||||
\input{docstrip}
|
||||
\keepsilent
|
||||
|
||||
\preamble
|
||||
|
||||
(w)(c) 1996-1997 by Carsten Heinz
|
||||
|
||||
This file is distributed freely. You are not allowed to take money
|
||||
for the distribution or use of this file, except for a nominal charge
|
||||
for copying etc.
|
||||
|
||||
This file is distributed without any warranty; without even the implied
|
||||
warranty of merchantability or fitness for a particular purpose.
|
||||
|
||||
You are not allowed to change this file.
|
||||
|
||||
\endpreamble
|
||||
|
||||
\askforoverwritefalse
|
||||
|
||||
\generate{%
|
||||
\file{listings.sty}{\from{listings.dtx}{package}}
|
||||
\file{lstblank.sty}{\from{listings.dtx}{blank}}
|
||||
\file{lstada.sty}{\from{listings.dtx}{ada}}
|
||||
\file{lstalgol.sty}{\from{listings.dtx}{algol}}
|
||||
\file{lstc.sty}{\from{listings.dtx}{c}}
|
||||
\file{lstcpp.sty}{\from{listings.dtx}{cpp}}
|
||||
\file{lstcobol.sty}{\from{listings.dtx}{cobol}}
|
||||
\file{lstcomal.sty}{\from{listings.dtx}{comal}}
|
||||
\file{lsteiffel.sty}{\from{listings.dtx}{eiffel}}
|
||||
\file{lstelan.sty}{\from{listings.dtx}{elan}}
|
||||
\file{lstfortran.sty}{\from{listings.dtx}{fortran}}
|
||||
\file{lstjava.sty}{\from{listings.dtx}{java}}
|
||||
\file{lstlisp.sty}{\from{listings.dtx}{lisp}}
|
||||
\file{lstlogo.sty}{\from{listings.dtx}{logo}}
|
||||
\file{lstmatlab.sty}{\from{listings.dtx}{matlab}}
|
||||
\file{lstmodula.sty}{\from{listings.dtx}{modula}}}
|
||||
\generate{%
|
||||
\file{lstoberon.sty}{\from{listings.dtx}{oberon}}
|
||||
\file{lstpascal.sty}{\from{listings.dtx}{pascal}}
|
||||
\file{lstpxsc.sty}{\from{listings.dtx}{pxsc}}
|
||||
\file{lsttp.sty}{\from{listings.dtx}{tp}}
|
||||
\file{lstperl.sty}{\from{listings.dtx}{perl}}
|
||||
\file{lstpli.sty}{\from{listings.dtx}{pli}}
|
||||
\file{lstsimula.sty}{\from{listings.dtx}{simula}}
|
||||
\file{lstsql.sty}{\from{listings.dtx}{sql}}
|
||||
\file{lsttex.sty}{\from{listings.dtx}{tex}}}
|
||||
|
||||
|
||||
\Msg{*}
|
||||
\Msg{* Move all `.sty' files into a directory searched by TeX.}
|
||||
\Msg{*}
|
||||
\Msg{* Run the `.dtx' file through LaTeX2e to get the documentation.}
|
||||
\Msg{*}
|
339
docs/packages/mdwtools/COPYING
Normal file
339
docs/packages/mdwtools/COPYING
Normal file
@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
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.
|
||||
|
||||
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.)
|
||||
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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.)
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
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.
|
||||
|
||||
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 OF TERMS AND CONDITIONS
|
||||
|
||||
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.
|
||||
|
||||
<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.
|
||||
|
||||
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:
|
||||
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
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
|
||||
|
||||
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.
|
499
docs/packages/mdwtools/README
Normal file
499
docs/packages/mdwtools/README
Normal file
@ -0,0 +1,499 @@
|
||||
|
||||
===============
|
||||
|
||||
M D W T O O L S
|
||||
|
||||
===============
|
||||
|
||||
|
||||
--- Licence note ---
|
||||
|
||||
mdwtools package release note
|
||||
Copyright (c) 1996 Mark Wooding, except doafter, which is Copyright (c) 1996
|
||||
Peter Schmitt and Mark Wooding.
|
||||
|
||||
These programs are free software; you can redistribute them and/or modify
|
||||
them 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.
|
||||
|
||||
These programs are distributed in the hope that they 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 these programs; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
--- What it's all about ---
|
||||
|
||||
This is a bunch of LaTeX 2e packages which have made my life as a LaTeX user
|
||||
easier, so I thought I'd share them. I'm mainly an ARM assembler hacker
|
||||
(which explains why my TeX code looks so horrible), although I have been
|
||||
known to write documentation for programs. This may explain the sort of
|
||||
things these packages do, and where I'm coming from.
|
||||
|
||||
|
||||
--- Licencing ---
|
||||
|
||||
The packages are made available under the GNU General Public Licence (not the
|
||||
usual LaTeX agreement). A copy of this licence is supplied in the file
|
||||
COPYING. You should read this document if you haven't read it already, even
|
||||
if it's just for educational value. I'm not actually sure how good a thing
|
||||
the GNU GPL actually is, so I'm sort of testing the water. The idea that
|
||||
this is how all software should be distributed still fills me with a certain
|
||||
amount of trepidation.
|
||||
|
||||
|
||||
--- What's in the box ---
|
||||
|
||||
You should have received the following files in whatever sort of archive
|
||||
thing this suite came in:
|
||||
|
||||
README -- You've got this file for sure, because it's this one
|
||||
COPYING -- A textual version of the GNU General Public Licence
|
||||
at.dtx -- Documentation and code for `at.sty' package
|
||||
cmtt.dtx -- Documentation and code for `cmtt.sty'package and
|
||||
associated files
|
||||
doafter.dtx -- Documentation and code for `doafter.sty' package; the
|
||||
code is also used in `syntax.sty' and `mdwtab.sty'
|
||||
mdwlist.dtx -- Documentation and code for `mdwlist.sty' package
|
||||
mdwmath.dtx -- Documentation and code for `mdwmath.sty' package
|
||||
mdwtab.dtx -- Documentation and code for `mdwtab.sty' and `mathenv.sty'
|
||||
packages
|
||||
footnote.dtx -- Documentation and code for `footnote.sty' package; the
|
||||
code is used in `mdwtab.sty'
|
||||
sverb.dtx -- Documentation and code for `sverb.stx' package
|
||||
syntax.dtx -- Documentation and code for `syntax.dtx' package
|
||||
mdwtools.ins -- Installation script for all the packages
|
||||
gpl.tex -- LaTeX version of the GNU General Public Licence
|
||||
mdwtools.tex -- Definitions for typesetting the documentation
|
||||
|
||||
If you're missing any of these files, complain at whoever gave the rest of
|
||||
them to you, and get them quickly. However, if you're lucky, you may have
|
||||
received some other files:
|
||||
|
||||
at.sty -- Unpacked `at.sty' package
|
||||
cmtt.sty -- Unpacked `cmtt.sty' package
|
||||
mTTenc.def -- Unpacked encoding definition file for `cmtt.sty'
|
||||
mTTcmtt.fd -- Unpacked font definition file for `cmtt.sty'
|
||||
doafter.sty -- Unpacked `doafter.sty' package for LaTeX
|
||||
doafter.tex -- Unpacked `doafter.tex' package for Plain TeX
|
||||
mathenv.sty -- Unpacked `mathenv.sty' package
|
||||
mdwlist.sty -- Unpacked `mdwlist.sty' package
|
||||
mdwmath.sty -- Unpacked `mdwmath.sty' package
|
||||
mdwtab.sty -- Unpacked `mdwtab.sty' package
|
||||
footnote.sty -- Unpackad `savenot.dty' package
|
||||
sverb.sty -- Unpacked `sverb.sty' package
|
||||
syntax.sty -- Unpacked `syntax.sty' package
|
||||
|
||||
at.dvi -- Typeset documentation for `at.sty'
|
||||
cmtt.dvi -- Typeset documentation for `cmtt.sty' and co.
|
||||
doafter.dvi -- Typeset documentation for `doafter.sty'
|
||||
mdwlist.dtx -- Typeset documentation for `mdwlist.sty'
|
||||
mdwmath.dvi -- Typeset documentation for `mdwmath.sty'
|
||||
mdwtab.dvi -- Typeset documentation for `mdwtab.sty' and `mathenv.sty'
|
||||
footnote.dvi -- Typeset documentation for `footnote.sty'
|
||||
sverb.dvi -- Typeset documentation for `sverb.sty'
|
||||
syntax.dvi -- Typeset documentation for `syntax.sty'
|
||||
|
||||
If you've already got these, then great, because you don't have to generate
|
||||
them. If you haven't, it's not a big deal. You might also have a bunch of
|
||||
files with extensions like `.log', `.aux', `.tmp', `.ilg' and so on. These
|
||||
files are really not at all interesting, and you might as well get rid of
|
||||
them now.
|
||||
|
||||
|
||||
--- What the packages do ---
|
||||
|
||||
Before we can get anywhere, you need to know what the packages do, roughly
|
||||
speaking. Here's a quick rundown:
|
||||
|
||||
at.sty -- Allows you to use `@' as a sort of `command-introducing'
|
||||
character, a bit like `\' is already. This gives you
|
||||
a lot more short command names which you can assign to
|
||||
common constructions. For example, you can set up
|
||||
@/<text>/ as a command to put <text> in italics.
|
||||
|
||||
cmtt.sty -- Provides an `mTT' encoding for the Computer Modern
|
||||
Typewriter font, which solves lots of messy problems.
|
||||
|
||||
doafter.sty -- Provides a TeX programmer's utility
|
||||
\doafter <token> <group>
|
||||
which does the <token> after the group is complete,
|
||||
including any \aftergroup things. The code was originally
|
||||
written by Peter Schmitt in answer to a `challenge' I made
|
||||
on comp.text.tex;I tweaked it a bit to make it work
|
||||
slightly better. doafter.tex is a plain TeX version of
|
||||
the same macro.
|
||||
|
||||
mathenv.sty -- Contains a collection of mathematical environments with
|
||||
a theme of aligning things in columns. There's a
|
||||
rewritten version of `eqnarray' which is much more
|
||||
powerful than the old one, and it gets the spacing right.
|
||||
This package requires `mdwtab.sty' in order to work. It
|
||||
is extracted from `mdwtab.dtx'. In general, the AmS
|
||||
things to a better job, although it seems that the mathenv
|
||||
matrix and script handling environments give prettier
|
||||
results than the AmS equivalents (at least to my eyes).
|
||||
|
||||
mdwlist.sty -- Various list related environments. There's a more
|
||||
versatile `description' environment, and some stuff for
|
||||
making `compacted' lists (with no extra space between
|
||||
items).
|
||||
|
||||
mdwmath.sty -- Contains a few trivial definitions for mathematical
|
||||
things. The main thing is that the \sqrt command for
|
||||
doing square roots has been improved -- there's a \sqrt*
|
||||
command which stops the line being drawn over the formula
|
||||
being square-rooted, and the positioning of the root
|
||||
index (the optional argument) has been improved.
|
||||
|
||||
mdwtab.sty -- A complete ground-up rewrite of LaTeX's `tabular' and
|
||||
`array' environments. Has lots of advantages over
|
||||
the standard version, and over the version in `array.sty'.
|
||||
It works correctly with all the table-related packages in
|
||||
the Tools bundle (longtable, delarray, hhline, tabularx
|
||||
and dcolumn). This package includes most of the code
|
||||
from `doafter.sty' and `footnote.sty' (it doesn't load
|
||||
the packages -- it has its own copies built-in, although
|
||||
you won't waste memory if you do load these packages).
|
||||
To generate `mdwtab.sty', you require `mdwtab.dtx',
|
||||
`doafter.dtx' and `footnote.dtx'; the last two provide
|
||||
the shared code.
|
||||
|
||||
footnote.sty -- Provides commands for saving executing footnotes; the
|
||||
author has noticed several packages which attempt to
|
||||
enable footnotes in tables, all of which eat an extra
|
||||
token list register. This is an attempt to offer shared
|
||||
code to do the job, saving space and effort. It also
|
||||
provides a `footnote' environment which allows verbatim
|
||||
text.
|
||||
|
||||
sverb.sty -- A bunch of macros for doing verbatim things. Required
|
||||
for typesetting all the documentation for the other
|
||||
packages.
|
||||
|
||||
syntax.sty -- A load of commands for describing syntax. There's an
|
||||
environment for typesetting BNF grammars. But best of
|
||||
all, there's a load of commands and environments for
|
||||
drawing syntax diagrams. Required for typesetting all
|
||||
the documentation for the other packages. If you're
|
||||
extracting syntax.sty from syntax.dtx, you also need
|
||||
doafter.dtx.
|
||||
|
||||
With the exception of the dependencies listed above, the packages will all
|
||||
work independently of each other. If you want to typeset the documentation,
|
||||
you'll need `sverb.sty' and `syntax.sty'. Typesetting the documentation
|
||||
isn't essential, although it will probably help if you can see what the
|
||||
various commands actually do.
|
||||
|
||||
|
||||
--- Extracting the packages ---
|
||||
|
||||
If you don't have the various .sty files already, you'll need to extract them
|
||||
from the .dtx files. This requires docstrip.tex, which should be part of
|
||||
your base LaTeX 2e distribution. If you have docstrip vsersion 2.3d, which
|
||||
is available with the December 1995 release of LaTeX, things will go rather
|
||||
faster. If your LaTeX release is much older than this, you should upgrade,
|
||||
because the packages need a fairly new LaTeX anyway. (I could do something
|
||||
about this, but I won't, because I want to encourage everyone to upgrade.)
|
||||
|
||||
If everything's set up correctly, all you should need to do is say
|
||||
|
||||
tex mdwtools.ins
|
||||
|
||||
or
|
||||
|
||||
latex mdwtools.ins
|
||||
|
||||
or whatever incantation is necessary to run TeX or LaTeX on the supplied
|
||||
`mdwtools.ins' file on your system.
|
||||
|
||||
TeX will grind away at the files for a bit, and then say `Done' at you. (This
|
||||
could take a while, so be patient.) You will then have a mdwtools.log file,
|
||||
which you can throw away, and a collection of sparkly new .sty files, which
|
||||
you should put somewhere where TeX can find them easily.
|
||||
|
||||
|
||||
--- Typesetting the documentation ---
|
||||
|
||||
If you want to typeset the documentation for a package, you'll need the
|
||||
`mdwtools.tex' file provided, and the `syntax.sty' and `sverb.sty' packages.
|
||||
You'll also need the `.dtx' file for the package you want documentation on,
|
||||
and any packages it generated.
|
||||
|
||||
For example, if you want documentation on `mathenv.sty', you need:
|
||||
|
||||
mdwtools.tex -- Shared defintions for all the documentation files
|
||||
syntax.sty -- Syntax typesetting commands
|
||||
sverb.sty -- Verbatim text handling commands
|
||||
mathenv.sty -- So the documentation can use it to demonstrate its
|
||||
features
|
||||
mdwtab.sty -- Required by `mathenv.sty'
|
||||
mdwtab.dtx -- The documentation file from which `mathenv.sty' was
|
||||
extracted, and therefore the file which contains the
|
||||
documentation you want to read
|
||||
|
||||
Make sure you've got all the files, and then run LaTeX on the .dtx file you
|
||||
want to read.
|
||||
|
||||
TeX will start hammering away for a very short while, and then stop and ask
|
||||
you whether you want to build the indexing files. Generating index files
|
||||
takes a lot longer (I'd guess that it doubled the amount of time taken to
|
||||
typeset the `.dtx' file) so I don't recommend it unless:
|
||||
|
||||
* you've got a very fast processor, or
|
||||
* you're very interested in how the package works internally, or
|
||||
* you just like everything to be complete, or
|
||||
* you're a masochist.
|
||||
|
||||
Even so, there's no point writing indexing information the first time you
|
||||
run LaTeX on a file, because the table of contents hasn't been created yet,
|
||||
and when you LaTeX the file the second time, all the references will change.
|
||||
|
||||
If you want the index files anyway, type `y' when you're asked. Otherwise,
|
||||
type 'n'. You know you want to type `n' really...
|
||||
|
||||
If you want to do the job properly, you need to run LaTeX a second time
|
||||
to read in the contents table. /This/ is the correct time to turn on
|
||||
indexing, if you really want it.
|
||||
|
||||
If you did build the index files, you should now sort the index by saying
|
||||
|
||||
makeindex -s gind.ist <name>.idx
|
||||
|
||||
where <name> is the same as the name of the `.dtx' file. The `gind.ist' file
|
||||
should have come with LaTeX. Having done this, you should run the `.dtx'
|
||||
file though LaTeX one final time, to insert the formatted index.
|
||||
|
||||
You can now print or preview the generated `.dvi' file using whatever tools
|
||||
you usually use for such things.
|
||||
|
||||
|
||||
--- What changed? ---
|
||||
|
||||
Here's a list of what changed in the various releases.
|
||||
|
||||
Version Changes
|
||||
|
||||
1.00 * First general releases of everything.
|
||||
|
||||
|
||||
1.01 * Fixed typos in various bits of documentation.
|
||||
|
||||
* (mdwtab.sty) Added enhanced \cline command. Added
|
||||
hhline.sty to list of supported table-related packages.
|
||||
(I guess it always worked -- I just forgot about it.)
|
||||
Made some of the section titles a little sillier ;-)
|
||||
|
||||
* (mathenv.sty) Added some new random environments, mainly
|
||||
because I saw some more interesting examples in /The/
|
||||
/TeXbook/ and had an idea... Now support nesting of
|
||||
various environments, albeit rather imperfectly.
|
||||
|
||||
* (at.sty) Made @-commands really properly robust. Fixed
|
||||
some lies in the documentation. Removed some truly insane
|
||||
bits of old code here too. Made package sort of
|
||||
cooperate with amsmath's use of @-commands -- suggestions
|
||||
for improvement welcomed.
|
||||
|
||||
* (mdwtools.tex) Fixed /really/ stupid mistake in which made
|
||||
typesetting the documentation about fifty times slower
|
||||
than it should have been (bashes self on head several
|
||||
times). Changed the structure here a bit too, to handle
|
||||
document classes as well as packages. Made TeX much
|
||||
quieter while it's typesetting the documentation.
|
||||
|
||||
* (sverb.sty) Fixed duff paragraph formatting in listing
|
||||
environment and \verbinput command (due to the `wrong
|
||||
sort' of grouping). (My excuse for missing this one is
|
||||
that my standard document class sets \parskip=0pt.)
|
||||
|
||||
* (mdwtools.ins) Fixed this in line with the documentation
|
||||
which hints that it should work with older docstrips.
|
||||
It's a bit hacky but it works.
|
||||
|
||||
|
||||
1.02 * (gpl.tex) Fixed some bugs which made typesetting go wrong
|
||||
in larger documents. Restructured preamble so that it
|
||||
can be typeset on its own. Put in eplicit item numbers
|
||||
in the enumerate environments, for more obvious conformance
|
||||
to the original.
|
||||
|
||||
* (mdwtab.sty) Lots of changes here, many suggested by
|
||||
David Carlisle (so oodles of thanks to him for taking
|
||||
an interest in my humble hackings). Fixed bugs, including
|
||||
one which put entirely incorrect interline spacing in
|
||||
`p' type columns. Redone the handling of [t] and [b]
|
||||
tables with top and bottom rules, and removed the
|
||||
`\rulefudge' parameter which is no longer necessary.
|
||||
Miscellaneous other changes.
|
||||
|
||||
* (mdwtab.dtx) Tidied up some nastinesses in the
|
||||
documentation, and removed the `\over' commands from the
|
||||
maths demos, to keep certain people happy. Floated a few
|
||||
more of the demonstrations to make page breaking better.
|
||||
There's a danger that some of the demos are drifting too
|
||||
far away from their text, but it's not too bad yet.
|
||||
|
||||
* (syntax.sty) Used \doafter here to fix some colour handling
|
||||
problems.
|
||||
|
||||
* (syntax.sty) Tidied up the `grammar' environment quite a
|
||||
bit (it now uses `\item', rather than trying to emulate it
|
||||
internally), and fixed some vicious bugs in it and some
|
||||
other code.
|
||||
|
||||
* (doafter.sty etc.) A new addition, to make the various
|
||||
packages handle colour properly. Mainly written by
|
||||
Peter Scmitt, actually, I just fiddled with it a little.
|
||||
Then Peter gave me a better version, and I've tried to
|
||||
upgrade this one.
|
||||
|
||||
* (footnote.sty) A new addition, to offer some shared things
|
||||
for handling footnotes. It also enables footnotes in
|
||||
parboxes, which used to be difficult, and provides a
|
||||
`footnote' environment which allows verbatim text.
|
||||
|
||||
* (mdwlist.sty} A new addition, providing miscellanous
|
||||
list-related macros. It's a sort of mixed bag of things
|
||||
I've had lying around various document preambles, combined
|
||||
with some ideas from the Companion.
|
||||
|
||||
* (at.sty) Rewritten command name parser to be much nicer.
|
||||
Added support for digits within @-command names (subject
|
||||
to being enabled by an option). This is in response to
|
||||
requests in comp.text.tex for digits in command names.
|
||||
|
||||
* (mathenv.sty) Totally overhauled the matrix spacing rules.
|
||||
Added `script' environment. Improved numbering things,
|
||||
with `\eqnumber'.
|
||||
|
||||
* (mdwtools.tex) Some minor changes here to fix some buglets.
|
||||
Played with some more float parameters, to discourage
|
||||
float pages a bit more. Then revamped completely, turned
|
||||
into a docced program (although it isn't docstripped),
|
||||
rewritten title generation, and made much more
|
||||
customisable.
|
||||
|
||||
|
||||
1.02a * (mdwtab.sty) Added support for table beautification in
|
||||
longtable. Documented how to do this.
|
||||
|
||||
|
||||
1.03 * (mdwtab.sty) Completely redone the paragraph-cell handling:
|
||||
list environments now work properly inside tables (without
|
||||
funny extra space appearing at the top and bottom). Also
|
||||
fixed a bug in the newline handling, which ignored negative
|
||||
interrow space in the \\ command.
|
||||
|
||||
* (syntax.sty) Changed the underscore handling, and some
|
||||
other bits, to fit in rather better with LaTeX's output
|
||||
encoding system. It's nastier and hackier inside, but it
|
||||
works better with things like the DC fonts. Also stopped
|
||||
re-lowercasing of `~' from escaping and messing everything
|
||||
up for everyone. Improved underscore appearance by
|
||||
lowering it some more.
|
||||
|
||||
* (syntax.sty) Replaced some `2's with `\tw@'s. Added a
|
||||
comment about dvips's inaccurate positioning of rules.
|
||||
|
||||
* (sverb.sty) Made non-* environments build end text from
|
||||
the name of the current environment, rather than having it
|
||||
hardcoded. Also stopped `unignore' environments being
|
||||
a group.
|
||||
|
||||
* (sverb.dtx) Removed some porkies from the documentation.
|
||||
|
||||
* (mdwtab.sty) Fixed some miscellaneous typos. Removed
|
||||
`\rulefudge' from the table of tweakables, because it
|
||||
was withdrawn in release 1.02.
|
||||
|
||||
* (cmtt.dtx) New package, for handling the `cmtt' font
|
||||
better. It introduces a special encoding for the font,
|
||||
and provides a command which allows you to use all the
|
||||
characters without the disadvantages of verbatim text.
|
||||
|
||||
* (other changes) Improved distribution building and
|
||||
testing stuff which you can't see because I'm not
|
||||
releasing it.
|
||||
|
||||
|
||||
1.04 * (syntax.sty) Provided some new commands for playing with
|
||||
interword spacing in `tt' fonts.
|
||||
|
||||
* (doafter.dtx and footnote.dtx) Added some docstrip guards
|
||||
around the meta-comments, so that the charactertable and
|
||||
the GPL header aren't put into other packages.
|
||||
Unfortunately the version of docstrip which understands
|
||||
this hasn't been released yet...
|
||||
|
||||
* RCSified everything, so I can find old revisions, and I'm
|
||||
less likely to destroy everything.
|
||||
|
||||
* (footnote.dtx) Added a check for AMS environments doing
|
||||
measuring passes, to avoid duplicated footnotes. (Spotted
|
||||
by Roberto Bagnara.)
|
||||
|
||||
|
||||
1.05 * (mdwtab.dtx) Fixed stupid bug in paragraph cells which
|
||||
left 1000pt high table rows. (Spotted by Rowland.)
|
||||
|
||||
* (mdwtab.dtx) Fixed horizontal spacing problems with
|
||||
empty paragraph cells.
|
||||
|
||||
* (mdwlist.dtx) Allowed compact lists and resumed lists
|
||||
to pass arguments on to the underlying environments.
|
||||
|
||||
|
||||
--- Future plans ---
|
||||
|
||||
doafter.sty Add Peter Schmitt's testing for implicit/explicit braces,
|
||||
as a package or docstrip option. (This extra testing is
|
||||
a significant chunk of code, and I don't think it's worth
|
||||
burdening the standard version with it. Peter agrees with
|
||||
me.)
|
||||
|
||||
mathenv.sty Do postprocessing on display maths environments to position
|
||||
the equations and equation numbers properly, so they don't
|
||||
overlap (like the AMS environments do, although more
|
||||
robustly). Once this is done, I think I'll have a reasonable
|
||||
case for saying that this provides an alternative to the
|
||||
AMS environments, although quite what the advantage is I
|
||||
don't know: mdwtab.sty isn't exactly small.
|
||||
|
||||
Work is currently `in progress' on this one.
|
||||
|
||||
mdwtab.sty Consider doing postprocessing on tables (yuk) in a blkarray
|
||||
sort of way.
|
||||
|
||||
footnote.sty Merge with Robin Fairbairn's package of the same name. Allow
|
||||
different rules for continued notes (suggested by Donald
|
||||
Arseneau, after a news article by Jonathan Wand).
|
||||
|
||||
New packages I'm currently working on a little something for typesetting
|
||||
poetry properly (centring poems horizontally based on the
|
||||
longest line, etc.), handling footnotes properly, doing
|
||||
line numbering etc. If anyone has any wishes for this,
|
||||
little things a tyro like me ought to know, or knows that
|
||||
it's already done better than I could manage, then let me
|
||||
know.
|
||||
|
||||
|
||||
--- Contacting the author ---
|
||||
|
||||
The author can be reached by email at mdw@excessus.demon.co.uk. This is his
|
||||
personal dial-up account, paid for privately, so don't expect replies after
|
||||
five minutes or anything like that.
|
||||
|
||||
If you do have any comments regarding the code, its documentation, or
|
||||
anything else to do with these packages, don't leave me guessing -- let me
|
||||
know. While I won't guarantee to do anything about your comments, chances
|
||||
are that I'll right any wrongs and rescue any damsels in distress (oh, no,
|
||||
wrong spiel).
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
753
docs/packages/mdwtools/at.dtx
Normal file
753
docs/packages/mdwtools/at.dtx
Normal file
@ -0,0 +1,753 @@
|
||||
% \begin{meta-comment}
|
||||
%
|
||||
% $Id$
|
||||
%
|
||||
% Allow @-commands
|
||||
%
|
||||
% (c) 1995 Mark Wooding
|
||||
%
|
||||
%----- Revision history -----------------------------------------------------
|
||||
%
|
||||
% $Log$
|
||||
% Revision 1.1 1998-09-21 10:18:06 michael
|
||||
% Initial implementation
|
||||
%
|
||||
% Revision 1.3 1996/11/19 20:46:55 mdw
|
||||
% Entered into RCS
|
||||
%
|
||||
%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \begin{meta-comment} <general public licence>
|
||||
%%
|
||||
%% at package -- support for `@' commands'
|
||||
%% 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} <Package preamble>
|
||||
%<+package>\NeedsTeXFormat{LaTeX2e}
|
||||
%<+package>\ProvidesPackage{at}
|
||||
%<+package> [1996/05/02 1.3 @-command support (MDW)]
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \CheckSum{355}
|
||||
%% \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 \~}
|
||||
%%
|
||||
%
|
||||
% \begin{meta-comment} <driver>
|
||||
%
|
||||
%<*driver>
|
||||
\input{mdwtools}
|
||||
\describespackage{at}
|
||||
\aton
|
||||
\atlet p=\package
|
||||
\atdef at{\package{at}}
|
||||
\atdef={\mbox{-}}
|
||||
\atdef-{@@@=}
|
||||
\atlet.=\syntax
|
||||
\mdwdoc
|
||||
%</driver>
|
||||
%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \section{User guide}
|
||||
%
|
||||
% The @at\ package is an attempt to remove a lot of tedious typing that
|
||||
% ends up in \LaTeX\ documents, by expanding the number of short command
|
||||
% names available. The new command names begin with the `|@|' character,
|
||||
% rather than the conventional `|\|', so you can tell them apart.
|
||||
%
|
||||
% The package provides some general commands for defining @-commands, and
|
||||
% then uses them to define some fairly simple ones which will be useful to
|
||||
% most people.
|
||||
%
|
||||
% The rules for @-command names aren't terribly complex:
|
||||
% \begin{itemize}
|
||||
% \item If the first character of the name is a letter, then the command name
|
||||
% consists of all characters up to, but not including, the first
|
||||
% nonletter. Spaces following the command name are ignored.
|
||||
% \item If the first character of the name is a backslash, then the @-command
|
||||
% name consists of the control sequence introduced by the backslash.
|
||||
% \item Otherwise, the command name consists only of that first character.
|
||||
% Spaces following the name are not ignored, unless that character
|
||||
% was itself a space character.
|
||||
% \end{itemize}
|
||||
%
|
||||
% Usually, digits are not considered to be letters. However, the
|
||||
% \package{at} package will consider digits to be letters if you give it the
|
||||
% \textsf{digits} option in the |\usepackage| command. (Note that this
|
||||
% only affects the \package{at} package; it won't change the characters
|
||||
% allowed in normal command names.)
|
||||
%
|
||||
% \DescribeMacro{\atallowdigits}
|
||||
% \DescribeMacro{\atdisallowdigits}
|
||||
% You can enable and disable digits being considered as letters dynamically.
|
||||
% The |\atallowdigits| command allows digits to be used as letters;
|
||||
% |\atdisallowdigits| prevents this. Both declarations follow \LaTeX's
|
||||
% usual scoping rules. Both of these commands have corresponding
|
||||
% environments with the same names (without the leading `|\|', obviously).
|
||||
%
|
||||
% \subsection{Defining @-commands}
|
||||
%
|
||||
% \DescribeMacro{\newatcommand}
|
||||
% \DescribeMacro{\renewatcommand}
|
||||
% The |\newatcommand| command will define a new @-command using a syntax
|
||||
% similar to |\newcommand|. For example, you could define
|
||||
% \begin{listing}
|
||||
%\newatcommand c[1]{\chapter{#1}}
|
||||
% \end{listing}
|
||||
% to make @.{"@c{"<name>"}"} equivalent to @.{"\\chapter{"<name>"}"}.
|
||||
%
|
||||
% A |\renewatcommand| is also provided to redefine existing commands, should
|
||||
% the need arise.
|
||||
%
|
||||
% \DescribeMacro{\atdef}
|
||||
% For \TeX\ hackers, the |\atdef| command defines @-commands using a syntax
|
||||
% similar to \TeX's built-in |\def|.
|
||||
%
|
||||
% As an example, the following command makes @.{"@/"<text>"/"} write its
|
||||
% argument \<text> in italics:
|
||||
% \begin{listing}
|
||||
%\atdef/#1/{\textit{#1}}
|
||||
% \end{listing}
|
||||
% The real implementation of the |@/|\dots|/| command is a bit more
|
||||
% complex, and is given in the next section.
|
||||
%
|
||||
% You can use all of \TeX's features for defining the syntax of your
|
||||
% command. (See chapter~20 of @/The \TeX book/ for more details.)
|
||||
%
|
||||
% \DescribeMacro{\atlet}
|
||||
% Since |\atdef| is provided to behave similarly to |\def|, @at\ provides
|
||||
% |\atlet| which works similarly to |\let|. For example you can say
|
||||
% \begin{listing}
|
||||
%\atlet!=\index
|
||||
% \end{listing}
|
||||
% to allow the short |@!| to behave exactly like |\index|.
|
||||
%
|
||||
% Note that all commands defined using these commands are robust even if you
|
||||
% use fragile commands in their definitions. Unless you start doing very
|
||||
% strange things, @-commands never need |\protect|ing.
|
||||
%
|
||||
% \subsection{Predefined @-commands}
|
||||
%
|
||||
% A small number of hopefully useful commands are provided by default.
|
||||
% These are described in the table below:
|
||||
%
|
||||
% \bigskip \begin{center} \begin{tabular}{lp{3in}} \hline
|
||||
% \bf Command & \bf Meaning \\ \hline
|
||||
% @.{"@@"} & Typesets an `@@' character. \\
|
||||
% @.{"@/"<text>"/"} & In text (LR or paragraph) mode, typesets its
|
||||
% argument emphasised. In maths mode, it
|
||||
% always chooses italics. \\
|
||||
% @.{"@*"<text>"*"} & Typesets its argument \<text> in bold. \\
|
||||
% @.{"@i{"<text>"}"} & Equivalent to `@.{"\\index{"<text>"}"}'. \\
|
||||
% @.{"@I{"<text>"}"} & As for |@i|, but also writes its argument
|
||||
% to the document. \\ \hline
|
||||
% \end{tabular} \end{center} \bigskip
|
||||
%
|
||||
% Package writers should not rely on any predefined @-commands -- they're
|
||||
% provided for users, and users should be able to redefine them without
|
||||
% fear of messing anything up. (This includes the `standard' commands
|
||||
% provided by the @at\ package, by the way. They're provided in the vague
|
||||
% hope that they might be useful, and as examples.)
|
||||
%
|
||||
% \implementation
|
||||
%
|
||||
% \section{Implementation}
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%<*package>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsection{Options handling}
|
||||
%
|
||||
% We need a switch to say whether digits should be allowed. Since this
|
||||
% is a user thing, I'll avoid |\newif| and just define the thing by hand.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\atallowdigits{\let\ifat@digits\iftrue}
|
||||
\def\atdisallowdigits{\let\ifat@digits\iffalse}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now define the options.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\DeclareOption{digits}{\atallowdigits}
|
||||
\DeclareOption{nodigits}{\atdisallowdigits}
|
||||
\ExecuteOptions{nodigits}
|
||||
\ProcessOptions
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsection{How the commands work}
|
||||
%
|
||||
% Obviously we make the `@@' character active. It inspects the next
|
||||
% character (or argument, actually -- it can be enclosed in braces for
|
||||
% longer commands, although this is a bit futile), and builds the command
|
||||
% name from that.
|
||||
%
|
||||
% The |\at| command is equivalent to the active `@@' character always.
|
||||
%
|
||||
%
|
||||
% \subsection{Converting command names}
|
||||
%
|
||||
% We need to be able to read an @-command name, and convert it to a normal
|
||||
% \TeX\ control sequence. First, we declare some control sequences for
|
||||
% braces, which we need later.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\begingroup
|
||||
\catcode`\<1
|
||||
\catcode`\>2
|
||||
\catcode`\{12
|
||||
\catcode`\}12
|
||||
\gdef\at@lb<{>
|
||||
\gdef\at@rb<}>
|
||||
\gdef\at@spc< >
|
||||
\endgroup
|
||||
% \end{macrocode}
|
||||
%
|
||||
% I'll set up some helper routines now, to help me read the command
|
||||
% names. The way this works is that we |\futurelet| the token into
|
||||
% |\@let@token|. These routines will then sort out what to do next.
|
||||
%
|
||||
% \begin{macro}{\at@test}
|
||||
%
|
||||
% Given an |\if|\dots\ test, does its first or second argument.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@test#1\then{%
|
||||
#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\at@ifcat}
|
||||
%
|
||||
% Checks the category code of the current character. If it matches the
|
||||
% argument, it does its second argument, otherwise it does the third.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@ifcat#1{\at@test\ifcat#1\noexpand\@let@token\then}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\at@ifletter}
|
||||
%
|
||||
% This routine tests the token to see if it's a letter, and if so adds
|
||||
% it to the token list and does the first argument; otherwise it does the
|
||||
% second argument. It accepts digits as letters if the switch is turned
|
||||
% on.
|
||||
%
|
||||
% There's some fun later, so I'll describe this slowly. First, we compare
|
||||
% the category code to a letter, and if we have a match, we know we're done;
|
||||
% we need to pick up the letter as an argument. If the catcode is `other',
|
||||
% we must compare with numbers to see if it's in range.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@ifletter#1#2{%
|
||||
\at@ifcat x%
|
||||
{\at@ifletter@ii{#1}}%
|
||||
{\at@ifcat 0%
|
||||
{\at@ifletter@i{#1}{#2}}%
|
||||
{#2}%
|
||||
}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Right. It's `other' (so it's safe to handle as a macro argument) and we
|
||||
% need to know if it's a digit. This is a little tricky: I use |\if| to
|
||||
% compare two characters. The first character is~`1' or~`0' depending on the
|
||||
% `digit' switch; the second is~`1' or~`x' depending on whether it's actually
|
||||
% a digit. They'll only match if everything's worked out OK.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@ifletter@i#1#2#3{%
|
||||
\at@test\if%
|
||||
\ifat@digits1\else0\fi%
|
||||
\ifnum`#3<`0x\else\ifnum`#3>`9x\else1\fi\fi%
|
||||
\then%
|
||||
{\at@ifletter@ii{#1}{#3}}%
|
||||
{#2#3}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Right; we have the character, so add it to the list and carry on.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@ifletter@ii#1#2{\toks@\expandafter{\the\toks@#2}#1}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% Now we define the command name reading routines. We have @/almost/ the
|
||||
% same behaviour as \TeX, although we can't support `|%|' characters for
|
||||
% reasons to do with \TeX's tokenising algorithm.
|
||||
%
|
||||
% \begin{macro}{\at@read@name}
|
||||
%
|
||||
% The routine which actually reads the command name works as follows:
|
||||
% \begin{enumerate}
|
||||
% \item Have a peek at the next character. If it's a left or right brace,
|
||||
% then use the appropriate character.
|
||||
% \item If the character is not a letter, just use the character (or whole
|
||||
% control sequence.
|
||||
% \item Finally, if it's a letter, keep reading letters until we find one
|
||||
% that wasn't.
|
||||
% \end{enumerate}
|
||||
%
|
||||
% First, we do some setting up and read the first character
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@read@name#1{%
|
||||
\let\at@next=#1%
|
||||
\toks@{}%
|
||||
\futurelet\@let@token\at@rn@i%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Next, sort out what to do, based on the category code.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@rn@i{%
|
||||
\def\@tempa{\afterassignment\at@rn@iv\let\@let@token= }%
|
||||
\at@ifletter%
|
||||
{\futurelet\@let@token\at@rn@iii}%
|
||||
{\at@ifcat\bgroup%
|
||||
{\toks@\expandafter{\at@lb}\@tempa}%
|
||||
{\at@ifcat\egroup%
|
||||
{\toks@\expandafter{\at@rb}\@tempa}%
|
||||
{\at@ifcat\at@spc%
|
||||
{\toks@{ }\@tempa}%
|
||||
{\at@rn@ii}%
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Most types of tokens can be fiddled using |\string|.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@rn@ii#1{%
|
||||
\toks@\expandafter{\string#1}%
|
||||
\at@rn@iv%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% We've found a letter, so we should check for another one.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@rn@iii{%
|
||||
\at@ifletter%
|
||||
{\futurelet\@let@token\at@rn@iii}%
|
||||
{\@ifnextchar.\at@rn@iv\at@rn@iv}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Finally, we need to pass the real string, as an argument, to the
|
||||
% macro. We make |\@let@token| relax, since it might be something which will
|
||||
% upset \TeX\ later, e.g., a |#| character.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@rn@iv{%
|
||||
\let\@let@token\relax%
|
||||
\expandafter\at@next\csname at.\the\toks@\endcsname%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\at@cmdname}
|
||||
%
|
||||
% Given a control sequence, work out which @-command it came from.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@cmdname#1{\expandafter\at@cmdname@i\string#1\@@foo}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now extract the trailing bits.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@cmdname@i#1.#2\@@foo{#2}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\at@decode}
|
||||
%
|
||||
% The |\at@decode| macro takes an extracted @-command name, and tries to
|
||||
% execute the correct control sequence derived from it.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@decode#1{%
|
||||
\at@test\ifx#1\relax\then{%
|
||||
\PackageError{at}{Unknown @-command `@\at@cmdname#1'}{%
|
||||
The @-command you typed wasn't recognised, so I've ignored it.
|
||||
}%
|
||||
}{%
|
||||
#1%
|
||||
}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\@at}
|
||||
%
|
||||
% We'd like a measure of compatibility with @p{amsmath}. The @-commands
|
||||
% provided by @p{amsmath} work only in maths mode, so this gives us a way of
|
||||
% distinguishing. If the control sequence |\Iat| is defined, and we're in
|
||||
% maths mode, we'll call that instead of doing our own thing.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\@at{%
|
||||
\def\@tempa{\at@read@name\at@decode}%
|
||||
\ifmmode\ifx\Iat\not@@defined\else%
|
||||
\let\@tempa\Iat%
|
||||
\fi\fi%
|
||||
\@tempa%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
%
|
||||
% \subsection{Defining new commands}
|
||||
%
|
||||
% \begin{macro}{\at@buildcmd}
|
||||
%
|
||||
% First, we define a command to build these other commands:
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@buildcmd#1#2{%
|
||||
\expandafter\def\csname\expandafter
|
||||
\@gobble\string#1@decode\endcsname##1{#2##1}%
|
||||
\edef#1{%
|
||||
\noexpand\at@read@name%
|
||||
\expandafter\noexpand%
|
||||
\csname\expandafter\@gobble\string#1@decode\endcsname%
|
||||
}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\newatcommand}
|
||||
% \begin{macro}{\renewatcommand}
|
||||
% \begin{macro}{\provideatcommand}
|
||||
% \begin{macro}{\atdef}
|
||||
% \begin{macro}{\atshow}
|
||||
%
|
||||
% Now we define the various operations on @-commands.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\at@buildcmd\newatcommand\newcommand
|
||||
\at@buildcmd\renewatcommand\renewcommand
|
||||
\at@buildcmd\provideatcommand\providecommand
|
||||
\at@buildcmd\atdef\def
|
||||
\at@buildcmd\atshow\show
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\atlet}
|
||||
%
|
||||
% |\atlet| is rather harder than the others, because we want to allow people
|
||||
% to say things like @.{"\\atlet"<name>"=@"<name>}. The following hacking
|
||||
% does the trick. I'm trying very hard to duplicate |\let|'s behaviour with
|
||||
% respect to space tokens here, to avoid any surprises, although there
|
||||
% probably will be some differences. In particular, |\afterassignment|
|
||||
% won't work in any sensible way.
|
||||
%
|
||||
% First, we read the name of the @-command we're defining. We also open
|
||||
% a group, to stop messing other people up, and make `@@' into an `other'
|
||||
% token, so that it doesn't irritatingly look like its meaning as a control
|
||||
% sequence.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\atlet{%
|
||||
\begingroup%
|
||||
\@makeother\@%
|
||||
\at@read@name\atlet@i%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Put the name into a scratch macro for later use. Now see if there's an
|
||||
% equals sign up ahead. If not, this will gobble any spaces in between the
|
||||
% @-command name and the argument.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\atlet@i#1{%
|
||||
\def\at@temp{#1}%
|
||||
\@ifnextchar=\atlet@ii{\atlet@ii=}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now we gobble the equals sign (whatever catcode it is), and peek at the
|
||||
% next token up ahead using |\let| with no following space.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\atlet@ii#1{\afterassignment\atlet@iii\global\let\at@gnext=}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% The control sequence |\at@gnext| is now |\let| to be whatever we want the
|
||||
% @-command to be, unless it's picked up an `@@' sign. If it has, we've
|
||||
% eaten the |@| token, so just read the name and pass it on. Otherwise,
|
||||
% we can |\let| the @-command directly to |\at@gnext|. There's some
|
||||
% nastiness here to make |\the\toks@| expand before we close the group and
|
||||
% restore its previous definition.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\atlet@iii{%
|
||||
\if @\noexpand\at@gnext%
|
||||
\expandafter\at@read@name\expandafter\atlet@iv%
|
||||
\else%
|
||||
\expandafter\endgroup%
|
||||
\expandafter\let\at@temp= \at@gnext%
|
||||
\fi%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% We've read the source @-command name, so just copy the definitions over.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\atlet@iv#1{%
|
||||
\expandafter\endgroup%
|
||||
\expandafter\let\at@temp=#1%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
%
|
||||
% \subsection{Robustness of @-commands}
|
||||
%
|
||||
% We want all @-commands to be robust. We could leave them all being
|
||||
% fragile, although making robust @-commands would then be almost impossible.
|
||||
% There are two problems which we must face:
|
||||
%
|
||||
% \begin{itemize}
|
||||
%
|
||||
% \item The `|\@at|' command which scans the @-command name is (very)
|
||||
% fragile. I could have used |\DeclareRobustCommand| for it (and in
|
||||
% fact I did in an earlier version), but that doesn't help the other
|
||||
% problem at all.
|
||||
%
|
||||
% \item The `name' of the @-command may contain active characters or control
|
||||
% sequences, which will be expanded at the wrong time unless we do
|
||||
% something about it now.
|
||||
%
|
||||
% \end{itemize}
|
||||
%
|
||||
% We must also be careful not to introduce extra space characters into any
|
||||
% files written, because spaces are significant in @-commands. Finally,
|
||||
% we have a minor problem in that most auxiliary files are read in with
|
||||
% the `@@' character set to be a letter.
|
||||
%
|
||||
% \begin{macro}{\at}
|
||||
%
|
||||
% Following the example of \LaTeX's `short' command handling, we'll define
|
||||
% |\at| to decide what to do depending on what |\protect| looks like. If
|
||||
% we're typesetting, we just call |\@at| (above) and expect it to cope.
|
||||
% Otherwise we call |\at@protect|, which scoops up the |\fi| and the |\@at|,
|
||||
% and inserts other magic.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at{\ifx\protect\@typeset@protect\else\at@protect\fi\@at}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\at@protect}
|
||||
%
|
||||
% Since we gobbled the |\fi| from the above, we must put that back. We then
|
||||
% need to do things which are more complicated. If |\protect| is behaving
|
||||
% like |\string|, then we do one sort of protection. Otherwise, we assume
|
||||
% that |\protect| is being like |\noexpand|.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@protect\fi#1{%
|
||||
\fi%
|
||||
\ifx\protect\string%
|
||||
\expandafter\at@protect@string%
|
||||
\else%
|
||||
\expandafter\at@protect@noexpand%
|
||||
\fi%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\at@protect@string}
|
||||
%
|
||||
% When |\protect| is |\string|, we don't need to be able to recover the
|
||||
% original text particularly accurately -- it's for the user to look at.
|
||||
% Therefore, we just output a $|@|_{11}$ and use |\string| on the next
|
||||
% token. This must be sufficient, since we only allow multi-token command
|
||||
% names if the first token is a letter (code~11).
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@protect@string{@\string}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\at@protect@noexpand}
|
||||
%
|
||||
% This is a little more complex, since we're still expecting to be executed
|
||||
% properly at some stage. However, there's a cheeky dodge we can employ
|
||||
% since the |\at| command is thoroughly robustified (or at least it will be
|
||||
% by the time we've finished this). All |\@unexpandable@protect| does
|
||||
% is confer repeated robustness on a fragile command. Since our command
|
||||
% is robust, we don't need this and we can get away with just using a
|
||||
% single |\noexpand|, both for the |\@at@| command and the following token
|
||||
% (which we must robustify, because no-one else can do it for us -- if
|
||||
% anyone tries, they end up using the |@\protect| command which is rather
|
||||
% embarassing).
|
||||
%
|
||||
% I'll give the definition, and then examine how this expands in various
|
||||
% cases.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\at@protect@noexpand{\noexpand\@at@ @\noexpand}
|
||||
\def\@at@#1{\at}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% A few points, before we go into the main examination of the protection.
|
||||
% I've inserted a $|@|_{11}$ token, which is gobbled by |\@at@| when the
|
||||
% thing is finally expanded fully. This prevents following space tokens
|
||||
% in an |\input| file from being swallowed because they follow a control
|
||||
% sequence. (I can't use the normal $|@|_{13}$ token, because when files
|
||||
% like the |.aux| file are read in, |@| is given code~11 by
|
||||
% |\makeatletter|.)
|
||||
%
|
||||
% \setbox0\hbox{|@at@|}
|
||||
% Now for a description of why this works. When |\at| is expanded, it works
|
||||
% out that |\protect| is either |\noexpand| or |\@unexpandable@protect|, and
|
||||
% becomes |\at@protect@noexpand|. Because of the |\noexpand| tokens, this
|
||||
% stops being expanded once it reaches $\fbox{\box0}\,|@|_{11}\,x$ (where
|
||||
% $x$ is the token immediately following the $|@|_{13}$ character). If this
|
||||
% is expanded again, for example in another |\edef|, or in a |\write| or a
|
||||
% |\mark|, the |\@at@| wakes up, gobbles the following |@| (whatever catcode
|
||||
% it is -- there may be intervening |\write| and |\input| commands) and
|
||||
% becomes |\at|, and the whole thing can start over again.
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
%
|
||||
% \subsection{Enabling and disabling @-commands}
|
||||
%
|
||||
% \begin{macro}{\aton}
|
||||
%
|
||||
% We define the |\aton| command to enable all of our magic. We store
|
||||
% the old catcode in the |\atoff| command, make `@@' active, and make it
|
||||
% do the stuff.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\aton{%
|
||||
\ifnum\catcode`\@=\active\else%
|
||||
\edef\atoff{\catcode`\noexpand\@\the\catcode`\@}%
|
||||
\catcode`\@\active%
|
||||
\lccode`\~`\@%
|
||||
\lowercase{\let~\at}%
|
||||
\fi%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\atoff}
|
||||
%
|
||||
% The |\atoff| command makes `@@' do the stuff it's meant to. We remember
|
||||
% the old catcode and revert to it. This is largely unnecessary.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\atoff{\catcode`\@12}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\makeatother}
|
||||
%
|
||||
% Now we make our active `@@' the default outside of package files.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\makeatother\aton
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% And we must make sure that the user can use all of our nice commands.
|
||||
% Once the document starts, we allow @-commands.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\AtBeginDocument{\aton}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \begin{macro}{\dospecials}
|
||||
% \begin{macro}{\@sanitize}
|
||||
%
|
||||
% We must add the `@@' character to the various specials lists.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\expandafter\def\expandafter\dospecials\expandafter{\dospecials\do\@}
|
||||
\expandafter\def\expandafter\@sanitize\expandafter{%
|
||||
\@sanitize\@makeother\@}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
%
|
||||
% \subsection{Default @-commands}
|
||||
%
|
||||
% We define some trivial examples to get the user going.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\expandafter\chardef\csname at.@\endcsname=`\@
|
||||
\atdef*#1*{\ifmmode\mathbf{#1}\else\textbf{#1}\fi}
|
||||
\atdef/#1/{\ifmmode\mathit{#1}\else\emph{#1}\fi}
|
||||
\atlet i=\index
|
||||
\atdef I#1{#1\index{#1}}
|
||||
%</package>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \hfill Mark Wooding, \today
|
||||
%
|
||||
% \Finale
|
||||
%
|
||||
\endinput
|
523
docs/packages/mdwtools/cmtt.dtx
Normal file
523
docs/packages/mdwtools/cmtt.dtx
Normal file
@ -0,0 +1,523 @@
|
||||
% \begin{meta-comment}
|
||||
%
|
||||
% $Id$
|
||||
%
|
||||
% Nicer handling of the Computer Modern Typewriter font
|
||||
%
|
||||
% (c) 1996 Mark Wooding
|
||||
%
|
||||
%----- Revision history -----------------------------------------------------
|
||||
%
|
||||
% $Log$
|
||||
% Revision 1.1 1998-09-21 10:19:01 michael
|
||||
% Initial implementation
|
||||
%
|
||||
% Revision 1.1 1996/11/19 20:47:55 mdw
|
||||
% Initial revision
|
||||
%
|
||||
%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \begin{meta-comment} <general public licence>
|
||||
%%
|
||||
%% mdwlist package -- various list-related things
|
||||
%% 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} <Package preambles>
|
||||
%<+sty>\NeedsTeXFormat{LaTeX2e}
|
||||
%<+sty>\ProvidesPackage{cmtt}
|
||||
%<+fd>\ProvidesFile{mTTcmtt.fd}
|
||||
%<+def>\ProvidesFile{mTTcmtt.def}
|
||||
%<+sty|fd|def> [1996/05/25 1.1 Handing of the cmtt font]
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% ^^A \CheckSum{174}
|
||||
%% \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 \~}
|
||||
%%
|
||||
%
|
||||
% \begin{meta-comment}
|
||||
%
|
||||
%<*driver>
|
||||
\input{mdwtools}
|
||||
\describespackage{cmtt}
|
||||
\mdwdoc
|
||||
%</driver>
|
||||
%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
%^^A-------------------------------------------------------------------------
|
||||
% \section{Introductory note}
|
||||
%
|
||||
% \LaTeX\ has a rather cunning encoding handling system, which makes funny
|
||||
% commands like accents work properly independent of the current font's
|
||||
% actual layout. While this works rather well most of the time, the standard
|
||||
% \mtt{tt} font has been rather left out of things. \LaTeX\ assumes that
|
||||
% the Computer Modern Typewriter fonts have exactly the same layout as the
|
||||
% more normal Computer Modern Roman family (i.e., that both conform to the
|
||||
% \mtt{OT1} encoding). This plainly isn't true, since the Typewriter font
|
||||
% contains a bunch of standard ASCII characters which are omitted from the
|
||||
% standard Computer Modern fonts, such as curly braces \mtt{\{} and \mtt{\}},
|
||||
% and the backslash \mtt{\\}; these are usually dug up from the maths fonts,
|
||||
% which looks fine in normal text, but looks really odd in monospace text.
|
||||
% Compare `\texttt{\textbackslash begin\{document\}}' to
|
||||
% `\mtt{\\begin\{document\}}', for example.
|
||||
%
|
||||
% There are two possibilities for dealing with this problem. One is to use
|
||||
% the \mtt{\\verb} command, which works since all the extra characters in
|
||||
% the Typewriter font are in the correct places, or use the DC~fonts, which
|
||||
% have a proper encoding set up which contains all of these special
|
||||
% characters anyway.
|
||||
%
|
||||
% Neither of these solutions is perfect. Using \mtt{\\verb} causes all
|
||||
% manner of little niggly problems: you can't use it in footnotes or
|
||||
% section headings, for example. (There are of course workarounds for this
|
||||
% sort of thing: the author's \package{footnote} package provides a
|
||||
% \env{footnote} environment which will allow verbatim text, and verbatim
|
||||
% text in section headings can be achieved if one is sufficiently
|
||||
% \TeX nical.) Using the DC~fonts is fine, although you actually lose a
|
||||
% glyph or two. As far as the author is aware, the character \mtt{\'} (an
|
||||
% `unsexed' single quote) is not present in the \mtt{T1}-encoded version of
|
||||
% Computer Modern Typewriter, although it is hidden away in the original
|
||||
% version. The author has found a need for this character in computer
|
||||
% listings, and was horrified to discover that it was replaced by a German
|
||||
% single quote character (\mtt{\\quotesinglbase}).
|
||||
%
|
||||
% This package defines a special encoding for the Computer Modern Typewriter
|
||||
% font, so that documents can take advantage of its ASCII characters without
|
||||
% resorting to verbatim text. (The main advantage of the DC~fonts, that
|
||||
% words containing accents can be hyohenated, doesn't really apply to the
|
||||
% Typewriter font, since it doesn't allow hyphenation by default anyway.)
|
||||
%
|
||||
% There are several files you'll need to create:
|
||||
% \begin{description} \def\makelabel#1{\hskip\labelsep\mttfamily#1\hfil}
|
||||
%
|
||||
% \item [cmtt.sty] tells \LaTeX\ that there's a new encoding. It also
|
||||
% provides some options for customising some aspects of the
|
||||
% encoding, and defines some useful commands.
|
||||
%
|
||||
% \item [mTTenc.def] describes the encoding to \LaTeX: it sets up all the
|
||||
% appropriate text commands so that they produce beautiful results.
|
||||
%
|
||||
% \item [mTTcmtt.fd] describes the re-encoded version of the font. This
|
||||
% is more or less a copy of the file \mtt{OT1cmtt.fd}.
|
||||
%
|
||||
% \end{description}
|
||||
%
|
||||
% The package accepts some options which may be useful:
|
||||
% \begin{description} \def\makelabel#1{\hskip\labelsep\sffamily#1\hfil}
|
||||
%
|
||||
% \item [override] overrides the meaning of the \mtt{\\ttfamily} command
|
||||
% (and therefore also the \mtt{\\texttt} command too), making it the
|
||||
% same as the new \mtt{\\mttfamily} command. This isn't the default
|
||||
% just in case the change breaks something in an unexpected way.
|
||||
%
|
||||
% \item [t1] informs the package that you're using the \mtt{T1} encoding,
|
||||
% and therefore can borrow some accented characters from the DC~version
|
||||
% of Computer Modern Typewriter. This will probably be unnecessary,
|
||||
% since the package attempts to work out what to do all by itself.
|
||||
%
|
||||
% \item [ot1] forces the package \emph{not} to use the DC~version of the
|
||||
% Computer Modern Typewriter font for funny accents. Only use this
|
||||
% option if the package thinks it should use the DC~Typewriter font
|
||||
% when it shouldn't.
|
||||
%
|
||||
% \end{description}
|
||||
%
|
||||
% \DescribeMacro{\mttfamily}
|
||||
% The command \mtt{\\mttfamily} selects the properly-encoded Typewriter
|
||||
% font. It's a declaration which works just like the \mtt{\\ttfamily}
|
||||
% command, except that comamnds like \mtt{\\\}} and \mtt{\\\_} use the
|
||||
% characters from the font rather than choosing odd-looking versions from
|
||||
% the maths fonts. All of the accent commands still work properly. In fact,
|
||||
% some accent commands which didn't work before have been fixed. For
|
||||
% example, saying `\mtt{\\texttt\{P\\'al Erd\\H os\}}' would produce
|
||||
% something truly appalling like `\texttt{P\'al Erd\H os}', which is
|
||||
% obviously ghastly. The new encoding handles this properly, and produces
|
||||
% `\textmtt{P\'al Erd\H os}'.\footnote{
|
||||
% This isn't quite perfect. The accent, which isn't actually present in
|
||||
% the Typewriter font, is taken from the Computer Modern bold font, but
|
||||
% it doesn't look too bad. However, if you pass the option \textsf{t1}
|
||||
% to the \package{cmtt} package when you load it, the accent will be taken
|
||||
% from the DC~Typewriter font, and it will look totally wonderful.}
|
||||
%
|
||||
% \DescribeMacro{\textmtt}
|
||||
% Font changing commands are much more convenient than th declarations,
|
||||
% so a command \mtt{\\textmtt} is provided: it just typesets its argument
|
||||
% in the re-encoded Typewriter font.
|
||||
%
|
||||
% \DescribeMacro{\mtt}
|
||||
% Rather more excitingly, the \mtt{\\mtt} command allows you to generate
|
||||
% almost-verbatim text very easily, without any of the restrictions of
|
||||
% the \mtt{\\verb} command. This command was inspired by something which
|
||||
% David Carlisle said to me in an email correspondence regarding the
|
||||
% overuse of verbatim commands.
|
||||
%
|
||||
% \mtt{\\mtt} redefines several `short' commands to typeset the obvious
|
||||
% characters. The complete list is shown below: there are some oddities,
|
||||
% so watch out.
|
||||
%
|
||||
% ^^A This is an evil table. See if I care. (This is based on lots of
|
||||
% ^^A hacking I did in glyphs.tex, but a good deal less horrible.)
|
||||
%
|
||||
% \medskip
|
||||
% \hbox to \hsize\bgroup
|
||||
% \hfil\vbox\bgroup
|
||||
% \def\ex#1#2{\strut
|
||||
% \enskip
|
||||
% \mtt{\\\char`#2}\quad\hfil%
|
||||
% \mtt{#2}\enskip}
|
||||
% \def\h{\noalign{\hrule}}
|
||||
% \def\v{height2pt&\omit&&\omit&&\omit&&\omit&&\omit&\cr}
|
||||
% \let~\relax
|
||||
% \offinterlineskip
|
||||
% \ialign\bgroup&\vrule#&\ex#\cr \h\v
|
||||
% &~\\&&~\{&&~\}&&~\_&&~\^&\cr \v\h\v
|
||||
% &~\$&&~\%&&~\&&&~\#&&~\~&\cr \v\h\v
|
||||
% &~\"&&~\'&&~\ &&~\|&&\omit\hfil&\cr \v\h
|
||||
% \egroup\egroup
|
||||
% \hfil\egroup
|
||||
% \medskip
|
||||
%
|
||||
% As well as redefining these commands, \mtt{\\mtt} will endeavour to make
|
||||
% single special characters display themselves in a verbatim-like way. This
|
||||
% only works on `active' characters (like \mtt{~}), and \mtt{\\mtt} makes
|
||||
% no attempt to change the category codes of any characters.
|
||||
%
|
||||
% Among other things, you'll probably noticed that several accent-making
|
||||
% commands have been redefined. You can still use these accents through
|
||||
% the \mtt{\\a} command, by saying \mtt{\\a'}, \mtt{\\a\^} and so on,
|
||||
% as in the \env{tabbing} environment.
|
||||
%
|
||||
% There are also some oddities in the table: \mtt{\|} and \mtt{\"} can be
|
||||
% accessed easily without playing with silly commands. Well, that's almost
|
||||
% the case: these two characters are both often used as `short' verbatim
|
||||
% commands, so they are forced back to their normal meanings so you can
|
||||
% type them.
|
||||
%
|
||||
% Finally, a word on spacing. The \mtt{\\\ } command has been hijacked
|
||||
% to produce a funny `visible space' character. You can still produce
|
||||
% multiple spaces by saying something like `\mtt{\ \{\}\ \{\}}\dots\mtt{\ }',
|
||||
% which is a bit contrived, but that's tough. Also, \mtt{~} has been stolen
|
||||
% so that you can type \mtt{~} characters (e.g., in URLs), so the only
|
||||
% way you can tpye a nonbreaking space is by using the \mtt{\\nobreakspace}
|
||||
% command, which is a bit of a mouthful. There's an abbreviation, though:
|
||||
% \mtt{\\nbsp} now means exactly the same thing.
|
||||
%
|
||||
% Was that not all supremely useful? Oh, just a note: this document doesn't
|
||||
% use a single verbatim command or environment (except in the listings,
|
||||
% where it's unavoidable) -- it's all done with \mtt{\\mtt}.
|
||||
%
|
||||
% \implementation
|
||||
%
|
||||
% \section{Implementation}
|
||||
%
|
||||
% \subsection{The package}
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%<*sty>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% I'll start with some options handling.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\newif\ifcmtt@override
|
||||
\newif\ifcmtt@dcfonts
|
||||
\def\@tempa{T1}\ifx\encodingdefault\@tempa
|
||||
\cmtt@dcfontstrue
|
||||
\fi
|
||||
\DeclareOption{override}{\cmtt@overridetrue}
|
||||
\DeclareOption{t1}{\cmtt@dcfontstrue}
|
||||
\DeclareOption{ot1}{\cmtt@dcfontsfalse}
|
||||
\ProcessOptions
|
||||
% \end{macrocode}
|
||||
%
|
||||
% This bit is really trivial. I'll just declare the font encoding. Oh, that
|
||||
% was easy.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\DeclareFontEncoding{mTT}{}{}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Wait: there's a problem. \LaTeX\ will now complain bitterly that it can't
|
||||
% find the font \mtt{mTT/cmr/m/n}, which is readonable, since I haven't
|
||||
% declared any such font. The following line should sort this out,
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\DeclareFontSubstitution{mTT}{cmtt}{m}{n}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now I'd better load all the text commands I'll need when in this funny
|
||||
% font variant.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\input{mTTenc.def}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \begin{macro}{\mttfamily}
|
||||
% \begin{macro}{\textmtt}
|
||||
%
|
||||
% Finally, I'll need to define a command which switches to this funny font,
|
||||
% and a \mtt{\\text}\dots\ command for it.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\DeclareRobustCommand{\mttfamily}{%
|
||||
\fontencoding{mTT}\fontfamily{\ttdefault}\selectfont%
|
||||
}
|
||||
\DeclareTextFontCommand{\textmtt}{\mttfamily}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
%
|
||||
% If an override was requested, make \mtt{\\ttfamily} the same as
|
||||
% \mtt{\\mttfamily}.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\ifcmtt@override
|
||||
\let\ttfamily\mttfamily
|
||||
\fi
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Well, that's all that's needed for the font definition. Here's a command
|
||||
% which will typeset its argument in the typewriter font, allowing easy
|
||||
% access to all the funny characters, and printing them properly in the
|
||||
% correct font (which \mtt{\\\{} doesn't do, for example).
|
||||
%
|
||||
% \begin{macro}{\mtt@setchar}
|
||||
%
|
||||
% This macro assigns the given meaning to the given control sequence. Also,
|
||||
% if the character named in the control sequence is currently set active,
|
||||
% it will set the active meaning of the character to the same value.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\mtt@setchar#1#2{%
|
||||
\ifx#1#2\chardef#1`#1\else\let#1#2\fi%
|
||||
\ifnum\catcode`#1=13%
|
||||
\begingroup%
|
||||
\lccode`\~=`#1%
|
||||
\lowercase{\endgroup\let~#1}%
|
||||
\fi%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\mtt@chars}
|
||||
%
|
||||
% This macro lists the various control sequences which should be set up,
|
||||
% so that they can be easily added to.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\mtt@chars{%
|
||||
\do\#\#%
|
||||
\do\%\%%
|
||||
\do\&\&%
|
||||
\do\^\^%
|
||||
\do\~\~%
|
||||
\do\'\textquotesingl%
|
||||
\do\"\textquotedbl%
|
||||
\do\|\textbar%
|
||||
\do\$\textdollar%
|
||||
\do\_\textunderscore%
|
||||
\do\{\textbraceleft%
|
||||
\do\}\textbraceright%
|
||||
\do\\\textbackslash%
|
||||
\do\ \textvisiblespace%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\mtt@do}
|
||||
%
|
||||
% This just sets up all the special characters listed above. It's a simple
|
||||
% abbreviation, really.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\mtt@do{\let\do\mtt@setchar\mtt@chars}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\mtt}
|
||||
%
|
||||
% And finally, the macro itself. Ta-da!
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\DeclareRobustCommand\mtt[1]{\textmtt{\mtt@do#1}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\@tabacckludge}
|
||||
%
|
||||
% The otherwise almost totally perfect \mtt{\\@tabacckludge} gets very
|
||||
% upset when its argument is an active character. (If you're wondering,
|
||||
% this is the command which is responsible for the behaviour of the \mtt{\\a}
|
||||
% command.) Adding a \mtt{\\string} makes everything work perfectly.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\@tabacckludge#1{%
|
||||
\expandafter\@changed@cmd\csname\string#1\endcsname\relax%
|
||||
}
|
||||
\let\a\@tabacckludge
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\nbsp}
|
||||
%
|
||||
% Make an abbreviation for \mtt{\\nobreakspace}.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\nbsp\nobreakspace
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% I think that's all that I have to do for the package. If there's any
|
||||
% more to do, I'll add it later.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%</sty>
|
||||
% \end{macrocode}
|
||||
%
|
||||
%
|
||||
% \subsection{The font definition file}
|
||||
%
|
||||
% This is obviously copied almost verbatim from the file \mtt{OT1cmtt.fd}.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%<*fd>
|
||||
\DeclareFontFamily{mTT}{cmtt}{\hyphenchar\font\m@ne}
|
||||
\DeclareFontShape{mTT}{cmtt}{m}{n}{
|
||||
<5> <6> <7> <8> cmtt8
|
||||
<9> cmtt9
|
||||
<10> <10.95> cmtt10
|
||||
<12> <14.4> <17.28> <20.74> <24.88> cmtt12
|
||||
}{}
|
||||
\DeclareFontShape{mTT}{cmtt}{m}{it}{
|
||||
<5> <6> <7> <8> <9> <10> <10.95> <12> <14.4> <17.28> <20.74> <24.88>
|
||||
cmitt10
|
||||
}{}
|
||||
\DeclareFontShape{mTT}{cmtt}{m}{sl}{
|
||||
<5> <6> <7> <8> <9> <10> <10.95> <12> <14.4> <17.28> <20.74> <24.88>
|
||||
cmsltt10
|
||||
}{}
|
||||
\DeclareFontShape{mTT}{cmtt}{m}{sc}{
|
||||
<5> <6> <7> <8> <9> <10> <10.95> <12> <14.4> <17.28> <20.74> <24.88>
|
||||
cmtcsc10
|
||||
}{}
|
||||
\DeclareFontShape{mTT}{cmtt}{m}{ui} {<->sub * cmtt/m/it} {}
|
||||
\DeclareFontShape{mTT}{cmtt}{bx}{n} {<->sub * cmtt/m/n} {}
|
||||
\DeclareFontShape{mTT}{cmtt}{bx}{it} {<->sub * cmtt/m/it} {}
|
||||
\DeclareFontShape{mTT}{cmtt}{bx}{ui} {<->sub * cmtt/m/it} {}
|
||||
%</fd>
|
||||
% \end{macrocode}
|
||||
%
|
||||
%
|
||||
% \subsection{The encoding definitions file}
|
||||
%
|
||||
% I've saved the trickiest bit until last. This file defines the mappings
|
||||
% from text commands to glyphs in the font.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%<*def>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% First for some fun with accents. The |cmtt| font doesn't contain all of
|
||||
% the accents which the other Computer Modern fonts do, because those slots
|
||||
% contain the standard ASCII characters which usually have to be `borrowed'
|
||||
% from the maths fonts.
|
||||
%
|
||||
% Anyway, there's a load which don't need any special treatment. These are
|
||||
% chosen from the \mtt{OT1} encoding by default anyway, so I needn't
|
||||
% bother unless I'm really bothered about speed. I'm not, so I'll save
|
||||
% the memory.
|
||||
%
|
||||
% Following the example of the \TeX book, I'll use the bold roman font
|
||||
% for accents, so that they don't look really spindly. This is actually
|
||||
% remarkably difficult to do, because the \textsf{NFSS} keeps getting in
|
||||
% the way. I'll look after the old font name in a macro (it's handy that
|
||||
% \textsf{NFSS} maintains this for me) and change to a known font, do the
|
||||
% accent, change font back again, do the argument to the accent, and then
|
||||
% close the group I did all of this in, so that no-one else notices what a
|
||||
% naughty chap I am, really. This is startlingly evil.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\cmtt@accent#1#2{{%
|
||||
\let\@old@font\font@name%
|
||||
\ifcmtt@dcfonts%
|
||||
\fontencoding{T1}\selectfont%
|
||||
\else%
|
||||
\usefont{OT1}{cmr}{bx}{n}%
|
||||
\fi%
|
||||
#1{\@old@font#2}%
|
||||
}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% And now for the actual offending accents.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\DeclareTextCommand{\H}{mTT}{\cmtt@accent\H}
|
||||
\DeclareTextCommand{\.}{mTT}{\cmtt@accent\.}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% The `under' accents are all OK, so I shan't bother to define them either.
|
||||
% Similarly, lots of the text symbol commands are fine as they are by
|
||||
% default and I don't need to try and define them again.
|
||||
%
|
||||
% This, then, is the remaining commands which really need sorting out.
|
||||
% (By the way, the only reason I've redefined \mtt{\\textellipsis} is
|
||||
% because otherwise it will mess up the nice monospacing.)
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\DeclareTextSymbol{\textbackslash}{mTT}{92}
|
||||
\DeclareTextSymbol{\textbar}{mTT}{124}
|
||||
\DeclareTextSymbol{\textbraceleft}{mTT}{123}
|
||||
\DeclareTextSymbol{\textbraceright}{mTT}{125}
|
||||
\DeclareTextSymbol{\textless}{mTT}{60}
|
||||
\DeclareTextSymbol{\textgreater}{mTT}{62}
|
||||
\DeclareTextSymbol{\textunderscore}{mTT}{95}
|
||||
\DeclareTextSymbol{\textvisiblespace}{mTT}{32}
|
||||
\DeclareTextCommand{\textellipsis}{mTT}{...}
|
||||
\DeclareTextSymbol{\textquotedbl}{mTT}{34}
|
||||
\DeclareTextSymbol{\textquotesingl}{mTT}{13}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% That's all there is. Please return to your homes.
|
||||
%
|
||||
% \Finale
|
||||
%
|
||||
\endinput
|
519
docs/packages/mdwtools/doafter.dtx
Normal file
519
docs/packages/mdwtools/doafter.dtx
Normal file
@ -0,0 +1,519 @@
|
||||
% \begin{meta-comment}
|
||||
%
|
||||
% $Id$
|
||||
%
|
||||
% Insert tokens to be read after a group has been processed
|
||||
%
|
||||
% (c) 1996 Peter Schmitt and Mark Wooding
|
||||
%
|
||||
%----- Revision history -----------------------------------------------------
|
||||
%
|
||||
% $Log$
|
||||
% Revision 1.1 1998-09-21 10:19:01 michael
|
||||
% Initial implementation
|
||||
%
|
||||
% Revision 1.2 1996/11/19 20:49:08 mdw
|
||||
% Entered into RCS
|
||||
%
|
||||
%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \begin{meta-comment} <general public licence>
|
||||
%%
|
||||
%% doafter package -- insert a token really after a group
|
||||
%% Copyright (c) 1996 Peter Schmitt and Mark Wooding
|
||||
%<*package>
|
||||
%%
|
||||
%% 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.
|
||||
%</package>
|
||||
%%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \begin{meta-comment} <Package preamble>
|
||||
%<+latex2e>\NeedsTeXFormat{LaTeX2e}
|
||||
%<+latex2e>\ProvidesPackage{doafter}
|
||||
%<+latex2e> [1996/05/08 1.2 Aftergroup hacking (PS/MDW)]
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \CheckSum{259}
|
||||
%\iffalse
|
||||
%<*package>
|
||||
%\fi
|
||||
%% \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 \~}
|
||||
%%
|
||||
%\iffalse
|
||||
%</package>
|
||||
%\fi
|
||||
%
|
||||
% \begin{meta-comment} <driver>
|
||||
%
|
||||
%<*driver>
|
||||
\input{mdwtools}
|
||||
\describespackage{doafter}
|
||||
\author{Peter Schmitt\thanks{%
|
||||
Peter came up with the basic implementation after I posed the problem
|
||||
in the \texttt{comp.text.tex} newsgroup. I fixed some really piddly little
|
||||
things, to improve it a bit, wrote the documentation, and turned the code
|
||||
into a nice \package{doc}ced package. Then Peter gave me an updated
|
||||
version, and I upgraded this from memory. Then he gave me some more tweaks
|
||||
which I haven't incorporated.}
|
||||
\and Mark Wooding}
|
||||
\def\author#1{}
|
||||
\mdwdoc
|
||||
%</driver>
|
||||
%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \section{Description}
|
||||
%
|
||||
% \subsection{What it's all about}
|
||||
%
|
||||
% \DescribeMacro{\doafter}
|
||||
% It's common for the \TeX\ primitive |\aftergroup| to be used to `tidy up'
|
||||
% after a group. For example, \LaTeX's colour handling uses this to insert
|
||||
% appropriate |\special|s when the scope of a colour change ends. This
|
||||
% causes several problems, though; for example, extra grouping must be added
|
||||
% within boxes to ensure that the |\special|s don't `leak' out of their box
|
||||
% and appear in odd places in the document. \LaTeX\ usually solves this
|
||||
% problem by reading the box contents as an argument, although this isn't
|
||||
% particularly desirable. The |\doafter| macro provided here will solve the
|
||||
% problem in a different way, by allowing a macro to regain control after
|
||||
% all the |\aftergroup| things have been processed.
|
||||
%
|
||||
% The macro works like this:
|
||||
% \begin{grammar}
|
||||
% <doafter-cmd> ::= \[[
|
||||
% "\\doafter" <token> <group>
|
||||
% \]]
|
||||
% \end{grammar}
|
||||
% The \<token> can be any token you like, except an explicit braces, since
|
||||
% it's read as an undelimited macro argument. The \<group> is a normal
|
||||
% \TeX\ group, surrounded by either implicit or explicit braces, or by
|
||||
% |\begingroup| and |\endgroup| tokens. Once the final closing token of the
|
||||
% \<group> is read, and any tokens saved up by |\aftergroup| have been
|
||||
% processed, the \<token> is inserted and processed. Under normal
|
||||
% circumstances, this will be a macro.
|
||||
%
|
||||
% There are some subtle problems with the current implementation, which you
|
||||
% may need to be aware of:
|
||||
%
|
||||
% \begin{itemize}
|
||||
%
|
||||
% \item Since we're inserting things after all the |\aftergroup| tokens,
|
||||
% those tokens might read something they're not expecting if they try
|
||||
% to look ahead at the text after the group (e.g., with |\futurelet|).
|
||||
% This is obviously totally unavoidable.
|
||||
%
|
||||
% \item Implicit braces (like |\bgroup| and |\egroup|) inserted using
|
||||
% |\aftergroup| may be turned into \emph{explicit} $|{|_1$ and $|}|_2$
|
||||
% characters within a |\doafter| group. This can cause probems under
|
||||
% very specialised circumstances. The names |\bgroup| and |\egroup|
|
||||
% are treated specially, and they will work normally (remaining as
|
||||
% implicit braces). This should minimise problems caused by this
|
||||
% slight difference. (This only applies to the last |\aftergroup|
|
||||
% token in a group.)
|
||||
%
|
||||
% \item To handle the |\aftergroup| tokens properly, |\doafter| has to insert
|
||||
% some |\aftergroup| tokens of its own. It will then process the
|
||||
% other tokens some more, and set them up to be read again. This does
|
||||
% mean that after the group ends, some assignments and other `stomach
|
||||
% operations' will be performed, which may cause problems in
|
||||
% alignments and similar places.
|
||||
%
|
||||
% \end{itemize}
|
||||
%
|
||||
%
|
||||
% \subsection{Package options}
|
||||
%
|
||||
% There are a fair few \textsf{docstrip} options provided by this packge:
|
||||
%
|
||||
% \begin{description}
|
||||
% \item [driver] extracts the documentation driver. This isn't usually
|
||||
% necessary.
|
||||
% \item [package] extracts the code as a standalone package, formatted for
|
||||
% either \LaTeXe\ or Plain~\TeX.
|
||||
% \item [latex2e] inserts extra identification code for a \LaTeXe\ package.
|
||||
% \item [plain] inserts some extra code for a Plain \TeX\ package.
|
||||
% \item [macro] just extracts the raw code, for inclusion in another package.
|
||||
% \item [test] extracts some code for testing the current implementation.
|
||||
% \end{description}
|
||||
%
|
||||
%
|
||||
% \implementation
|
||||
%
|
||||
% \section{Implementation}
|
||||
%
|
||||
% \subsection{The main macro}
|
||||
%
|
||||
% We start outputting code here. If this is a Plain~\TeX\ package, we must
|
||||
% make \lit{@} into a letter.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%<*macro|package>
|
||||
%<+plain>\catcode`\@=11
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \begin{macro}{\doafter}
|
||||
%
|
||||
% The idea is to say \syntax{"\\doafter" <token> <group>} and expect the
|
||||
% \synt{token} to be processed after the group has finished its stuff,
|
||||
% even if it contains |\aftergroup| things. My eternal gratitude goes to
|
||||
% Peter Schmitt, who came up with most of the solution implemented here;
|
||||
% I've just tidied up some very minor niggles and things later.
|
||||
%
|
||||
% Let's start with some preamble. I'll save the (hopefully) primitive
|
||||
% |\aftergroup| in a different token.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\@@aftergroup\aftergroup
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now to define the `user' interface. It takes a normal undelimited
|
||||
% argument, although this must be a single token; otherwise eveything will
|
||||
% go wrong. It assumes that the token following is some kind of group
|
||||
% opening thing (an explicit or implicit character with catcode~1, or
|
||||
% a |\begingroup| token). To make this work, I'll save the token,
|
||||
% together with an |\@@aftergroup| (to save an |\expandafter| later) in
|
||||
% a temporary macro which no-one will mind me using, and then look ahead at
|
||||
% the beginning-group token.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\doafter#1{%
|
||||
\def\@tempa{\@@aftergroup#1}%
|
||||
\afterassignment\doafter@i\let\@let@token%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% I now have the token in |\@let@token|, so I'll put that in. I'll then
|
||||
% make |\aftergroup| do my thing rather than the normal thing, and queue
|
||||
% the tokens |\@prepare@after| and the |\doafter| argument for later use.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\doafter@i{%
|
||||
\@let@token%
|
||||
\let\aftergroup\@my@aftergroup%
|
||||
\@@aftergroup\@prepare@after\@tempa%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\@my@aftergroup}
|
||||
%
|
||||
% Now the cleverness begins. We keep two macros (Peter's original used
|
||||
% count registers) which keep counts of the numbers of |\aftergroup|s,
|
||||
% both locally and globally. Let's call the local counter~$n$ and the
|
||||
% global one $N$. Every time we get a call to our |\aftergroup| hack,
|
||||
% we set~$n := n+1$ and~$N := n$, and leave the token given to us for later
|
||||
% processing. When we actually process an |\aftergroup| token properly,
|
||||
% set~$N := N-1$ to indicate that it's been handled; when they're all done,
|
||||
% we'll have $N=n$, which is exactly what we'd have if there weren't any
|
||||
% to begin with.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\ag@cnt@local{0 }
|
||||
\let\ag@cnt@global\ag@cnt@local
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now we come to the definition of my version of |\aftergroup|. I'll just
|
||||
% add the token |\@after@token| before every |\aftergroup| token I find.
|
||||
% This means there's two calls to |\aftergroup| for every one the user makes,
|
||||
% but these things aren't all that common, so it's OK really. I'll also
|
||||
% bump the local counter, and synchronise them.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\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%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% Now what does |\@after@token| we inserted above actually do? Well, this
|
||||
% is more exciting. There are actually two different variants of the
|
||||
% macro, which are used at different times.
|
||||
%
|
||||
% \begin{macro}{\@after@token}
|
||||
%
|
||||
% The default |\@after@token| starts a group, which will `catch'
|
||||
% |\aftergroup| tokens which I throw at it. I put the two counters into
|
||||
% some scratch count registers. (There's a slight problem here: Plain \TeX\
|
||||
% only gives us one. For the sake of evilness I'll use |\clubpenalty| as the
|
||||
% other one. Eeeek.) I then redefine |\@after@token| to the second
|
||||
% variant, and execute it. The |\@start@after@group| macro starts the
|
||||
% group, because this code is shared with |\@prepare@after| below.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\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%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\@after@token@i}
|
||||
%
|
||||
% I have $|\count@| = N$ and $|\@tempcnta| = n$. I'll decrement~$N$,
|
||||
% and if I have $N = n$, I know that this is the last token to do, so I
|
||||
% must insert an |\@after@all| after the token. This will close the group,
|
||||
% and maybe insert the original |\doafter| token if appropriate.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\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%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Finally, establish a default meaning for |\@after@all|.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\@after@all\endgroup
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\@prepare@after}
|
||||
%
|
||||
% If this group is handled by |\doafter|, then the first |\aftergroup| token
|
||||
% isn't |\@after@token|; it's |\@prepare@after|.
|
||||
%
|
||||
% There are some extra cases to deal with:
|
||||
% \begin{itemize}
|
||||
% \item If $N=n$ then there were no |\aftergroup| tokens, so we have an easy
|
||||
% job. I'll just let the token do its stuff directly.
|
||||
% \item Otherwise, $N>n$, and there are |\aftergroup| tokens. I'll open
|
||||
% the group, and let |\@after@token| do all the handling.
|
||||
% \end{itemize}
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\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}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\@after@aftertoken}
|
||||
%
|
||||
% This is where all the difficulty lies. The next token in the stream is
|
||||
% an |\aftergroup| one, which could be more or less anything. We have an
|
||||
% argument, which is some code to do \emph{after} the token has been
|
||||
% |\aftergroup|ed.
|
||||
%
|
||||
% If the token is anything other than a brace (i.e., an explicit character
|
||||
% of category~1 or~2) then I have no problem; I can scoop up the token with
|
||||
% an undelimited macro argument. But the only way I can decide if this token
|
||||
% is a brace (nondestructively) is with |\futurelet|, which makes the token
|
||||
% implicit, so I can't decide whether it's really dangerous.
|
||||
%
|
||||
% There is a possible way of doing this\footnote{Due to Peter Schmitt,
|
||||
% again.} which relates to nobbling the offending token with |\string| and
|
||||
% sifting through the results. The problem here involves scooping up all the
|
||||
% tokens of a |\string|ed control sequence, which may turn out to be
|
||||
% `|\csname\endcsname|' or something equally horrid.
|
||||
%
|
||||
% The solution I've used is much simpler: I'll change |\bgroup| and |\egroup|
|
||||
% to stop them from being implicit braces before comparing.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\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%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
%
|
||||
% Phew!
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%<+plain>\catcode`\@=12
|
||||
%</macro|package>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsection{Test code}
|
||||
%
|
||||
% The following code gives |\doafter| a bit of a testing. It's based on
|
||||
% the test suite I gave to comp.text.tex, although it's been improved a
|
||||
% little since then.
|
||||
%
|
||||
% The first thing to do is define a control sequence with an \lit{@} sign
|
||||
% in its name, so we can test catcode changes. This also hides an
|
||||
% |\aftergroup| within a macro, making life more difficult for prospective
|
||||
% implementations.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%<*test>
|
||||
\catcode`\@=11
|
||||
\def\at@name{\aftergroup\saynine}
|
||||
\def\saynine{\say{ix}}
|
||||
\catcode`\@=12
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now define a command to write a string to the terminal. The name will
|
||||
% probably be familiar to REXX hackers.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\say{\immediate\write16}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Test one: This is really easy; it just tests that the thing works at all.
|
||||
% If your implementation fails this, it's time for a major rethink.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\say{Test one... (1--2)}
|
||||
\def\saytwo{\say{ii}}
|
||||
\doafter\saytwo{\say{i}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Test two: Does |\aftergroup| work?
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\say{Test two... (1--4)}
|
||||
\def\saythree{\say{iii}}
|
||||
\def\sayfour{\say{iv}}
|
||||
\doafter\sayfour{\say{i}\aftergroup\saythree\say{ii}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Test three: Test braces and |\iffalse| working as they should. Several
|
||||
% proposed solutions based on |\write|ing the group to a file get upset by
|
||||
% this test, although I forgot to include it in the torture test. It also
|
||||
% tests whether literal braces can be |\aftergroup|ed properly. (Added a new
|
||||
% test here, making sure that |\bgroup| is left as an implicit token.)
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\say{Test three... (1--4, `\string\bgroup', 5)}
|
||||
\def\sayfive{\say{v}}
|
||||
\doafter\sayfive{%
|
||||
\say{i}%
|
||||
\aftergroup\say%
|
||||
\aftergroup{%
|
||||
\aftergroup\romannumeral\aftergroup3%
|
||||
\aftergroup}%
|
||||
\iffalse}\fi%
|
||||
\aftergroup\def%
|
||||
\aftergroup\sayfouretc%
|
||||
\aftergroup{%
|
||||
\aftergroup\say%
|
||||
\aftergroup{%
|
||||
\aftergroup i%
|
||||
\aftergroup v%
|
||||
\aftergroup}%
|
||||
\aftergroup\say%
|
||||
\aftergroup{%
|
||||
\aftergroup\string%
|
||||
\aftergroup\bgroup%
|
||||
\aftergroup}%
|
||||
\aftergroup}%
|
||||
\aftergroup\sayfouretc%
|
||||
\say{ii}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Test four: Make sure the implementation isn't leaking things. This just
|
||||
% makes sure that |\aftergroup| is its normal reasonable self.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\say{Test four... (1--3)}
|
||||
{\say{i}\aftergroup\saythree\say{ii}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Test five: Nesting, aftergroup, catcodes, grouping. This is the `torture'
|
||||
% test I gave to comp.text.tex, slightly corrected (oops) and amended. It
|
||||
% ensures that nested groups and |\doafter|s work properly (the latter is
|
||||
% actually more likely than might be imagined).
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\say{Test five... (1--14)}
|
||||
\def\sayten{\say{x}}
|
||||
\def\saythirteen{\say{xiii}}
|
||||
\def\sayfourteen{\say{xiv}}
|
||||
\doafter\sayfourteen\begingroup%
|
||||
\say{i}%
|
||||
{\say{ii}\aftergroup\sayfour\say{iii}}%
|
||||
\def\saynum{\say{viii}}%
|
||||
\doafter\sayten{%
|
||||
\say{v}%
|
||||
\def\saynum{\say{vii}}%
|
||||
\catcode`\@=11%
|
||||
\aftergroup\saynum%
|
||||
\say{vi}%
|
||||
\at@name%
|
||||
\saynum%
|
||||
}%
|
||||
\say{xi}%
|
||||
\aftergroup\saythirteen%
|
||||
\say{xii}%
|
||||
\endgroup
|
||||
\end
|
||||
%</test>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% That's it. All present and correct.
|
||||
%
|
||||
% \Finale
|
||||
%
|
||||
\endinput
|
702
docs/packages/mdwtools/footnote.dtx
Normal file
702
docs/packages/mdwtools/footnote.dtx
Normal file
@ -0,0 +1,702 @@
|
||||
% \begin{meta-comment}
|
||||
%
|
||||
% $Id$
|
||||
%
|
||||
% Save footnotes around boxing environments and things
|
||||
%
|
||||
% (c) 1996 Mark Wooding
|
||||
%
|
||||
%----- Revision history -----------------------------------------------------
|
||||
%
|
||||
% $Log$
|
||||
% Revision 1.1 1998-09-21 10:19:01 michael
|
||||
% Initial implementation
|
||||
%
|
||||
% Revision 1.13 1997/01/28 19:45:16 mdw
|
||||
% Fixed stupid bug in AMS environment handling which stops the thing from
|
||||
% working properly if you haven't included amsmath. Doh.
|
||||
%
|
||||
% Revision 1.12 1997/01/18 00:45:37 mdw
|
||||
% Fix problems with duplicated footnotes in broken AMS environments which
|
||||
% typeset things multiple times. This is a nasty kludge.
|
||||
%
|
||||
% Revision 1.11 1996/11/19 20:50:05 mdw
|
||||
% Entered into RCS
|
||||
%
|
||||
%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \begin{meta-comment} <general public licence>
|
||||
%%
|
||||
%% footnote package -- Save footnotes around boxing environments
|
||||
%% Copyright (c) 1996 Mark Wooding
|
||||
%<*package>
|
||||
%%
|
||||
%% 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.
|
||||
%</package>
|
||||
%%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \begin{meta-comment} <Package preamble>
|
||||
%<+package>\NeedsTeXFormat{LaTeX2e}
|
||||
%<+package>\ProvidesPackage{footnote}
|
||||
%<+package> [1997/01/28 1.13 Save footnotes around boxes]
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \CheckSum{327}
|
||||
%\iffalse
|
||||
%<*package>
|
||||
%\fi
|
||||
%% \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 \~}
|
||||
%%
|
||||
%\iffalse
|
||||
%</package>
|
||||
%\fi
|
||||
%
|
||||
% \begin{meta-comment} <driver>
|
||||
%
|
||||
%<*driver>
|
||||
\input{mdwtools}
|
||||
\describespackage{footnote}
|
||||
\mdwdoc
|
||||
%</driver>
|
||||
%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \section{User guide}
|
||||
%
|
||||
% This package provides some commands for handling footnotes slightly
|
||||
% better than \LaTeX\ usually does; there are several commands and
|
||||
% environments (notably |\parbox|, \env{minipage} and \env{tabular}
|
||||
% \begin{footnote}
|
||||
% The \package{mdwtab} package, provided in this distribution, handles
|
||||
% footnotes correctly anyway; it uses an internal version of this package
|
||||
% to do so.
|
||||
% \end{footnote})
|
||||
% which `trap' footnotes so that they can't escape and appear at the bottom
|
||||
% of the page.
|
||||
%
|
||||
% \DescribeEnv{savenotes}
|
||||
% The \env{savenotes} environment saves up any footnotes encountered within
|
||||
% it, and performs them all at the end.
|
||||
%
|
||||
% \DescribeMacro{\savenotes}
|
||||
% \DescribeMacro{\spewnotes}
|
||||
% If you're defining a command or environment, you can use the |\savenotes|
|
||||
% command to start saving up footnotes, and the |\spewnotes| command to
|
||||
% execute them all at the end. Note that |\savenotes| and |\spewnotes|
|
||||
% enclose a group, so watch out. You can safely nest the commands and
|
||||
% environments -- they work out if they're already working and behave
|
||||
% appropriately.
|
||||
%
|
||||
% \DescribeEnv{minipage*}
|
||||
% To help things along a bit, the package provides a $*$-version of the
|
||||
% \env{minipage} environment, which doesn't trap footnotes for itself (and
|
||||
% in fact sends any footnotes it contains to the bottom of the page, where
|
||||
% they belong).
|
||||
%
|
||||
% \DescribeMacro{\makesavenoteenv}
|
||||
% The new \env{minipage$*$} environment was created with a magic command
|
||||
% called |\makesavenoteenv|. It has a fairly simple syntax:
|
||||
%
|
||||
% \begin{grammar}
|
||||
% <make-save-note-env-cmd> ::= \[[
|
||||
% "\\makesavenoteenv"
|
||||
% \begin{stack} \\ "[" <new-env-name> "]" \end{stack}
|
||||
% "{" <env-name> "}"
|
||||
% \]]
|
||||
% \end{grammar}
|
||||
%
|
||||
% Without the optional argument, it redefines the named environment so that
|
||||
% it handles footnotes correctly. With the optional argument, it makes
|
||||
% the new environment named by \<new-env-name> into a footnote-friendly
|
||||
% version of the \<env-name> environment.
|
||||
%
|
||||
% \DescribeMacro{\parbox}
|
||||
% The package also redefines the |\parbox| command so that it works properly
|
||||
% with footnotes.
|
||||
%
|
||||
% \DescribeEnv{footnote}
|
||||
% The other problem which people tend to experience with footnotes is that
|
||||
% you can't put verbatim text (with the |\verb| comamnd or the \env{verbatim}
|
||||
% environment) into the |\footnote| command's argument. This package
|
||||
% provides a \env{footnote} \emph{environment}, which \emph{does} allow
|
||||
% verbatim things. You use the environment just like you do the command.
|
||||
% It's really easy. It even has an optional argument, which works the same
|
||||
% way.
|
||||
%
|
||||
% \DescribeEnv{footnotetext}
|
||||
% To go with the \env{footnote} environment, there's a \env{footnotetext}
|
||||
% environment, which just puts the text in the bottom of the page, like
|
||||
% |\footnotetext| does.
|
||||
%
|
||||
% There's a snag with these environments, though. Some other nonstandard
|
||||
% environments, like \env{tabularx}, try to handle footnotes their own
|
||||
% way, because they won't work otherwise. The way they do this is not
|
||||
% compatible with the way that the \env{footnote} and \env{footnotetext}
|
||||
% environments work, and you will get strange results if you try (there'll
|
||||
% be odd vertical spacing, and the footnote text may well be incorrect).
|
||||
% \begin{footnote}
|
||||
% The solution to this problem is to send mail to David Carlisle persuading
|
||||
% him to use this package to handle footnotes, rather than doing it his
|
||||
% way.
|
||||
% \end{footnote}
|
||||
%
|
||||
% \implementation
|
||||
%
|
||||
% \section{Implementation}
|
||||
%
|
||||
% Most implementations of footnote-saving (in particular, that used in
|
||||
% the \package{tabularx} and \package{longtable} packages) use a token
|
||||
% list register to store the footnote text, and then expand it when whatever
|
||||
% was preventing footnotes (usually a vbox) stops. This is no good at all
|
||||
% if the footnotes contain things which might not be there by the time the
|
||||
% expansion occurs. For example, references to things in temporary boxes
|
||||
% won't work.
|
||||
%
|
||||
% This implementation therefore stores the footnotes up in a box register.
|
||||
% This must be just as valid as using tokens, because all I'm going to do
|
||||
% at the end is unbox the box).
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%<*macro|package>
|
||||
\ifx\fn@notes\@@undefined%
|
||||
\newbox\fn@notes%
|
||||
\fi
|
||||
% \end{macrocode}
|
||||
%
|
||||
% I'll need a length to tell me how wide the footnotes should be at the
|
||||
% moment.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\newdimen\fn@width
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Of course, I can't set this up until I actually start saving footnotes.
|
||||
% Until then I'll use |\columnwidth| (which works in \package{multicol}
|
||||
% even though it doesn't have any right to).
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\fn@colwidth\columnwidth
|
||||
% \end{macrocode}
|
||||
%
|
||||
% And now a switch to remember if we're already handling footnotes,
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\newif\if@savingnotes
|
||||
% \end{macrocode}
|
||||
%
|
||||
%
|
||||
% \subsection{Building footnote text}
|
||||
%
|
||||
% I need to emulate \LaTeX's footnote handling when I'm putting the notes
|
||||
% into my box; this is also useful in the verbatim-in-footnotes stuff.
|
||||
%
|
||||
% \begin{macro}{\fn@startnote}
|
||||
%
|
||||
% Here's how a footnote gets started. Most of the code here is stolen
|
||||
% from |\@footnotetext|.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\fn@startnote{%
|
||||
\hsize\fn@colwidth%
|
||||
\interlinepenalty\interfootnotelinepenalty%
|
||||
\reset@font\footnotesize%
|
||||
\floatingpenalty\@MM% Is this right???
|
||||
\@parboxrestore%
|
||||
\protected@edef\@currentlabel{\csname p@\@mpfn\endcsname\@thefnmark}%
|
||||
\color@begingroup%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\fn@endnote}
|
||||
%
|
||||
% Footnotes are finished off by this macro. This is the easy bit.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\fn@endnote\color@endgroup
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
%
|
||||
% \subsection{Footnote saving}
|
||||
%
|
||||
% \begin{macro}{\fn@fntext}
|
||||
%
|
||||
% Now to define how to actually do footnotes. I'll just add the notes to
|
||||
% the bottom of the footnote box I'm building.
|
||||
%
|
||||
% There's some hacking added here to handle the case that a footnote is
|
||||
% in an |\intertext| command within a broken \package{amsmath} alignment
|
||||
% environment -- otherwise the footnotes get duplicated due to the way that
|
||||
% that package measures equations.
|
||||
% \begin{footnote}
|
||||
% The correct solution of course is to
|
||||
% implement aligning environments in a sensible way, by building the table
|
||||
% and leaving penalties describing the intended format, and then pick that
|
||||
% apart in a postprocessing phase. If I get the time, I'll start working
|
||||
% on this again. I have a design worked out and the beginnings of an
|
||||
% implementation, but it's going to be a long time coming.
|
||||
% \end{footnote}
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\fn@fntext#1{%
|
||||
\ifx\ifmeasuring@\@@undefined%
|
||||
\expandafter\@secondoftwo\else\expandafter\@iden%
|
||||
\fi%
|
||||
{\ifmeasuring@\expandafter\@gobble\else\expandafter\@iden\fi}%
|
||||
{%
|
||||
\global\setbox\fn@notes\vbox{%
|
||||
\unvbox\fn@notes%
|
||||
\fn@startnote%
|
||||
\@makefntext{%
|
||||
\rule\z@\footnotesep%
|
||||
\ignorespaces%
|
||||
#1%
|
||||
\@finalstrut\strutbox%
|
||||
}%
|
||||
\fn@endnote%
|
||||
}%
|
||||
}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\savenotes}
|
||||
%
|
||||
% The |\savenotes| declaration starts saving footnotes, to be spewed at a
|
||||
% later date. We'll also remember which counter we're meant to use, and
|
||||
% redefine the footnotes used by minipages.
|
||||
%
|
||||
% The idea here is that we'll gather up footnotes within the environment,
|
||||
% and output them in whatever format they were being typeset outside the
|
||||
% environment.
|
||||
%
|
||||
% I'll take this a bit at a time. The start is easy: we need a group in
|
||||
% which to keep our local definitions.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\savenotes{%
|
||||
\begingroup%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now, if I'm already saving footnotes away, I won't bother doing anything
|
||||
% here. Otherwise I need to start hacking, and set the switch.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\if@savingnotes\else%
|
||||
\@savingnotestrue%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% I redefine the |\@footnotetext| command, which is responsible for adding
|
||||
% a footnote to the appropriate insert. I'll redefine both the current
|
||||
% version, and \env{minipage}'s specific version, in case there's a nested
|
||||
% minipage.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\@footnotetext\fn@fntext%
|
||||
\let\@mpfootnotetext\fn@fntext%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% I'd better make sure my box is empty before I start, and I must set up
|
||||
% the column width so that later changes (e.g., in \env{minipage}) don't
|
||||
% upset things too much.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\fn@width\columnwidth%
|
||||
\let\fn@colwidth\fn@width%
|
||||
\global\setbox\fn@notes\box\voidb@x%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now for some yuckiness. I want to ensure that \env{minipage} doesn't
|
||||
% change how footnotes are handled once I've taken charge. I'll store the
|
||||
% current values of |\thempfn| (which typesets a footnote marker) and
|
||||
% |\@mpfn| (which contains the name of the current footnote counter).
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\fn@thempfn\thempfn%
|
||||
\let\fn@mpfn\@mpfn%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% The \env{minipage} environment provides a hook, called |\@minipagerestore|.
|
||||
% Initially it's set to |\relax|, which is unfortunately unexpandable, so if
|
||||
% I want to add code to it, I must check this possibility. I'll make it
|
||||
% |\@empty| (which expands to nothing) if it's still |\relax|. Then I'll
|
||||
% add my code to the hook, to override |\thempfn| and |\@mpfn| set up by
|
||||
% \env{minipage}.
|
||||
%
|
||||
% Note that I can't just force the |mpfootnote| counter to be equal to
|
||||
% the |footnote| one, because \env{minipage} clears |\c@mpfootnote| to zero
|
||||
% when it starts. This method will ensure that even so, the current counter
|
||||
% works OK.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\ifx\@minipagerestore\relax\let\@minipagerestore\@empty\fi%
|
||||
\expandafter\def\expandafter\@minipagerestore\expandafter{%
|
||||
\@minipagerestore%
|
||||
\let\thempfn\fn@thempfn%
|
||||
\let\@mpfn\fn@mpfn%
|
||||
}%
|
||||
\fi%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\spewnotes}
|
||||
%
|
||||
% Now I can spew out the notes we saved. This is a bit messy, actually.
|
||||
% Since the standard |\@footnotetext| implementation tries to insert funny
|
||||
% struts and things, I must be a bit careful. I'll disable all this bits
|
||||
% which start paragraphs prematurely.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\spewnotes{%
|
||||
\endgroup%
|
||||
\if@savingnotes\else\ifvoid\fn@notes\else\begingroup%
|
||||
\let\@makefntext\@empty%
|
||||
\let\@finalstrut\@gobble%
|
||||
\let\rule\@gobbletwo%
|
||||
\@footnotetext{\unvbox\fn@notes}%
|
||||
\endgroup\fi\fi%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% Now make an environment, for users.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\endsavenotes\spewnotes
|
||||
% \end{macrocode}
|
||||
%
|
||||
% That's all that needs to be in the shared code section.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%</macro|package>
|
||||
%<*package>
|
||||
% \end{macrocode}
|
||||
%
|
||||
%
|
||||
% \subsection{The \env{footnote} environment}
|
||||
%
|
||||
% Since |\footnote| is a command with an argument, things like \env{verbatim}
|
||||
% are unwelcome in it. Every so often someone on |comp.text.tex| moans
|
||||
% about it and I post a nasty hack to make it work. However, as a more
|
||||
% permanent and `official' solution, here's an environment which does the
|
||||
% job rather better. Lots of this is based on code from my latest attempt
|
||||
% on the newsgroup.
|
||||
%
|
||||
% I'll work on this in a funny order, although I think it's easier to
|
||||
% understand. First, I'll do some macros for reading the optional argument
|
||||
% of footnote-related commands.
|
||||
%
|
||||
% \begin{macro}{\fn@getmark}
|
||||
%
|
||||
% Saying \syntax{"\\fn@getmark{"<default-code>"}{"<cont-code>"}"} will read
|
||||
% an optional argument giving a value for the footnote counter; if the
|
||||
% argument isn't there, the \<default-code> is executed, and it's expected
|
||||
% to set up the appropriate counter to the current value. The footnote
|
||||
% marker text is stored in the macro |\@thefnmark|, as is conventional for
|
||||
% \LaTeX's footnote handling macros. Once this is done properly, the
|
||||
% \<cont-code> is called to continue handling things.
|
||||
%
|
||||
% Since the handling of the optional argument plays with the footnote
|
||||
% counter locally, I'll start a group right now to save some code. Then I'll
|
||||
% decide what to do based on the presence of the argument.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\fn@getmark#1#2{%
|
||||
\begingroup%
|
||||
\@ifnextchar[%
|
||||
{\fn@getmark@i{#1}}%
|
||||
{#1\fn@getmark@ii{#2}}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% There's an optional argument, so I need to read it and assign it to the
|
||||
% footnote counter.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\fn@getmark@i#1[#2]{%
|
||||
\csname c@\@mpfn\endcsname#2%
|
||||
\fn@getmark@ii%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Finally, set up the macro properly, and end the group.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\fn@getmark@ii#1{%
|
||||
\unrestored@protected@xdef\@thefnmark{\thempfn}%
|
||||
\endgroup%
|
||||
#1%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% From argument reading, I'll move on to footnote typesetting.
|
||||
%
|
||||
% \begin{macro}{\fn@startfntext}
|
||||
%
|
||||
% The |\fn@startfntext| macro sets everything up for building the footnote
|
||||
% in a box register, ready for unboxing into the footnotes insert. The
|
||||
% |\fn@prefntext| macro is a style hook I'll set up later.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\fn@startfntext{%
|
||||
\setbox\z@\vbox\bgroup%
|
||||
\fn@startnote%
|
||||
\fn@prefntext%
|
||||
\rule\z@\footnotesep%
|
||||
\ignorespaces%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\fn@endfntext}
|
||||
%
|
||||
% Now I'll end the vbox, and add it to the footnote insertion. Again, I
|
||||
% must be careful to prevent |\@footnotetext| from adding horizontal mode
|
||||
% things in bad places.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\fn@endfntext{%
|
||||
\@finalstrut\strutbox%
|
||||
\fn@postfntext%
|
||||
\egroup%
|
||||
\begingroup%
|
||||
\let\@makefntext\@empty%
|
||||
\let\@finalstrut\@gobble%
|
||||
\let\rule\@gobbletwo%
|
||||
\@footnotetext{\unvbox\z@}%
|
||||
\endgroup%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{environment}{footnote}
|
||||
%
|
||||
% I can now start on the environment proper. First I'll look for an
|
||||
% optional argument.
|
||||
%
|
||||
% \begin{listing}
|
||||
%\def\footnote{%
|
||||
% \end{listing}
|
||||
%
|
||||
% Oh. I've already come up against the first problem: that name's already
|
||||
% used. I'd better save the original version.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\fn@latex@@footnote\footnote
|
||||
% \end{macrocode}
|
||||
%
|
||||
% The best way I can think of for seeing if I'm in an environment is to
|
||||
% look at |\@currenvir|. I'll need something to compare with, then.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\fn@footnote{footnote}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now to start properly. |;-)|
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\footnote{%
|
||||
\ifx\@currenvir\fn@footnote%
|
||||
\expandafter\@firstoftwo%
|
||||
\else%
|
||||
\expandafter\@secondoftwo%
|
||||
\fi%
|
||||
{\fn@getmark{\stepcounter\@mpfn}%
|
||||
{\leavevmode\unskip\@footnotemark\fn@startfntext}}%
|
||||
{\fn@latex@@footnote}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Ending the environment is simple.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\endfootnote\fn@endfntext
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{environment}
|
||||
%
|
||||
% \begin{environment}{footnotetext}
|
||||
%
|
||||
% I'll do the same magic as before for |\footnotetext|.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\fn@footnotetext{footnotetext}
|
||||
\let\fn@latex@@footnotetext\footnotetext
|
||||
\def\footnotetext{%
|
||||
\ifx\@currenvir\fn@footnotetext%
|
||||
\expandafter\@firstoftwo%
|
||||
\else%
|
||||
\expandafter\@secondoftwo%
|
||||
\fi%
|
||||
{\fn@getmark{}\fn@startfntext}%
|
||||
{\fn@latex@@footnotetext}%
|
||||
}
|
||||
\let\endfootnotetext\endfootnote
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{environment}
|
||||
%
|
||||
% \begin{macro}{\fn@prefntext}
|
||||
% \begin{macro}{\fn@postfntext}
|
||||
%
|
||||
% Now for one final problem. The style hook for footnotes is the command
|
||||
% |\@makefntext|, which takes the footnote text as its argument. Clearly
|
||||
% this is utterly unsuitable, so I need to split it into two bits, where
|
||||
% the argument is. This is very tricky, and doesn't deserve to work,
|
||||
% although it appears to be a good deal more effective than it has any right
|
||||
% to be.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\long\def\@tempa#1\@@#2\@@@{\def\fn@prefntext{#1}\def\fn@postfntext{#2}}
|
||||
\expandafter\@tempa\@makefntext\@@\@@@
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
%
|
||||
%
|
||||
% \subsection{Hacking existing environments}
|
||||
%
|
||||
% Some existing \LaTeX\ environments ought to have footnote handling but
|
||||
% don't. Now's our chance.
|
||||
%
|
||||
% \begin{macro}{\makesavenoteenv}
|
||||
%
|
||||
% The |\makesavenoteenv| command makes an environment save footnotes around
|
||||
% itself.
|
||||
%
|
||||
% It would also be nice to make |\parbox| work with footnotes. I'll do this
|
||||
% later.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\makesavenoteenv{\@ifnextchar[\fn@msne@ii\fn@msne@i}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% We're meant to redefine the environment. We'll copy it (using |\let|) to
|
||||
% a magic name, and then pass it on to stage~2.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\fn@msne@i#1{%
|
||||
\expandafter\let\csname msne$#1\expandafter\endcsname%
|
||||
\csname #1\endcsname%
|
||||
\expandafter\let\csname endmsne$#1\expandafter\endcsname%
|
||||
\csname end#1\endcsname%
|
||||
\fn@msne@ii[#1]{msne$#1}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now we'll define the new environment. The start is really easy, since we
|
||||
% just need to insert a |\savenotes|. The end is more complex, since we
|
||||
% need to preserve the |\if@endpe| flag so that |\end| can pick it up. I
|
||||
% reckon that proper hooks should be added to |\begin| and |\end| so that
|
||||
% environments can define things to be done outside the main group as
|
||||
% well as within it; still, we can't all have what we want, can we?
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\fn@msne@ii[#1]#2{%
|
||||
\expandafter\edef\csname#1\endcsname{%
|
||||
\noexpand\savenotes%
|
||||
\expandafter\noexpand\csname#2\endcsname%
|
||||
}%
|
||||
\expandafter\edef\csname end#1\endcsname{%
|
||||
\expandafter\noexpand\csname end#2\endcsname%
|
||||
\noexpand\expandafter%
|
||||
\noexpand\spewnotes%
|
||||
\noexpand\if@endpe\noexpand\@endpetrue\noexpand\fi%
|
||||
}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{environment}{minipage*}
|
||||
%
|
||||
% Let's define a \env{minipage$*$} environment which handles footnotes
|
||||
% nicely. Really easy:
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\makesavenoteenv[minipage*]{minipage}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{environment}
|
||||
%
|
||||
% \begin{macro}{\parbox}
|
||||
%
|
||||
% Now to alter |\parbox| slightly, so that it handles footnotes properly.
|
||||
% I'm going to do this fairly inefficiently, because I'm going to try and
|
||||
% change it as little as possible.
|
||||
%
|
||||
% First, I'll save the old |\parbox| command. If I don't find a \lit{*},
|
||||
% I'll just call this command.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\fn@parbox\parbox
|
||||
% \end{macrocode}
|
||||
%
|
||||
% This is the clever bit: I don't know how many optional arguments
|
||||
% Mr~Mittelbach and his chums will add to |\parbox|, so I'll handle any
|
||||
% number. I'll store them all up in my first argument and call myself
|
||||
% every time I find a new one. If I run out of optional arguments,
|
||||
% I'll call the original |\parbox| command, surrounding it with |\savenotes|
|
||||
% and |\spewnotes|.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\parbox{\@ifnextchar[{\fn@parbox@i{}}{\fn@parbox@ii{}}}
|
||||
\def\fn@parbox@i#1[#2]{%
|
||||
\@ifnextchar[{\fn@parbox@i{#1[#2]}}{\fn@parbox@ii{#1[#2]}}%
|
||||
}
|
||||
\long\def\fn@parbox@ii#1#2#3{\savenotes\fn@parbox#1{#2}{#3}\spewnotes}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% Done!
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%</package>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \hfill Mark Wooding, \today
|
||||
%
|
||||
% \Finale
|
||||
%
|
||||
\endinput
|
447
docs/packages/mdwtools/gpl.tex
Normal file
447
docs/packages/mdwtools/gpl.tex
Normal file
@ -0,0 +1,447 @@
|
||||
% \iffalse <meta-comment>
|
||||
%
|
||||
% $Id$
|
||||
%
|
||||
% 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$
|
||||
% Revision 1.1 1998-09-21 10:19:01 michael
|
||||
% Initial implementation
|
||||
%
|
||||
% 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
|
212
docs/packages/mdwtools/mathenv.tex
Normal file
212
docs/packages/mdwtools/mathenv.tex
Normal file
@ -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}
|
759
docs/packages/mdwtools/mdwlist.dtx
Normal file
759
docs/packages/mdwtools/mdwlist.dtx
Normal file
@ -0,0 +1,759 @@
|
||||
% \begin{meta-comment}
|
||||
%
|
||||
% $Id$
|
||||
%
|
||||
% Various list-related things
|
||||
%
|
||||
% (c) 1996 Mark Wooding
|
||||
%
|
||||
%----- Revision history -----------------------------------------------------
|
||||
%
|
||||
% $Log$
|
||||
% Revision 1.1 1998-09-21 10:19:01 michael
|
||||
% Initial implementation
|
||||
%
|
||||
% Revision 1.1 1996/11/19 20:52:26 mdw
|
||||
% Initial revision
|
||||
%
|
||||
%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \begin{meta-comment} <general public licence>
|
||||
%%
|
||||
%% mdwlist package -- various list-related things
|
||||
%% 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} <Package preambles>
|
||||
%<+package>\NeedsTeXFormat{LaTeX2e}
|
||||
%<+package>\ProvidesPackage{mdwlist}
|
||||
%<+package> [1996/05/02 1.1 Various list-related things]
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \CheckSum{179}
|
||||
%% \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 \~}
|
||||
%%
|
||||
%
|
||||
% \begin{meta-comment}
|
||||
%
|
||||
%<*driver>
|
||||
\input{mdwtools}
|
||||
\describespackage{mdwlist}
|
||||
\def\defaultdesc{%
|
||||
\desclabelwidth{80pt}%
|
||||
\desclabelstyle\nextlinelabel%
|
||||
\def\makelabel{\bfseries}%
|
||||
}
|
||||
\newenvironment{cmdlist}
|
||||
{\basedescript{\let\makelabel\cmd}}
|
||||
{\endbasedescript}
|
||||
\mdwdoc
|
||||
%</driver>
|
||||
%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \section{User guide}
|
||||
%
|
||||
% This package provides some vaguely useful list-related commands and
|
||||
% environments:
|
||||
% \begin{itemize*}
|
||||
% \item A way of building \env{description}-like environments.
|
||||
% \item Commands for making `compacted' versions of list environments
|
||||
% \item A method for suspending and resuming enumerated lists.
|
||||
% \end{itemize*}
|
||||
%
|
||||
% \subsection{Description list handling}
|
||||
%
|
||||
% Different sorts of description-type lists require different sorts of
|
||||
% formatting: I think that's fairly obvious. There are essentially three
|
||||
% different attributes which should be changable:
|
||||
% \begin{itemize*}
|
||||
% \item the indentation of the items being described,
|
||||
% \item the handling of labels which don't fit properly, and
|
||||
% \item the style used to typeset the label text.
|
||||
% \end{itemize*}
|
||||
% The first two items should usually be decided for all description-like
|
||||
% lists in the document, to ensure consistency of appearance. The last
|
||||
% depends much more on the content of the labels.
|
||||
%
|
||||
% \DescribeEnv{basedescript}
|
||||
% The \env{basedescript} environment acts as a `skeleton' for description
|
||||
% environments. It takes one argument, which contains declarations to
|
||||
% be performed while constructing the list. I'd consider it unusual for
|
||||
% the \env{basedescript} environment to be used in the main text: it's
|
||||
% intended to be used to build other environments.
|
||||
%
|
||||
% The declarations which can be used to define description-type environments
|
||||
% include all of those which are allowed when setting up a list (see the
|
||||
% \LaTeX\ book for information here). Some others, which apply specifically
|
||||
% to description lists, are also provided:
|
||||
%
|
||||
% \begin{itemize}
|
||||
%
|
||||
% \item \DescribeMacro{\desclabelwidth}
|
||||
% The \syntax{"\\desclabelwidth{"<length>"}"} declaration sets labels
|
||||
% to be left-aligned, with a standard width of \<length>; the item
|
||||
% text is indented by \<length> plus the value of |\labelsep|.
|
||||
%
|
||||
% \item \DescribeMacro{\desclabelstyle}
|
||||
% The label style determines how overlong labels are typeset. A style
|
||||
% may be set using the \syntax{"\\desclabelstyle{"<style>"}"}
|
||||
% declaration. The following \<style>s are provided:
|
||||
% \begin{cmdlist}
|
||||
% \item [\nextlinelabel] If the label is too wide to fit next to the
|
||||
% first line of text, then it is placed on a line by itself;
|
||||
% the main text is started on the next line with the usual
|
||||
% indentation.
|
||||
% \item [\multilinelabel] The label is typeset in a parbox with the
|
||||
% appropriate width; if it won't fit on one line, then the
|
||||
% text will be split onto subsequent lines.
|
||||
% \item [\pushlabel] If the label is too wide to fit in the space
|
||||
% allocated to it, the start of the item's text will be `pushed'
|
||||
% over to the right to provide space for the label. This is
|
||||
% the standard \LaTeX\ \env{description} behaviour.
|
||||
% \end{cmdlist}
|
||||
%
|
||||
% \item \DescribeMacro{\makelabel}
|
||||
% The |\makelabel| command is responsible for typesetting a label.
|
||||
% It is given one argument, which is the text given as an argument
|
||||
% to the |\item| command; it should typeset it appropriately. The
|
||||
% text will then be arranged appropriately according to the chosen
|
||||
% label style. This command should be redefined using |\renewcommand|.
|
||||
%
|
||||
% \end{itemize}
|
||||
%
|
||||
% \begin{figure}
|
||||
% \begin{demo}[w]{Various labelling styles}
|
||||
%\begin{basedescript}{\desclabelstyle{\nextlinelabel}}
|
||||
%\item [Short label] This is a short item, although it has quite a
|
||||
% lot of text attached to it.
|
||||
%\item [Slightly longer label text] This is a rather longer piece
|
||||
% of text, with a correspondingly slightly longer label.
|
||||
%\end{basedescript}
|
||||
%\medskip
|
||||
%\begin{basedescript}{\desclabelstyle{\multilinelabel}}
|
||||
%\item [Short label] This is a short item, although it has quite a
|
||||
% lot of text attached to it.
|
||||
%\item [Slightly longer label text] This is a rather longer piece
|
||||
% of text, with a correspondingly slightly longer label.
|
||||
%\end{basedescript}
|
||||
%\medskip
|
||||
%\begin{basedescript}{\desclabelstyle{\pushlabel}}
|
||||
%\item [Short label] This is a short item, although it has quite a
|
||||
% lot of text attached to it.
|
||||
%\item [Slightly longer label text] This is a rather longer piece
|
||||
% of text, with a correspondingly slightly longer label.
|
||||
%\end{basedescript}
|
||||
% \end{demo}
|
||||
% \end{figure}
|
||||
%
|
||||
% \DescribeMacro{\defaultdesc}
|
||||
% To allow document designers to control the global appearance of description
|
||||
% lists, the |\defaultdesc| command may be redefined; it is called while
|
||||
% setting up a new \env{basedescript} list, before performing the user's
|
||||
% declarations. By default, it attempts to emulate the standard \LaTeX\
|
||||
% \env{description} environment:\footnote{^^A
|
||||
% This is a slightly sanitised version of the real definition, which is
|
||||
% given in the implementation section of this document.}
|
||||
% \begin{listing}
|
||||
%\providecommand{\defaultdesc}{%
|
||||
% \desclabelstyle{\pushlabel}%
|
||||
% \renewcommand{\makelabel}[1]{\bfseries##1}%
|
||||
% \setlength{\labelwidth}{0pt}%
|
||||
%}
|
||||
% \end{listing}
|
||||
% Unfortunately, \LaTeX\ doesn't provide a means for overriding a command
|
||||
% which may or may not have been defined yet; in this case, I'd probably
|
||||
% recommend using the \TeX\ primitive |\def| to redefine |\defaultdesc|.
|
||||
%
|
||||
% If you want to redefine the \env{description} environment in terms of
|
||||
% the commands in this package, the following method is recommended:
|
||||
% \begin{listing}
|
||||
%\renewenvironment{description}{%
|
||||
% \begin{basedescript}{%
|
||||
% \renewcommand{\makelabel}[1]{\bfseries##1}%
|
||||
% }%
|
||||
%}{%
|
||||
% \end{basedescript}%
|
||||
%}
|
||||
% \end{listing}
|
||||
% This ensures that labels are typeset in bold, as is usual, but other
|
||||
% properties of the list are determined by the overall document style.
|
||||
%
|
||||
% \subsection{Compacted lists}
|
||||
%
|
||||
% \LaTeX\ tends to leave a certain amount of vertical space between list
|
||||
% items. While this is normally correct for lists in which the items are
|
||||
% several lines long, it tends to look odd if all or almost all the items
|
||||
% are only one line long.
|
||||
%
|
||||
% \DescribeMacro{\makecompactlist}
|
||||
% The command
|
||||
% \syntax{"\\makecompactlist{"<new-env-name>"}{"<old-env-name>"}"}
|
||||
% defines a new environment \<new-env-name> to be a `compacted' version of
|
||||
% the existing environment \<old-env-name>; i.e., the two environments are
|
||||
% the same except that the compacted version leaves no space between items
|
||||
% or paragraphs within the list.
|
||||
%
|
||||
% \DescribeEnv{itemize*}
|
||||
% \DescribeEnv{enumerate*}
|
||||
% \DescribeEnv{description*}
|
||||
% So that the most common cases are already handled, the package creates
|
||||
% compacted $*$-variants of the \env{itemize}, \env{enumerate} and
|
||||
% \env{description} environments. These were created using the commands
|
||||
% \begin{listing}
|
||||
%\makecompactlist{itemize*}{itemize}
|
||||
%\makecompactlist{enumerate*}{enumerate}
|
||||
%\makecompactlist{description*}{description}
|
||||
% \end{listing}
|
||||
%
|
||||
% Some list environments accept arguments. You can pass an argument to a
|
||||
% list environment using an optional argument to its compact variant. For
|
||||
% example,
|
||||
% \begin{listing}
|
||||
%\begin{foolist*}[{someargument}]
|
||||
% \end{listing}
|
||||
%
|
||||
% \subsection{Suspending and resuming list environments}
|
||||
%
|
||||
% \DescribeMacro{\suspend}
|
||||
% \DescribeMacro{\resume}
|
||||
% The |\suspend| and |\resume| commands allow you to temporarily end a list
|
||||
% environment and then pick it up where you left off. The syntax is fairly
|
||||
% simple:
|
||||
%
|
||||
% \begin{grammar}
|
||||
%
|
||||
% <suspend-cmd> ::= \[[
|
||||
% "\\suspend"
|
||||
% \begin{stack} \\ "[" <name> "]" \end{stack} "{" <env-name> "}"
|
||||
% \]]%
|
||||
%
|
||||
% <resume-cmd> ::= \[[
|
||||
% "\\resume"
|
||||
% \begin{stack} \\ "[" <name> "]" \end{stack} "{" <env-name> "}"
|
||||
% \begin{stack} \\ "[" <text> "]" \end{stack}
|
||||
% \]]%
|
||||
%
|
||||
% \end{grammar}
|
||||
%
|
||||
% The \<env-name> is the name of the environment; this will more often than
|
||||
% not be the \env{enumerate} environment. The \<name> is a magic name you
|
||||
% can use to identify the suspended environment; if you don't specify this,
|
||||
% the environment name is used instead.
|
||||
%
|
||||
% \begin{demo}{Suspended environments}
|
||||
%Here's some initial text. It's
|
||||
%not very interesting.
|
||||
%\begin{enumerate*}
|
||||
%\item This is an item.
|
||||
%\item This is another.
|
||||
%\suspend{enumerate*}
|
||||
%Some more commentry text.
|
||||
%\resume{enumerate*}
|
||||
%\item Another item.
|
||||
%\end{enumerate*}
|
||||
% \end{demo}
|
||||
%
|
||||
% You can pass arguments to a resumed list environment through the second
|
||||
% optional argument of the |\resume| command. If, for example, you're using
|
||||
% David Carlisle's \package{enumerate} package, you could say something like
|
||||
% \begin{listing}
|
||||
%\begin{enumerate}[\bfseries{Item} i]
|
||||
%\item An item
|
||||
%\item Another item
|
||||
%\suspend{enumerate}
|
||||
%Some intervening text.
|
||||
%\resume{enumerate}[{[\bfseries{Item} i]}]
|
||||
%\item Yet another item
|
||||
%\end{enumerate}
|
||||
% \end{listing}
|
||||
%
|
||||
% \implementation
|
||||
%
|
||||
% \section{Implementation}
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%<*package>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsection{Description lists}
|
||||
%
|
||||
% \subsubsection{Label styles}
|
||||
%
|
||||
% \begin{macro}{\nextlinelabel}
|
||||
%
|
||||
% The idea here is that if the label is too long to fit in its box, we put
|
||||
% it on its own line and start the text of the item on the next. I've
|
||||
% used |\sbox| here to capture colour changes properly, even though I have
|
||||
% deep moral objections to the use of \LaTeX\ boxing commands. Anyway,
|
||||
% I capture the text in box~0 and compare its width to the amount of space
|
||||
% I have in the label box. If there's enough, I can just unbox the box;
|
||||
% otherwise I build a vbox containing the label text and an empty hbox --
|
||||
% |\baselineskip| glue inserted between the two boxes makes sure we get
|
||||
% the correct spacing between the two lines, and the vboxness of the vbox
|
||||
% ensures that the baseline of my strange thing is the baseline of the
|
||||
% \emph{bottom} box. I then bash the vbox on the nose, so as to make its
|
||||
% width zero, and leave that as the result. Either way, I then add glue
|
||||
% to left align whatever it is I've created.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\nextlinelabel#1{%
|
||||
\sbox\z@{#1}%
|
||||
\ifdim\wd\z@>\labelwidth%
|
||||
\setbox\z@\vbox{\box\z@\hbox{}}%
|
||||
\wd\z@\z@%
|
||||
\box\z@%
|
||||
\else%
|
||||
\unhbox\z@%
|
||||
\fi%
|
||||
\hfil%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\multilinelabel}
|
||||
%
|
||||
% A different idea -- make the label text wrap around onto the next line if
|
||||
% it's too long. This is really easy, actually. I use a parbox to contain
|
||||
% the label text, set to be ragged right, because there won't be enough
|
||||
% space to do proper justification. There's also a funny hskip there --
|
||||
% this is because \TeX\ only hyphenates things it finds sitting \emph{after}
|
||||
% glue items. The parbox is top-aligned, so the label text and the item
|
||||
% run downwards together. I put the result in box~0, and remove the depth,
|
||||
% so as not to make the top line of the item text look really strange.
|
||||
%
|
||||
% All this leaves a little problem, though: if the item text isn't very long,
|
||||
% the label might go further down the page than the main item, and possibly
|
||||
% collide with the label below. I must confess that I'm not actually sure
|
||||
% how to deal with this possibility, so I just hope it doesn't happen.
|
||||
%
|
||||
% By the way, I don't have moral objections to |\parbox|.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\multilinelabel#1{%
|
||||
\setbox\z@\hbox{%
|
||||
\parbox[t]\labelwidth{\raggedright\hskip\z@skip#1}%
|
||||
}%
|
||||
\dp\z@\z@%
|
||||
\box\z@%
|
||||
\hfil%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\pushlabel}
|
||||
%
|
||||
% Now we implement the old style behaviour -- if the label is too wide, we
|
||||
% just push the first line of the item further over to the right. This
|
||||
% is really very easy indeed -- we just stick some |\hfil| space on the
|
||||
% right hand side (to left align if the label comes up too short). The
|
||||
% `push' behaviour is handled automatically by \LaTeX's item handling.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\pushlabel#1{{#1}\hfil}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \subsubsection{The main environment}
|
||||
%
|
||||
% \begin{macro}{\desclabelstyle}
|
||||
%
|
||||
% This is a declaration intended to be used only in the argument to the
|
||||
% \env{basedescript} environment. It sets the label style for the list.
|
||||
% All we do is take the argument and assign it to a magic control sequence
|
||||
% which \env{basedescript} will understand later.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\desclabelstyle#1{\def\desc@labelstyle{#1}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\desclabelwidth}
|
||||
%
|
||||
% We set the label width and various other bits of information which will
|
||||
% make all the bits of the description line up beautifully. We set
|
||||
% |\labelwidth| to the value we're given (using |\setlength|, so that
|
||||
% people can use the \package{calc} package if they so wish), and make
|
||||
% the |\leftmargin| equal $|\labelwidth|+|\labelsep|$.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\desclabelwidth#1{%
|
||||
\setlength\labelwidth{#1}%
|
||||
\leftmargin\labelwidth%
|
||||
\advance\leftmargin\labelsep%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{environment}{basedescript}
|
||||
%
|
||||
% This is the new description environment. It does almost everything you
|
||||
% could want from a description environment, I think. The argument is a
|
||||
% collection of declarations to be performed while setting up the list.
|
||||
%
|
||||
% This environment isn't really intended to be used by users -- it's here
|
||||
% so that you can define other description environments in terms of it,
|
||||
%
|
||||
% The environment is defined in two bits -- the `start' bit here simply
|
||||
% starts the list and inserts the user declarations in an appropriate
|
||||
% point, although sensible details will be inerted if the argument was
|
||||
% empty.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\basedescript#1{%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% We must start the list. If the |\item| command's optional argument is
|
||||
% missing, we should just leave a blank space, I think.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\list{}{%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% So far, so good. Now put in some default declarations. I'll use a
|
||||
% separate macro for this, so that the global appearance of lists can be
|
||||
% configured.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\defaultdesc%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now we do the user's declarations.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
#1%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now set up the other parts of the list. We set |\itemindent| so that the
|
||||
% label is up against the current left margin. (The standard version
|
||||
% actually leaves the label hanging to the left of the margin by a
|
||||
% distance of |\labelsep| for a reason I can't quite comprehend -- there's
|
||||
% an |\hspace{\labelsep}| in the standard |\makelabel| to compensate for
|
||||
% this. Strange\dots)
|
||||
%
|
||||
% To make the label start in the right place, the text of the item must
|
||||
% start a distance of $|\labelwidth|+|\labelsep|$ from the (pre-list) left
|
||||
% hand margin; this means that we must set |\itemindent| to be
|
||||
% $|\labelwidth|+|\labelsep|-|\leftmargin|$. Time for some \TeX\ arithmetic.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\itemindent\labelwidth%
|
||||
\advance\itemindent\labelsep%
|
||||
\advance\itemindent-\leftmargin%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now we must set up the label typesetting. We'll take the |\makelabel|
|
||||
% provided by the user, remember it, and then redefine |\makelabel| in
|
||||
% terms of the |\desclabelstyle| and the saved |\makelabel|.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\desc@makelabel\makelabel%
|
||||
\def\makelabel##1{\desc@labelstyle{\desc@makelabel{##1}}}%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% I can't think of anything else which needs doing, so I'll call it a day
|
||||
% there.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now we define the `end-bit' of the environment. Since all we need to do
|
||||
% is to close the list, we can be ever-so slightly clever and use |\let|.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\endbasedescript\endlist
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Note that with these definitions, the standard \env{description}
|
||||
% environment can be emulated by saying simply:
|
||||
% \begin{listing}
|
||||
%\renewenvironment{description}{%
|
||||
% \begin{basedescript}{}%
|
||||
%}{%
|
||||
% \end{basedescript}
|
||||
%}
|
||||
% \end{listing}
|
||||
%
|
||||
% \end{environment}
|
||||
%
|
||||
% \begin{macro}{\defaultdesc}
|
||||
%
|
||||
% Now to set up the standard description appearance. In the absence
|
||||
% of any other declarations, the label will `push' the text out the way if
|
||||
% the text is too long. The standard |\labelsep| and |\leftmargin| are not
|
||||
% our problem. We typeset the label text in bold by default. Also,
|
||||
% |\labelwidth| is cleared to 0\,pt, because this is what \LaTeX's usual
|
||||
% \env{description} does.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\providecommand\defaultdesc{%
|
||||
\desclabelstyle\pushlabel%
|
||||
\def\makelabel##1{\bfseries##1}%
|
||||
\labelwidth\z@%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \subsubsection{An example}
|
||||
%
|
||||
% \begin{environment}{note}
|
||||
%
|
||||
% The \env{note} environment is a simple application of the general
|
||||
% description list shown above. It typesets the label (by default, the
|
||||
% text `\textbf{note}') at the left margin, and the note text indented by
|
||||
% the width of the label.
|
||||
%
|
||||
% The code is simple -- we take the environment's argument (which may have
|
||||
% been omitted), store it in a box (using |\sbox| again, to handle colour
|
||||
% changes correctly), set the label width from the width of the box, and
|
||||
% then create a single item containing the label text. The text of the
|
||||
% environment then appears in exactly the desired place.
|
||||
%
|
||||
% I've not used |\newcommand| here, for the following reasons:
|
||||
% \begin{itemize}
|
||||
%
|
||||
% \item I don't like it much, to be honest.
|
||||
%
|
||||
% \item Until very recently, |\newcommand| only allowed you to define
|
||||
% `long' commands, where new paragraphs were allowed to be started
|
||||
% in command arguments; this removes a useful check which traps
|
||||
% common errors like missing out `|}|' characters. I'd prefer to
|
||||
% be compatible with older \LaTeX s than to use the new |\newcommand|
|
||||
% which provides a $*$-form to work around this restriction.
|
||||
%
|
||||
% \end{itemize}
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\note{\@ifnextchar[\note@i{\note@i[Note:]}}
|
||||
\def\note@i[#1]{%
|
||||
\basedescript{%
|
||||
\sbox\z@{\makelabel{#1}}%
|
||||
\desclabelwidth{\wd\z@}%
|
||||
}%
|
||||
\item[\box\z@]%
|
||||
}
|
||||
\let\endnote\endbasedescript
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{environment}
|
||||
%
|
||||
%
|
||||
% \subsection{Compacted environments}
|
||||
%
|
||||
% Normal lists tend to have rather too much space between items if all or
|
||||
% most of the item texts are one line or less each. We therefore define
|
||||
% a macro |\makecompactlist| whuch creates `compacted' versions of existing
|
||||
% environments.
|
||||
%
|
||||
% \begin{macro}{\makecompactlist}
|
||||
%
|
||||
% We're given two arguments: the name of the new environment to create, and
|
||||
% the name of the existing list environment to create.
|
||||
%
|
||||
% The first thing to do is to ensure that the environment we're creating is
|
||||
% actually valid (i.e., it doesn't exist already, and it has a sensible
|
||||
% name). We can do this with the internal \LaTeX\ macro |\@ifdefinable|.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\makecompactlist#1#2{%
|
||||
\expandafter\@ifdefinable\csname#1\endcsname%
|
||||
{\makecompactlist@i{#1}{#2}}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% We also ought to ensure that the other environment already exists. This
|
||||
% isn't too tricky. We'll steal \LaTeX's error and message for this.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\makecompactlist@i#1#2{%
|
||||
\@ifundefined{#2}{\me@err{Environment `#2' not defined}\@ehc}{}%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% The main work for starting a compact list is done elsewhere.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\@namedef{#1}{\@compact@list{#2}}%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now to define the end of the environment; this isn't terribly difficult.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\expandafter\let\csname end#1\expandafter\endcsname%
|
||||
\csname end#2\endcsname%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% That's a compacted environment created. Easy, no?
|
||||
%
|
||||
% \begin{macrocode}
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% The general case macro has to try slurping some arguments, calling the
|
||||
% underlying environment, and removing vertical space.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\@compact@list#1{\@testopt{\@compact@list@i{#1}}{}}
|
||||
\def\@compact@list@i#1[#2]{%
|
||||
\@nameuse{#1}#2%
|
||||
\parskip\z@%
|
||||
\itemsep\z@%
|
||||
}%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{environment}{itemize*}
|
||||
% \begin{environment}{enumerate*}
|
||||
% \begin{environment}{description*}
|
||||
%
|
||||
% Let's build some compacted environments now. These are easy now that
|
||||
% we've done all the work above.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\makecompactlist{itemize*}{itemize}
|
||||
\makecompactlist{enumerate*}{enumerate}
|
||||
\makecompactlist{description*}{description}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{environment}
|
||||
% \end{environment}
|
||||
% \end{environment}
|
||||
%
|
||||
%
|
||||
% \subsection{Suspending and resuming lists}
|
||||
%
|
||||
% This is nowhere near perfect; it relies a lot on the goodwill of the user,
|
||||
% although it seems to work fairly well.
|
||||
%
|
||||
% \begin{macro}{\suspend}
|
||||
%
|
||||
% The only thing that needs saving here is the list counter, whose name
|
||||
% is stored in |\@listctr|. When I get a request to save the counter, I'll
|
||||
% build a macro which will restore it when the environment is restored later.
|
||||
%
|
||||
% The first thing to do is to handle the optional argument. |\@dblarg| will
|
||||
% sort this out, giving me a copy of the mandatory argument if there's no
|
||||
% optional one provided.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\suspend{\@dblarg\suspend@i}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% That's all we need to do here.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\suspend@i[#1]#2{%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now I have a little problem; when I |\end| the environment, it will close
|
||||
% off the grouping level, and the counter value will be forgotten. This is
|
||||
% bad. I'll store all my definitions into a macro, and build the |\end|
|
||||
% command into it; that way, everything will be expanded correctly. This
|
||||
% requires the use of |\edef|, which means I must be a little careful.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\edef\@tempa{%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% The first thing to do is to end the environment. I don't want |\end|
|
||||
% expanded yet, so I'll use |\noexpand|.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\noexpand\end{#2}%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now I must define the `resume' macro. I'll use |\csname| to build the
|
||||
% named identifier into the name, so it won't go wrong (maybe). There's
|
||||
% a little fun here to make the control sequence name but not expand it
|
||||
% here.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\expandafter\noexpand\csname resume.#1\endcsname{%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% The counter name is hidden inside |\@listctr|, so the actual counter is
|
||||
% called `|\csname c@\@listctr\endcsname|'. I'll use |\the| to read its
|
||||
% current value, and assign it to the counter when the macro is used later.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\csname c@\@listctr\endcsname\the\csname c@\@listctr\endcsname%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% That's all we need to do there. Now close the macros and run them.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
}%
|
||||
}%
|
||||
\@tempa%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\resume}
|
||||
%
|
||||
% Resuming environments is much easier. Since I use |\csname| to build the
|
||||
% name, nothing happens if you try to resume environments which weren't
|
||||
% suspended. I'll trap this and raise an error. Provide an optional
|
||||
% argument for collecting arguments to the target list.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\resume{\@dblarg\resume@i}
|
||||
\def\resume@i[#1]#2{\@testopt{\resume@ii{#1}{#2}}{}}
|
||||
\def\resume@ii#1#2[#3]{%
|
||||
\begin{#2}#3%
|
||||
\@ifundefined{resume.#1}{\ml@err@resume}{\@nameuse{resume.#1}}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% That's all there is.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%</package>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \hfill Mark Wooding, \today
|
||||
%
|
||||
% \Finale
|
||||
%
|
||||
\endinput
|
933
docs/packages/mdwtools/mdwmath.dtx
Normal file
933
docs/packages/mdwtools/mdwmath.dtx
Normal file
@ -0,0 +1,933 @@
|
||||
% \begin{meta-comment}
|
||||
%
|
||||
% $Id$
|
||||
%
|
||||
% Various nicer mathematical things
|
||||
%
|
||||
% (c) 1996 Mark Wooding
|
||||
%
|
||||
%----- Revision history -----------------------------------------------------
|
||||
%
|
||||
% $Log$
|
||||
% Revision 1.1 1998-09-21 10:19:01 michael
|
||||
% Initial implementation
|
||||
%
|
||||
% Revision 1.1 1996/11/19 20:53:21 mdw
|
||||
% Initial revision
|
||||
%
|
||||
%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \begin{meta-comment} <general public licence>
|
||||
%%
|
||||
%% mdwmath package -- various nicer mathematical things
|
||||
%% 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} <Package preamble>
|
||||
%<+package>\NeedsTeXFormat{LaTeX2e}
|
||||
%<+package>\ProvidesPackage{mdwmath}
|
||||
%<+package> [1996/04/11 1.1 Nice mathematical things]
|
||||
%<+oldeqnarray>\NeedsTeXFormat{LaTeX2e}
|
||||
%<+oldeqnarray>\ProvidesPackage{eqnarray}
|
||||
%<+oldeqnarray> [1996/04/11 1.1 Old enhanced eqnarray]
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \CheckSum{259}
|
||||
% \begin{old-eqnarray}
|
||||
% \CheckSum{484}
|
||||
% \end{old-eqnarray}
|
||||
%% \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 \~}
|
||||
%%
|
||||
%
|
||||
% \begin{meta-comment}
|
||||
%
|
||||
%<*driver>
|
||||
\input{mdwtools}
|
||||
\describespackage{mdwmath}
|
||||
% \describespackage{eqnarray}
|
||||
\ignoreenv{old-eqnarray}
|
||||
% \unignoreenv{old-eqnarray}
|
||||
\mdwdoc
|
||||
%</driver>
|
||||
%
|
||||
% \end{meta-comment}
|
||||
%
|
||||
% \section{User guide}
|
||||
%
|
||||
% \subsection{Square root typesetting}
|
||||
%
|
||||
% \DescribeMacro{\sqrt}
|
||||
% The package supplies a star variant of the |\sqrt| command which omits the
|
||||
% vinculum over the operand (the line over the top). While this is most
|
||||
% useful in simple cases like $\sqrt*{2}$ it works for any size of operand.
|
||||
% The package also re-implements the standard square root command so that it
|
||||
% positions the root number rather better.
|
||||
%
|
||||
% \begin{figure}
|
||||
% \begin{demo}[w]{Examples of the new square root command}
|
||||
%\[ \sqrt*{2} \quad \mbox{rather than} \quad \sqrt{2} \]
|
||||
%\[ \sqrt*[3]{2} \quad \mbox{ rather than } \quad \sqrt[3]{2} \]
|
||||
%\[ \sqrt{x^3 + \sqrt*[y]{\alpha}} - \sqrt*[n+1]{a} \]
|
||||
%\[ x = \sqrt*[3]{\frac{3y}{7}} \]
|
||||
%\[ q = \frac{2\sqrt*{2}}{5}+\sqrt[\frac{n+1}{2}]{2x^2+3xy-y^2} \]
|
||||
% \end{demo}
|
||||
% \end{figure}
|
||||
%
|
||||
% [Note that omission of the vinculum was originally a cost-cutting exercise
|
||||
% because the radical symbol can just fit in next to its operand and
|
||||
% everything ends up being laid out along a line. However, I find that the
|
||||
% square root without vinculum is less cluttered, so I tend to use it when
|
||||
% it doesn't cause ambiguity.]
|
||||
%
|
||||
% \subsection{Some maths symbols you already have}
|
||||
%
|
||||
% Having just tried to do some simple things, I've found that there are maths
|
||||
% symbols missing. Here they are, in all their glory:
|
||||
%
|
||||
% \begin{center} \unverb\| \begin{tabular}{cl|cl|cl}
|
||||
% $\&$ & "\&" & $\bitor$ & "\bitor" & $\dbland$ & "\dbland" \\
|
||||
% $\bitand$ & "\bitand" & $\dblor$ & "\dblor" &
|
||||
% \end{tabular} \end{center}
|
||||
%
|
||||
% \begin{ignore}
|
||||
% There used to be an eqnarray here, but that's migrated its way into the
|
||||
% \package{mdwtab} package. Maybe the original version, without dependency
|
||||
% on \package{mdwtab} ought to be releasable separately. I'll keep it around
|
||||
% just in case.
|
||||
%
|
||||
% The following is the documentation for the original version. There's an
|
||||
% updated edition in \package{mdwtab}.
|
||||
% \end{ignore}
|
||||
%
|
||||
% \begin{old-eqnarray}
|
||||
%
|
||||
% \subsection{A new \env{eqnarray} environment}
|
||||
%
|
||||
% \LaTeX's built-in \env{eqnarray} is horrible -- it puts far too much space
|
||||
% between the items in the array. This environment is rather nearer to the
|
||||
% \env{amsmath} \env{align} environments, although rather less capable.
|
||||
%
|
||||
% \bigskip
|
||||
% \DescribeEnv{eqnarray}
|
||||
% {\synshorts
|
||||
% \setbox0\hbox{"\\begin{eqnarray}["<preamble>"]" \dots "\\end{eqnarray}"}
|
||||
% \leavevmode \hskip-\parindent \fbox{\box0}
|
||||
% }
|
||||
% \smallskip
|
||||
%
|
||||
% The new version of \env{eqnarray} tries to do everything which you really
|
||||
% want it to. The \synt{preamble} string allows you to define the column
|
||||
% types in a vaguely similar way to the wonderful \env{tabular} environment.
|
||||
% The types provided (and it's easy-ish to add more) are:
|
||||
%
|
||||
% \def\ch{\char`}
|
||||
% \begin{description} \def\makelabel{\hskip\labelsep\normalfont\ttfamily}
|
||||
% \item [r] Right aligned equation
|
||||
% \item [c] Centre-aligned equation
|
||||
% \item [l] Left aligned equation
|
||||
% \item [\textrm{\texttt{Tr}, \texttt{Tc} and \texttt{Tl}}] Right, centre and
|
||||
% left aligned text (not maths)
|
||||
% \item [L] Left aligned zero-width equation
|
||||
% \item [x] Centred entire equation
|
||||
% \item [:] Big gap separating sets of equations
|
||||
% \item [q] Quad space
|
||||
% \item [>\ch\{\synt{text}\ch\}] Insert text before column
|
||||
% \item [<\ch\{\synt{text}\ch\}] Insert text after column
|
||||
% \end{description}
|
||||
%
|
||||
% Some others are also defined: don't use them because they do complicated
|
||||
% things which are hard to explain and they aren't much use anyway.
|
||||
%
|
||||
% The default preamble, if you don't supply one of your own, is \lit{rcl}.
|
||||
% Most of the time, \lit{rl} is sufficient, although compatibility is more
|
||||
% important to me.
|
||||
%
|
||||
% By default, there is no space between columns, which makes formul\ae\ in an
|
||||
% \env{eqnarray} environment look just like formul\ae\ typeset on their own,
|
||||
% except that things get aligned in columns. This is where the default
|
||||
% \env{eqnarray} falls down: it leaves |\arraycolsep| space between each
|
||||
% column making the thing look horrible.
|
||||
%
|
||||
% An example would be good here, I think. This one's from exercise 22.9 of
|
||||
% the \textit{\TeX book}.
|
||||
%
|
||||
% \begin{demo}[w]{Simultaneous equations}
|
||||
%\begin{eqnarray}[rcrcrcrl]
|
||||
% 10w & + & 3x & + & 3y & + & 18z & = 1 \\
|
||||
% 6w & - & 17x & & & - & 5z & = 2
|
||||
%\end{eqnarray}
|
||||
% \end{demo}
|
||||
%
|
||||
% Choosing a more up-to-date example, here's one demonstrating the \lit{:}
|
||||
% column specifier from the \textit{\LaTeX\ Companion}.
|
||||
%
|
||||
% \begin{demo}[w]{Lots of equations}
|
||||
%\begin{eqnarray}[rl:rl:l]
|
||||
% V_i &= v_i - q_i v_j, & X_i &= x_i - q_i x_j, &
|
||||
% U_i = u_i, \qquad \mbox{for $i \ne j$} \label{eq:A} \\
|
||||
% V_j &= v_j, & X_j &= x_j &
|
||||
% U_j u_j + \sum_{i \ne j} q_i u_i.
|
||||
%\end{eqnarray}
|
||||
% \end{demo}
|
||||
%
|
||||
% We can make things more interesting by adding a plain text column. Here we
|
||||
% go:
|
||||
%
|
||||
% \begin{demo}[w]{Plain text column}
|
||||
%\begin{eqnarray}[rlqqTl]
|
||||
% x &= y & by (\ref{eq:A}) \\
|
||||
% x' &= y' & by definition \\
|
||||
% x + x' &= y + y' & by Axiom~1
|
||||
%\end{eqnarray}
|
||||
% \end{demo}
|
||||
%
|
||||
% The new features also mean that you don't need to mess about with
|
||||
% |\lefteqn| any more. This is handled by the \lit{L} column type:
|
||||
%
|
||||
% \begin{demo}{Splitting example}
|
||||
%\begin{eqnarray*}[Ll]
|
||||
% w+x+y+z = \\
|
||||
% & a+b+c+d+e+ \\
|
||||
% & f+g+h+i+j
|
||||
%\end{eqnarray*}
|
||||
% \end{demo}
|
||||
%
|
||||
% Finally, just to prove that the spacing's right at last, here's another one
|
||||
% from the \textit{Companion}.
|
||||
%
|
||||
% \begin{demo}{Spacing demonstration}
|
||||
%\begin{equation}
|
||||
% x^2 + y^2 = z^2
|
||||
%\end{equation}
|
||||
%\begin{eqnarray}[rl]
|
||||
% x^2 + y^2 &= z^2 \\
|
||||
% y^2 &< z^2
|
||||
%\end{eqnarray}
|
||||
% \end{demo}
|
||||
%
|
||||
% Well, that was easy enough. Now on to numbering. As you've noticed, the
|
||||
% equations above are numbered. You can use the \env{eqnarray$*$}
|
||||
% environment to turn off the numbering in the whole environment, or say
|
||||
% |\nonumber| on a line to suppress numbering of that one in particular.
|
||||
% More excitingly, you can say \syntax{"\\nonumber["<text>"]"} to choose
|
||||
% what text to display.
|
||||
%
|
||||
% A note for cheats: you can use the sparkly new \env{eqnarray} for simple
|
||||
% equations simply by specifying \lit{x} as the column description. Who
|
||||
% needs \AmSTeX? |;-)|
|
||||
%
|
||||
% \end{old-eqnarray}
|
||||
%
|
||||
% \implementation
|
||||
%
|
||||
% \section{Implementation}
|
||||
%
|
||||
% This isn't really complicated (honest) although it is a lot hairier than I
|
||||
% think it ought to be.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%<*package>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsection{Square roots}
|
||||
%
|
||||
% \subsubsection{Where is the square root sign?}
|
||||
%
|
||||
% \LaTeX\ hides the square root sign away somewhere without telling anyone
|
||||
% where it is. I extract it forcibly by peeking inside the |\sqrtsign| macro
|
||||
% and scrutinising the contents. Here we go: prepare for yukkiness.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\newcount\sq@sqrt
|
||||
\begingroup
|
||||
\catcode`\|0 \catcode`\\12
|
||||
|def|sq@readrad#1"#2\#3|relax{|global|sq@sqrt"#2|relax}
|
||||
|expandafter|sq@readrad|meaning|sqrtsign|relax
|
||||
|endgroup
|
||||
\def\sq@delim{\delimiter\sq@sqrt\relax}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsubsection{Drawing fake square root signs}
|
||||
%
|
||||
% \TeX\ absolutely insists on drawing square root signs with a vinculum over
|
||||
% the top. In order to get the same effect, we have to attempt to emulate
|
||||
% \TeX's behaviour.
|
||||
%
|
||||
% \begin{macro}{\sqrtdel}
|
||||
%
|
||||
% This does the main job of typesetting a vinculum-free radical.\footnote{^^A
|
||||
% Note for chemists: this is nothing to do with short-lived things which
|
||||
% don't have their normal numbers of electrons. And it won't reduce the
|
||||
% appearance of wrinkles either.}
|
||||
% It's more or less a duplicate of what \TeX\ does internally, so it might be
|
||||
% a good plan to have a copy of Appendix~G open while you examine this.
|
||||
%
|
||||
% We start off by using |\mathpalette| to help decide how big things should
|
||||
% be.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\sqrtdel{\mathpalette\sqrtdel@i}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Read the contents of the radical into a box, so we can measure it.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\sqrtdel@i#1#2{%
|
||||
\setbox\z@\hbox{$\m@th#1#2$}% %%% Bzzzt -- uncramps the mathstyle
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now try and sort out the values needed in this calculation. We'll assume
|
||||
% that $\xi_8$ is 0.6\,pt, the way it usually is. Next try to work out the
|
||||
% value of $\varphi$.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\ifx#1\displaystyle%
|
||||
\@tempdima1ex%
|
||||
\else%
|
||||
\@tempdima.6\p@%
|
||||
\fi%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% That was easy. Now for $\psi$.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\@tempdimb.6\p@%
|
||||
\advance\@tempdimb.25\@tempdima%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Build the `delimiter' in a box of height $h(x)+d(x)+\psi+\xi_8$, as
|
||||
% requested. Box~2 will do well for this purpose.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\dimen@.6\p@%
|
||||
\advance\dimen@\@tempdimb%
|
||||
\advance\dimen@\ht\z@%
|
||||
\advance\dimen@\dp\z@%
|
||||
\setbox\tw@\hbox{%
|
||||
$\left\sq@delim\vcenter to\dimen@{}\right.\n@space$%
|
||||
}%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now we need to do some more calculating (don't you hate it?). As far as
|
||||
% Appendix~G is concerned, $\theta=h(y)=0$, because we want no rule over the
|
||||
% top.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\@tempdima\ht\tw@%
|
||||
\advance\@tempdima\dp\tw@%
|
||||
\advance\@tempdima-\ht\z@%
|
||||
\advance\@tempdima-\dp\z@%
|
||||
\ifdim\@tempdima>\@tempdimb%
|
||||
\advance\@tempdima\@tempdimb%
|
||||
\@tempdimb.5\@tempdima%
|
||||
\fi%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Work out how high to raise the radical symbol. Remember that Appendix~G
|
||||
% thinks that the box has a very small height, although this is untrue here.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\@tempdima\ht\z@%
|
||||
\advance\@tempdima\@tempdimb%
|
||||
\advance\@tempdima-\ht\tw@%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Build the output (finally). The brace group is there to turn the output
|
||||
% into a mathord, one of the few times that this is actually desirable.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
{\raise\@tempdima\box\tw@\vbox{\kern\@tempdimb\box\z@}}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \subsubsection{The new square root command}
|
||||
%
|
||||
% This is where we reimplement all the square root stuff. Most of this stuff
|
||||
% comes from the \PlainTeX\ macros, although some is influenced by \AmSTeX\
|
||||
% and \LaTeXe, and some is original. I've tried to make the spacing vaguely
|
||||
% automatic, so although it's not configurable like \AmSTeX's version, the
|
||||
% output should look nice more of the time. Maybe.
|
||||
%
|
||||
% \begin{macro}{\sqrt}
|
||||
%
|
||||
% \LaTeX\ says this must be robust, so we make it robust. The first thing to
|
||||
% do is to see if there's a star and pass the appropriate squareroot-drawing
|
||||
% command on to the rest of the code.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\DeclareRobustCommand\sqrt{\@ifstar{\sqrt@i\sqrtdel}{\sqrt@i\sqrtsign}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now we can sort out an optional argument to be displayed on the root.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\sqrt@i#1{\@ifnextchar[{\sqrt@ii{#1}}{\sqrt@iv{#1}}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Stages~2 and~3 below are essentially equivalents of \PlainTeX's
|
||||
% |\root|\dots|\of| and |\r@@t|. Here we also find the first wrinkle: the
|
||||
% |\rootbox| used to store the number is spaced out on the left if necessary.
|
||||
% There's a backspace after the end so that the root can slip underneath, and
|
||||
% everything works out nicely. Unfortunately size is fixed here, although
|
||||
% doesn't actually seem to matter.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\sqrt@ii#1[#2]{%
|
||||
\setbox\rootbox\hbox{$\m@th\scriptscriptstyle{#2}$}%
|
||||
\ifdim\wd\rootbox<6\p@%
|
||||
\setbox\rootbox\hb@xt@6\p@{\hfil\unhbox\rootbox}%
|
||||
\fi%
|
||||
\mathpalette{\sqrt@iii{#1}}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now we can actually build everything. Note that the root is raised by its
|
||||
% depth -- this prevents a common problem with letters with descenders.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\sqrt@iii#1#2#3{%
|
||||
\setbox\z@\hbox{$\m@th#2#1{#3}$}%
|
||||
\dimen@\ht\z@%
|
||||
\advance\dimen@-\dp\z@%
|
||||
\dimen@.6\dimen@%
|
||||
\advance\dimen@\dp\rootbox%
|
||||
\mkern-3mu%
|
||||
\raise\dimen@\copy\rootbox%
|
||||
\mkern-10mu%
|
||||
\box\z@%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Finally handle a non-numbered root. We read the rooted text in as an
|
||||
% argument, to stop problems when people omit the braces. (\AmSTeX\ does
|
||||
% this too.)
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\sqrt@iv#1#2{#1{#2}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\root}
|
||||
%
|
||||
% We also re-implement \PlainTeX's |\root| command, just in case someone uses
|
||||
% it, and supply a star-variant. This is all very trivial.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\root{\@ifstar{\root@i\sqrtdel}{\root@i\sqrtsign}}
|
||||
\def\root@i#1#2\of{\sqrt@ii{#1}[#2]}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \subsection{Some magic new maths characters}
|
||||
%
|
||||
% This is all really easy.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\DeclareMathSymbol{&}{\mathbin}{operators}{`\&}
|
||||
\DeclareMathSymbol{\bitand}{\mathbin}{operators}{`\&}
|
||||
\def\bitor{\mathbin\mid}
|
||||
\def\dblor{\mathbin{\mid\mid}}
|
||||
\def\dbland{\mathbin{\mathrel\bitand\mathrel\bitand}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsection{Biggles}
|
||||
%
|
||||
% Now for some user-controlled delimiter sizing. The standard bigness of
|
||||
% plain \TeX's delimiters are all right, but it's a little limiting.
|
||||
%
|
||||
% The biggness of delimiters is based on the size of the current |\strut|,
|
||||
% which \LaTeX\ keeps up to date all the time. This will make the various
|
||||
% delimiters grow in proportion when the text gets bigger. Actually, I'm
|
||||
% not sure that this is exactly right -- maybe it should be nonlinear,
|
||||
%
|
||||
% \begin{macro}{\bbigg}
|
||||
% \begin{macro}{\bbiggl}
|
||||
% \begin{macro}{\bbiggr}
|
||||
% \begin{macro}{\bbiggm}
|
||||
%
|
||||
% This is where the bigness is done. This is more similar to the plain \TeX\
|
||||
% big delimiter stuff than to the \package{amsmath} stuff, although there's
|
||||
% not really a lot of difference.
|
||||
%
|
||||
% The two arguments are a multiplier for the delimiter size, and a small
|
||||
% increment applied \emph{before} the multiplication (which is optional).
|
||||
%
|
||||
% This is actually a front for a low-level interface which can be called
|
||||
% directly for efficiency.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\bbigg{\@bbigg\mathord}
|
||||
\def\bbiggl{\@bbigg\mathopen}
|
||||
\def\bbiggr{\@bbigg\mathclose}
|
||||
\def\bbiggm{\@bbigg\mathrel}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\@bbigg}
|
||||
%
|
||||
% This is an optional argument parser providing a front end for the main
|
||||
% macro |\bbigg@|.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\@bbigg#1{\@ifnextchar[{\@bigg@i{#1}}{\@bigg@i{#1}[\z@]}}
|
||||
\def\@bigg@i#1[#2]#3#4{#1{\bbigg@{#2}{#3}{#4}}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\bbigg@}
|
||||
%
|
||||
% This is it, at last. The arguments are as described above: an addition
|
||||
% to be made to the strut height, and a multiplier. Oh, and the delimiter,
|
||||
% of course.
|
||||
%
|
||||
% This is a bit messy. The smallest `big' delimiter, |\big|, is the same
|
||||
% height as the current strut box. Other delimiters are~$1\frac12$, $2$
|
||||
% and~$2\frac12$ times this height. I'll set the height of the delimiter by
|
||||
% putting in a |\vcenter| of the appropriate size.
|
||||
%
|
||||
% Given an extra height~$x$, a multiplication factor~$f$ and a strut
|
||||
% height~$h$ and depth~$d$, I'll create a vcenter with total height
|
||||
% $f(h+d+x)$. Easy, isn't it?
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\bbigg@#1#2#3{%
|
||||
\hbox{$%
|
||||
\dimen@\ht\strutbox\advance\dimen@\dp\strutbox%
|
||||
\advance\dimen@#1%
|
||||
\dimen@#2\dimen@%
|
||||
\left#3\vcenter to\dimen@{}\right.\n@space%
|
||||
$}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{\big}
|
||||
% \begin{macro}{\Big}
|
||||
% \begin{macro}{\bigg}
|
||||
% \begin{macro}{\Bigg}
|
||||
%
|
||||
% Now for the easy macros.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\big{\bbigg@\z@\@ne}
|
||||
\def\Big{\bbigg@\z@{1.5}}
|
||||
\def\bigg{\bbigg@\z@\tw@}
|
||||
\def\Bigg{\bbigg@\z@{2.5}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
%
|
||||
%
|
||||
% \begin{ignore}
|
||||
% The following is the original definition of the enhanced eqnarray
|
||||
% environment. It's not supported, although if you can figure out how to
|
||||
% extract it, it's all yours.
|
||||
% \end{ignore}
|
||||
%
|
||||
% \begin{old-eqnarray}
|
||||
%
|
||||
% \subsection{The sparkly new \env{eqnarray}}
|
||||
%
|
||||
% Start off by writing a different package.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%</package>
|
||||
%<*oldeqnarray>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsubsection{Options handling}
|
||||
%
|
||||
% We need to be able to cope with \textsf{fleqn} and \textsf{leqno} options.
|
||||
% This will adjust our magic modified \env{eqnarray} environment
|
||||
% appropriately.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\newif\if@fleqn
|
||||
\newif\if@leqno
|
||||
\DeclareOption{fleqn}{\@fleqntrue}
|
||||
\DeclareOption{leqno}{\@leqnotrue}
|
||||
\ProcessOptions
|
||||
% \end{macrocode}
|
||||
%
|
||||
% This is all really different to the \LaTeX\ version. I've looked at the
|
||||
% various \env{tabular} implementations, the original \env{eqnarray} and the
|
||||
% \textit{\TeX book} to see how best to do this, and then went my own way.
|
||||
% If it doesn't work it's all my fault.
|
||||
%
|
||||
% \subsubsection{Some useful registers}
|
||||
%
|
||||
% The old \LaTeX\ version puts the equation numbers in by keeping a count of
|
||||
% where it is in the alignment. Since I don't know how may columns there are
|
||||
% going to be, I'll just use a switch in the preamble to tell me to stop
|
||||
% tabbing.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\newif\if@eqalast
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now define some useful length parameters. First allocate them:
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\newskip\eqaopenskip
|
||||
\newskip\eqacloseskip
|
||||
\newskip\eqacolskip
|
||||
\newskip\eqainskip
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now assign some default values. Users can play with these if they really
|
||||
% want although I can't see the point myself.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\if@fleqn
|
||||
\AtBeginDocument{\eqaopenskip\leftmargini}
|
||||
\else
|
||||
\eqaopenskip\@centering
|
||||
\fi
|
||||
\eqacloseskip\@centering
|
||||
\eqacolskip\@centering
|
||||
\eqainskip\z@
|
||||
% \end{macrocode}
|
||||
%
|
||||
% We allow the user to play with the style if this is really wanted. I dunno
|
||||
% why, really. Maybe someone wants very small alignments.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\eqa@style\displaystyle
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsubsection{The main environments}
|
||||
%
|
||||
% We define the toplevel commands here. They just add in default arguments
|
||||
% and then call |\@eqnarray| with a preamble string. The only difference is
|
||||
% the last column they add in -- \env{eqnarray$*$} throws away the last
|
||||
% column by sticking it in box~0. (I used to |\@gobble| it but that caused
|
||||
% the |\cr| to be lost.)
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\eqnarray{\@ifnextchar[\eqnarray@i{\eqnarray@i[rcl]}}
|
||||
\def\eqnarray@i[#1]{%
|
||||
\@eqnarray{#1!{\hb@xt@\z@{\hss##}\tabskip\z@}}
|
||||
}
|
||||
\@namedef{eqnarray*}{\@ifnextchar[\eqnarray@s@i{\eqnarray@s@i[rcl]}}
|
||||
\def\eqnarray@s@i[#1]{%
|
||||
\@eqnarray{#1!{\nonumber\setbox\z@\hbox{##}\tabskip\z@}}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsubsection{Set up the initial display}
|
||||
%
|
||||
% \begin{macro}{\@eqnarray}
|
||||
%
|
||||
% The |\@eqnarray| command does most of the initial work. It sets up some
|
||||
% flags and things, builds the |\halign| preamble, and returns.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\@eqnarray#1{%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Start playing with the counter here. The original does some icky internal
|
||||
% playing, which isn't necessary. The |\if@eqnsw| switch is |true| if the
|
||||
% user hasn't supplied an equation number. The |\if@eqalast| switch is
|
||||
% |true| in the final equation-number column.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\refstepcounter{equation}%
|
||||
\@eqalastfalse%
|
||||
\global\@eqnswtrue%
|
||||
\m@th%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Set things up for the |\halign| which is coming up.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\openup\jot%
|
||||
\tabskip\eqaopenskip%
|
||||
\let\\\@eqncr%
|
||||
\everycr{}%
|
||||
$$%
|
||||
% \end{macrocode}
|
||||
%
|
||||
% We'll build the real |\halign| and preamble in a token register. All we
|
||||
% need to do is stuff the header in the token register, clear a switch
|
||||
% (that'll be explained later), parse the preamble and then expand the
|
||||
% tokens we collected. Easy, no?
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\toks@{\halign to\displaywidth\bgroup}%
|
||||
\@tempswafalse%
|
||||
\eqa@preamble#1\end%
|
||||
\the\toks@\cr%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{macro}
|
||||
%
|
||||
% \subsubsection{Parsing the preamble}
|
||||
%
|
||||
% All this actually involves is reading the next character and building a
|
||||
% command from it. That can pull off an argument if it needs it. Just make
|
||||
% sure we don't fall off the end and we'll be OK.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\eqa@preamble#1{%
|
||||
\ifx\end#1\else\csname eqa@char@#1\expandafter\endcsname\fi%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Adding stuff to the preamble tokens is a simple matter of using
|
||||
% |\expandafter| in the correct way.\footnote{^^A
|
||||
% I have no idea why \LaTeX\ uses \cmd\edef\ for building its preamble. It
|
||||
% seems utterly insane to me -- the amount of bodgery that \env{tabular}
|
||||
% has to go through to make everything expand at the appropriate times is
|
||||
% scary. Maybe Messrs~Lamport and Mittelbach just forgot about token
|
||||
% registers when they were writing the code. Maybe I ought to rewrite the
|
||||
% thing properly some time. Sigh.
|
||||
%
|
||||
% As a sort of postscript to the above, I \emph{have} rewritten the
|
||||
% \env{tabular} environment, and made a damned fine job of it, in my
|
||||
% oh-so-humble opinion. All this \env{eqnarray} stuff has been remoulded
|
||||
% in terms of the generic column-defining things in \package{mdwtab}.
|
||||
% You're reading the documentation of the old version, which isn't
|
||||
% supported any more, so any bugs here are your own problem.}
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\eqa@addraw#1{\expandafter\toks@\expandafter{\the\toks@#1}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now for some cleverness again. In order to put all the right bits of
|
||||
% |\tabskip| glue in the right places we must \emph{not} terminate each
|
||||
% column until we know what the next one is. We set |\if@tempswa| to be
|
||||
% |true| if there's a column waiting to be closed (so it's initially
|
||||
% |false|). The following macro adds a column correctly, assuming we're in
|
||||
% a formula. Other column types make their own arrangements.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\eqa@add#1{%
|
||||
\if@tempswa%
|
||||
\eqa@addraw{\tabskip\eqainskip}%
|
||||
\else%
|
||||
\eqa@addraw{#1}%
|
||||
\fi%
|
||||
\@tempswatrue%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now to defining column types. Let's define a macro which allows us to
|
||||
% define column types:
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\eqa@def#1{\expandafter\def\csname eqa@char@#1\endcsname}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now we can define the column types. Each column type must loop back to
|
||||
% |\eqa@preamble| once it's finished, to read the rest of the preamble
|
||||
% string. Note the positioning of ord atoms in the stuff below. This will
|
||||
% space out relations and binops correctly when they occur at the edges of
|
||||
% columns, and won't affect ord atoms at the edges, because ords pack
|
||||
% closely.
|
||||
%
|
||||
% First the easy onces. Just stick |\hfil| in the right places and
|
||||
% everything will be all right.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\eqa@def r{\eqa@add{\hfil$\eqa@style##{}$}\eqa@preamble}
|
||||
\eqa@def c{\eqa@add{\hfil$\eqa@style{}##{}$\hfil}\eqa@preamble}
|
||||
\eqa@def l{\eqa@add{$\eqa@style{}##$\hfil}\eqa@preamble}
|
||||
\eqa@def x{\eqa@add{\hfil$\eqa@style##$\hfil}\eqa@preamble}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now for the textual ones. This is also fairly easy.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\eqa@def T#1{%
|
||||
\eqa@add{}%
|
||||
\if#1l\else\eqa@addraw{\hfil}\fi%
|
||||
\eqa@addraw{##}%
|
||||
\if#1r\else\eqa@addraw{\hfil}\fi%
|
||||
\eqa@preamble%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Sort of split types of equations. I mustn't use |\rlap| here, or
|
||||
% everything goes wrong -- |\\| doesn't get noticed by \TeX\ in the same way
|
||||
% as |\cr| does.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\eqa@def L{\eqa@add{\hb@xt@\z@{$\eqa@style##$\hss}\qquad}\eqa@preamble}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% The \lit{:} column type is fairly simple. We set |\tabskip| up to make
|
||||
% lots of space and close the current column, because there must be one.^^A
|
||||
% \footnote{This is an assumption.}
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\eqa@def :{%
|
||||
\eqa@addraw{\tabskip\eqacolskip&}\@tempswafalse\eqa@preamble%
|
||||
}
|
||||
\eqa@def q{\eqa@add{\quad}\@tempswafalse\eqa@preamble}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% The other column types just insert given text in an appropriate way.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\eqa@def >#1{\eqa@add{#1}\@tempswafalse\eqa@preamble}
|
||||
\eqa@def <#1{\eqa@addraw{#1}\eqa@preamble}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Finally, the magical \lit{!} column type, which sets the equation number.
|
||||
% We set up the |\tabskip| glue properly, tab on, and set the flag which
|
||||
% marks the final column.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\eqa@def !#1{%
|
||||
\eqa@addraw{\tabskip\eqacloseskip&\@eqalasttrue#1}\eqa@preamble%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsubsection{Newline codes}
|
||||
%
|
||||
% Newline sequences (|\\|) get turned into calls of |\@eqncr|. The job is
|
||||
% fairly simple, really. However, to avoid reading `|&|' characters
|
||||
% prematurely, we set up a magic brace (from the \package{array} package --
|
||||
% this avoids creating ord atoms and other nastyness).
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\@eqncr{%
|
||||
\iffalse{\fi\ifnum0=`}\fi%
|
||||
\@ifstar{\eqacr@i{\@M}}{\eqacr@i{\interdisplaylinepenalty}}%
|
||||
}
|
||||
\def\eqacr@i#1{\@ifnextchar[{\eqacr@ii{#1}}{\eqacr@ii{#1}[\z@]}}
|
||||
\def\eqacr@ii#1[#2]{%
|
||||
\ifnum0=`{}\fi%
|
||||
\eqa@eqnum%
|
||||
\noalign{\penalty#1\vskip#2\relax}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsubsection{Setting equation numbers}
|
||||
%
|
||||
% Before we start, we need to generalise the flush-left number handling bits.
|
||||
% The macro |\eqa@eqpos| will put its argument in the right place.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\if@leqno
|
||||
\def\eqa@eqpos#1{%
|
||||
\hb@xt@.01\p@{}\rlap{\normalfont\normalcolor\hskip-\displaywidth#1}%
|
||||
}
|
||||
\else
|
||||
\def\eqa@eqpos#1{\normalfont\normalcolor#1}
|
||||
\fi
|
||||
% \end{macrocode}
|
||||
%
|
||||
% First we need to move into the right column. Then we just set the equation
|
||||
% number appropriately. There is some subtlety here, ish. The |\relax| is
|
||||
% important, to delay expansion of the |\if|\dots\ until the new column has
|
||||
% been started. The two helper macros are important too, to hide `|&|'s and
|
||||
% `|\cr|'s from \TeX's scanner until the right time.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\eqa@eqnum{%
|
||||
\relax%
|
||||
\if@eqalast\expandafter\eqa@eqnum@i\else\expandafter\eqa@eqnum@ii\fi%
|
||||
}
|
||||
\def\eqa@eqnum@i{%
|
||||
\if@eqnsw%
|
||||
\eqa@eqpos{(\theequation)}\stepcounter{equation}%
|
||||
\else%
|
||||
\eqa@eqpos\eqa@number%
|
||||
\fi%
|
||||
\global\@eqnswtrue%
|
||||
\cr%
|
||||
}
|
||||
\def\eqa@eqnum@ii{&\eqa@eqnum}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsubsection{Numbering control}
|
||||
%
|
||||
% This is trivial. We set the |\if@eqnsw| flag to be |false| and store the
|
||||
% text in a macro.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\let\nonumber\relax
|
||||
\newcommand\nonumber[1][]{\global\@eqnswfalse\global\def\eqa@number{#1}}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsubsection{Closing the environments off}
|
||||
%
|
||||
% This is really easy. Set the final equation number, close the |\halign|,
|
||||
% tidy up the equation counter (it's been stepped once too many times) and
|
||||
% close the display.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\def\endeqnarray{%
|
||||
\eqa@eqnum%
|
||||
\egroup%
|
||||
\global\advance\c@equation\m@ne%
|
||||
$$%
|
||||
\global\@ignoretrue%
|
||||
}
|
||||
\expandafter\let\csname endeqnarray*\endcsname\endeqnarray
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Now start up the other package again.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%</oldeqnarray>
|
||||
%<*package>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \end{old-eqnarray}
|
||||
%
|
||||
% That's all there is. Byebye.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%</package>
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \hfill Mark Wooding, \today
|
||||
%
|
||||
% \Finale
|
||||
\endinput
|
5444
docs/packages/mdwtools/mdwtab.dtx
Normal file
5444
docs/packages/mdwtools/mdwtab.dtx
Normal file
File diff suppressed because it is too large
Load Diff
82
docs/packages/mdwtools/mdwtools.ins
Normal file
82
docs/packages/mdwtools/mdwtools.ins
Normal file
@ -0,0 +1,82 @@
|
||||
%
|
||||
% $Id$
|
||||
%
|
||||
% Installer for the mdwtools packages
|
||||
%
|
||||
% (c) 1996 Mark Wooding
|
||||
%
|
||||
|
||||
%----- Revision history -----------------------------------------------------
|
||||
%
|
||||
% $Log$
|
||||
% Revision 1.1 1998-09-21 10:19:01 michael
|
||||
% Initial implementation
|
||||
%
|
||||
% Revision 1.3 1996/11/19 20:57:26 mdw
|
||||
% Entered into RCS
|
||||
%
|
||||
|
||||
% --- Licence note ---
|
||||
%
|
||||
% mdwtools installer
|
||||
% 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.
|
||||
|
||||
% --- Sort out how to do all this ---
|
||||
|
||||
\def\batchfile{mdwtools.ins}
|
||||
\input docstrip
|
||||
\keepsilent
|
||||
|
||||
\preamble
|
||||
|
||||
IMPORTANT NOTICE
|
||||
\endpreamble
|
||||
|
||||
{ % --- This is a group so that docstrip \reads it all in one go ---
|
||||
|
||||
\ifx\generate\mdwxxnotdef
|
||||
\gdef\mdwgen#1{#1}
|
||||
\gdef\mdwf#1#2{\generateFile{#1}{n}{#2}}
|
||||
\gdef\needed#1{}
|
||||
\else
|
||||
\global\let\mdwgen\generate
|
||||
\global\def\mdwf{\file}
|
||||
\global\askforoverwritefalse
|
||||
\fi
|
||||
|
||||
}
|
||||
|
||||
\mdwgen{\mdwf {at.sty} {\from {at.dtx} {package}}
|
||||
\mdwf {mdwlist.sty} {\from {mdwlist.dtx} {package}}
|
||||
\mdwf {mdwtab.sty} {\from {mdwtab.dtx} {mdwtab}
|
||||
\needed{syntax.dtx}
|
||||
\from {footnote.dtx} {macro}
|
||||
\from {doafter.dtx} {macro}}
|
||||
\mdwf {syntax.sty} {\from {syntax.dtx} {package}
|
||||
\from {doafter.dtx} {macro}}
|
||||
\mdwf {mathenv.sty} {\from {mdwtab.dtx} {mathenv}}
|
||||
\mdwf {mdwmath.sty} {\from {mdwmath.dtx} {package}}
|
||||
\mdwf {sverb.sty} {\from {sverb.dtx} {package}}
|
||||
\mdwf {footnote.sty} {\from {footnote.dtx} {package}}
|
||||
\mdwf {doafter.sty} {\from {doafter.dtx} {package,latex2e}}
|
||||
\mdwf {doafter.tex} {\from {doafter.dtx} {package,plain}}
|
||||
\mdwf {cmtt.sty} {\from {cmtt.dtx} {sty}}
|
||||
\mdwf {mTTenc.def} {\from {cmtt.dtx} {def}}
|
||||
\mdwf {mTTcmtt.fd} {\from {cmtt.dtx} {fd}}
|
||||
}
|
||||
|
||||
\Msg{Done!}
|
1215
docs/packages/mdwtools/mdwtools.tex
Normal file
1215
docs/packages/mdwtools/mdwtools.tex
Normal file
File diff suppressed because it is too large
Load Diff
1189
docs/packages/mdwtools/sverb.dtx
Normal file
1189
docs/packages/mdwtools/sverb.dtx
Normal file
File diff suppressed because it is too large
Load Diff
2875
docs/packages/mdwtools/syntax.dtx
Normal file
2875
docs/packages/mdwtools/syntax.dtx
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user