|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T U
Length: 23934 (0x5d7e) Types: TextFile Notes: Uncompressed file
└─⟦060c9c824⟧ Bits:30007080 DKUUG TeX 2/12/89 └─⟦9882174fa⟧ »./tex82/TeXdoc/amstex/amstex.doc.Z« └─⟦this⟧
AMSTEX.DOC THIS IS THE DOCUMENTATION FOR AMSTEX.TEX THE AIM OF THIS DOCUMENTATION is to show what is going on and how various macros are inter-related, so that one can easily change things. Major tricks that are special to amstex.tex will be documented, but I won't try to explain all macros in detail. (I might add more explanation if people think it is really important.) The documentation file amsppt.doc for the AMS preprint style file amsppt.sty should also be consulted. The present version of amstex.tex is .9999, which is written for TeX version .9999. When version 1.0 is available, amstex.tex will be updated, and so will this documentation file. At the moment, amstex.tex assumes that plain.tex is available, although some control sequences are redefined. In version 1.0 this will no longer be true, although all features of plain.tex will still be available. By the time version 1.0 of amstex.tex is written, all the changes for the sake of efficiency should have been added (they will be invisible to the user). Fixes to version 1.0 of amstex.tex will be numbered 1.01, etc. Version 1.1 of amstex.tex will be the version interfaced to LaTeX. I'm certain that things will presently bomb if one tries simply to \input amstex.tex as a macro package while using LaTeX (I haven't actually tried doing that, however). Although the preparatory work for the interface has been done, and it is simple in principle, there are lots of details to be taken care of, so this will not happen for several weeks at least. I don't think that it's worth making an interim version of amstex.tex that can simply be loaded in as a macro package to LaTeX, since this would also involve lots of details, and just slow everything down. Fixes to version 1.1 will be 1.11, etc. Version 2.0 will not be written for six months to a year. It will incorporate major macro packages (which can be \input separately as soon as they are written) and various improvements that I would like to make, but which aren't essential. 1. In plain.tex, @ is just type 12, since the new fonts will have @ in the right place. But in AmS-TeX, @ will be type 13, so that \@ will be needed for an @ symbol. This is in anticipation of the day when some one wants to add one more feature to AmS-TeX. For the present a plain @ will give an error message. We need @ to be type 13 to define this. 2. @ will be a letter in amstex.tex, to produce control sequences that the user cannot redefine. All AmS-TeX internal control sequence names end with @AmS. At the end we make @ type 13 again. 3. ~ will be the "tie"; it is defined later. 4. Note that we can't use \err@AmS for the error message in the definition of @ ! 5. \comp@AmS tests whether #1 and #2 are the same (no expansions). It sets \cresult@AmS to be T if they are, F otherwise. (I should eventually replace this with a switch for efficiency.) The \long is needed in case #2 involves a \par; this actually happens when \comp@AmS is used in \comment@AmS---#2 might be an explicit \par. 6. \in@AmS#1#2 tests whether #1 occurs in #2. It sets the same flag \cresult@AmS as \comp@AmS. 7. We want to have \relax@AmS as an alternative to \relax; otherwise the definition of \define won't work if the user decides to \define\relax. \relax@AmS will always be used for \relax. Since AmS-TeX is presently built on top of plain.tex, all places in plain.tex where there is a \relax are changed to \relax@AmS. 8. \define#1 checks whether #1 is already defined by seeing if #1, recreated by \csname...\endcsname, is \relax@AmS. If #1 is already defined we do \def\garbage@AmS. This makes TeX correctly parse the remaining stuff (assuming it's correctly written), so that it is back in sync. 9. There is no note 9. 10. There are two %s on this line because the first one is part of the file, NOT just a remark notation! It is there to make sure that there is space before the carriage return. The effect of these two lines is to \let \Space@AmS equal to a space (as opposed to plain.tex's \space, which is merely defined to be a space). \Space@AmS is needed in \s@AmS and \qspace. 11. We want ~ not only to delete a preceeding space (via \unskip) but to delete a succeeding space (which is not ignored after an active character). We use \futurelet to find the next token, and to test if it is a space we need \Space@AmS, which is \let equal to a space. Probably ~ should be rewritten so that in math mode it gives the symbol it used to in plain.tex. 12. \srdr@AmS is the proper space to put between a single right quote and a double right quote, and similarly for the next three. These amounts will depend on the font. \drsr@AmS is .13889em less than \srdr@AmS. Possibly these should be redefined by \it, etc. 13. \lqtest@AmS#1 tests whether #1 is either ` or \lq. 14. \qspace has one argument, which is presumable either ` or ' (or \lq or \rq), and then does two \futurelet's, to determine whether the next token is a quote, and also to see if the one after that is a space. Although this can't explode if \qspace is properly followed by a quote, it would be nicer to have \qspace do one more \futurelet, so as to be totally robust. 15. There is no note 15. 16. \relax@AmS is needed in \{ and \} in case they are first elements in an \halign. New rules of TeX allow these definitions to work with \left and \right. 17. \smallvspace is \smallskip from plain.tex; syntax changed for \amstex. Similarly for next two. 18. The breaks, newline and space insertion macros are temporary until we are interfaced with LaTeX. 19. \comment...\endcomment is supposed to kill things off a line at a time, so that we don't have to worry about running out of memory space. \comment starts a group, does some \catcodes, and calls \comment@AmS, which scans everything up to a carriage-return and then sees if the next thing is \endcomment. If not it calls itself, otherwise it stops; in either case the line is thrown away. It is obvious that carriage-return (^^M) has to be of type 12. But we also to have to \catcode { and } and # because if they occur at the beginning of a line they will confuse the \comp@AmS macro which is looking at the thing at the beginning of a line. We also have to \catcode %, since it would actually cause the carriage-return at the end of a line to disappear. The definition of \comment@AmS is too long to fit on one line, and both carriage-return and % are no longer available, so we temporarily \catcode ^^A; the ^^A's at the ends of lines are necessary. Someday I should allow \endcomment to be in the middle of a line. 20. \relax@AmS again needed in case these spaces are first in an \halign. 21. Probably \: should be defined differently---the AMS uses different spacing than you get this way. 22. There is no note 22. 23. There is no note 23. 24. \bigl, etc., are defined in terms of \big@AmS, which in turn are defined in terms of the parameters \big@@AmS, etc. A style file would presumably give definitions of \big@@AmS, etc., in terms of the current point size (although amsppt.sty doesn't do this at present, see Note 1 of amsppt.doc). 25. All the \smashes should be redone much more easily since we can now set the height and depth of a box, but for now we leave the old definitions. Even with the new definitions, it will probably be more efficient to combine all \smashes by using a switch, like \phantom, \vphantom and \hphantom. 26. We \let\slimits@AmS=\displaylimits rather than doing a def, to make it easier to test what \slimits@AmS is (using \ifx). 27. The flag \intflag@AmS is used by \dots, to see if something involves an \int, since there are so many kinds of ints, like \intii, etc. The setting of \intflag@AmS is done by \inttest@AmS, below. 28. \intic@AmS is the amount of space to correct for in order to get limits on multiple integral signs properly centered (when they are set as limits). \intkern@AmS is the amount of space to put between \int signs to get the multiple integral signs looking good. Both depend on the font. \negintic@AmS is just a \mathchoice of the negatives of \initic@AmS, but it's not worth the bother trying to pull things apart automatically. \intdots@Ams, similarly, is the proper dots and spacing between the \ints in \intdotsint. 29. To handle all the \ints efficiently we have a counter to keep track of how many there are in our symbol. The multiple integrals all set this counter (\intsdotsint sets it to 0, arbitrarily). 30. All the \ints set \intflag@AmS to be T. They all have to look ahead to see if there is a \limits or \nolimits and have to consider what \ilimits@AmS is, in order to decide what kind of thing to construct. They also set the flag \ignoretoken@AmS to be T if the next token is \limits or \nolimits, which should be ignored, or F it is isn't, and shouldn't be ignored. \findlimits@AmS does this step. Then \ints@@AmS prepares to call either \multintlimits@AmS or \multint@AmS, depending on what the decision is, and the latter two actually construct the multiple integral. 31. We want \operatorname and \operatornamewithlimits to recognize ligatures involving ' and -, which normally give primes and minus signs, so we give them a different \mathcode inside the \mathop. 32. \buffer@AmS keeps the \fontdimen13\tenex that the font actually has, in case \changebuffer is used to change it and then \resetbuffer is used to reset it. 33. Font info changes like \fontdimen13 are global, so have to be explicitly reset. 34. AmS-TeX always uses \\ instead of \cr. In many cases it would suffice to \def \\ to be \cr, but sometimes we must \let\\=\cr. This happens in \aligntag and \bunchtag, and generally any place where we have an \halign for which the last entry in the preamble involves some macro applied to # rather than just a #; the problem is that when TeX is in an \halign it assumes that the # text will be delimited by & or \cr, and when TeX is reading in the argument to a macro it does not do expansions. Consequently, it will keep reading in the argument to the macro until it reaches an actual \cr, and not merely something that expands to \cr. This means that all the alignment things need to say \let\\=\cr at the beginning. (Actually, \\ always means \cr except in \conditions. If we were willing to use something other than \\ in \conditions, we could simply \let\\=\cr once and for all, and avoid all the problems we are about to discuss, but it seemed like a poor design decision to hardwire this in.) The problem with saying \let\\=\cr at the beginning of each alignment macro is that when you have one of these inside another, the \\ in the inner \let\\=\cr is already \cr, so is regarded as the delimiter for the # text. So we need a way to put in \let\\=\cr without having \halign see it. This is done by \Let. \halign counts the { and } as a new level, but since they are inside of \iffalse they don't actually create a new level of grouping. 35. In old AmS-TeX we said \vspace <dim>//, but that really isn't satisfactory, since we couldn't add \vspace <dim> after the last line. (Although that's not really important for \vspace, it would be important for similar things, like dotted lines.) So now we say \vspace{<dim>}. With the new \afterassignment in TeX, and some judiciously applied \futurelet's we should be able to allow \vspace <dim>, or \vspace {<dim>}, or even \vspace {<dim>}\\ all to mean exactly the same thing. But this will be added later. 35.1 The \Let@AmS is inside the \bgroup so that it will be local to the align. This is important if \align occurs inside a \condition, or anything else using \\ to mean something else. 36. \align starts a \vcenter{\halign that will be finished by \endalign, unlike the arrangement in old AmS-TeX, where we had \def\align#1\endalign. This is essential in order to allow an \align...\endalign inside an \align...\endalign without having braces around the inner one. 37. It would be nice to put &&\iffalse#<error message>\fi before the first \cr, so that if there is more than one & on a line, it just gets ignored and an error message is issued. 38. \matrix also begins an \halign, that is eventually finished by \endmatrix, but there are several new twists. First of all, \matrix first makes tabs type 4, so that tabs can be used inside matrices just like &'s, and then calls \matrix@AmS. A \futurelet is needed in \matrix@AmS to see if there is the token \format after \matrix. Depending on whether there is or not, \matrix@@AmS or \matrix@@@AMS is called. There is a new wrinkle if there actually happens to be a \format...\\, because any &'s in the \format...\\ need to be sequestered. This is done by the funny sequence \iffalse{\fi \ifnum`}=0. The \iffalse{\fi increases the level as far as \halign is concerned. The \ifnum`}=0 does not change the level back, but it keeps the braces balanced for the \def.! This is balanced out by the \ifnum`{=0\fi \iffalse}\fi that occurs later in \matrix@@AmS and \matrix@@@AmS. 39. If there is no \format after the \matrix, we just use the default format, centered columns with a \quad of space between them. 40. If there is a \format...\\, \matrix@@AmS has to figure out the format. To do this, it first defines \preamble@AmS to be ... Then it makes a token list \toks@ with just # in it (## appears because this all happens inside a \def). Then it defines \c, \r, \l in the appropriate way, using \the\toks@ to say the #. Finally, it \xdef's \Preamble@AmS to be \preamble, thereby getting the proper expansion. But there's even one more complication! Something in the preamble might be of the form \ifmmode...\fi; in fact the usual glues \, and \; are defined this way. These things should be interpreted as being in horizontal mode, because that's how they are going to be used in the preamble. But because \if's are now taken care of in TeX's mouth, they will seem to be in math mode, since the \matrix is done in math mode. So we do the whole thing inside an \hbox, to fool it. Just to be on the safe side, and not actually mention a box, we just set box 0 to be this box. 41. \dotsfor (and the more general \spacedots for) don't really work right---if you use \dotsfor after some column the dots go through the spacing at the beginning of the next column. (This will be hell to fix.) 42. \enabletabs calls \enabletabs@AmS, which has \disabletabs as part of its syntax, because it's too easy for the user to forget to disable the tabs. But \Enabletabs and \Disabletabs are there for those who want them. 43. \smallmatrix is just like \matrix, except that the default format is centered columns separated by \; (actually it seems to make things that are too tall, but I haven't had a chance to worry about this yet). 44. Possibly the \qquad should be a control sequence that can be changed by the style format (the AMS likes \quad), although it's easy enough for the style format to simply redefine the whole thing. 45. \tag will be either \leqno or \eqno, with the tag being \maketag@AmS#1\tagend@AmS; the flag \atag@AmS is set to T so that \maketag@AmS will do the right thing (see next note). We put in the \tagend@AmS as a delimiter for the argument of \maketag@AmS because we can't put in extra braces, since we have to see if #1 is of the form [...] (see the next note). 46. \maketag@AmS decides how to process the tag found by \tag, depending on whether tags are processed as text or as math. There are additional decisions that have to be made for interfacing with LaTeX. In this case, \AutoTag will tell AmS-TeX to insert the next tag number, automatically updated by LaTeX, whenever there is a \tag with no argument (at the moment all you get is a * as the equation number in this case). We use the flag \atag@AmS to keep track of whether there is a tag, either implicit or explicit. Anything that might have tags or not begins by setting this flag to F, and then occurences of \tag set it to T. The final form of the tag depends on \tagform@AmS, which can be reset by the style file. The default is to automatically put parentheses around the tag. But \tag[...] is supposed to get the explicit tag ... without any parentheses or anything else supplied by the format. So we first do a futurelet to see if the next token is a [. 46.1 The #2 is there in case there is space after the ]. 47. \inaligntag@AmS and \inbunchtag@AmS are flags set by \aligntag and \bunchtag. They are needed by \broken, since it is treated differently when alone and when in each of these. 48. \broken will usually set tags at the left of the top line of the broken equation or at the right of the bottom line, but apparently some people insist on setting the tags centered even on a broken equation, so \broken needs one more flag, \centerbroken@AmS, to tell it if this is required. 49. \broken gets ready to set box 0 to be an appropriate \halign. It uses \openup3pt if we're not already in an \aligntag or \bunchtag (if we are, there is already an \openup3pt, so we don't want another one). (This is the only place where \inbunchtag@AmS is used.) 50. Here's where the fun starts. What these first few lines do is to set box 7 to be box 0, and at the same time get box 4 to be a box as long as the left hand column of the \halign in box 0. 51. Now we munge box 7, depending on whether we're in an \aligntag, whether tags are on the left or right, and whether \broken's are supposed to be tagged in the center or not; the result is stored as \broken@AmS, which is finally inserted at the end of the macro. For example, if we're in an \aligntag, tags are on the left and \broken's are supposed to have their tags in the center, then \broken@AmS is &\vcenter{\vbox{\moveleft\wd4\box7}}; thus \broken@AmS will be set in the right hand column of the \aligntag (by the &), its tag will be centered (by the \vcenter), and the things that it was aligned on will all align with the things that are being aligned in the \aligntag (by the \moveleft\wd4). 52. But if we aren't centering tags on brokens then we want to use a \vtop, so that the left-hand tag will end up on the top line. 53. If we're not in an \aligntag, then we use a \vcenter or \vtop, but the & and \moveleft aren't used. 54. There is no note 54. 55. Now we redo everything for tagging on the right; the only difference is that we don't make the box into a \vtop. 56. \cbroken...\endcbroken is to be used for treating an individual \broken as if \centerbroken@AmS were T. It can't be put in a group since the result has the & in it. So we save the present definition of \centerbroken@AmS as \centerbroken@@AmS, set \centerbroken@AmS to be T and reset \centerbroken@AmS with \endcbroken. 57. \multline can have a \tag after it, but the tagging is not taken care of by the usual \tag, since a multline is really the whole display width. Instead, the \multline is set differently depending on whether there is a tag or not. So we first test if there is a \tag before the $ sign. If so, we call \multline@AmS, which sets the \atag@AmS flag to T and calls \getmltag@AmS; the latter finds the text between \tag and the $ sign, sets box 9 to be the proper tag, and calls \multline@@AmS and \multline@@@AmS for further processing. If there is no tag we just set box 9 to be empty and call \multline@@AmS and \multline@@@AmS. 58. \multline@@AmS defines \lwidth@AmS and \rwidth@AmS in a way that depends on whether we are doing tags on the left or the right. These are needed for \shoveleft and \shoveright in \multline@@@AmS; they are the extra amount of space to leave at the left or right of the middle lines that are normally centered, but which can be shoved left or right. 59. The \hfilneg in \shoveright will cancel the \hfil in the preamble to the \halign. 60. There is an extra wrinkle with \shoveleft. The preamble has {}## rather than ##, because if a line starts with a binary operator, like +, it should probably be set that way, rather than as a unary operator on the next term. But this actually leaves some extra space to the left of the + sign also, which becomes painfully visible when something is shoved left. So we set the line and then set it with {} in front of it and compare the widths of the two boxes. If they are the same, there wasn't a binary operator there, so we just need \hfilneg\lwidth@AmS\quad before the formula; otherwise we need to subtract half the difference of the widths to get things lined up. Actually, we really ought to perform this correction on all lines. 61. If tags are on the left we put in the tag as \copy9. 62. If tags are on the right we put in the tag at the end as \copy9. 63. The \quad and \hskip-1em in \multline@@@AmS set the top and bottom lines one quad from the left and right. They should really be replaced by something that can be set by the format. 64. \aligntag and \bunchtag are real problems, because of the fact that the final #'s in their preambles are inside macros. This not only necessitates the \let\\=\cr, and its attendant problems, which have already been discussed, but also means that we can't have \endaligntag be a separate macro that supplies the final \cr, since that \cr will never be seen. That seems to mean that we have to \def\aligntag#1\endaligntag, which would create awful difficulties for interfacing with LaTeX. Fortunately, however, \aligntag...\endaligntag should only be used as $$\aligntag...\endaligntag$$--- there shouldn't be anything between the \endaligntag and the $$ (in fact, there mustn't be, since it is an \halign, not a \vbox{\halign}). So we can actually let \aligntag be delimited by $$, and define \endaligntag to be empty. When interfacing with LaTeX we will have to first check if a flag has been set to tell us that the user has gotten into display math mode with \[ instead of $$; if so, we will call another version of \aligntag which looks for \]. One thing that should be added: \aligntag should deliver an error message if used outside of math mode (TeX won't give an error message, since it's just an \halign). Also, it would be nice to add \iffalse#<error message>\fi, as in \matrix. 65. \tag is essentially just &; different preambles will be used for left and right tagging, so \aligntag will call \laligntag@AmS and \raligntag@AmS. 66. \vspace will eventually be improved as in \matrix. 67. \xtext should be improved to allow paragraphed text, and we should worry about whether it starts at the margin of the page or at the margin of the display, in case \displaywidth and \hsize are different. 68. \break, etc., will change to the LaTeX syntax when we interface. Also, \everycr should be used to insert \noalign{\penalty\aligntagpenalty@AmS} after each line. This penalty should normally be 0, but \nobreaks [sic] before \aligntag should change it to 10000, so that all breaks can be inhibited at once. 69. The \kern-\displaywidth moves the tag, in the third column of the \halign, back to the left margin. 70. Most of the remarks for \aligntag apply to \bunchtag. 71. These are for cases when you need ligatures involving ` ' and - when using \rm inside math, but aren't using \operatorname. (The ones involving ` aren't really needed, but are provided for symmetry.) 72. \cfrac, \cfracl and \cfracr are defined in terms of \cfrac@@AmS, which is a recursive macro. The test for being at the end, signalled by \cfend@AmS is complicated by the fact that we want to allow an optional ; to be typed at the end. 73. The arrows should all be done with some flag or switch for efficiency. 74. \binary#1 checks whether something is a binary operator by comparing the width of the formula $#1$ and ${}#1$. But we put 9 extra {}'s, in case #1 is a macro with arguments. 75. The \iffalse{\fi and \iffalse}\fi are needed in case \dots is used in a \matrix, etc. 76. We use \root from plain.tex. Only \r@@t is changed to allow \uproot and \rightroot to do their thing. ▶00◀▶00◀▶00◀