diff options
Diffstat (limited to 'Master/texmf-dist/doc/plain/metatex')
-rw-r--r-- | Master/texmf-dist/doc/plain/metatex/README | 92 | ||||
-rw-r--r-- | Master/texmf-dist/doc/plain/metatex/gpl.txt | 340 | ||||
-rw-r--r-- | Master/texmf-dist/doc/plain/metatex/mtmp2pdf.tex | 369 | ||||
-rw-r--r-- | Master/texmf-dist/doc/plain/metatex/mtpaper.pdf | bin | 0 -> 133791 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/plain/metatex/mtpaper/delay.mf | 301 | ||||
-rw-r--r-- | Master/texmf-dist/doc/plain/metatex/mtpaper/diagram.tex | 83 | ||||
-rw-r--r-- | Master/texmf-dist/doc/plain/metatex/mtpaper/frame.tex | 23 | ||||
-rw-r--r-- | Master/texmf-dist/doc/plain/metatex/mtpaper/mtpaper.tex | 654 | ||||
-rw-r--r-- | Master/texmf-dist/doc/plain/metatex/mtpaper/shadow.tex | 85 |
9 files changed, 1947 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/plain/metatex/README b/Master/texmf-dist/doc/plain/metatex/README new file mode 100644 index 00000000000..1e384d8e7ef --- /dev/null +++ b/Master/texmf-dist/doc/plain/metatex/README @@ -0,0 +1,92 @@ +
+\title METATeX
+
+\section What is METATeX?
+
+METATeX is a set of plain TeX and METAFONT macros that you can use to
+define both the text and the figures in a single source file. Because
+METATeX sets up two way communication, from TeX to METAFONT and back
+from METAFONT to TeX, drawing dimensions can be controlled by TeX and
+labels can be located by METAFONT. Only standard features of TeX and
+METAFONT are used, but two runs of TeX and one of METAFONT are needed.
+
+
+\section How to use METATeX?
+
+Please read the TUGboat paper on METATeX to get an explanation. The
+paper is provided here in pdf format (mtpaper.pdf). To recreate yourself
+the paper, you will need the plain TUGboat style files (tugboat.cmn and
+tugboat.sty), in addition to the sources located in the mtpaper subdir
+(mtpaper.tex, delay.mf, diagram.tex, frame.tex and shadow.tex),.
+
+The original TUGboat paper on METATeX is:
+
+"METATeX" by Ram\'on Casares.
+ TUGboat (ISSN 0896-3207)
+ Volume 23, Number 3/4, pp. 313-318, 2002.
+
+It is also available on-line:
+ http://www.tug.org/TUGboat/Articles/tb23-3-4/tb75casa.pdf
+
+
+\section Where to find METATeX?
+
+The home of METATeX is CTAN:
+
+ http://www.ctan.org/tex-archive/macros/plain/contrib/metatex/
+
+
+\section Bugs and comments
+
+Please address your comments and bug reports to (change # by @):
+
+ r.casares#computer.org
+
+I do not promise anything.
+
+
+\section Files
+
+METATeX comprises the following files:
+
+ metatex.tex
+ mtmp2pdf.tex
+ mtpaper.pdf
+ mtpaper/mtpaper.tex
+ mtpaper/delay.mf
+ mtpaper/diagram.tex
+ mtpaper/frame.tex
+ mtpaper/shadow.tex
+ README
+ gpl.txt
+
+
+\section License
+
+ METATeX.TeX communicates TeX and METAFONT
+ Copyright (C) 2003, 2004 Ram\'on Casares
+
+ 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.,
+ 59 Temple Place, Suite 330,
+ Boston, MA 02111-1307 USA
+
+
+\section Versions
+
+ 1.1 Date 2004.08.12. File mptopdf.tex renamed to mtmp2pdf.tex.
+ 1.0 Date 2003.10.15. The first public version.
+
+
+\bye
diff --git a/Master/texmf-dist/doc/plain/metatex/gpl.txt b/Master/texmf-dist/doc/plain/metatex/gpl.txt new file mode 100644 index 00000000000..98acb4ffd90 --- /dev/null +++ b/Master/texmf-dist/doc/plain/metatex/gpl.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 + + 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) <year> <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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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) year 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. diff --git a/Master/texmf-dist/doc/plain/metatex/mtmp2pdf.tex b/Master/texmf-dist/doc/plain/metatex/mtmp2pdf.tex new file mode 100644 index 00000000000..6cc2b4841b4 --- /dev/null +++ b/Master/texmf-dist/doc/plain/metatex/mtmp2pdf.tex @@ -0,0 +1,369 @@ +% MTMP2PDF.TeX (RMCG19970919) + +% MTMP2PDF.TeX converts from PostScript code (by METAPost) to PDF +% Adapted by Ram\'on Casares from ConTeXt by PRAGMA +% ConTeXt copyright={PRAGMA / Hans Hagen & Ton Otten} +% Under the same terms as ConTeXt +% http://www.pragma-ade.com/general/manuals/mreadme.pdf + +% \catcode`\@ should be 11 + +\newcount\MPcounter +\newdimen\MPdimen + +% POSTSCRIPT operators that METAPOST uses + +\def \PScurveto {curveto} +\def \PSlineto {lineto} +\def \PSmoveto {moveto} +\def \PSshowpage {showpage} +\def \PSnewpath {newpath} +\def \PSfshow {fshow} +\def \PSclosepath {closepath} +\def \PSfill {fill} +\def \PSstroke {stroke} +\def \PSclip {clip} +\def \PSrlineto {rlineto} +\def \PSsetlinejoin {setlinejoin} +\def \PSsetlinecap {setlinecap} +\def \PSsetmiterlimit {setmiterlimit} +\def \PSsetgray {setgray} +\def \PSsetrgbcolor {setrgbcolor} +\def \PSsetdash {setdash} +\def \PSgsave {gsave} +\def \PSgrestore {grestore} +\def \PStranslate {translate} +\def \PSscale {scale} +\def \PSconcat {concat} +\def \PSdtransform {dtransform} + +\def \PSBoundingBox {BoundingBox:} +\def \PSHiResBoundingBox {HiResBoundingBox:} +\def \PSExactBoundingBox {ExactBoundingBox:} +\def \PSPage {Page:} + +% A stack + +\newcount\nofMPsegments +\newcount\nofMParguments + +\def\@@MP{@@MP} + +\def\setMPargument#1{\advance\nofMParguments by 1 + \expandafter\def + \csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname% + {\do#1}} + +\def\gMPa#1{\csname\@@MP0#1\endcsname} +\def\gMPs#1{\csname\@@MP\the\nofMPsegments#1\endcsname} + +\def\setMPkeyword#1 + {\expandafter\def\csname\@@MP\the\nofMPsegments0\endcsname{#1}% + \advance\nofMPsegments by 1 \nofMParguments=0\relax} + +\def\getMPkeyword#1{\csname\@@MP#10\endcsname} + +\def\resetMPstack{\catcode`\%=13 % active + \let\handleMPgraphic=\handleMPendgraphic + \def\resetMPstack{\nofMParguments=0\relax}% + \resetMPstack} + +% Ignore, most of times, ( and ), but with care +% Take care, also of TeX specials + +\def\octalMPcharacter#1#2#3{\char'#1#2#3\relax} + +\bgroup +\catcode`\|=14 \catcode`\%=13 \catcode`\[=13 \catcode`\]=13 +\catcode`\{=13 \catcode`\}=13 \catcode`B=1 \catcode`E=2 +\gdef\ignoreMPspecialsB\def%BE\def[BE\def]BE\def{BE\def}BEE +\gdef\obeyMPspecialsB\def%B\char 37\relax E| + \def[B\char 91\relax E\def]B\char 93\relax E| + \def{B\char123\relax E\def}B\char125\relax EE +\gdef\setMPspecialsB\catcode`\%=13 + \catcode`\[=13 \catcode`\]=13 \catcode`\{=13 \catcode`\}=13 + \catcode`\$=11 \catcode`\_=11 \catcode`\#=11 \catcode`\^=11 + \catcode`\&=11 \catcode`\|=11 \catcode`\~=11 + \def\(B\char40\relax E\def\)B\char41\relax E\def\\B\char92\relax E| + \def\0B\octalMPcharacter0E\def\1B\octalMPcharacter1E| + \def\2B\octalMPcharacter2E\def\3B\octalMPcharacter3E| + \def\4B\octalMPcharacter4E\def\5B\octalMPcharacter5E| + \def\6B\octalMPcharacter6E\def\7B\octalMPcharacter7E| + \def\8B\octalMPcharacter8E\def\9B\octalMPcharacter9EE +\egroup + +% We use the comment symbol as a sort of trigger: + +\bgroup \catcode`\%=13 +\gdef\startMPscanning{\let%=\startMPconversion} +\egroup + +\def\startMPconversion{\catcode`\%=9 \ignoreMPspecials \handleMPsequence} + +% The main loop. +% Most arguments are numbers that can be recognized by their \lccode. + +\def\dohandleMPsequence#1#2 {\ifnum\lccode`#1=0 \setMPargument{#1#2}% + \else \edef\somestring{#1#2}\ifx\somestring\PSmoveto + \edef\lastMPmoveX{\gMPa1}\edef\lastMPmoveY{\gMPa2}% + \pdfliteral{\gMPa1 \gMPa2 m}\resetMPstack + \else\ifx\somestring\PSnewpath \let\handleMPsequence=\handleMPpath + \else\ifx\somestring\PSgsave \pdfliteral{q}\resetMPstack + \else\ifx\somestring\PSgrestore \pdfliteral{Q}\resetMPstack + \else\ifx\somestring\PSdtransform % == setlinewidth + \let\handleMPsequence=\handleMPdtransform + \else\ifx\somestring\PSconcat + \pdfliteral{\gMPa1 \gMPa2 \gMPa3 \gMPa4 \gMPa5 \gMPa6 cm}\resetMPstack + \else\ifx\somestring\PSsetrgbcolor + \pdfliteral{\gMPa1 \gMPa2 \gMPa3 rg \gMPa1 \gMPa2 \gMPa3 RG}% + \resetMPstack + \else\ifx\somestring\PSsetgray \pdfliteral{\gMPa1 g \gMPa1 G}\resetMPstack + \else\ifx\somestring\PStranslate + \pdfliteral{1 0 0 1 \gMPa1 \gMPa2 cm}\resetMPstack + \else\ifx\somestring\PSsetdash \handleMPsetdash \resetMPstack + \else\ifx\somestring\PSsetlinejoin \pdfliteral{\gMPa1 j}\resetMPstack + \else\ifx\somestring\PSsetmiterlimit \pdfliteral{\gMPa1 M}\resetMPstack + \else\ifx\somestring\PSfshow \handleMPfshow \resetMPstack + \else\ifx\somestring\PSsetlinecap \pdfliteral{\gMPa1 J}\resetMPstack + \else\ifx\somestring\PSrlineto + \pdfliteral{\lastMPmoveX\space \lastMPmoveY\space l S}\resetMPstack + \else\ifx\somestring\PSscale + \pdfliteral{\gMPa1 0 0 \gMPa2 0 0 cm}\resetMPstack + \else \handleMPgraphic{#1#2}% + \fi\fi\fi\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi\fi\fi\fi \fi + \handleMPsequence} + +% Graphics + +\def\handleMPendgraphic#1{\ifx\somestring\PSshowpage + \let\handleMPsequence=\finishMPgraphic \else + \setMPargument{#1}\fi} + +\def\handleMPbegingraphic#1{\ifx\somestring\PSBoundingBox + \let\handleMPsequence=\handleMPboundingbox + \else\ifx\somestring\PSHiResBoundingBox + \let\handleMPsequence=\handleMPboundingbox + \else\ifx\somestring\PSExactBoundingBox + \let\handleMPsequence=\handleMPboundingbox + \else\ifx\somestring\PSPage + \let\handleMPsequence=\handleMPpage + \else \setMPargument{#1}\fi\fi\fi\fi} + +\let\handleMPgraphic=\handleMPbegingraphic + +% There are three kind of bounding boxes: +% BoundingBox: llx lly ucx ucy +% HiResBoundingBox: llx lly ucx ucy +% ExactBoundingBox: llx lly ucx ucy +% The dimensions are saved for later use. + +\def\handleMPboundingbox #1 #2 #3 #4 {\nofMParguments=0 + \let\handleMPsequence=\dohandleMPsequence \handleMPsequence} + +% The page comment is a signal that stackbuilding can be started + +\def\handleMPpage #1 #2 {\nofMParguments=0 + \let\handleMPsequence=\dohandleMPsequence \handleMPsequence} + +% METAPOST: 0 0 rlineto + +\def\lastMPmoveX{0}\def\lastMPmoveY{0} + +% Text + +{\catcode`\.=12 \catcode`\p=12 \catcode`\t=12 + \gdef\WITHOUTPT#1pt{#1}} +\def\withoutpt#1{\expandafter\WITHOUTPT#1} +\def\ScaledPointsToBigPoints#1#2{\MPdimen=#1sp\relax + \MPdimen=.996264\MPdimen \edef#2{\withoutpt{\the\MPdimen}}} + +\def\handleMPfshow{\setbox0=\hbox{\obeyMPspecials + \edef\size{\gMPa{\the\nofMParguments} }% + \advance\nofMParguments by -1 + \font\temp=\gMPa{\the\nofMParguments} at \size bp + \advance\nofMParguments by -1 \temp + \ifnum\nofMParguments=1 \def\do(##1){##1}\gMPa1% + \else \MPcounter=1 + \def\do(##1{##1}\gMPa{\the\MPcounter}\space\def\do{}% + \loop \advance\MPcounter by 1 + \ifnum\MPcounter<\nofMParguments \gMPa{\the\MPcounter}\space\repeat + \def\do##1){##1}\gMPa{\the\MPcounter}% + \fi + \unskip}% + \dimen0=\lastMPmoveY bp \advance\dimen0 by \ht0 + \ScaledPointsToBigPoints{\number\dimen0}\lastMPmoveY + \pdfliteral{n q 1 0 0 1 \lastMPmoveX\space\lastMPmoveY\space cm}% + \dimen0=\ht0 \advance\dimen0 by \dp0 \box0 \vskip-\dimen0 + \pdfliteral{Q}} + + +% Take care of dashes + +\def\handleMPsetdash{\bgroup \def\somestring{[}\MPcounter=1 + \loop \ifnum\MPcounter<\nofMParguments + \edef\somestring{\somestring\space\gMPa{\the\MPcounter}}% + \advance\MPcounter by 1 \repeat + \edef\somestring{\somestring]\gMPa{\the\MPcounter} d}% + \pdfliteral{\somestring}\egroup} + +% setlinewidth + +\def\handleMPdtransform{\ifdim\gMPa1pt>0pt + \pdfliteral{\gMPa1 w}% + \def\next##1 ##2 ##3 ##4 ##5 ##6 {\handleMPsequence}\else + \pdfliteral{\gMPa2 w}% + \def\next##1 ##2 ##3 ##4 {\handleMPsequence}\fi + \let\handleMPsequence=\dohandleMPsequence \resetMPstack + \next} + +% Paths, concat + +\def\handleMPpath{\chardef\finiMPpath=0 + \let\closeMPpath=\relax \let\flushMPpath=\flushnormalMPpath + \resetMPstack \nofMPsegments=1 + \let\handleMPsequence=\dohandleMPpath \dohandleMPpath} + +\def\flushnormalMPpath{\MPcounter=\nofMPsegments \nofMPsegments=1 + \loop \expandafter\ifcase\getMPkeyword{\the\nofMPsegments}\relax + \pdfliteral{\gMPs1 \gMPs2 l}\or + \pdfliteral{\gMPs1 \gMPs2 \gMPs3 \gMPs4 \gMPs5 \gMPs6 c}\or + \pdfliteral{\lastMPmoveX\space \lastMPmoveY\space l S}\or + \edef\lastMPmoveX{\gMPs1}\edef\lastMPmoveY{\gMPs2}% + \pdfliteral{\lastMPmoveX\space \lastMPmoveY\space m}\fi + \advance\nofMPsegments by 1\relax + \ifnum\nofMPsegments<\MPcounter \repeat} + +\def\flushconcatMPpath{\MPcounter=\nofMPsegments \nofMPsegments=1 + \loop \expandafter\ifcase\getMPkeyword{\the\nofMPsegments}\relax + \doMPconcat{\gMPs1}\a{\gMPs2}\b \pdfliteral{\a\space \b\space l}% + \or + \doMPconcat{\gMPs1}\a{\gMPs2}\b + \doMPconcat{\gMPs3}\c{\gMPs4}\d + \doMPconcat{\gMPs5}\e{\gMPs6}\f + \pdfliteral{\a\space \b\space \c\space \d\space \e\space \f\space c}% + \or + \bgroup \noMPtranslate \doMPconcat\lastMPmoveX\a\lastMPmoveY\b + \pdfliteral{\a\space \b\space l S}\egroup + \or + \edef\lastMPmoveX{\gMPs1}\edef\lastMPmoveY{\gMPs2}% + \doMPconcat\lastMPmoveX\a\lastMPmoveY\b + \pdfliteral{\a\space \b\space m}% + \fi + \advance\nofMPsegments by 1\relax + \ifnum\nofMPsegments<\MPcounter \repeat} + +% The transformation of the coordinates + +\def\MPconcatfactor{256} + +\def\doMPreducedimen#1 {\count0=\MPconcatfactor + \advance\dimen#1 \ifdim\dimen#1>0pt .5\else -.5\fi\count0 + \divide\dimen#1 \count0\relax} + +\def\doMPexpanddimen#1 {\multiply\dimen#1 \MPconcatfactor\relax} + +\def\presetMPconcat% + {\dimen 0=\gMPs1 pt \doMPreducedimen 0 % r_x + \dimen 2=\gMPs2 pt \doMPreducedimen 2 % s_x + \dimen 4=\gMPs3 pt \doMPreducedimen 4 % s_y + \dimen 6=\gMPs4 pt \doMPreducedimen 6 % r_y + \dimen 8=\gMPs5 pt \doMPreducedimen 8 % t_x + \dimen10=\gMPs6 pt \doMPreducedimen10 } % t_y + +\def\presetMPscale% + {\dimen 0=\gMPs1 pt \doMPreducedimen 0 + \dimen 2=0pt + \dimen 4=0pt + \dimen 6=\gMPs2 pt \doMPreducedimen 6 + \dimen 8=0pt + \dimen10=0pt } + +\def\noMPtranslate% use this one grouped + {\dimen 8=0pt % t_x + \dimen10=0pt } % t_y + +\def\doMPconcat#1#2#3#4% + {\dimen12=#1 pt \doMPreducedimen12 % p_x + \dimen14=#3 pt \doMPreducedimen14 % p_y + % + \dimen16 \dimen 0 + \multiply \dimen16 \dimen 6 + \dimen20 \dimen 2 + \multiply \dimen20 \dimen 4 + \advance \dimen16 -\dimen20 + % + \dimen18 \dimen12 + \multiply \dimen18 \dimen 6 + \dimen20 \dimen14 + \multiply \dimen20 \dimen 4 + \advance \dimen18 -\dimen20 + \dimen20 \dimen 4 + \multiply \dimen20 \dimen10 + \advance \dimen18 \dimen20 + \dimen20 \dimen 6 + \multiply \dimen20 \dimen 8 + \advance \dimen18 -\dimen20 + % + \multiply \dimen12 -\dimen 2 + \multiply \dimen14 \dimen 0 + \advance \dimen12 \dimen14 + \dimen20 \dimen 2 + \multiply \dimen20 \dimen 8 + \advance \dimen12 \dimen20 + \dimen20 \dimen 0 + \multiply \dimen20 \dimen10 + \advance \dimen12 -\dimen20 + % + \doMPreducedimen16 + \divide \dimen18 \dimen16 \doMPexpanddimen18 + \divide \dimen12 \dimen16 \doMPexpanddimen12 + % + \edef#2{\withoutpt{\the\dimen18}}% % p_x^\prime + \edef#4{\withoutpt{\the\dimen12}}} % p_y^\prime + +\def\processMPpath{\flushMPpath \closeMPpath + \pdfliteral{\ifcase\finiMPpath W n\or S\or f\or B\fi}% + \let\handleMPsequence=\dohandleMPsequence + \resetMPstack \nofMPsegments=0 \handleMPsequence} + +\def\handleMPpathconcat{\presetMPconcat + \pdfliteral{\gMPs1 \gMPs2 \gMPs3 \gMPs4 \gMPs5 \gMPs6 cm}% + \resetMPstack} + +\def\handleMPpathscale{\presetMPscale + \pdfliteral{\gMPs1 0 0 \gMPs2 0 0 cm}\resetMPstack} + +\def\dohandleMPpath#1#2 {\ifnum\lccode`#1=0 \setMPargument{#1#2}% + \else \def\somestring{#1#2}\ifx\somestring\PSlineto \setMPkeyword0 + \else\ifx\somestring\PScurveto \setMPkeyword1 + \else\ifx\somestring\PSrlineto \setMPkeyword2 + \else\ifx\somestring\PSmoveto \setMPkeyword3 + \else\ifx\somestring\PSclip \let\handleMPsequence=\processMPpath + \else\ifx\somestring\PSgsave \chardef\finiMPpath=3 + \else\ifx\somestring\PSgrestore + \else\ifx\somestring\PSfill + \ifnum\finiMPpath=0 + \chardef\finiMPpath=2 \let\handleMPsequence=\processMPpath \fi + \else\ifx\somestring\PSstroke + \ifnum\finiMPpath=0 \chardef\finiMPpath=1 \fi + \let\handleMPsequence=\processMPpath + \else\ifx\somestring\PSclosepath \def\closeMPpath{\pdfliteral{h}}% + \else\ifx\somestring\PSconcat + \let\flushMPpath=\flushconcatMPpath \handleMPpathconcat + \else\ifx\somestring\PSscale + \let\flushMPpath\flushconcatMPpath \handleMPpathscale + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \handleMPsequence} + +% The main conversion command + +\def\MPtoPDF#1{\bgroup + \setMPspecials\startMPscanning\def\do{}% + \setbox0=\vbox\bgroup + \parskip=0pt \leftskip=0pt \parindent=0pt \everypar{}\offinterlineskip + \pdfliteral{q}\let\handleMPsequence=\dohandleMPsequence + \input #1 \relax} + +\def\finishMPgraphic{\pdfliteral{Q}\egroup\box0\egroup} + +\endinput diff --git a/Master/texmf-dist/doc/plain/metatex/mtpaper.pdf b/Master/texmf-dist/doc/plain/metatex/mtpaper.pdf Binary files differnew file mode 100644 index 00000000000..80953ce70b1 --- /dev/null +++ b/Master/texmf-dist/doc/plain/metatex/mtpaper.pdf diff --git a/Master/texmf-dist/doc/plain/metatex/mtpaper/delay.mf b/Master/texmf-dist/doc/plain/metatex/mtpaper/delay.mf new file mode 100644 index 00000000000..72bafc9f173 --- /dev/null +++ b/Master/texmf-dist/doc/plain/metatex/mtpaper/delay.mf @@ -0,0 +1,301 @@ +% DELAY.MF (RMCG19950405) + +% DELAY.MF delays the actual drawing till the endchar; +% Copyright (C) 2003 Ram\'on Casares +% +% 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., +% 59 Temple Place, Suite 330, +% Boston, MA 02111-1307 USA + +def clear_del = + save _dn, _del; _dn := 0; string _del[]; +enddef; + +def make_del = + for k := 1 upto _dn: scantokens _del[k]; endfor +enddef; + +extra_beginchar := extra_beginchar & "clear_del;"; +extra_endchar := "make_del;" & extra_endchar; + +def MTlabel(suffix i)(expr v,h,add,wd,ht,dp) = + x.i.l = x.i if h="c": - wd/2 elseif h="r": - wd fi; + y.i.t = y.i if v="c": + ht/2 elseif v="b": + ht fi; + x.i.r = x.i.l + wd; y.i.b = y.i.t - ht - dp; + if not (add=""): _del[incr _dn] := "_delete(" & str i & ");"; fi + _del[incr _dn] := "_pos(" & str i & ");"; +enddef; + +def _delete(suffix i) = erase fill (x.i.l,y.i.t) -- + (x.i.l,y.i.b) -- (x.i.r,y.i.b) -- (x.i.r,y.i.t) -- cycle; +enddef; + +def _pos(suffix i) = + message"\MTloglabel"; show x\i/pt; show y\i/pt; message""; +enddef; + +pickup pencircle scaled 0.4pt; thin_pen:=savepen; +pickup pencircle scaled 0.8pt; med_pen:=savepen; +pickup pencircle scaled 1.2pt; thick_pen:=savepen; + +def thinpen = pickup thin_pen; + _del[incr _dn] := "pickup thin_pen;"; +enddef; + +def medpen = pickup med_pen; + _del[incr _dn] := "pickup med_pen;"; +enddef; + +def thickpen = pickup thick_pen; + _del[incr _dn] := "pickup thick_pen;"; +enddef; + +def rectangle(suffix s)(expr width,height) = + x.s.l = x.s - width/2; x.s.r = x.s + width/2; + y.s.t = y.s + height/2; y.s.b = y.s - height/2; + _del[incr _dn] := "_rectangle(" & str s & ");"; +enddef; + +def _rectangle(suffix s) = + draw (x.s.l,y.s.b) -- (x.s.r,y.s.b) -- + (x.s.r,y.s.t) -- (x.s.l,y.s.t) -- cycle; +enddef; + +def square(suffix s)(expr side) = + x.s.l = x.s - side/2; x.s.r = x.s + side/2; + y.s.t = y.s + side/2; y.s.b = y.s - side/2; + _del[incr _dn] := "_square(" & str s & ");"; +enddef; + +def _square(suffix s) = + draw (x.s.l,y.s.b) -- (x.s.r,y.s.b) -- + (x.s.r,y.s.t) -- (x.s.l,y.s.t) -- cycle; +enddef; + +def ellipse(suffix s)(expr width,height) = + x.s.l = x.s - width/2; x.s.r = x.s + width/2; + y.s.t = y.s + height/2; y.s.b = y.s - height/2; + _del[incr _dn] := "_ellipse(" & str s & ");"; +enddef; + +def _ellipse(suffix s) = + draw (fullcircle xscaled (x.s.r - x.s.l) yscaled (y.s.t - y.s.b) + shifted z.s); +enddef; + +def circle(suffix s)(expr diameter) = + x.s.l = x.s - diameter/2; x.s.r = x.s + diameter/2; + y.s.t = y.s + diameter/2; y.s.b = y.s - diameter/2; + _del[incr _dn] := "_circle(" & str s & ");"; +enddef; + +def _circle(suffix s) = + draw (fullcircle scaled (x.s.r - x.s.l) shifted z.s); +enddef; + +def oval(suffix s)(expr width,height,superness) = + x.s.l = x.s - width/2; x.s.r = x.s + width/2; + y.s.t = y.s + height/2; y.s.b = y.s - height/2; + x.s.ness = superness; + _del[incr _dn] := "_oval(" & str s & ");"; +enddef; + +def _oval(suffix s) = + draw superellipse((x.s.r,y.s),(x.s,y.s.t),(x.s.l,y.s),(x.s,y.s.b), + x.s.ness); +enddef; + +def triangle(suffix s)(expr width,height) = + x.s.l = x.s - width/2; x.s.r = x.s + width/2; + y.s.t = y.s + height/2; y.s.b = y.s - height/2; + _del[incr _dn] := "_triangle(" & str s & ");"; +enddef; + +def _triangle(suffix s) = + draw (x.s.l,y.s.b) -- (x.s.r,y.s.b) -- (x.s,y.s.t) -- cycle; +enddef; + +def lozenge(suffix s)(expr width,height) = + x.s.l = x.s - width/2; x.s.r = x.s + width/2; + y.s.t = y.s + height/2; y.s.b = y.s - height/2; + _del[incr _dn] := "_lozenge(" & str s & ");"; +enddef; + +def _lozenge(suffix s) = + draw (x.s.l,y.s) -- (x.s,y.s.b) -- + (x.s.r,y.s) -- (x.s,y.s.t) -- cycle; +enddef; + +dot_diameter := 2.4pt; + +def dot(suffix s) = + x.s.dd = dot_diameter; + _del[incr _dn] := "_dot(" & str s & ");"; +enddef; + +def _dot(suffix s) = + fill fullcircle scaled x.s.dd shifted z.s; +enddef; + +def line(suffix s) = + _del[incr _dn] := "_line(" & str s & ");"; +enddef; + +def _line(suffix s) = + draw z.s.o -- z.s.d; +enddef; + +dash_length := 4pt; + +def dottedline(suffix s) = + x.s.dl = dash_length; x.s.dd = dot_diameter; + _del[incr _dn] := "_dottedline(" & str s & ");"; +enddef; + +def _dottedline(suffix s) = + begingroup save p, n; + path p; p = z.s.o -- z.s.d; + n := floor(length(z.s.d-z.s.o)/abs(x.s.dl)); + for i := 0 upto n: + fill fullcircle scaled x.s.dd shifted (point i/n of p); + endfor endgroup +enddef; + +def dashedline(suffix s) = + x.s.dl = dash_length; + _del[incr _dn] := "_dashedline(" & str s & ");"; +enddef; + +def _dashedline(suffix s) = + begingroup save p, n; + path p; p = z.s.o -- z.s.d; + n := floor(length(z.s.d-z.s.o)/abs(x.s.dl)); + if not (odd n): n := n + 1; fi + for i := 0 upto (n-1): if not (odd i): + draw subpath(i/n,(i+1)/n) of p; + fi endfor endgroup +enddef; + +arrow_head_length := 6pt; +arrow_head_width := 2.4pt; + +def arrowhead(suffix s) = + x.s.ahl = arrow_head_length; x.s.ahw = arrow_head_width; + _del[incr _dn] := "_arrowhead(" & str s & ");"; +enddef; + +def _arrowhead(suffix s) = + z.s.dh = (x.s.ahl/length(z.s.d-z.s.o))[z.s.d,z.s.o]; + z.s.dr = z.s.dh + x.s.ahw / 2 * dir(angle(z.s.d-z.s.o)+90); + z.s.dl = z.s.dh + x.s.ahw / 2 * dir(angle(z.s.d-z.s.o)-90); + fill z.s.d -- z.s.dr -- z.s.dl -- cycle; +enddef; + +def arrow(suffix s) = + arrowhead(s); + _del[incr _dn] := "_arrow(" & str s & ");"; +enddef; + +def _arrow(suffix s) = + draw z.s.o .. z.s.dh; +enddef; + +def cillinder(suffix s)(expr width,height) = + x.s.l = x.s - 1/2width; x.s.r = x.s + 1/2width; + y.s.b = y.s - 1/2height; y.s.t = y.s + 1/2height; + y.s.ar = 1/6height; + _del[incr _dn] := "_cillinder(" & str s & ");"; +enddef; + +def _cillinder(suffix s) = + draw (x.s.l,y.s.t-y.s.ar) -- (x.s.l,y.s.b+y.s.ar); + draw (x.s.r,y.s.t-y.s.ar) -- (x.s.r,y.s.b+y.s.ar); + draw (x.s.l,y.s.b+y.s.ar){down} .. (x.s,y.s.b){right} + .. (x.s.r,y.s.b+y.s.ar){up}; + draw (x.s.l,y.s.t-y.s.ar){down} .. (x.s,y.s.t-2y.s.ar){right} + .. (x.s.r,y.s.t-y.s.ar){up} .. (x.s,y.s.t){left} .. cycle; +enddef; + +join_radius := 5pt; + +def box(suffix s)(expr width,height) = + x.s.l = x.s - width/2; x.s.r = x.s + width/2; + y.s.t = y.s + height/2; y.s.b = y.s - height/2; + x.s.jr = join_radius; + _del[incr _dn] := "_box(" & str s & ");"; +enddef; + +def _box(suffix s) = + if min((x.s.r-x.s.l),(y.s.t-y.s.b)) > 2x.s.jr: + draw (((x.s,y.s.b) .. (x.s.r,y.s.b)) softjoin + ((x.s.r,y.s.b) .. (x.s.r,y.s.t)) softjoin + ((x.s.r,y.s.t) .. (x.s.l,y.s.t)) softjoin + ((x.s.l,y.s.t) .. (x.s.l,y.s.b)) softjoin + ((x.s.l,y.s.b) .. (x.s,y.s.b))); + else: + draw (fullcircle xscaled (x.s.r-x.s.l) yscaled (y.s.t-y.s.b) + shifted z.s); + fi +enddef; + +def soft(suffix s) = + _del[incr _dn] := "_soft(" & str s & ");"; +enddef; + +def _soft(suffix s) = + draw (z.s.o -- z.s.m) softjoin (z.s.m -- z.s.d); +enddef; + +def softt(suffix s) = + _del[incr _dn] := "_softt(" & str s & ");"; +enddef; + +def _softt(suffix s) = + draw ((z.s.o .. z.s.m1) softjoin + (z.s.m1 .. z.s.m2) softjoin (z.s.m2 .. z.s.d)); +enddef; + +def fork(suffix s) = + z.s.head.o = z.s.m; z.s.head.d = z.s.d; + arrowhead(s.head); + dot(s.o); + z.s.body.o = z.s.o; z.s.body.m = z.s.m; + z.s.body.d = z.s.head.dh; + soft(s.body); +enddef; + +def darrow(suffix s) = + z.s.med = 1/2[z.s.o,z.s.d]; + z.s.one.o = z.s.med; z.s.one.d = z.s.d; + arrow(s.one); + z.s.two.o = z.s.med; z.s.two.d = z.s.o; + arrow(s.two); +enddef; + +def arroww(suffix s) = + z.s.head.o = z.s.m; z.s.head.d = z.s.d; + arrowhead(s.head); + z.s.body.o = z.s.o; z.s.body.m = z.s.m; + z.s.body.d = z.s.head.dh; + soft(s.body); +enddef; + +def arrowww(suffix s) = + z.s.head.o = z.s.m2; z.s.head.d = z.s.d; + arrowhead(s.head); + z.s.body.o = z.s.o; z.s.body.m1 = z.s.m1; + z.s.body.m2 = z.s.m2; z.s.body.d = z.s.head.dh; + softt(s.body); +enddef; diff --git a/Master/texmf-dist/doc/plain/metatex/mtpaper/diagram.tex b/Master/texmf-dist/doc/plain/metatex/mtpaper/diagram.tex new file mode 100644 index 00000000000..9dd392df99f --- /dev/null +++ b/Master/texmf-dist/doc/plain/metatex/mtpaper/diagram.tex @@ -0,0 +1,83 @@ +% DIAGRAM.TEX + +\dimen0=\hsize \divide\dimen0 by 10 +\dimen2=\dimen0 \divide\dimen2 by 3 \multiply\dimen2 by 4 + +\MTbeginchar(\the\dimen0,\the\dimen2,0pt); +\MT: thickpen; +\MT: z1 = (0,0); z2 = (0,h); z3 = (w,h); z4 = (w,0); +\MT: z5 = (1/3w,1/8h); z6 = (1/2w,0); z7 = (2/3w,-1/16h); +\MT: draw z1 -- z2 -- z3 -- z4; +\MT: draw z1 .. z5 ..z6 .. z7 .. z4; +\MT: thinpen; +\MT: for i = 11 upto 20: y[i] = 1/8h + 7/80h*(i-10); endfor +\MT: for i = 12,13,15,16,17,19,20: +\MT: draw (1/8w,y[i]) -- (7/8w,y[i]); +\MT: endfor; +\MT: for i = 11,14,18: +\MT: draw (1/4w,y[i]) -- (7/8w,y[i]); +\MT: endfor; +\MTendchar; + +\setbox0=\box\MTbox + +\ifdim\hsize<10cm + \let\figfont=\smallsf \def\driver{drv} + \dimen0=\hsize \multiply\dimen0 by 2 \divide\dimen0 by 3 +\else + \let\figfont=\sf \def\driver{Driver} + \dimen0=\hsize \multiply\dimen0 by 2 \divide\dimen0 by 4 +\fi + +\MTbeginchar(\the\hsize,\the\dimen0,\the\ht0); +\MT: save u, v; u = w/10; v = h/10; +\MT: thickpen; +%\MT: draw (0,-d)--(0,h)--(w,h)--(w,-d)--cycle; draw(0,0)--(w,0); +\MT: x1l = x2l = x4l = x7l = 2u; +\MT: y1t = h - v; z1lbl = z1; +\MT: rectangle(1)(u,v); +\MTlabel(1lbl)"\figfont\TeX"; +\MT: y2 = y3 = y1 - 2v; z2lbl = z2; z3lbl = z3; x3 = x2 + 2u; +\MT: ellipse(2)(u,v); rectangle(3)(u,v); +\MTlabel(2lbl)"\figfont\TeX"; \MTlabel(3lbl)"\figfont TFM"; +\MT: y4 = y5 = y6 = y2 - 2v; x5 = x3 + 2u; x6 = x5 + 2u; +\MT: z4lbl = z4; z5lbl = z5; z6lbl = z6; +\MT: rectangle(4)(u,v); ellipse(5)(u,v); rectangle(6)(u,v); +\MTlabel(4lbl)"\figfont DVI"; \MTlabel(5lbl)"\figfont MF"; +\MTlabel(6lbl)"\figfont MF"; +\MT: y7 = y8 = y4 - 2v; x8 = x3; z7lbl = z7; z8lbl = z8; +\MT: ellipse(7)(u,v); rectangle(8)(u,v); +\MTlabel(7lbl)"\figfont\driver"; \MTlabel(8lbl)"\figfont GF"; +\MT: x9 = x7; y9t = y7t - 2v; +\MTlabel(9)"\box0"; +\MT: x31r = x2l - u; y31 = y2; z31lbl = z31; rectangle(31)(u,v); +\MTlabel(31lbl)"\figfont FMT"; +\MT: x32 = x5; y32b = y5t + v; z32lbl = z32; rectangle(32)(u,v); +\MTlabel(32lbl)"\figfont BAS"; +\MT: x33 = x31; y33 = y4; z33lbl = z33; rectangle(33)(u,v); +\MTlabel(33lbl)"\figfont log"; +\MT: x34 = x32; y34 = y7; z34lbl = z34; rectangle(34)(u,v); +\MTlabel(34lbl)"\figfont log"; +\MT: thinpen; join_radius:=15pt; +\MT: z11o = (x1,h); z11d = (x1,y1t); arrow(11); +\MT: z12o = (x1,y1b); z12d = (x2,y2t); arrow(12); +\MT: z13o = (x3l,y3); z13d = (x2r,y2); arrow(13); +\MT: z14o = (x2,y2b); z14d = (x4,y4t); arrow(14); +\MT: z15o = (w,y6); z15d = (x6r,y6); arrow(15); +\MT: z16o = (x6l,y6); z16d = (x5r,y5); arrow(16); +\MT: z17o = (x5l,y5); z17d = (x3,y3b); z17m = (x3,y5); +\MT: arroww(17); +\MT: z18o = (x5l,y5); z18d = (x8,y8t); z18m = (x8,y5); +\MT: arroww(18); +\MT: z19o = (x4,y4b); z19d = (x7,y7t); arrow(19); +\MT: z20o = (x8l,y8); z20d = (x7r,y7); arrow(20); +\MT: z21o = (x7,y7b); z21d = (x9,y9t); arrow(21); +\MT: z41o = (x31r,y31); z41d = (x2l,y2); arrow(41); +\MT: z42o = (x32,y32b); z42d = (x5,y5t); arrow(42); +\MT: z43o = (x2,y2b); z43d = (x33r,y33t); arrow(43); +\MT: z44o = (x5,y5b); z44d = (x34,y34t); arrow(44); +\MT: x0 = w/2; y0 = y9; % y0b = -d; +\MTlabel(0)"\rm \TeX\ formats"; +\MTendchar; + +\centerline{\box\MTbox} diff --git a/Master/texmf-dist/doc/plain/metatex/mtpaper/frame.tex b/Master/texmf-dist/doc/plain/metatex/mtpaper/frame.tex new file mode 100644 index 00000000000..a1433d567c7 --- /dev/null +++ b/Master/texmf-dist/doc/plain/metatex/mtpaper/frame.tex @@ -0,0 +1,23 @@ +% FRAME.TEX (RMCG19950401) + +\catcode`\@=11 + +\newbox\@uxbox + +\let\oldhrule=\hrule \let\oldvrule=\vrule +\def\rulethickness{\afterassignment\rul@thickness\dimen0 } +\def\rul@thickness{\edef\hrule{\oldhrule height\dimen0 }% + \edef\vrule{\oldvrule width\dimen0 }} + +\def\framebox{\afterassignment\fr@mebox\count@=} +\def\fr@mebox{\ifvoid\count@\else \bgroup + \dimen0=\wd\count@ \dimen2=\ht\count@ \advance\dimen2\dp\count@ + \global\setbox\@uxbox=\vtop{ + \hbox to\dimen0{\vrule\hss\vbox to \dimen2{\hrule\vss + \hbox to\dimen0{}\vss\hrule}\hss\vrule}\kern0pt}\egroup + \wd\@uxbox=0pt \ht\@uxbox=0pt \dp\@uxbox=0pt + \ifhbox\count@ + \setbox\count@=\hbox{\raise\ht\count@\box\@uxbox\box\count@}\else + \setbox\count@=\vbox{\box\@uxbox\nointerlineskip\box\count@}\fi\fi} + +\catcode`\@=12 diff --git a/Master/texmf-dist/doc/plain/metatex/mtpaper/mtpaper.tex b/Master/texmf-dist/doc/plain/metatex/mtpaper/mtpaper.tex new file mode 100644 index 00000000000..de044df2bf7 --- /dev/null +++ b/Master/texmf-dist/doc/plain/metatex/mtpaper/mtpaper.tex @@ -0,0 +1,654 @@ + +\input tugboat.sty + +%\input tugboat.dates +%\input tb75pages +%\pageno=\TBcasa + +% EXTRA CODE + +\ifx\plaindefaults\undefined \let\next=\relax +\else \let\next=\plaindefaults \fi \next + +\input metatex +\MTline{input delay.mf;} + +\def\MTeX{{\manual META}\-\TeX} +\font\smallsf=cmssq8 +\font\sf=cmss10 + +% END EXTRA CODE + + +\title * {\MTeX} * +\author * Ram\'on Casares * +\address * Telef\'onica de Espa\~na * +\netaddress * r.casares@computer.org * + +\article %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\head * Abstract * + +{\MTeX} is a set of {\plain} {\TeX} and {\MF} macros that you can use to +define both the text and the figures in a single source file. Because +{\MTeX} sets up two way communication, from {\TeX} to {\MF} and back +from {\MF} to {\TeX}, drawing dimensions can be controlled by {\TeX} and +labels can be located by {\MF}. Only standard features of {\TeX} and +{\MF} are used, but two runs of {\TeX} and one of {\MF} are needed. + + +\head * Overview * + +Together, {\TeX} and {\MF} define the page layout to the pixel. This +means that nothing more is needed, not even a means of including figures +in a {\TeX} document. To prove this is the aim of this paper. + +To split the typesetting process in two parts, one to define and draw +the characters and the other to arrange the characters in paragraphs and +pages, is surely the best way to reduce the complexity of the +typesetting task, provided it needs simplification (see Figure~1). But +this method makes it difficult, for example, to integrate labels with +graphics in figures, because while {\TeX} is best suited to typeset the +labels, {\MF} is the appropriate tool to draw the graphics. And, of +course, labels should be located in accordance with the graphics. + +Therefore, the true successor of {\TeX} has to include in a single +program both the capabilities of {\TeX} and {\MF}. Then the typesetting +engine would include a powerful graphic tool, a grid in which to typeset if +required, and it could take into account the shapes of the characters to +determine, for example, kernings or italic corrections. The other way +around is also possible. It could be seen as a graphic engine with a +powerful typesetting tool. From this point of view, the page would be a +graphic object that could contain paragraphs of different shapes +requested from the typesetting tool. + +\MTeX, although it does not fulfill the requirements of such a +successor, can be seen as an early sign of its possibilities. For the +moment, {\MTeX} takes advantage of {\MF}'s equation solving capabilities +to locate objects, including the labels, which are typeset by {\TeX}. The +cost of this nice feature is that two {\TeX} passes are required. + +During the first {\TeX} pass a {\MF} file is written. As it is {\TeX} +itself who writes the {\MF} file, any dimension controlled by {\TeX} can +be used and incorporated in {\MF}'s calculations. For example, the label +sizes, as they will be typeset by {\TeX}, are made known to {\MF}. + +After the first {\TeX} pass, {\MF} draws the graphic figures and +writes the label locations in its log file. So it is {\MF}'s +responsibility to locate the labels. Note that, depending on the style +of {\MF} programming, this can be completely determined from {\TeX}. In +other words, you can relate the label location to the location and size +of other {\MF} objects, or not. + +When {\TeX} executes its second pass, it takes the graphics +from the new font, reads the location of labels from the +{\MF} log file, and then everything is complete. + +Because labels are just |\hbox|es typeset by \TeX, every macro currently +defined for text automatically applies also to figures. For example, if +a macro |\person| is defined to write its argument in a small caps font +and save it to an index file, the same happens whenever it is used +inside a figure label. + + +\head * Methods * + +{\MTeX} allows the source file to include, in addition to the customary +{\TeX} macros to control the text, other commands to generate +figures with {\MF}. + +\subhead * Steps * + +In order to use {\MTeX} the following three steps are to be executed: + +\list[\numbered] + +\item The {\MTeX} file, suppose it is |filename.ext|, is first +processed by |TEX|, with the {\plain} format, during which a {\MF} file +named |auxiliar.mf| is created. This {\MF} file contains information +provided by {\TeX} concerning the size of the labels, so the |MF| +program can delete this area from the figure if requested. If the output +file |filename.dvi| were typeset now, it would have blanks in place of +the figures, but otherwise be the same as the final document. + +\item Then |MF|, with the {\plain} base, is run on |auxiliar.mf|. +As a result, information specifying where to typeset the labels is +written in the log file, |auxiliar.log|. In addition, the metric file, +|auxiliar.tfm|, and the generic format bitmap font, |auxiliar.329gf|, +are created. On my system I have to process this |gf| file to get a +|pk| file that my drivers can read, so I execute the program |GFtoPK| on +it, getting the packed bitmap font |auxiliar.329pk|. Please note three +points. i)~The number |329|, referring to the resolution, varies +according to the {\MF} mode. ii)~The |tfm| and |pk| files must be in or +moved to directories where programs can find them. iii)~{\MTeX} sets the +{\MF} mode to |localfont|, thus assuming that |localfont| is assigned +the appropriate name. + +\item Lastly, |filename.ext| is again run through |TEX|. During this +second run, both the font |auxiliar| containing the figures and the +information explaining where to locate the labels are available, so the +document is complete. + +\endlist + +The figures fill exactly the same area in both the first and second +|TEX| program runs, so indices, tables of contents, and other references +that also need two passes to be resolved can take advantage of the two +runs needed by {\MTeX}. + +\subhead * Use * + +To use the {\MTeX} macros, they must be imported by writing in the +source file: ||\input metatex|| + +\noindent This has to be written after |\mag| has been given its final +value. When |metatex.tex| is read, {\MTeX} checks whether the file +|auxiliar.mf| exists. If it does not exist, then things are set up for +the first pass; for example, |auxiliar.mf| is opened for writing. If it +does exist, then things are set for the second pass; for example, +|auxiliar.log| is opened for reading. This means that if +|auxiliar.mf| is not deleted, then step~3, the second |TEX| program +pass, is executed directly. This saves time when only the text in file +|filename.ext|, but not the figures, were modified. + +\subhead * User macros * + +The {\MTeX} user macros are: + +\list + +\item |\MTbeginchar(wd,ht,dp);| states that a figure sized as given +(width |wd|, height |ht|, depth |dp|) will be created. These values +should be known both by {\TeX} and by {\MF}, so for example |12pt|, +|6cm|, |\the\hsize| or |\the\dimen0|, always without |#|, are allowed. +During the {\it first pass}, {\TeX} writes in |auxiliar.mf| the {\MF} +macro |beginchar| assigning character codes sequentially, and box +|\MTbox| is made empty but sized as specified by the arguments of this +macro. During the {\it second pass}, {\TeX} puts the corresponding +character of the font |auxiliar| in box |\MTbox|. The size of |\MTbox| is +that specified and not affected by the character dimensions. + +\item |\MTendchar;| finishes the figure definition. During the +{\it first pass}, {\TeX} writes the {\MF} macro |endchar;| in file +|auxiliar.mf|. During the {\it second pass}, box |\MTbox| contains the +complete figure, including labels. Something like |\box\MTbox| is +used to typeset the figure. + +\item |\MTlabel*(s)cc"Text";| adds a label to the current figure. +The parameter between quotes, |Text| in the example, is the label +content; it will be put inside an |\hbox| and therefore could be +anything that {\TeX} allows inside an |\hbox|. The optional asterisk +after |\MTlabel| instructs {\MTeX} to erase the area of the figure +already drawn that it is under the label. + +The label will be located at {\MF} point |z.s|, where |s| is the parameter +between parentheses. The reference point is further specified by the +optional parameter after the right parenthesis, |cc| in the example. +This parameter is composed of exactly two letters: the first can be |t| +meaning top, |c| meaning center or |b| meaning bottom; and the second +letter can be |l| meaning left, |c| meaning center or |r| meaning right. +So, for example, |tl| means that the label reference point is its top +left corner. The default value for the reference point is |cc|, that is, +its center. + +|\MTlabel| should only be used between |\MTbeginchar| and |\MTendchar|. +During the {\it first pass}, it writes the following three elements in +|auxiliar.mf|: i)~the {\MF} macros which in turn cause |MF| to write the +label reference point location to its log file, |auxiliar.log|; ii)~the +four label sides, which are by this means made available to the +following {\MF} code for the figure, notated as |y.s.t| for the top side, +|y.s.b| for the bottom side, |x.s.l| for the left side and |x.s.r| for the right +side; and iii)~the code to delete, if requested, the figure area already +drawn that is under the rectangle occupied by the label. During the {\it +second pass}, it adds the label to the box |\MTbox| in the place that +reads from file |auxiliar.log|, making no modification to the dimensions of +|\MTbox|, even if the label is typeset outside the box. + +\endlist + +There are three more macros for passing information to \MF, that is, for +writing general text in |auxiliar.mf|: |\MT:|, |\MTcode| and |\MTline|. +This happens only during the first pass; during the second pass, these +macros do nothing. + +\list + +\item |\MT:| writes in file |auxiliar.mf| everything till the end of +line. It writes verbatim except for the character |\|, which keeps its +normal {\TeX} |\catcode| of |0|. Spaces are {\it not\/} ignored after +macros. The sequence |\\| writes a single |\| in file |auxiliar.mf|. + +\item |\MTcode| writes in file |auxiliar.mf| everything until it finds a +line equal (including |\catcode|s) to the current value of |\MTendmark|. +By default, this is a blank line, thus, |\def\MTendmark{}|. As with +|\MT:|, it writes verbatim except for |\|, which still operates as an +escape character. The control sequence |\\| writes a single |\| in file +|auxiliar.mf|. + +\item |\MTline{text}| writes its parameter to |auxiliar.mf|, +|text| in the example. It does not change the |\catcode|s in the +argument, so it does not perform verbatim writing. But all {\plain} +special characters can be written prefixing them by the escape character +|\|. The {\plain} special characters are (not including the first colon +nor the final period): |\{}$&#^_~%|. For example, |\#| results in +|#|. + +\endlist + +When defining {\TeX} macros that write to |auxiliar.mf|, |\MTline| +should generally be used in preference to |\MT:| or |\MTcode|, because +the latter two use +the end of line in a special way that is not usually available when +{\TeX} is reading a macro. + +{\TeX} dimensions can be included using any of these three writing +macros. For example, |\the\hsize| will be expanded to {\tt \the\hsize} +(for the present article), +and written as such to the {\MF} file |auxiliar.mf|. Note that the character +|\| keeps its escape |\catcode| in all three writing macros. In the +case of |\MTline|, braces |{}| also keep their |\catcode|s and therefore +macros with parameters can be used normally. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\head * Examples * + +\subhead * Diagram * + +First a typical example of {\MTeX} usage, showing the file formats, +programs, and their relationships. The figure width is exactly +|\hsize|, but what is more important is that the same code will adapt +itself to any value for the measure. Well, of course, not to {\it any\/} +width but to any width between, let's say, $8\,$cm and $25\,$cm. + +\figure[\caption{Figure 1: One column diagram}] + \input diagram +\endfigure + +%\twocolfigure[\caption{Figure 2: Two columns diagram}] +% \input diagram +%\endfigure + +Figure~1 is the one column version, and Figure~2 (above the appendix) is +the two column version, generated by the same source. + + +%%%%%%%%%%%%%%%%%%% + +\input shadow + +\def\beginshadowpar{\setbox0=\vbox\bgroup \kern3pt + \advance\parindent by -3pt \leftskip=3pt\rightskip=3pt } +\def\endshadowpar{\par\kern3pt\egroup\framebox0\shadowbox0\box0 } + +% \subhead * Shadowing * +\bigskip % \subhead skip + +\beginshadowpar\noindent +{\bf Shadowing.} Both {\TeX} and {\MF} are ill suited to creating +shadows. In {\TeX}, one straightforward technique is double use of +|\leaders|, but in practice this results in huge |dvi| files. In {\MF}, +drawing lots of tiny points easily exceeds the capacity of the program. +The solution is to coordinate the work of both programs. +\endshadowpar + +To create a large rectangular shadow we divide it into an array of $n +\times m$ smaller rectangles. The smaller rectangles are all identical, +so it is enough for {\MF} to draw one shadow character and then for +{\TeX} to typeset a solid area repeating it. + +To simplify the tasks of both {\TeX} and {\MF}, the size of the shadow +character should be similar to that of normal characters, because neither +program was designed to work well with extraordinarily large (or small) +characters. So a +good approach is to make the shadow character as big as possible but +never wider nor higher than 16$\,$pt. + +For {\MTeX}, each figure is a character. This causes problems with {\MF} +when the figure is big and the resolution is high, because it cannot +draw areas bigger than $4095\times4095$ pixels. This is not usually a +problem working at 300$\,$dpi. (It is never a problem with {\MP}, see +the following section on {\PS}. Another advantage of using {\PS} is that +you get a shadow simply by drawing a grey rule, and none of the above +machinations are necessary.) + +%%%%%%%%%%%%%%%%%%% + +\subhead * Keys * + +After the following {\MTeX} macros: + +\verbatim[\numbered\outputtofile{keys.tex}] +\MTcode +def keybox = + pickup pencircle scaled 0.8pt; + x1 = x3 = 1pt; + x2 = x4 = w - 1pt; + x5 = 0; x6 = w; + y1 = y2 = -d; + y3 = y4 = h; + y5 = y6 = (h - d)/2; + draw z1 -- z2 .. z6{up} .. + z4 -- z3 .. z5{down} .. cycle; + z0 = (x1,0); +enddef; + +\def\defkey#1#2{\setbox0=\hbox{\sf#2}% + \dimen0=\wd0\advance\dimen0 by 2pt + \dimen2=\ht0\advance\dimen2 by 1pt + \dimen4=\dp0\advance\dimen4 by 1pt + \MTbeginchar(\the\dimen0,% + \the\dimen2,% + \the\dimen4);% + \MTline{keybox;}% + \MTlabel(0)bl"\sf #2";% + \MTendchar;% + \expandafter\newbox + \csname\string#1box\endcsname + \expandafter\setbox + \csname\string#1box\endcsname + =\vtop{\unvbox\MTbox}% + \def#1{\expandafter\copy + \csname\string#1box\endcsname}} + +\def\makekey#1{\expandafter\defkey% + \csname#1\endcsname{#1}} +\endverbatim + +\input keys + +Then, we can declare |\makekey{Alt}|\makekey{Alt} to +typeset {\Alt} simply via |\Alt|. It is also possible to +declare |\defkey\escape{\tt\char92}|\defkey\escape{\tt\char92} and then +|\escape| results in \escape. + +%%%%%%%%%%%%%%%%%%% + +\subhead * Baroque tables * + +Baroque periods are the result of new technical achievements providing +unexplored possibilities and hence the urgent need to experiment with them, +frequently far away from what discretion might recommend. This explains +the time of baroque software that we live in, and increases the value of +\MTeX, because it provides the means to easily draw baroque tables. I am not +a baroque man, so my baroque table example is not baroque but, and this +is the point, it is at least not built with straight lines. + +\MTcode +def tablebox = + pickup pencircle scaled 1.6pt; + x0 = 5pt; y0 = 5pt; + draw (0,h) ... (w/2,h+y0) ... (w,h) ... (w+x0,(h-d)/2) ... (w,-d) ... + (w/2,-d-y0) ... (0,-d) ... (-x0,(h-d)/2) ... cycle; +enddef; + +\def\beginbaroquetable{\setbox0=\vbox\bgroup + \halign\bgroup##\hfil&&\quad##\hfil\cr} +\def\endbaroquetable{\crcr\egroup\egroup + \MTbeginchar(\the\wd0,\the\ht0,\the\dp0);% + \MTline{ tablebox;}% + \MTendchar;% + $$\rlap{\box\MTbox}\box0$$} + +\beginbaroquetable + This is not a straight table\cr + but it's only an example\cr + and therefore not so ample\cr + of what's {\MTeX}-able! +\endbaroquetable + +%%%%%%%%%%%%%%%%%%% + +\MTcode +def leftbrace = + pickup penrazor scaled 2pt rotated 30; + x3 = 0; x0 = x6 = w; x1 = x5 = w/5; x2 = x4 = w-x1; + y0 = 0; y1 = h/8; y2 = h/3; y3 = h/2; + y4 + y2 = h; y1 + y5 = h; y6 = h; + draw z0 .. z1 .. z2 .. z3; + draw z6 .. z5 .. z4 .. z3; +enddef; + +\def\beginbracedpar{\setbox0=\vbox\bgroup + \leftskip=20pt } +\def\endbracedpar{\strut\par\egroup + \MTbeginchar(20pt,\the\ht0,0pt);% + \MTline{ leftbrace;}% + \MTendchar;% + \hbox to\hsize{\rlap{\box\MTbox}\box0\hss}} + +%\subhead * Ornate paragraphs * +\bigskip % \subhead skip + +\beginbracedpar\noindent +{\bf Ornate paragraphs.} Only if you are truly baroque can you get the +most from {\MTeX}. If, for example, you like ornate paragraphs, you are +in your element. Just put the material in a |\vbox| to get the height +and the depth, and pass these dimensions to {\MF} to draw a right sized +embellishment. Ah!, but be aware that Computer Modern is a neoclassical +font, so it won't mix well with your elaborations. +\endbracedpar + +%%%%%%%%%%%%%%%%%%% + +% To fill unused space! +\MTcode + def tribar(expr alpha) = + pickup pencircle scaled 0.8pt; + % draw (0,0)--(w,0)--(w,h)--(0,h)--cycle; + save u, v; u = w/2; v = 12; + z1 = (w/2,h/2) + u*(right rotated alpha); + z2 = (w/2,h/2) + u*(right rotated (alpha+120)); + z3 = (w/2,h/2) + u*(right rotated (alpha-120)); + z1r = (w/2,h/2) + u*(right rotated (alpha+v)); + z2r = (w/2,h/2) + u*(right rotated (alpha+120+v)); + z3r = (w/2,h/2) + u*(right rotated (alpha-120+v)); + draw z1 .. z1r; draw z2 .. z2r; draw z3 .. z3r; + draw z1 .. z3r; draw z2 .. z1r; draw z3 .. z2r; + z1m = whatever[z1,z2r]; z1m = whatever[z1r,z3]; + z2m = whatever[z2,z3r]; z2m = whatever[z2r,z1]; + z3m = whatever[z3,z1r]; z3m = whatever[z3r,z2]; + draw z1 .. z2m; draw z2 .. z3m; draw z3 .. z1m; + z1ra = z1 reflectedabout (z1r,z1m); + z2ra = z2 reflectedabout (z2r,z2m); + z3ra = z3 reflectedabout (z3r,z3m); + draw z1m .. z1ra; draw z2m .. z2ra; draw z3m .. z3ra; + z3x - z1x = whatever*(z3-z1m); + z2x - z3x = whatever*(z2-z3m); + z1x - z2x = whatever*(z1-z2m); + z1ra - z1x = whatever*(z3-z1m); + z3ra - z3x = whatever*(z2-z3m); + z2ra - z2x = whatever*(z1-z2m); + z1y = whatever[z1m,z3]; z1y = whatever[z1x,z2x]; + z2y = whatever[z2m,z1]; z2y = whatever[z2x,z3x]; + z3y = whatever[z3m,z2]; z3y = whatever[z3x,z1x]; + draw z1x .. z3y; + draw z2x .. z1y; + draw z3x .. z2y; + enddef; + +\def\tribar#1#2{% #1=ht, #2=angle + \MTbeginchar(#1,#1,0pt);\MTline{tribar(#2);}\MTendchar;\box\MTbox} + +\newcount\angle \angle=-36 +\newdimen\tribarht \tribarht=75pt + +%\subhead * Exercice * +\bigskip % \subhead skip + + \noindent + {\bf Exercise.}\footnote*{The real exercise is to fill the rest of the + page with tribars. A clue: let {\TeX} to calculate how many are needed, + so you can concentrate your efforts in drawing the figure.} + Take three equal bars and build as shown. + Ask Roger Penrose if you don't find the solution. + \vskip1pc + + \loop + \vfil + \line{\tribar{\the\tribarht}{\the\angle}\hfil \global\advance\angle5 + \tribar{\the\tribarht}{\the\angle}\hfil \global\advance\angle5 + \tribar{\the\tribarht}{\the\angle}\global\advance\angle5 } + \dimen0=\pagegoal \advance\dimen0 by-\pagetotal + \ifdim\dimen0>\tribarht + \repeat + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\head * {\PS} * + +By taking advantage of {\MP}, we can make {\PS} versions of the +{\MTeX} files. Simply execute |mpost &plain auxiliar.mf| instead of +{\MF} and, after {\TeX}'s second pass, execute |dvips| ({\MTeX} uses +|dvips| specials). This works because |auxiliar.mf| is valid code +for both {\MF} and {\MP}, and because, in the second {\TeX} pass, +{\MTeX} checks which one was used and adapts itself to the situation. + +And thanks to {\PDF\TeX} and the Con{\TeX}t files |supp-mis.tex| and +|supp-pdf.tex|, it is also possible to get \acro{PDF} output. Just +execute {\PDF\TeX} twice, instead of {\TeX}, and once {\MP}, instead of +{\MF}. (In practice, {\MTeX} uses its own macro file |mtmp2pdf.tex| for +this, instead of the Con{\TeX}t files. I extracted all that {\MTeX} +needs from the Con{\TeX}t files into |mtmp2pdf.tex|.) + +This works because, if {\MTeX} determines that {\MP} was employed to +draw the figures, it then checks which program, {\TeX} or {\PDF\TeX}, is +executing. If {\TeX}, then it includes the files produced by {\MP} using +the |dvips| specials. If {\PDF\TeX}, it translates from |ps| to |pdf|. + +Therefore, the same {\MTeX} source file generates at will any of the +three output formats---|dvi|, |ps|, or |pdf|---just by running the +appropriate programs. In the appendix, as an example, there is a +\acro{DOS} batch file that shows how to get the |pdf| version of a file +|filename.ext|. + + +\head * Other graphical tools * + +There are other tools to include pictures in a {\TeX} document. +{\LaTeX}'s |picture| environment, {\PiCTeX}, and |mfpic|, are three of +them. {\MTeX} is similar to |mfpic|, in that both use {\MF} to draw. + +The aim of |mfpic| is to overcome the difficulties of {\LaTeX}'s +|picture| environment and of {\PiCTeX}. {\LaTeX}'s |picture| environment +uses four pre-cooked special fonts, and its drawings are just +compositions of these characters (as well as {\TeX}'s builtin |\hrule|s and +|\vrule|s). {\PiCTeX} only uses a tiny point to compose the pictures, so +it is more general. But letting {\TeX} to draw the figures setting point +after point is painful, as noted above. The |mfpic| solution uses a +better tool for drawing: {\MF}. + +With these origins, for |mfpic|, {\MF} is a hidden back-end processor, +and |mfpic| imposes only two requirements on its users: to know {\TeX}, +and to know |mfpic|. On the other hand, {\MTeX}'s approach is +minimalist, at the cost of being more demanding with its users. A +{\MTeX} user has to know {\TeX}, {\MF}, and {\MTeX}\Dash although this +last requirement is small, because {\MTeX} only builds the necessary +bridges to use {\TeX} and {\MF} in a cooperative way. + +A feature that shows the different strategies employed in designing +|mfpic| and {\MTeX} is label positioning. {\MTeX} labels are located by +{\MF}, so {\TeX} has to read the {\MF} log file to learn where to +typeset them. For |mfpic|, {\TeX} itself locates the labels, +but by doing so |mfpic| has to give up some nice {\MF} characteristics, +such as its equation solving capabilities. + +% |mfpic| is to {\LaTeX} as {\MTeX} is to |plain| {\TeX}. +In summary, |mfpic|'s aim is to draw pictures in {\TeX} documents in a +better way than using {\LaTeX}'s |picture| environment or {\PiCTeX}; +while {\MTeX}'s intention is to coordinate the work of {\TeX} and +{\MF}. In this way, {\MTeX} provides the full raw power of {\TeX} and +{\MF}, and it is up to you to harness them. + + +\head * Final remarks * + +I have been using {\MTeX} for some years. The first version was dated +1994, but it has been used only for personal purposes. For this reason, +it is not truly a straightforward end-user tool, as for example {\LaTeX} packages +should be. It has to be used knowledgeably and with care. And though +most tasks can be automated, by chaining {\TeX} and {\MF} errors are +even more difficult to pinpoint than in {\TeX} or {\MF} alone. + +Nevertheless, {\MTeX} serves to validate the feasibility of a closer +collaboration between {\TeX} and {\MF} and to appraise the interest of +such a collaboration. And, of course, if you dare, you can get lots of +fun, and at least an equal amount of frustration, using {\MTeX}. Try it! + +The {\MTeX} package is available from {\CTAN} in +\acro{CTAN}|:/macros/plain/contrib/metatex|. + +Happy {\MTeX}ing! + + +\makesignature + + +\newpage + + +\onecol % Annex in one column, can't switch to \twocol on the same page + % with current plain tugboat macros. + +\figure[\caption{Figure 2: Two-column diagram}] +\input diagram +\endfigure + +\head * Appendix: Pseudo-batch example * + +This is an example based on \acro{DOS} batch files that can be adapted for +other operating systems. It processes the file |filename.ext|, generating +|filename.pdf|. We will comment each line of pseudo-code. + +\list[\numbered] +\item We go to the directory where our working files are. + ||cd c:\dir\subdir\mydir|| +\item We set environment variables (if necessary). In this case we are +using a |web2c| system, so it is enough to set one. In |web2c|, by +default, all programs look for files in the current dir, ``|.|'', and +that is enough for us. + ||set TEXMFCNF=c:\tex\texmf.local\web2c;c:\tex\texmf\web2c;d:\texmf\web2c|| +\item We tell the operating system where to find the programs. + ||path=$path$;c:\tex\bin\dos|| +\item After the settings, we force the first {\TeX} pass. + ||if exist auxiliar.mf del auxiliar.mf|| +\item Then, we execute the first {\TeX} pass (in this case, it is {\PDF\TeX}). + ||pdftex &plain filename.ext|| +\item If {\MTeX} was not used, and no |auxiliar.mf| was written, then we +are done. + ||if not exist auxiliar.mf goto end|| +\item Otherwise we run {\MP} with its |&plain| memory (format), +also known as |&mpost|. + ||mpost &plain auxiliar.mf|| +\item Finally, we execute the second {\TeX} pass. + ||pdftex &plain filename.ext|| +\item We now have the complete |filename.pdf| file. + ||:end|| + +\endlist + +\MTline{end.} % METATeX changes \bye +\endarticle + + +% To check labels (ink intensive example!) +\MTbeginchar(5cm,5cm,0cm); +\MT: fill (0,0)--(w,0)--(w,h)--(0,h)--cycle; +\MT: z0 = (w/2,h/2); +\MT: z1 = (w/2,3h/4); z11 = z1; +\MT: z2 = (w/2,h/4); +\MT: z3 = (0,h/2); +\MT: z4 = (0,h/4); +\MTlabel*(0)"Center"; +\MTlabel*(1)tl"."; +\MTlabel*(11)br"."; +\MTlabel*(2)":"; +\MTlabel(3)"Out"; +\MTlabel*(4)"Intruder"; +\MTendchar; +$$\box\MTbox$$ diff --git a/Master/texmf-dist/doc/plain/metatex/mtpaper/shadow.tex b/Master/texmf-dist/doc/plain/metatex/mtpaper/shadow.tex new file mode 100644 index 00000000000..5ac184ef523 --- /dev/null +++ b/Master/texmf-dist/doc/plain/metatex/mtpaper/shadow.tex @@ -0,0 +1,85 @@ +% SHADOW.TEX (RMCG19950401) + +\ifx\MT\undefined \input metatex \fi +\ifx\framebox\undefined \input frame \fi + +\let\TMline=\MTline + +\catcode`\@=11 + +\newdimen\shadowdim \shadowdim=0.3pt % for 600dpi; try 0.85 for 300dpi + +\TMline{\% Defined by SHADOW.TEX} +\TMline{} +\TMline{ if unknown prologues: font_size 12pt\#; fi} +\TMline{} +\TMline{ def shadowall(expr dist) =} +\TMline{ begingroup} +\TMline{ save u,v,distx,disty,zbase,zcur;} +\TMline{ pair zbase,zcur;} +\TMline{ u := floor(w/dist); if odd u: u := u + 1; fi distx = w/u;} +\TMline{ v := floor(h/dist); if odd v: v := v + 1; fi disty = h/v;} +\TMline{ zbase := (1/2distx,1/2disty);} +\TMline{ for i := 0 upto (u-1):} +\TMline{ zcur := zbase if odd i: + (0,disty) fi;} +\TMline{ for j := 0 upto (v-1): if (not odd(i+j)):} +\TMline{ addto currentpicture contour unitsquare shifted zcur;} +\TMline{ zcur := zcur + (0,2disty);} +\TMline{ fi endfor} +\TMline{ zbase := zbase + (distx,0);} +\TMline{ endfor} +\TMline{ endgroup;} +\TMline{ enddef;} +\TMline{} + +\def\shadowbox{\afterassignment\sh@dowbox\count@=} +\def\sh@dowbox{\ifvoid\count@ \let\next=\relax \else + \shadowchar + \ifMTmf \let\next=\MTsh@dow \else + \ifx\pdfliteral\undefined \let\next=\PSsh@dow \else + \let\next=\ACsh@dow \fi \fi \fi + \next} + +\def\shadowchar{\bgroup + \dimen0=\wd\count@ \dimen2=\ht\count@ \advance\dimen2\dp\count@ + \dimen4=16pt \count2=\dimen4 + \count0=\dimen0 \divide\count0 by \count2 \advance\count0 by 1 + \dimen4=\dimen0 \divide\dimen4 by \count0 + \count0=\dimen2 \divide\count0 by \count2 \advance\count0 by 1 + \dimen6=\dimen2 \divide\dimen6 by \count0 + \setbox0=\box\MTbox + \MTbeginchar(\the\dimen4,\the\dimen6,0pt);% + \MTline{ shadowall(\the\shadowdim);}% + \MTendchar;% + \global\setbox\@uxbox=\vtop to \dimen2{\cleaders + \hbox to \dimen0{\cleaders\box\MTbox\hfil}\vfil}% + \global\setbox\MTbox=\box0 \egroup} + +\def\MTsh@dow{\wd\@uxbox=0pt \ht\@uxbox=0pt \dp\@uxbox=0pt + \ifhbox\count@ + \setbox\count@=\hbox{\raise\ht\count@\box\@uxbox\box\count@}\else + \setbox\count@=\vbox{\box\@uxbox\nointerlineskip\box\count@}\fi} + +\def\PSsh@dow{\ifhbox\count@ + \setbox\count@=\hbox{\special{ps:gsave 0.8 setgray}% + \rlap{\vrule width \wd\count@ height \ht\count@ depth \dp\count@}% + \special{ps:0 setgray grestore}% + \unhbox\count@}\else + \setbox\count@=\vbox{\special{ps:gsave 0.8 setgray} + \vtop to 0pt{\vbox to 0pt{ + \hrule width \wd\count@ height \ht\count@ depth \dp\count@ + \vss}\vss} + \special{ps:0 setgray grestore} + \nointerlineskip + \unvbox\count@}\fi} + +\def\ACsh@dow{\ifhbox\count@ + \setbox\count@=\hbox{\pdfliteral{q 0.8 g}% + \rlap{\vrule width \wd\count@ height \ht\count@ depth \dp\count@}% + \pdfliteral{0 g Q}\unhbox\count@}\else + \setbox\count@=\vbox{\pdfliteral{q 0.8 g} + \vtop to 0pt{\vbox to 0pt{ + \hrule width \wd\count@ height \ht\count@ depth \dp\count@ + \vss}\vss}\pdfliteral{0 g Q}\nointerlineskip\unvbox\count@}\fi} + +\catcode`\@=12 |