From 48e91ef03a032a541100743df1fd083696a5d3cd Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Tue, 8 Oct 2013 22:05:45 +0200 Subject: [PATCH] Rework doc-handing make rules and remove generated files from version control. Newer texinfo.tex was imported from texinfo 5.1. --- .gitignore | 16 + Makefile.in | 11 +- doc/Makefile | 22 +- doc/gnushogi.html | 58 - doc/gnushogi.info | 55 - doc/gnushogi.info-1 | 1080 ----- doc/gnushogi.info-2 | 1251 ------ doc/gnushogi.ps | 4283 ------------------- doc/gnushogi_1.html | 91 - doc/gnushogi_10.html | 118 - doc/gnushogi_11.html | 64 - doc/gnushogi_12.html | 126 - doc/gnushogi_13.html | 164 - doc/gnushogi_14.html | 77 - doc/gnushogi_15.html | 231 -- doc/gnushogi_16.html | 114 - doc/gnushogi_17.html | 162 - doc/gnushogi_18.html | 186 - doc/gnushogi_19.html | 558 --- doc/gnushogi_2.html | 62 - doc/gnushogi_20.html | 547 --- doc/gnushogi_21.html | 156 - doc/gnushogi_22.html | 96 - doc/gnushogi_23.html | 61 - doc/gnushogi_24.html | 208 - doc/gnushogi_3.html | 405 -- doc/gnushogi_4.html | 133 - doc/gnushogi_5.html | 146 - doc/gnushogi_6.html | 100 - doc/gnushogi_7.html | 140 - doc/gnushogi_8.html | 86 - doc/gnushogi_9.html | 136 - doc/gnushogi_abt.html | 202 - doc/gnushogi_ovr.html | 65 - doc/gnushogi_toc.html | 100 - doc/texinfo.tex |10941 ++++++++++++++++++++++++++++++++++--------------- 36 files changed, 7611 insertions(+), 14640 deletions(-) delete mode 100644 doc/gnushogi.html delete mode 100644 doc/gnushogi.info delete mode 100644 doc/gnushogi.info-1 delete mode 100644 doc/gnushogi.info-2 delete mode 100644 doc/gnushogi.ps delete mode 100644 doc/gnushogi_1.html delete mode 100644 doc/gnushogi_10.html delete mode 100644 doc/gnushogi_11.html delete mode 100644 doc/gnushogi_12.html delete mode 100644 doc/gnushogi_13.html delete mode 100644 doc/gnushogi_14.html delete mode 100644 doc/gnushogi_15.html delete mode 100644 doc/gnushogi_16.html delete mode 100644 doc/gnushogi_17.html delete mode 100644 doc/gnushogi_18.html delete mode 100644 doc/gnushogi_19.html delete mode 100644 doc/gnushogi_2.html delete mode 100644 doc/gnushogi_20.html delete mode 100644 doc/gnushogi_21.html delete mode 100644 doc/gnushogi_22.html delete mode 100644 doc/gnushogi_23.html delete mode 100644 doc/gnushogi_24.html delete mode 100644 doc/gnushogi_3.html delete mode 100644 doc/gnushogi_4.html delete mode 100644 doc/gnushogi_5.html delete mode 100644 doc/gnushogi_6.html delete mode 100644 doc/gnushogi_7.html delete mode 100644 doc/gnushogi_8.html delete mode 100644 doc/gnushogi_9.html delete mode 100644 doc/gnushogi_abt.html delete mode 100644 doc/gnushogi_ovr.html delete mode 100644 doc/gnushogi_toc.html diff --git a/.gitignore b/.gitignore index c3649b8..f11da0b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,19 @@ /xshogi/scanner.c /xshogi/parser.c /xshogi/xshogi + +/doc/gnushogi*.info +/doc/gnushogi*.html +/doc/*.ps +/doc/*.pdf +/doc/*.aux +/doc/*.cp +/doc/*.cps +/doc/*.dvi +/doc/*.fn +/doc/*.ky +/doc/*.log +/doc/*.pg +/doc/*.toc +/doc/*.tp +/doc/*.vr diff --git a/Makefile.in b/Makefile.in index 7812668..cdc7c8f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -73,7 +73,7 @@ xshogi_install: $(XSHOGIDIR)/xshogi # Cleanup. # -clean: gnushogi_clean @XSHOGICLEAN@ +clean: gnushogi_clean @XSHOGICLEAN@ doc_clean gnushogi_clean: cd $(GNUSHOGIDIR); $(MAKE) clean @@ -81,6 +81,9 @@ gnushogi_clean: xshogi_clean: cd $(XSHOGIDIR); $(MAKE) clean +doc_clean: + cd doc; $(MAKE) clean + # # Building a distribution. @@ -101,14 +104,14 @@ DISTCLEANFILES = \ distclean: clean rm -rf $(DISTCLEANFILES) - + cd doc; $(MAKE) distclean # # Extra cleanup, for the maintainer only. # -MAINTAINERCLEANFILES = configure config.h.in doc/gnushogi.info +MAINTAINERCLEANFILES = configure config.h.in maintainerclean: distclean rm -f $(MAINTAINERCLEANFILES) - + cd doc; $(MAKE) maintainerclean diff --git a/doc/Makefile b/doc/Makefile index 6e4e0ac..8b93ab6 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,5 +1,5 @@ -DISTCLEANFILES = *.info* *.ps *.html - +MAINTAINERCLEANFILES = *.info* +DISTCLEANFILES = *.ps *.html CLEANFILES = *.log *.dvi *.aux *.dlog \ *.cp *.cps *.fn *.ky *.pg *.toc *.tp *.vr @@ -7,22 +7,22 @@ CLEANFILES = *.log *.dvi *.aux *.dlog \ info: makeinfo gnushogi.texinfo -tex: +dvi: texi2dvi gnushogi.texinfo +pdf: + texi2pdf gnushogi.texinfo + # I do some egregious hacks to get around limitations of # texi2html. html: texi2html -split_node gnushogi.texinfo -view: - xdvi gnushogi.dvi - -ps: +ps: dvi dvips -t letter gnushogi.dvi -o gnushogi.ps -ps2: +ps2: dvi dvi2ps gnushogi.dvi > gnushogi.ps spell: @@ -39,5 +39,7 @@ distclean: clean do if [ -f $$file ]; then rm $$file; fi; \ done - - +maintainerclean: distclean + @for file in $(MAINTAINERCLEANFILES); \ + do if [ -f $$file ]; then rm $$file; fi; \ + done diff --git a/doc/gnushogi.html b/doc/gnushogi.html deleted file mode 100644 index c20fcc9..0000000 --- a/doc/gnushogi.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - -GNU Shogi manual: GNU Shogi manual - - - - - - - - - - - - - - - - - -
[Top][Contents][Index][ ? ]
-
-

GNU Shogi manual

- -

- - - - - - - - - -
1. Introduction  What is GNU shogi?
GNU GENERAL PUBLIC LICENSE  The GNU General Public License.
2. About the game of shogi  General information, rules, etc.
3. gnushogi  How to play GNU shogi (gnushogi).
4. xshogi  The X interface to GNU shogi.
5. References and links  Where to go for more information.
6. Acknowledgements  
7. Bugs  Where and how to report bugs.
8. Index  
-

- -


-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi.info b/doc/gnushogi.info deleted file mode 100644 index b009eee..0000000 --- a/doc/gnushogi.info +++ /dev/null @@ -1,55 +0,0 @@ -This is gnushogi.info, produced by makeinfo version 4.3 from -gnushogi.texinfo. - - This file describes how to use GNU shogi, a program which plays -Shogi (Japanese chess). - - Copyright (C) 1999 Michael C. Vanier and the Free Software -Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Free Software Foundation. - - -Indirect: -gnushogi.info-1: 926 -gnushogi.info-2: 49337 - -Tag Table: -(Indirect) -Node: Top926 -Node: Introduction1484 -Node: License2565 -Node: About shogi21724 -Node: The rules of shogi24319 -Node: The moves of the pieces25979 -Node: The opening setup29145 -Node: Promotion of pieces30677 -Node: Drops32518 -Node: Winning the game34770 -Node: Draws35484 -Node: Handicaps37889 -Node: Notes for chess players41315 -Node: Sample game42033 -Node: Mating problems49337 -Node: Shogi variants51585 -Node: Differences between shogi and chess55943 -Node: gnushogi60351 -Node: xshogi71829 -Node: References and links87937 -Node: Acknowledgements91081 -Node: Bugs92590 -Node: Index93073 - -End Tag Table diff --git a/doc/gnushogi.info-1 b/doc/gnushogi.info-1 deleted file mode 100644 index e37ba55..0000000 --- a/doc/gnushogi.info-1 +++ /dev/null @@ -1,1080 +0,0 @@ -This is gnushogi.info, produced by makeinfo version 4.3 from -gnushogi.texinfo. - - This file describes how to use GNU shogi, a program which plays -Shogi (Japanese chess). - - Copyright (C) 1999 Michael C. Vanier and the Free Software -Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Free Software Foundation. - - -File: gnushogi.info, Node: Top, Next: (dir), Prev: (dir), Up: (dir) - -GNU Shogi (Japanese chess) -************************** - -* Menu: - -* Introduction:: What is GNU shogi? -* License:: The GNU General Public License. -* About shogi:: General information, rules, etc. -* gnushogi:: How to play GNU shogi (gnushogi). -* xshogi:: The X interface to GNU shogi. -* References and links:: Where to go for more information. -* Acknowledgements:: -* Bugs:: Where and how to report bugs. -* Index:: - - -File: gnushogi.info, Node: Introduction, Next: License, Prev: Top, Up: Top - -Introduction -************ - - GNU shogi is a program that plays shogi, the Japanese version of -chess, against a human (or computer) opponent. This file describes how -to use GNU shogi and also gives background information about the game -of shogi. - - This file describes GNU shogi version 1.3.2. It was written by me, -Mike Vanier, the current maintainer of GNU shogi. My email address is -. - - GNU shogi is actually two programs: - - -`gnushogi' - is the text-based program which also contains the game-playing - engine. - -`xshogi' - is the X-windows graphical interface to gnushogi. - - - Since xshogi invokes gnushogi, most players will just type "xshogi" -and start playing. - - Disclaimer: I use the personal pronouns "him", "his" etc. to refer -to a shogi player regardless of gender. That's easier than writing -"his or her" all over the place. I don't mean to infer that women -don't play shogi; in fact shogi is very popular in Japan among women as -well as men. - - -File: gnushogi.info, Node: License, Next: About shogi, Prev: Introduction, Up: Top - -GNU GENERAL PUBLIC LICENSE -************************** - - Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -Preamble -======== - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it in -new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, -and (2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - 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) 19YY NAME OF AUTHOR - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - Also add information on how to contact you by electronic and paper -mail. - - If the program is interactive, make it output a short notice like -this when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details - type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - - The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the -commands you use may be called something other than `show w' and `show -c'; they could even be mouse-clicks or menu items--whatever suits your -program. - - You should also get your employer (if you work as a programmer) or -your school, if any, to sign a "copyright disclaimer" for the program, -if necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - SIGNATURE OF TY COON, 1 April 1989 - Ty Coon, President of Vice - - This General Public License does not permit incorporating your -program into proprietary programs. If your program is a subroutine -library, you may consider it more useful to permit linking proprietary -applications with the library. If this is what you want to do, use the -GNU Library General Public License instead of this License. - - -File: gnushogi.info, Node: About shogi, Next: gnushogi, Prev: License, Up: Top - -About the game of shogi -*********************** - - "Japanese chess cedes nothing in depth or beauty to the European - game... it is at least as interesting." - - -- Alexander Alekhine - (quoted in David Pritchard, `The Encyclopedia of Chess Variants') - - - "... shogi [is] by far the most complex form of chess that has ever - achieved widespread popularity." - - -- R. Wayne Schmittberger, `New Rules for Classic Games' - - - Shogi is the version of chess played in Japan. It is strikingly -different from standard chess (which I shall refer to henceforth as -"international chess") and also to all other regional variants, because -captured pieces can re-enter play on the side of the capturer. This -has several interesting effects on the play of the game: - - - 1. Shogi is much more complex than international chess, at least in - terms of the average number of possible moves per turn (estimated - at about 35 for chess and at about 80 for shogi). - - 2. There are almost no draws (about 1-2% of all games in professional - play). - - 3. Exchanges complicate the play rather than simplifying it. - - 4. There are no "endgames" in the standard chess sense; all pieces - remain in play throughout the game. Games typically end in a race - to checkmate the other player before being checkmated oneself. - - 5. Ownership of a piece is not indicated by the color of the piece; - instead, pieces are wedge-shaped and point towards the opponent. - The name of the piece is inscribed in Kanji characters on the - front of the piece. - - 6. Most importantly: it's more fun than other forms of chess :-) - - - - Shogi is extremely popular in Japan; it has been estimated that 20 -million Japanese can play shogi, of which perhaps 1 million are active -players. It is even more popular there than the game of go, Japan's -other favorite board game. There are a number of professional players -who make a considerable amount of money playing in shogi tournaments, -and the game receives extensive newpaper and television coverage. -Despite this, the game has yet to become popular outside of Japan. Part -of this is because the Kanji characters on the pieces scare away some -people, but mostly it's due, I think, to lack of exposure to the game -and to the difficulty of finding opponents. I hope that GNU shogi will -help introduce shogi to a wider audience. - -* Menu: - -* The rules of shogi:: -* Sample game:: -* Mating problems:: -* Shogi variants:: -* Differences between shogi and chess:: - - -File: gnushogi.info, Node: The rules of shogi, Next: Sample game, Prev: About shogi, Up: About shogi - -The rules of shogi -================== - - Shogi is a two-person abstract strategy board game with full -information (i.e. all pieces and moves are visible to both players at -all times). It is in the chess family, being descended from the same -ancestral game as international chess: the Indian game of Chaturanga. -The two players are referred to as "Black" and "White", with Black -moving first (unlike in international chess, where White moves first), -and with movement alternating between the two players. Note that -"Black" and "White" are just names; the pieces are not colored. -Instead, they are flat, wedge-shaped pieces which point towards the -opponent. The identity of a given piece is indicated by two Japanese -Kanji characters on each piece. In fact, only the top character is -needed to identify the piece and thus only the top character is used in -shogi diagrams. I will use alphabetical equivalents in the diagrams -here; to see what the Kanji characters look like, start up xshogi -(*note xshogi::) and compare the starting setup there with the starting -setup in this file (*note The opening setup::). - - The object of the game is to capture the opponent's King. The board -is a grid of 9x9 uncolored squares, and pieces are placed on the -squares. Each player begins with 20 pieces, described in the next -section. Capture is by displacement, as in international chess. - -* Menu: - -* The moves of the pieces:: -* The opening setup:: -* Promotion of pieces:: -* Drops:: -* Winning the game:: -* Draws:: -* Handicaps:: -* Notes for chess players:: - - -File: gnushogi.info, Node: The moves of the pieces, Next: The opening setup, Prev: The rules of shogi, Up: The rules of shogi - -The moves of the pieces ------------------------ - - Each player at the beginning of a shogi game has a total of 20 -pieces of eight different types. The moves of the shogi pieces can be -divided into three classes: "stepping" pieces, that only move one -square at a time; "ranging" pieces that move any number of unobstructed -squares in a line, and "jumping" pieces that can jump over obstructing -pieces to reach their destination squares. Most pieces can also -promote to different (usually stronger) pieces under certain -circumstances (see the next section). All pieces capture the same way -that they move (even pawns). The piece moves and promotions are as -follows; each piece name is followed by the standard piece abbreviation: - - 1. The king (K). The king can move one square in any horizontal, - vertical, or diagonal direction, just like the king in - international chess. The king does not promote. - - 2. The rook (R). The rook can move any number of squares in a - horizontal or vertical direction. The rook is the same as the - rook in international chess (except that it can promote). A rook - promotes to a "dragon king" or "dragon" for short (often just - referred to as a "promoted rook"), which can move as a rook or can - move one square in any diagonal direction. - - 3. The bishop (B). The bishop can move any number of squares in a - diagonal direction. The bishop is the same as the bishop in - international chess (except that it can promote). A bishop - promotes to a "dragon horse" or "horse" for short (often just - referred to as a "promoted bishop"), which can move as a bishop or - can move one square in any horizontal or vertical direction. - Note: the horse should not be confused with a knight (see below), - as they are two completely different pieces. - - 4. The gold general (G). A gold general can move one square in any - horizontal or vertical direction, or one square in a forward - diagonal direction. Gold generals do not promote. - - 5. The silver general (S). A silver general can move one square in - any diagonal direction, or one square straight forward. A silver - general promotes to a gold general. - - 6. The knight (N). A knight can move one square straight forward - followed by one square to either forward diagonal, jumping over - intervening pieces if any. In other words, a knight moves like - its international chess counterpart, but forward only. A knight - promotes to a gold general. The knight is the only jumping piece, - as in chess. - - 7. The lance (L). A lance can move any number of squares straight - forward. A lance promotes to a gold general. - - 8. The pawn (P). A pawn can move one square straight forward. The - pawn captures the same way that it moves, in contrast to - international chess. There is also no initial two-space move for - pawns and no _en-passant_ capture. A pawn promotes to a gold - general; a promoted pawn is usually known as a "Tokin". - - - -File: gnushogi.info, Node: The opening setup, Next: Promotion of pieces, Prev: The moves of the pieces, Up: The rules of shogi - -The opening setup ------------------ - - The opening setup for shogi is as follows: - - 9 8 7 6 5 4 3 2 1 -+--------------------------------------------+ -| wL | wN | wS | wG | wK | wG | wS | wN | wL | a -+--------------------------------------------+ -| | wR | | | | | | wB | | b -+--------------------------------------------+ -| wP | wP | wP | wP | wP | wP | wP | wP | wP | c -+--------------------------------------------+ -| | | | | | | | | | d -+--------------------------------------------+ -| | | | | | | | | | e -+--------------------------------------------+ -| | | | | | | | | | f -+--------------------------------------------+ -| bP | bP | bP | bP | bP | bP | bP | bP | bP | g -+--------------------------------------------+ -| | bB | | | | | | bR | | h -+--------------------------------------------+ -| bL | bN | bS | bG | bK | bG | bS | bN | bL | i -+--------------------------------------------+ - - - Here, "b" stands for "black" and "w" stands for "white", so that, -for instance, "bL" means "black lance". The numbers above the files -and the letters to the right of the ranks represent the most common -notation system used for shogi by westerners (the Japanese also use -Arabic numerals for the files but use Japanese numerals for the ranks). - - -File: gnushogi.info, Node: Promotion of pieces, Next: Drops, Prev: The opening setup, Up: The rules of shogi - -Promotion of pieces -------------------- - - In sharp contrast to international chess, where only pawns can -promote to higher-ranked pieces, most of the pieces in shogi can -promote. The promoted ranks are discussed in the section on piece -moves (*note The moves of the pieces::) but are repeated here for -reference: - -Pawn - promotes to gold general (called a `tokin' in this case only). - -Lance - promotes to gold general. - -Knight - promotes to gold general. - -Silver general - promotes to gold general. - -Gold general - does not promote. - -Bishop - promotes to "dragon horse" or just "horse" for short. The horse - can move as a bishop or can move one square in any orthogonal - direction. - -Rook - promotes to "dragon king" or just "dragon" for short. The dragon - can move as a rook or can move one square in any diagonal - direction. - -King - does not promote. - - - The three ranks furthest away from each player constitute his/her -"promotion zone". A player may, but is not required to, promote a -piece after making a move in which the piece begins and/or ends in the -promotion zone. Thus you can promote a piece when moving the piece into -the promotion zone, out of the promotion zone, or entirely within the -promotion zone. Promotion is mandatory in these cases: - - - 1. You must promote a pawn or a lance after moving it to the last - rank. - - 2. You must promote a knight after moving it to either of the last - two ranks. - - - - These forced promotions ensure that a piece cannot be moved to a -square from which it would have no further move. - - Pieces "dropped" onto the board (*note Drops::) always drop in the -unpromoted state, even if they drop into the promotion zone. - - -File: gnushogi.info, Node: Drops, Next: Winning the game, Prev: Promotion of pieces, Up: The rules of shogi - -Drops ------ - - When a player captures a piece, that piece is not removed from play. -Instead, it becomes the property of the capturer and can re-enter play -by being placed on (almost) any vacant square during the player's move. -This is known as a "drop" and counts as a full move (in other words, -you can either move a piece on the board or drop a piece onto the board -during your move, but not both). All pieces drop in the unpromoted -state. Pieces may be legally dropped in their promotion zone, but they -do not promote on that turn. - - There are several restrictions on drops: - - 1. A pawn may not be dropped onto a file if there is already an - unpromoted pawn belonging to the same player on that file. It is - legal to drop a pawn on a file which contains a _promoted_ pawn - belonging to the same player, however. - - 2. A pawn may not be dropped to give immediate checkmate on the move. - A pawn is, however, permitted to be moved on the board to give - immediate checkmate. This is a curious rule, and if anyone knows - the reason for it I would appreciate it if they would contact me - and explain it to me :-) - - 3. A pawn or piece may not be dropped onto a square from which they - would have no legal move. This means that pawns and lances may - not be dropped onto the last rank, and the knight may not be - dropped onto the last or second-to-last rank. - - - It is entirely permissible (and often advisable) to drop a piece or -pawn between one's King and an attacking ranging piece. For this -reason, the final checkmating move is nearly always an attack on the -King from an adjacent square (except for an attack by a Knight). - - Captured pieces are said to be pieces "in hand". - - The drop is the primary distinguishing feature of Japanese chess, -shared with no other popular chess-type game. It gives shogi a very -aggressive quality, and dramatically increases the number of possible -moves once a few pieces have been captured. Another interesting -feature of shogi is that exchanges complicate play rather than -simplifying it (as in international chess), because of the drop rule. - - -File: gnushogi.info, Node: Winning the game, Next: Draws, Prev: Drops, Up: The rules of shogi - -Winning the game ----------------- - - A game of shogi is won by capturing the opponent's king. In general, -this is done by checkmating the king: attacking the king in such a way -that the king cannot be defended no matter what the defending player -moves. Note, though, that there is no rule that requires a player to -defend a king which is being attacked. However, if he does not defend -his king, the opponent is entirely free to capture it on the next move, -thus winning the game. As in international chess, in practice most -games end by resignation when one player realizes that he cannot escape -checkmate. - - -File: gnushogi.info, Node: Draws, Next: Handicaps, Prev: Winning the game, Up: The rules of shogi - -Draws ------ - - There are very few draws in shogi; only about 1-2% of professional -games end in a draw. One reason for this is that material can never be -depleted as in chess, because captured pieces are constantly re-entering -play as a consequence of the drop rule. In fact, most of the ways a -game can be drawn in chess are not allowed in shogi: - - - * Draws cannot be offered. - - * There is no fifty-move rule. - - * A stalemate counts as a win for the stalemater. Stated otherwise: - if you can't move, you lose. - - * Perpetual check is illegal (see below). - - - - There are only two legal ways in which a draw can occur: - - - 1. A position (including the pieces in hand) occurs 4 times with the - same player to move (called "Sennichite"). However, if this is - caused by consecutive checks (direct attacks on the King, - threatening to capture it on the next move) by one side, the - player giving these checks loses the game. In other words, - perpetual check results in a loss for the attacker who recreates - the same position the 4th time. - - 2. Both players have moved their King into the the promotion zone (or - they cannot be prevented from doing so) and the Kings cannot be - checkmated. A King who has entered the promotion zone is known as - an "entering King"; due to the forward orientation of most shogi - pieces, it is very hard to mate such a King. In that case the - players may decide to count their pieces as follows: the King does - not count, the Rook and Bishop count as 5 points, and all other - pieces as one point. Promotion is disregarded. If both players - have at least 24 points the game is a draw (called "Jishogi"). If - a player has less, he loses the game. - - Of course, a player can refuse to count pieces when he still has - mating chances or chances to gain material which would affect the - outcome of the counting. There is no strict rule about what to do - if this is not the case, but nonetheless a player refuses to count - up (e.g. because he does not have enough points for a draw). It - has been generally accepted that in such a case the game ends and - the pieces are counted after one player has managed to get all his - pieces protected in the promotion zone. - - - - -File: gnushogi.info, Node: Handicaps, Next: Notes for chess players, Prev: Draws, Up: The rules of shogi - -Handicaps ---------- - - Unlike international chess, shogi has a well-established handicap -system which is used when players of different strengths play against -each other. Handicaps range from small to huge, which makes it -possible for weak players to play against even very strong players and -have an even chance of winning. - - Shogi players are ranked as follows: the weakest rank is around 15 -"kyu", which represents a beginner. 14 kyu is higher than 15 kyu, 13 -kyu is higher still, and so on until you get to 1 kyu. The next highest -rank is 1 "dan", followed by 2 dan, 3 dan and so forth. The highest -amateur rank is 6 dan; professionals go up to 9 dan. However, -professional ranks are not the same as amateur ranks; a professional 1 -dan is _much_ stronger than an amateur 1 dan. This system is similar -to that used by go players (and also other Japanese sports such as -karate). - - A handicap consists of the stronger player playing White and removing -one or more pieces from his side of the board at the start of the game. -These pieces are permanently removed from play; they are not in hand. - - The following is a list of the accepted handicaps, from weakest to -strongest. The degree of the handicap, represented by the position in -the list, represents the difference in rank between the two players for -which the handicap is appropriate. These rules are taken from the books -"Shogi for Beginners" by John Fairbairn and "The Art of Shogi" by Tony -Hoskings (*note References and links::) and, I believe, represent -current Japanese practice. - - - 1. The stronger player removes his left lance (on 1a). - - 2. The players play a two-game match; in the first game the stronger - player removes his left lance (on 1a), while in the second game he - removes his bishop. - - 3. The stronger player removes his bishop. - - 4. The stronger player removes his rook. - - 5. The stronger player removes his rook and left lance. - - 6. The players play a two-game match; in the first game the stronger - player removes his rook and left lance (on 1a), while in the - second game he removes his rook and bishop. - - 7. The stronger player removes his rook and bishop. This is usually - called a "two-piece" handicap. - - 8. The stronger player removes his rook, bishop, and both lances. - This is called a "four-piece" handicap. - - 9. The stronger player removes his rook, bishop, both lances, and both - knights. This is called a "six-piece" handicap. - - 10. The stronger player removes his rook, bishop, both lances, both - knights, and both silvers. This is called an "eight-piece" - handicap. - - - - Another advantage of playing handicap games is that the handicaps -alter the optimal strategy for both players. For instance, handicaps -all have their own opening lines which may bear little or no -resemblance to those used in non-handicap shogi. This means that when -learning handicap shogi, you are essentially learning completely new -games which use the same equipment! - - The reader may wonder how on earth a player giving an eight-piece -handicap, say, could possibly hope to win. Don't forget, though, that -in shogi the opponent's pieces can be captured and then become part of -one's own army. Thus, if the opponent plays badly enough, the number of -pieces will soon even out. - - -File: gnushogi.info, Node: Notes for chess players, Prev: Handicaps, Up: The rules of shogi - -Notes for chess players ------------------------ - - Here are a few miscellaneous things that may confuse chess players. -Some of these have been mentioned elsewhere, but they bear repeating. - - - 1. There is no queen. - - 2. Pawns capture the same way they move. There is no initial - two-space pawn move and no _en-passant_ move. - - 3. There is no special castling move. There _are_ a large number of - possible defensive formations referred to as "castles" (*note - Sample game::) but there is no need for special moves to create - them. - - 4. A given piece can only promote to _one_ other kind of piece. - - - - -File: gnushogi.info, Node: Sample game, Next: Mating problems, Prev: The rules of shogi, Up: About shogi - -Sample game -=========== - - This game was annotated by Pieter Stouten (*note References and -links::). I have made some minor corrections. Note that captures are -denoted by the "x" symbol e.g. Rx3f and drops are denoted by the "*" -symbol e.g. R*3f. Check is indicated by a "+" after the move, e.g. -R3f+. I recommend you use gnushogi/xshogi to play along with this -game. In xshogi simply hit the "Force Moves" button after starting up, -while in gnushogi enter the word "force" at the prompt. This will -allow you to enter moves for both sides. - - Note also that the move numbering system used here is the chess-type -system where one move means one move by each player. The Japanese count -one move made by each player as two moves. - --------------------------------------------------------------------------- - - Below you will find (the English translation of) an annotated game -which was published in the Dutch Shogi magazine "81" and in the Dutch -beginners booklet. It has proven to be a very useful game to explain -some basic principles of Shogi. Also, it is a rather straightforward -game compared to professional games where in most cases very diffuse -middle game fights take place. - - Pieter Stouten, 14th May 1990. - --------------------------------------------------------------------------- - - Black: Michael Trent (1-dan). White: David Murphy (2-dan). - - 1. P2f P3d 2. P2e B3c -[ This move is necessary, as otherwise white can exchange pawns: 3. P2d -Px2d 4. Rx2d. He would thus get a pawn in hand and open up his rook -file. ] - - 3. P7f P4d -[ White closes the bishop diagonal again. He plans to play ranging rook -(the rook goes to 5b, 4b, 3 or 2b; a defensive strategy) and in that -case he'd better avoid an exchange of bishops. One of the reasons is -that he will have problems developing his pieces without leaving holes -for bishop drops. ] - - 4. S4h R3b 5. P3f S4b 6. K6h K6b -[ In general the rook plays an important role in the attacks. It is -wise to move the king away from the area where the initial fights will -be and both players act according to the Shogi proverb "keep the rook -and king apart". ] - - 7. K7h K7b 8. P5f P5d 9. G4i-5h G4a-5b -[ Both players use their second gold general to build their castle. ] - - 10. S6h -[ In itself this move is not bad. However, it will become clear that -black plans a quick attack and in that case it is wiser to omit this -move. ] - - 10... S5c 11. P1f P1d -[ The advance of the edge pawns must be timed very well. The remark at -black's tenth move applies here too: this move is good if black wants to -play a slow game, because it eliminates a future B1e. ] - - 12. P4f K8b 13. N3g S7b -[ Black develops his knight in order to start an attack over the second, -third and fourth files. White strengthens his king's position and -awaits the attack. He aims at a counterattack as soon as black has -broken through into the white camp. Probably white's breakthrough will -take place later, but he has good compensation in the form of a stronger -castle. This theme occurs very often in static rook versus ranging rook -games. ] - - 14. P4e R4b -[ Black starts his attack and white puts up a very passive defence. His -rook has a hard task now to penetrate the black position. Moreover, he -blocks his own bishop. It seems much better to start a counterattack -with 14... P3e, later to be followed by B2b, B5a or Bx4d in order to use -his rook more actively. ] - - 15. Px4d Sx4d 16. P*4e S5c -[ 16... Sx4e is more active. A silver general is normally more valuable -than a knight, but white gets two pawns in hand and black none, while -the knight might come in handy for white too. ] - - 17. Bx3c+ Nx3c 18. P2d Px2d -[ Black threatens to break through and white has to consider taking the -pawn on 2d or starting a counterattack with Nx4e. If he chooses the -latter, black can play Px2c+ followed by +P3c. The disadvantage is the -black "tokin" (=promoted pawn) that white will get in his camp; the -advantage is that it will cost black two more moves to promote his rook. -Because white did not trust that the result after engaging in a -"semeai" (=mutual attack) with 18...Nx4e would give a positive result, -he captured the pawn on 2d. Making the right decision in moments like -this often makes the difference between a win and a loss: miss one -attacking chance and you will be forced to defend the whole game until -the unavoidable defeat; on the other hand, an unsound attack can destroy -all "aji" (=potential, meaning possibilities, threats) without getting -anything in return. ] - - 19. Rx2d Nx4e 20. Nx4e Rx4e 21. R2a+ P*4g -[ Now it becomes clear why black's 10. S6h was not good. Had this move -been omitted, then white would not have had the time to play 13... S7b -and after R2a+ the gold on 6a would hang. Thus black would have kept -"sente" (=initiative). Instead of 21... P*4g, B*6d is a very good -move, because after 22. P*2h black does not have a pawn in hand anymore -and he is being threatened with the annoying 22... N*4f 23. G5g N3h+ -24. S4g +N4h also. Black can also counter 21... B*6d with 22. N*3g. -White would then reply with 22... R4b 23. B*3c P*4g 24. Bx4b+ Sx4b. The -white rook has played its role and instead of spending moves on saving -it white starts to scatter black's defences by successive pawn drops on -the fourth file: 25. Gx4g P*4f 26. G5g N*6e 27. G5h P4g+ 28. Gx4g P*4f. -This analysis was provided by Kato Hifumi, 9-dan professional (the -highest regular grade). Destroying the coherence of the enemy pieces -(their shape) by dropping pawns is one of the most important Shogi -techniques. With the actual move 21... P*4g white missed a good -chance. ] - - 22. Sx4g P*4f 23. B*3g Px4g+ 24. +Rx6a +Px3g -[ 23. B*3g seems pointless, but a closer look reveals that it is -actually quite mean. On move 24 white cannot capture black's "Ryu" -(=dragon =promoted rook) with his silver: 24... Sx6a 25. N*7d K7b 26. -G*8b mate. By attacking the front of the white castle and threatening -to mate him there, black has the chance to break down the white -defences from the side. ] - - 25. +Rx5b S*6b -[ Here 25... B*4d would be much better, because it is defensive and -attacking at the same time. After e.g. 26. G*4c Bx9i+ 27. Gx5c black -threatens 28. +Rx7b Kx7b 29. S*6a K8b 30. S*7a Kx7a 31. G*7b mate. -White is one move quicker, however. He has the following beautiful -"tsume" (mating sequence where every move is check): 27... N*8f 28. Px8f -S*8g 29. Kx8g B*9h 30. K7h Bx8i+ 31. K8g +B8i-8h 32. K9f L*9e mate. -This illustrates the sharpness of Shogi: one move can make the -difference between winning and losing. ] - - 26. P*4f Rx4f -[ This move eliminates white's last chances. 26... R4b 27. +Rx4b Sx4b -28. R*4a seems annoying, but after 28... B*3c 29. S7g B*3b white wins -the rook and with his "tokin" on 3g there still is some hope. ] - - 27. N*6e +P4g -[ White cannot defend anymore, so he starts a desperate attack. Black -does not lose the right track, however. ] - - 28. Nx5c+ +Px5h 29. +Nx6b +Px6h 30. Gx6h N*8f 31. Px8f B*6i 32. -Gx6i R4h+ 33. N*6h +Rx6h 34. Gx6h S*8g 35. Kx8g N*9e 36. K7h -Resigns -[ White resigns here, because after 36... B*8g 27. K7g his attack has -petered out. ] - diff --git a/doc/gnushogi.info-2 b/doc/gnushogi.info-2 deleted file mode 100644 index 12ceac9..0000000 --- a/doc/gnushogi.info-2 +++ /dev/null @@ -1,1251 +0,0 @@ -This is gnushogi.info, produced by makeinfo version 4.3 from -gnushogi.texinfo. - - This file describes how to use GNU shogi, a program which plays -Shogi (Japanese chess). - - Copyright (C) 1999 Michael C. Vanier and the Free Software -Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Free Software Foundation. - - -File: gnushogi.info, Node: Mating problems, Next: Shogi variants, Prev: Sample game, Up: About shogi - -Mating problems -=============== - - One good way to improve at shogi is to solve mating problems. There -are several types of these problems, but the most common is called a -"tsume-shogi" problem, or "tsume" problem for short. In a tsume -problem, all pieces that are not on the board are assumed to be in the -opponent's hand (except for your King, which is usually not shown). -Every move you make must be check until the final checkmate. Your -opponent may play any piece on the board or drop any of his pieces in -hand in order to prevent the mate. In a properly constructed tsume -problem, all of your pieces on the board and in hand must be essential -to the solution. One consequence of this is that all of your pieces in -hand must be played during the solution. There should only be one -correct solution for the given number of moves. Tsume problems use -Japanese-style move numbering; thus, a problem where you move (and give -check), your opponent moves, and you move to give checkmate is called a -three-mover. Here is a really trivial three-mover: - - - 3 2 1 ----------------+ -| | | | a ----------------+ -| | | wK | b ----------------+ -| | | | c ----------------+ -| bN | | | d ----------------+ -| | | | e ----------------+ -| | bN | | f ----------------+ - -Black in hand: S, G - - - Here, Black plays G*2b, White plays K1c, and Black plays G*1d mate. -More typical tsume problems range from 5 moves to arbitrarily high -numbers of moves, and they can be quite brain-busting. Tsume problems -may seem artificial, but in the closing stages of the game where both -players have a lot of pieces in hand, it is often necessary to give -check at every move, or else your opponent will start a counterattack -and will mate you before you mate him. A tsume problem is a worst-case -scenario for the attacker: you have to mate your opponent even though he -has every piece not on the board in hand, which means you have to -develop sharp attacking skills. Many more tsume problems can be found -on the internet; I particularly recommend Patrick Davin's "Shogi Nexus" -(*note References and links::). - - -File: gnushogi.info, Node: Shogi variants, Next: Differences between shogi and chess, Prev: Mating problems, Up: About shogi - -Shogi variants -============== - - Several historical variants of shogi exist. Most of these were -invented before modern shogi (in some cases hundreds of years before), -are much larger than modern shogi and are not played with drops. Thus, -in many ways they are really more like giant chess games than like -modern shogi. The only one of these games to have survived in Japan is -Chu (middle) shogi, which is still played a little bit. Thanks to the -efforts of George Hodges and John Fairbairn of the Shogi Association -(two British shogi enthusiasts), these games were resurrected and rules -and sets for them can still be purchased from George Hodges (*note -References and links::). I hope to eventually extend GNU shogi so that -it can play at least some of these games. There are also several -non-historical variants of shogi; I don't know much about them but you -can find information about them on the internet (*note References and -links::). - - The historical variants include: - - - 1. Tori (bird) shogi, played on a 7x7 board with 32 pieces in all; - this is the only variant that is known to have been played with - drops. - - 2. Wa shogi, played on an 11x11 board with 54 pieces. This game can - be played with or without drops but the historical evidence favors - the view that it was played without drops. However, most people - who have tried it claim it is a much better game with drops, being - even more intricate than standard shogi. - - 3. Chu (middle) shogi, played on a 12x12 board with 92 pieces. This - was (and is) by far the most popular of the variants, and has 21 - different kinds of pieces in the starting line-up alone (along - with several others that appear upon promotion). Unlike modern - shogi, there are a tremendous number of ranging pieces and the - game is definitely not played with drops. There is also an - amazing piece called the Lion which has a double king move and can - capture two pieces at once! Chu shogi has a small but fanatical - following, some of whom consider it better than modern shogi. - - 4. Dai (great) shogi, played on a 15x15 board with 130 pieces. Other - than the larger board, this game is very similar to Chu shogi. - - 5. Tenjiku (exotic) shogi, played on a 16x16 board with 176 pieces. - This game is possibly the most complex tactical game in existence. - There are many astoundingly powerful pieces, including one (the - Fire Demon) that can capture up to eight opposing pieces in a - single move! Despite the size of the game, checkmates can occur - very suddenly (and often very early on) if one player makes a - wrong move. Tenjiku also has a small but fanatical following, one - of whom (Colin Adams) has written a book on the game which is - available for download at - `http://www.colina.demon.co.uk/tenjiku.html'. - - 6. Dai-dai (great-great) shogi, played on a 17x17 board with 192 - pieces. The opening setup alone has 64 different kinds of pieces! - This game and the larger ones that follow sound pretty - outlandish, but they have actually been played; a game of Dai-dai - can supposedly be played in about 12 hours. - - 7. Maka-dai-dai (great-great-great) shogi, played on a 19x19 board - with 192 pieces. For those for whom Dai-dai shogi is just too - small :-) - - 8. Tai (grand) shogi, played on a 25x25 board with 354 pieces! Until - recently, this was thought to be the biggest chess game ever - devised, but now there is... - - 9. Kyoku tai (extremely grand?) shogi, played on a 36x36 board with - 402 pieces. The rules for this have just been unearthed in an old - Japanese book. Hopefully someone will soon organize a postal - Kyoku tai shogi championship; maybe their distant ancestors could - finish it :-) - - It is thought that the really huge games (Dai-dai and up) were - never really played to any significant extent (gee, wonder why?) - and were devised merely so that the creators could have the fun of - inventing enormous games, amazing their friends and confounding - their enemies. However, the games up to Tenjiku shogi at least - appear to be quite playable, assuming one has the time. - - - - -File: gnushogi.info, Node: Differences between shogi and chess, Prev: Shogi variants, Up: About shogi - -Differences between shogi and chess -=================================== - - Some differences between shogi and international chess have been -mentioned elsewhere in this document; I summarize them here for people -who are interested in game comparisons. I won't try to deal with the -thorny question of which game is "better" although my bias may have -already come through :-) In fact, the drop rule makes the two games so -different in character that arguing over which game is better is like -comparing apples to oranges (you'd be better off comparing chess to Chu -shogi (*note Shogi variants::). However, I believe that if you are a -chess fan you'll really like shogi as well, and shogi is also popular -with many people who don't particularly like chess. - - Here are the significant differences between chess and shogi: - - - 1. In shogi, captured pieces become the property of the capturer and - can re-enter play by being dropped onto almost any vacant square. - In chess, captured pieces are out of the game. Thus, in shogi, - piece exchanges complicate the play significantly while in chess - they simplify it. - - 2. The shogi board is 9x9; the chess board is 8x8. - - 3. Shogi has five pieces with no counterpart in chess: the gold and - silver generals, the lance, the promoted rook and the promoted - bishop. Chess has one piece with no counterpart in shogi: the - queen. The knight's move in shogi is much more restrictive than - in chess. Pieces in shogi generally have a much smaller range of - movement than in chess (unless they are in hand). - - 4. In shogi, all pieces except the gold general and the king can - promote, but only to one kind of piece. Promotion is easier in - shogi because the promotion zone is closer to the starting - position of the pieces (especially pawns). In chess, only the - pawn can promote, but it can promote to any other piece except the - king. - - 5. In shogi, pawns capture the same way they move. There is no - initial two-space pawn move and hence no _en-passant_ captures. - In chess, pawns capture diagonally which means that opposing pawns - can block each other. - - 6. In shogi, you only have one rook and one bishop. Note that the - bishop is not restricted to only one "color" square (squares in - shogi aren't colored, but never mind) because promoted bishops can - also move one square orthogonally. - - 7. There is no special castling move in shogi. The term "castle" is - used in shogi to denote a defensive formation consisting of - (usually) three generals which protect the king. There are many - such castles (about 40 or so have names). *Note Sample game::. - - 8. Draws are much rarer in shogi than in chess. Perpetual check is - not allowed. Stalemate is a virtual impossibility, and is a loss - for the stalematee. - - 9. Since pieces are never out of play in shogi, chess-type endgames - involving only a few pieces do not occur. - - 10. Shogi games are generally longer than chess games (about 60-70 - moves is typical). - - 11. Shogi has a well-developed handicap system which is in general use; - chess does not. - - - - The effects of all these differences on play include (in my opinion): - - - 1. Piece/pawn structures in chess are more rigid than in shogi. Pawns - block each other and pawns, once advanced, cannot ever retreat. In - shogi, you can repair the hole caused by a pawn advance by - exchanging the pawn and dropping it back where you want it. Thus - shogi is more fluid than chess and less "structural". - - 2. Counterattack is MUCH more common in shogi than in chess. Games - typically end in mutual mating attacks, where each player is - trying to checkmate the other player before being checkmated - himself. This makes tempo incredibly important and also makes - sacrificial play quite common. - - 3. Attacks involving only ranging pieces are more a feature of chess - than of shogi. A shogi attack typically uses a ranging piece or - pieces to support an attack by short-range pieces (especially - generals). It is very rare to mate a king with a non-adjacent - ranging piece in shogi since the player whose king is threatened - can almost always interpose by dropping a piece. - - - - -File: gnushogi.info, Node: gnushogi, Next: xshogi, Prev: About shogi, Up: Top - -gnushogi -******** - - This section describes how to run the "gnushogi" program. - - - SYNOPSIS - - - gnushogi [ [[-]a] [-b bookfile] [-B binbookfile] [-C] [-h langfile] -[-L langfile] [-r length] [-R] [-s pathname] [-l pathname] [-S -binbooksize] [-t] [-c size] [-T size] [-v] [-x] [-X] arg1 arg2 ] - - - DESCRIPTION - - - GNU shogi (gnushogi) plays a game of japanese chess (shogi) against -the user or it plays against itself. - - At startup gnushogi reads the binbook file if it is present. It then -looks for a book file. If it is present it adds its contents to the -binbook data. If the binbook file is writable a new combined binbook -file is written. - - Gnushogi is a modified version of the gnuchess program. It has a -simple alphanumeric board display, or it can be used with the xshogi -program under X windows. The program gets its opening moves from the -file gnushogi.bbk which is located in a directory specified in the -Makefile. To invoke the program type: - - -`gnushogi -C' - simple curses based version - -`gnushogi -X (or just gnushogi)' - xshogi compatible version - -`gnushogi -R' - raw test display version - - - TIME CONTROLS - - - If one argument is given, it is the search time per move in -[minutes:]seconds. So gnushogi 30 will generate one move every 30 -seconds, while gnushogi 5:00 will generate one move every 5 minutes. - - If two or more arguments are given, they will be used to set -tournament time controls with the first argument of each pair being the -number of moves and the second being the total clock time in -minutes[:seconds]. Thus, entering gnushogi 60 5 will set the clocks -for 5 minutes (300 seconds) for the first 60 moves, and gnushogi 30 -3:30 will allow 3 minutes and 30 seconds for 30 moves. - - gnushogi 30 5 1 :30 will allow 5 minutes for the first 30 moves and -30 seconds for each move after that. Up to 4 pairs of controls may be -specified. - - If no argument is given the program will prompt the user for level of -play. - - For use with xshogi see the documentation on that program. *Note -xshogi::. - - - BOOK - - - The book gnushogi.tbk consists of a sequence of openings. An opening -begins with a line starting with a # (the rest of the line is a -comment). Following this is a series of moves in algebraic notation -alternating between black and white separated by whitespace. A move -may have a ? after it indicating this move should never be made in -this position. Moves are stored as position:move so transpositions -between openings can take place. - - - HASHFILE - - - The hashfile if created should be on the order of 4 megabytes; you -can create such a hashfile by typing "gnushogi -c 22" (see below). This -file contains positions and moves learned from previous games. If a -hashfile is used the computer makes use of the experience it gained in -past games. Tests run so far show that it plays no worse with the -hashfile than without, but it is not clear yet whether it provides a -real advantage. - - - LEGAL MOVES - - - Note: Piece letters are determined by the language file. What is -specified here is the default (English). - - Once gnushogi is invoked, the program will display the board and -prompt the user for a move. To enter a move, use the notation 7g7f -where the first letter-number pair indicates the origin square and the -second letter-number pair indicates the destination square. An -alternative is to use the notation P7f where the first letter indicates -the piece type (P,L,N,S,G,B,R,K). To promote append a + the type of -the new piece to the move, as in 2d2c+ or P2c+. Note that you must use -capital letters for the pieces by default. - - - COMMAND-LINE OPTIONS - - -`-a' - Do not search on opponent's time. - -`a' - Do search on opponent's time. - -`-b BOOKFILE' - Use bookfile for opening book. - -`-B BINBOOKFILE' - Use binbookfile for binary opening book. - -`-c SIZE' - Create a new HASHFILE. File size is 2^size entries of - approximately 65+? bytes. - -`-C' - Use curses-based display mode. - -`-h' - Do not use hashfile. - -`h' - Do use hashfile. - -`-l PATHNAME' - Pathname of the loadfile used with get or xget. - -`-L LANG' - Use language lang from the file gnushogi.lang. If -L is not - specified it uses the first language in the file. - -`-P PLYLEVELS' - Number of plys to include in the binbookfile. For generating a - binbookfile. - -`-r LENGTH' - Rehash _length_ times in searching entries for position in - transposition table. - -`-R' - Use raw text display mode. This can be used for dumb terminals or - for systems that don't have curses. - -`-s PATHNAME' - Pathname of the save file to use with the save command. - -`-S SIZE' - Size of binbookfile for memory based books. For creating a - binbookfile. - -`-t' - Show statistics for HASHFILE. - -`-T SIZE' - Set the transposition table size to 2^size entries. - -`-v' - Show version and patchlevel. - -`-x VALUE' - Use value as the evaluation window xwndw. - -`-X' - Use xshogi display mode (the default). - - - COMMANDS - - - In addition to legal moves, the following commands can be entered at -the gnushogi prompt. Note: command names are determined by the language -file and may vary with the implementation. The default language is -English. - -`alg' - allow algebraic input (not implemented). - -`Awindow' - change Alpha window (default score + 90). - -`Bwindow' - change Beta window (default score - 90). - -`beep' - toggles beeping after each move (default: on). - -`bd' - updates the current board position on the display. - -`book' - turns off use of the opening library. - -`both' - causes the computer to play both sides of a shogi game. - -`black' - causes the computer to play as White, if the computer was to move - first. - -`bsave' - saves a game to disk as a book textfile. The program will prompt - the user for a file name. - -`gamein' - toggles game mode time control. Assumes the time specified for - time control is the time for a complete game. Input with the - level command should be the game time and the expected number of - moves in a game. go command must be given. - -`coords' - show coordinates on the display (visual only). - -`contempt' - allows the value of _contempt_ to be modified. - -`debug' - asks for a piece as color piece, as wb or bn, and shows its - calculated value on each square. - -`debuglevel' - sets level of debugging output if compiled with debug options. - -`depth' - allows the user to change the search depth of the program. The - maximum depth is 29 ply. Normally the depth is set to 29 and the - computer terminates its search based on elapsed time rather than - depth. If depth is set to (say) 4 ply, the program will search - until all moves have been examined to a depth of 4 ply (with - extensions up to 11 additional ply for sequences of checks and - captures). If you set a maximum time per move and also use the - depth command, the search will stop at the specified time or the - specified depth, whichever comes first. - -`easy' - toggles easy mode (thinking on opponents time) on and off. The - default is easy mode ON. If easy mode is disabled, the keyboard - is polled for input every so often and when input is seen the - search is terminated. It may also be terminated with a sigint. - -`edit' - allows the user to set up a board position. - - # clear the board. - - - c toggle piece color. - - - . command will exit setup mode. - - - p3b place a pawn on 3b - - - p3b+ place a promoted pawn on 3b - - - p* place a pawn in hand (among the captured pieces) - - - Pieces are entered by typing a letter (p,l,n,s,g,b,r,k) for the - piece followed by the coordinate. Here, letter case is ignored. - - The usual warning about the language file applies. - -`exit' - exits gnushogi. - -`first' - tells the computer to move first. Computer begins searching for a - move. (same as "go"). - -`force' - allows the user to enter moves for both sides. To get the program - to play after a sequence of moves has been entered use the "black" - or "white" commands. - -`get' - retrieves a game from disk. The program will prompt the user for - a file name. - -`go' - tells the computer to move first. Computer begins searching for a - move. (same as "first"). - -`hash' - use/don't use hashfile. - -`hashdepth' - allows the user to change the minimum depth for using the hashfile - and the number of moves from the beginning of the game to use it. - -`help' - displays a short description of the commands and the current - status of options. - -`hint' - causes the program to supply the user with its predicted move. - -`level' - allows the user to set time controls such as 60 moves in 5 minutes - etc. In tournament mode, the program will vary the time it takes - for each move depending on the situation. If easy mode is - disabled (using the "easy" command), the program will often - respond with its move immediately, saving time on its clock for - use later on. - -`list' - writes the game moves and some statistics on search depth, nodes, - and time to the file "shogi.lst". - -`material' - toggle material flag - draws on no pawns and both sides < rook. - -`new' - starts a new game. - -`p' - evaluates the board and shows the point score for each piece. The - total score for a position is the sum of these individual piece - scores. - -`post' - causes the program to display the principal variation and the score - during the search. A score of 100 is equivalent to a 1 pawn - advantage for the computer. - -`quit' - exits the game. - -`random' - causes the program to randomize its move selection slightly. - -`rcptr' - set recapture mode. - -`remove' - backout the last level for both sides. Equal to 2 undo's. - -`reverse' - causes the board display to be reversed. That is, the Black's - pieces will now appear at the top of the board. - -`rv' - reverse board display. - -`save' - saves a game to disk. The program will prompt the user for a file - name. - -`switch' - causes the program to switch places with the opponent and begin - searching. - -`test' - performs some speed tests for MoveList and CaptureList generation, - and ScorePosition position scoring for the current board. - -`time' - set computer's time remaining, intended for synchronizing clocks - among multiple players. - -`tsume' - toggle tsume mode. In tsume mode, not all possible moves will be - generated. If a king is in check, only moves that get the king out - of check are generated. If the king is not in check, only moves - that give check to the opponent's king are generated. - -`undo' - undoes the last move whether it was the computer's or the human's. - You may also type "remove". This is equivalent to two "undo"'s - (e.g. retract one move for each side). - -`white' - causes the computer to play as Black; if the computer is to move - first the go command must be given. - -`xget' - read an xshogi position file. - -`xsave' - save as an xshogi position file. - -`xwndw' - change X window. The window around alpha/beta used to determine - whether the position should be scored or just estimated. Note: - this has _nothing_ to do with xshogi or X windows; the terms are - completely separate. - - - -File: gnushogi.info, Node: xshogi, Next: References and links, Prev: gnushogi, Up: Top - -xshogi -****** - - This section describes how to run the "xshogi" program. - - - SYNOPSIS - - - xshogi [ options ] - - - DESCRIPTION - - - xshogi provides an X11/Xt/Athena Widgets user interface for gnushogi. -With xshogi you can play gnushogi, set up arbitrary positions, force -variations, or watch xshogi manage a game between two shogi programs. -Furthermore, it can be used as an interface between two players on -different displays. - - xshogi can also be used as a shogi board to play out games. It will -read through a game file or allow a player to play through a variation -manually (force mode). This is useful for keeping track of email postal -games or browsing games off the net. - - After starting xshogi, you can make moves by pressing mouse button 1 -while the cursor is over a square with your piece on it and dragging the -mouse to another square. If the move is illegal, gnushogi will not -allow it. xshogi will then retract the move. - - - COMMAND-LINE OPTIONS - - - The following command line options also correspond to X resources -that you can set in your .Xdefaults file. - - -`[standard Xt options]' - xshogi accepts standard Xt options like -display, -geometry, and - -iconic. - -`-tc or -timeControl minutes[:seconds]' - Amount of time for a set of moves determined by movesPerSession. - If this number of moves is played within the time control period, - xshogi resets the time clocks. Default: 5 minutes. - -`-mps or -movesPerSession moves' - Number of moves in a time control period. Default: 40 moves. - -`-st or -searchTime minutes[:seconds]' - Tell gnushogi to spend at most the given amount of time searching - for each of its moves. Without this option, gnushogi chooses its - search time based on the number of moves and amount of time - remaining until the next time control. Setting this option also - sets -clockMode to False. - -`-sd or -searchDepth number' - Tell gnushogi to look ahead at most the given number of moves when - searching for a move to make. Without this option, gnushogi - chooses its search depth based on the number of moves and amount - of time remaining until the next time control. Setting this - option also sets -clockMode to False. - -`-clock or -clockMode (True | False)' - Determines whether or not to use the clock. If clockMode is - False, the clock does not run, but the side that is to play next - is still highlighted. - -`-td or -timeDelay seconds' - Time delay between moves during "Load Game". This doesn't have to - be a round number. Try -td 0.4. Default: 1 second. - -`-nsp or -noShogiProgram (True | False)' - If this option is True, xshogi acts as a passive shogi board; it - does not try to start a shogi program, not even to check whether - moves made in Force mode are legal. It also sets -clockMode to - False. Default: False. - -`-fsp or -firstShogiProgram program' - Name of first shogi program. In matches between two machines, this - program plays white. Default: "gnushogi". - -`-ssp or -secondShogiProgram program' - Name of second shogi program, if needed. In matches between two - machines, this program plays black; otherwise it is not started. - Default: "gnushogi". - -`-fh or -firstHost host' - Name of host the first shogi program plays on. Default: - "localhost". - -`-sh or -secondHost host' - Name of host the second shogi program plays on. Default: - "localhost". - -`-rsh or -remoteShell shell_name' - Some systems do not use rsh as the remote shell. This option - allows a user to name the remote shell command. This should be - done in the resource file. - -`-mm or -matchMode (False | Init | Position | Opening)' - Automatically run a game between firstShogiProgram and - secondShogiProgram. If matchMode is set to Init, xshogi will - start the game with the initial shogi position. If matchMode is - set to Position, xshogi will start the game with the position - specified by the loadPositionFile resource. If matchMode is set - to Opening, xshogi will play out the opening moves specified by - the -loadGameFile resource. If the -saveGameFile resource is set, - a move record for the match will be saved in the specified file. - Default: "False". - -`-lgf or -loadGameFile file' - Name of file to read a game record from. Game files are found in - the directory named by the SHOGIDIR environment variable. If this - variable is not set, the current directory is used unless the file - name starts with a /. - -`-lpf or -loadPositionFile file' - Name of file to read a game position from. Position files are - found in the directory named by the SHOGIDIR environment variable. - If this variable is not set, the current directory is used unless - the file name starts with a /. - -`-sgf or -saveGameFile file' - Name of file to save a game record to. Game files are saved in the - directory named by the SHOGIDIR environment variable. If this - variable is not set, the current directory is used unless the file - name starts with a /. - -`-spf or -savePositionFile file' - Name of file to save a game position to. Position files are saved - in the directory named by the SHOGIDIR environment variable. If - this variable is not set, the current directory is used unless the - file name starts with a /. - -`-coords or -showCoords (True | False)' - If this option is True, xshogi displays algebraic coordinates - along the board's left and bottom edges. The default is False. - The coordFont resource specifies what font to use. - -`-mono or -monoMode (True | False)' - Determines whether xshogi displays its pieces and squares with two - colors or four. You shouldn't have to specify monochrome. xshogi - will determine if this is necessary. - -`-pc or -pieceColor color' - Color specification for pieces suitable for XParseColor(). - Default: #FFFFD7. - -`-sc or -squareColor color' - Same for squares. Default: #EBDFB0. - -`-wps or -westernPieceSet (True | False)' - Choose the Western style piece set. - -`-npb or -normalPawnBitmap file' - -`-nnb or -normalKnightBitmap file' - -`-nbb or -normalBishopBitmap file' - -`-nrb or -normalRookBitmap file' - -`-nkb or -normalKingBitmap file' - Names of the bitmap files for the bitmap piece icons. - -`-rpb or -reversePawnBitmap file' - -`-rnb or -reverseKnightBitmap file' - -`-rbb or -reverseBishopBitmap file' - -`-rrb or -reverseRookBitmap file' - -`-rkb or -reverseKingBitmap file' - Names of the bitmap files for the outline piece icons. - -`-debug or -debugMode (True | False)' - Turns on debugging printout. - - - OTHER X RESOURCES - - -`initString' - The actual string that is sent to initialize the shogi program can - be set from .Xdefaults. It can't be set from the command line - because of syntax problems. The default value is - "new\nbeep\nrandom\neasy\n". The "new" and "beep" commands are - required. You can remove the "random" command if you like; - including it causes gnushogi to randomize its move selection - slightly so that it doesn't play the same moves in every game. - Even without "random", gnushogi randomizes its choice of moves - from its opening book. You can also remove "easy" if you like; - including it toggles easy mode off, causing gnushogi to think on - your time. That is, if "easy" is included in the initString, GNU - Shogi thinks on your time; if not, it does not. (Yes, this does - seem backwards, doesn't it.) You can also try adding other - commands to the initString; see the gnushogi documentation (*note - gnushogi::) for details. - -`blackString and whiteString' - These resources control what is sent when the Machine Black and - Machine White buttons are selected. This is mostly for - compatibility with obsolete versions of gnushogi. - - Alternate bitmaps for piece icons can be specified either by - choosing one of the built-in sets or with the file name resources - described above. There are three built-in sets of piece bitmaps - available, large (the default), medium, or small. It is easiest - to select the set you prefer in the .Xdefaults file: - - XShogi*boardSize: Medium - - The font used for button labels and comments can be changed in the - .Xdefaults file. You may want to choose a smaller font if you are - using the small pieces: - - XShogi*font: helvetica_oblique12 - - The font used for coordinates (when the showCoords option is True) - can be set similarly: - - XShogi*coordFont: helvetica_10 - - If you are using a grayscale monitor, try setting the colors to: - - XShogi*pieceColor: gray100 - XShogi*squareColor: gray60 - - COMMAND BUTTONS AND KEYS - - -`Quit' - Quits xshogi. Q or q is a keyboard equivalent. - -`Reset' - Resets xshogi to the beginning of a shogi game. It also deselects - any game or position files. - -`Flip View' - inverts the view of the shogi board. - -`Hint' - displays a move hint from gnushogi. - -`Load Game' - plays a game from a record file. If no file is specified a popup - dialog asks for a filename. Game files are found in the directory - named by the SHOGIDIR environment variable. If this variable is - not declared then the current directory is used unless the file - name starts with a /. G or g is a keyboard equivalent. The game - file parser will accept almost any file that contains moves in - algebraic notation. If the first line begins with `#', it is - assumed to be a title and is displayed. Text enclosed in - parentheses or square brackets is assumed to be commentary and is - displayed in a pop-up window. Any other text in the file is - ignored. - -`Load Position' - sets up a position from a position file. If no file is specified a - popup dialog asks for a filename. Position files are found in the - directory named by the SHOGIDIR environment variable. If this - variable is not declared then the current directory is used unless - the file name starts with a /. Position files must be in the - format that the Save Position command writes. - -`Save Game' - saves a game to a record file. If no file is specified a popup - dialog asks for a filename. If the filename exists, the user is - asked whether the current game record is be appended to this file - or if the file should be replaced. Game files are saved in the - directory named by the SHOGIDIR environment variable. If this - variable is not declared then the current directory is used unless - the file name starts with a /. Game files are human-readable, and - can also be read back by the Load Game command. Furthermore, they - are accepted as gnushogi text bookfiles. - -`Save Position' - saves a position to a position file. If no file is specified a - popup dialog asks for a filename. Position files are saved in the - directory named by the SHOGIDIR environment variable. If this - variable is not declared then the current directory is used unless - the file name starts with a /. Position files are human-readable, - and can also be read back by the Load Position command. - -`Machine White' - forces gnushogi to play white. - -`Machine Black' - forces gnushogi to play black. - -`Force Moves' - forces a series of moves. That is, gnushogi stops playing and - xshogi allows you to make moves for both white and black. - -`Two Machines' - plays a game between two computer programs. - -`Forward' - moves forward through a series of remembered moves. F or f is a - keyboard equivalent. - -`Backward' - moves backward through a series of remembered moves. As a side - effect, puts xshogi into Force Moves mode. B or b is a keyboard - equivalent. - -`Pause' - pauses the clocks or (in Load Game mode) pauses the game being - loaded. Press Pause again to continue. P or p is a keyboard - equivalent. - -`Edit Position' - lets you set up an arbitrary board position. Use mouse button 1 - to drag pieces to new squares, or to delete a piece by dragging it - off the board or dragging an empty square on top of it. To drop a - new piece on a square, press mouse button 2 or 3 over the square. - This brings up a menu of black pieces (button 2) or white pieces - (button 3). Additional menu choices let you empty the square or - clear the board. You can set the side to play next by clicking on - the Black or White indicator at the top of the screen. - -`Challenge' - allows you to make a two display game between two human players. - Enter the display you want to connect to. If you are allowed to - connect, a new board is displayed at the remote display. - Challenge mode can only be stopped by pressing "quit". - -`Select Level' - allows you to reset the clocks for both players. Enter the number - of moves and the number of minutes in which the moves should be - done. - -`Move NOW' - force computer to stop thinking and to make the current best move. - -`Iconify I, i, C or c' - iconifies xshogi. - - - LIMITATIONS - - - If you press the Pause button during GNU Shogi's turn, xshogi -will stop the clocks, but gnushogi will still make a move. - - After a mate or draw when playing against gnushogi, if you back up -with the Backward button, the clocks are reset (because gnushogi -has exited and must be restarted). - - The game parser recognizes only algebraic notation. - - - AUTHORS - - - Original authors of XBoard: Chris Sears and Dan Sears. - - Enhancements for XBoard (Version 2.0): Tim Mann. - - Conversion to XShogi (Version 1.1): Matthias Mutz. - - Current maintainer: Mike Vanier. - - - COPYRIGHT INFORMATION - - - XShogi borrows its piece bitmaps from CRANES Shogi. - - Copyright 1991 by Digital Equipment Corporation, Maynard, -Massachusetts. Enhancements Copyright 1992 Free Software Foundation, -Inc. Enhancements Copyright 1993 Matthias Mutz. Further enhancements -copyright 1999 by Michael Vanier and the Free Software Foundation, Inc. - - The following terms apply to Digital Equipment Corporation's -copyright interest in XBoard: - - All Rights Reserved - - Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be used in -advertising or publicity pertaining to distribution of the software -without specific, written prior permission. - - DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - - The following terms apply to the enhanced version of XShogi -distributed by the Free Software Foundation: - - This file is part of XSHOGI. - - XSHOGI is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY. No author or distributor accepts responsibility to anyone -for the consequences of using it or for whether it serves any particular -purpose or works at all, unless he says so in writing. Refer to the -XSHOGI General Public License for full details. - - Everyone is granted permission to copy, modify and redistribute -XSHOGI, but only under the conditions described in the XSHOGI General -Public License. A copy of this license is supposed to have been given -to you along with XSHOGI so you can know your rights and -responsibilities. It should be in a file named COPYING. Among other -things, the copyright notice and this notice must be preserved on all -copies. - - -File: gnushogi.info, Node: References and links, Next: Acknowledgements, Prev: xshogi, Up: Top - -References and links -******************** - - There are very few English-language books for people learning shogi. -The two I recommend are: - - - 1. `Shogi for Beginners, 2nd. Edition', by John Fairbairn. This is a - superb beginner's book in every way, covering all phases of the - game. It was out of print for a long time, but has now been - reprinted and is available either from Kiseido - (`http://www.labnet.or.jp/~kiseido') or from George Hodges (see - below). - - 2. `The Art of Shogi', by Tony Hoskings. This is one step up from the - Fairbairn book. It covers a lot of ground, and is especially - noteworthy for its detailed treatment of opening lines. You can - order this book from Amazon.com's UK branch - (`http://www.amazon.co.uk'). - - - - Another book you may find is `Shogi: Japan's Game of Strategy' by -Trevor Leggett. This book is very elementary and is somewhat outdated, -having been published first in 1966. However, it does feature a paper -shogi board and punch-out pieces, so if you want a really cheap shogi -set you might pick this book up. It is still in print. - - Two books that are no longer in print but are definitely worth -getting if you find them are `Guide to Shogi Openings' and `Better -Moves for Better Shogi', both by Aono Teriuchi. They are published in a -bilingual edition (English/Japanese) and are the only books on shogi in -English written by a Japanese professional shogi player. John Fairbairn -did the translation from Japanese to English. - - Shogi sets are available from: - - - George F. Hodges - P.O. Box 77 - Bromley, Kent - United Kingdom BR1 2WT - - - George also sells equipment for all the historical shogi variants -(*note Shogi variants::) (except for Kyoku tai shogi) and also sells -back issues of the magazine "Shogi" which he published for 70 issues in -the late 70's to late 80's. This magazine is STRONGLY recommended; it -contains more information about shogi in English than you will ever -find anywhere else. - - Here are some useful URLs: - - -Pieter Stouten's shogi page: `http://www.shogi.net' - This is the main shogi-related site on the internet, with links to - almost all the other sites. - -Roger Hare's shogi page: `http://www.ed.ac.uk/~rjhare/shogi' - This has lots of information, including full rules to most of the - shogi variants. - -Patrick Davin's Shogi Nexus: `http://www.vega.or.jp/~patrick/shogi/' - There's lots of cool stuff on this site; my favorite is the - extensive collection of Tsume-shogi (mating) problems, both for - beginners and more advanced players. - -Steve Evans' shogi page: `http://www.netspace.net.au/~trout/index.html' - Steve has written a program that plays almost all of the shogi - variants, unfortunately it only runs on Windows :-( - -Hans Bodlaender's chess variant pages: `http://www.cs.ruu.nl/~hansb/d.chessvar' - This page has an almost unimaginable variety of rules for different - chess variants, including many shogi variants (historical and - non-historical). - - - -File: gnushogi.info, Node: Acknowledgements, Next: Bugs, Prev: References and links, Up: Top - -Acknowledgements -**************** - - I would like to thank the following people: - - - * Matthias Mutz, who originally developed GNU shogi as a spin-off of - GNU chess and who very kindly let me take over the maintenance of - this very interesting project. - - * Richard Stallman and the Free Software Foundation, for creating an - organization where anyone can contribute software for the common - good of all, for making GNU/Linux possible, and especially for - writing emacs and gcc, without which my working life would be - intolerable. - - * Georges Hodges, for starting the Shogi Association in England, - without which I would probably never have heard of shogi, for - supplying shogi equipment, for publishing the excellent magazine - "Shogi" (now sadly defunct), for personally answering all my silly - questions by mail, and for being the ambassador of shogi to the - West. - - * Pieter Stouten, for having the most comprehensive shogi site on the - World Wide Web (`http://www.shogi.net'), and for maintaining the - shogi-l mailing list. Go to Pieter's web site for more - information on subscribing to the list. Also thanks to everyone - who contributes and has contributed to that list. - - * Matt Casters, for testing GNU shogi. Matt and I will be working - together on improving the solution engine in future versions of - this program. - - - - -File: gnushogi.info, Node: Bugs, Next: Index, Prev: Acknowledgements, Up: Top - -Bugs -**** - - The motto of GNU shogi is "100% bug-free or you don't pay!" :-) In -the extremely unlikely case (*ahem*) that you do find a bug, please -send me (Mike Vanier) an email at . Also, feel -free to send me comments, complaints, out-and-out raves, suggestions, -plane tickets to Hawaii, and/or large suitcases filled with unmarked, -untraceable hundred-dollar bills. - - -File: gnushogi.info, Node: Index, Prev: Bugs, Up: Top - -Index -***** - -* Menu: - -* Acknowledgements: Acknowledgements. -* Books: References and links. -* Chu Shogi: Shogi variants. -* Dai Shogi: Shogi variants. -* Dai-dai Shogi: Shogi variants. -* Draws: Draws. -* Drops: Drops. -* gnushogi: gnushogi. -* GPL: License. -* Handicaps: Handicaps. -* Introduction: Introduction. -* Kyoku Tai Shogi: Shogi variants. -* License: License. -* Mailing lists: References and links. -* Maka-dai-dai Shogi: Shogi variants. -* Opening setup: The opening setup. -* Piece moves: The moves of the pieces. -* Piece promotion: Promotion of pieces. -* References: References and links. -* Rules: The rules of shogi. -* Sample game: Sample game. -* Shogi variants: Shogi variants. -* Shogi vs. Chess: Differences between shogi and chess. -* Tai Shogi: Shogi variants. -* Tenjiku Shogi: Shogi variants. -* Tori Shogi: Shogi variants. -* Variants: Shogi variants. -* Wa Shogi: Shogi variants. -* Web sites: References and links. -* Winning the game: Winning the game. -* xshogi: xshogi. - - diff --git a/doc/gnushogi.ps b/doc/gnushogi.ps deleted file mode 100644 index db33063..0000000 --- a/doc/gnushogi.ps +++ /dev/null @@ -1,4283 +0,0 @@ -%!PS-Adobe-2.0 -%%Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software -%%Title: gnushogi.dvi -%%Pages: 52 -%%PageOrder: Ascend -%%BoundingBox: 0 0 612 792 -%%EndComments -%DVIPSWebPage: (www.radicaleye.com) -%DVIPSCommandLine: dvips -t letter gnushogi.dvi -o gnushogi.ps -%DVIPSParameters: dpi=600, compressed -%DVIPSSource: TeX output 2004.07.07:1715 -%%BeginProcSet: texc.pro -%! -/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S -N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 -mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 -0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ -landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize -mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ -matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round -exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ -statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] -N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin -/FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array -/BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 -array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N -df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A -definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get -}B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} -B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr -1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3 -1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx -0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx -sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{ -rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp -gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B -/chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{ -/cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{ -A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy -get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse} -ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp -fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17 -{2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add -chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{ -1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop} -forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn -/BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put -}if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ -bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A -mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ -SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ -userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X -1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 -index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N -/p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ -/Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) -(LaserWriter 16/600)]{A length product length le{A length product exch 0 -exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse -end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask -grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} -imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round -exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto -fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p -delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} -B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ -p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S -rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end - -%%EndProcSet -TeXDict begin 40258431 52099146 1000 600 600 (gnushogi.dvi) -@start -%DVIPSBitmapFont: Fa cmbxti10 14.4 1 -/Fa 1 47 df<13FCEA03FF000F13804813C05AA25AA2B5FCA31480A214006C5A6C5A6C5A -EA0FE0121271912B>46 D E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fb cmti9 9 1 -/Fb 1 47 df<121C127F12FFA412FE12380808778718>46 D E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fc cmr9 9 52 -/Fc 52 122 df45 D<123C127E12FFA4127E123C08087A8715> -I<13075B5B137FEA07FFB5FC13BFEAF83F1200B3B3A2497E007FB51280A319327AB126> -49 DIII<000C14C0380FC00F90B5128015005C5C14F014C0D80C18C7FC90C8 -FCA9EB0FC0EB7FF8EBF07C380FC03F9038001F80EC0FC0120E000CEB07E0A2C713F01403 -A215F8A41218127E12FEA315F0140712F8006014E01270EC0FC06C131F003C14806CEB7F -00380F80FE3807FFF8000113E038003F801D347CB126>I<14FE903807FF80011F13E090 -383F00F0017C13703901F801F8EBF003EA03E01207EA0FC0EC01F04848C7FCA248C8FCA3 -5A127EEB07F0EB1FFC38FE381F9038700F809038E007C039FFC003E0018013F0EC01F813 -0015FC1400A24814FEA5127EA4127F6C14FCA26C1301018013F8000F14F0EBC0030007EB -07E03903E00FC03901F81F806CB51200EB3FFCEB0FE01F347DB126>I<1230123C003FB6 -FCA34814FEA215FC0070C7123800601430157015E04814C01401EC0380C7EA0700140614 -0E5C141814385CA25CA2495A1303A3495AA2130FA3131F91C7FCA25BA55BA9131C20347C -B126>III<15E0A34A7EA24A7EA34A7EA3EC0DFE140CA2EC187FA34A6C7EA202707FEC601F -A202E07FECC00FA2D901807F1507A249486C7EA301066D7EA2010E80010FB5FCA2498001 -18C77EA24981163FA2496E7EA3496E7EA20001821607487ED81FF04A7ED8FFFE49B512E0 -A333367DB53A>65 DII< -B77E16F016FE3A01FE0001FF00009138003FC0EE0FE0707E707E707E707E177E177FEF3F -80A2EF1FC0A3EF0FE0A418F0AA18E0A3171F18C0A21880173F18005F17FE5F4C5AEE07F0 -4C5AEE3FC000014AB45AB748C7FC16F8168034337EB23B>I71 DII75 -DII79 DI82 -D<90381FE00390387FFC0748B5FC3907F01FCF390F8003FF48C7FC003E80814880A20078 -8000F880A46C80A27E92C7FC127F13C0EA3FF013FF6C13F06C13FF6C14C06C14F0C68001 -3F7F01037F9038003FFF140302001380157F153FED1FC0150F12C0A21507A37EA26CEC0F -80A26C15006C5C6C143E6C147E01C05B39F1FC03F800E0B512E0011F138026C003FEC7FC -22377CB42B>I<007FB712FEA390398007F001D87C00EC003E0078161E0070160EA20060 -160600E01607A3481603A6C71500B3AB4A7E011FB512FCA330337DB237>I86 DI< -EB7F803803FFF0380F80FC381C003E003F133F6D6C7E6E7EA26E7EEA1F00C7FCA4EB01FF -131FEBFF873803FC07EA0FF0EA1FC0EA3F80127F13004815C05AA3140FA26C131F6C133B -3A3F8071F180391FC1E1FF2607FFC013003900FE003C22237DA126>97 -DII<153FEC0FFFA3EC007F81AEEB07F0EB3FFCEBFC0F3901F003BF39 -07E001FF48487E48487F8148C7FCA25A127E12FEAA127E127FA27E6C6C5BA26C6C5B6C6C -4813803A03F007BFFC3900F81E3FEB3FFCD90FE0130026357DB32B>III<151F90391FC07F809039FFF8E3C03901F07FC73907E03F033A0FC01F8380 -9039800F8000001F80EB00074880A66C5CEB800F000F5CEBC01F6C6C48C7FCEBF07C380E -FFF8380C1FC0001CC9FCA3121EA2121F380FFFFEECFFC06C14F06C14FC4880381F000100 -3EEB007F4880ED1F8048140FA56C141F007C15006C143E6C5C390FC001F83903F007E0C6 -B51280D91FFCC7FC22337EA126>IIIIII<2703F01FE013FF00FF90267FF80313C0903BF1E07C0F03E0 -903BF3803E1C01F02807F7003F387FD803FE1470496D486C7EA2495CA2495CB3486C496C -487EB53BC7FFFE3FFFF0A33C217EA041>I<3903F01FC000FFEB7FF09038F1E0FC9038F3 -807C3907F7007EEA03FE497FA25BA25BB3486CEB7F80B538C7FFFCA326217EA02B>II<3903F03F8000FFEBFFE09038 -F3C0F89038F7007ED807FE7F6C48EB1F804914C049130F16E0ED07F0A3ED03F8A9150716 -F0A216E0150F16C06D131F6DEB3F80160001FF13FC9038F381F89038F1FFE0D9F07FC7FC -91C8FCAA487EB512C0A325307EA02B>I<3803E07C38FFE1FF9038E38F809038E71FC0EA -07EEEA03ECA29038FC0F8049C7FCA35BB2487EB512E0A31A217FA01E>114 -DI<1330A51370A313F0A21201 -A212031207381FFFFEB5FCA23803F000AF1403A814073801F806A23800FC0EEB7E1CEB1F -F8EB07E0182F7FAD1E>IIIII<3A7FFF807FF8A33A07F8001FC00003 -EC0F800001EC070015066C6C5BA26D131C017E1318A26D5BA2EC8070011F1360ECC0E001 -0F5BA2903807E180A214F3010390C7FC14FBEB01FEA26D5AA31478A21430A25CA214E05C -A2495A1278D8FC03C8FCA21306130EEA701CEA7838EA1FF0EA0FC025307F9F29>I -E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fd cmti10 10.95 18 -/Fd 18 118 df<387FFFFCA3B5FCA21605799521>45 D<120FEA3FC0127FA212FFA31380 -EA7F00123C0A0A77891C>I<147E49B47E903907C1C38090391F80EFC090383F00FF017E -137F4914804848133F485AA248481400120F5B001F5C157E485AA215FE007F5C90C7FCA2 -1401485C5AA21403EDF0385AA21407EDE078020F1370127C021F13F0007E013F13E0003E -137FECF3E1261F01E313C03A0F8781E3803A03FF00FF00D800FC133E252977A72E>97 -D99 DII< -EC03F0EC0FFC91383E0E1C9138FC077E903901F003FE1303903807E001D90FC013FCEB1F -80A2EB3F004914F8137E01FE1303A2484814F0A2150712034914E0A2150F12074914C0A2 -151FA216805B153F1203ED7F006D5BA200015B0000495A9038F80F7E90387C1EFEEB1FF8 -903807E0FC90C7FC1401A25DA21403A25D001C1307007F5C48130F5D4A5A4AC7FC48137E -00F85B387C03F0381FFFC0D803FEC8FC273B7CA72A>103 DI<1478EB01 -FCA21303A314F8EB00E01400AD137C48B4FC38038F80EA0707000E13C0121E121CEA3C0F -1238A2EA781F00701380A2EAF03F140012005B137E13FE5BA212015BA212035B14381207 -13E0000F1378EBC070A214F0EB80E0A2EB81C01383148038078700EA03FEEA00F8163E79 -BC1C>I108 DIII<903903E001F890390FF807FE903A1E7C1E0F8090 -3A1C3E3C07C0013C137801389038E003E0EB783F017001C013F0ED80019038F07F0001E0 -15F8147E1603000113FEA2C75AA20101140717F05CA20103140F17E05CA20107EC1FC0A2 -4A1480163F010F15005E167E5E131F4B5A6E485A4B5A90393FB80F80DA9C1FC7FCEC0FFC -EC03E049C9FCA2137EA213FEA25BA21201A25BA21203A2387FFFE0B5FCA22D3A80A72E> -I114 -DII<137C48B4141C26038F -80137EEA0707000E7F001E15FE121CD83C0F5C12381501EA781F007001805BA2D8F03F13 -03140000005D5B017E1307A201FE5C5B150F1201495CA2151F0003EDC1C0491481A2153F -1683EE0380A2ED7F07000102FF13005C01F8EBDF0F00009038079F0E90397C0F0F1C9039 -1FFC07F8903907F001F02A2979A731>I E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fe cmbx12 13.14 35 -/Fe 35 122 df46 D<15F014011407141F147FEB03FF137FB6FCA313FC1380C7FCB3B3B200 -7FB712E0A52B4777C63D>49 DIIIII<121F7F7F13FE90B812E0A45A18C0188018005F5FA25F485E90 -C8EA07E0007E4B5A5F007C151F4CC7FC167E5E485D15014B5A4B5AC8485A4B5AA24BC8FC -157EA25D1401A24A5A1407A24A5AA2141FA24A5AA2147FA314FFA3495BA45BA55BAA6D5B -A26D90C9FCEB007C334B79C93D>II68 D72 -D78 D80 D<003FBB12C0A5DA80019038FC001FD9FC001601D87FF09438007FE001C018 -3F49181F90C7170FA2007E1907A3007C1903A500FC1AF0481901A5C894C7FCB3B3A749B8 -12FCA54C4A7CC955>84 D87 D97 -D<91380FFF8091B512F8010314FF010F158090263FFE0013C0D97FF8EB1FE0D9FFE0EB3F -F04849EB7FF8484913FF4890C7FC5A5B121F5B003FED7FF0EE3FE0007FED1FC093C7FC5B -A212FFAC127F7FA2123FA26D153E121F6D157E6C167C6C6D14FC6C16F86C6D13036C01F0 -EB07F0D97FFCEB1FE06DB4EBFFC0010F90B5120001035C010014F0020F13802F337CB137 ->99 DIIIII<13FCEA03FF487F487FA2487FA66C5BA26C5B6C90C7FCEA00 -FC90C8FCACEB7FC0B5FCA512037EB3B3B61280A5194D7BCC22>I108 D<90287FC001FFE0EC7FF8B5010F01FC0103B5FC -033F6D010F804B6D6C4814E0DBFE079026C03F817F9126C3F0019138FC007F0003D9C7E0 -DAE1F8806CDA8000D9F1E06D7E02CFC7EBF3C002DE91267FF780131F02FC03FFC77FA24A -5DA24A5DA34A5DB3A9B6D8C03FB5D8F00FB512FCA55E317BB067>I<903A7FC001FFC0B5 -010F13F8033F13FE4B7F9126C1FE077F9126C3F0037F00039038C7C0016CD9CF80801500 -02DE7F02FC81A25CA25CA35CB3A9B6D8C07FEBFFE0A53B317BB044>I<913807FF80027F -13F80103B6FC010F15C090261FFE017F903A7FF0003FF8D9FFC0EB0FFC48496D7E4890C7 -6C7E4817804980000F17C048486E13E0A2003F17F049157FA2007F17F8A400FF17FCAB00 -7F17F8A36C6CEDFFF0A3001F17E06D5C000F17C06C6C4A13806C17006C6D495A6C01E0EB -1FFC6D6C495A903A3FFE01FFF0010FB612C0010392C7FCD9007F13F80207138036337DB1 -3D>I<90397FC00FFFB5017F13F002C1B512FC02C714FF9126CFF80F7F9126FFC00313E0 -000391C77F6C01FC6E7E4A6E7E5C4A6E7E848319808319C0A47113E0AC4D13C0A319805F -A219004D5A804D5A6E4A5A6E4A5A02FF495BDB80075B9126EFF01F5B02E7B548C7FC02E3 -14F802E014E0DB0FFEC8FC92CAFCAFB612C0A53B467CB044>I<9039FF803FE0B5EBFFF8 -028113FE02837FDA87E11380EC8F830003D99F0713C06C139E14BCA214F8A24A6C13806F -13004A6C5A93C7FCA45CB3A7B612E0A52A317CB032>114 D<90390FFF8070017FEBF1F0 -48B6FC1207380FFC01391FE0003F4848130F491307127F90C712035A1501A27FA213E06D -90C7FC13FE387FFFF0ECFFC015F06C14FC6C14FF6C15806C15C06C15E0C615F0013F14F8 -010714FCEB007F14019138003FFE150F0078140700F81403A26C1401A37E16FC6C14036D -14F87F6DEB07F001F8EB1FE001FFEBFFC091B51280D8FC7F1400D8F81F13FCD8E00313C0 -27337CB130>I<14F8A61301A41303A21307A2130FA2131F133F137F13FF1203000F90B5 -12F0B7FCA426007FF8C7FCB3A6167CAA013F14F880A290391FFE01F0010F1303903907FF -87E06DEBFFC06D14806D6C1300EC0FFC26467EC430>IIII<007FB500C090387FFFE0A5C601F0C73803F8006E5D017F5E6E1407013F5E6E140F -011F5E6E141FA26D6D91C7FC5F6D153E6F137E6D157C6F13FC6D5DEDF0016D5DEDF80302 -7F5C15FC1607DA3FFE5B160F021F5CEDFF1F6E91C8FC16BF6E13BE16FE6E5BA36E5BA26E -5BA26F5AA26F5AA26F5AA393C9FC5D153E157E157CD81F8013FC486C5B387FE001D8FFF0 -5B14035D14074A5A49485A007F49CAFCEBC07E383F81FC6CB45A6C5B6C13C0C648CBFC3B -467EAF41>121 D E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Ff cmsl10 10.95 42 -/Ff 42 123 df12 -D39 D44 -D<121EEA3F80EA7FC012FFA41380EA7F00123C0A0A788919>46 D50 D<13F0EA01FC1203EA07FEA313FCA2EA03F8EA01E0C7FCB3121EEA3F80EA7FC0 -12FFA41380EA7F00123C0F2778A619>58 D<17E016011603831607A2160FA2161F83163F -A2167F167716F7EEE7FCED01E316C3150316831507EE03FEED0F01150E151E151C153C03 -387FED7800157015F05D4A4880177F4A5AA24AC7FCA2020E81173F5C021FB6FC5CA20270 -C7EA3FE0171F5CA2495AA2494881170F49C8FCA2130EA24982013C1507A2137CD801FE4B -7E2607FF80EC3FFEB500F00107B512FC19F85E3E417DC044>65 D<013FB7FC18E018FC90 -3B007FE00007FE6E48903801FF809438007FC05DF03FE0F01FF0A3027F16F892C8FCA54A -16F04A153F19E0187F19C0F0FF8001014B13004A4A5A4D5AEF1FF04D5ADC03FFC7FC49B6 -12F8EFFF8002F8C7EA3FE0EF0FF0EF07FC717E010715014A81711380A319C0130F5CA501 -1F4B13805C19005F601707013F4B5A4A4A5A4D5A4D5A017F913801FF8001FF020F90C7FC -B812FC17F094C8FC3D3E7DBD40>I -I<013FB812F8A39026007FF0C7127F6E48140F18034B14011800A31978147F4B1570A502 -FF147092C7FCA3190017F0495D4A1301A21607161F91B6FC495DA29138FC003F160F1607 -160301075D5CA219E0180119C0010FEC07004A90C712031980A218071900011F5E5C181E -A2183E183C013F167C4A15FC4D5A1707017F151F01FF4AB45AB9FCA2603D3E7DBD3E>69 -D<4BB46C1370031F01F013F0037F9038FC01E0913A03FF807E03913A0FF8000F83DA1FE0 -EB07C7DA7F80EB01EF4AC812FFD903FE16C04948157F4948153F495A4948151F495A4948 -168091C9120F5A485AA2485A000F18004982121FA248485EA295C7FC485AA412FF5BA604 -3FB512E05BA29339001FFC00715AA2607F127FA2171F123F6D5EA2121F7F000F163F6C7E -6C6C4B5A7F6C6C15FF6C6DEB01EFD93FC0EB07C7D91FF0EB1F87D907FE9038FE03800101 -B5EAF8016D6C01E0C8FCDA07FEC9FC3C4276BF47>71 D<021FB512FCA3DA000713006F5A -A25EA41507A25EA4150FA25EA4151FA25EA4153FA25EA4157FA25EA415FFA293C7FCA45C -121FD87F805BEAFFC0A214035D13804A5AEAFE0000F8495A48495A00705C6C495A6C01FE -C8FC380F81FC3803FFE0C690C9FC2E407ABD2F>74 D<90263FFFF093381FFFF85013F062 -9026007FF8EFF000023F4D5AA2023B933801DFC0A2DA39FCED039FA2F1073F1479027104 -0E5BEC70FE191C19381A7F02F01670DAE07F94C7FC19E0A2F001C06201016D6C495A02C0 -5FF00700A2180E6F6C14010103161C028003385BA218706F7EF0E00313070200DA01C05B -A2923907F00380A294380700075B010E902603F80E5C5FA25F190F011E6D6C5A011C605F -A2EEFDC0DB00FF141F013C5D013860013C92C7FC017C5C01FE027E143F2607FF80017C4A -7EB500FC037FB512E004785E4A1338553E7CBD53>77 D<90263FFFE0023FB5FC6F16FEA2 -9026003FF8020313C0021F030013004A6C157C023B163C6F15381439810238167802787F -DA707F157082153F82031F15F002F07FDAE00F5D8215078203031401010180DAC0015D82 -811780047F1303010315C04A013F5C17E0161F17F0040F1307010715F891C7000791C7FC -17FC160317FE04015B4915FF010E6E130E188E177F18CEEF3FDE011E16FE011C6F5AA217 -0FA21707133C01386F5A133C017C150113FE2607FF801400B512FC18705C483E7DBD44> -I<923803FF80031F13F09238FE01FE913903F0003FDA0FC0EB1FC0DA3F80EB07E0027EC7 -6C7E49486E7E49488149486E7E4948157F495A013F17804948ED3FC049C9FCA24848EE1F -E012035B000718F05B120FA2485A19F8123F5BA2127FA219F04848163FA5F07FE0A35BF0 -FFC0A219805F19007F4D5A127F4D5A60003F160F6D5E001F4C5A4D5A6C6C4B5A95C7FC6C -6C15FE00034B5A6C6C4A5A6C6C4A5A017FEC1FC06D6C495AD90FE001FEC8FC903903F807 -F80100B512C0DA0FFCC9FC3D4276BF47>I<013FB612F017FF18E0903B007FF0003FF86E -48EB07FCEF01FE4B6D7EF07F8019C0183F19E0147F4B15F0A502FFED7FE092C8FCA219C0 -F0FF80A2494B13004A5D4D5AEF0FF04D5AEF7F800103DA07FEC7FC91B612F017809139FC -0007E0EE03F8EE00FC0107814A147F717EA284A2130F5CA484011F157F5CA41902013F17 -075CA2F0F00F017F170E496C143FB600E0011F131C94380FF83C4B01071378CA3801FFE0 -9438003F8040407DBD43>82 D<9238FF80070207EBE00F021FEBF81E91387F00FE02FCEB -1F3ED903F0EB0FFE49481307494813034AEB01FC49C7FC491400133E137E177C491578A5 -7F1770A26D1500808080EB7FFEECFFE06D13FEEDFFC06D14F06D14FC010380010080143F -02031480DA003F13C015031500EE7FE0163F161FA2160F121CA31607160F003C16C0A317 -80003E151F1700007E5D007F153E6D5C16FC01E0495AD87DF0495AD8FCFCEB0FC03AF87F -803F8027F01FFFFEC7FCD8E00713F839C0007FC030427BBF33>I<0007B912F0A33C0FFE -000FF8003F01F0160F01C04A13034848160190C7FC121EF000E048141F5E1238A2127812 -70153F5E5AA3C81600157F5EA515FF93C9FCA55C5DA514035DA514075DA5140F5DA3141F -EC7FFC0003B7FCA33C3D76BC42>I86 D97 DIIIII<177C913907 -F803FE91393FFE0F8F9139FC0F9C3F903901F007F8903907E003E0D90FC013F0011F9038 -01F80C02801400133FD97F007FA315035B495CA3017E495A5E150F6D5C6D495A90263F80 -3EC7FCECC0FC903871FFF09038E07F8091C9FC485AA47FA27F90B512F8EDFF806C15E016 -F86D8048B6FC3A07E0000FFED80F801300003FC8127F003E815A00FC815AA25E163EA25E -6C15FC007C4A5A6C4A5A6CEC0FC0D80FC0013FC7FC3903F801FCC6B512F0010F90C8FC30 -3D7FA82D>I<147FEB3FFFA313017FA25CA513015CA513035CA4ED07F80107EB1FFF9139 -F0781FC09138F1E00F9139F38007E0ECF70002FE14F0495A5CA25CA24A130F131F4A14E0 -A4161F133F4A14C0A4163F137F91C71380A4167F5B491500A300015D486C491380B5D8F8 -7F13FCA32E3F7DBE33>I<1478EB01FE130314FFA25B14FE130314FCEB00F01400ACEB03 -F8EA01FF14F0A2EA001F130FA314E0A5131F14C0A5133F1480A5137F1400A55B5BA4EA03 -FF007F13F0A2B5FC183E7DBD1A>I<147FEB3FFFA313017FA25CA513015CA513035CA501 -070103B5FC02F014FEA26F13F06F1380EEFE00010F14F84A485AED03C04B5A031FC7FC15 -3E011F13784A5AECC3E0ECC7F0ECCFF814FF497F14F9ECE1FE14C04A7E4A7E4980017E13 -3F82151F82150F01FE8049130782A2000181486C49B4FCB5D8F03F13F04B13E0A2303F7E -BE30>107 D<143FEB1FFF5BA213017FA214FEA5130114FCA5130314F8A5130714F0A513 -0F14E0A5131F14C0A5133F1480A5137F1400A55B5BA4EA03FF007F13F8A2B5FC183F7DBE -1A>I<902707F007F8EB03FCD803FFD91FFF90380FFF80913CE0781FC03C0FE09126E1E0 -0FEBF0073E001FE38007E1C003F090260FE700EBE38002EEDAF70013F802FC14FE02D85C -14F84A5CA24A5C011F020F14074A4A14F0A5013F021F140F4A4A14E0A5017F023F141F91 -C74914C0A549027F143F4992C71380A300014B147F486C496DEBFFC0B5D8F87FD9FC3F13 -FEA347287DA74C>I<903907F007F8D803FFEB1FFF9139E0781FC09138E1E00F3B001FE3 -8007E090380FE70002EE14F014FC14D814F85CA24A130F131F4A14E0A4161F133F4A14C0 -A4163F137F91C71380A4167F5B491500A300015D486C491380B5D8F87F13FCA32E287DA7 -33>II<91387F01FE903A7FFF0FFFC09139FE3E03F09238F801 -F8903A03FFE000FE6D49137F4B7F92C713804A15C04A141FA218E0A20103150F5C18F0A3 -171F010716E05CA3173F18C0130F4A147F1880A2EFFF004C5A011F5D16034C5A6E495AEE -1FC06E495AD93FDC017EC7FC91388F01F8913883FFE0028090C8FC92C9FC137FA291CAFC -A45BA25BA31201487EB512F8A3343A81A733>I<903907F01F80D803FFEB7FE09138E1E1 -F09138E387F839001FE707EB0FE614EE02FC13F002D813E09138F801804AC7FCA25C131F -A25CA4133F5CA5137F91C8FCA55B5BA31201487EB512FEA325287EA724>114 -D<9138FF81C0010713E390381F807F90397C003F8049131F4848130F5B00031407A24848 -1400A27FA27F6D90C7FCEBFF8014FC6C13FF6C14C015F06C6C7F011F7F13079038007FFE -1403140100381300157EA2123C153E157E007C147CA2007E147815F8007F495A4A5A486C -485A26F9E01FC7FC38E0FFFC38C01FE0222A7DA824>II<01FE147F00FFEC7FFF4914FEA20007140300031401A34914FCA4 -150312074914F8A41507120F4914F0A4150F121F4914E0A2151FA3153F4914C0157F15FF -EC01DF3A0FC003BFE09138073FFF3803F01E3801FFF826003FE01380282977A733>III<90B539E007FFF05E18E0902707FE000313006D48EB01FC -705A5F01014A5A5F16036E5C0100140794C7FC160E805E805E1678ED8070023F13F05EED -81C015C191381FC38015C793C8FC15EF15EEEC0FFCA25DA26E5AA25DA26E5A5DA24AC9FC -5C140E141E141C5C121C003F5B5A485B495A130300FE5B4848CAFCEA701EEA783CEA3FF0 -EA0FC0343A80A630>121 D<017FB512FEA2ECC00190397E0003FC49EB07F849EB0FF049 -EB1FE049EB3FC0ED7F8000011500495B4A5A4A5A4848485A4A5AC7485A4A5A5D147F4AC7 -FC495A495A49481370494813E0495A5C133F90387F8001D9FF0013C0485A48481303485A -4848EB078049130F4848131F003F143F397F8001FFB71200A227277EA628>I -E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fg cmtt10 10.95 81 -/Fg 81 127 df39 -D<141E147F14FF5BEB03FEEB07FCEB0FF0EB1FE0EB3FC0EB7F80EBFF00485A5B12035B48 -5A120F5BA2485AA2123F5BA2127F90C7FCA412FEAD127FA47F123FA27F121FA26C7EA27F -12076C7E7F12017F6C7EEB7F80EB3FC0EB1FE0EB0FF0EB07FCEB03FEEB01FF7F147F141E -184771BE30>I<127812FE7E7F6C7E6C7EEA0FF06C7E6C7E6C7E6C7EEB7F80133F14C013 -1FEB0FE014F01307A2EB03F8A214FC1301A214FE1300A4147FAD14FEA4130114FCA21303 -14F8A2EB07F0A2130F14E0EB1FC0133F1480137FEBFF00485A485A485A485AEA3FE0485A -485A90C7FC5A1278184778BE30>I<143EA2147FAF007FB7FCA2B81280A36C1600A2C76C -C8FCAF143EA229297DAF30>43 DI<007FB612F0A2B712F8A36C15F0A225077B9E30>I<120FEA3FC0EA7FE0A2EAFFF0A4 -EA7FE0A2EA3FC0EA0F000C0C6E8B30>I<16F01501ED03F8A21507A2ED0FF0A2ED1FE0A2 -ED3FC0A2ED7F80A2EDFF00A24A5AA25D1403A24A5AA24A5AA24A5AA24A5AA24A5AA24AC7 -FCA2495AA25C1303A2495AA2495AA2495AA2495AA2495AA249C8FCA2485AA25B1203A248 -5AA2485AA2485AA2485AA2485AA248C9FCA25AA2127CA225477BBE30>I<14FE903807FF -C0497F013F13F8497F90B57E48EB83FF4848C6138049137F4848EB3FC04848EB1FE04913 -0F001F15F0491307A24848EB03F8A290C712014815FCA400FEEC00FEAD6C14016C15FCA3 -6D1303003F15F8A26D1307001F15F0A26D130F6C6CEB1FE0A26C6CEB3FC06C6CEB7F806D -13FF2601FF8313006CEBFFFE6D5B6D5B010F13E06D5BD900FEC7FC273A7CB830>IIIII<000FB612804815C05AA316800180C8FCAE -EB83FF019F13C090B512F015FC8181D9FE0313809039F0007FC049133F0180EB1FE06CC7 -120F000E15F0C81207A216F81503A31218127EA2B4FC150716F048140F6C15E06C141F6D -EB3FC06D137F3A3FE001FF80261FFC0F13006CB55A6C5C6C5C6C14E06C6C1380D90FFCC7 -FC25397BB730>II<127CB712FC16FEA416FC48C7EA0FF816F0ED1FE0007CEC3F -C0C8EA7F80EDFF00A24A5A4A5A5D14075D140F5D4A5AA24A5AA24AC7FCA25C5C13015CA2 -13035CA213075CA4495AA6131F5CA96D5A6DC8FC273A7CB830>I<49B4FC011F13F0017F -13FC90B57E0003ECFF804815C048010113E03A1FF8003FF049131FD83FC0EB07F8A24848 -EB03FC90C71201A56D1303003F15F86D13076C6CEB0FF06C6CEB1FE0D807FCEB7FC03A03 -FF83FF806C90B512006C6C13FC011F13F0497F90B512FE48802607FE0013C0D80FF8EB3F -E0D81FE0EB0FF04848EB07F8491303007F15FC90C712014815FE481400A66C14016C15FC -6D1303003F15F86D1307D81FF0EB1FF06D133F3A0FFF01FFE06C90B512C06C1580C6ECFE -006D5B011F13F0010190C7FC273A7CB830>I<49B4FC010F13E0013F13F890B57E488048 -8048010113803A0FFC007FC0D81FF0EB3FE04848131F49EB0FF048481307A290C7EA03F8 -5A4815FC1501A416FEA37E7E6D1303A26C6C13076C6C130F6D133FD80FFC13FF6CB6FC7E -6C14FE6C14F9013FEBE1FC010F138190380060011400ED03F8A2150716F0150F000F15E0 -486C131F486CEB3FC0157FEDFF804A1300EC07FE391FF01FFC90B55A6C5C6C5C6C1480C6 -49C7FCEB3FF0273A7CB830>I<120FEA3FC0EA7FE0A2EAFFF0A4EA7FE0A2EA3FC0EA0F00 -C7FCAF120FEA3FC0EA7FE0A2EAFFF0A4EA7FE0A2EA3FC0EA0F000C276EA630>II<16F01503ED07F8151F157FEDFFF014034A13C0021F13809138 -3FFE00ECFFF8495B010713C0495BD93FFEC7FC495A3801FFF0485B000F13804890C8FCEA -7FFC5BEAFFE05B7FEA7FF87FEA1FFF6C7F000313E06C7F38007FFC6D7E90380FFF806D7F -010113F06D7FEC3FFE91381FFF80020713C06E13F01400ED7FF8151F1507ED03F0150025 -2F7BB230>I -64 D<147F4A7EA2497FA4497F14F7A401077F14E3A3010F7FA314C1A2011F7FA490383F -80FEA590387F007FA4498049133F90B6FCA34881A39038FC001F00038149130FA4000781 -491307A2D87FFFEB7FFFB56CB51280A46C496C130029397DB830>I<007FB512F0B612FE -6F7E82826C813A03F8001FF815076F7E1501A26F7EA615015EA24B5A1507ED1FF0ED7FE0 -90B65A5E4BC7FC6F7E16E0829039F8000FF8ED03FC6F7E1500167FA3EE3F80A6167F1700 -A25E4B5A1503ED1FFC007FB6FCB75A5E16C05E6C02FCC7FC29387EB730>I<91387F803C -903903FFF03E49EBFC7E011F13FE49EBFFFE5B9038FFE07F48EB801F3903FE000F484813 -075B48481303A2484813015B123F491300A2127F90C8FC167C16005A5AAC7E7EA2167C6D -14FE123FA27F121F6D13016C6C14FCA26C6CEB03F86D13076C6CEB0FF03901FF801F6C90 -38E07FE06DB512C06D14806D1400010713FC6D13F09038007FC0273A7CB830>I<003FB5 -12E04814FCB67E6F7E6C816C813A03F8007FF0ED1FF8150F6F7E6F7E15016F7EA2EE7F80 -A2163F17C0161FA4EE0FE0AC161F17C0A3163F1780A2167F17005E4B5A15034B5A150F4B -5AED7FF0003FB65A485DB75A93C7FC6C14FC6C14E02B387FB730>I<007FB7FCB81280A4 -7ED803F8C7123FA8EE1F0093C7FCA4157C15FEA490B5FCA6EBF800A4157C92C8FCA5EE07 -C0EE0FE0A9007FB7FCB8FCA46C16C02B387EB730>I<003FB712804816C0B8FCA27E7ED8 -01FCC7121FA8EE0F8093C7FCA5153E157FA490B6FCA69038FC007FA4153E92C8FCAE383F -FFF8487FB5FCA27E6C5B2A387EB730>I<02FF13F00103EBC0F8010F13F1013F13FD4913 -FF90B6FC4813C1EC007F4848133F4848131F49130F485A491307121F5B123F491303A212 -7F90C7FC6F5A92C8FC5A5AA892B5FC4A14805CA26C7F6C6D1400ED03F8A27F003F1407A2 -7F121F6D130F120F7F6C6C131FA2D803FE133F6C6C137FECC1FF6C90B5FC7F6D13FB010F -13F30103EBC1F0010090C8FC293A7DB830>I<3B3FFF800FFFE0486D4813F0B56C4813F8 -A26C496C13F06C496C13E0D803F8C7EAFE00B290B6FCA601F8C7FCB3A23B3FFF800FFFE0 -486D4813F0B56C4813F8A26C496C13F06C496C13E02D387FB730>I<007FB6FCB71280A4 -6C1500260007F0C7FCB3B3A8007FB6FCB71280A46C1500213879B730>I<49B512F04914 -F85BA27F6D14F090C7EAFE00B3B3123C127EB4FCA24A5A1403EB8007397FF01FF86CB55A -5D6C5C00075C000149C7FC38003FF025397AB730>II<383FFFF8487FB57EA26C -5B6C5BD801FCC9FCB3B0EE0F80EE1FC0A9003FB7FC5AB8FCA27E6C16802A387EB730>I< -D83FF8ECFFE0486C4913F0486C4913F8A2007F16F06C6C4913E00007160001EF14BFEC80 -0FA39039E7C01F3FA4ECE03F01E3133EA2ECF07EA201E1137CA2ECF8FCA201E013F8A214 -FDEC7DF0A3147FEC3FE0A3EC1FC0A2EC070091C7FCADD83FFC903801FFE0486C4913F0B5 -4913F8A26C486D13F06C486D13E02D387FB730>II<90383FFFE048B512FC000714FF4815804815C04815E0EBF80001E0133FD87F80EB0F -F0A290C71207A44815F8481403B3A96C1407A26C15F0A36D130FA26D131F6C6CEB3FE001 -F813FF90B6FC6C15C06C15806C1500000114FCD8003F13E0253A7BB830>I<007FB512F0 -B612FE6F7E16E0826C813903F8003FED0FFCED03FE15016F7EA2821780163FA6167F1700 -5EA24B5A1503ED0FFCED3FF890B6FC5E5E16804BC7FC15F001F8C9FCB0387FFFC0B57EA4 -6C5B29387EB730>I<90383FFFE048B512FC000714FF4815804815C04815E0EBF80001E0 -133F4848EB1FF049130F90C71207A44815F8481403B3A8147E14FE6CEBFF076C15F0EC7F -87A2EC3FC7018013CF9038C01FFFD83FE014E0EBF80F90B6FC6C15C06C15806C15000001 -14FCD8003F7FEB00016E7EA21680157F16C0153F16E0151F16F0150FED07E025467BB830 ->I<003FB57E4814F0B612FC15FF6C816C812603F8017F9138003FF0151F6F7E15071503 -821501A515035E1507150F4B5A153F4AB45A90B65A5E93C7FC5D8182D9F8007FED3FE015 -1F150F821507A817F8EEF1FCA53A3FFF8003FB4801C0EBFFF8B56C7E17F06C496C13E06C -49EB7FC0C9EA1F002E397FB730>I<90390FF803C0D97FFF13E048B512C74814F74814FF -5A381FF80F383FE001497E4848137F90C7123F5A48141FA2150FA37EED07C06C91C7FC7F -7FEA3FF0EA1FFEEBFFF06C13FF6C14E0000114F86C80011F13FF01031480D9003F13C014 -019138007FE0151FED0FF0A2ED07F8A2007C140312FEA56C140716F07F6DEB0FE06D131F -01F8EB3FC001FF13FF91B51280160000FD5CD8FC7F13F8D8F81F5BD878011380253A7BB8 -30>I<003FB712C04816E0B8FCA43AFE003F800FA8007CED07C0C791C7FCB3B1011FB5FC -4980A46D91C7FC2B387EB730>I<3B7FFFC007FFFCB56C4813FEA46C496C13FCD803F8C7 -EA3F80B3B16D147F00011600A36C6C14FE6D13016D5CEC800390393FE00FF890391FF83F -F06DB55A6D5C6D5C6D91C7FC9038007FFCEC1FF02F3980B730>III<3A3FFF01FFF84801837F02C77FA202835B6C -01015B3A01FC007F806D91C7FC00005C6D5BEB7F01EC81FCEB3F8314C3011F5B14E7010F -5B14FF6D5BA26D5BA26D5BA26D90C8FCA4497FA2497FA2815B81EB0FE781EB1FC381EB3F -8181EB7F0081497F49800001143F49800003141F49800007140FD87FFEEB7FFFB590B512 -8080A25C6C486D130029387DB730>II<007FB5FCB61280A4150048C8FCB3B3B3A5 -B6FC1580A46C140019476DBE30>91 D<127CA212FEA27EA26C7EA26C7EA26C7EA26C7EA2 -6C7EA26C7EA212017FA26C7EA26D7EA26D7EA26D7EA26D7EA26D7EA26D7EA2130180A26D -7EA26E7EA26E7EA26E7EA26E7EA26E7EA26E7EA2140181A26E7EA2ED7F80A2ED3FC0A2ED -1FE0A2ED0FF0A2ED07F8A21503A2ED01F0150025477BBE30>I<007FB5FCB61280A47EC7 -123FB3B3B3A5007FB5FCB6FCA46C140019477DBE30>I<1307EB1FC0EB7FF0497E000313 -FE000FEBFF80003F14E0D87FFD13F039FFF07FF8EBC01FEB800F38FE0003007CEB01F000 -10EB00401D0E77B730>I<007FB612F0A2B712F8A36C15F0A225077B7D30>I<1338137CEA -01FE12031207EA0FFC13F0EA1FE013C0EA3F8013005A127EA212FE5AA5EAFFC013E013F0 -127FA2123FA2EA1FE0EA07C00F1D70BE30>IIII<913801FFE04A7F5CA28080EC0007AA -EB03FE90381FFF874913E790B6FC5A5A481303380FFC00D81FF0133F49131F485A150F48 -48130790C7FCA25AA25AA87E6C140FA27F003F141F6D133F6C7E6D137F390FF801FF2607 -FE07EBFFC06CB712E06C16F06C14F76D01C713E0011F010313C0D907FCC8FC2C397DB730 ->I<49B4FC010713E0011F13F8017F7F90B57E488048018113803A07FC007FC04848133F -D81FE0EB1FE0150F484814F0491307127F90C7FCED03F85A5AB7FCA516F048C9FC7E7EA2 -7F003FEC01F06DEB03F86C7E6C7E6D1307D807FEEB1FF03A03FFC07FE06C90B5FC6C15C0 -013F14806DEBFE00010713F8010013C0252A7CA830>I -III<14E0EB03F8A249 -7EA36D5AA2EB00E091C8FCA9381FFFF8487F5AA27E7EEA0001B3A9003FB612C04815E0B7 -FCA27E6C15C023397AB830>III<38 -7FFFF8B57EA47EEA0001B3B3A8007FB612F0B712F8A46C15F025387BB730>I<02FC137E -3B7FC3FF01FF80D8FFEF01877F90B500CF7F15DF92B57E6C010F13872607FE07EB03F801 -FC13FE9039F803FC01A201F013F8A301E013F0B3A23C7FFE0FFF07FF80B548018F13C0A4 -6C486C01071380322881A730>II<49B4FC010F13E0 -013F13F8497F90B57E0003ECFF8014013A07FC007FC04848EB3FE0D81FE0EB0FF0A24848 -EB07F8491303007F15FC90C71201A300FEEC00FEA86C14016C15FCA26D1303003F15F86D -13076D130F6C6CEB1FF06C6CEB3FE06D137F3A07FF01FFC06C90B512806C15006C6C13FC -6D5B010F13E0010190C7FC272A7CA830>II<49B413F8010FEBC1FC013F13F14913FD48B6FC5A481381390FFC007F49 -131F4848130F491307485A491303127F90C7FC15015A5AA77E7E15037FA26C6C1307150F -6C6C131F6C6C133F01FC137F3907FF01FF6C90B5FC6C14FD6C14F9013F13F1010F13C190 -3803FE0190C7FCAD92B512F84A14FCA46E14F82E3C7DA730>II<90381FFC -1E48B5129F000714FF5A5A5A387FF007EB800100FEC7FC4880A46C143E007F91C7FC13E0 -6CB4FC6C13FC6CEBFF806C14E0000114F86C6C7F01037F9038000FFF02001380007C147F -00FEEC1FC0A2150F7EA27F151F6DEB3F806D137F9039FC03FF0090B6FC5D5D00FC14F0D8 -F83F13C026780FFEC7FC222A79A830>III<3B3FFFC07FFF80486D -B512C0B515E0A26C16C06C496C13803B01F80003F000A26D130700005DA26D130F017E5C -A2017F131F6D5CA2EC803F011F91C7FCA26E5A010F137EA2ECE0FE01075BA214F101035B -A3903801FBF0A314FF6D5BA36E5A6E5A2B277EA630>I<3B3FFFC01FFFE0486D4813F0B5 -15F8A26C16F06C496C13E0D807E0C7EA3F00A26D5C0003157EA56D14FE00015DEC0F80EC -1FC0EC3FE0A33A00FC7FF1F8A2147DA2ECFDF9017C5C14F8A3017E13FBA290393FF07FE0 -A3ECE03FA2011F5C90390F800F802D277FA630>I<3A3FFF81FFFC4801C37FB580A26C5D -6C01815BC648C66CC7FC137FEC80FE90383F81FC90381FC3F8EB0FE3ECE7F06DB45A6D5B -7F6D5B92C8FC147E147F5C497F81903803F7E0EB07E790380FE3F0ECC1F890381F81FC90 -383F80FE90387F007E017E137F01FE6D7E48486D7E267FFF80B5FCB500C1148014E3A214 -C16C0180140029277DA630>I<3B3FFFC07FFF80486DB512C0B515E0A26C16C06C496C13 -803B01FC0003F000A2000014076D5C137E150F017F5C7F151FD91F805BA214C0010F49C7 -FCA214E00107137EA2EB03F0157C15FCEB01F85DA2EB00F9ECFDF0147D147FA26E5AA36E -5AA35DA2143F92C8FCA25C147EA2000F13FE486C5AEA3FC1EBC3F81387EB8FF0EBFFE06C -5B5C6C90C9FC6C5AEA01F02B3C7EA630>I<001FB612FC4815FE5AA316FC90C7EA0FF8ED -1FF0ED3FE0ED7FC0EDFF80003E491300C7485A4A5A4A5A4A5A4A5A4A5A4A5A4990C7FC49 -5A495A495A495A495A495A4948133E4890C7127F485A485A485A485A485A48B7FCB8FCA4 -6C15FE28277DA630>I<127CA212FEB3B3B3AD127CA207476CBE30>124 -D<017C133848B4137C48EB80FE4813C14813C348EBEFFC397FEFFFF0D8FF8713E0010713 -C0486C1380D87C0113003838007C1F0C78B730>126 D E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fh cmbx12 17.28 45 -/Fh 45 121 df<167C16FC1501ED07F0150FED1FE0ED3FC0ED7F80EDFF004A5A14034A5A -4A5A5D141F4A5A147F4A5A5D5B4990C7FCA2495A130F5C131FA2495AA2495AA213FF5C5A -A25C5AA25A5CA25AA291C8FCA25AA35B123FA5127F5BA612FFB3A4127FA67F123FA5121F -7FA37EA280A27EA2807EA27E80A27E80137FA26D7EA26D7EA2130F8013076D7EA26D7F7F -816E7E143F6E7E140F816E7E6E7E14016E7EED7F80ED3FC0ED1FE0ED0FF01507ED01FC15 -00167C269071EB3F>40 D<127812FC127E6C7E7F6C7E6C7E6C7E6C7E6C7E7F6C7F6D7E13 -3F806D7E806D7E1307806D7EA26D7F817F81A26E7EA26E7EA281141F81A2140F81A21680 -80A216C0A280A216E0A38016F0A516F880A616FCB3A416F8A65C16F0A516E05CA316C0A2 -5CA21680A25C1600A25D141FA25D143F5DA24A5AA24A5AA25D5B5D4990C7FCA2495A5C13 -0F495A5C495A5C137F495A4890C8FC5B485A485A485A485A485A5B007EC9FC5A12782690 -77EB3F>I<16F04B7E1507151F153FEC01FF1407147F010FB5FCB7FCA41487EBF007C7FC -B3B3B3B3007FB91280A6395E74DD51>49 D<913801FFF8021FEBFFC091B612F8010315FF -010F16C0013F8290267FFC0114F89027FFE0003F7F4890C7000F7F48486E7FD807F86E14 -8048486E14C048486E14E048486F13F001FC17F8486C816D17FC6E80B56C16FE8380A219 -FFA283A36C5BA26C5B6C90C8FCD807FC5DEA01F0CA14FEA34D13FCA219F85F19F04D13E0 -A294B512C019804C14004C5B604C5B4C5B604C13804C90C7FC4C5A4C5A4B13F05F4B1380 -4B90C8FC4B5AED1FF84B5A4B5A4B48143F4A5B4A48C8FC4A5A4A48157E4A5A4A5AEC7F80 -92C9FC02FE16FE495A495A4948ED01FCD90FC0150749B8FC5B5B90B9FC5A4818F85A5A5A -5A5ABAFCA219F0A4405E78DD51>I<92B5FC020F14F8023F14FF49B712C04916F0010FD9 -C01F13FC90271FFC00077FD93FE001017F49486D8049C86C7F484883486C6F7F14C0486D -826E806E82487FA4805CA36C5E4A5E6C5B6C5B6C495E011FC85A90C95CA294B55A614C91 -C7FC604C5B4C5B4C5B4C5B047F138092260FFFFEC8FC020FB512F817E094C9FC17F817FF -91C7003F13E0040713F8040113FE707F717F7113E085717FA2717F85A285831A80A31AC0 -EA03FCEA0FFF487F487F487FA2B57EA31A80A34D14005C7E4A5E5F6C495E49C8485BD81F -F85F000F5ED807FE92B55A6C6C6C4914806C01F0010791C7FC6C9026FF803F5B6D90B65A -011F16F0010716C001014BC8FCD9001F14F0020149C9FC426079DD51>II<01C0EE01C0D801F8160F01 -FF167F02F0EC07FFDAFF8090B5FC92B7128019006060606060606095C7FC17FC5F17E017 -8004FCC8FC16E09026FC3FFCC9FC91CBFCADED3FFE0203B512F0020F14FE023F6E7E91B7 -12E001FDD9E00F7F9027FFFE00037F02F801007F02E06EB4FC02806E138091C8FC496F13 -C04917E07113F0EA00F090C914F8A219FC83A219FEA419FFA3EA03F0EA0FFC487E487E48 -7FA2B57EA319FEA35C4D13FC6C90C8FC5B4917F8EA3FF001804B13F06D17E0001F5E6C6C -17C06D4B1380D807FC92B512006C6C4A5B6C6C6C01075B6C01E0011F5BD97FFE90B55A6D -B712C0010F93C7FC6D15FC010115F0D9003F1480020301F0C8FC406078DD51>III< -92383FFF800203B512FC021FECFF80027F15E049B712F849D9F0077F010F90C76C7ED91F -FCEC1FFFD93FF06E7F494802037F494882717F484980854890C9127FA24884183FA25A80 -A380806E157F6E5E14FE6E7E6F4A5A6C14F003FC495B03FF495B6C1580DCE0075B6CDBF8 -0F90C7FC9338FE1FFE6C9238FF7FF84D5A6D16C06D5E6D4BC8FC6D6F7E6D16E00101826D -16FC023F814A8149B87E010783498390263FFE3F8190267FFC0F819026FFF003814849C6 -FC48496D804849131F4890C7000780160148486E1580003F163F49150F007F7014C04915 -01717E8400FF835B8484A384A21A80A27F007F1900607F003F606D160F001F606D4C5A6C -6D153F6C6D4B5A6C01F04B5A6C01FC02035B6C01FF021F5B6D9027F001FFFEC7FC6D90B6 -5A010F16F001035E010093C8FC020F14F8DA007F90C9FC426079DD51>I65 DI<4DB5 -ED03C0057F02F014070407B600FE140F047FDBFFC0131F4BB800F0133F030F05FC137F03 -3F9127F8007FFE13FF92B6C73807FF814A02F0020113C3020702C09138007FE74A91C900 -1FB5FC023F01FC16074A01F08291B54882490280824991CB7E4949844949844949844986 -5D49498490B5FC484A84A2484A84A24891CD127FA25A4A1A3F5AA348491A1FA44899C7FC -A25CA3B5FCB07EA380A27EA2F50FC0A26C7FA37E6E1A1F6C1D80A26C801D3F6C6E1A00A2 -6C6E616D1BFE6D7F6F4E5A7F6D6D4E5A6D6D4E5A6D6D4E5A6D6E171F6D02E04D5A6E6DEF -FF806E01FC4C90C7FC020F01FFEE07FE6E02C0ED1FF8020102F8ED7FF06E02FF913803FF -E0033F02F8013F1380030F91B648C8FC030117F86F6C16E004071680DC007F02F8C9FC05 -0191CAFC626677E375>I69 D<4DB5ED03C0057F02F014070407B600FE140F -047FDBFFC0131F4BB800F0133F030F05FC137F033F9127F8007FFE13FF92B6C73807FF81 -4A02F0020113C3020702C09138007FE74A91C9001FB5FC023F01FC16074A01F08291B548 -82490280824991CB7E49498449498449498449865D49498490B5FC484A84A2484A84A248 -91CD127FA25A4A1A3F5AA348491A1FA44899C8FCA25CA3B5FCB07E071FB812F880A37EA2 -96C70001ECC000A26C7FA37E807EA26C80A26C80A26C807F6D7F816D7F7F6D7F6D6D5F6D -14C06D6E5E6E7F6E01FC5E020F01FF5E6E02C0ED7FEF020102F8EDFFC76E02FF02071383 -033F02FC013F1301030F91B638FC007F03014D131F6F6C04E01307040704801301DC007F -02F8CAFC050191CBFC6D6677E37F>71 D73 D<020FB812F0A691C70001EC8000B3B3B3ACEA03FCEA0FFF487F487F487F -A2B57EA45E96C7FCA36C49495B604A5B6C90C75C6C484A5B01F84A5BD80FFE4A5B6C6C6C -90B55A0001D9F80749C8FC6C90B65A013F15F0010F15C001014AC9FCD9001F13C044647C -E153>I76 -D78 D80 D82 DI<001FBEFCA64849C79126E0000F -148002E0180091C8171F498601F81A0349864986A2491B7FA2491B3F007F1DC090C9181F -A4007E1C0FA600FE1DE0481C07A5CA95C7FCB3B3B3A3021FBAFCA663617AE070>II<913803FFFE027FEBFF -F00103B612FE010F6F7E4916E090273FFE001F7FD97FE001077FD9FFF801017F486D6D7F -717E486D6E7F85717FA2717FA36C496E7FA26C5B6D5AEB1FC090C9FCA74BB6FC157F0207 -B7FC147F49B61207010F14C0013FEBFE004913F048B512C04891C7FC485B4813F85A5C48 -5B5A5CA2B55AA45FA25F806C5E806C047D7F6EEB01F96C6DD903F1EBFF806C01FED90FE1 -14FF6C9027FFC07FC01580000191B5487E6C6C4B7E011F02FC130F010302F001011400D9 -001F90CBFC49437CC14E>97 D<903807FF80B6FCA6C6FC7F7FB3A8EFFFF8040FEBFF8004 -7F14F00381B612FC038715FF038F010014C0DBBFF0011F7FDBFFC001077F93C76C7F4B02 -007F03F8824B6F7E4B6F13804B17C0851BE0A27313F0A21BF8A37313FCA41BFEAE1BFCA4 -4F13F8A31BF0A24F13E0A24F13C06F17804F1300816F4B5A6F4A5B4AB402075B4A6C6C49 -5B9126F83FE0013F13C09127F00FFC03B55A4A6CB648C7FCDAC00115F84A6C15E091C700 -1F91C8FC90C8000313E04F657BE35A>I<92380FFFF04AB67E020F15F0023F15FC91B77E -01039039FE001FFF4901F8010113804901E0010713C04901804913E0017F90C7FC49484A -13F0A2485B485B5A5C5A7113E0485B7113C048701380943800FE0095C7FC485BA4B5FCAE -7EA280A27EA2806C18FCA26C6D150119F87E6C6D15036EED07F06C18E06C6D150F6D6DEC -1FC06D01E0EC7F806D6DECFF00010701FCEB03FE6D9039FFC03FFC010091B512F0023F5D -020F1580020102FCC7FCDA000F13C03E437BC148>II<92380FFFC04AB512FC020FECFF8002 -3F15E091B712F80103D9FE037F499039F0007FFF011F01C0011F7F49496D7F4990C76C7F -49486E7F48498048844A804884485B727E5A5C48717EA35A5C721380A2B5FCA391B9FCA4 -1A0002C0CBFCA67EA380A27EA27E6E160FF11F806C183F6C7FF17F006C7F6C6D16FE6C17 -016D6C4B5A6D6D4A5A6D01E04A5A6D6DEC3FE0010301FC49B45A6D9026FFC01F90C7FC6D -6C90B55A021F15F8020715E0020092C8FC030713F041437CC14A>III<903807FF80B6FCA6C6FC7F7FB3A8EF1FFF94B512F0040714FC041F14FF4C8193267F -E07F7F922781FE001F7FDB83F86D7FDB87F07FDB8FC0814C7F039FC78015BE03BC8003FC -825DA25DA25DA45DB3B2B7D8F007B71280A651647BE35A>II<903807FF80B6FCA6C6FC7F7FB3A90503 -B61280A6DD003FEB8000DE0FFCC7FCF01FF04E5AF0FFC04D5B4D90C8FCEF07FC4D5AEF3F -F04D5A4D5A4C90C9FC4C5AEE0FFC4C5A4C5AEE7FC04C7E03837F03877F158F039F7F03BF -7F92B5FC838403FC804B7E03F0804B6C7F4B6C7F1580707F707F707FA270807080717FA2 -717F717F717FA2717F717F83867180727F95B57EB7D8E00FECFFF0A64C647BE355>107 -D<903807FF80B6FCA6C6FC7F7FB3B3B3B3ADB712E0A623647BE32C>I<902607FF80D91F -FFEEFFF8B691B500F00207EBFF80040702FC023F14E0041F02FF91B612F84C6F48819326 -7FE07F6D4801037F922781FE001F9027E00FF0007FC6DA83F86D9026F01FC06D7F6DD987 -F06D4A487F6DD98FC0DBF87EC7804C6D027C80039FC76E488203BEEEFDF003BC6E4A8003 -FC04FF834B5FA24B5FA24B94C8FCA44B5EB3B2B7D8F007B7D8803FB612FCA67E417BC087 ->I<902607FF80EB1FFFB691B512F0040714FC041F14FF4C8193267FE07F7F922781FE00 -1F7FC6DA83F86D7F6DD987F07F6DD98FC0814C7F039FC78015BE03BC8003FC825DA25DA2 -5DA45DB3B2B7D8F007B71280A651417BC05A>I<923807FFE092B6FC020715E0021F15F8 -027F15FE494848C66C6C7E010701F0010F13E04901C001037F49496D7F4990C87F49486F -7E49486F7E48496F13804819C04A814819E048496F13F0A24819F8A348496F13FCA34819 -FEA4B518FFAD6C19FEA46C6D4B13FCA36C19F8A26C6D4B13F0A26C19E06C6D4B13C0A26C -6D4B13806C6D4B13006D6C4B5A6D6D495B6D6D495B010701F0010F13E06D01FE017F5B01 -0090B7C7FC023F15FC020715E0020092C8FC030713E048437CC151>I<902607FF80EBFF -F8B6010FEBFF80047F14F00381B612FC038715FF038F010114C09227BFF0003F7FC6DAFF -C0010F7F6D91C76C7F6D496E7F03F86E7F4B6E7F4B17804B6F13C0A27313E0A27313F0A2 -1BF885A21BFCA3851BFEAE4F13FCA41BF861A21BF0611BE0611BC06F92B512801B006F5C -6F4A5B6F4A5B03FF4A5B70495B04E0017F13C09226CFFC03B55A03C7B648C7FC03C115F8 -03C015E0041F91C8FC040313E093CBFCB3A3B712F0A64F5D7BC05A>I114 D<913A3FFF8007800107B5EAF81F011FECFE7F017F91B5FC48 -B8FC48EBE0014890C7121FD80FFC1407D81FF0801600485A007F167F49153FA212FF171F -A27F7F7F6D92C7FC13FF14E014FF6C14F8EDFFC06C15FC16FF6C16C06C16F06C826C826C -826C82013F1680010F16C01303D9007F15E0020315F0EC001F1500041F13F81607007C15 -0100FC81177F6C163FA2171F7EA26D16F0A27F173F6D16E06D157F6D16C001FEEDFF806D -0203130002C0EB0FFE02FCEB7FFC01DFB65A010F5DD8FE0315C026F8007F49C7FC48010F -13E035437BC140>II<902607FFC0ED3FFEB60207B5FCA6C6EE00076D826D82B3B3A260A360A2607F60 -183E6D6D147E4E7F6D6D4948806D6DD907F0ECFF806D01FFEB3FE06D91B55A6E1500021F -5C020314F8DA003F018002F0C7FC51427BC05A>I119 -D<007FB600C0017FB512F8A6D8001F01F8C70007EBF0006D040190C7FC6D6D5D6D6D4A5A -6D6D4A5A70495A6D4C5A6E7F6E6D495A6E6D495A7049C8FC6E4A5A6E6D485A6E6D485A6E -13FFEF8FF06EEC9FE06FEBFFC06F5C6F91C9FC5F6F5B816F7F6F7F8481707F8493B57E4B -805D4B80DB0FF37FDB1FE17F04C080153F4B486C7F4B486C7F4A486D7F4A486D7F4A5A4B -6D7F020F6E7F4A486D7F4A486D804A5A4AC86C7F49486F7F4A6F7F0107707FEB3FFFB600 -F049B7FCA650407EBF55>I E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fi cmsy10 10.95 3 -/Fi 3 16 df<007FB812F8B912FCA26C17F83604789847>0 D13 -D15 -D E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fj cmr10 10.95 86 -/Fj 86 125 df<4AB4EB0FE0021F9038E03FFC913A7F00F8FC1ED901FC90383FF03FD907 -F090397FE07F80494801FF13FF4948485BD93F805C137F0200ED7F00EF003E01FE6D91C7 -FC82ADB97EA3C648C76CC8FCB3AE486C4A7E007FD9FC3FEBFF80A339407FBF35>11 -DIII<121EEA7F80EAFFC0A9EA7F80ACEA3F00AC -121EAB120CC7FCA8121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A4179C019>33 -D<001E130F397F803FC000FF137F01C013E0A201E013F0A3007F133F391E600F30000013 -00A401E01370491360A3000114E04913C00003130101001380481303000EEB070048130E -0018130C0038131C003013181C1C7DBE2D>I<4B6C130C4B6C131EA20307143EA24C133C -A2030F147CA293C71278A24B14F8A2031E5CA2033E1301A2033C5CA3037C1303A203785C -A203F81307A24B5CA20201140F007FBAFCBB1280A26C1900C72707C0003EC8FC4B133CA3 -020F147CA292C71278A24A14F8A2021E5CA3023E1301007FBAFCBB1280A26C1900C727F8 -0007C0C8FC4A5CA20101140FA24A91C9FCA301035CA24A131EA20107143EA24A133CA201 -0F147CA291C71278A34914F8A2011E5CA2013E1301A2013C5CA201186D5A41517BBE4C> -I<013F1603D9FFC04B7E2601E0E0150F2607C070151F48486C4BC7FC023E157E48486C15 -FE48D90FC0EB03FC003ED90EF0EB0FF8DA0F3F13FD007E903A070FFFF1F0007C0200EB03 -E0160000FC6D6C495A170F604DC8FC5F173E5F17FC5F4C5A1603007CD907005B4C5A007E -150F003E495C020E49C9FC003F5D6C49133E260F803C5B023813FC6C6C485B3A01E0E001 -F03800FFC090273F0003E0133F90C70007ECFFC09339C001E0E0923A0F8007C070031F49 -487E0400143C033E90381F001C037E497F037C133E4B150F0201027E7F4B137C4A5A0207 -02FCEB03805D4A5A141F92C7FC143E147E147C5CA2495A0103037CEB07005C4948147E01 -0F033E5B4A160E49C8123F496F5B013E92380F803C49173801FC6F6C5A49923801E0E049 -6FB45A0160043FC7FC41497BC34C>37 D<121EEA7F8012FF13C0A213E0A3127FEA1E6012 -00A413E013C0A312011380120313005A120E5A1218123812300B1C79BE19>39 -D<1430147014E0EB01C0EB03801307EB0F00131E133E133C5B13F85B12015B1203A2485A -A2120F5BA2121F90C7FCA25AA3123E127EA6127C12FCB2127C127EA6123E123FA37EA27F -120FA27F1207A26C7EA212017F12007F13787F133E131E7FEB07801303EB01C0EB00E014 -701430145A77C323>I<12C07E12707E7E121E7E6C7E7F12036C7E7F12007F1378137CA2 -7FA2133F7FA21480130FA214C0A3130714E0A6130314F0B214E01307A614C0130FA31480 -A2131F1400A25B133EA25BA2137813F85B12015B485A12075B48C7FC121E121C5A5A5A5A -145A7BC323>II<121EEA7F8012FF13C0A213E0A3127FEA1E601200A413E013C0A3120113 -80120313005A120E5A1218123812300B1C798919>44 DI<121E -EA7F80A2EAFFC0A4EA7F80A2EA1E000A0A798919>IIIIII< -150E151E153EA2157EA215FE1401A21403EC077E1406140E141CA214381470A214E0EB01 -C0A2EB0380EB0700A2130E5BA25B5BA25B5B1201485A90C7FC5A120E120C121C5AA25A5A -B8FCA3C8EAFE00AC4A7E49B6FCA3283E7EBD2D>I<00061403D80780131F01F813FE90B5 -FC5D5D5D15C092C7FC14FCEB3FE090C9FCACEB01FE90380FFF8090383E03E090387001F8 -496C7E49137E497F90C713800006141FC813C0A216E0150FA316F0A3120C127F7F12FFA4 -16E090C7121F12FC007015C012780038EC3F80123C6CEC7F00001F14FE6C6C485A6C6C48 -5A3903F80FE0C6B55A013F90C7FCEB07F8243F7CBC2D>II<1238123C123F90B612FCA316F85A16F016E00078C712010070EC -03C0ED078016005D48141E151C153C5DC8127015F04A5A5D14034A5A92C7FC5C141EA25C -A2147C147814F8A213015C1303A31307A3130F5CA2131FA6133FAA6D5A0107C8FC26407B -BD2D>III<121EEA7F80A2EAFFC0A4EA7F80A2EA1E00C7FC -B3121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A2779A619>I<121EEA7F80A2EAFFC0A4EA -7F80A2EA1E00C7FCB3121E127FEAFF80A213C0A4127F121E1200A412011380A312031300 -5A1206120E120C121C5A1230A20A3979A619>I<007FB912E0BA12F0A26C18E0CDFCAE00 -7FB912E0BA12F0A26C18E03C167BA147>61 D63 D<15074B7EA34B7EA34B7EA34B7E -A34B7E15E7A2913801C7FC15C3A291380381FEA34AC67EA3020E6D7EA34A6D7EA34A6D7E -A34A6D7EA34A6D7EA349486D7E91B6FCA249819138800001A249C87EA24982010E157FA2 -011E82011C153FA2013C820138151FA2017882170F13FC00034C7ED80FFF4B7EB500F001 -0FB512F8A33D417DC044>65 DIIIIIIII<011FB512FCA3D9000713 -006E5A1401B3B3A6123FEA7F80EAFFC0A44A5A1380D87F005B007C130700385C003C495A -6C495A6C495A2603E07EC7FC3800FFF8EB3FC026407CBD2F>IIIIIIIIII<003FB91280A3903AF000 -7FE001018090393FC0003F48C7ED1FC0007E1707127C00781703A300701701A548EF00E0 -A5C81600B3B14B7E4B7E0107B612FEA33B3D7DBC42>IIII<007FB5 -D8C003B512E0A3C649C7EBFC00D93FF8EC3FE06D48EC1F806D6C92C7FC171E6D6C141C6D -6C143C5F6D6C14706D6D13F04C5ADA7FC05B023F13036F485ADA1FF090C8FC020F5BEDF8 -1E913807FC1C163C6E6C5A913801FF7016F06E5B6F5AA26F7E6F7EA28282153FED3BFEED -71FF15F103E07F913801C07F0203804B6C7EEC07004A6D7E020E6D7E5C023C6D7E02386D -7E14784A6D7E4A6D7F130149486E7E4A6E7E130749C86C7E496F7E497ED9FFC04A7E0007 -6DEC7FFFB500FC0103B512FEA33F3E7EBD44>II91 -D<486C13C00003130101001380481303000EEB070048130E0018130C0038131C00301318 -0070133800601330A300E01370481360A400CFEB678039FFC07FE001E013F0A3007F133F -A2003F131F01C013E0390F0007801C1C73BE2D>II96 DII<49B4FC010F13E090383F00F801 -7C131E4848131F4848137F0007ECFF80485A5B121FA24848EB7F00151C007F91C7FCA290 -C9FC5AAB6C7EA3003FEC01C07F001F140316806C6C13076C6C14000003140E6C6C131E6C -6C137890383F01F090380FFFC0D901FEC7FC222A7DA828>IIII< -167C903903F801FF903A1FFF078F8090397E0FDE1F9038F803F83803F001A23B07E000FC -0600000F6EC7FC49137E001F147FA8000F147E6D13FE00075C6C6C485AA23901F803E039 -03FE0FC026071FFFC8FCEB03F80006CAFC120EA3120FA27F7F6CB512E015FE6C6E7E6C15 -E06C810003813A0FC0001FFC48C7EA01FE003E140048157E825A82A46C5D007C153E007E -157E6C5D6C6C495A6C6C495AD803F0EB0FC0D800FE017FC7FC90383FFFFC010313C0293D -7EA82D>III<1478EB01FEA2EB03FFA4EB01FEA2EB00781400AC -147FEB7FFFA313017F147FB3B3A5123E127F38FF807E14FEA214FCEB81F8EA7F01387C03 -F0381E07C0380FFF803801FC00185185BD1C>III<2701F801FE14FF00FF902707FFC00313E0913B1E07E00F03F0913B -7803F03C01F80007903BE001F87000FC2603F9C06D487F000101805C01FBD900FF147F91 -C75B13FF4992C7FCA2495CB3A6486C496CECFF80B5D8F87FD9FC3F13FEA347287DA74C> -I<3901F801FE00FF903807FFC091381E07E091387803F000079038E001F82603F9C07F00 -01138001FB6D7E91C7FC13FF5BA25BB3A6486C497EB5D8F87F13FCA32E287DA733>I<14 -FF010713E090381F81F890387E007E01F8131F4848EB0F804848EB07C04848EB03E0000F -15F04848EB01F8A2003F15FCA248C812FEA44815FFA96C15FEA36C6CEB01FCA3001F15F8 -6C6CEB03F0A26C6CEB07E06C6CEB0FC06C6CEB1F80D8007EEB7E0090383F81FC90380FFF -F0010090C7FC282A7EA82D>I<3901FC03FC00FF90381FFF8091387C0FE09039FDE003F0 -3A07FFC001FC6C496C7E6C90C7127F49EC3F805BEE1FC017E0A2EE0FF0A3EE07F8AAEE0F -F0A4EE1FE0A2EE3FC06D1580EE7F007F6E13FE9138C001F89039FDE007F09039FC780FC0 -DA3FFFC7FCEC07F891C9FCAD487EB512F8A32D3A7EA733>I<02FF131C0107EBC03C9038 -1F80F090397F00387C01FC131CD803F8130E4848EB0FFC150748481303121F485A150148 -5AA448C7FCAA6C7EA36C7EA2001F14036C7E15076C6C130F6C7E6C6C133DD8007E137990 -383F81F190380FFFC1903801FE0190C7FCAD4B7E92B512F8A32D3A7DA730>I<3901F807 -E000FFEB1FF8EC787CECE1FE3807F9C100031381EA01FB1401EC00FC01FF1330491300A3 -5BB3A5487EB512FEA31F287EA724>I<90383FC0603901FFF8E03807C03F381F000F003E -1307003C1303127C0078130112F81400A27E7E7E6D1300EA7FF8EBFFC06C13F86C13FE6C -7F6C1480000114C0D8003F13E0010313F0EB001FEC0FF800E01303A214017E1400A27E15 -F07E14016C14E06CEB03C0903880078039F3E01F0038E0FFFC38C01FE01D2A7DA824>I< -131CA6133CA4137CA213FCA2120112031207001FB512C0B6FCA2D801FCC7FCB3A215E0A9 -12009038FE01C0A2EB7F03013F138090381F8700EB07FEEB01F81B397EB723>IIII< -B539F01FFFE0A30003D9C00F1300C690388007F8D97F0013E002805BD93FC05B011F49C7 -FC90380FE00EECF01E6D6C5A01035B6D6C5A6E5AEB00FF6E5A6E5A81141F814A7E81147B -ECF1FC903801E1FEECC0FF01037F49486C7ED90F007F011E6D7E013E130F496D7E01FC80 -486C80000F4A7EB539803FFFF8A32D277FA630>II<001FB61280A2EBE0000180140049485A001E -495A121C4A5A003C495A141F00385C4A5A147F5D4AC7FCC6485AA2495A495A130F5C495A -90393FC00380A2EB7F80EBFF005A5B484813071207491400485A48485BA248485B484813 -7F00FF495A90B6FCA221277EA628>I124 -D E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fk cmbx12 14.4 60 -/Fk 60 122 df<922601FFFC903801FFE0033F9026FF801F13F84AB6D8E07F13FE020F03 -F9B6FC023FD9C00FB500C0138091277FFC0003D9FE0113C0902601FFE049495A49494949 -4813E04990C714F049484A13E0495A19C0495A7413C0017F17804A6E6E1380719138007E -007192C7FCAEBCFCA526007FF8C7000301C0C8FCB3B3A7007FB5D8F803B612F0A553547D -D34E>11 D<151E153E157E15FCEC01F8EC07F0EC0FE0EC1FC01580143FEC7F0014FE1301 -495A5C1307495AA2495A133F5C137FA2495AA24890C7FCA25A5BA21207A2485AA3121F5B -A3123FA25BA3127FA55B12FFB3A3127F7FA5123FA37FA2121FA37F120FA36C7EA21203A2 -7F7EA26C7FA26D7EA2133F80131F6D7EA26D7E1303806D7E1300147FEC3F80141F15C0EC -0FE0EC07F0EC01F8EC00FC157E153E151E1F7973D934>40 D<127012F8127C127E7EEA1F -C06C7E6C7E12037F6C7E6C7E7F6D7E133F806D7EA26D7E80130780A26D7EA26D7EA21580 -7FA215C0A2EC7FE0A315F0143FA315F8A2141FA315FCA5140F15FEB3A315FC141FA515F8 -A3143FA215F0A3147F15E0A3ECFFC0A21580A25B1500A2495AA2495AA25C130F5C495AA2 -495A5C137F49C7FC5B485A485A5B1207485A485A48C8FC127E127C5A12701F7979D934> -I44 D46 -D<157815FC14031407141F14FF130F0007B5FCB6FCA2147F13F0EAF800C7FCB3B3B3A600 -7FB712FEA52F4E76CD43>49 DI<91380FFFC091B512 -FC0107ECFF80011F15E090263FF8077F9026FF800113FC4848C76C7ED803F86E7E491680 -D807FC8048B416C080486D15E0A4805CA36C17C06C5B6C90C75AD801FC1680C9FC4C1300 -5FA24C5A4B5B4B5B4B13C04B5BDBFFFEC7FC91B512F816E016FCEEFF80DA000713E00301 -13F89238007FFE707E7013807013C018E07013F0A218F8A27013FCA218FEA2EA03E0EA0F -F8487E487E487EB57EA318FCA25E18F891C7FC6C17F0495C6C4816E001F04A13C06C484A -1380D80FF84A13006CB44A5A6CD9F0075BC690B612F06D5D011F1580010302FCC7FCD900 -1F1380374F7ACD43>I<177C17FEA2160116031607160FA2161F163F167FA216FF5D5DA2 -5D5DED1FBFED3F3F153E157C15FCEC01F815F0EC03E01407EC0FC01580EC1F005C147E14 -7C5C1301495A495A5C495A131F49C7FC133E5B13FC485A5B485A1207485A485A90C8FC12 -3E127E5ABA12C0A5C96C48C7FCAF020FB712C0A53A4F7CCE43>III<121F7F7FEBFF8091B81280A45A1900606060A2606060485F0180C86CC7 -FC007EC95A4C5A007C4B5A5F4C5A160F4C5A484B5A4C5A94C8FC16FEC812014B5A5E4B5A -150F4B5AA24B5AA24B5A15FFA24A90C9FCA25C5D1407A2140FA25D141FA2143FA4147F5D -A314FFA55BAC6D5BA2EC3FC06E5A395279D043>I<913807FFC0027F13FC0103B67E010F -15E090261FFC0113F8903A3FE0003FFCD97F80EB0FFE49C76C7E48488048486E13800007 -17C04980120F18E0177FA2121F7FA27F7F6E14FF02E015C014F802FE4913806C7FDBC003 -13009238F007FE6C02F85B9238FE1FF86C9138FFBFF06CEDFFE017806C4BC7FC6D806D81 -010F15E06D81010115FC010781011F81491680EBFFE748018115C048D9007F14E0484801 -1F14F048487F48481303030014F8484880161F4848020713FC1601824848157F173FA217 -1FA2170FA218F8A27F007F17F06D151FA26C6CED3FE0001F17C06D157F6C6CEDFF806C6C -6C010313006C01E0EB0FFE6C01FCEBFFFC6C6CB612F06D5D010F1580010102FCC7FCD900 -0F13C0364F7ACD43>I<171F4D7E4D7EA24D7EA34C7FA24C7FA34C7FA34C7FA24C7FA34C -8083047F80167E8304FE804C7E03018116F8830303814C7E03078116E083030F814C7E03 -1F81168083033F8293C77E4B82157E8403FE824B800201835D840203834B800207835D84 -4AB87EA24A83A3DA3F80C88092C97E4A84A2027E8202FE844A82010185A24A820103854A -82010785A24A82010F855C011F717FEBFFFCB600F8020FB712E0A55B547BD366>65 -DI<932601FFFCEC01C0047F -D9FFC013030307B600F81307033F03FE131F92B8EA803F0203DAE003EBC07F020F01FCC7 -383FF0FF023F01E0EC0FF94A01800203B5FC494848C9FC4901F882494982494982494982 -4949824990CA7E494883A2484983485B1B7F485B481A3FA24849181FA3485B1B0FA25AA2 -98C7FC5CA2B5FCAE7EA280A2F307C07EA36C7FA21B0F6C6D1980A26C1A1F6C7F1C006C6D -606C6D187EA26D6C606D6D4C5A6D6D16036D6D4C5A6D6D4C5A6D01FC4C5A6D6DEE7F806D -6C6C6C4BC7FC6E01E0EC07FE020F01FEEC1FF80203903AFFE001FFF0020091B612C0033F -93C8FC030715FCDB007F14E0040101FCC9FC525479D261>IIII<9326 -01FFFCEC01C0047FD9FFC013030307B600F81307033F03FE131F92B8EA803F0203DAE003 -EBC07F020F01FCC7383FF0FF023F01E0EC0FF94A01800203B5FC494848C9FC4901F88249 -49824949824949824949824990CA7E494883A2484983485B1B7F485B481A3FA24849181F -A3485B1B0FA25AA298C8FC5CA2B5FCAE6C057FB712E0A280A36C94C7003FEBC000A36C7F -A36C7FA27E6C7FA26C7F6C7FA26D7E6D7F6D7F6D6D5E6D7F6D01FC93B5FC6D13FF6D6C6D -5C6E01F0EC07FB020F01FEEC1FF10203903AFFF001FFE0020091B6EAC07F033FEE001F03 -0703FC1307DB007F02E01301040149CAFC5B5479D26A>III<027FB71280A591C76C90C7FCB3 -B3B3EA07F0EA1FFC487E487EA2B57EA44C5AA34A485B7E49495BD83FF8495BD81FE05DD8 -0FFC011F5B2707FF807F90C8FC000190B512FC6C6C14F0011F14C0010101F8C9FC39537D -D145>IIII< -B600FC93B7FC8181A282D800076E9239003FFC0070EE07E08282A28202EF7F02E77F02E3 -80A202E18002E0806F7F6F7F6F7FA26F7F6F7F6F806F80A26F80707F707F707F707FA270 -7F7080708070808583717F717F717F717FA27114807114C07114E07213F07213F8A27213 -FC7213FE7213FF721487A27214C77214E77313F77313FF85A285858585A28586868686A2 -86868686A2D93FFC187FB7173F1B1F1B0F1B07755A60527CD169>I<93380FFFC00303B6 -FC031F15E092B712FC0203D9FC0013FF020F01C0010F13C0023F90C7000313F0DA7FFC02 -007F494848ED7FFE4901E0ED1FFF49496F7F49496F7F4990C96C7F49854948707F494870 -7FA24849717E48864A83481B804A83481BC0A2481BE04A83A2481BF0A348497113F8A5B5 -1AFCAF6C1BF86E5FA46C1BF0A26E5F6C1BE0A36C6D4D13C0A26C6D4D1380A26C1B006C6D -4D5A6E5E6C626D6C4C5B6D6D4B5B6D6D4B5B6D6D4B5B6D6D4B5B6D6D4B90C7FC6D6D4B5A -6D01FF02035B023F01E0011F13F0020F01FC90B512C0020390B7C8FC020016FC031F15E0 -030392C9FCDB001F13E0565479D265>II82 D<91260FFF80130791B500F85B010702FF5B011FEDC03F49EDF07F9026FFFC00 -6D5A4801E0EB0FFD4801800101B5FC4848C87E48488149150F001F824981123F4981007F -82A28412FF84A27FA26D82A27F7F6D93C7FC14C06C13F014FF15F86CECFF8016FC6CEDFF -C017F06C16FC6C16FF6C17C06C836C836D826D82010F821303010082021F16801400030F -15C0ED007F040714E01600173F050F13F08383A200788200F882A3187FA27EA219E07EA2 -6CEFFFC0A27F6D4B13806D17006D5D01FC4B5A01FF4B5A02C04A5A02F8EC7FF0903B1FFF -C003FFE0486C90B65AD8FC0393C7FC48C66C14FC48010F14F048D9007F90C8FC3C5479D2 -4B>I<003FBC1280A59126C0003F9038C0007F49C71607D87FF8060113C001E08449197F -49193F90C8171FA2007E1A0FA3007C1A07A500FC1BE0481A03A6C994C7FCB3B3AC91B912 -F0A553517BD05E>IIII<003FB7D88003B7FCA5D8000749C8 -000701F8C7FC6D6D9238007F806D6E93C8FC7015FE6D17016E6D5D704A5A6E16076E6D4A -5A6E6D5D4F5A6E6D143F6E6D4A5A7191C9FC6E16FE6EECC00171485A6F5D6F6D485A6FEB -F80F71485A6F5D6F6D485AEFFF7F6F4ACAFC6F5C6F5CA2705B705B8482707F707FA2707F -7080855E4C80855E4C80DC3FCF7F058F7FEE7F074C6C7FDB01FE814C7E4B486C8003076E -7F4B48814C7F4B486D7F033F824C7F4BC76C7F4B6E7F4A5A4B6E804A486E800207844A48 -814B6F7F4A4883023F824A486F7F92C96C7F02FE840101830103718090263FFFC084B76C -0103B712F8A55D527CD166>II97 DI<913801FFF8021FEBFF8091B612F00103 -15FC010F9038C00FFE903A1FFE0001FFD97FFC491380D9FFF05B4817C048495B5C5A485B -A2486F138091C7FC486F1300705A4892C8FC5BA312FFAD127F7FA27EA2EF03E06C7F1707 -6C6D15C07E6E140F6CEE1F806C6DEC3F006C6D147ED97FFE5C6D6CEB03F8010F9038E01F -F0010390B55A01001580023F49C7FC020113E033387CB63C>I<4DB47E0407B5FCA5EE00 -1F1707B3A4913801FFE0021F13FC91B6FC010315C7010F9038E03FE74990380007F7D97F -FC0101B5FC49487F4849143F484980485B83485B5A91C8FC5AA3485AA412FFAC127FA36C -7EA37EA26C7F5F6C6D5C7E6C6D5C6C6D49B5FC6D6C4914E0D93FFED90FEFEBFF80903A0F -FFC07FCF6D90B5128F0101ECFE0FD9003F13F8020301C049C7FC41547CD24B>I<913803 -FFC0023F13FC49B6FC010715C04901817F903A3FFC007FF849486D7E49486D7E4849130F -48496D7E48178048497F18C0488191C7FC4817E0A248815B18F0A212FFA490B8FCA318E0 -49CAFCA6127FA27F7EA218E06CEE01F06E14037E6C6DEC07E0A26C6DEC0FC06C6D141F6C -6DEC3F806D6CECFF00D91FFEEB03FE903A0FFFC03FF8010390B55A010015C0021F49C7FC -020113F034387CB63D>II -II<137F497E000313E0487FA2487FA76C5BA26C5BC613806DC7FC -90C8FCADEB3FF0B5FCA512017EB3B3A6B612E0A51B547BD325>I107 DIII<913801FFE002 -1F13FE91B612C0010315F0010F9038807FFC903A1FFC000FFED97FF86D6C7E49486D7F48 -496D7F48496D7F4A147F48834890C86C7EA24883A248486F7EA3007F1880A400FF18C0AC -007F1880A3003F18006D5DA26C5FA26C5F6E147F6C5F6C6D4A5A6C6D495B6C6D495B6D6C -495BD93FFE011F90C7FC903A0FFF807FFC6D90B55A010015C0023F91C8FC020113E03A38 -7CB643>I<903A3FF001FFE0B5010F13FE033FEBFFC092B612F002F301017F913AF7F800 -7FFE0003D9FFE0EB1FFFC602806D7F92C76C7F4A824A6E7F4A6E7FA2717FA285187F85A4 -721380AC1A0060A36118FFA2615F616E4A5BA26E4A5B6E4A5B6F495B6F4990C7FC03F0EB -FFFC9126FBFE075B02F8B612E06F1480031F01FCC8FC030313C092CBFCB1B612F8A5414D -7BB54B>I<90397FE003FEB590380FFF80033F13E04B13F09238FE1FF89139E1F83FFC00 -03D9E3E013FEC6ECC07FECE78014EF150014EE02FEEB3FFC5CEE1FF8EE0FF04A90C7FCA5 -5CB3AAB612FCA52F367CB537>114 D<903903FFF00F013FEBFE1F90B7FC120348EB003F -D80FF81307D81FE0130148487F4980127F90C87EA24881A27FA27F01F091C7FC13FCEBFF -C06C13FF15F86C14FF16C06C15F06C816C816C81C681013F1580010F15C01300020714E0 -EC003F030713F015010078EC007F00F8153F161F7E160FA27E17E07E6D141F17C07F6DEC -3F8001F8EC7F0001FEEB01FE9039FFC00FFC6DB55AD8FC1F14E0D8F807148048C601F8C7 -FC2C387CB635>I<143EA6147EA414FEA21301A313031307A2130F131F133F13FF5A000F -90B6FCB8FCA426003FFEC8FCB3A9EE07C0AB011FEC0F8080A26DEC1F0015806DEBC03E6D -EBF0FC6DEBFFF86D6C5B021F5B020313802A4D7ECB34>IIII<007FB500F090387FFFFEA5C66C48C7000F90C7FC6D6CEC07F8 -6D6D5C6D6D495A6D4B5A6F495A6D6D91C8FC6D6D137E6D6D5B91387FFE014C5A6E6C485A -6EEB8FE06EEBCFC06EEBFF806E91C9FCA26E5B6E5B6F7E6F7EA26F7F834B7F4B7F92B5FC -DA01FD7F03F87F4A486C7E4A486C7E020F7FDA1FC0804A486C7F4A486C7F02FE6D7F4A6D -7F495A49486D7F01076F7E49486E7E49486E7FEBFFF0B500FE49B612C0A542357EB447> -II E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fl cmbx12 20.736 17 -/Fl 17 116 df[<17F0EE03F81607EE0FF0163FEE7FE0EEFFC04B13804B13004B5A4B5A -4B5A153F4B5A4B5A5C5E4A5B5C4A90C7FC4A5AA24A5A147F5D14FF5D5B495BA2495BA25B -5D5B92C8FC5BA2495AA213FF5CA25A5CA25AA25C5AA35A5CA35AA25CA25AA55C5AA8B5FC -A391C9FCB280A37EA87E80A57EA280A27EA3807EA37E80A27EA2807EA280137FA26D7EA2 -7F817F817FA26D7FA26D7F7F81147F81143F6E7EA26E7E6E7F806E7F82806F7E6F7E151F -6F7E6F7E6F7E6F13806F13C0EE7FE0EE3FF0160FEE07F81603EE00F0>45 -172 110 256 75 40 D[<127812FE7E6C7E13E06C7E6C7E6C7E6C7E6C7E6C7F6C7F806D -7E6D7E80131F6D7E806D7F6D7FA26D7F817F81147F816E7EA26E7EA28280828082A26E7F -A28280A28280A282A2157F82A3178081A317C0A281A217E0A58117F0A817F8A381B25DA3 -17F0A817E05DA517C0A25DA21780A35D1700A35E15FFA25EA25C5EA25C5EA24A5BA25E5C -5E5C93C7FCA24A5AA24A5A5D14FF5D5B5D495BA2495B4990C8FC5C495A133F5C495A495A -5C485B4890C9FC485A485A485A485A485A138048CAFC5A1278>45 -172 117 256 75 I<96267FFFE01670063FB6ED01F80503B700F01403053F04FC14074C -B96C130F040706E0131F043F72133F93BA00FC137F0303DC00076D13FF030F03C0903900 -3FFF814B02FCC8000713C3037F02E0030113F792B600806F6CB5FC02034ACA121F4A02F8 -834A02E0834A4A1701027F4A8391B548CC7E494A85495C4C854988494A85494A85495C8A -4991CDFC90B54886A2484A1B7FA2481E3F5D481E1F5D5A1F0FA2485CA3481E075DA2795A -489BC9FCA45DA2B6FCB27EA26F0403BA12C0A47EA3816C96C8000302F8C7FCA36C80A36C -80A27E817E817E817F6D80827F6D806D806D80826D6E606D806E80021F6E5F6E02F05F6E -806E02FE5F0200DAFFC05E6F02F04BB6FC031F02FE030713CF6FDAFFE0021F1387030392 -26FF8003B51201030093B6EAFC00043F4E133F040706E0131F04014E1307DC003F4CC712 -01050304F8EC0070DD003F038092C8FCDE007F01F0CCFC827A75F798>71 -D<037FB912F8A892C86C49C7FCB3B3B3B3A6EBFF80000313E0487F001F13FCA2487F487F -A2B67EA46295B5FCA26292C8FC6C4C5CA24A4A5C6C5B6C494A5C4A4A5C6C01C04A91C8FC -6C90C8485B6C01E04A5B6C01F849B55A6C9026FFC00F14E0013F90B71280010F4CC9FC01 -0316F8010016C0021F4ACAFC0200148055787CF564>74 D78 -D<922603FFF8150E037FD9FFC0143F0203B600FC5C021F03FF5C027FEEC00149B8EAF003 -49EFFC07010FDA000F13FE4901F09039007FFF8F4901C0020F13DF4990C8000390B5FC49 -4815004801F8163F48844A8248498248844A8248844A834885A291CB7E5A86A286B5FC86 -80A28680A280A26E8380806E187E6E95C7FC6C8015E015FCEDFFC06C15FCEEFFE06C16FF -18F06CEFFF8019F06C18FE737E6C856C19F06C19FC6D846D846D856D856D850101856D85 -023F846E841407020084031F18801500040F17C0EE007F050716E0EF003F1803DE007F14 -F0191F8585070114F8A28586007E85B4FC86A286A37F86A36D1AF0A37F1CE06D60A26D1A -C06D607F6D1A806E5F6E4D13006E606E17FF02FC4C5B02FF4C5B03E04B5B03FC031F5B01 -FBD9FF80027F5B01F102FE0107B55AD9E07F90B8C7FC6E17FCD9C00F5FD9800317E090C7 -6C168048020F4BC8FC48020015F00070030349C9FC557A75F76C>83 -D85 D<92383FFFF80207B612E002 -7F15FC49B87E010717E0011F83499026F0007F13FC4948C7000F7F90B502036D7E486E6D -806F6D80727F486E6E7F8486727FA28684A26C5C72806C5C6D90C8FC6D5AEB0FF8EB03E0 -90CAFCA70507B6FC041FB7FC0303B8FC157F0203B9FC021FECFE0391B612800103ECF800 -010F14C04991C7FC017F13FC90B512F04814C0485C4891C8FC485B5A485B5C5A5CA2B5FC -5CA360A36E5DA26C5F6E5D187E6C6D846E4A48806C6D4A4814FC6C6ED90FF0ECFFFC6C02 -E090263FE07F14FE00019139FC03FFC06C91B6487E013F4B487E010F4B1307010303F013 -01D9003F0280D9003F13FC020101F8CBFC57507ACE5E>97 D<93383FFFF00307B612C003 -3F15F84AB712FE0207707E021F17E0027F8391B526FC001F7F010302C001037F4991C748 -7F49495C495B4901F04A7F5B90B55A485CA2485C4891C8FCA248715B5C48715B725B4A6F -5B489438007FC0071FC7FC96C8FC5AA25CA3B5FCAF7E80A47E80A27E806CF11F80F23FC0 -6C6E167FA26C6EEEFF80816C606C6E17006D6D4B5A6D6D15076D6D4B5A6D6D6C4A5A6D02 -E0EC7FF06D02F849485A01009126FF801F5B6E91B6C7FC021F5E020716F8020116E06E6C -1580030702FCC8FCDB003F13804A507ACE56>99 D<93387FFF80030FB512FC037FECFF80 -4AB712E0020716F8021F16FE027FD9F8077F49B5D8C000804991C7003F13E04901FC020F -7F49496E7F49498049496E7F49496E7F90B55A48727E92C914804884485B1BC048841BE0 -485BA27313F05AA25C5AA21BF885A2B5FCA391BAFCA41BF002F8CCFCA67EA3807EA47E80 -6CF103F0F207F86C7F1A0F6C6E17F06C191F6F17E06C6E163F6D6DEE7FC06D6D16FF6D6D -4B13806D6D4B13006D6D6CEC0FFE6D02E0EC3FFC6D02F8ECFFF86D9126FFC00F5B023F91 -B65A020F178002034CC7FC020016F8031F15E0030392C8FCDB000F13E04D507BCE58> -101 D103 -D<903801FFFCB6FCA8C67E131F7FB3AD95380FFFE095B512FE05036E7E050F15E0053F15 -F84D81932701FFF01F7F4CD900077FDC07FC6D80DC0FF06D80DC1FC07F4C48824CC8FC04 -7E6F7F5EEDFDF85E03FF707F5EA25EA25EA293C9FCA45DB3B3A6B8D8E003B81280A86178 -79F76C>II<902601FFF891380FFFE0B692B512FE05036E7E050F15E0053F -15F84D81932701FFF01F7F4CD900077FDC07FC6D80C66CDA0FF06D80011FDA1FC07F6D4A -48824CC8FC047E6F7F5EEDF9F85E03FB707F5E15FF5EA25EA293C9FCA45DB3B3A6B8D8E0 -03B81280A8614E79CD6C>110 D<93381FFFE00303B6FC031F15E092B712FC020316FF02 -0F17C0023FD9FC0014F091B500C0010F13FC4991C700037F4901FC02007F010F496F13C0 -49496F7F49496F7F4B8149496F7F90B5C96C7F4886A24849707F481B80A248497014C0A2 -481BE0A348497113F0A3481BF8A5B51AFCAE6C1BF8A46C1BF06E94B5FCA36C1BE0A26C6D -4C14C0A26C1B806E5E6C1B006C6E4B5BA26C6E4B5B6D6D4B5B6D6D4B5B6D6D4B5B6D6D92 -B55A6D01FF02035C6D02C0010F91C7FC010002FC90B512FC6E90B75A021F17E002071780 -02014CC8FCDA003F15F0030392C9FCDB001F13E056507BCE61>I<902601FFFCEC7FFEB6 -020FB512F0057F14FE4CB712C0040716F0041F82047F16FE93B5C66C7F92B500F0010F14 -C0C66C0380010380011F4AC76C806D4A6E8004F06F7F4C6F7F4C6F7F4C8193C915804B70 -14C0861DE0A27414F0A27414F8A47513FCA57513FEAF5113FCA598B512F8A31DF0621DE0 -621DC0621D806F5E701800704B5B505B704B5B7092B55A04FC4A5C704A5C706C010F5C05 -E0013F49C7FC9227FE7FFC01B55A70B712F0040F16C0040393C8FC040015F8053F14C005 -0301F0C9FC94CCFCB3A6B812E0A85F6F7ACD6C>I<912603FFFCEB0780027F9039FFE00F -C00103B6EAF83F010FEDFEFF013F92B5FC49EB000F2601FFF01300480180143F4890C812 -0F4848814848814981123F83485A187FA212FF6D163FA37F7F6DEE1F8002C092C7FC14F0 -14FEECFFF06CECFF8016FEEEFFE06C16FC6C16FF18C06C836C17F86C836C836C83013F17 -806D17C0010717E0010117F0EB003F020716F8EC001F030015FC1607EE007F051F13FE17 -07007E82B482836D167FA2183F7F181FA27F19FC7FA26D163F6D17F86D167F19F06D16FF -6E4A13E002E04A13C06E4A138002FE023F1300913AFFC003FFFE01E790B65A01C316F001 -8016C026FE003F92C7FC48010714F80070D9007F90C8FC3F507ACE4C>115 -D E -%EndDVIPSBitmapFont -end -%%EndProlog -%%BeginSetup -%%Feature: *Resolution 600dpi -TeXDict begin -%%BeginPaperSize: Letter -letter -%%EndPaperSize - -%%EndSetup -%%Page: 1 1 -1 0 bop 727 2424 a Fl(GNU)65 b(Shogi)f(\(Japanese)i(c)-5 -b(hess\))150 5340 y Fk(Mik)l(e)45 b(V)-11 b(anier)p eop -%%Page: 2 2 -2 1 bop 150 5322 a Fj(Cop)m(yrigh)m(t)602 5319 y(c)577 -5322 y Fi(\015)30 b Fj(1999)i(Mic)m(hael)f(C.)f(V)-8 -b(anier)30 b(and)g(the)g(F)-8 b(ree)32 b(Soft)m(w)m(are)f(F)-8 -b(oundation)p eop -%%Page: 1 3 -1 2 bop 150 -116 a Fj(GNU)31 b(Shogi)e(\(Japanese)i(c)m(hess\))2414 -b(1)150 299 y Fh(GNU)54 b(Shogi)f(\(Japanese)g(c)l(hess\))275 -533 y Fj(This)41 b(do)s(cumen)m(t)i(describ)s(es)e(GNU)j(shogi,)i(a)d -(program)g(whic)m(h)f(pla)m(ys)g(Japanese)h(c)m(hess)h(\(shogi\))150 -643 y(against)31 b(a)f(h)m(uman)g(opp)s(onen)m(t.)p eop -%%Page: 2 4 -2 3 bop 150 -116 a Fj(2)2779 b(GNU)31 b(Shogi)f(man)m(ual)p -eop -%%Page: 3 5 -3 4 bop 150 -116 a Fj(Chapter)30 b(1:)41 b(In)m(tro)s(duction)2591 -b(3)150 299 y Fh(1)80 b(In)l(tro)t(duction)275 533 y -Fj(GNU)45 b(shogi)g(is)f(a)i(program)f(that)h(pla)m(ys)f(shogi,)j(the)e -(Japanese)f(v)m(ersion)g(of)g(c)m(hess,)50 b(against)c(a)150 -643 y(h)m(uman)33 b(\(or)h(computer\))h(opp)s(onen)m(t.)51 -b(This)32 b(\014le)h(describ)s(es)f(ho)m(w)i(to)h(use)e(GNU)i(shogi)e -(and)h(also)g(giv)m(es)150 752 y(bac)m(kground)c(information)f(ab)s -(out)h(the)g(game)i(of)e(shogi.)275 887 y(This)37 b(\014le)h(describ)s -(es)g(GNU)i(shogi)f(v)m(ersion)g(1.3.2.)69 b(It)39 b(w)m(as)h(written)e -(b)m(y)i(me,)h(Mik)m(e)f(V)-8 b(anier,)42 b(the)150 996 -y(curren)m(t)30 b(main)m(tainer)f(of)i(GNU)g(shogi.)40 -b(My)31 b(email)e(address)h(is)f Fg(mvanier@cs.caltech.edu)p -Fj(.)275 1131 y(GNU)i(shogi)e(is)h(actually)g(t)m(w)m(o)h(programs:)150 -1375 y(`)p Fg(gnushogi)p Fj(')630 1484 y(is)e(the)i(text-based)g -(program)g(whic)m(h)e(also)h(con)m(tains)h(the)f(game-pla)m(ying)h -(engine.)150 1644 y(`)p Fg(xshogi)p Fj(')142 b(is)29 -b(the)i(X-windo)m(ws)e(graphical)g(in)m(terface)i(to)g(gn)m(ushogi.)275 -1913 y(Since)e(xshogi)h(in)m(v)m(ok)m(es)h(gn)m(ushogi,)f(most)h(pla)m -(y)m(ers)f(will)e(just)h(t)m(yp)s(e)i(\\xshogi")g(and)e(start)i(pla)m -(ying.)275 2047 y(Disclaimer:)58 b(I)40 b(use)f(the)h(p)s(ersonal)f -(pronouns)f(\\him",)k(\\his")d(etc.)70 b(to)41 b(refer)f(to)g(a)h -(shogi)e(pla)m(y)m(er)150 2157 y(regardless)f(of)h(gender.)67 -b(That's)39 b(easier)g(than)f(writing)f(\\his)h(or)h(her")g(all)f(o)m -(v)m(er)i(the)g(place.)66 b(I)39 b(don't)150 2267 y(mean)34 -b(to)h(infer)d(that)j(w)m(omen)f(don't)g(pla)m(y)f(shogi;)j(in)c(fact)j -(shogi)e(is)g(v)m(ery)i(p)s(opular)c(in)i(Japan)g(among)150 -2376 y(w)m(omen)e(as)f(w)m(ell)g(as)g(men.)p eop -%%Page: 4 6 -4 5 bop 150 -116 a Fj(4)2779 b(GNU)31 b(Shogi)f(man)m(ual)p -eop -%%Page: 5 7 -5 6 bop 150 -116 a Fj(GNU)31 b(GENERAL)f(PUBLIC)h(LICENSE)2052 -b(5)150 299 y Fh(GNU)54 b(GENERAL)g(PUBLIC)f(LICENSE)1537 -508 y Fj(V)-8 b(ersion)30 b(2,)h(June)f(1991)390 637 -y(Cop)m(yrigh)m(t)842 634 y(c)817 637 y Fi(\015)g Fj(1989,)j(1991)f(F) --8 b(ree)31 b(Soft)m(w)m(are)h(F)-8 b(oundation,)30 b(Inc.)390 -741 y(675)i(Mass)e(Av)m(e,)i(Cam)m(bridge,)e(MA)h(02139,)h(USA)390 -948 y(Ev)m(ery)m(one)f(is)f(p)s(ermitted)f(to)i(cop)m(y)g(and)f -(distribute)e(v)m(erbatim)i(copies)390 1052 y(of)h(this)e(license)g(do) -s(cumen)m(t,)i(but)e(c)m(hanging)i(it)f(is)f(not)i(allo)m(w)m(ed.)150 -1309 y Fk(Pream)l(ble)275 1502 y Fj(The)39 b(licenses)h(for)g(most)h -(soft)m(w)m(are)g(are)g(designed)e(to)i(tak)m(e)h(a)m(w)m(a)m(y)h(y)m -(our)d(freedom)g(to)h(share)g(and)150 1611 y(c)m(hange)g(it.)70 -b(By)40 b(con)m(trast,)k(the)c(GNU)h(General)f(Public)e(License)i(is)f -(in)m(tended)g(to)h(guaran)m(tee)i(y)m(our)150 1721 y(freedom)24 -b(to)h(share)f(and)f(c)m(hange)i(free)f(soft)m(w)m(are|to)j(mak)m(e)e -(sure)e(the)h(soft)m(w)m(are)i(is)d(free)h(for)g(all)f(its)h(users.)150 -1831 y(This)38 b(General)i(Public)d(License)j(applies)e(to)i(most)g(of) -g(the)g(F)-8 b(ree)41 b(Soft)m(w)m(are)g(F)-8 b(oundation's)39 -b(soft)m(w)m(are)150 1940 y(and)c(to)h(an)m(y)g(other)g(program)f -(whose)h(authors)f(commit)g(to)i(using)d(it.)55 b(\(Some)36 -b(other)g(F)-8 b(ree)37 b(Soft)m(w)m(are)150 2050 y(F)-8 -b(oundation)31 b(soft)m(w)m(are)i(is)d(co)m(v)m(ered)j(b)m(y)e(the)g -(GNU)h(Library)e(General)h(Public)e(License)h(instead.\))43 -b(Y)-8 b(ou)150 2159 y(can)31 b(apply)e(it)h(to)h(y)m(our)f(programs,)g -(to)s(o.)275 2294 y(When)37 b(w)m(e)g(sp)s(eak)g(of)g(free)h(soft)m(w)m -(are,)i(w)m(e)e(are)g(referring)d(to)j(freedom,)h(not)f(price.)60 -b(Our)36 b(General)150 2403 y(Public)c(Licenses)h(are)i(designed)e(to)i -(mak)m(e)g(sure)f(that)g(y)m(ou)h(ha)m(v)m(e)g(the)g(freedom)f(to)g -(distribute)e(copies)150 2513 y(of)k(free)h(soft)m(w)m(are)g(\(and)f(c) -m(harge)i(for)e(this)f(service)h(if)f(y)m(ou)i(wish\),)g(that)f(y)m(ou) -h(receiv)m(e)g(source)f(co)s(de)h(or)150 2623 y(can)e(get)h(it)e(if)f -(y)m(ou)i(w)m(an)m(t)h(it,)f(that)g(y)m(ou)g(can)g(c)m(hange)h(the)e -(soft)m(w)m(are)i(or)f(use)f(pieces)h(of)f(it)g(in)g(new)g(free)150 -2732 y(programs;)c(and)g(that)h(y)m(ou)g(kno)m(w)f(y)m(ou)h(can)f(do)h -(these)g(things.)275 2867 y(T)-8 b(o)40 b(protect)h(y)m(our)f(righ)m -(ts,)i(w)m(e)e(need)g(to)h(mak)m(e)g(restrictions)d(that)j(forbid)d(an) -m(y)m(one)j(to)g(den)m(y)f(y)m(ou)150 2976 y(these)d(righ)m(ts)f(or)g -(to)h(ask)g(y)m(ou)f(to)h(surrender)e(the)h(righ)m(ts.)58 -b(These)36 b(restrictions)f(translate)i(to)g(certain)150 -3086 y(resp)s(onsibilities)25 b(for)31 b(y)m(ou)f(if)g(y)m(ou)g -(distribute)e(copies)i(of)h(the)f(soft)m(w)m(are,)j(or)d(if)f(y)m(ou)i -(mo)s(dify)e(it.)275 3220 y(F)-8 b(or)30 b(example,)f(if)g(y)m(ou)g -(distribute)e(copies)j(of)f(suc)m(h)g(a)h(program,)g(whether)e(gratis)i -(or)f(for)g(a)h(fee,)h(y)m(ou)150 3330 y(m)m(ust)i(giv)m(e)h(the)g -(recipien)m(ts)e(all)h(the)g(righ)m(ts)g(that)h(y)m(ou)g(ha)m(v)m(e.)51 -b(Y)-8 b(ou)34 b(m)m(ust)g(mak)m(e)g(sure)f(that)h(they)-8 -b(,)35 b(to)s(o,)150 3440 y(receiv)m(e)j(or)g(can)g(get)g(the)g(source) -g(co)s(de.)62 b(And)37 b(y)m(ou)h(m)m(ust)f(sho)m(w)h(them)f(these)h -(terms)f(so)h(they)g(kno)m(w)150 3549 y(their)29 b(righ)m(ts.)275 -3684 y(W)-8 b(e)29 b(protect)g(y)m(our)f(righ)m(ts)f(with)g(t)m(w)m(o)i -(steps:)40 b(\(1\))29 b(cop)m(yrigh)m(t)f(the)g(soft)m(w)m(are,)j(and)c -(\(2\))i(o\013er)g(y)m(ou)f(this)150 3793 y(license)h(whic)m(h)g(giv)m -(es)i(y)m(ou)g(legal)f(p)s(ermission)d(to)k(cop)m(y)-8 -b(,)32 b(distribute)c(and/or)i(mo)s(dify)f(the)i(soft)m(w)m(are.)275 -3928 y(Also,)45 b(for)d(eac)m(h)i(author's)f(protection)f(and)g(ours,)j -(w)m(e)e(w)m(an)m(t)h(to)f(mak)m(e)h(certain)e(that)h(ev)m(ery)m(one) -150 4037 y(understands)29 b(that)j(there)f(is)f(no)h(w)m(arran)m(t)m(y) -h(for)f(this)f(free)h(soft)m(w)m(are.)44 b(If)30 b(the)i(soft)m(w)m -(are)g(is)e(mo)s(di\014ed)f(b)m(y)150 4147 y(someone)i(else)e(and)g -(passed)h(on,)g(w)m(e)g(w)m(an)m(t)h(its)e(recipien)m(ts)g(to)h(kno)m -(w)g(that)g(what)g(they)g(ha)m(v)m(e)h(is)e(not)h(the)150 -4257 y(original,)e(so)h(that)g(an)m(y)h(problems)d(in)m(tro)s(duced)g -(b)m(y)i(others)g(will)d(not)j(re\015ect)h(on)f(the)g(original)e -(authors')150 4366 y(reputations.)275 4501 y(Finally)-8 -b(,)24 b(an)m(y)h(free)f(program)g(is)g(threatened)g(constan)m(tly)h(b) -m(y)g(soft)m(w)m(are)h(paten)m(ts.)39 b(W)-8 b(e)26 b(wish)c(to)j(a)m -(v)m(oid)150 4610 y(the)30 b(danger)g(that)h(redistributors)c(of)k(a)f -(free)h(program)f(will)d(individually)e(obtain)30 b(paten)m(t)h -(licenses,)e(in)150 4720 y(e\013ect)39 b(making)e(the)h(program)f -(proprietary)-8 b(.)62 b(T)-8 b(o)38 b(prev)m(en)m(t)g(this,)h(w)m(e)f -(ha)m(v)m(e)h(made)f(it)f(clear)g(that)i(an)m(y)150 4829 -y(paten)m(t)31 b(m)m(ust)g(b)s(e)e(licensed)g(for)h(ev)m(ery)m(one's)i -(free)f(use)f(or)g(not)h(licensed)e(at)i(all.)275 4964 -y(The)e(precise)h(terms)g(and)g(conditions)f(for)h(cop)m(ying,)h -(distribution)26 b(and)k(mo)s(di\014cation)f(follo)m(w.)p -eop -%%Page: 6 8 -6 7 bop 150 -116 a Fj(6)2779 b(GNU)31 b(Shogi)f(man)m(ual)150 -166 y Fk(TERMS)44 b(AND)h(CONDITIONS)g(F)l(OR)g(COPYING,)150 -299 y(DISTRIBUTION)f(AND)h(MODIFICA)-11 b(TION)199 515 -y Fj(0.)61 b(This)41 b(License)h(applies)e(to)k(an)m(y)f(program)f(or)g -(other)h(w)m(ork)g(whic)m(h)e(con)m(tains)i(a)g(notice)f(placed)330 -625 y(b)m(y)33 b(the)h(cop)m(yrigh)m(t)g(holder)e(sa)m(ying)i(it)f(ma)m -(y)h(b)s(e)f(distributed)e(under)h(the)h(terms)h(of)g(this)e(General) -330 735 y(Public)37 b(License.)67 b(The)39 b(\\Program",)j(b)s(elo)m -(w,)f(refers)e(to)h(an)m(y)g(suc)m(h)f(program)g(or)g(w)m(ork,)j(and)d -(a)330 844 y(\\w)m(ork)29 b(based)f(on)h(the)g(Program")g(means)f -(either)h(the)f(Program)h(or)g(an)m(y)g(deriv)-5 b(ativ)m(e)28 -b(w)m(ork)g(under)330 954 y(cop)m(yrigh)m(t)k(la)m(w:)42 -b(that)32 b(is)e(to)j(sa)m(y)-8 b(,)33 b(a)e(w)m(ork)h(con)m(taining)f -(the)g(Program)h(or)f(a)h(p)s(ortion)e(of)h(it,)g(either)330 -1063 y(v)m(erbatim)e(or)g(with)e(mo)s(di\014cations)g(and/or)i -(translated)g(in)m(to)g(another)g(language.)40 b(\(Hereinafter,)330 -1173 y(translation)26 b(is)g(included)f(without)h(limitation)f(in)h -(the)h(term)g(\\mo)s(di\014cation".\))40 b(Eac)m(h)27 -b(licensee)g(is)330 1282 y(addressed)i(as)i(\\y)m(ou".)330 -1429 y(Activities)38 b(other)h(than)f(cop)m(ying,)k(distribution)35 -b(and)j(mo)s(di\014cation)f(are)i(not)g(co)m(v)m(ered)h(b)m(y)f(this) -330 1538 y(License;)33 b(they)g(are)f(outside)g(its)f(scop)s(e.)47 -b(The)32 b(act)h(of)g(running)c(the)k(Program)f(is)f(not)i(restricted,) -330 1648 y(and)24 b(the)g(output)g(from)g(the)h(Program)f(is)g(co)m(v)m -(ered)i(only)d(if)g(its)h(con)m(ten)m(ts)i(constitute)f(a)g(w)m(ork)f -(based)330 1758 y(on)h(the)h(Program)f(\(indep)s(enden)m(t)f(of)i(ha)m -(ving)f(b)s(een)f(made)i(b)m(y)f(running)e(the)i(Program\).)40 -b(Whether)330 1867 y(that)31 b(is)e(true)i(dep)s(ends)d(on)i(what)h -(the)f(Program)h(do)s(es.)199 2014 y(1.)61 b(Y)-8 b(ou)42 -b(ma)m(y)g(cop)m(y)g(and)e(distribute)f(v)m(erbatim)i(copies)g(of)h -(the)f(Program's)h(source)f(co)s(de)h(as)g(y)m(ou)330 -2123 y(receiv)m(e)32 b(it,)f(in)f(an)m(y)h(medium,)f(pro)m(vided)g -(that)h(y)m(ou)h(conspicuously)d(and)h(appropriately)g(publish)330 -2233 y(on)j(eac)m(h)h(cop)m(y)g(an)f(appropriate)f(cop)m(yrigh)m(t)i -(notice)f(and)g(disclaimer)d(of)k(w)m(arran)m(t)m(y;)h(k)m(eep)f(in)m -(tact)330 2342 y(all)d(the)g(notices)h(that)h(refer)e(to)h(this)f -(License)g(and)g(to)i(the)f(absence)g(of)g(an)m(y)g(w)m(arran)m(t)m(y;) -h(and)e(giv)m(e)330 2452 y(an)m(y)g(other)f(recipien)m(ts)g(of)g(the)h -(Program)f(a)h(cop)m(y)g(of)g(this)e(License)h(along)g(with)f(the)i -(Program.)330 2598 y(Y)-8 b(ou)31 b(ma)m(y)g(c)m(harge)h(a)f(fee)g(for) -f(the)h(ph)m(ysical)e(act)j(of)f(transferring)e(a)i(cop)m(y)-8 -b(,)32 b(and)e(y)m(ou)h(ma)m(y)g(at)g(y)m(our)330 2708 -y(option)f(o\013er)h(w)m(arran)m(t)m(y)g(protection)g(in)e(exc)m(hange) -j(for)e(a)g(fee.)199 2854 y(2.)61 b(Y)-8 b(ou)24 b(ma)m(y)h(mo)s(dify)d -(y)m(our)i(cop)m(y)g(or)g(copies)g(of)g(the)g(Program)g(or)g(an)m(y)g -(p)s(ortion)e(of)i(it,)h(th)m(us)f(forming)f(a)330 2964 -y(w)m(ork)k(based)g(on)f(the)h(Program,)h(and)f(cop)m(y)g(and)g -(distribute)d(suc)m(h)j(mo)s(di\014cations)e(or)h(w)m(ork)h(under)330 -3074 y(the)k(terms)f(of)g(Section)h(1)f(ab)s(o)m(v)m(e,)i(pro)m(vided)d -(that)i(y)m(ou)g(also)f(meet)h(all)f(of)g(these)h(conditions:)379 -3220 y(a.)61 b(Y)-8 b(ou)43 b(m)m(ust)f(cause)i(the)e(mo)s(di\014ed)f -(\014les)g(to)i(carry)g(prominen)m(t)e(notices)i(stating)f(that)i(y)m -(ou)510 3330 y(c)m(hanged)31 b(the)g(\014les)e(and)h(the)g(date)h(of)g -(an)m(y)g(c)m(hange.)374 3476 y(b.)60 b(Y)-8 b(ou)31 -b(m)m(ust)g(cause)g(an)m(y)h(w)m(ork)f(that)g(y)m(ou)g(distribute)d(or) -j(publish,)d(that)j(in)f(whole)g(or)h(in)e(part)510 3586 -y(con)m(tains)35 b(or)h(is)e(deriv)m(ed)g(from)h(the)g(Program)g(or)g -(an)m(y)h(part)f(thereof,)i(to)f(b)s(e)e(licensed)g(as)i(a)510 -3695 y(whole)30 b(at)h(no)f(c)m(harge)i(to)f(all)e(third)f(parties)i -(under)f(the)i(terms)f(of)g(this)g(License.)384 3842 -y(c.)61 b(If)39 b(the)h(mo)s(di\014ed)e(program)h(normally)f(reads)i -(commands)f(in)m(teractiv)m(ely)h(when)f(run,)i(y)m(ou)510 -3951 y(m)m(ust)30 b(cause)h(it,)f(when)g(started)h(running)c(for)k(suc) -m(h)f(in)m(teractiv)m(e)h(use)f(in)f(the)i(most)g(ordinary)510 -4061 y(w)m(a)m(y)-8 b(,)25 b(to)d(prin)m(t)e(or)h(displa)m(y)f(an)h -(announcemen)m(t)g(including)d(an)k(appropriate)e(cop)m(yrigh)m(t)i -(notice)510 4170 y(and)i(a)g(notice)h(that)f(there)h(is)e(no)h(w)m -(arran)m(t)m(y)h(\(or)g(else,)g(sa)m(ying)f(that)h(y)m(ou)g(pro)m(vide) -e(a)i(w)m(arran)m(t)m(y\))510 4280 y(and)35 b(that)g(users)g(ma)m(y)g -(redistribute)e(the)j(program)f(under)e(these)j(conditions,)f(and)g -(telling)510 4390 y(the)f(user)f(ho)m(w)h(to)g(view)f(a)i(cop)m(y)f(of) -g(this)f(License.)50 b(\(Exception:)e(if)32 b(the)i(Program)g(itself)f -(is)510 4499 y(in)m(teractiv)m(e)i(but)e(do)s(es)h(not)g(normally)e -(prin)m(t)h(suc)m(h)g(an)h(announcemen)m(t,)h(y)m(our)f(w)m(ork)g -(based)510 4609 y(on)c(the)h(Program)f(is)g(not)g(required)f(to)i(prin) -m(t)e(an)h(announcemen)m(t.\))330 4792 y(These)41 b(requiremen)m(ts)g -(apply)f(to)i(the)g(mo)s(di\014ed)e(w)m(ork)h(as)h(a)g(whole.)73 -b(If)42 b(iden)m(ti\014able)d(sections)330 4902 y(of)j(that)h(w)m(ork)g -(are)f(not)h(deriv)m(ed)e(from)h(the)h(Program,)i(and)d(can)h(b)s(e)e -(reasonably)h(considered)330 5011 y(indep)s(enden)m(t)24 -b(and)j(separate)g(w)m(orks)g(in)e(themselv)m(es,)j(then)e(this)g -(License,)h(and)f(its)h(terms,)g(do)g(not)330 5121 y(apply)36 -b(to)i(those)f(sections)g(when)g(y)m(ou)g(distribute)e(them)i(as)g -(separate)h(w)m(orks.)61 b(But)37 b(when)g(y)m(ou)330 -5230 y(distribute)27 b(the)i(same)g(sections)h(as)f(part)g(of)g(a)h -(whole)e(whic)m(h)g(is)g(a)h(w)m(ork)h(based)e(on)h(the)h(Program,)330 -5340 y(the)h(distribution)d(of)j(the)h(whole)e(m)m(ust)h(b)s(e)g(on)g -(the)g(terms)g(of)h(this)e(License,)h(whose)g(p)s(ermissions)p -eop -%%Page: 7 9 -7 8 bop 150 -116 a Fj(GNU)31 b(GENERAL)f(PUBLIC)h(LICENSE)2052 -b(7)330 299 y(for)22 b(other)h(licensees)e(extend)i(to)g(the)f(en)m -(tire)g(whole,)i(and)d(th)m(us)h(to)h(eac)m(h)h(and)d(ev)m(ery)i(part)g -(regardless)330 408 y(of)31 b(who)e(wrote)i(it.)330 538 -y(Th)m(us,)48 b(it)d(is)f(not)i(the)f(in)m(ten)m(t)g(of)h(this)e -(section)h(to)h(claim)f(righ)m(ts)f(or)h(con)m(test)i(y)m(our)f(righ)m -(ts)e(to)330 648 y(w)m(ork)34 b(written)e(en)m(tirely)h(b)m(y)h(y)m -(ou;)h(rather,)g(the)f(in)m(ten)m(t)g(is)e(to)j(exercise)e(the)h(righ)m -(t)f(to)i(con)m(trol)f(the)330 757 y(distribution)27 -b(of)j(deriv)-5 b(ativ)m(e)30 b(or)h(collectiv)m(e)f(w)m(orks)h(based)f -(on)g(the)h(Program.)330 887 y(In)41 b(addition,)h(mere)f(aggregation)i -(of)f(another)f(w)m(ork)g(not)h(based)f(on)g(the)g(Program)h(with)e -(the)330 996 y(Program)22 b(\(or)g(with)e(a)i(w)m(ork)g(based)f(on)h -(the)g(Program\))g(on)f(a)h(v)m(olume)g(of)g(a)g(storage)h(or)f -(distribution)330 1106 y(medium)28 b(do)s(es)j(not)f(bring)f(the)h -(other)h(w)m(ork)f(under)f(the)i(scop)s(e)f(of)h(this)e(License.)199 -1235 y(3.)61 b(Y)-8 b(ou)38 b(ma)m(y)f(cop)m(y)h(and)f(distribute)d -(the)k(Program)f(\(or)g(a)h(w)m(ork)f(based)g(on)g(it,)i(under)c -(Section)i(2\))330 1345 y(in)29 b(ob)5 b(ject)31 b(co)s(de)g(or)g -(executable)g(form)f(under)e(the)j(terms)f(of)h(Sections)f(1)h(and)f(2) -h(ab)s(o)m(v)m(e)g(pro)m(vided)330 1455 y(that)g(y)m(ou)g(also)f(do)g -(one)h(of)f(the)h(follo)m(wing:)379 1584 y(a.)61 b(Accompan)m(y)47 -b(it)e(with)f(the)i(complete)g(corresp)s(onding)e(mac)m(hine-readable)h -(source)g(co)s(de,)510 1694 y(whic)m(h)25 b(m)m(ust)h(b)s(e)f -(distributed)e(under)h(the)j(terms)e(of)i(Sections)e(1)i(and)e(2)h(ab)s -(o)m(v)m(e)i(on)d(a)i(medium)510 1803 y(customarily)i(used)h(for)g -(soft)m(w)m(are)i(in)m(terc)m(hange;)f(or,)374 1933 y(b.)60 -b(Accompan)m(y)30 b(it)f(with)f(a)i(written)e(o\013er,)j(v)-5 -b(alid)27 b(for)i(at)i(least)e(three)h(y)m(ears,)g(to)g(giv)m(e)g(an)m -(y)g(third)510 2042 y(part)m(y)-8 b(,)32 b(for)f(a)h(c)m(harge)g(no)f -(more)h(than)f(y)m(our)g(cost)h(of)f(ph)m(ysically)f(p)s(erforming)f -(source)i(distri-)510 2152 y(bution,)c(a)h(complete)h(mac)m -(hine-readable)e(cop)m(y)h(of)g(the)g(corresp)s(onding)e(source)i(co)s -(de,)h(to)g(b)s(e)510 2262 y(distributed)i(under)i(the)h(terms)g(of)h -(Sections)f(1)g(and)g(2)h(ab)s(o)m(v)m(e)g(on)f(a)h(medium)d -(customarily)510 2371 y(used)e(for)g(soft)m(w)m(are)i(in)m(terc)m -(hange;)f(or,)384 2501 y(c.)61 b(Accompan)m(y)33 b(it)e(with)g(the)h -(information)e(y)m(ou)i(receiv)m(ed)g(as)g(to)g(the)g(o\013er)g(to)h -(distribute)c(cor-)510 2610 y(resp)s(onding)i(source)i(co)s(de.)50 -b(\(This)31 b(alternativ)m(e)j(is)e(allo)m(w)m(ed)h(only)g(for)g -(noncommercial)f(dis-)510 2720 y(tribution)e(and)h(only)g(if)g(y)m(ou)i -(receiv)m(ed)f(the)g(program)g(in)f(ob)5 b(ject)33 b(co)s(de)f(or)g -(executable)g(form)510 2829 y(with)d(suc)m(h)h(an)g(o\013er,)h(in)e -(accord)j(with)d(Subsection)g(b)h(ab)s(o)m(v)m(e.\))330 -2979 y(The)j(source)h(co)s(de)g(for)f(a)h(w)m(ork)g(means)f(the)h -(preferred)e(form)h(of)h(the)g(w)m(ork)f(for)h(making)f(mo)s(di\014-) -330 3088 y(cations)e(to)g(it.)40 b(F)-8 b(or)31 b(an)f(executable)h(w)m -(ork,)g(complete)f(source)h(co)s(de)f(means)h(all)e(the)h(source)h(co)s -(de)330 3198 y(for)25 b(all)g(mo)s(dules)f(it)h(con)m(tains,)i(plus)c -(an)m(y)j(asso)s(ciated)g(in)m(terface)h(de\014nition)c(\014les,)j -(plus)d(the)j(scripts)330 3308 y(used)41 b(to)i(con)m(trol)g -(compilation)d(and)i(installation)e(of)i(the)h(executable.)76 -b(Ho)m(w)m(ev)m(er,)48 b(as)42 b(a)g(sp)s(e-)330 3417 -y(cial)30 b(exception,)i(the)f(source)g(co)s(de)g(distributed)d(need)i -(not)h(include)e(an)m(ything)h(that)i(is)e(normally)330 -3527 y(distributed)37 b(\(in)h(either)h(source)h(or)f(binary)f(form\))i -(with)e(the)i(ma)5 b(jor)39 b(comp)s(onen)m(ts)h(\(compiler,)330 -3636 y(k)m(ernel,)35 b(and)f(so)g(on\))g(of)h(the)f(op)s(erating)g -(system)g(on)g(whic)m(h)f(the)h(executable)h(runs,)f(unless)e(that)330 -3746 y(comp)s(onen)m(t)f(itself)e(accompanies)i(the)f(executable.)330 -3875 y(If)39 b(distribution)c(of)40 b(executable)g(or)f(ob)5 -b(ject)40 b(co)s(de)f(is)g(made)g(b)m(y)g(o\013ering)g(access)h(to)g -(cop)m(y)g(from)330 3985 y(a)e(designated)f(place,)i(then)f(o\013ering) -f(equiv)-5 b(alen)m(t)37 b(access)h(to)h(cop)m(y)f(the)f(source)h(co)s -(de)g(from)f(the)330 4095 y(same)29 b(place)f(coun)m(ts)g(as)h -(distribution)24 b(of)k(the)h(source)f(co)s(de,)h(ev)m(en)g(though)e -(third)g(parties)g(are)i(not)330 4204 y(comp)s(elled)g(to)i(cop)m(y)g -(the)g(source)f(along)h(with)e(the)h(ob)5 b(ject)31 b(co)s(de.)199 -4334 y(4.)61 b(Y)-8 b(ou)35 b(ma)m(y)h(not)f(cop)m(y)-8 -b(,)37 b(mo)s(dify)-8 b(,)35 b(sublicense,)f(or)g(distribute)f(the)i -(Program)f(except)i(as)f(expressly)330 4443 y(pro)m(vided)k(under)g -(this)h(License.)70 b(An)m(y)41 b(attempt)h(otherwise)e(to)h(cop)m(y)-8 -b(,)45 b(mo)s(dify)-8 b(,)42 b(sublicense)c(or)330 4553 -y(distribute)24 b(the)j(Program)g(is)e(v)m(oid,)i(and)f(will)e -(automatically)j(terminate)f(y)m(our)h(righ)m(ts)f(under)f(this)330 -4663 y(License.)70 b(Ho)m(w)m(ev)m(er,)45 b(parties)40 -b(who)g(ha)m(v)m(e)h(receiv)m(ed)g(copies,)i(or)d(righ)m(ts,)j(from)d -(y)m(ou)g(under)f(this)330 4772 y(License)d(will)e(not)j(ha)m(v)m(e)h -(their)e(licenses)f(terminated)i(so)g(long)f(as)h(suc)m(h)f(parties)g -(remain)g(in)f(full)330 4882 y(compliance.)199 5011 y(5.)61 -b(Y)-8 b(ou)38 b(are)g(not)g(required)d(to)j(accept)h(this)e(License,)i -(since)e(y)m(ou)g(ha)m(v)m(e)i(not)f(signed)e(it.)62 -b(Ho)m(w)m(ev)m(er,)330 5121 y(nothing)23 b(else)g(gran)m(ts)i(y)m(ou)f -(p)s(ermission)c(to)25 b(mo)s(dify)d(or)h(distribute)f(the)i(Program)g -(or)f(its)g(deriv)-5 b(ativ)m(e)330 5230 y(w)m(orks.)38 -b(These)23 b(actions)g(are)h(prohibited)c(b)m(y)j(la)m(w)g(if)f(y)m(ou) -h(do)g(not)h(accept)g(this)e(License.)38 b(Therefore,)330 -5340 y(b)m(y)e(mo)s(difying)d(or)j(distributing)c(the)k(Program)g(\(or) -h(an)m(y)f(w)m(ork)g(based)g(on)f(the)i(Program\),)h(y)m(ou)p -eop -%%Page: 8 10 -8 9 bop 150 -116 a Fj(8)2779 b(GNU)31 b(Shogi)f(man)m(ual)330 -299 y(indicate)h(y)m(our)i(acceptance)h(of)f(this)e(License)h(to)i(do)e -(so,)h(and)f(all)f(its)h(terms)g(and)g(conditions)f(for)330 -408 y(cop)m(ying,)g(distributing)26 b(or)31 b(mo)s(difying)c(the)k -(Program)f(or)h(w)m(orks)f(based)g(on)g(it.)199 545 y(6.)61 -b(Eac)m(h)43 b(time)e(y)m(ou)h(redistribute)e(the)i(Program)g(\(or)g -(an)m(y)h(w)m(ork)f(based)f(on)h(the)g(Program\),)k(the)330 -655 y(recipien)m(t)31 b(automatically)i(receiv)m(es)g(a)g(license)e -(from)h(the)g(original)f(licensor)g(to)i(cop)m(y)-8 b(,)34 -b(distribute)330 765 y(or)i(mo)s(dify)f(the)h(Program)h(sub)5 -b(ject)36 b(to)h(these)g(terms)f(and)g(conditions.)57 -b(Y)-8 b(ou)37 b(ma)m(y)g(not)f(imp)s(ose)330 874 y(an)m(y)27 -b(further)f(restrictions)f(on)i(the)g(recipien)m(ts')f(exercise)h(of)g -(the)g(righ)m(ts)f(gran)m(ted)h(herein.)38 b(Y)-8 b(ou)28 -b(are)330 984 y(not)j(resp)s(onsible)c(for)j(enforcing)g(compliance)g -(b)m(y)g(third)e(parties)i(to)h(this)e(License.)199 1121 -y(7.)61 b(If,)27 b(as)g(a)g(consequence)h(of)f(a)g(court)g(judgmen)m(t) -f(or)h(allegation)f(of)h(paten)m(t)h(infringemen)m(t)c(or)j(for)g(an)m -(y)330 1230 y(other)h(reason)f(\(not)h(limited)d(to)j(paten)m(t)h -(issues\),)e(conditions)f(are)h(imp)s(osed)f(on)h(y)m(ou)h(\(whether)f -(b)m(y)330 1340 y(court)c(order,)h(agreemen)m(t)g(or)f(otherwise\))f -(that)h(con)m(tradict)h(the)e(conditions)f(of)i(this)f(License,)i(they) -330 1450 y(do)34 b(not)g(excuse)h(y)m(ou)f(from)g(the)g(conditions)f -(of)h(this)f(License.)52 b(If)33 b(y)m(ou)i(cannot)g(distribute)c(so)k -(as)330 1559 y(to)f(satisfy)f(sim)m(ultaneously)f(y)m(our)h -(obligations)g(under)f(this)g(License)h(and)g(an)m(y)h(other)g(p)s -(ertinen)m(t)330 1669 y(obligations,)41 b(then)f(as)g(a)g(consequence)h -(y)m(ou)f(ma)m(y)g(not)g(distribute)e(the)i(Program)g(at)g(all.)68 -b(F)-8 b(or)330 1778 y(example,)25 b(if)e(a)i(paten)m(t)g(license)e(w)m -(ould)g(not)h(p)s(ermit)f(ro)m(y)m(alt)m(y-free)j(redistribution)20 -b(of)k(the)h(Program)330 1888 y(b)m(y)35 b(all)f(those)h(who)f(receiv)m -(e)i(copies)f(directly)e(or)i(indirectly)e(through)h(y)m(ou,)i(then)f -(the)g(only)f(w)m(a)m(y)330 1998 y(y)m(ou)27 b(could)e(satisfy)h(b)s -(oth)f(it)h(and)g(this)f(License)h(w)m(ould)f(b)s(e)h(to)h(refrain)d -(en)m(tirely)i(from)g(distribution)330 2107 y(of)31 b(the)f(Program.) -330 2244 y(If)43 b(an)m(y)g(p)s(ortion)f(of)h(this)g(section)g(is)f -(held)g(in)m(v)-5 b(alid)41 b(or)i(unenforceable)f(under)g(an)m(y)i -(particular)330 2354 y(circumstance,)i(the)e(balance)f(of)g(the)h -(section)f(is)f(in)m(tended)g(to)i(apply)e(and)g(the)i(section)f(as)h -(a)330 2463 y(whole)30 b(is)f(in)m(tended)g(to)i(apply)e(in)g(other)i -(circumstances.)330 2600 y(It)41 b(is)e(not)i(the)f(purp)s(ose)f(of)i -(this)e(section)i(to)g(induce)e(y)m(ou)i(to)g(infringe)d(an)m(y)j -(paten)m(ts)g(or)g(other)330 2710 y(prop)s(ert)m(y)e(righ)m(t)h(claims) -e(or)i(to)h(con)m(test)h(v)-5 b(alidit)m(y)38 b(of)i(an)m(y)g(suc)m(h)g -(claims;)j(this)c(section)h(has)g(the)330 2819 y(sole)30 -b(purp)s(ose)e(of)j(protecting)f(the)g(in)m(tegrit)m(y)g(of)g(the)h -(free)f(soft)m(w)m(are)h(distribution)c(system,)j(whic)m(h)330 -2929 y(is)k(implemen)m(ted)g(b)m(y)h(public)d(license)i(practices.)55 -b(Man)m(y)36 b(p)s(eople)e(ha)m(v)m(e)i(made)f(generous)h(con)m(tri-) -330 3039 y(butions)e(to)i(the)f(wide)g(range)g(of)h(soft)m(w)m(are)h -(distributed)32 b(through)j(that)h(system)f(in)f(reliance)h(on)330 -3148 y(consisten)m(t)h(application)e(of)h(that)h(system;)i(it)d(is)g -(up)f(to)i(the)g(author/donor)f(to)h(decide)f(if)g(he)g(or)330 -3258 y(she)i(is)g(willing)d(to)k(distribute)d(soft)m(w)m(are)k(through) -e(an)m(y)g(other)h(system)g(and)f(a)g(licensee)g(cannot)330 -3367 y(imp)s(ose)29 b(that)i(c)m(hoice.)330 3504 y(This)25 -b(section)j(is)e(in)m(tended)g(to)i(mak)m(e)g(thoroughly)e(clear)h -(what)g(is)f(b)s(eliev)m(ed)g(to)i(b)s(e)f(a)g(consequence)330 -3614 y(of)k(the)f(rest)h(of)f(this)f(License.)199 3751 -y(8.)61 b(If)35 b(the)g(distribution)c(and/or)k(use)g(of)g(the)g -(Program)g(is)f(restricted)h(in)f(certain)h(coun)m(tries)f(either)330 -3861 y(b)m(y)h(paten)m(ts)h(or)g(b)m(y)f(cop)m(yrigh)m(ted)h(in)m -(terfaces,)h(the)e(original)f(cop)m(yrigh)m(t)i(holder)e(who)h(places)g -(the)330 3970 y(Program)h(under)f(this)g(License)h(ma)m(y)h(add)e(an)i -(explicit)d(geographical)j(distribution)32 b(limitation)330 -4080 y(excluding)27 b(those)i(coun)m(tries,)g(so)g(that)g(distribution) -c(is)i(p)s(ermitted)h(only)f(in)g(or)i(among)g(coun)m(tries)330 -4189 y(not)k(th)m(us)f(excluded.)47 b(In)32 b(suc)m(h)g(case,)j(this)c -(License)i(incorp)s(orates)f(the)h(limitation)d(as)j(if)f(written)330 -4299 y(in)d(the)i(b)s(o)s(dy)d(of)j(this)e(License.)199 -4436 y(9.)61 b(The)26 b(F)-8 b(ree)28 b(Soft)m(w)m(are)g(F)-8 -b(oundation)26 b(ma)m(y)i(publish)23 b(revised)i(and/or)i(new)f(v)m -(ersions)g(of)h(the)g(General)330 4545 y(Public)35 b(License)h(from)h -(time)g(to)g(time.)61 b(Suc)m(h)36 b(new)h(v)m(ersions)f(will)f(b)s(e)h -(similar)e(in)i(spirit)f(to)j(the)330 4655 y(presen)m(t)30 -b(v)m(ersion,)h(but)e(ma)m(y)i(di\013er)e(in)g(detail)h(to)h(address)e -(new)h(problems)f(or)h(concerns.)330 4792 y(Eac)m(h)46 -b(v)m(ersion)e(is)g(giv)m(en)h(a)g(distinguishing)40 -b(v)m(ersion)45 b(n)m(um)m(b)s(er.)83 b(If)44 b(the)h(Program)g(sp)s -(eci\014es)f(a)330 4902 y(v)m(ersion)35 b(n)m(um)m(b)s(er)g(of)h(this)e -(License)i(whic)m(h)e(applies)g(to)j(it)e(and)g(\\an)m(y)i(later)e(v)m -(ersion",)j(y)m(ou)e(ha)m(v)m(e)330 5011 y(the)d(option)f(of)h(follo)m -(wing)e(the)i(terms)g(and)f(conditions)f(either)i(of)g(that)g(v)m -(ersion)f(or)h(of)g(an)m(y)g(later)330 5121 y(v)m(ersion)d(published)c -(b)m(y)k(the)g(F)-8 b(ree)31 b(Soft)m(w)m(are)g(F)-8 -b(oundation.)41 b(If)29 b(the)i(Program)f(do)s(es)g(not)g(sp)s(ecify)f -(a)330 5230 y(v)m(ersion)e(n)m(um)m(b)s(er)g(of)h(this)e(License,)i(y)m -(ou)g(ma)m(y)h(c)m(ho)s(ose)f(an)m(y)h(v)m(ersion)e(ev)m(er)h -(published)c(b)m(y)k(the)g(F)-8 b(ree)330 5340 y(Soft)m(w)m(are)31 -b(F)-8 b(oundation.)p eop -%%Page: 9 11 -9 10 bop 150 -116 a Fj(GNU)31 b(GENERAL)f(PUBLIC)h(LICENSE)2052 -b(9)154 299 y(10.)61 b(If)29 b(y)m(ou)g(wish)f(to)i(incorp)s(orate)f -(parts)g(of)g(the)g(Program)h(in)m(to)f(other)h(free)f(programs)g -(whose)g(distri-)330 408 y(bution)e(conditions)g(are)j(di\013eren)m(t,) -e(write)g(to)i(the)f(author)f(to)i(ask)e(for)h(p)s(ermission.)37 -b(F)-8 b(or)29 b(soft)m(w)m(are)330 518 y(whic)m(h)23 -b(is)g(cop)m(yrigh)m(ted)h(b)m(y)g(the)g(F)-8 b(ree)25 -b(Soft)m(w)m(are)g(F)-8 b(oundation,)25 b(write)e(to)i(the)f(F)-8 -b(ree)25 b(Soft)m(w)m(are)g(F)-8 b(oun-)330 628 y(dation;)28 -b(w)m(e)g(sometimes)g(mak)m(e)g(exceptions)g(for)f(this.)39 -b(Our)26 b(decision)g(will)f(b)s(e)h(guided)h(b)m(y)g(the)h(t)m(w)m(o) -330 737 y(goals)23 b(of)g(preserving)e(the)h(free)h(status)g(of)f(all)g -(deriv)-5 b(ativ)m(es)22 b(of)g(our)g(free)h(soft)m(w)m(are)h(and)e(of) -h(promoting)330 847 y(the)31 b(sharing)e(and)g(reuse)h(of)h(soft)m(w)m -(are)h(generally)-8 b(.)p eop -%%Page: 10 12 -10 11 bop 150 -116 a Fj(10)2734 b(GNU)31 b(Shogi)f(man)m(ual)330 -299 y Fk(NO)45 b(W)-15 b(ARRANTY)154 491 y Fj(11.)61 -b(BECA)m(USE)40 b(THE)f(PR)m(OGRAM)i(IS)e(LICENSED)g(FREE)g(OF)h(CHAR)m -(GE,)h(THERE)e(IS)g(NO)330 601 y(W)-10 b(ARRANTY)26 b(F)m(OR)f(THE)g -(PR)m(OGRAM,)h(TO)e(THE)h(EXTENT)f(PERMITTED)h(BY)g(APPLI-)330 -711 y(CABLE)i(LA)-10 b(W.)27 b(EX)m(CEPT)g(WHEN)h(OTHER)-10 -b(WISE)25 b(ST)-8 b(A)g(TED)28 b(IN)e(WRITING)i(THE)e(COPY-)330 -820 y(RIGHT)35 b(HOLDERS)g(AND/OR)h(OTHER)f(P)-8 b(AR)g(TIES)35 -b(PR)m(O)m(VIDE)h(THE)f(PR)m(OGRAM)h(\\AS)330 930 y(IS")22 -b(WITHOUT)f(W)-10 b(ARRANTY)23 b(OF)f(ANY)g(KIND,)h(EITHER)e(EXPRESSED) -g(OR)h(IMPLIED,)330 1039 y(INCLUDING,)33 b(BUT)g(NOT)g(LIMITED)f(TO,)g -(THE)h(IMPLIED)g(W)-10 b(ARRANTIES)32 b(OF)h(MER-)330 -1149 y(CHANT)-8 b(ABILITY)28 b(AND)g(FITNESS)e(F)m(OR)i(A)g(P)-8 -b(AR)g(TICULAR)27 b(PURPOSE.)g(THE)g(ENTIRE)330 1259 -y(RISK)19 b(AS)h(TO)g(THE)g(QUALITY)g(AND)h(PERF)m(ORMANCE)g(OF)f(THE)g -(PR)m(OGRAM)h(IS)f(WITH)330 1368 y(YOU.)h(SHOULD)g(THE)f(PR)m(OGRAM)i -(PR)m(O)m(VE)f(DEFECTIVE,)g(YOU)g(ASSUME)f(THE)g(COST)330 -1478 y(OF)30 b(ALL)g(NECESSAR)-8 b(Y)30 b(SER)-10 b(VICING,)30 -b(REP)-8 b(AIR)30 b(OR)g(CORRECTION.)154 1612 y(12.)61 -b(IN)26 b(NO)g(EVENT)g(UNLESS)f(REQUIRED)h(BY)h(APPLICABLE)f(LA)-10 -b(W)26 b(OR)g(A)m(GREED)h(TO)f(IN)330 1722 y(WRITING)37 -b(WILL)f(ANY)i(COPYRIGHT)e(HOLDER,)h(OR)f(ANY)h(OTHER)f(P)-8 -b(AR)g(TY)38 b(WHO)330 1831 y(MA)-8 b(Y)52 b(MODIFY)g(AND/OR)g -(REDISTRIBUTE)e(THE)h(PR)m(OGRAM)h(AS)f(PERMITTED)330 -1941 y(ABO)m(VE,)40 b(BE)f(LIABLE)f(TO)g(YOU)h(F)m(OR)g(D)m(AMA)m(GES,) -h(INCLUDING)f(ANY)h(GENERAL,)330 2051 y(SPECIAL,)e(INCIDENT)-8 -b(AL)40 b(OR)e(CONSEQUENTIAL)g(D)m(AMA)m(GES)j(ARISING)e(OUT)g(OF)330 -2160 y(THE)44 b(USE)g(OR)g(INABILITY)h(TO)f(USE)g(THE)g(PR)m(OGRAM)h -(\(INCLUDING)h(BUT)e(NOT)330 2270 y(LIMITED)29 b(TO)g(LOSS)f(OF)h(D)m -(A)-8 b(T)g(A)31 b(OR)e(D)m(A)-8 b(T)g(A)31 b(BEING)f(RENDERED)g(INA)m -(CCURA)-8 b(TE)29 b(OR)330 2379 y(LOSSES)38 b(SUST)-8 -b(AINED)40 b(BY)h(YOU)f(OR)g(THIRD)g(P)-8 b(AR)g(TIES)40 -b(OR)g(A)h(F)-10 b(AILURE)40 b(OF)g(THE)330 2489 y(PR)m(OGRAM)f(TO)f -(OPERA)-8 b(TE)38 b(WITH)h(ANY)g(OTHER)f(PR)m(OGRAMS\),)h(EVEN)g(IF)f -(SUCH)330 2599 y(HOLDER)33 b(OR)h(OTHER)f(P)-8 b(AR)g(TY)34 -b(HAS)f(BEEN)h(AD)m(VISED)g(OF)g(THE)f(POSSIBILITY)f(OF)330 -2708 y(SUCH)e(D)m(AMA)m(GES.)150 2966 y Fk(END)45 b(OF)g(TERMS)f(AND)h -(CONDITIONS)p eop -%%Page: 11 13 -11 12 bop 150 -116 a Fj(GNU)31 b(GENERAL)f(PUBLIC)h(LICENSE)2006 -b(11)150 299 y Fk(Ho)l(w)46 b(to)f(Apply)f(These)h(T)-11 -b(erms)45 b(to)g(Y)-11 b(our)44 b(New)i(Programs)275 -498 y Fj(If)38 b(y)m(ou)i(dev)m(elop)f(a)g(new)g(program,)j(and)c(y)m -(ou)i(w)m(an)m(t)g(it)e(to)i(b)s(e)f(of)g(the)h(greatest)h(p)s(ossible) -36 b(use)j(to)150 607 y(the)i(public,)g(the)h(b)s(est)e(w)m(a)m(y)i(to) -g(ac)m(hiev)m(e)g(this)e(is)g(to)i(mak)m(e)g(it)f(free)g(soft)m(w)m -(are)h(whic)m(h)e(ev)m(ery)m(one)j(can)150 717 y(redistribute)28 -b(and)i(c)m(hange)h(under)e(these)i(terms.)275 858 y(T)-8 -b(o)29 b(do)h(so,)g(attac)m(h)h(the)f(follo)m(wing)e(notices)h(to)i -(the)e(program.)40 b(It)30 b(is)f(safest)h(to)g(attac)m(h)h(them)f(to)g -(the)150 967 y(start)j(of)g(eac)m(h)h(source)e(\014le)g(to)h(most)g -(e\013ectiv)m(ely)h(con)m(v)m(ey)g(the)e(exclusion)g(of)g(w)m(arran)m -(t)m(y;)j(and)d(eac)m(h)i(\014le)150 1077 y(should)28 -b(ha)m(v)m(e)k(at)f(least)g(the)f(\\cop)m(yrigh)m(t")i(line)d(and)g(a)i -(p)s(oin)m(ter)f(to)h(where)f(the)g(full)e(notice)j(is)e(found.)390 -1212 y Ff(one)i(line)d(to)j(giv)m(e)g(the)g(program's)f(name)h(and)e(a) -i(brief)e(idea)h(of)g(what)h(it)f(do)s(es.)390 1316 y -Fg(Copyright)45 b(\(C\))i(19)p Ff(yy)103 b(name)30 b(of)h(author)390 -1523 y Fg(This)47 b(program)e(is)j(free)e(software;)g(you)g(can)h -(redistribute)e(it)i(and/or)f(modify)390 1627 y(it)h(under)g(the)f -(terms)h(of)g(the)g(GNU)g(General)f(Public)g(License)g(as)h(published)e -(by)390 1731 y(the)i(Free)g(Software)e(Foundation;)g(either)h(version)g -(2)h(of)g(the)g(License,)f(or)390 1835 y(\(at)h(your)g(option\))e(any)i -(later)g(version.)390 2042 y(This)g(program)e(is)j(distributed)c(in)k -(the)e(hope)h(that)g(it)g(will)g(be)g(useful,)390 2146 -y(but)g(WITHOUT)f(ANY)h(WARRANTY;)e(without)h(even)g(the)h(implied)f -(warranty)g(of)390 2250 y(MERCHANTABILITY)e(or)j(FITNESS)f(FOR)h(A)g -(PARTICULAR)e(PURPOSE.)93 b(See)47 b(the)390 2354 y(GNU)g(General)f -(Public)g(License)g(for)h(more)f(details.)390 2561 y(You)h(should)f -(have)h(received)e(a)j(copy)e(of)h(the)g(GNU)g(General)f(Public)g -(License)390 2665 y(along)g(with)h(this)g(program;)e(if)i(not,)g(write) -f(to)i(the)e(Free)h(Software)390 2769 y(Foundation,)e(Inc.,)h(675)h -(Mass)g(Ave,)f(Cambridge,)f(MA)i(02139,)g(USA.)275 2909 -y Fj(Also)30 b(add)f(information)g(on)h(ho)m(w)h(to)g(con)m(tact)i(y)m -(ou)d(b)m(y)g(electronic)h(and)f(pap)s(er)f(mail.)275 -3050 y(If)f(the)g(program)h(is)e(in)m(teractiv)m(e,)j(mak)m(e)g(it)e -(output)g(a)h(short)f(notice)h(lik)m(e)f(this)f(when)h(it)g(starts)h -(in)e(an)150 3160 y(in)m(teractiv)m(e)k(mo)s(de:)390 -3295 y Fg(Gnomovision)45 b(version)h(69,)g(Copyright)g(\(C\))h(19)p -Ff(yy)55 b(name)30 b(of)g(author)390 3399 y Fg(Gnomovision)45 -b(comes)h(with)h(ABSOLUTELY)e(NO)i(WARRANTY;)e(for)i(details)390 -3502 y(type)g(`show)f(w'.)390 3606 y(This)h(is)g(free)f(software,)g -(and)h(you)g(are)f(welcome)g(to)h(redistribute)e(it)390 -3710 y(under)h(certain)g(conditions;)f(type)i(`show)f(c')h(for)g -(details.)275 3851 y Fj(The)27 b(h)m(yp)s(othetical)g(commands)h(`)p -Fg(show)h(w)p Fj(')f(and)f(`)p Fg(show)j(c)p Fj(')d(should)f(sho)m(w)i -(the)g(appropriate)f(parts)h(of)150 3960 y(the)38 b(General)g(Public)d -(License.)63 b(Of)37 b(course,)j(the)f(commands)e(y)m(ou)h(use)g(ma)m -(y)g(b)s(e)f(called)g(something)150 4070 y(other)25 b(than)f(`)p -Fg(show)29 b(w)p Fj(')c(and)f(`)p Fg(show)29 b(c)p Fj(';)e(they)d -(could)g(ev)m(en)h(b)s(e)f(mouse-clic)m(ks)g(or)h(men)m(u)f -(items|whatev)m(er)150 4179 y(suits)29 b(y)m(our)h(program.)275 -4320 y(Y)-8 b(ou)28 b(should)e(also)i(get)h(y)m(our)f(emplo)m(y)m(er)g -(\(if)f(y)m(ou)h(w)m(ork)g(as)h(a)f(programmer\))g(or)g(y)m(our)f(sc)m -(ho)s(ol,)i(if)e(an)m(y)-8 b(,)150 4430 y(to)34 b(sign)f(a)g(\\cop)m -(yrigh)m(t)i(disclaimer")c(for)j(the)f(program,)h(if)f(necessary)-8 -b(.)51 b(Here)34 b(is)e(a)i(sample;)g(alter)g(the)150 -4539 y(names:)390 4674 y Fg(Yoyodyne,)45 b(Inc.,)i(hereby)f(disclaims)f -(all)i(copyright)e(interest)h(in)h(the)g(program)390 -4778 y(`Gnomovision')d(\(which)i(makes)h(passes)f(at)h(compilers\))e -(written)h(by)h(James)f(Hacker.)390 4986 y Ff(signature)30 -b(of)g(T)m(y)h(Co)s(on)p Fg(,)47 b(1)g(April)g(1989)390 -5090 y(Ty)g(Coon,)g(President)e(of)i(Vice)275 5230 y -Fj(This)19 b(General)h(Public)f(License)h(do)s(es)h(not)g(p)s(ermit)e -(incorp)s(orating)g(y)m(our)i(program)f(in)m(to)h(proprietary)150 -5340 y(programs.)38 b(If)22 b(y)m(our)h(program)f(is)g(a)h(subroutine)e -(library)-8 b(,)23 b(y)m(ou)g(ma)m(y)g(consider)f(it)g(more)h(useful)e -(to)j(p)s(ermit)p eop -%%Page: 12 14 -12 13 bop 150 -116 a Fj(12)2734 b(GNU)31 b(Shogi)f(man)m(ual)150 -299 y(linking)j(proprietary)i(applications)g(with)g(the)h(library)-8 -b(.)57 b(If)35 b(this)h(is)f(what)h(y)m(ou)h(w)m(an)m(t)g(to)g(do,)h -(use)e(the)150 408 y(GNU)31 b(Library)e(General)h(Public)e(License)i -(instead)f(of)i(this)e(License.)p eop -%%Page: 13 15 -13 14 bop 150 -116 a Fj(Chapter)30 b(2:)41 b(Ab)s(out)30 -b(the)g(game)i(of)e(shogi)2061 b(13)150 299 y Fh(2)80 -b(Ab)t(out)53 b(the)g(game)g(of)h(shogi)390 518 y Fj(\\Japanese)34 -b(c)m(hess)h(cedes)f(nothing)e(in)h(depth)g(or)g(b)s(eaut)m(y)h(to)h -(the)f(Europ)s(ean)e(game...)52 b(it)390 622 y(is)29 -b(at)j(least)e(as)h(in)m(teresting.")390 749 y(|)f(Alexander)g -(Alekhine)390 853 y(\(quoted)h(in)e(Da)m(vid)h(Pritc)m(hard,)g -Ff(The)g(Encyclop)s(edia)f(of)h(Chess)g(V)-8 b(arian)m(ts)t -Fj(\))390 1084 y(\\...)69 b(shogi)39 b([is])g(b)m(y)h(far)f(the)h(most) -f(complex)h(form)f(of)g(c)m(hess)h(that)h(has)e(ev)m(er)h(ac)m(hiev)m -(ed)390 1187 y(widespread)28 b(p)s(opularit)m(y)-8 b(.")390 -1314 y(|)30 b(R.)h(W)-8 b(a)m(yne)32 b(Sc)m(hmittb)s(erger,)d -Ff(New)i(Rules)e(for)h(Classic)f(Games)275 1557 y Fj(Shogi)22 -b(is)f(the)j(v)m(ersion)e(of)h(c)m(hess)g(pla)m(y)m(ed)g(in)f(Japan.)37 -b(It)23 b(is)f(strikingly)f(di\013eren)m(t)h(from)g(standard)g(c)m -(hess)150 1666 y(\(whic)m(h)37 b(I)h(shall)e(refer)i(to)g(henceforth)g -(as)g(\\in)m(ternational)f(c)m(hess"\))j(and)d(also)h(to)h(all)d(other) -j(regional)150 1776 y(v)-5 b(arian)m(ts,)37 b(b)s(ecause)f(captured)f -(pieces)h(can)g(re-en)m(ter)h(pla)m(y)e(on)h(the)g(side)f(of)h(the)f -(capturer.)57 b(This)34 b(has)150 1886 y(sev)m(eral)d(in)m(teresting)e -(e\013ects)j(on)e(the)h(pla)m(y)f(of)h(the)f(game:)199 -2105 y(1.)61 b(Shogi)30 b(is)g(m)m(uc)m(h)h(more)h(complex)e(than)h(in) -m(ternational)f(c)m(hess,)i(at)g(least)f(in)f(terms)h(of)g(the)g(a)m(v) -m(erage)330 2214 y(n)m(um)m(b)s(er)i(of)i(p)s(ossible)c(mo)m(v)m(es)36 -b(p)s(er)e(turn)f(\(estimated)i(at)g(ab)s(out)f(35)h(for)f(c)m(hess)h -(and)f(at)h(ab)s(out)f(80)330 2324 y(for)c(shogi\).)199 -2457 y(2.)61 b(There)30 b(are)h(almost)f(no)g(dra)m(ws)g(\(ab)s(out)h -(1-2\045)g(of)f(all)g(games)h(in)e(professional)g(pla)m(y\).)199 -2589 y(3.)61 b(Exc)m(hanges)31 b(complicate)g(the)f(pla)m(y)g(rather)h -(than)f(simplifying)c(it.)199 2722 y(4.)61 b(There)23 -b(are)g(no)h(\\endgames")g(in)e(the)h(standard)g(c)m(hess)g(sense;)j -(all)c(pieces)h(remain)g(in)e(pla)m(y)i(through-)330 -2832 y(out)h(the)g(game.)40 b(Games)25 b(t)m(ypically)d(end)i(in)e(a)j -(race)f(to)h(c)m(hec)m(kmate)h(the)f(other)f(pla)m(y)m(er)g(b)s(efore)f -(b)s(eing)330 2941 y(c)m(hec)m(kmated)32 b(oneself.)199 -3074 y(5.)61 b(Ownership)38 b(of)j(a)h(piece)f(is)f(not)i(indicated)d -(b)m(y)i(the)h(color)f(of)g(the)h(piece;)k(instead,)e(pieces)d(are)330 -3184 y(w)m(edge-shap)s(ed)32 b(and)g(p)s(oin)m(t)f(to)m(w)m(ards)i(the) -g(opp)s(onen)m(t.)46 b(The)31 b(name)i(of)f(the)h(piece)f(is)f(inscrib) -s(ed)e(in)330 3293 y(Kanji)g(c)m(haracters)j(on)e(the)h(fron)m(t)f(of)h -(the)f(piece.)199 3426 y(6.)61 b(Most)31 b(imp)s(ortan)m(tly:)39 -b(it's)30 b(more)h(fun)e(than)h(other)h(forms)f(of)g(c)m(hess)h(:-\)) -275 3691 y(Shogi)26 b(is)g(extremely)h(p)s(opular)e(in)h(Japan;)i(it)e -(has)h(b)s(een)g(estimated)g(that)h(20)g(million)23 b(Japanese)28 -b(can)150 3801 y(pla)m(y)d(shogi,)i(of)f(whic)m(h)e(p)s(erhaps)g(1)i -(million)d(are)j(activ)m(e)h(pla)m(y)m(ers.)39 b(It)26 -b(is)e(ev)m(en)j(more)f(p)s(opular)d(there)j(than)150 -3911 y(the)39 b(game)h(of)f(go,)j(Japan's)d(other)g(fa)m(v)m(orite)h(b) -s(oard)e(game.)67 b(There)38 b(are)i(a)f(n)m(um)m(b)s(er)f(of)h -(professional)150 4020 y(pla)m(y)m(ers)33 b(who)f(mak)m(e)i(a)g -(considerable)d(amoun)m(t)j(of)f(money)g(pla)m(ying)e(in)h(shogi)g -(tournamen)m(ts,)i(and)f(the)150 4130 y(game)h(receiv)m(es)g(extensiv)m -(e)f(newpap)s(er)f(and)g(television)g(co)m(v)m(erage.)51 -b(Despite)33 b(this,)g(the)g(game)h(has)f(y)m(et)150 -4239 y(to)k(b)s(ecome)g(p)s(opular)c(outside)j(of)g(Japan.)58 -b(P)m(art)37 b(of)f(this)f(is)h(b)s(ecause)g(the)g(Kanji)f(c)m -(haracters)j(on)e(the)150 4349 y(pieces)27 b(scare)h(a)m(w)m(a)m(y)h -(some)e(p)s(eople,)g(but)g(mostly)g(it's)f(due,)i(I)f(think,)f(to)i -(lac)m(k)g(of)f(exp)s(osure)g(to)h(the)f(game)150 4459 -y(and)h(to)h(the)g(di\016cult)m(y)e(of)i(\014nding)d(opp)s(onen)m(ts.) -39 b(I)29 b(hop)s(e)f(that)h(GNU)g(shogi)f(will)e(help)h(in)m(tro)s -(duce)g(shogi)150 4568 y(to)k(a)g(wider)e(audience.)150 -4820 y Fk(2.1)68 b(The)45 b(rules)g(of)g(shogi)275 5011 -y Fj(Shogi)28 b(is)g(a)h(t)m(w)m(o-p)s(erson)h(abstract)g(strategy)g(b) -s(oard)f(game)h(with)d(full)g(information)h(\(i.e.)40 -b(all)28 b(pieces)150 5121 y(and)c(mo)m(v)m(es)j(are)e(visible)e(to)i -(b)s(oth)g(pla)m(y)m(ers)g(at)g(all)f(times\).)39 b(It)25 -b(is)f(in)g(the)h(c)m(hess)h(family)-8 b(,)25 b(b)s(eing)f(descended) -150 5230 y(from)29 b(the)g(same)h(ancestral)g(game)g(as)g(in)m -(ternational)e(c)m(hess:)40 b(the)30 b(Indian)d(game)k(of)e -(Chaturanga.)40 b(The)150 5340 y(t)m(w)m(o)j(pla)m(y)m(ers)e(are)h -(referred)f(to)h(as)f(\\Blac)m(k")j(and)d(\\White",)k(with)40 -b(Blac)m(k)i(mo)m(ving)f(\014rst)g(\(unlik)m(e)f(in)p -eop -%%Page: 14 16 -14 15 bop 150 -116 a Fj(14)2734 b(GNU)31 b(Shogi)f(man)m(ual)150 -299 y(in)m(ternational)e(c)m(hess,)i(where)f(White)g(mo)m(v)m(es)i -(\014rst\),)e(and)g(with)f(mo)m(v)m(emen)m(t)j(alternating)e(b)s(et)m -(w)m(een)h(the)150 408 y(t)m(w)m(o)38 b(pla)m(y)m(ers.)61 -b(Note)38 b(that)f(\\Blac)m(k")i(and)e(\\White")g(are)h(just)e(names;)k -(the)d(pieces)g(are)g(not)h(colored.)150 518 y(Instead,)27 -b(they)f(are)g(\015at,)i(w)m(edge-shap)s(ed)d(pieces)h(whic)m(h)f(p)s -(oin)m(t)f(to)m(w)m(ards)j(the)f(opp)s(onen)m(t.)39 b(The)25 -b(iden)m(tit)m(y)150 628 y(of)32 b(a)g(giv)m(en)g(piece)f(is)g -(indicated)f(b)m(y)i(t)m(w)m(o)h(Japanese)e(Kanji)g(c)m(haracters)i(on) -e(eac)m(h)i(piece.)45 b(In)31 b(fact,)i(only)150 737 -y(the)d(top)h(c)m(haracter)h(is)d(needed)h(to)h(iden)m(tify)e(the)h -(piece)h(and)e(th)m(us)h(only)g(the)g(top)h(c)m(haracter)g(is)f(used)f -(in)150 847 y(shogi)35 b(diagrams.)55 b(I)35 b(will)e(use)i(alphab)s -(etical)f(equiv)-5 b(alen)m(ts)35 b(in)f(the)h(diagrams)g(here;)j(to)e -(see)g(what)g(the)150 956 y(Kanji)d(c)m(haracters)i(lo)s(ok)e(lik)m(e,) -i(start)f(up)f(xshogi)g(\(see)i(Chapter)e(4)i([xshogi],)f(page)h(33\))g -(and)e(compare)150 1066 y(the)e(starting)g(setup)g(there)h(with)e(the)h -(starting)g(setup)g(in)f(this)g(\014le)g(\(see)i(Section)f(2.1.2)i -([The)e(op)s(ening)150 1176 y(setup],)f(page)i(15\).)275 -1304 y(The)h(ob)5 b(ject)35 b(of)f(the)g(game)h(is)e(to)h(capture)g -(the)g(opp)s(onen)m(t's)g(King.)50 b(The)33 b(b)s(oard)g(is)g(a)h(grid) -f(of)h(9x9)150 1414 y(uncolored)26 b(squares,)i(and)f(pieces)g(are)h -(placed)e(on)i(the)f(squares.)40 b(Eac)m(h)28 b(pla)m(y)m(er)f(b)s -(egins)f(with)g(20)i(pieces,)150 1524 y(describ)s(ed)g(in)h(the)i(next) -f(section.)41 b(Capture)30 b(is)g(b)m(y)g(displacemen)m(t,)f(as)i(in)e -(in)m(ternational)g(c)m(hess.)150 1731 y Fe(2.1.1)63 -b(The)41 b(mo)m(v)m(es)f(of)h(the)g(pieces)275 1918 y -Fj(Eac)m(h)33 b(pla)m(y)m(er)g(at)h(the)f(b)s(eginning)e(of)i(a)g -(shogi)g(game)h(has)f(a)g(total)h(of)f(20)h(pieces)f(of)g(eigh)m(t)g -(di\013eren)m(t)150 2027 y(t)m(yp)s(es.)49 b(The)32 b(mo)m(v)m(es)i(of) -g(the)f(shogi)f(pieces)h(can)g(b)s(e)g(divided)d(in)m(to)j(three)g -(classes:)46 b(\\stepping")33 b(pieces,)150 2137 y(that)21 -b(only)f(mo)m(v)m(e)i(one)e(square)h(at)g(a)g(time;)j(\\ranging")c -(pieces)g(that)h(mo)m(v)m(e)h(an)m(y)f(n)m(um)m(b)s(er)e(of)i -(unobstructed)150 2246 y(squares)26 b(in)f(a)h(line,)g(and)f -(\\jumping")g(pieces)h(that)g(can)h(jump)d(o)m(v)m(er)k(obstructing)d -(pieces)h(to)h(reac)m(h)g(their)150 2356 y(destination)39 -b(squares.)71 b(Most)42 b(pieces)e(can)h(also)f(promote)h(to)g -(di\013eren)m(t)f(\(usually)f(stronger\))i(pieces)150 -2466 y(under)33 b(certain)i(circumstances)f(\(see)h(the)g(next)g -(section\).)54 b(All)33 b(pieces)h(capture)h(the)g(same)g(w)m(a)m(y)g -(that)150 2575 y(they)c(mo)m(v)m(e)h(\(ev)m(en)f(pa)m(wns\).)42 -b(The)30 b(piece)g(mo)m(v)m(es)i(and)e(promotions)g(are)h(as)g(follo)m -(ws;)f(eac)m(h)h(piece)g(name)150 2685 y(is)e(follo)m(w)m(ed)h(b)m(y)h -(the)f(standard)g(piece)g(abbreviation:)199 2814 y(1.)61 -b(The)35 b(king)f(\(K\).)i(The)f(king)g(can)g(mo)m(v)m(e)i(one)f -(square)f(in)f(an)m(y)i(horizon)m(tal,)g(v)m(ertical,)h(or)f(diagonal) -330 2923 y(direction,)29 b(just)h(lik)m(e)g(the)g(king)g(in)f(in)m -(ternational)g(c)m(hess.)41 b(The)30 b(king)g(do)s(es)g(not)g(promote.) -199 3052 y(2.)61 b(The)36 b(ro)s(ok)h(\(R\).)g(The)g(ro)s(ok)f(can)h -(mo)m(v)m(e)i(an)m(y)e(n)m(um)m(b)s(er)e(of)i(squares)f(in)g(a)h -(horizon)m(tal)f(or)h(v)m(ertical)330 3162 y(direction.)78 -b(The)43 b(ro)s(ok)g(is)g(the)g(same)h(as)f(the)h(ro)s(ok)f(in)f(in)m -(ternational)g(c)m(hess)i(\(except)g(that)g(it)330 3271 -y(can)34 b(promote\).)51 b(A)33 b(ro)s(ok)h(promotes)g(to)g(a)g -(\\dragon)g(king")f(or)g(\\dragon")i(for)e(short)g(\(often)i(just)330 -3381 y(referred)c(to)i(as)f(a)g(\\promoted)h(ro)s(ok"\),)g(whic)m(h)e -(can)h(mo)m(v)m(e)h(as)f(a)h(ro)s(ok)e(or)h(can)h(mo)m(v)m(e)g(one)f -(square)330 3490 y(in)d(an)m(y)i(diagonal)e(direction.)199 -3619 y(3.)61 b(The)32 b(bishop)e(\(B\).)k(The)e(bishop)f(can)i(mo)m(v)m -(e)g(an)m(y)g(n)m(um)m(b)s(er)e(of)i(squares)f(in)f(a)i(diagonal)f -(direction.)330 3729 y(The)21 b(bishop)f(is)h(the)h(same)h(as)f(the)g -(bishop)e(in)g(in)m(ternational)h(c)m(hess)h(\(except)i(that)e(it)g -(can)g(promote\).)330 3838 y(A)33 b(bishop)d(promotes)j(to)g(a)g -(\\dragon)g(horse")g(or)g(\\horse")g(for)f(short)g(\(often)i(just)e -(referred)f(to)j(as)330 3948 y(a)40 b(\\promoted)h(bishop"\),)g(whic)m -(h)d(can)j(mo)m(v)m(e)g(as)f(a)g(bishop)e(or)i(can)g(mo)m(v)m(e)h(one)f -(square)g(in)f(an)m(y)330 4058 y(horizon)m(tal)31 b(or)g(v)m(ertical)g -(direction.)42 b(Note:)i(the)31 b(horse)g(should)e(not)j(b)s(e)e -(confused)h(with)f(a)h(knigh)m(t)330 4167 y(\(see)g(b)s(elo)m(w\),)g -(as)f(they)h(are)f(t)m(w)m(o)i(completely)e(di\013eren)m(t)g(pieces.) -199 4296 y(4.)61 b(The)27 b(gold)g(general)g(\(G\).)h(A)g(gold)e -(general)i(can)f(mo)m(v)m(e)i(one)e(square)g(in)f(an)m(y)i(horizon)m -(tal)f(or)g(v)m(ertical)330 4406 y(direction,)f(or)f(one)h(square)g(in) -e(a)j(forw)m(ard)e(diagonal)g(direction.)38 b(Gold)25 -b(generals)h(do)f(not)h(promote.)199 4534 y(5.)61 b(The)29 -b(silv)m(er)f(general)h(\(S\).)h(A)f(silv)m(er)f(general)i(can)f(mo)m -(v)m(e)i(one)f(square)f(in)f(an)m(y)h(diagonal)g(direction,)330 -4644 y(or)h(one)h(square)f(straigh)m(t)h(forw)m(ard.)40 -b(A)30 b(silv)m(er)g(general)g(promotes)h(to)g(a)g(gold)e(general.)199 -4773 y(6.)61 b(The)26 b(knigh)m(t)h(\(N\).)g(A)g(knigh)m(t)g(can)g(mo)m -(v)m(e)h(one)f(square)g(straigh)m(t)g(forw)m(ard)f(follo)m(w)m(ed)g(b)m -(y)h(one)g(square)330 4882 y(to)42 b(either)e(forw)m(ard)h(diagonal,)i -(jumping)c(o)m(v)m(er)j(in)m(terv)m(ening)e(pieces)h(if)f(an)m(y)-8 -b(.)74 b(In)40 b(other)h(w)m(ords,)330 4992 y(a)f(knigh)m(t)f(mo)m(v)m -(es)i(lik)m(e)e(its)g(in)m(ternational)f(c)m(hess)i(coun)m(terpart,)j -(but)c(forw)m(ard)g(only)-8 b(.)68 b(A)39 b(knigh)m(t)330 -5102 y(promotes)31 b(to)g(a)g(gold)f(general.)40 b(The)30 -b(knigh)m(t)g(is)f(the)i(only)e(jumping)g(piece,)h(as)h(in)e(c)m(hess.) -199 5230 y(7.)61 b(The)39 b(lance)h(\(L\).)h(A)e(lance)h(can)g(mo)m(v)m -(e)i(an)m(y)e(n)m(um)m(b)s(er)e(of)i(squares)g(straigh)m(t)g(forw)m -(ard.)68 b(A)40 b(lance)330 5340 y(promotes)31 b(to)g(a)g(gold)f -(general.)p eop -%%Page: 15 17 -15 16 bop 150 -116 a Fj(Chapter)30 b(2:)41 b(Ab)s(out)30 -b(the)g(game)i(of)e(shogi)2061 b(15)199 299 y(8.)61 b(The)29 -b(pa)m(wn)g(\(P\).)h(A)g(pa)m(wn)f(can)h(mo)m(v)m(e)h(one)f(square)f -(straigh)m(t)h(forw)m(ard.)40 b(The)29 b(pa)m(wn)g(captures)h(the)330 -408 y(same)40 b(w)m(a)m(y)h(that)g(it)e(mo)m(v)m(es,)44 -b(in)39 b(con)m(trast)i(to)g(in)m(ternational)e(c)m(hess.)69 -b(There)40 b(is)f(also)h(no)g(initial)330 518 y(t)m(w)m(o-space)i(mo)m -(v)m(e)g(for)e(pa)m(wns)g(and)f(no)h Fd(en-p)-5 b(assant)51 -b Fj(capture.)70 b(A)41 b(pa)m(wn)e(promotes)i(to)g(a)f(gold)330 -628 y(general;)31 b(a)f(promoted)h(pa)m(wn)f(is)f(usually)f(kno)m(wn)i -(as)h(a)f(\\T)-8 b(okin".)150 867 y Fe(2.1.2)63 b(The)41 -b(op)s(ening)i(setup)275 1067 y Fj(The)29 b(op)s(ening)g(setup)h(for)g -(shogi)g(is)g(as)g(follo)m(ws:)293 1291 y Fg(9)191 b(8)f(7)h(6)g(5)f(4) -h(3)g(2)f(1)150 1400 y(+-----------------------)o(----)o(----)o(---)o -(----)o(----)o(--+)150 1510 y(|)47 b(wL)h(|)f(wN)g(|)h(wS)f(|)g(wG)h(|) -f(wK)g(|)h(wG)f(|)g(wS)g(|)h(wN)f(|)h(wL)f(|)95 b(a)150 -1620 y(+-----------------------)o(----)o(----)o(---)o(----)o(----)o -(--+)150 1729 y(|)191 b(|)47 b(wR)g(|)191 b(|)g(|)f(|)h(|)f(|)48 -b(wB)f(|)191 b(|)95 b(b)150 1839 y(+-----------------------)o(----)o -(----)o(---)o(----)o(----)o(--+)150 1948 y(|)47 b(wP)h(|)f(wP)g(|)h(wP) -f(|)g(wP)h(|)f(wP)g(|)h(wP)f(|)g(wP)g(|)h(wP)f(|)h(wP)f(|)95 -b(c)150 2058 y(+-----------------------)o(----)o(----)o(---)o(----)o -(----)o(--+)150 2168 y(|)191 b(|)f(|)h(|)g(|)f(|)h(|)f(|)h(|)g(|)95 -b(d)150 2277 y(+-----------------------)o(----)o(----)o(---)o(----)o -(----)o(--+)150 2387 y(|)191 b(|)f(|)h(|)g(|)f(|)h(|)f(|)h(|)g(|)95 -b(e)150 2496 y(+-----------------------)o(----)o(----)o(---)o(----)o -(----)o(--+)150 2606 y(|)191 b(|)f(|)h(|)g(|)f(|)h(|)f(|)h(|)g(|)95 -b(f)150 2716 y(+-----------------------)o(----)o(----)o(---)o(----)o -(----)o(--+)150 2825 y(|)47 b(bP)h(|)f(bP)g(|)h(bP)f(|)g(bP)h(|)f(bP)g -(|)h(bP)f(|)g(bP)g(|)h(bP)f(|)h(bP)f(|)95 b(g)150 2935 -y(+-----------------------)o(----)o(----)o(---)o(----)o(----)o(--+)150 -3044 y(|)191 b(|)47 b(bB)g(|)191 b(|)g(|)f(|)h(|)f(|)48 -b(bR)f(|)191 b(|)95 b(h)150 3154 y(+-----------------------)o(----)o -(----)o(---)o(----)o(----)o(--+)150 3263 y(|)47 b(bL)h(|)f(bN)g(|)h(bS) -f(|)g(bG)h(|)f(bK)g(|)h(bG)f(|)g(bS)g(|)h(bN)f(|)h(bL)f(|)95 -b(i)150 3373 y(+-----------------------)o(----)o(----)o(---)o(----)o -(----)o(--+)275 3739 y Fj(Here,)40 b(\\b")e(stands)f(for)h(\\blac)m(k") -h(and)e(\\w")h(stands)g(for)f(\\white",)j(so)e(that,)j(for)c(instance,) -j(\\bL")150 3849 y(means)30 b(\\blac)m(k)h(lance".)41 -b(The)30 b(n)m(um)m(b)s(ers)f(ab)s(o)m(v)m(e)j(the)e(\014les)g(and)g -(the)g(letters)h(to)g(the)f(righ)m(t)g(of)h(the)g(ranks)150 -3958 y(represen)m(t)39 b(the)g(most)g(common)h(notation)f(system)g -(used)f(for)h(shogi)f(b)m(y)h(w)m(esterners)g(\(the)h(Japanese)150 -4068 y(also)30 b(use)g(Arabic)g(n)m(umerals)f(for)h(the)h(\014les)e -(but)h(use)g(Japanese)h(n)m(umerals)e(for)h(the)g(ranks\).)150 -4307 y Fe(2.1.3)63 b(Promotion)41 b(of)g(pieces)275 4507 -y Fj(In)24 b(sharp)g(con)m(trast)i(to)g(in)m(ternational)d(c)m(hess,)k -(where)d(only)g(pa)m(wns)h(can)g(promote)g(to)h(higher-rank)m(ed)150 -4617 y(pieces,)34 b(most)f(of)g(the)g(pieces)g(in)f(shogi)g(can)h -(promote.)49 b(The)33 b(promoted)f(ranks)h(are)g(discussed)e(in)h(the) -150 4726 y(section)22 b(on)g(piece)g(mo)m(v)m(es)i(\(see)f(Section)f -(2.1.1)i([The)e(mo)m(v)m(es)h(of)f(the)h(pieces],)h(page)f(14\))g(but)e -(are)i(rep)s(eated)150 4836 y(here)30 b(for)g(reference:)150 -5006 y(P)m(a)m(wn)262 b(promotes)31 b(to)g(gold)f(general)g(\(called)g -(a)h(`tokin')f(in)f(this)h(case)h(only\).)150 5173 y(Lance)247 -b(promotes)31 b(to)g(gold)f(general.)150 5340 y(Knigh)m(t)204 -b(promotes)31 b(to)g(gold)f(general.)p eop -%%Page: 16 18 -16 17 bop 150 -116 a Fj(16)2734 b(GNU)31 b(Shogi)f(man)m(ual)150 -299 y(Silv)m(er)f(general)630 408 y(promotes)i(to)g(gold)f(general.)150 -569 y(Gold)g(general)630 678 y(do)s(es)g(not)h(promote.)150 -838 y(Bishop)207 b(promotes)28 b(to)h(\\dragon)g(horse")f(or)g(just)g -(\\horse")h(for)f(short.)39 b(The)28 b(horse)g(can)h(mo)m(v)m(e)g(as)g -(a)630 948 y(bishop)f(or)j(can)f(mo)m(v)m(e)i(one)f(square)f(in)f(an)m -(y)i(orthogonal)g(direction.)150 1108 y(Ro)s(ok)272 b(promotes)35 -b(to)h(\\dragon)g(king")e(or)i(just)e(\\dragon")i(for)f(short.)54 -b(The)35 b(dragon)g(can)g(mo)m(v)m(e)630 1218 y(as)c(a)f(ro)s(ok)h(or)f -(can)h(mo)m(v)m(e)h(one)e(square)g(in)f(an)m(y)i(diagonal)f(direction.) -150 1378 y(King)287 b(do)s(es)30 b(not)h(promote.)275 -1648 y(The)c(three)h(ranks)f(furthest)g(a)m(w)m(a)m(y)j(from)e(eac)m(h) -h(pla)m(y)m(er)f(constitute)g(his/her)e(\\promotion)i(zone".)41 -b(A)150 1758 y(pla)m(y)m(er)29 b(ma)m(y)-8 b(,)30 b(but)e(is)g(not)h -(required)e(to,)k(promote)e(a)g(piece)g(after)g(making)f(a)i(mo)m(v)m -(e)g(in)d(whic)m(h)h(the)h(piece)150 1867 y(b)s(egins)c(and/or)i(ends)f -(in)g(the)h(promotion)g(zone.)40 b(Th)m(us)26 b(y)m(ou)h(can)g(promote) -h(a)f(piece)g(when)f(mo)m(ving)h(the)150 1977 y(piece)i(in)m(to)f(the)h -(promotion)f(zone,)i(out)f(of)g(the)g(promotion)f(zone,)i(or)f(en)m -(tirely)f(within)e(the)j(promotion)150 2087 y(zone.)41 -b(Promotion)30 b(is)g(mandatory)g(in)f(these)i(cases:)199 -2306 y(1.)61 b(Y)-8 b(ou)31 b(m)m(ust)f(promote)h(a)g(pa)m(wn)f(or)g(a) -h(lance)f(after)h(mo)m(ving)f(it)g(to)h(the)g(last)f(rank.)199 -2441 y(2.)61 b(Y)-8 b(ou)31 b(m)m(ust)f(promote)h(a)g(knigh)m(t)f -(after)g(mo)m(ving)h(it)f(to)h(either)e(of)i(the)g(last)f(t)m(w)m(o)i -(ranks.)275 2711 y(These)27 b(forced)i(promotions)e(ensure)g(that)i(a)g -(piece)f(cannot)h(b)s(e)e(mo)m(v)m(ed)i(to)g(a)g(square)f(from)f(whic)m -(h)g(it)150 2820 y(w)m(ould)i(ha)m(v)m(e)j(no)e(further)f(mo)m(v)m(e.) -275 2956 y(Pieces)f(\\dropp)s(ed")f(on)m(to)i(the)f(b)s(oard)f(\(see)i -(Section)f(2.1.4)h([Drops],)h(page)e(16\))h(alw)m(a)m(ys)g(drop)e(in)g -(the)150 3065 y(unpromoted)i(state,)j(ev)m(en)f(if)f(they)g(drop)g(in)m -(to)g(the)h(promotion)e(zone.)150 3291 y Fe(2.1.4)63 -b(Drops)275 3485 y Fj(When)24 b(a)i(pla)m(y)m(er)f(captures)g(a)g -(piece,)h(that)g(piece)f(is)f(not)h(remo)m(v)m(ed)h(from)e(pla)m(y)-8 -b(.)39 b(Instead,)26 b(it)f(b)s(ecomes)150 3594 y(the)30 -b(prop)s(ert)m(y)g(of)g(the)h(capturer)f(and)f(can)i(re-en)m(ter)g(pla) -m(y)e(b)m(y)i(b)s(eing)d(placed)i(on)g(\(almost\))h(an)m(y)f(v)-5 -b(acan)m(t)150 3704 y(square)32 b(during)e(the)i(pla)m(y)m(er's)h(mo)m -(v)m(e.)47 b(This)31 b(is)g(kno)m(wn)h(as)g(a)h(\\drop")f(and)g(coun)m -(ts)g(as)h(a)f(full)e(mo)m(v)m(e)k(\(in)150 3813 y(other)25 -b(w)m(ords,)g(y)m(ou)g(can)f(either)g(mo)m(v)m(e)i(a)f(piece)f(on)g -(the)h(b)s(oard)e(or)h(drop)g(a)g(piece)h(on)m(to)g(the)g(b)s(oard)e -(during)150 3923 y(y)m(our)31 b(mo)m(v)m(e,)i(but)d(not)i(b)s(oth\).)42 -b(All)30 b(pieces)g(drop)h(in)e(the)j(unpromoted)e(state.)44 -b(Pieces)31 b(ma)m(y)h(b)s(e)e(legally)150 4032 y(dropp)s(ed)e(in)h -(their)h(promotion)f(zone,)j(but)d(they)i(do)f(not)h(promote)g(on)f -(that)h(turn.)275 4168 y(There)e(are)i(sev)m(eral)g(restrictions)e(on)h -(drops:)199 4303 y(1.)61 b(A)26 b(pa)m(wn)f(ma)m(y)h(not)f(b)s(e)g -(dropp)s(ed)e(on)m(to)k(a)f(\014le)e(if)h(there)g(is)g(already)g(an)g -(unpromoted)g(pa)m(wn)g(b)s(elong-)330 4413 y(ing)31 -b(to)h(the)f(same)h(pla)m(y)m(er)g(on)f(that)h(\014le.)43 -b(It)31 b(is)g(legal)g(to)h(drop)e(a)i(pa)m(wn)f(on)g(a)h(\014le)f -(whic)m(h)f(con)m(tains)330 4522 y(a)h Fd(pr)-5 b(omote)g(d)43 -b Fj(pa)m(wn)30 b(b)s(elonging)e(to)j(the)g(same)g(pla)m(y)m(er,)f(ho)m -(w)m(ev)m(er.)199 4657 y(2.)61 b(A)35 b(pa)m(wn)g(ma)m(y)h(not)f(b)s(e) -f(dropp)s(ed)g(to)h(giv)m(e)h(immediate)e(c)m(hec)m(kmate)k(on)d(the)g -(mo)m(v)m(e.)57 b(A)35 b(pa)m(wn)g(is,)330 4767 y(ho)m(w)m(ev)m(er,)d -(p)s(ermitted)c(to)j(b)s(e)f(mo)m(v)m(ed)h(on)f(the)g(b)s(oard)f(to)i -(giv)m(e)g(immediate)e(c)m(hec)m(kmate.)43 b(This)28 -b(is)i(a)330 4876 y(curious)f(rule,)h(and)h(if)e(an)m(y)m(one)j(kno)m -(ws)f(the)g(reason)g(for)g(it)f(I)h(w)m(ould)f(appreciate)h(it)f(if)g -(they)h(w)m(ould)330 4986 y(con)m(tact)i(me)d(and)g(explain)f(it)h(to)h -(me)f(:-\))199 5121 y(3.)61 b(A)36 b(pa)m(wn)f(or)h(piece)g(ma)m(y)g -(not)g(b)s(e)g(dropp)s(ed)d(on)m(to)38 b(a)e(square)f(from)h(whic)m(h)e -(they)i(w)m(ould)f(ha)m(v)m(e)i(no)330 5230 y(legal)27 -b(mo)m(v)m(e.)41 b(This)26 b(means)h(that)h(pa)m(wns)f(and)g(lances)g -(ma)m(y)h(not)g(b)s(e)e(dropp)s(ed)g(on)m(to)i(the)g(last)f(rank,)330 -5340 y(and)j(the)g(knigh)m(t)g(ma)m(y)h(not)g(b)s(e)e(dropp)s(ed)g(on)m -(to)i(the)g(last)f(or)g(second-to-last)i(rank.)p eop -%%Page: 17 19 -17 18 bop 150 -116 a Fj(Chapter)30 b(2:)41 b(Ab)s(out)30 -b(the)g(game)i(of)e(shogi)2061 b(17)275 299 y(It)36 b(is)f(en)m(tirely) -h(p)s(ermissible)c(\(and)k(often)h(advisable\))e(to)i(drop)f(a)g(piece) -g(or)h(pa)m(wn)f(b)s(et)m(w)m(een)h(one's)150 408 y(King)28 -b(and)g(an)h(attac)m(king)i(ranging)d(piece.)40 b(F)-8 -b(or)30 b(this)e(reason,)i(the)f(\014nal)f(c)m(hec)m(kmating)i(mo)m(v)m -(e)h(is)d(nearly)150 518 y(alw)m(a)m(ys)j(an)f(attac)m(k)j(on)d(the)h -(King)e(from)h(an)g(adjacen)m(t)i(square)e(\(except)i(for)e(an)g(attac) -m(k)j(b)m(y)d(a)h(Knigh)m(t\).)275 650 y(Captured)e(pieces)h(are)h -(said)e(to)i(b)s(e)f(pieces)g(\\in)g(hand".)275 781 y(The)h(drop)g(is)g -(the)h(primary)e(distinguishing)d(feature)32 b(of)g(Japanese)g(c)m -(hess,)h(shared)e(with)g(no)h(other)150 891 y(p)s(opular)21 -b(c)m(hess-t)m(yp)s(e)k(game.)39 b(It)24 b(giv)m(es)f(shogi)g(a)h(v)m -(ery)g(aggressiv)m(e)h(qualit)m(y)-8 b(,)24 b(and)f(dramatically)f -(increases)150 1000 y(the)h(n)m(um)m(b)s(er)f(of)h(p)s(ossible)d(mo)m -(v)m(es)k(once)g(a)f(few)f(pieces)h(ha)m(v)m(e)h(b)s(een)e(captured.)38 -b(Another)23 b(in)m(teresting)f(fea-)150 1110 y(ture)h(of)h(shogi)f(is) -g(that)h(exc)m(hanges)h(complicate)e(pla)m(y)h(rather)f(than)g -(simplifying)d(it)j(\(as)h(in)e(in)m(ternational)150 -1220 y(c)m(hess\),)31 b(b)s(ecause)g(of)f(the)h(drop)e(rule.)150 -1435 y Fe(2.1.5)63 b(Winning)41 b(the)g(game)275 1625 -y Fj(A)36 b(game)g(of)h(shogi)e(is)g(w)m(on)h(b)m(y)g(capturing)f(the)h -(opp)s(onen)m(t's)f(king.)57 b(In)35 b(general,)j(this)c(is)h(done)h(b) -m(y)150 1734 y(c)m(hec)m(kmating)26 b(the)e(king:)37 -b(attac)m(king)26 b(the)f(king)e(in)g(suc)m(h)i(a)f(w)m(a)m(y)i(that)f -(the)f(king)g(cannot)h(b)s(e)f(defended)f(no)150 1844 -y(matter)32 b(what)f(the)h(defending)d(pla)m(y)m(er)i(mo)m(v)m(es.)45 -b(Note,)33 b(though,)e(that)h(there)f(is)g(no)g(rule)f(that)h(requires) -150 1954 y(a)f(pla)m(y)m(er)g(to)g(defend)f(a)h(king)f(whic)m(h)f(is)h -(b)s(eing)g(attac)m(k)m(ed.)43 b(Ho)m(w)m(ev)m(er,)32 -b(if)d(he)g(do)s(es)h(not)g(defend)e(his)h(king,)150 -2063 y(the)36 b(opp)s(onen)m(t)f(is)g(en)m(tirely)f(free)i(to)g -(capture)g(it)f(on)h(the)g(next)f(mo)m(v)m(e,)k(th)m(us)c(winning)e -(the)j(game.)57 b(As)150 2173 y(in)31 b(in)m(ternational)g(c)m(hess,)j -(in)d(practice)i(most)g(games)g(end)f(b)m(y)g(resignation)g(when)f(one) -i(pla)m(y)m(er)f(realizes)150 2282 y(that)f(he)f(cannot)h(escap)s(e)g -(c)m(hec)m(kmate.)150 2498 y Fe(2.1.6)63 b(Dra)m(ws)275 -2687 y Fj(There)26 b(are)h(v)m(ery)g(few)f(dra)m(ws)g(in)f(shogi;)j -(only)e(ab)s(out)g(1-2\045)i(of)e(professional)f(games)j(end)e(in)f(a)i -(dra)m(w.)150 2797 y(One)37 b(reason)g(for)g(this)g(is)f(that)i -(material)e(can)i(nev)m(er)g(b)s(e)e(depleted)h(as)g(in)f(c)m(hess,)k -(b)s(ecause)d(captured)150 2907 y(pieces)e(are)h(constan)m(tly)g(re-en) -m(tering)f(pla)m(y)g(as)h(a)g(consequence)g(of)f(the)h(drop)e(rule.)55 -b(In)34 b(fact,)k(most)e(of)150 3016 y(the)31 b(w)m(a)m(ys)g(a)g(game)g -(can)g(b)s(e)e(dra)m(wn)h(in)f(c)m(hess)i(are)f(not)h(allo)m(w)m(ed)f -(in)f(shogi:)225 3235 y Fi(\017)60 b Fj(Dra)m(ws)31 b(cannot)g(b)s(e)f -(o\013ered.)225 3367 y Fi(\017)60 b Fj(There)30 b(is)f(no)i(\014ft)m -(y-mo)m(v)m(e)h(rule.)225 3499 y Fi(\017)60 b Fj(A)33 -b(stalemate)i(coun)m(ts)f(as)f(a)h(win)e(for)h(the)h(stalemater.)50 -b(Stated)34 b(otherwise:)46 b(if)32 b(y)m(ou)i(can't)g(mo)m(v)m(e,)330 -3608 y(y)m(ou)d(lose.)225 3740 y Fi(\017)60 b Fj(P)m(erp)s(etual)30 -b(c)m(hec)m(k)i(is)d(illegal)g(\(see)i(b)s(elo)m(w\).)275 -4003 y(There)e(are)i(only)f(t)m(w)m(o)h(legal)g(w)m(a)m(ys)g(in)e(whic) -m(h)g(a)i(dra)m(w)f(can)g(o)s(ccur:)199 4222 y(1.)61 -b(A)29 b(p)s(osition)e(\(including)f(the)k(pieces)e(in)g(hand\))g(o)s -(ccurs)h(4)h(times)e(with)g(the)h(same)h(pla)m(y)m(er)f(to)g(mo)m(v)m -(e)330 4332 y(\(called)j(\\Sennic)m(hite"\).)47 b(Ho)m(w)m(ev)m(er,)35 -b(if)c(this)h(is)f(caused)i(b)m(y)f(consecutiv)m(e)i(c)m(hec)m(ks)f -(\(direct)g(attac)m(ks)330 4441 y(on)27 b(the)g(King,)g(threatening)g -(to)h(capture)f(it)g(on)g(the)g(next)g(mo)m(v)m(e\))i(b)m(y)e(one)h -(side,)f(the)g(pla)m(y)m(er)g(giving)330 4551 y(these)34 -b(c)m(hec)m(ks)i(loses)e(the)g(game.)53 b(In)33 b(other)h(w)m(ords,)h -(p)s(erp)s(etual)d(c)m(hec)m(k)k(results)c(in)h(a)i(loss)e(for)h(the) -330 4660 y(attac)m(k)m(er)f(who)d(recreates)i(the)f(same)f(p)s(osition) -f(the)h(4th)h(time.)199 4792 y(2.)61 b(Both)36 b(pla)m(y)m(ers)f(ha)m -(v)m(e)h(mo)m(v)m(ed)g(their)e(King)g(in)m(to)h(the)h(the)f(promotion)f -(zone)i(\(or)g(they)f(cannot)h(b)s(e)330 4902 y(prev)m(en)m(ted)22 -b(from)g(doing)f(so\))h(and)g(the)g(Kings)f(cannot)h(b)s(e)f(c)m(hec)m -(kmated.)40 b(A)22 b(King)f(who)h(has)f(en)m(tered)330 -5011 y(the)31 b(promotion)e(zone)j(is)d(kno)m(wn)h(as)h(an)f(\\en)m -(tering)h(King";)f(due)g(to)h(the)f(forw)m(ard)g(orien)m(tation)h(of) -330 5121 y(most)j(shogi)g(pieces,)h(it)f(is)f(v)m(ery)h(hard)g(to)g -(mate)h(suc)m(h)f(a)h(King.)51 b(In)33 b(that)i(case)g(the)f(pla)m(y)m -(ers)g(ma)m(y)330 5230 y(decide)29 b(to)i(coun)m(t)f(their)f(pieces)g -(as)h(follo)m(ws:)40 b(the)29 b(King)g(do)s(es)g(not)h(coun)m(t,)h(the) -f(Ro)s(ok)g(and)f(Bishop)330 5340 y(coun)m(t)h(as)g(5)g(p)s(oin)m(ts,)f -(and)g(all)g(other)h(pieces)f(as)h(one)g(p)s(oin)m(t.)39 -b(Promotion)30 b(is)e(disregarded.)39 b(If)30 b(b)s(oth)p -eop -%%Page: 18 20 -18 19 bop 150 -116 a Fj(18)2734 b(GNU)31 b(Shogi)f(man)m(ual)330 -299 y(pla)m(y)m(ers)k(ha)m(v)m(e)i(at)f(least)g(24)g(p)s(oin)m(ts)e -(the)h(game)i(is)d(a)i(dra)m(w)f(\(called)g(\\Jishogi"\).)52 -b(If)34 b(a)h(pla)m(y)m(er)f(has)330 408 y(less,)c(he)g(loses)g(the)h -(game.)330 545 y(Of)41 b(course,)k(a)d(pla)m(y)m(er)f(can)h(refuse)f -(to)i(coun)m(t)f(pieces)f(when)g(he)g(still)f(has)h(mating)g(c)m -(hances)i(or)330 655 y(c)m(hances)32 b(to)g(gain)f(material)g(whic)m(h) -f(w)m(ould)g(a\013ect)j(the)e(outcome)i(of)e(the)h(coun)m(ting.)43 -b(There)31 b(is)f(no)330 765 y(strict)38 b(rule)f(ab)s(out)h(what)g(to) -h(do)f(if)f(this)g(is)g(not)i(the)f(case,)k(but)37 b(nonetheless)h(a)g -(pla)m(y)m(er)h(refuses)330 874 y(to)f(coun)m(t)g(up)e(\(e.g.)63 -b(b)s(ecause)38 b(he)f(do)s(es)g(not)h(ha)m(v)m(e)g(enough)f(p)s(oin)m -(ts)g(for)g(a)g(dra)m(w\).)62 b(It)38 b(has)f(b)s(een)330 -984 y(generally)30 b(accepted)i(that)g(in)e(suc)m(h)g(a)h(case)h(the)g -(game)f(ends)g(and)f(the)h(pieces)g(are)g(coun)m(ted)g(after)330 -1093 y(one)g(pla)m(y)m(er)f(has)g(managed)h(to)g(get)h(all)d(his)g -(pieces)h(protected)h(in)e(the)i(promotion)f(zone.)150 -1355 y Fe(2.1.7)63 b(Handicaps)275 1552 y Fj(Unlik)m(e)34 -b(in)m(ternational)g(c)m(hess,)j(shogi)e(has)g(a)h(w)m(ell-established) -d(handicap)h(system)h(whic)m(h)f(is)h(used)150 1662 y(when)28 -b(pla)m(y)m(ers)i(of)f(di\013eren)m(t)g(strengths)g(pla)m(y)g(against)g -(eac)m(h)i(other.)41 b(Handicaps)28 b(range)i(from)e(small)g(to)150 -1771 y(h)m(uge,)h(whic)m(h)d(mak)m(es)j(it)e(p)s(ossible)f(for)h(w)m -(eak)i(pla)m(y)m(ers)e(to)i(pla)m(y)e(against)h(ev)m(en)h(v)m(ery)f -(strong)g(pla)m(y)m(ers)g(and)150 1881 y(ha)m(v)m(e)k(an)e(ev)m(en)h(c) -m(hance)g(of)g(winning.)275 2020 y(Shogi)f(pla)m(y)m(ers)i(are)f(rank)m -(ed)h(as)f(follo)m(ws:)42 b(the)32 b(w)m(eak)m(est)i(rank)c(is)h -(around)f(15)j(\\kyu",)f(whic)m(h)e(repre-)150 2130 y(sen)m(ts)j(a)g(b) -s(eginner.)46 b(14)33 b(kyu)f(is)g(higher)f(than)h(15)i(kyu,)f(13)g -(kyu)f(is)g(higher)f(still,)g(and)h(so)h(on)g(un)m(til)e(y)m(ou)150 -2240 y(get)e(to)g(1)g(kyu.)40 b(The)27 b(next)i(highest)e(rank)h(is)f -(1)i(\\dan",)g(follo)m(w)m(ed)f(b)m(y)g(2)h(dan,)f(3)h(dan)f(and)f(so)i -(forth.)39 b(The)150 2349 y(highest)34 b(amateur)g(rank)g(is)g(6)g -(dan;)i(professionals)d(go)i(up)e(to)i(9)g(dan.)52 b(Ho)m(w)m(ev)m(er,) -38 b(professional)33 b(ranks)150 2459 y(are)c(not)g(the)h(same)f(as)g -(amateur)g(ranks;)g(a)h(professional)d(1)i(dan)g(is)f -Fd(much)36 b Fj(stronger)29 b(than)g(an)f(amateur)150 -2568 y(1)35 b(dan.)55 b(This)33 b(system)i(is)f(similar)f(to)j(that)f -(used)f(b)m(y)h(go)h(pla)m(y)m(ers)f(\(and)g(also)g(other)h(Japanese)f -(sp)s(orts)150 2678 y(suc)m(h)30 b(as)h(k)-5 b(arate\).)275 -2817 y(A)40 b(handicap)f(consists)g(of)i(the)f(stronger)h(pla)m(y)m(er) -f(pla)m(ying)f(White)h(and)g(remo)m(ving)g(one)h(or)f(more)150 -2927 y(pieces)35 b(from)f(his)g(side)g(of)h(the)g(b)s(oard)f(at)i(the)f -(start)g(of)h(the)f(game.)55 b(These)35 b(pieces)g(are)g(p)s(ermanen)m -(tly)150 3037 y(remo)m(v)m(ed)c(from)f(pla)m(y;)g(they)h(are)g(not)f -(in)f(hand.)275 3176 y(The)e(follo)m(wing)g(is)h(a)h(list)e(of)h(the)h -(accepted)h(handicaps,)d(from)h(w)m(eak)m(est)i(to)f(strongest.)41 -b(The)28 b(degree)150 3286 y(of)37 b(the)g(handicap,)h(represen)m(ted)f -(b)m(y)g(the)g(p)s(osition)e(in)h(the)h(list,)g(represen)m(ts)g(the)g -(di\013erence)g(in)e(rank)150 3395 y(b)s(et)m(w)m(een)45 -b(the)f(t)m(w)m(o)h(pla)m(y)m(ers)f(for)f(whic)m(h)g(the)h(handicap)e -(is)h(appropriate.)80 b(These)44 b(rules)f(are)h(tak)m(en)150 -3505 y(from)32 b(the)g(b)s(o)s(oks)f(\\Shogi)h(for)g(Beginners")f(b)m -(y)h(John)g(F)-8 b(airbairn)30 b(and)i(\\The)g(Art)g(of)g(Shogi")g(b)m -(y)g(T)-8 b(on)m(y)150 3614 y(Hoskings)33 b(\(see)i(Chapter)f(5)g -([References)h(and)e(links],)g(page)i(41\))g(and,)f(I)g(b)s(eliev)m(e,) -g(represen)m(t)g(curren)m(t)150 3724 y(Japanese)d(practice.)199 -3943 y(1.)61 b(The)30 b(stronger)g(pla)m(y)m(er)h(remo)m(v)m(es)h(his)d -(left)h(lance)g(\(on)h(1a\).)199 4080 y(2.)61 b(The)31 -b(pla)m(y)m(ers)h(pla)m(y)f(a)h(t)m(w)m(o-game)i(matc)m(h;)f(in)d(the)i -(\014rst)f(game)h(the)g(stronger)g(pla)m(y)m(er)f(remo)m(v)m(es)i(his) -330 4190 y(left)d(lance)g(\(on)h(1a\),)h(while)c(in)h(the)i(second)f -(game)i(he)e(remo)m(v)m(es)i(his)d(bishop.)199 4327 y(3.)61 -b(The)30 b(stronger)g(pla)m(y)m(er)h(remo)m(v)m(es)h(his)d(bishop.)199 -4463 y(4.)61 b(The)30 b(stronger)g(pla)m(y)m(er)h(remo)m(v)m(es)h(his)d -(ro)s(ok.)199 4600 y(5.)61 b(The)30 b(stronger)g(pla)m(y)m(er)h(remo)m -(v)m(es)h(his)d(ro)s(ok)h(and)g(left)g(lance.)199 4737 -y(6.)61 b(The)31 b(pla)m(y)m(ers)h(pla)m(y)f(a)h(t)m(w)m(o-game)i(matc) -m(h;)f(in)d(the)i(\014rst)f(game)h(the)g(stronger)g(pla)m(y)m(er)f -(remo)m(v)m(es)i(his)330 4847 y(ro)s(ok)d(and)f(left)h(lance)g(\(on)g -(1a\),)h(while)d(in)h(the)h(second)g(game)h(he)f(remo)m(v)m(es)h(his)d -(ro)s(ok)i(and)g(bishop.)199 4984 y(7.)61 b(The)30 b(stronger)i(pla)m -(y)m(er)f(remo)m(v)m(es)h(his)d(ro)s(ok)i(and)g(bishop.)40 -b(This)29 b(is)h(usually)f(called)h(a)h(\\t)m(w)m(o-piece")330 -5093 y(handicap.)199 5230 y(8.)61 b(The)31 b(stronger)g(pla)m(y)m(er)g -(remo)m(v)m(es)h(his)e(ro)s(ok,)h(bishop,)f(and)g(b)s(oth)g(lances.)43 -b(This)29 b(is)h(called)g(a)i(\\four-)330 5340 y(piece")f(handicap.)p -eop -%%Page: 19 21 -19 20 bop 150 -116 a Fj(Chapter)30 b(2:)41 b(Ab)s(out)30 -b(the)g(game)i(of)e(shogi)2061 b(19)199 299 y(9.)61 b(The)33 -b(stronger)h(pla)m(y)m(er)g(remo)m(v)m(es)h(his)d(ro)s(ok,)i(bishop,)f -(b)s(oth)g(lances,)h(and)f(b)s(oth)g(knigh)m(ts.)50 b(This)32 -b(is)330 408 y(called)e(a)g(\\six-piece")h(handicap.)154 -545 y(10.)61 b(The)41 b(stronger)h(pla)m(y)m(er)f(remo)m(v)m(es)i(his)d -(ro)s(ok,)45 b(bishop,)e(b)s(oth)e(lances,)j(b)s(oth)d(knigh)m(ts,)j -(and)d(b)s(oth)330 655 y(silv)m(ers.)e(This)29 b(is)g(called)h(an)g -(\\eigh)m(t-piece")i(handicap.)275 930 y(Another)j(adv)-5 -b(an)m(tage)38 b(of)e(pla)m(ying)e(handicap)h(games)h(is)f(that)h(the)g -(handicaps)e(alter)i(the)g(optimal)150 1040 y(strategy)g(for)e(b)s(oth) -g(pla)m(y)m(ers.)54 b(F)-8 b(or)35 b(instance,)h(handicaps)d(all)g(ha)m -(v)m(e)j(their)e(o)m(wn)g(op)s(ening)f(lines)g(whic)m(h)150 -1150 y(ma)m(y)j(b)s(ear)g(little)e(or)i(no)f(resem)m(blance)h(to)h -(those)f(used)f(in)f(non-handicap)g(shogi.)57 b(This)34 -b(means)h(that)150 1259 y(when)26 b(learning)f(handicap)g(shogi,)i(y)m -(ou)g(are)g(essen)m(tially)e(learning)g(completely)h(new)g(games)i -(whic)m(h)d(use)150 1369 y(the)31 b(same)f(equipmen)m(t!)275 -1508 y(The)c(reader)g(ma)m(y)h(w)m(onder)f(ho)m(w)h(on)f(earth)h(a)g -(pla)m(y)m(er)g(giving)e(an)i(eigh)m(t-piece)g(handicap,)f(sa)m(y)-8 -b(,)29 b(could)150 1617 y(p)s(ossibly)37 b(hop)s(e)j(to)h(win.)68 -b(Don't)41 b(forget,)j(though,)f(that)d(in)f(shogi)h(the)g(opp)s(onen)m -(t's)g(pieces)g(can)h(b)s(e)150 1727 y(captured)g(and)h(then)f(b)s -(ecome)h(part)g(of)g(one's)g(o)m(wn)g(arm)m(y)-8 b(.)76 -b(Th)m(us,)44 b(if)d(the)h(opp)s(onen)m(t)f(pla)m(ys)g(badly)150 -1837 y(enough,)30 b(the)h(n)m(um)m(b)s(er)e(of)i(pieces)f(will)d(so)s -(on)j(ev)m(en)i(out.)150 2070 y Fe(2.1.8)63 b(Notes)41 -b(for)g(c)m(hess)g(pla)m(y)m(ers)275 2267 y Fj(Here)29 -b(are)h(a)f(few)g(miscellaneous)f(things)f(that)j(ma)m(y)g(confuse)f(c) -m(hess)g(pla)m(y)m(ers.)41 b(Some)29 b(of)g(these)h(ha)m(v)m(e)150 -2376 y(b)s(een)g(men)m(tioned)g(elsewhere,)g(but)f(they)i(b)s(ear)f -(rep)s(eating.)199 2595 y(1.)61 b(There)30 b(is)f(no)i(queen.)199 -2732 y(2.)61 b(P)m(a)m(wns)29 b(capture)h(the)f(same)h(w)m(a)m(y)g -(they)f(mo)m(v)m(e.)42 b(There)29 b(is)f(no)h(initial)e(t)m(w)m -(o-space)k(pa)m(wn)e(mo)m(v)m(e)i(and)330 2842 y(no)f -Fd(en-p)-5 b(assant)41 b Fj(mo)m(v)m(e.)199 2979 y(3.)61 -b(There)42 b(is)g(no)h(sp)s(ecial)e(castling)h(mo)m(v)m(e.)80 -b(There)42 b Fd(ar)-5 b(e)51 b Fj(a)43 b(large)g(n)m(um)m(b)s(er)e(of)i -(p)s(ossible)d(defensiv)m(e)330 3088 y(formations)31 -b(referred)f(to)i(as)g(\\castles")h(\(see)f(Section)f(2.2)h([Sample)f -(game],)i(page)f(19\))g(but)f(there)330 3198 y(is)e(no)i(need)f(for)g -(sp)s(ecial)f(mo)m(v)m(es)j(to)f(create)h(them.)199 3334 -y(4.)61 b(A)30 b(giv)m(en)h(piece)f(can)h(only)e(promote)i(to)g -Fd(one)38 b Fj(other)30 b(kind)f(of)h(piece.)150 3630 -y Fk(2.2)68 b(Sample)46 b(game)275 3827 y Fj(This)e(game)k(w)m(as)f -(annotated)g(b)m(y)g(Pieter)f(Stouten)h(\(see)g(Chapter)f(5)h -([References)h(and)e(links],)150 3937 y(page)40 b(41\).)70 -b(I)39 b(ha)m(v)m(e)i(made)f(some)f(minor)g(corrections.)68 -b(Note)41 b(that)f(captures)g(are)g(denoted)f(b)m(y)h(the)150 -4046 y(\\x")34 b(sym)m(b)s(ol)f(e.g.)51 b(Rx3f)34 b(and)e(drops)h(are)h -(denoted)f(b)m(y)h(the)g(\\*")g(sym)m(b)s(ol)f(e.g.)51 -b(R*3f.)g(Chec)m(k)34 b(is)e(indi-)150 4156 y(cated)k(b)m(y)g(a)g(\\)p -Fg(+)p Fj(")g(after)g(the)f(mo)m(v)m(e,)k(e.g.)56 b(R3f)p -Fg(+)p Fj(.)g(I)35 b(recommend)h(y)m(ou)f(use)g(gn)m(ushogi/xshogi)g -(to)h(pla)m(y)150 4266 y(along)i(with)f(this)g(game.)66 -b(In)37 b(xshogi)h(simply)e(hit)h(the)h(\\F)-8 b(orce)41 -b(Mo)m(v)m(es")f(button)e(after)h(starting)f(up,)150 -4375 y(while)26 b(in)h(gn)m(ushogi)g(en)m(ter)i(the)f(w)m(ord)f -(\\force")j(at)f(the)f(prompt.)39 b(This)26 b(will)f(allo)m(w)j(y)m(ou) -g(to)h(en)m(ter)g(mo)m(v)m(es)150 4485 y(for)h(b)s(oth)g(sides.)275 -4624 y(Note)d(also)f(that)h(the)g(mo)m(v)m(e)g(n)m(um)m(b)s(ering)e -(system)h(used)f(here)h(is)g(the)g(c)m(hess-t)m(yp)s(e)h(system)g -(where)f(one)150 4733 y(mo)m(v)m(e)33 b(means)d(one)i(mo)m(v)m(e)g(b)m -(y)f(eac)m(h)h(pla)m(y)m(er.)43 b(The)31 b(Japanese)g(coun)m(t)h(one)f -(mo)m(v)m(e)i(made)e(b)m(y)g(eac)m(h)h(pla)m(y)m(er)150 -4843 y(as)f(t)m(w)m(o)g(mo)m(v)m(es.)275 4982 y -(|||||||||||||||||||||||||)275 5121 y(Belo)m(w)c(y)m(ou)g(will)d -(\014nd)h(\(the)i(English)d(translation)i(of)7 b(\))27 -b(an)f(annotated)i(game)f(whic)m(h)f(w)m(as)h(published)150 -5230 y(in)41 b(the)i(Dutc)m(h)h(Shogi)d(magazine)j(\\81")g(and)e(in)g -(the)g(Dutc)m(h)i(b)s(eginners)c(b)s(o)s(oklet.)77 b(It)43 -b(has)g(pro)m(v)m(en)150 5340 y(to)e(b)s(e)e(a)h(v)m(ery)g(useful)e -(game)j(to)g(explain)d(some)i(basic)f(principles)d(of)k(Shogi.)69 -b(Also,)42 b(it)d(is)g(a)h(rather)p eop -%%Page: 20 22 -20 21 bop 150 -116 a Fj(20)2734 b(GNU)31 b(Shogi)f(man)m(ual)150 -299 y(straigh)m(tforw)m(ard)44 b(game)i(compared)e(to)h(professional)e -(games)i(where)f(in)f(most)i(cases)h(v)m(ery)e(di\013use)150 -408 y(middle)28 b(game)j(\014gh)m(ts)g(tak)m(e)h(place.)275 -543 y(Pieter)e(Stouten,)g(14th)h(Ma)m(y)h(1990.)275 678 -y(|||||||||||||||||||||||||)275 813 y(Blac)m(k:)41 b(Mic)m(hael)31 -b(T)-8 b(ren)m(t)30 b(\(1-dan\).)42 b(White:)e(Da)m(vid)31 -b(Murph)m(y)e(\(2-dan\).)275 948 y(1.)41 b(P2f)30 b(P3d)g(2.)41 -b(P2e)31 b(B3c)150 1058 y([)j(This)f(mo)m(v)m(e)i(is)f(necessary)-8 -b(,)36 b(as)e(otherwise)g(white)f(can)i(exc)m(hange)g(pa)m(wns:)48 -b(3.)53 b(P2d)33 b(Px2d)h(4.)53 b(Rx2d.)150 1167 y(He)31 -b(w)m(ould)e(th)m(us)h(get)i(a)e(pa)m(wn)g(in)f(hand)h(and)f(op)s(en)h -(up)f(his)g(ro)s(ok)i(\014le.)39 b(])275 1302 y(3.)i(P7f)30 -b(P4d)150 1412 y([)39 b(White)f(closes)h(the)g(bishop)d(diagonal)i -(again.)66 b(He)39 b(plans)e(to)i(pla)m(y)f(ranging)g(ro)s(ok)h(\(the)g -(ro)s(ok)f(go)s(es)150 1521 y(to)h(5b,)g(4b,)h(3)e(or)g(2b;)k(a)c -(defensiv)m(e)f(strategy\))i(and)f(in)e(that)i(case)h(he'd)f(b)s(etter) -f(a)m(v)m(oid)i(an)e(exc)m(hange)150 1631 y(of)32 b(bishops.)42 -b(One)32 b(of)f(the)h(reasons)g(is)f(that)h(he)g(will)d(ha)m(v)m(e)j -(problems)e(dev)m(eloping)h(his)f(pieces)i(without)150 -1740 y(lea)m(ving)e(holes)g(for)g(bishop)e(drops.)40 -b(])275 1875 y(4.)h(S4h)29 b(R3b)i(5.)41 b(P3f)30 b(S4b)g(6.)41 -b(K6h)30 b(K6b)150 1985 y([)36 b(In)g(general)g(the)h(ro)s(ok)f(pla)m -(ys)f(an)i(imp)s(ortan)m(t)e(role)h(in)f(the)h(attac)m(ks.)61 -b(It)36 b(is)f(wise)h(to)h(mo)m(v)m(e)g(the)g(king)150 -2094 y(a)m(w)m(a)m(y)h(from)d(the)h(area)g(where)f(the)h(initial)d -(\014gh)m(ts)j(will)d(b)s(e)i(and)g(b)s(oth)g(pla)m(y)m(ers)h(act)h -(according)e(to)i(the)150 2204 y(Shogi)29 b(pro)m(v)m(erb)i(\\k)m(eep)g -(the)g(ro)s(ok)f(and)g(king)f(apart".)42 b(])275 2339 -y(7.)f(K7h)30 b(K7b)g(8.)41 b(P5f)30 b(P5d)g(9.)41 b(G4i-5h)31 -b(G4a-5b)150 2449 y([)g(Both)g(pla)m(y)m(ers)f(use)g(their)f(second)i -(gold)f(general)g(to)h(build)d(their)h(castle.)41 b(])275 -2583 y(10.)g(S6h)150 2693 y([)25 b(In)f(itself)f(this)g(mo)m(v)m(e)j -(is)e(not)h(bad.)38 b(Ho)m(w)m(ev)m(er,)28 b(it)c(will)e(b)s(ecome)j -(clear)g(that)g(blac)m(k)f(plans)f(a)i(quic)m(k)g(attac)m(k)150 -2803 y(and)30 b(in)f(that)i(case)g(it)f(is)g(wiser)f(to)i(omit)f(this)f -(mo)m(v)m(e.)42 b(])275 2937 y(10...)g(S5c)30 b(11.)42 -b(P1f)30 b(P1d)150 3047 y([)38 b(The)e(adv)-5 b(ance)38 -b(of)g(the)f(edge)h(pa)m(wns)f(m)m(ust)g(b)s(e)g(timed)g(v)m(ery)g(w)m -(ell.)61 b(The)37 b(remark)g(at)h(blac)m(k's)f(ten)m(th)150 -3157 y(mo)m(v)m(e)i(applies)c(here)i(to)s(o:)54 b(this)36 -b(mo)m(v)m(e)j(is)d(go)s(o)s(d)h(if)f(blac)m(k)h(w)m(an)m(ts)h(to)g -(pla)m(y)e(a)i(slo)m(w)e(game,)k(b)s(ecause)d(it)150 -3266 y(eliminates)29 b(a)i(future)e(B1e.)42 b(])275 3401 -y(12.)f(P4f)31 b(K8b)e(13.)42 b(N3g)31 b(S7b)150 3511 -y([)25 b(Blac)m(k)g(dev)m(elops)f(his)f(knigh)m(t)h(in)f(order)h(to)h -(start)g(an)g(attac)m(k)h(o)m(v)m(er)g(the)f(second,)h(third)c(and)i -(fourth)g(\014les.)150 3620 y(White)36 b(strengthens)f(his)g(king's)g -(p)s(osition)f(and)h(a)m(w)m(aits)i(the)f(attac)m(k.)60 -b(He)37 b(aims)e(at)i(a)f(coun)m(terattac)m(k)150 3730 -y(as)c(so)s(on)g(as)g(blac)m(k)g(has)g(brok)m(en)g(through)f(in)m(to)h -(the)g(white)f(camp.)46 b(Probably)30 b(white's)i(breakthrough)150 -3839 y(will)e(tak)m(e)k(place)e(later,)i(but)d(he)i(has)f(go)s(o)s(d)g -(comp)s(ensation)g(in)f(the)i(form)f(of)h(a)f(stronger)h(castle.)48 -b(This)150 3949 y(theme)31 b(o)s(ccurs)f(v)m(ery)h(often)f(in)f(static) -i(ro)s(ok)g(v)m(ersus)f(ranging)f(ro)s(ok)i(games.)41 -b(])275 4084 y(14.)g(P4e)31 b(R4b)150 4194 y([)c(Blac)m(k)h(starts)f -(his)e(attac)m(k)30 b(and)c(white)g(puts)g(up)g(a)h(v)m(ery)g(passiv)m -(e)g(defence.)40 b(His)26 b(ro)s(ok)h(has)f(a)h(hard)f(task)150 -4303 y(no)m(w)34 b(to)h(p)s(enetrate)g(the)f(blac)m(k)h(p)s(osition.)50 -b(Moreo)m(v)m(er,)38 b(he)c(blo)s(c)m(ks)g(his)e(o)m(wn)j(bishop.)50 -b(It)34 b(seems)h(m)m(uc)m(h)150 4413 y(b)s(etter)29 -b(to)h(start)g(a)g(coun)m(terattac)m(k)i(with)c(14...)42 -b(P3e,)30 b(later)f(to)h(b)s(e)f(follo)m(w)m(ed)g(b)m(y)g(B2b,)h(B5a)g -(or)g(Bx4d)f(in)150 4522 y(order)h(to)h(use)f(his)f(ro)s(ok)h(more)h -(activ)m(ely)-8 b(.)41 b(])275 4657 y(15.)g(Px4d)30 b(Sx4d)g(16.)42 -b(P*4e)31 b(S5c)150 4767 y([)j(16...)52 b(Sx4e)34 b(is)f(more)g(activ)m -(e.)52 b(A)34 b(silv)m(er)e(general)i(is)f(normally)f(more)i(v)-5 -b(aluable)32 b(than)h(a)h(knigh)m(t,)h(but)150 4876 y(white)f(gets)h(t) -m(w)m(o)h(pa)m(wns)e(in)f(hand)h(and)g(blac)m(k)g(none,)i(while)d(the)i -(knigh)m(t)f(migh)m(t)g(come)h(in)f(handy)f(for)150 4986 -y(white)c(to)s(o.)42 b(])275 5121 y(17.)f(Bx3c)p Fg(+)31 -b Fj(Nx3c)h(18.)41 b(P2d)30 b(Px2d)150 5230 y([)38 b(Blac)m(k)i -(threatens)e(to)h(break)f(through)g(and)g(white)f(has)h(to)h(consider)e -(taking)h(the)h(pa)m(wn)f(on)g(2d)g(or)150 5340 y(starting)28 -b(a)h(coun)m(terattac)m(k)j(with)27 b(Nx4e.)41 b(If)28 -b(he)g(c)m(ho)s(oses)i(the)f(latter,)g(blac)m(k)g(can)f(pla)m(y)g(Px2c) -p Fg(+)h Fj(follo)m(w)m(ed)p eop -%%Page: 21 23 -21 22 bop 150 -116 a Fj(Chapter)30 b(2:)41 b(Ab)s(out)30 -b(the)g(game)i(of)e(shogi)2061 b(21)150 299 y(b)m(y)33 -b Fg(+)p Fj(P3c.)48 b(The)33 b(disadv)-5 b(an)m(tage)33 -b(is)f(the)h(blac)m(k)g(\\tokin")g(\(=promoted)g(pa)m(wn\))g(that)g -(white)f(will)e(get)k(in)150 408 y(his)k(camp;)44 b(the)39 -b(adv)-5 b(an)m(tage)41 b(is)d(that)i(it)f(will)d(cost)k(blac)m(k)f(t)m -(w)m(o)i(more)e(mo)m(v)m(es)i(to)e(promote)h(his)e(ro)s(ok.)150 -518 y(Because)32 b(white)d(did)f(not)j(trust)e(that)i(the)g(result)e -(after)h(engaging)h(in)e(a)i(\\semeai")g(\(=m)m(utual)e(attac)m(k\))150 -628 y(with)g(18...Nx4e)j(w)m(ould)d(giv)m(e)h(a)g(p)s(ositiv)m(e)f -(result,)g(he)h(captured)f(the)h(pa)m(wn)f(on)h(2d.)41 -b(Making)29 b(the)h(righ)m(t)150 737 y(decision)c(in)g(momen)m(ts)i -(lik)m(e)f(this)f(often)i(mak)m(es)g(the)g(di\013erence)f(b)s(et)m(w)m -(een)h(a)g(win)d(and)i(a)h(loss:)39 b(miss)26 b(one)150 -847 y(attac)m(king)39 b(c)m(hance)f(and)f(y)m(ou)g(will)d(b)s(e)j -(forced)g(to)h(defend)e(the)i(whole)e(game)i(un)m(til)d(the)j(una)m(v)m -(oidable)150 956 y(defeat;)i(on)c(the)g(other)g(hand,)h(an)e(unsound)f -(attac)m(k)39 b(can)d(destro)m(y)g(all)f(\\a)5 b(ji")37 -b(\(=p)s(oten)m(tial,)g(meaning)150 1066 y(p)s(ossibilities,)26 -b(threats\))31 b(without)f(getting)h(an)m(ything)f(in)f(return.)39 -b(])275 1200 y(19.)i(Rx2d)30 b(Nx4e)i(20.)41 b(Nx4e)31 -b(Rx4e)h(21.)41 b(R2a)p Fg(+)31 b Fj(P*4g)150 1310 y([)k(No)m(w)h(it)f -(b)s(ecomes)g(clear)g(wh)m(y)g(blac)m(k's)g(10.)56 b(S6h)35 -b(w)m(as)g(not)h(go)s(o)s(d.)54 b(Had)36 b(this)e(mo)m(v)m(e)i(b)s(een) -f(omitted,)150 1420 y(then)f(white)f(w)m(ould)g(not)i(ha)m(v)m(e)h(had) -d(the)i(time)f(to)h(pla)m(y)f(13...)54 b(S7b)33 b(and)h(after)h(R2a)p -Fg(+)g Fj(the)f(gold)g(on)g(6a)150 1529 y(w)m(ould)25 -b(hang.)40 b(Th)m(us)25 b(blac)m(k)i(w)m(ould)e(ha)m(v)m(e)j(k)m(ept)f -(\\sen)m(te")i(\(=initiativ)m(e\).)38 b(Instead)27 b(of)g(21...)40 -b(P*4g,)29 b(B*6d)150 1639 y(is)h(a)h(v)m(ery)g(go)s(o)s(d)g(mo)m(v)m -(e,)h(b)s(ecause)f(after)h(22.)42 b(P*2h)31 b(blac)m(k)g(do)s(es)g(not) -g(ha)m(v)m(e)h(a)f(pa)m(wn)f(in)g(hand)f(an)m(ymore)150 -1748 y(and)g(he)h(is)f(b)s(eing)g(threatened)h(with)f(the)h(anno)m -(ying)g(22...)42 b(N*4f)31 b(23.)41 b(G5g)31 b(N3h)p -Fg(+)f Fj(24.)42 b(S4g)30 b Fg(+)p Fj(N4h)g(also.)150 -1858 y(Blac)m(k)j(can)g(also)f(coun)m(ter)h(21...)47 -b(B*6d)33 b(with)e(22.)47 b(N*3g.)h(White)32 b(w)m(ould)f(then)h(reply) -f(with)g(22...)47 b(R4b)150 1968 y(23.)40 b(B*3c)29 b(P*4g)e(24.)41 -b(Bx4b)p Fg(+)26 b Fj(Sx4b.)39 b(The)26 b(white)g(ro)s(ok)h(has)f(pla)m -(y)m(ed)h(its)f(role)g(and)g(instead)g(of)g(sp)s(ending)150 -2077 y(mo)m(v)m(es)k(on)f(sa)m(ving)g(it)g(white)f(starts)h(to)h -(scatter)h(blac)m(k's)e(defences)g(b)m(y)g(successiv)m(e)g(pa)m(wn)g -(drops)f(on)h(the)150 2187 y(fourth)i(\014le:)42 b(25.)j(Gx4g)33 -b(P*4f)f(26.)46 b(G5g)32 b(N*6e)h(27.)46 b(G5h)32 b(P4g)p -Fg(+)g Fj(28.)45 b(Gx4g)33 b(P*4f.)45 b(This)29 b(analysis)i(w)m(as)150 -2296 y(pro)m(vided)k(b)m(y)h(Kato)i(Hifumi,)d(9-dan)i(professional)e -(\(the)i(highest)e(regular)h(grade\).)60 b(Destro)m(ying)37 -b(the)150 2406 y(coherence)25 b(of)g(the)f(enem)m(y)h(pieces)f(\(their) -g(shap)s(e\))g(b)m(y)g(dropping)e(pa)m(wns)i(is)f(one)i(of)g(the)f -(most)h(imp)s(ortan)m(t)150 2516 y(Shogi)k(tec)m(hniques.)41 -b(With)30 b(the)g(actual)h(mo)m(v)m(e)h(21...)42 b(P*4g)31 -b(white)f(missed)f(a)i(go)s(o)s(d)f(c)m(hance.)42 b(])275 -2650 y(22.)f(Sx4g)31 b(P*4f)g(23.)41 b(B*3g)32 b(Px4g)p -Fg(+)f Fj(24.)42 b Fg(+)p Fj(Rx6a)30 b Fg(+)p Fj(Px3g)150 -2760 y([)38 b(23.)64 b(B*3g)40 b(seems)e(p)s(oin)m(tless,)g(but)g(a)g -(closer)g(lo)s(ok)f(rev)m(eals)i(that)f(it)g(is)f(actually)g(quite)g -(mean.)64 b(On)150 2869 y(mo)m(v)m(e)38 b(24)f(white)e(cannot)i -(capture)g(blac)m(k's)f(\\Ryu")g(\(=dragon)h(=promoted)f(ro)s(ok\))g -(with)f(his)g(silv)m(er:)150 2979 y(24...)53 b(Sx6a)35 -b(25.)53 b(N*7d)34 b(K7b)g(26.)53 b(G*8b)34 b(mate.)53 -b(By)35 b(attac)m(king)g(the)g(fron)m(t)f(of)g(the)h(white)e(castle)i -(and)150 3088 y(threatening)26 b(to)h(mate)g(him)e(there,)i(blac)m(k)g -(has)f(the)g(c)m(hance)h(to)g(break)f(do)m(wn)g(the)h(white)e(defences) -h(from)150 3198 y(the)31 b(side.)39 b(])275 3333 y(25.)i -Fg(+)p Fj(Rx5b)30 b(S*6b)150 3442 y([)h(Here)h(25...)44 -b(B*4d)32 b(w)m(ould)e(b)s(e)g(m)m(uc)m(h)h(b)s(etter,)h(b)s(ecause)f -(it)g(is)f(defensiv)m(e)g(and)h(attac)m(king)h(at)g(the)g(same)150 -3552 y(time.)44 b(After)32 b(e.g.)45 b(26.)g(G*4c)34 -b(Bx9i)p Fg(+)d Fj(27.)45 b(Gx5c)33 b(blac)m(k)e(threatens)h(28.)46 -b Fg(+)p Fj(Rx7b)31 b(Kx7b)g(29.)45 b(S*6a)32 b(K8b)150 -3661 y(30.)44 b(S*7a)33 b(Kx7a)e(31.)45 b(G*7b)32 b(mate.)44 -b(White)31 b(is)g(one)g(mo)m(v)m(e)i(quic)m(k)m(er,)f(ho)m(w)m(ev)m -(er.)45 b(He)32 b(has)f(the)g(follo)m(wing)150 3771 y(b)s(eautiful)d -(\\tsume")k(\(mating)f(sequence)h(where)e(ev)m(ery)i(mo)m(v)m(e)g(is)e -(c)m(hec)m(k\):)44 b(27...)g(N*8f)32 b(28.)43 b(Px8f)31 -b(S*8g)150 3880 y(29.)53 b(Kx8g)35 b(B*9h)g(30.)54 b(K7h)34 -b(Bx8i)p Fg(+)g Fj(31.)53 b(K8g)35 b Fg(+)p Fj(B8i-8h)f(32.)54 -b(K9f)34 b(L*9e)h(mate.)54 b(This)32 b(illustrates)h(the)150 -3990 y(sharpness)c(of)h(Shogi:)40 b(one)31 b(mo)m(v)m(e)h(can)e(mak)m -(e)i(the)e(di\013erence)g(b)s(et)m(w)m(een)h(winning)d(and)h(losing.)40 -b(])275 4125 y(26.)h(P*4f)31 b(Rx4f)150 4234 y([)37 b(This)d(mo)m(v)m -(e)39 b(eliminates)34 b(white's)i(last)h(c)m(hances.)60 -b(26...)g(R4b)37 b(27.)60 b Fg(+)p Fj(Rx4b)36 b(Sx4b)g(28.)60 -b(R*4a)38 b(seems)150 4344 y(anno)m(ying,)33 b(but)e(after)i(28...)48 -b(B*3c)34 b(29.)48 b(S7g)33 b(B*3b)g(white)e(wins)g(the)h(ro)s(ok)h -(and)e(with)g(his)g(\\tokin")i(on)150 4453 y(3g)e(there)g(still)d(is)h -(some)i(hop)s(e.)40 b(])275 4588 y(27.)h(N*6e)32 b Fg(+)p -Fj(P4g)150 4697 y([)j(White)g(cannot)h(defend)e(an)m(ymore,)j(so)f(he)f -(starts)g(a)h(desp)s(erate)f(attac)m(k.)57 b(Blac)m(k)36 -b(do)s(es)f(not)h(lose)f(the)150 4807 y(righ)m(t)30 b(trac)m(k,)i(ho)m -(w)m(ev)m(er.)42 b(])275 4941 y(28.)52 b(Nx5c)p Fg(+)35 -b(+)p Fj(Px5h)e(29.)52 b Fg(+)p Fj(Nx6b)34 b Fg(+)p Fj(Px6h)g(30.)52 -b(Gx6h)34 b(N*8f)h(31.)52 b(Px8f)34 b(B*6i)h(32.)52 b(Gx6i)34 -b(R4h)p Fg(+)g Fj(33.)150 5051 y(N*6h)d Fg(+)p Fj(Rx6h)f(34.)41 -b(Gx6h)31 b(S*8g)g(35.)42 b(Kx8g)31 b(N*9e)g(36.)42 b(K7h)30 -b(Resigns)150 5161 y([)h(White)f(resigns)f(here,)i(b)s(ecause)f(after)h -(36...)42 b(B*8g)32 b(27.)41 b(K7g)31 b(his)e(attac)m(k)k(has)d(p)s -(etered)g(out.)41 b(])p eop -%%Page: 22 24 -22 23 bop 150 -116 a Fj(22)2734 b(GNU)31 b(Shogi)f(man)m(ual)150 -299 y Fk(2.3)68 b(Mating)46 b(problems)275 491 y Fj(One)29 -b(go)s(o)s(d)h(w)m(a)m(y)h(to)f(impro)m(v)m(e)g(at)h(shogi)e(is)g(to)i -(solv)m(e)f(mating)g(problems.)39 b(There)29 b(are)i(sev)m(eral)f(t)m -(yp)s(es)150 601 y(of)38 b(these)h(problems,)f(but)f(the)i(most)f -(common)g(is)f(called)h(a)g(\\tsume-shogi")h(problem,)f(or)g(\\tsume") -150 711 y(problem)26 b(for)i(short.)40 b(In)27 b(a)i(tsume)e(problem,)g -(all)g(pieces)h(that)h(are)f(not)g(on)g(the)h(b)s(oard)e(are)h(assumed) -f(to)150 820 y(b)s(e)h(in)f(the)i(opp)s(onen)m(t's)f(hand)g(\(except)i -(for)e(y)m(our)h(King,)f(whic)m(h)f(is)h(usually)e(not)j(sho)m(wn\).)40 -b(Ev)m(ery)28 b(mo)m(v)m(e)150 930 y(y)m(ou)33 b(mak)m(e)g(m)m(ust)g(b) -s(e)f(c)m(hec)m(k)i(un)m(til)c(the)j(\014nal)e(c)m(hec)m(kmate.)50 -b(Y)-8 b(our)33 b(opp)s(onen)m(t)f(ma)m(y)h(pla)m(y)f(an)m(y)h(piece)f -(on)150 1039 y(the)37 b(b)s(oard)e(or)i(drop)e(an)m(y)i(of)g(his)e -(pieces)h(in)f(hand)g(in)h(order)g(to)h(prev)m(en)m(t)g(the)g(mate.)60 -b(In)35 b(a)i(prop)s(erly)150 1149 y(constructed)32 b(tsume)g(problem,) -g(all)f(of)h(y)m(our)g(pieces)g(on)g(the)h(b)s(oard)e(and)h(in)e(hand)i -(m)m(ust)g(b)s(e)f(essen)m(tial)150 1259 y(to)i(the)g(solution.)46 -b(One)32 b(consequence)h(of)g(this)e(is)h(that)h(all)e(of)i(y)m(our)g -(pieces)f(in)f(hand)h(m)m(ust)g(b)s(e)g(pla)m(y)m(ed)150 -1368 y(during)38 b(the)h(solution.)68 b(There)39 b(should)f(only)h(b)s -(e)g(one)h(correct)h(solution)d(for)i(the)g(giv)m(en)f(n)m(um)m(b)s(er) -g(of)150 1478 y(mo)m(v)m(es.)59 b(Tsume)36 b(problems)e(use)i -(Japanese-st)m(yle)h(mo)m(v)m(e)g(n)m(um)m(b)s(ering;)g(th)m(us,)h(a)e -(problem)f(where)h(y)m(ou)150 1587 y(mo)m(v)m(e)e(\(and)f(giv)m(e)h(c)m -(hec)m(k\),)i(y)m(our)c(opp)s(onen)m(t)h(mo)m(v)m(es,)i(and)e(y)m(ou)g -(mo)m(v)m(e)i(to)e(giv)m(e)h(c)m(hec)m(kmate)h(is)d(called)h(a)150 -1697 y(three-mo)m(v)m(er.)42 b(Here)31 b(is)f(a)g(really)g(trivial)e -(three-mo)m(v)m(er:)293 1916 y Fg(3)191 b(2)f(1)150 2026 -y(----------------+)198 2135 y(|)g(|)h(|)g(|)95 b(a)150 -2245 y(----------------+)198 2355 y(|)190 b(|)h(|)47 -b(wK)h(|)95 b(b)150 2464 y(----------------+)198 2574 -y(|)190 b(|)h(|)g(|)95 b(c)150 2683 y(----------------+)198 -2793 y(|)47 b(bN)g(|)191 b(|)g(|)95 b(d)150 2902 y(----------------+) -198 3012 y(|)190 b(|)h(|)g(|)95 b(e)150 3122 y(----------------+)198 -3231 y(|)190 b(|)48 b(bN)f(|)191 b(|)95 b(f)150 3341 -y(----------------+)150 3450 y(Black)46 b(in)i(hand:)94 -b(2G)275 3794 y Fj(Here,)38 b(Blac)m(k)f(pla)m(ys)f(G*2b,)j(White)d -(pla)m(ys)g(K1c,)i(and)e(Blac)m(k)h(pla)m(ys)f(G*1d)h(mate.)59 -b(More)37 b(t)m(ypical)150 3904 y(tsume)28 b(problems)f(range)i(from)g -(5)g(mo)m(v)m(es)h(to)f(arbitrarily)d(high)h(n)m(um)m(b)s(ers)g(of)i -(mo)m(v)m(es,)i(and)d(they)h(can)g(b)s(e)150 4013 y(quite)k -(brain-busting.)49 b(Tsume)33 b(problems)f(ma)m(y)j(seem)f -(arti\014cial,)g(but)f(in)g(the)h(closing)f(stages)j(of)e(the)150 -4123 y(game)d(where)e(b)s(oth)h(pla)m(y)m(ers)g(ha)m(v)m(e)h(a)f(lot)g -(of)g(pieces)g(in)f(hand,)g(it)h(is)f(often)h(necessary)g(to)h(giv)m(e) -g(c)m(hec)m(k)g(at)150 4232 y(ev)m(ery)h(mo)m(v)m(e,)h(or)e(else)f(y)m -(our)h(opp)s(onen)m(t)g(will)d(start)k(a)f(coun)m(terattac)m(k)j(and)d -(will)d(mate)k(y)m(ou)f(b)s(efore)g(y)m(ou)150 4342 y(mate)25 -b(him.)37 b(A)23 b(tsume)h(problem)e(is)h(a)h(w)m(orst-case)i(scenario) -d(for)h(the)g(attac)m(k)m(er:)40 b(y)m(ou)24 b(ha)m(v)m(e)h(to)f(mate)h -(y)m(our)150 4452 y(opp)s(onen)m(t)k(ev)m(en)h(though)f(he)g(has)g(ev)m -(ery)h(piece)f(not)h(on)f(the)g(b)s(oard)f(in)g(hand,)h(whic)m(h)f -(means)h(y)m(ou)h(ha)m(v)m(e)150 4561 y(to)d(dev)m(elop)g(sharp)e -(attac)m(king)j(skills.)37 b(Man)m(y)27 b(more)f(tsume)h(problems)d -(can)j(b)s(e)f(found)f(on)h(the)h(in)m(ternet;)150 4671 -y(I)36 b(particularly)f(recommend)h(P)m(atric)m(k)i(Da)m(vin's)f -(\\Shogi)f(Nexus")h(\(see)h(Chapter)e(5)h([References)h(and)150 -4780 y(links],)29 b(page)i(41\).)p eop -%%Page: 23 25 -23 24 bop 150 -116 a Fj(Chapter)30 b(2:)41 b(Ab)s(out)30 -b(the)g(game)i(of)e(shogi)2061 b(23)150 299 y Fk(2.4)68 -b(Shogi)45 b(v)-7 b(arian)l(ts)275 500 y Fj(Sev)m(eral)39 -b(historical)e(v)-5 b(arian)m(ts)39 b(of)g(shogi)g(exist.)67 -b(Most)40 b(of)f(these)h(w)m(ere)f(in)m(v)m(en)m(ted)h(b)s(efore)e(mo)s -(dern)150 610 y(shogi)29 b(\(in)f(some)h(cases)h(h)m(undreds)d(of)i(y)m -(ears)h(b)s(efore\),)g(are)f(m)m(uc)m(h)g(larger)g(than)g(mo)s(dern)f -(shogi)g(and)h(are)150 719 y(not)38 b(pla)m(y)m(ed)g(with)e(drops.)62 -b(Th)m(us,)39 b(in)e(man)m(y)h(w)m(a)m(ys)g(they)g(are)h(really)d(more) -i(lik)m(e)g(gian)m(t)g(c)m(hess)g(games)150 829 y(than)g(lik)m(e)g(mo)s -(dern)f(shogi.)65 b(The)38 b(only)f(one)i(of)g(these)g(games)g(to)g(ha) -m(v)m(e)h(surviv)m(ed)d(in)g(Japan)h(is)g(Ch)m(u)150 -938 y(\(middle\))e(shogi,)i(whic)m(h)e(is)g(still)g(pla)m(y)m(ed)h(a)g -(little)g(bit.)60 b(Thanks)36 b(to)i(the)f(e\013orts)h(of)g(George)h -(Ho)s(dges)150 1048 y(and)c(John)g(F)-8 b(airbairn)34 -b(of)i(the)g(Shogi)f(Asso)s(ciation)g(\(t)m(w)m(o)i(British)d(shogi)h -(en)m(th)m(usiasts\),)j(these)e(games)150 1157 y(w)m(ere)h(resurrected) -g(and)f(rules)g(and)g(sets)h(for)g(them)g(can)g(still)d(b)s(e)j(purc)m -(hased)f(from)g(George)j(Ho)s(dges)150 1267 y(\(see)31 -b(Chapter)e(5)h([References)h(and)e(links],)f(page)j(41\).)41 -b(I)30 b(hop)s(e)f(to)h(ev)m(en)m(tually)g(extend)g(GNU)g(shogi)g(so) -150 1377 y(that)f(it)f(can)g(pla)m(y)g(at)h(least)g(some)g(of)f(these)h -(games.)41 b(There)28 b(are)h(also)f(sev)m(eral)h(non-historical)d(v)-5 -b(arian)m(ts)150 1486 y(of)33 b(shogi;)h(I)e(don't)h(kno)m(w)g(m)m(uc)m -(h)g(ab)s(out)g(them)g(but)f(y)m(ou)h(can)g(\014nd)e(information)h(ab)s -(out)g(them)h(on)g(the)150 1596 y(in)m(ternet)d(\(see)h(Chapter)f(5)h -([References)g(and)f(links],)f(page)i(41\).)275 1739 -y(The)e(historical)g(v)-5 b(arian)m(ts)30 b(include:)199 -1958 y(1.)61 b(T)-8 b(ori)32 b(\(bird\))f(shogi,)h(pla)m(y)m(ed)h(on)f -(a)h(7x7)g(b)s(oard)e(with)g(32)i(pieces)g(in)e(all;)h(this)f(is)h(the) -g(only)g(v)-5 b(arian)m(t)330 2068 y(that)31 b(is)e(kno)m(wn)h(to)h(ha) -m(v)m(e)h(b)s(een)e(pla)m(y)m(ed)g(with)f(drops.)199 -2206 y(2.)61 b(W)-8 b(a)32 b(shogi,)e(pla)m(y)m(ed)h(on)g(an)f(11x11)j -(b)s(oard)d(with)f(54)j(pieces.)41 b(This)29 b(game)j(can)f(b)s(e)f -(pla)m(y)m(ed)h(with)e(or)330 2316 y(without)34 b(drops)g(but)h(the)g -(historical)f(evidence)h(fa)m(v)m(ors)h(the)g(view)e(that)i(it)f(w)m -(as)h(pla)m(y)m(ed)f(without)330 2425 y(drops.)57 b(Ho)m(w)m(ev)m(er,) -40 b(most)c(p)s(eople)f(who)h(ha)m(v)m(e)h(tried)f(it)f(claim)g(it)h -(is)f(a)i(m)m(uc)m(h)f(b)s(etter)g(game)h(with)330 2535 -y(drops,)29 b(b)s(eing)g(ev)m(en)j(more)e(in)m(tricate)g(than)h -(standard)e(shogi.)199 2674 y(3.)61 b(Ch)m(u)30 b(\(middle\))f(shogi,)i -(pla)m(y)m(ed)f(on)h(a)g(12x12)i(b)s(oard)d(with)f(92)j(pieces.)42 -b(This)29 b(w)m(as)i(\(and)f(is\))g(b)m(y)h(far)330 2783 -y(the)36 b(most)f(p)s(opular)f(of)h(the)h(v)-5 b(arian)m(ts,)37 -b(and)e(has)g(21)h(di\013eren)m(t)f(kinds)f(of)h(pieces)g(in)g(the)g -(starting)330 2893 y(line-up)28 b(alone)i(\(along)h(with)e(sev)m(eral)h -(others)h(that)f(app)s(ear)g(up)s(on)f(promotion\).)40 -b(Unlik)m(e)29 b(mo)s(dern)330 3003 y(shogi,)h(there)g(are)g(a)h -(tremendous)e(n)m(um)m(b)s(er)g(of)h(ranging)f(pieces)h(and)f(the)i -(game)g(is)e(de\014nitely)f(not)330 3112 y(pla)m(y)m(ed)j(with)f -(drops.)42 b(There)30 b(is)g(also)h(an)g(amazing)h(piece)f(called)f -(the)h(Lion)f(whic)m(h)g(has)h(a)g(double)330 3222 y(king)36 -b(mo)m(v)m(e)j(and)d(can)i(capture)f(t)m(w)m(o)i(pieces)d(at)i(once!)62 -b(Ch)m(u)36 b(shogi)h(has)g(a)g(small)f(but)g(fanatical)330 -3331 y(follo)m(wing,)29 b(some)i(of)f(whom)g(consider)f(it)h(b)s(etter) -h(than)f(mo)s(dern)f(shogi.)199 3470 y(4.)61 b(Dai)40 -b(\(great\))h(shogi,)h(pla)m(y)m(ed)d(on)h(a)f(15x15)j(b)s(oard)c(with) -g(130)j(pieces.)68 b(Other)39 b(than)h(the)f(larger)330 -3580 y(b)s(oard,)30 b(this)f(game)i(is)f(v)m(ery)g(similar)e(to)j(Ch)m -(u)f(shogi.)199 3718 y(5.)61 b(T)-8 b(enjiku)26 b(\(exotic\))j(shogi,)e -(pla)m(y)m(ed)g(on)h(a)f(16x16)i(b)s(oard)e(with)f(176)i(pieces.)40 -b(This)25 b(game)j(is)f(p)s(ossibly)330 3828 y(the)35 -b(most)g(complex)f(tactical)i(game)g(in)d(existence.)54 -b(There)35 b(are)g(man)m(y)g(astoundingly)d(p)s(o)m(w)m(erful)330 -3938 y(pieces,)c(including)c(one)k(\(the)g(Fire)f(Demon\))i(that)f(can) -g(capture)f(up)g(to)h(eigh)m(t)g(opp)s(osing)e(pieces)h(in)330 -4047 y(a)j(single)e(mo)m(v)m(e!)42 b(Despite)30 b(the)f(size)h(of)g -(the)f(game,)i(c)m(hec)m(kmates)h(can)e(o)s(ccur)f(v)m(ery)h(suddenly)d -(\(and)330 4157 y(often)34 b(v)m(ery)h(early)f(on\))g(if)f(one)h(pla)m -(y)m(er)g(mak)m(es)h(a)g(wrong)e(mo)m(v)m(e.)53 b(T)-8 -b(enjiku)33 b(also)h(has)g(a)g(small)f(but)330 4266 y(fanatical)27 -b(follo)m(wing,)f(one)h(of)g(whom)f(\(Colin)g(Adams\))h(has)f(written)g -(a)h(b)s(o)s(ok)g(on)f(the)h(game)h(whic)m(h)330 4376 -y(is)h(a)m(v)-5 b(ailable)30 b(for)g(do)m(wnload)g(at)h -Fg(http://www.colina.demon.)o(co.u)o(k/te)o(nji)o(ku.h)o(tml)o -Fj(.)199 4515 y(6.)61 b(Dai-dai)39 b(\(great-great\))k(shogi,)e(pla)m -(y)m(ed)e(on)g(a)h(17x17)h(b)s(oard)d(with)g(192)j(pieces.)67 -b(The)38 b(op)s(ening)330 4624 y(setup)29 b(alone)g(has)h(64)g -(di\013eren)m(t)f(kinds)e(of)j(pieces!)40 b(This)28 b(game)i(and)f(the) -h(larger)f(ones)h(that)g(follo)m(w)330 4734 y(sound)35 -b(prett)m(y)j(outlandish,)e(but)g(they)h(ha)m(v)m(e)h(actually)e(b)s -(een)g(pla)m(y)m(ed;)k(a)d(game)h(of)e(Dai-dai)h(can)330 -4843 y(supp)s(osedly)28 b(b)s(e)h(pla)m(y)m(ed)i(in)e(ab)s(out)h(12)h -(hours.)199 4982 y(7.)61 b(Mak)-5 b(a-dai-dai)33 b -(\(great-great-great\))k(shogi,)c(pla)m(y)m(ed)g(on)g(a)g(19x19)h(b)s -(oard)e(with)f(192)j(pieces.)47 b(F)-8 b(or)330 5092 -y(those)31 b(for)f(whom)g(Dai-dai)g(shogi)f(is)h(just)g(to)s(o)h(small) -e(:-\))199 5230 y(8.)61 b(T)-8 b(ai)35 b(\(grand\))g(shogi,)h(pla)m(y)m -(ed)f(on)g(a)h(25x25)h(b)s(oard)d(with)g(354)i(pieces!)55 -b(Un)m(til)34 b(recen)m(tly)-8 b(,)38 b(this)c(w)m(as)330 -5340 y(though)m(t)d(to)g(b)s(e)f(the)g(biggest)h(c)m(hess)g(game)g(ev)m -(er)g(devised,)f(but)f(no)m(w)i(there)f(is...)p eop -%%Page: 24 26 -24 25 bop 150 -116 a Fj(24)2734 b(GNU)31 b(Shogi)f(man)m(ual)199 -299 y(9.)61 b(Ky)m(oku)36 b(tai)g(\(extremely)h(grand?\))57 -b(shogi,)37 b(pla)m(y)m(ed)f(on)g(a)g(36x36)i(b)s(oard)d(with)g(402)i -(pieces.)57 b(The)330 408 y(rules)22 b(for)g(this)g(ha)m(v)m(e)j(just)d -(b)s(een)h(unearthed)f(in)g(an)h(old)f(Japanese)h(b)s(o)s(ok.)38 -b(Hop)s(efully)21 b(someone)j(will)330 518 y(so)s(on)36 -b(organize)h(a)f(p)s(ostal)g(Ky)m(oku)g(tai)g(shogi)g(c)m(hampionship;) -h(ma)m(yb)s(e)f(their)f(distan)m(t)h(ancestors)330 628 -y(could)29 b(\014nish)f(it)i(:-\))330 768 y(It)40 b(is)g(though)m(t)h -(that)f(the)h(really)e(h)m(uge)i(games)g(\(Dai-dai)f(and)g(up\))f(w)m -(ere)i(nev)m(er)g(really)e(pla)m(y)m(ed)330 877 y(to)k(an)m(y)f -(signi\014can)m(t)f(exten)m(t)i(\(gee,)j(w)m(onder)c(wh)m(y?\))75 -b(and)41 b(w)m(ere)h(devised)f(merely)g(so)h(that)h(the)330 -987 y(creators)38 b(could)e(ha)m(v)m(e)j(the)e(fun)f(of)h(in)m(v)m(en)m -(ting)g(enormous)g(games,)j(amazing)d(their)g(friends)e(and)330 -1096 y(confounding)27 b(their)h(enemies.)40 b(Ho)m(w)m(ev)m(er,)32 -b(the)d(games)h(up)d(to)j(T)-8 b(enjiku)28 b(shogi)g(at)i(least)f(app)s -(ear)f(to)330 1206 y(b)s(e)i(quite)g(pla)m(y)m(able,)g(assuming)f(one)h -(has)h(the)f(time.)150 1521 y Fk(2.5)68 b(Di\013erences)46 -b(b)t(et)l(w)l(een)g(shogi)g(and)f(c)l(hess)275 1725 -y Fj(Some)22 b(di\013erences)g(b)s(et)m(w)m(een)h(shogi)f(and)g(in)m -(ternational)g(c)m(hess)h(ha)m(v)m(e)g(b)s(een)f(men)m(tioned)g -(elsewhere)g(in)150 1834 y(this)h(do)s(cumen)m(t;)j(I)e(summarize)f -(them)h(here)f(for)h(p)s(eople)f(who)h(are)g(in)m(terested)g(in)f(game) -i(comparisons.)37 b(I)150 1944 y(w)m(on't)27 b(try)g(to)g(deal)g(with)e -(the)i(thorn)m(y)f(question)g(of)h(whic)m(h)f(game)h(is)f(\\b)s(etter") -i(although)e(m)m(y)h(bias)e(ma)m(y)150 2053 y(ha)m(v)m(e)37 -b(already)e(come)h(through)f(:-\))h(In)f(fact,)j(the)d(drop)g(rule)f -(mak)m(es)i(the)g(t)m(w)m(o)g(games)h(so)e(di\013eren)m(t)g(in)150 -2163 y(c)m(haracter)28 b(that)g(arguing)e(o)m(v)m(er)i(whic)m(h)d(game) -j(is)e(b)s(etter)h(is)f(lik)m(e)g(comparing)g(apples)g(to)h(oranges)g -(\(y)m(ou'd)150 2273 y(b)s(e)43 b(b)s(etter)g(o\013)h(comparing)f(c)m -(hess)g(to)i(Ch)m(u)d(shogi)h(\(see)h(Section)f(2.4)i([Shogi)d(v)-5 -b(arian)m(ts],)47 b(page)d(23\).)150 2382 y(Ho)m(w)m(ev)m(er,)39 -b(I)c(b)s(eliev)m(e)f(that)i(if)e(y)m(ou)i(are)g(a)f(c)m(hess)h(fan)f -(y)m(ou'll)g(really)f(lik)m(e)g(shogi)h(as)h(w)m(ell,)f(and)g(shogi)g -(is)150 2492 y(also)30 b(p)s(opular)e(with)i(man)m(y)g(p)s(eople)f(who) -h(don't)h(particularly)d(lik)m(e)h(c)m(hess.)275 2637 -y(Here)h(are)h(the)g(signi\014can)m(t)e(di\013erences)h(b)s(et)m(w)m -(een)h(c)m(hess)g(and)e(shogi:)199 2856 y(1.)61 b(In)26 -b(shogi,)i(captured)f(pieces)g(b)s(ecome)g(the)g(prop)s(ert)m(y)g(of)g -(the)g(capturer)g(and)g(can)g(re-en)m(ter)h(pla)m(y)f(b)m(y)330 -2966 y(b)s(eing)h(dropp)s(ed)f(on)m(to)j(almost)g(an)m(y)f(v)-5 -b(acan)m(t)31 b(square.)40 b(In)28 b(c)m(hess,)i(captured)f(pieces)g -(are)h(out)f(of)h(the)330 3076 y(game.)45 b(Th)m(us,)32 -b(in)e(shogi,)h(piece)h(exc)m(hanges)h(complicate)f(the)g(pla)m(y)f -(signi\014can)m(tly)f(while)f(in)h(c)m(hess)330 3185 -y(they)h(simplify)26 b(it.)199 3325 y(2.)61 b(The)30 -b(shogi)g(b)s(oard)f(is)g(9x9;)j(the)e(c)m(hess)h(b)s(oard)f(is)f(8x8.) -199 3465 y(3.)61 b(Shogi)37 b(has)g(\014v)m(e)h(pieces)g(with)e(no)i -(coun)m(terpart)g(in)f(c)m(hess:)56 b(the)38 b(gold)f(and)g(silv)m(er)g -(generals,)j(the)330 3575 y(lance,)47 b(the)d(promoted)g(ro)s(ok)g(and) -f(the)h(promoted)g(bishop.)79 b(Chess)43 b(has)h(one)g(piece)g(with)e -(no)330 3684 y(coun)m(terpart)33 b(in)f(shogi:)45 b(the)33 -b(queen.)48 b(The)33 b(knigh)m(t's)f(mo)m(v)m(e)i(in)e(shogi)g(is)g(m)m -(uc)m(h)h(more)g(restrictiv)m(e)330 3794 y(than)f(in)f(c)m(hess.)46 -b(Pieces)32 b(in)f(shogi)g(generally)g(ha)m(v)m(e)j(a)e(m)m(uc)m(h)g -(smaller)f(range)h(of)g(mo)m(v)m(emen)m(t)i(than)330 -3903 y(in)29 b(c)m(hess)i(\(unless)e(they)h(are)h(in)e(hand\).)199 -4043 y(4.)61 b(In)30 b(shogi,)h(all)f(pieces)h(except)g(the)h(gold)e -(general)h(and)f(the)i(king)e(can)h(promote,)h(but)e(only)g(to)i(one) -330 4153 y(kind)c(of)i(piece.)41 b(Promotion)29 b(is)g(easier)h(in)e -(shogi)i(b)s(ecause)g(the)g(promotion)f(zone)h(is)f(closer)h(to)h(the) -330 4263 y(starting)25 b(p)s(osition)e(of)i(the)g(pieces)f(\(esp)s -(ecially)g(pa)m(wns\).)39 b(In)24 b(c)m(hess,)i(only)e(the)i(pa)m(wn)e -(can)h(promote,)330 4372 y(but)30 b(it)g(can)g(promote)h(to)g(an)m(y)g -(other)g(piece)f(except)h(the)g(king.)199 4512 y(5.)61 -b(In)32 b(shogi,)g(pa)m(wns)g(capture)h(the)f(same)h(w)m(a)m(y)g(they)g -(mo)m(v)m(e.)48 b(There)32 b(is)g(no)g(initial)e(t)m(w)m(o-space)k(pa)m -(wn)330 4622 y(mo)m(v)m(e)42 b(and)e(hence)h(no)f Fd(en-p)-5 -b(assant)51 b Fj(captures.)71 b(In)40 b(c)m(hess,)k(pa)m(wns)c(capture) -g(diagonally)f(whic)m(h)330 4731 y(means)30 b(that)h(opp)s(osing)e(pa)m -(wns)h(can)g(blo)s(c)m(k)g(eac)m(h)i(other.)199 4871 -y(6.)61 b(In)25 b(shogi,)i(y)m(ou)g(only)e(ha)m(v)m(e)j(one)e(ro)s(ok)g -(and)g(one)g(bishop.)38 b(Note)27 b(that)g(the)f(bishop)f(is)g(not)h -(restricted)330 4981 y(to)36 b(only)e(one)h(\\color")i(square)d -(\(squares)h(in)f(shogi)h(aren't)g(colored,)i(but)d(nev)m(er)i(mind\))d -(b)s(ecause)330 5090 y(promoted)d(bishops)f(can)h(also)h(mo)m(v)m(e)g -(one)g(square)f(orthogonally)-8 b(.)199 5230 y(7.)61 -b(There)26 b(is)g(no)g(sp)s(ecial)f(castling)h(mo)m(v)m(e)i(in)d -(shogi.)39 b(The)26 b(term)h(\\castle")h(is)d(used)h(in)f(shogi)h(to)h -(denote)330 5340 y(a)42 b(defensiv)m(e)g(formation)g(consisting)f(of)h -(\(usually\))e(three)j(generals)e(whic)m(h)g(protect)i(the)g(king.)p -eop -%%Page: 25 27 -25 26 bop 150 -116 a Fj(Chapter)30 b(2:)41 b(Ab)s(out)30 -b(the)g(game)i(of)e(shogi)2061 b(25)330 299 y(There)38 -b(are)g(man)m(y)h(suc)m(h)f(castles)h(\(ab)s(out)f(40)h(or)f(so)h(ha)m -(v)m(e)g(names\).)65 b(See)38 b(Section)h(2.2)g([Sample)330 -408 y(game],)32 b(page)f(19.)199 543 y(8.)61 b(Dra)m(ws)26 -b(are)f(m)m(uc)m(h)g(rarer)g(in)f(shogi)g(than)h(in)f(c)m(hess.)40 -b(P)m(erp)s(etual)24 b(c)m(hec)m(k)j(is)d(not)h(allo)m(w)m(ed.)39 -b(Stalemate)330 653 y(is)29 b(a)i(virtual)e(imp)s(ossibilit)m(y)-8 -b(,)26 b(and)k(is)g(a)g(loss)g(for)g(the)h(stalematee.)199 -787 y(9.)61 b(Since)33 b(pieces)h(are)g(nev)m(er)g(out)g(of)g(pla)m(y)g -(in)f(shogi,)h(c)m(hess-t)m(yp)s(e)h(endgames)f(in)m(v)m(olving)f(only) -g(a)h(few)330 897 y(pieces)c(do)g(not)h(o)s(ccur.)154 -1031 y(10.)61 b(Shogi)29 b(games)j(are)e(generally)g(longer)g(than)g(c) -m(hess)h(games)g(\(ab)s(out)g(60-70)h(mo)m(v)m(es)g(is)d(t)m(ypical\).) -154 1166 y(11.)61 b(Shogi)29 b(has)i(a)f(w)m(ell-dev)m(elop)s(ed)f -(handicap)g(system)i(whic)m(h)e(is)g(in)g(general)i(use;)f(c)m(hess)h -(do)s(es)f(not.)275 1435 y(The)f(e\013ects)j(of)f(all)e(these)i -(di\013erences)e(on)i(pla)m(y)f(include)e(\(in)h(m)m(y)i(opinion\):)199 -1654 y(1.)61 b(Piece/pa)m(wn)34 b(structures)f(in)f(c)m(hess)i(are)h -(more)e(rigid)f(than)h(in)g(shogi.)50 b(P)m(a)m(wns)34 -b(blo)s(c)m(k)f(eac)m(h)i(other)330 1763 y(and)22 b(pa)m(wns,)i(once)g -(adv)-5 b(anced,)25 b(cannot)e(ev)m(er)h(retreat.)39 -b(In)22 b(shogi,)i(y)m(ou)g(can)f(repair)e(the)i(hole)g(caused)330 -1873 y(b)m(y)32 b(a)h(pa)m(wn)g(adv)-5 b(ance)33 b(b)m(y)f(exc)m -(hanging)h(the)g(pa)m(wn)f(and)g(dropping)e(it)i(bac)m(k)i(where)e(y)m -(ou)h(w)m(an)m(t)g(it.)330 1983 y(Th)m(us)c(shogi)h(is)g(more)g -(\015uid)e(than)i(c)m(hess)h(and)f(less)g(\\structural".)199 -2117 y(2.)61 b(Coun)m(terattac)m(k)39 b(is)d(MUCH)h(more)f(common)h(in) -f(shogi)g(than)g(in)g(c)m(hess.)60 b(Games)37 b(t)m(ypically)f(end)330 -2227 y(in)e(m)m(utual)h(mating)g(attac)m(ks,)40 b(where)35 -b(eac)m(h)i(pla)m(y)m(er)e(is)g(trying)g(to)h(c)m(hec)m(kmate)i(the)e -(other)g(pla)m(y)m(er)330 2336 y(b)s(efore)k(b)s(eing)f(c)m(hec)m -(kmated)k(himself.)69 b(This)38 b(mak)m(es)k(temp)s(o)e(incredibly)d -(imp)s(ortan)m(t)j(and)g(also)330 2446 y(mak)m(es)31 -b(sacri\014cial)e(pla)m(y)h(quite)g(common.)199 2580 -y(3.)61 b(A)m(ttac)m(ks)43 b(in)m(v)m(olving)c(only)g(ranging)g(pieces) -i(are)f(more)h(a)f(feature)h(of)g(c)m(hess)f(than)g(of)h(shogi.)70 -b(A)330 2690 y(shogi)39 b(attac)m(k)j(t)m(ypically)c(uses)h(a)h -(ranging)f(piece)g(or)h(pieces)f(to)h(supp)s(ort)e(an)i(attac)m(k)i(b)m -(y)d(short-)330 2800 y(range)c(pieces)e(\(esp)s(ecially)g(generals\).) -53 b(It)34 b(is)f(v)m(ery)i(rare)f(to)h(mate)g(a)f(king)f(with)g(a)i -(non-adjacen)m(t)330 2909 y(ranging)40 b(piece)h(in)f(shogi)h(since)g -(the)g(pla)m(y)m(er)g(whose)g(king)g(is)f(threatened)i(can)f(almost)g -(alw)m(a)m(ys)330 3019 y(in)m(terp)s(ose)30 b(b)m(y)g(dropping)e(a)j -(piece.)p eop -%%Page: 26 28 -26 27 bop 150 -116 a Fj(26)2734 b(GNU)31 b(Shogi)f(man)m(ual)p -eop -%%Page: 27 29 -27 28 bop 150 -116 a Fj(Chapter)30 b(3:)41 b(gn)m(ushogi)2697 -b(27)150 299 y Fh(3)80 b(gn)l(ushogi)275 500 y Fj(This)28 -b(section)j(describ)s(es)d(ho)m(w)j(to)g(run)e(the)h(\\gn)m(ushogi")h -(program.)275 737 y(SYNOPSIS)275 975 y(gn)m(ushogi)d([)i([[-]a])h([-b)f -(b)s(o)s(ok\014le])e([-B)j(bin)m(b)s(o)s(ok\014le])c([-C])j([-h)f -(lang\014le])g([-L)h(lang\014le])e([-r)i(length])f([-R])150 -1084 y([-s)i(pathname])f([-l)g(pathname])h([-S)f(bin)m(b)s(o)s(oksize]) -f([-t])i([-c)h(size])e([-T)h(size])f([-v])h([-x])g([-X])h(arg1)f(arg2)g -(])275 1322 y(DESCRIPTION)275 1559 y(GNU)26 b(shogi)g(\(gn)m(ushogi\))h -(pla)m(ys)e(a)i(game)g(of)g(japanese)f(c)m(hess)h(\(shogi\))g(against)f -(the)h(user)e(or)i(it)e(pla)m(ys)150 1669 y(against)31 -b(itself.)275 1797 y(A)m(t)h(startup)f(gn)m(ushogi)g(reads)g(the)h(bin) -m(b)s(o)s(ok)e(\014le)g(if)h(it)g(is)f(presen)m(t.)45 -b(It)31 b(then)g(lo)s(oks)g(for)h(a)g(b)s(o)s(ok)f(\014le.)150 -1906 y(If)c(it)g(is)f(presen)m(t)h(it)g(adds)f(its)h(con)m(ten)m(ts)i -(to)f(the)f(bin)m(b)s(o)s(ok)f(data.)40 b(If)27 b(the)g(bin)m(b)s(o)s -(ok)f(\014le)g(is)g(writable)g(a)h(new)150 2016 y(com)m(bined)j(bin)m -(b)s(o)s(ok)e(\014le)i(is)f(written.)275 2144 y(Gn)m(ushogi)j(is)g(a)h -(mo)s(di\014ed)e(v)m(ersion)h(of)h(the)g(gn)m(uc)m(hess)h(program.)48 -b(It)33 b(has)g(a)g(simple)e(alphan)m(umeric)150 2253 -y(b)s(oard)g(displa)m(y)-8 b(,)31 b(or)h(it)f(can)h(b)s(e)g(used)f -(with)f(the)i(xshogi)f(program)h(under)e(X)i(windo)m(ws.)44 -b(The)31 b(program)150 2363 y(gets)j(its)e(op)s(ening)f(mo)m(v)m(es)j -(from)e(the)h(\014le)f(gn)m(ushogi.bbk)g(whic)m(h)f(is)h(lo)s(cated)h -(in)e(a)i(directory)g(sp)s(eci\014ed)150 2473 y(in)c(the)i(Mak)m -(e\014le.)41 b(T)-8 b(o)31 b(in)m(v)m(ok)m(e)g(the)g(program)f(t)m(yp)s -(e:)150 2710 y(`)p Fg(gnushogi)e(-C)p Fj(')630 2820 y(simple)g(curses)i -(based)g(v)m(ersion)150 2966 y(`)p Fg(gnushogi)e(-X)i(\(or)g(just)f -(gnushogi\))p Fj(')630 3075 y(xshogi)h(compatible)f(v)m(ersion)150 -3222 y(`)p Fg(gnushogi)f(-R)p Fj(')630 3331 y(ra)m(w)i(test)i(displa)m -(y)c(v)m(ersion)275 3587 y(TIME)i(CONTR)m(OLS)275 3824 -y(If)23 b(one)h(argumen)m(t)h(is)e(giv)m(en,)j(it)d(is)g(the)h(searc)m -(h)h(time)f(p)s(er)f(mo)m(v)m(e)i(in)e([min)m(utes:]seconds.)39 -b(So)24 b(gn)m(ushogi)150 3934 y(30)f(will)c(generate)k(one)f(mo)m(v)m -(e)h(ev)m(ery)g(30)g(seconds,)g(while)d(gn)m(ushogi)h(5:00)i(will)d -(generate)j(one)f(mo)m(v)m(e)h(ev)m(ery)150 4044 y(5)31 -b(min)m(utes.)275 4172 y(If)h(t)m(w)m(o)j(or)e(more)h(argumen)m(ts)g -(are)f(giv)m(en,)i(they)e(will)e(b)s(e)h(used)h(to)h(set)g(tournamen)m -(t)g(time)f(con)m(trols)150 4281 y(with)f(the)h(\014rst)f(argumen)m(t)i -(of)f(eac)m(h)h(pair)e(b)s(eing)f(the)i(n)m(um)m(b)s(er)f(of)h(mo)m(v)m -(es)i(and)d(the)h(second)g(b)s(eing)f(the)150 4391 y(total)e(clo)s(c)m -(k)g(time)f(in)g(min)m(utes[:seconds].)40 b(Th)m(us,)29 -b(en)m(tering)g(gn)m(ushogi)g(60)h(5)g(will)d(set)j(the)g(clo)s(c)m(ks) -f(for)h(5)150 4500 y(min)m(utes)d(\(300)i(seconds\))e(for)h(the)f -(\014rst)g(60)h(mo)m(v)m(es,)i(and)d(gn)m(ushogi)g(30)h(3:30)h(will)c -(allo)m(w)i(3)h(min)m(utes)f(and)150 4610 y(30)k(seconds)g(for)f(30)h -(mo)m(v)m(es.)275 4738 y(gn)m(ushogi)h(30)h(5)g(1)g(:30)h(will)29 -b(allo)m(w)k(5)g(min)m(utes)e(for)i(the)f(\014rst)g(30)i(mo)m(v)m(es)f -(and)f(30)i(seconds)e(for)h(eac)m(h)150 4847 y(mo)m(v)m(e)f(after)f -(that.)41 b(Up)30 b(to)h(4)g(pairs)e(of)h(con)m(trols)h(ma)m(y)g(b)s(e) -f(sp)s(eci\014ed.)275 4975 y(If)f(no)i(argumen)m(t)g(is)e(giv)m(en)h -(the)h(program)f(will)e(prompt)h(the)i(user)e(for)i(lev)m(el)f(of)g -(pla)m(y)-8 b(.)275 5103 y(F)g(or)37 b(use)g(with)f(xshogi)h(see)h(the) -f(do)s(cumen)m(tation)g(on)g(that)h(program.)61 b(See)38 -b(Chapter)e(4)i([xshogi],)150 5213 y(page)31 b(33.)p -eop -%%Page: 28 30 -28 29 bop 150 -116 a Fj(28)2734 b(GNU)31 b(Shogi)f(man)m(ual)275 -299 y(BOOK)275 541 y(The)24 b(b)s(o)s(ok)g(gn)m(ushogi.tbk)g(consists)h -(of)g(a)g(sequence)g(of)g(op)s(enings.)38 b(An)24 b(op)s(ening)f(b)s -(egins)h(with)f(a)j(line)150 650 y(starting)k(with)f(a)h(#)g(\(the)h -(rest)f(of)g(the)h(line)d(is)h(a)i(commen)m(t\).)42 b(F)-8 -b(ollo)m(wing)29 b(this)g(is)h(a)g(series)f(of)i(mo)m(v)m(es)g(in)150 -760 y(algebraic)i(notation)h(alternating)f(b)s(et)m(w)m(een)h(blac)m(k) -f(and)g(white)g(separated)h(b)m(y)f(whitespace.)50 b(A)33 -b(mo)m(v)m(e)150 870 y(ma)m(y)i(ha)m(v)m(e)h(a)f(?)52 -b(after)35 b(it)f(indicating)f(this)g(mo)m(v)m(e)j(should)c(nev)m(er)j -(b)s(e)f(made)g(in)g(this)f(p)s(osition.)51 b(Mo)m(v)m(es)150 -979 y(are)31 b(stored)f(as)h(p)s(osition:mo)m(v)m(e)f(so)h(transp)s -(ositions)d(b)s(et)m(w)m(een)j(op)s(enings)e(can)h(tak)m(e)i(place.)275 -1221 y(HASHFILE)275 1463 y(The)37 b(hash\014le)f(if)g(created)j(should) -c(b)s(e)i(on)h(the)g(order)f(of)g(4)h(megab)m(ytes;)43 -b(y)m(ou)38 b(can)g(create)h(suc)m(h)f(a)150 1573 y(hash\014le)h(b)m(y) -h(t)m(yping)g(\\gn)m(ushogi)h(-c)g(22")g(\(see)h(b)s(elo)m(w\).)70 -b(This)39 b(\014le)h(con)m(tains)g(p)s(ositions)f(and)h(mo)m(v)m(es)150 -1682 y(learned)25 b(from)g(previous)g(games.)40 b(If)25 -b(a)i(hash\014le)d(is)h(used)g(the)h(computer)g(mak)m(es)h(use)e(of)h -(the)h(exp)s(erience)150 1792 y(it)h(gained)f(in)g(past)h(games.)40 -b(T)-8 b(ests)29 b(run)d(so)j(far)e(sho)m(w)h(that)h(it)e(pla)m(ys)h -(no)g(w)m(orse)g(with)f(the)h(hash\014le)e(than)150 1902 -y(without,)k(but)f(it)h(is)g(not)g(clear)h(y)m(et)g(whether)f(it)g(pro) -m(vides)f(a)i(real)f(adv)-5 b(an)m(tage.)275 2144 y(LEGAL)30 -b(MO)m(VES)275 2386 y(Note:)54 b(Piece)37 b(letters)f(are)h(determined) -f(b)m(y)g(the)h(language)g(\014le.)58 b(What)37 b(is)f(sp)s(eci\014ed)f -(here)h(is)g(the)150 2495 y(default)30 b(\(English\).)275 -2628 y(Once)44 b(gn)m(ushogi)f(is)g(in)m(v)m(ok)m(ed,)48 -b(the)d(program)f(will)d(displa)m(y)h(the)j(b)s(oard)e(and)g(prompt)g -(the)i(user)150 2737 y(for)d(a)h(mo)m(v)m(e.)78 b(T)-8 -b(o)43 b(en)m(ter)g(a)f(mo)m(v)m(e,)47 b(use)42 b(the)h(notation)f -(7g7f)i(where)d(the)i(\014rst)f(letter-n)m(um)m(b)s(er)f(pair)150 -2847 y(indicates)j(the)g(origin)f(square)i(and)f(the)h(second)f -(letter-n)m(um)m(b)s(er)g(pair)g(indicates)f(the)i(destination)150 -2956 y(square.)k(An)33 b(alternativ)m(e)g(is)f(to)i(use)f(the)g -(notation)h(P7f)f(where)f(the)i(\014rst)e(letter)i(indicates)e(the)h -(piece)150 3066 y(t)m(yp)s(e)c(\(P)-8 b(,L,N,S,G,B,R,K\).)32 -b(T)-8 b(o)29 b(promote)h(app)s(end)d(a)i Fg(+)g Fj(the)g(t)m(yp)s(e)g -(of)g(the)h(new)e(piece)h(to)h(the)f(mo)m(v)m(e,)i(as)150 -3176 y(in)e(2d2c)p Fg(+)i Fj(or)f(P2c)p Fg(+)p Fj(.)41 -b(Note)32 b(that)f(y)m(ou)g(m)m(ust)f(use)g(capital)g(letters)h(for)f -(the)g(pieces)g(b)m(y)h(default.)275 3418 y(COMMAND-LINE)g(OPTIONS)150 -3660 y(`)p Fg(-a)p Fj(')334 b(Do)31 b(not)g(searc)m(h)g(on)f(opp)s -(onen)m(t's)g(time.)150 3815 y(`)p Fg(a)p Fj(')382 b(Do)31 -b(searc)m(h)g(on)f(opp)s(onen)m(t's)h(time.)150 3970 -y(`)p Fg(-b)f Ff(b)s(o)s(ok\014le)5 b Fj(')630 4080 y(Use)31 -b(b)s(o)s(ok\014le)e(for)h(op)s(ening)f(b)s(o)s(ok.)150 -4235 y(`)p Fg(-B)h Ff(bin)m(b)s(o)s(ok\014le)5 b Fj(')630 -4345 y(Use)31 b(bin)m(b)s(o)s(ok\014le)c(for)k(binary)d(op)s(ening)h(b) -s(o)s(ok.)150 4500 y(`)p Fg(-c)h Ff(size)5 b Fj(')157 -b(Create)46 b(a)f(new)f(HASHFILE.)h(File)f(size)g(is)g(2)p -Fg(^)p Fj(size)h(en)m(tries)f(of)h(appro)m(ximately)f(65)p -Fg(+)p Fj(?)630 4609 y(b)m(ytes.)150 4765 y(`)p Fg(-C)p -Fj(')334 b(Use)31 b(curses-based)f(displa)m(y)e(mo)s(de.)150 -4920 y(`)p Fg(-h)p Fj(')334 b(Do)31 b(not)g(use)f(hash\014le.)150 -5075 y(`)p Fg(h)p Fj(')382 b(Do)31 b(use)f(hash\014le.)150 -5230 y(`)p Fg(-l)g Ff(pathname)5 b Fj(')630 5340 y(P)m(athname)31 -b(of)g(the)f(load\014le)f(used)h(with)f(get)i(or)g(xget.)p -eop -%%Page: 29 31 -29 30 bop 150 -116 a Fj(Chapter)30 b(3:)41 b(gn)m(ushogi)2697 -b(29)150 299 y(`)p Fg(-L)30 b Ff(lang)8 b Fj(')129 b(Use)31 -b(language)h(lang)e(from)h(the)g(\014le)f(gn)m(ushogi.lang.)42 -b(If)30 b(-L)h(is)f(not)h(sp)s(eci\014ed)f(it)g(uses)h(the)630 -408 y(\014rst)f(language)g(in)f(the)i(\014le.)150 567 -y(`)p Fg(-P)f Ff(plylev)m(els)t Fj(')630 676 y(Num)m(b)s(er)f(of)i -(plys)e(to)i(include)d(in)h(the)i(bin)m(b)s(o)s(ok\014le.)38 -b(F)-8 b(or)31 b(generating)f(a)h(bin)m(b)s(o)s(ok\014le.)150 -835 y(`)p Fg(-r)f Ff(length)p Fj(')630 944 y(Rehash)g -Fd(length)38 b Fj(times)30 b(in)f(searc)m(hing)h(en)m(tries)g(for)g(p)s -(osition)f(in)g(transp)s(osition)f(table.)150 1103 y(`)p -Fg(-R)p Fj(')334 b(Use)26 b(ra)m(w)g(text)g(displa)m(y)e(mo)s(de.)39 -b(This)23 b(can)j(b)s(e)f(used)g(for)g(dum)m(b)f(terminals)g(or)i(for)f -(systems)630 1212 y(that)31 b(don't)f(ha)m(v)m(e)i(curses.)150 -1370 y(`)p Fg(-s)e Ff(pathname)5 b Fj(')630 1480 y(P)m(athname)31 -b(of)g(the)f(sa)m(v)m(e)i(\014le)e(to)h(use)f(with)f(the)h(sa)m(v)m(e)i -(command.)150 1638 y(`)p Fg(-S)e Ff(size)5 b Fj(')157 -b(Size)30 b(of)g(bin)m(b)s(o)s(ok\014le)e(for)i(memory)g(based)g(b)s(o) -s(oks.)40 b(F)-8 b(or)32 b(creating)e(a)h(bin)m(b)s(o)s(ok\014le.)150 -1797 y(`)p Fg(-t)p Fj(')334 b(Sho)m(w)30 b(statistics)g(for)g -(HASHFILE.)150 1955 y(`)p Fg(-T)g Ff(size)5 b Fj(')157 -b(Set)31 b(the)f(transp)s(osition)e(table)j(size)f(to)h(2)p -Fg(^)p Fj(size)f(en)m(tries.)150 2113 y(`)p Fg(-v)p Fj(')334 -b(Sho)m(w)30 b(v)m(ersion)g(and)g(patc)m(hlev)m(el.)150 -2271 y(`)p Fg(-x)g Ff(v)-5 b(alue)5 b Fj(')94 b(Use)31 -b(v)-5 b(alue)30 b(as)g(the)h(ev)-5 b(aluation)30 b(windo)m(w)e(xwndw.) -150 2430 y(`)p Fg(-X)p Fj(')334 b(Use)31 b(xshogi)f(displa)m(y)e(mo)s -(de)i(\(the)h(default\).)275 2698 y(COMMANDS)275 2941 -y(In)42 b(addition)f(to)j(legal)f(mo)m(v)m(es,)48 b(the)43 -b(follo)m(wing)e(commands)i(can)g(b)s(e)g(en)m(tered)g(at)h(the)g(gn)m -(ushogi)150 3051 y(prompt.)39 b(Note:)h(command)26 b(names)g(are)h -(determined)e(b)m(y)h(the)h(language)g(\014le)e(and)h(ma)m(y)h(v)-5 -b(ary)27 b(with)e(the)150 3160 y(implemen)m(tation.)39 -b(The)30 b(default)g(language)h(is)e(English.)150 3319 -y(`)p Fg(alg)p Fj(')286 b(allo)m(w)30 b(algebraic)g(input)e(\(not)j -(implemen)m(ted\).)150 3477 y(`)p Fg(Awindow)p Fj(')94 -b(c)m(hange)32 b(Alpha)d(windo)m(w)g(\(default)g(score)i -Fg(+)f Fj(90\).)150 3635 y(`)p Fg(Bwindow)p Fj(')94 b(c)m(hange)32 -b(Beta)f(windo)m(w)e(\(default)h(score)h(-)g(90\).)150 -3794 y(`)p Fg(beep)p Fj(')238 b(toggles)32 b(b)s(eeping)c(after)j(eac)m -(h)h(mo)m(v)m(e)g(\(default:)40 b(on\).)150 3952 y(`)p -Fg(bd)p Fj(')334 b(up)s(dates)29 b(the)i(curren)m(t)f(b)s(oard)f(p)s -(osition)g(on)h(the)h(displa)m(y)-8 b(.)150 4110 y(`)p -Fg(book)p Fj(')238 b(turns)29 b(o\013)i(use)f(of)h(the)f(op)s(ening)f -(library)-8 b(.)150 4268 y(`)p Fg(both)p Fj(')238 b(causes)31 -b(the)f(computer)h(to)g(pla)m(y)f(b)s(oth)f(sides)h(of)g(a)h(shogi)f -(game.)150 4427 y(`)p Fg(black)p Fj(')190 b(causes)31 -b(the)f(computer)h(to)g(pla)m(y)f(as)g(White,)h(if)e(the)i(computer)f -(w)m(as)h(to)g(mo)m(v)m(e)h(\014rst.)150 4585 y(`)p Fg(bsave)p -Fj(')190 b(sa)m(v)m(es)33 b(a)f(game)g(to)g(disk)e(as)i(a)g(b)s(o)s(ok) -e(text\014le.)44 b(The)31 b(program)h(will)c(prompt)j(the)g(user)g(for) -630 4695 y(a)g(\014le)e(name.)150 4853 y(`)p Fg(gamein)p -Fj(')142 b(toggles)36 b(game)g(mo)s(de)f(time)g(con)m(trol.)55 -b(Assumes)34 b(the)i(time)f(sp)s(eci\014ed)e(for)i(time)f(con)m(trol) -630 4963 y(is)d(the)h(time)f(for)g(a)h(complete)g(game.)46 -b(Input)30 b(with)h(the)g(lev)m(el)h(command)f(should)f(b)s(e)h(the)630 -5072 y(game)36 b(time)f(and)g(the)g(exp)s(ected)h(n)m(um)m(b)s(er)e(of) -h(mo)m(v)m(es)i(in)d(a)i(game.)56 b(go)36 b(command)f(m)m(ust)630 -5182 y(b)s(e)30 b(giv)m(en.)150 5340 y(`)p Fg(coords)p -Fj(')142 b(sho)m(w)30 b(co)s(ordinates)g(on)h(the)f(displa)m(y)f -(\(visual)g(only\).)p eop -%%Page: 30 32 -30 31 bop 150 -116 a Fj(30)2734 b(GNU)31 b(Shogi)f(man)m(ual)150 -299 y(`)p Fg(contempt)p Fj(')630 408 y(allo)m(ws)g(the)g(v)-5 -b(alue)30 b(of)h Fd(c)-5 b(ontempt)40 b Fj(to)31 b(b)s(e)f(mo)s -(di\014ed.)150 565 y(`)p Fg(debug)p Fj(')190 b(asks)33 -b(for)g(a)h(piece)f(as)g(color)g(piece,)h(as)f(wb)g(or)g(bn,)g(and)f -(sho)m(ws)h(its)f(calculated)h(v)-5 b(alue)33 b(on)630 -674 y(eac)m(h)f(square.)150 830 y(`)p Fg(debuglevel)p -Fj(')630 940 y(sets)f(lev)m(el)f(of)g(debugging)g(output)g(if)f -(compiled)g(with)g(debug)h(options.)150 1096 y(`)p Fg(depth)p -Fj(')190 b(allo)m(ws)41 b(the)h(user)f(to)h(c)m(hange)h(the)f(searc)m -(h)g(depth)f(of)h(the)g(program.)74 b(The)41 b(maxim)m(um)630 -1205 y(depth)32 b(is)f(29)i(ply)-8 b(.)46 b(Normally)31 -b(the)i(depth)e(is)g(set)i(to)g(29)h(and)d(the)i(computer)f(terminates) -630 1315 y(its)23 b(searc)m(h)h(based)f(on)h(elapsed)f(time)g(rather)h -(than)f(depth.)38 b(If)23 b(depth)g(is)f(set)i(to)h(\(sa)m(y\))g(4)f -(ply)-8 b(,)630 1425 y(the)28 b(program)g(will)d(searc)m(h)j(un)m(til)e -(all)h(mo)m(v)m(es)i(ha)m(v)m(e)g(b)s(een)e(examined)g(to)i(a)f(depth)f -(of)h(4)g(ply)630 1534 y(\(with)g(extensions)h(up)f(to)i(11)g -(additional)d(ply)h(for)h(sequences)g(of)g(c)m(hec)m(ks)i(and)d -(captures\).)630 1644 y(If)38 b(y)m(ou)h(set)g(a)g(maxim)m(um)f(time)g -(p)s(er)g(mo)m(v)m(e)i(and)e(also)h(use)f(the)h(depth)f(command,)j(the) -630 1753 y(searc)m(h)36 b(will)c(stop)j(at)h(the)f(sp)s(eci\014ed)e -(time)i(or)g(the)g(sp)s(eci\014ed)e(depth,)j(whic)m(hev)m(er)e(comes) -630 1863 y(\014rst.)150 2019 y(`)p Fg(easy)p Fj(')238 -b(toggles)28 b(easy)f(mo)s(de)f(\(thinking)e(on)i(opp)s(onen)m(ts)g -(time\))h(on)f(and)g(o\013.)39 b(The)26 b(default)g(is)f(easy)630 -2129 y(mo)s(de)34 b(ON.)h(If)f(easy)h(mo)s(de)f(is)f(disabled,)h(the)g -(k)m(eyb)s(oard)h(is)e(p)s(olled)g(for)h(input)e(ev)m(ery)k(so)630 -2238 y(often)22 b(and)f(when)g(input)f(is)g(seen)i(the)g(searc)m(h)g -(is)f(terminated.)38 b(It)21 b(ma)m(y)i(also)e(b)s(e)g(terminated)630 -2348 y(with)29 b(a)i(sigin)m(t.)150 2504 y(`)p Fg(edit)p -Fj(')238 b(allo)m(ws)30 b(the)g(user)g(to)h(set)g(up)e(a)i(b)s(oard)e -(p)s(osition.)679 2637 y Fi(\000)60 b Fj(#)30 b(clear)g(the)h(b)s -(oard.)679 2770 y Fi(\000)60 b Fj(c)31 b(toggle)g(piece)g(color.)679 -2902 y Fi(\000)60 b Fj(.)41 b(command)30 b(will)e(exit)i(setup)g(mo)s -(de.)679 3035 y Fi(\000)60 b Fj(p3b)30 b(place)g(a)h(pa)m(wn)f(on)g(3b) -679 3168 y Fi(\000)60 b Fj(p3b)p Fg(+)29 b Fj(place)i(a)g(promoted)f -(pa)m(wn)g(on)g(3b)679 3301 y Fi(\000)60 b Fj(p*)30 b(place)h(a)f(pa)m -(wn)g(in)f(hand)h(\(among)h(the)f(captured)g(pieces\))630 -3457 y(Pieces)35 b(are)h(en)m(tered)f(b)m(y)g(t)m(yping)g(a)g(letter)g -(\(p,l,n,s,g,b,r,k\))g(for)g(the)g(piece)g(follo)m(w)m(ed)g(b)m(y)630 -3567 y(the)c(co)s(ordinate.)40 b(Here,)31 b(letter)g(case)g(is)f -(ignored.)630 3699 y(The)g(usual)f(w)m(arning)g(ab)s(out)h(the)h -(language)f(\014le)g(applies.)150 3856 y(`)p Fg(exit)p -Fj(')238 b(exits)30 b(gn)m(ushogi.)150 4012 y(`)p Fg(first)p -Fj(')190 b(tells)27 b(the)h(computer)f(to)i(mo)m(v)m(e)g(\014rst.)39 -b(Computer)27 b(b)s(egins)g(searc)m(hing)g(for)h(a)g(mo)m(v)m(e.)41 -b(\(same)630 4121 y(as)31 b(\\go"\).)150 4277 y(`)p Fg(force)p -Fj(')190 b(allo)m(ws)28 b(the)i(user)e(to)i(en)m(ter)g(mo)m(v)m(es)g -(for)f(b)s(oth)g(sides.)39 b(T)-8 b(o)29 b(get)i(the)e(program)g(to)h -(pla)m(y)e(after)630 4387 y(a)j(sequence)g(of)f(mo)m(v)m(es)i(has)e(b)s -(een)g(en)m(tered)g(use)h(the)f(\\blac)m(k")h(or)g(\\white")f -(commands.)150 4543 y(`)p Fg(get)p Fj(')286 b(retriev)m(es)31 -b(a)f(game)i(from)e(disk.)39 b(The)30 b(program)g(will)e(prompt)h(the)i -(user)e(for)i(a)f(\014le)g(name.)150 4699 y(`)p Fg(go)p -Fj(')334 b(tells)27 b(the)h(computer)f(to)i(mo)m(v)m(e)g(\014rst.)39 -b(Computer)27 b(b)s(egins)g(searc)m(hing)g(for)h(a)g(mo)m(v)m(e.)41 -b(\(same)630 4809 y(as)31 b(\\\014rst"\).)150 4965 y(`)p -Fg(hash)p Fj(')238 b(use/don't)31 b(use)f(hash\014le.)150 -5121 y(`)p Fg(hashdepth)p Fj(')630 5230 y(allo)m(ws)38 -b(the)g(user)g(to)h(c)m(hange)g(the)f(minim)m(um)e(depth)h(for)h(using) -f(the)h(hash\014le)f(and)h(the)630 5340 y(n)m(um)m(b)s(er)29 -b(of)i(mo)m(v)m(es)g(from)f(the)h(b)s(eginning)c(of)k(the)g(game)g(to)g -(use)f(it.)p eop -%%Page: 31 33 -31 32 bop 150 -116 a Fj(Chapter)30 b(3:)41 b(gn)m(ushogi)2697 -b(31)150 299 y(`)p Fg(help)p Fj(')238 b(displa)m(ys)25 -b(a)i(short)f(description)f(of)i(the)g(commands)f(and)g(the)h(curren)m -(t)f(status)i(of)e(options.)150 458 y(`)p Fg(hint)p Fj(')238 -b(causes)31 b(the)f(program)g(to)i(supply)c(the)i(user)g(with)f(its)h -(predicted)f(mo)m(v)m(e.)150 617 y(`)p Fg(level)p Fj(')190 -b(allo)m(ws)28 b(the)h(user)f(to)h(set)g(time)g(con)m(trols)g(suc)m(h)f -(as)h(60)h(mo)m(v)m(es)f(in)f(5)h(min)m(utes)f(etc.)41 -b(In)28 b(tour-)630 726 y(namen)m(t)f(mo)s(de,)h(the)f(program)g(will)d -(v)-5 b(ary)27 b(the)g(time)g(it)g(tak)m(es)h(for)f(eac)m(h)h(mo)m(v)m -(e)g(dep)s(ending)630 836 y(on)39 b(the)g(situation.)64 -b(If)39 b(easy)g(mo)s(de)f(is)g(disabled)f(\(using)g(the)i(\\easy")i -(command\),)g(the)630 945 y(program)28 b(will)d(often)j(resp)s(ond)e -(with)h(its)g(mo)m(v)m(e)j(immediately)-8 b(,)27 b(sa)m(ving)h(time)f -(on)h(its)g(clo)s(c)m(k)630 1055 y(for)i(use)g(later)h(on.)150 -1214 y(`)p Fg(list)p Fj(')238 b(writes)27 b(the)h(game)i(mo)m(v)m(es)f -(and)f(some)g(statistics)g(on)g(searc)m(h)h(depth,)f(no)s(des,)g(and)f -(time)h(to)630 1324 y(the)j(\014le)e(\\shogi.lst".)150 -1482 y(`)p Fg(material)p Fj(')630 1592 y(toggle)j(material)e(\015ag)g -(-)h(dra)m(ws)f(on)g(no)g(pa)m(wns)g(and)g(b)s(oth)f(sides)h -Fg(<)g Fj(ro)s(ok.)150 1751 y(`)p Fg(new)p Fj(')286 b(starts)31 -b(a)g(new)e(game.)150 1910 y(`)p Fg(p)p Fj(')382 b(ev)-5 -b(aluates)34 b(the)f(b)s(oard)f(and)h(sho)m(ws)g(the)h(p)s(oin)m(t)e -(score)i(for)f(eac)m(h)h(piece.)49 b(The)33 b(total)h(score)630 -2019 y(for)c(a)h(p)s(osition)d(is)i(the)g(sum)g(of)g(these)h -(individual)26 b(piece)k(scores.)150 2178 y(`)p Fg(post)p -Fj(')238 b(causes)31 b(the)h(program)e(to)i(displa)m(y)d(the)j -(principal)27 b(v)-5 b(ariation)31 b(and)f(the)h(score)h(during)d(the) -630 2288 y(searc)m(h.)41 b(A)31 b(score)g(of)f(100)i(is)d(equiv)-5 -b(alen)m(t)30 b(to)h(a)g(1)g(pa)m(wn)f(adv)-5 b(an)m(tage)32 -b(for)e(the)h(computer.)150 2447 y(`)p Fg(quit)p Fj(')238 -b(exits)30 b(the)h(game.)150 2606 y(`)p Fg(random)p Fj(')142 -b(causes)31 b(the)f(program)g(to)i(randomize)d(its)h(mo)m(v)m(e)i -(selection)e(sligh)m(tly)-8 b(.)150 2765 y(`)p Fg(rcptr)p -Fj(')190 b(set)31 b(recapture)f(mo)s(de.)150 2924 y(`)p -Fg(remove)p Fj(')142 b(bac)m(k)m(out)32 b(the)e(last)h(lev)m(el)f(for)g -(b)s(oth)g(sides.)39 b(Equal)29 b(to)j(2)e(undo's.)150 -3082 y(`)p Fg(reverse)p Fj(')94 b(causes)36 b(the)g(b)s(oard)f(displa)m -(y)f(to)j(b)s(e)e(rev)m(ersed.)58 b(That)35 b(is,)i(the)f(Blac)m(k's)h -(pieces)f(will)d(no)m(w)630 3192 y(app)s(ear)d(at)h(the)f(top)h(of)g -(the)f(b)s(oard.)150 3351 y(`)p Fg(rv)p Fj(')334 b(rev)m(erse)31 -b(b)s(oard)e(displa)m(y)-8 b(.)150 3510 y(`)p Fg(save)p -Fj(')238 b(sa)m(v)m(es)32 b(a)f(game)g(to)g(disk.)39 -b(The)30 b(program)g(will)e(prompt)i(the)g(user)g(for)g(a)h(\014le)e -(name.)150 3669 y(`)p Fg(switch)p Fj(')142 b(causes)31 -b(the)f(program)g(to)i(switc)m(h)d(places)i(with)e(the)h(opp)s(onen)m -(t)g(and)g(b)s(egin)f(searc)m(hing.)150 3828 y(`)p Fg(test)p -Fj(')238 b(p)s(erforms)52 b(some)i(sp)s(eed)e(tests)j(for)e(Mo)m(v)m -(eList)i(and)e(CaptureList)f(generation,)60 b(and)630 -3937 y(ScoreP)m(osition)30 b(p)s(osition)f(scoring)g(for)i(the)f -(curren)m(t)g(b)s(oard.)150 4096 y(`)p Fg(time)p Fj(')238 -b(set)28 b(computer's)g(time)f(remaining,)g(in)m(tended)f(for)h(sync)m -(hronizing)f(clo)s(c)m(ks)i(among)g(m)m(ulti-)630 4206 -y(ple)h(pla)m(y)m(ers.)150 4365 y(`)p Fg(tsume)p Fj(')190 -b(toggle)35 b(tsume)e(mo)s(de.)50 b(In)33 b(tsume)h(mo)s(de,)g(not)g -(all)f(p)s(ossible)e(mo)m(v)m(es)k(will)c(b)s(e)i(generated.)630 -4474 y(If)f(a)i(king)e(is)f(in)h(c)m(hec)m(k,)j(only)d(mo)m(v)m(es)i -(that)g(get)g(the)f(king)f(out)h(of)g(c)m(hec)m(k)h(are)g(generated.) -630 4584 y(If)f(the)h(king)e(is)h(not)h(in)e(c)m(hec)m(k,)k(only)d(mo)m -(v)m(es)h(that)h(giv)m(e)f(c)m(hec)m(k)h(to)f(the)g(opp)s(onen)m(t's)f -(king)630 4693 y(are)e(generated.)150 4852 y(`)p Fg(undo)p -Fj(')238 b(undo)s(es)29 b(the)h(last)g(mo)m(v)m(e)h(whether)f(it)f(w)m -(as)i(the)f(computer's)g(or)g(the)g(h)m(uman's.)40 b(Y)-8 -b(ou)30 b(ma)m(y)630 4962 y(also)i(t)m(yp)s(e)g(\\remo)m(v)m(e".)47 -b(This)30 b(is)g(equiv)-5 b(alen)m(t)31 b(to)i(t)m(w)m(o)g(\\undo"'s)f -(\(e.g.)46 b(retract)32 b(one)g(mo)m(v)m(e)630 5071 y(for)e(eac)m(h)i -(side\).)150 5230 y(`)p Fg(white)p Fj(')190 b(causes)35 -b(the)g(computer)g(to)g(pla)m(y)f(as)h(Blac)m(k;)k(if)33 -b(the)i(computer)g(is)f(to)h(mo)m(v)m(e)h(\014rst)e(the)h(go)630 -5340 y(command)30 b(m)m(ust)g(b)s(e)g(giv)m(en.)p eop -%%Page: 32 34 -32 33 bop 150 -116 a Fj(32)2734 b(GNU)31 b(Shogi)f(man)m(ual)150 -299 y(`)p Fg(xget)p Fj(')238 b(read)30 b(an)h(xshogi)e(p)s(osition)g -(\014le.)150 458 y(`)p Fg(xsave)p Fj(')190 b(sa)m(v)m(e)32 -b(as)f(an)f(xshogi)g(p)s(osition)e(\014le.)150 618 y(`)p -Fg(xwndw)p Fj(')190 b(c)m(hange)32 b(X)e(windo)m(w.)39 -b(The)30 b(windo)m(w)f(around)g(alpha/b)s(eta)h(used)g(to)h(determine)f -(whether)630 727 y(the)k(p)s(osition)d(should)h(b)s(e)h(scored)g(or)h -(just)f(estimated.)50 b(Note:)f(this)32 b(has)h Fd(nothing)43 -b Fj(to)34 b(do)630 837 y(with)29 b(xshogi)h(or)g(X)h(windo)m(ws;)e -(the)h(terms)g(are)h(completely)f(separate.)p eop -%%Page: 33 35 -33 34 bop 150 -116 a Fj(Chapter)30 b(4:)41 b(xshogi)2793 -b(33)150 299 y Fh(4)80 b(xshogi)275 508 y Fj(This)28 -b(section)j(describ)s(es)d(ho)m(w)j(to)g(run)e(the)h(\\xshogi")h -(program.)275 747 y(SYNOPSIS)275 986 y(xshogi)e([)i(options)f(])275 -1225 y(DESCRIPTION)275 1465 y(xshogi)36 b(pro)m(vides)g(an)i(X11/Xt/A)m -(thena)i(Widgets)e(user)e(in)m(terface)i(for)f(gn)m(ushogi.)61 -b(With)36 b(xshogi)150 1574 y(y)m(ou)29 b(can)f(pla)m(y)g(gn)m(ushogi,) -g(set)h(up)f(arbitrary)f(p)s(ositions,)g(force)h(v)-5 -b(ariations,)28 b(or)h(w)m(atc)m(h)g(xshogi)f(manage)150 -1684 y(a)k(game)h(b)s(et)m(w)m(een)g(t)m(w)m(o)h(shogi)d(programs.)45 -b(F)-8 b(urthermore,)33 b(it)f(can)g(b)s(e)f(used)g(as)i(an)f(in)m -(terface)g(b)s(et)m(w)m(een)150 1793 y(t)m(w)m(o)g(pla)m(y)m(ers)e(on)g -(di\013eren)m(t)g(displa)m(ys.)275 1923 y(xshogi)d(can)h(also)g(b)s(e)f -(used)g(as)h(a)g(shogi)g(b)s(oard)f(to)h(pla)m(y)g(out)g(games.)41 -b(It)28 b(will)d(read)j(through)f(a)h(game)150 2032 y(\014le)j(or)g -(allo)m(w)g(a)h(pla)m(y)m(er)f(to)h(pla)m(y)f(through)g(a)h(v)-5 -b(ariation)30 b(man)m(ually)g(\(force)j(mo)s(de\).)43 -b(This)30 b(is)h(useful)e(for)150 2142 y(k)m(eeping)h(trac)m(k)i(of)e -(email)g(p)s(ostal)g(games)h(or)f(bro)m(wsing)f(games)i(o\013)g(the)g -(net.)275 2271 y(After)e(starting)g(xshogi,)f(y)m(ou)i(can)f(mak)m(e)h -(mo)m(v)m(es)g(b)m(y)f(pressing)f(mouse)g(button)h(1)g(while)e(the)j -(cursor)150 2381 y(is)36 b(o)m(v)m(er)i(a)f(square)g(with)f(y)m(our)h -(piece)f(on)h(it)g(and)f(dragging)h(the)g(mouse)f(to)i(another)f -(square.)60 b(If)37 b(the)150 2491 y(mo)m(v)m(e)32 b(is)d(illegal,)g -(gn)m(ushogi)h(will)e(not)i(allo)m(w)g(it.)40 b(xshogi)30 -b(will)e(then)i(retract)h(the)g(mo)m(v)m(e.)275 2730 -y(COMMAND-LINE)g(OPTIONS)275 2969 y(The)f(follo)m(wing)e(command)j -(line)e(options)g(also)i(corresp)s(ond)e(to)i(X)g(resources)f(that)i(y) -m(ou)e(can)h(set)g(in)150 3078 y(y)m(our)f(.Xdefaults)g(\014le.)150 -3318 y(`)p Fg([standard)e(Xt)i(options])p Fj(')630 3427 -y(xshogi)g(accepts)h(standard)f(Xt)h(options)f(lik)m(e)f(-displa)m(y)-8 -b(,)30 b(-geometry)-8 b(,)32 b(and)e(-iconic.)150 3577 -y(`)p Fg(-tc)g(or)f(-timeControl)f(minutes[:seconds])p -Fj(')630 3686 y(Amoun)m(t)42 b(of)g(time)g(for)f(a)h(set)h(of)f(mo)m(v) -m(es)h(determined)d(b)m(y)i(mo)m(v)m(esP)m(erSession.)76 -b(If)41 b(this)630 3796 y(n)m(um)m(b)s(er)e(of)h(mo)m(v)m(es)h(is)e -(pla)m(y)m(ed)h(within)d(the)j(time)g(con)m(trol)g(p)s(erio)s(d,)g -(xshogi)f(resets)i(the)630 3905 y(time)30 b(clo)s(c)m(ks.)41 -b(Default:)g(5)31 b(min)m(utes.)150 4055 y(`)p Fg(-mps)e(or)h -(-movesPerSession)c(moves)p Fj(')630 4164 y(Num)m(b)s(er)j(of)i(mo)m(v) -m(es)h(in)d(a)h(time)g(con)m(trol)h(p)s(erio)s(d.)39 -b(Default:)h(40)32 b(mo)m(v)m(es.)150 4314 y(`)p Fg(-st)e(or)f -(-searchTime)f(minutes[:seconds])p Fj(')630 4423 y(T)-8 -b(ell)30 b(gn)m(ushogi)g(to)i(sp)s(end)d(at)j(most)f(the)h(giv)m(en)f -(amoun)m(t)g(of)g(time)g(searc)m(hing)g(for)g(eac)m(h)h(of)630 -4533 y(its)f(mo)m(v)m(es.)46 b(Without)32 b(this)e(option,)i(gn)m -(ushogi)f(c)m(ho)s(oses)i(its)e(searc)m(h)h(time)g(based)f(on)h(the)630 -4643 y(n)m(um)m(b)s(er)k(of)i(mo)m(v)m(es)h(and)f(amoun)m(t)g(of)g -(time)f(remaining)f(un)m(til)g(the)i(next)g(time)f(con)m(trol.)630 -4752 y(Setting)30 b(this)f(option)h(also)h(sets)f(-clo)s(c)m(kMo)s(de)i -(to)f(F)-8 b(alse.)150 4902 y(`)p Fg(-sd)30 b(or)f(-searchDepth)f -(number)p Fj(')630 5011 y(T)-8 b(ell)26 b(gn)m(ushogi)g(to)i(lo)s(ok)f -(ahead)g(at)h(most)f(the)g(giv)m(en)g(n)m(um)m(b)s(er)f(of)h(mo)m(v)m -(es)h(when)e(searc)m(hing)630 5121 y(for)37 b(a)h(mo)m(v)m(e)i(to)e -(mak)m(e.)64 b(Without)37 b(this)g(option,)i(gn)m(ushogi)e(c)m(ho)s -(oses)h(its)f(searc)m(h)i(depth)630 5230 y(based)e(on)g(the)h(n)m(um)m -(b)s(er)e(of)h(mo)m(v)m(es)i(and)e(amoun)m(t)h(of)f(time)g(remaining)f -(un)m(til)f(the)j(next)630 5340 y(time)30 b(con)m(trol.)41 -b(Setting)30 b(this)g(option)f(also)i(sets)g(-clo)s(c)m(kMo)s(de)g(to)g -(F)-8 b(alse.)p eop -%%Page: 34 36 -34 35 bop 150 -116 a Fj(34)2734 b(GNU)31 b(Shogi)f(man)m(ual)150 -299 y(`)p Fg(-clock)f(or)h(-clockMode)d(\(True)i(|)h(False\))p -Fj(')630 408 y(Determines)36 b(whether)f(or)h(not)g(to)h(use)e(the)h -(clo)s(c)m(k.)58 b(If)36 b(clo)s(c)m(kMo)s(de)g(is)f(F)-8 -b(alse,)38 b(the)f(clo)s(c)m(k)630 518 y(do)s(es)30 b(not)h(run,)e(but) -h(the)g(side)f(that)i(is)f(to)h(pla)m(y)f(next)g(is)g(still)e(highligh) -m(ted.)150 667 y(`)p Fg(-td)i(or)f(-timeDelay)f(seconds)p -Fj(')630 777 y(Time)37 b(dela)m(y)h(b)s(et)m(w)m(een)g(mo)m(v)m(es)h -(during)d(\\Load)i(Game".)64 b(This)36 b(do)s(esn't)i(ha)m(v)m(e)h(to)f -(b)s(e)g(a)630 887 y(round)29 b(n)m(um)m(b)s(er.)39 b(T)-8 -b(ry)30 b(-td)h(0.4.)42 b(Default:)e(1)31 b(second.)150 -1036 y(`)p Fg(-nsp)e(or)h(-noShogiProgram)c(\(True)j(|)h(False\))p -Fj(')630 1146 y(If)k(this)f(option)h(is)f(T)-8 b(rue,)35 -b(xshogi)f(acts)i(as)e(a)h(passiv)m(e)f(shogi)g(b)s(oard;)h(it)f(do)s -(es)g(not)h(try)f(to)630 1255 y(start)h(a)g(shogi)e(program,)j(not)e -(ev)m(en)i(to)f(c)m(hec)m(k)h(whether)d(mo)m(v)m(es)j(made)e(in)f(F)-8 -b(orce)36 b(mo)s(de)630 1365 y(are)31 b(legal.)40 b(It)31 -b(also)f(sets)h(-clo)s(c)m(kMo)s(de)g(to)g(F)-8 b(alse.)42 -b(Default:)f(F)-8 b(alse.)150 1514 y(`)p Fg(-fsp)29 b(or)h -(-firstShogiProgram)c(program)p Fj(')630 1624 y(Name)33 -b(of)f(\014rst)f(shogi)g(program.)45 b(In)31 b(matc)m(hes)i(b)s(et)m(w) -m(een)g(t)m(w)m(o)g(mac)m(hines,)f(this)f(program)630 -1733 y(pla)m(ys)f(white.)40 b(Default:)h(\\gn)m(ushogi".)150 -1883 y(`)p Fg(-ssp)29 b(or)h(-secondShogiProgram)25 b(program)p -Fj(')630 1993 y(Name)34 b(of)g(second)g(shogi)f(program,)i(if)d -(needed.)51 b(In)33 b(matc)m(hes)i(b)s(et)m(w)m(een)f(t)m(w)m(o)h(mac)m -(hines,)630 2102 y(this)29 b(program)h(pla)m(ys)g(blac)m(k;)h -(otherwise)f(it)g(is)f(not)i(started.)41 b(Default:)g(\\gn)m(ushogi".) -150 2252 y(`)p Fg(-fh)30 b(or)f(-firstHost)f(host)p Fj(')630 -2361 y(Name)j(of)g(host)f(the)h(\014rst)e(shogi)h(program)g(pla)m(ys)g -(on.)41 b(Default:)g(\\lo)s(calhost".)150 2511 y(`)p -Fg(-sh)30 b(or)f(-secondHost)f(host)p Fj(')630 2620 y(Name)j(of)g(host) -f(the)h(second)f(shogi)g(program)g(pla)m(ys)g(on.)41 -b(Default:)f(\\lo)s(calhost".)150 2770 y(`)p Fg(-rsh)29 -b(or)h(-remoteShell)d(shell_name)p Fj(')630 2879 y(Some)k(systems)h(do) -f(not)h(use)f(rsh)f(as)i(the)g(remote)g(shell.)42 b(This)30 -b(option)h(allo)m(ws)g(a)g(user)g(to)630 2989 y(name)f(the)h(remote)g -(shell)e(command.)40 b(This)29 b(should)f(b)s(e)i(done)g(in)f(the)i -(resource)f(\014le.)150 3138 y(`)p Fg(-mm)g(or)f(-matchMode)f(\(False)h -(|)h(Init)f(|)h(Position)e(|)i(Opening\))p Fj(')630 3248 -y(Automatically)46 b(run)f(a)i(game)g(b)s(et)m(w)m(een)h -(\014rstShogiProgram)d(and)g(secondShogiPro-)630 3357 -y(gram.)52 b(If)33 b(matc)m(hMo)s(de)j(is)d(set)h(to)h(Init,)f(xshogi)g -(will)d(start)j(the)h(game)g(with)d(the)j(initial)630 -3467 y(shogi)26 b(p)s(osition.)38 b(If)26 b(matc)m(hMo)s(de)h(is)f(set) -h(to)g(P)m(osition,)g(xshogi)f(will)e(start)j(the)g(game)g(with)630 -3577 y(the)k(p)s(osition)e(sp)s(eci\014ed)g(b)m(y)i(the)g(loadP)m -(ositionFile)e(resource.)42 b(If)30 b(matc)m(hMo)s(de)i(is)e(set)h(to) -630 3686 y(Op)s(ening,)22 b(xshogi)h(will)d(pla)m(y)j(out)g(the)g(op)s -(ening)e(mo)m(v)m(es)k(sp)s(eci\014ed)c(b)m(y)i(the)g(-loadGameFile)630 -3796 y(resource.)40 b(If)26 b(the)i(-sa)m(v)m(eGameFile)h(resource)e -(is)f(set,)j(a)e(mo)m(v)m(e)i(record)e(for)f(the)i(matc)m(h)g(will)630 -3905 y(b)s(e)i(sa)m(v)m(ed)h(in)e(the)i(sp)s(eci\014ed)d(\014le.)40 -b(Default:)h(\\F)-8 b(alse".)150 4055 y(`)p Fg(-lgf)29 -b(or)h(-loadGameFile)d(file)p Fj(')630 4164 y(Name)j(of)f(\014le)g(to)h -(read)f(a)g(game)h(record)g(from.)39 b(Game)31 b(\014les)d(are)h(found) -f(in)g(the)h(directory)630 4274 y(named)h(b)m(y)f(the)i(SHOGIDIR)e(en)m -(vironmen)m(t)h(v)-5 b(ariable.)39 b(If)30 b(this)f(v)-5 -b(ariable)29 b(is)g(not)h(set,)h(the)630 4384 y(curren)m(t)f(directory) -g(is)f(used)h(unless)f(the)h(\014le)g(name)g(starts)h(with)e(a)i(/.)150 -4533 y(`)p Fg(-lpf)e(or)h(-loadPositionFile)c(file)p -Fj(')630 4643 y(Name)44 b(of)g(\014le)f(to)h(read)g(a)g(game)h(p)s -(osition)c(from.)80 b(P)m(osition)43 b(\014les)g(are)h(found)e(in)h -(the)630 4752 y(directory)38 b(named)g(b)m(y)g(the)g(SHOGIDIR)g(en)m -(vironmen)m(t)g(v)-5 b(ariable.)63 b(If)38 b(this)f(v)-5 -b(ariable)37 b(is)630 4862 y(not)31 b(set,)g(the)f(curren)m(t)h -(directory)e(is)h(used)f(unless)g(the)i(\014le)e(name)i(starts)f(with)f -(a)i(/.)150 5011 y(`)p Fg(-sgf)e(or)h(-saveGameFile)d(file)p -Fj(')630 5121 y(Name)37 b(of)g(\014le)e(to)j(sa)m(v)m(e)g(a)f(game)g -(record)g(to.)59 b(Game)38 b(\014les)d(are)i(sa)m(v)m(ed)h(in)d(the)h -(directory)630 5230 y(named)30 b(b)m(y)f(the)i(SHOGIDIR)e(en)m -(vironmen)m(t)h(v)-5 b(ariable.)39 b(If)30 b(this)f(v)-5 -b(ariable)29 b(is)g(not)h(set,)h(the)630 5340 y(curren)m(t)f(directory) -g(is)f(used)h(unless)f(the)h(\014le)g(name)g(starts)h(with)e(a)i(/.)p -eop -%%Page: 35 37 -35 36 bop 150 -116 a Fj(Chapter)30 b(4:)41 b(xshogi)2793 -b(35)150 299 y(`)p Fg(-spf)29 b(or)h(-savePositionFile)c(file)p -Fj(')630 408 y(Name)h(of)g(\014le)f(to)h(sa)m(v)m(e)h(a)f(game)h(p)s -(osition)d(to.)40 b(P)m(osition)26 b(\014les)g(are)h(sa)m(v)m(ed)g(in)f -(the)g(directory)630 518 y(named)k(b)m(y)f(the)i(SHOGIDIR)e(en)m -(vironmen)m(t)h(v)-5 b(ariable.)39 b(If)30 b(this)f(v)-5 -b(ariable)29 b(is)g(not)h(set,)h(the)630 628 y(curren)m(t)f(directory)g -(is)f(used)h(unless)f(the)h(\014le)g(name)g(starts)h(with)e(a)i(/.)150 -787 y(`)p Fg(-coords)e(or)g(-showCoords)f(\(True)h(|)h(False\))p -Fj(')630 897 y(If)35 b(this)f(option)h(is)f(T)-8 b(rue,)36 -b(xshogi)f(displa)m(ys)e(algebraic)i(co)s(ordinates)g(along)g(the)h(b)s -(oard's)630 1006 y(left)d(and)g(b)s(ottom)g(edges.)50 -b(The)33 b(default)f(is)g(F)-8 b(alse.)50 b(The)33 b(co)s(ordF)-8 -b(on)m(t)35 b(resource)e(sp)s(eci\014es)630 1116 y(what)d(fon)m(t)h(to) -g(use.)150 1275 y(`)p Fg(-mono)e(or)h(-monoMode)e(\(True)h(|)h(False\)) -p Fj(')630 1385 y(Determines)36 b(whether)f(xshogi)g(displa)m(ys)f(its) -h(pieces)h(and)f(squares)g(with)g(t)m(w)m(o)i(colors)f(or)630 -1494 y(four.)42 b(Y)-8 b(ou)31 b(shouldn't)e(ha)m(v)m(e)j(to)g(sp)s -(ecify)e(mono)s(c)m(hrome.)42 b(xshogi)31 b(will)d(determine)i(if)g -(this)630 1604 y(is)f(necessary)-8 b(.)150 1763 y(`)p -Fg(-pc)30 b(or)f(-pieceColor)f(color)p Fj(')630 1873 -y(Color)i(sp)s(eci\014cation)f(for)h(pieces)g(suitable)f(for)h(XP)m -(arseColor\(\).)42 b(Default:)f(#FFFFD7.)150 2032 y(`)p -Fg(-sc)30 b(or)f(-squareColor)f(color)p Fj(')630 2142 -y(Same)i(for)h(squares.)40 b(Default:)h(#EBDFB0.)150 -2301 y(`)p Fg(-wps)29 b(or)h(-westernPieceSet)c(\(True)j(|)h(False\))p -Fj(')630 2411 y(Cho)s(ose)g(the)h(W)-8 b(estern)31 b(st)m(yle)g(piece)f -(set.)150 2570 y(`)p Fg(-npb)f(or)h(-normalPawnBitmap)c(file)p -Fj(')150 2705 y(`)p Fg(-nnb)j(or)h(-normalKnightBitmap)25 -b(file)p Fj(')150 2839 y(`)p Fg(-nbb)k(or)h(-normalBishopBitmap)25 -b(file)p Fj(')150 2974 y(`)p Fg(-nrb)k(or)h(-normalRookBitmap)c(file)p -Fj(')150 3108 y(`)p Fg(-nkb)j(or)h(-normalKingBitmap)c(file)p -Fj(')630 3218 y(Names)31 b(of)f(the)h(bitmap)e(\014les)h(for)g(the)g -(bitmap)f(piece)i(icons.)150 3377 y(`)p Fg(-rpb)e(or)h -(-reversePawnBitmap)c(file)p Fj(')150 3512 y(`)p Fg(-rnb)j(or)h -(-reverseKnightBitmap)25 b(file)p Fj(')150 3646 y(`)p -Fg(-rbb)k(or)h(-reverseBishopBitmap)25 b(file)p Fj(')150 -3781 y(`)p Fg(-rrb)k(or)h(-reverseRookBitmap)c(file)p -Fj(')150 3915 y(`)p Fg(-rkb)j(or)h(-reverseKingBitmap)c(file)p -Fj(')630 4025 y(Names)31 b(of)f(the)h(bitmap)e(\014les)h(for)g(the)g -(outline)f(piece)i(icons.)150 4184 y(`)p Fg(-debug)e(or)h(-debugMode)d -(\(True)i(|)h(False\))p Fj(')630 4294 y(T)-8 b(urns)29 -b(on)h(debugging)f(prin)m(tout.)p eop -%%Page: 36 38 -36 37 bop 150 -116 a Fj(36)2734 b(GNU)31 b(Shogi)f(man)m(ual)275 -299 y(OTHER)f(X)i(RESOUR)m(CES)150 540 y(`)p Fg(initString)p -Fj(')630 650 y(The)k(actual)h(string)f(that)h(is)f(sen)m(t)h(to)g -(initialize)d(the)j(shogi)f(program)g(can)h(b)s(e)f(set)h(from)630 -759 y(.Xdefaults.)k(It)29 b(can't)h(b)s(e)e(set)i(from)f(the)g(command) -g(line)e(b)s(ecause)i(of)h(syn)m(tax)f(problems.)630 -869 y(The)j(default)g(v)-5 b(alue)32 b(is)g(\\new)p Fg(\\)p -Fj(n)m(b)s(eep)p Fg(\\)p Fj(nrandom)p Fg(\\)p Fj(neasy)p -Fg(\\)p Fj(n".)45 b(The)32 b(\\new")i(and)e(\\b)s(eep")630 -978 y(commands)i(are)g(required.)51 b(Y)-8 b(ou)35 b(can)f(remo)m(v)m -(e)i(the)e(\\random")h(command)f(if)f(y)m(ou)h(lik)m(e;)630 -1088 y(including)28 b(it)j(causes)g(gn)m(ushogi)g(to)h(randomize)e(its) -h(mo)m(v)m(e)i(selection)e(sligh)m(tly)e(so)j(that)f(it)630 -1198 y(do)s(esn't)c(pla)m(y)g(the)h(same)g(mo)m(v)m(es)g(in)e(ev)m(ery) -i(game.)41 b(Ev)m(en)28 b(without)e(\\random",)j(gn)m(ushogi)630 -1307 y(randomizes)38 b(its)g(c)m(hoice)h(of)g(mo)m(v)m(es)h(from)e(its) -f(op)s(ening)h(b)s(o)s(ok.)64 b(Y)-8 b(ou)39 b(can)g(also)f(remo)m(v)m -(e)630 1417 y(\\easy")30 b(if)d(y)m(ou)i(lik)m(e;)f(including)d(it)j -(toggles)h(easy)g(mo)s(de)f(o\013,)h(causing)f(gn)m(ushogi)f(to)i -(think)630 1526 y(on)d(y)m(our)g(time.)39 b(That)25 b(is,)i(if)e -(\\easy")i(is)e(included)e(in)i(the)h(initString,)e(GNU)j(Shogi)e -(thinks)630 1636 y(on)33 b(y)m(our)h(time;)h(if)d(not,)j(it)e(do)s(es)g -(not.)50 b(\(Y)-8 b(es,)36 b(this)c(do)s(es)h(seem)h(bac)m(kw)m(ards,)h -(do)s(esn't)e(it.\))630 1745 y(Y)-8 b(ou)39 b(can)f(also)g(try)g -(adding)f(other)h(commands)g(to)h(the)f(initString;)h(see)g(the)g(gn)m -(ushogi)630 1855 y(do)s(cumen)m(tation)30 b(\(see)i(Chapter)d(3)i([gn)m -(ushogi],)g(page)g(27\))g(for)f(details.)150 2008 y(`)p -Fg(blackString)e(and)h(whiteString)p Fj(')630 2118 y(These)42 -b(resources)h(con)m(trol)g(what)f(is)g(sen)m(t)h(when)e(the)i(Mac)m -(hine)f(Blac)m(k)i(and)e(Mac)m(hine)630 2228 y(White)i(buttons)g(are)h -(selected.)84 b(This)43 b(is)g(mostly)h(for)g(compatibilit)m(y)f(with)g -(obsolete)630 2337 y(v)m(ersions)30 b(of)g(gn)m(ushogi.)630 -2469 y(Alternate)e(bitmaps)e(for)h(piece)h(icons)f(can)h(b)s(e)f(sp)s -(eci\014ed)e(either)i(b)m(y)h(c)m(ho)s(osing)f(one)h(of)g(the)630 -2578 y(built-in)j(sets)k(or)f(with)e(the)j(\014le)e(name)h(resources)g -(describ)s(ed)e(ab)s(o)m(v)m(e.)54 b(There)33 b(are)i(three)630 -2688 y(built-in)c(sets)j(of)g(piece)g(bitmaps)f(a)m(v)-5 -b(ailable,)34 b(large)g(\(the)g(default\),)h(medium,)e(or)h(small.)630 -2798 y(It)c(is)g(easiest)h(to)g(select)g(the)f(set)h(y)m(ou)g(prefer)f -(in)f(the)h(.Xdefaults)g(\014le:)630 2929 y(XShogi*b)s(oardSize:)39 -b(Medium)630 3061 y(The)25 b(fon)m(t)g(used)g(for)g(button)g(lab)s(els) -e(and)i(commen)m(ts)h(can)g(b)s(e)e(c)m(hanged)i(in)e(the)h(.Xdefaults) -630 3170 y(\014le.)40 b(Y)-8 b(ou)31 b(ma)m(y)g(w)m(an)m(t)g(to)g(c)m -(ho)s(ose)g(a)g(smaller)e(fon)m(t)i(if)e(y)m(ou)i(are)g(using)e(the)h -(small)f(pieces:)630 3302 y(XShogi*fon)m(t:)41 b(helv)m(etica)p -1536 3302 28 4 v 33 w(oblique12)630 3433 y(The)26 b(fon)m(t)i(used)e -(for)g(co)s(ordinates)h(\(when)f(the)h(sho)m(wCo)s(ords)f(option)g(is)g -(T)-8 b(rue\))27 b(can)g(b)s(e)f(set)630 3543 y(similarly:)630 -3674 y(XShogi*co)s(ordF)-8 b(on)m(t:)42 b(helv)m(etica)p -1780 3674 V 33 w(10)630 3806 y(If)30 b(y)m(ou)h(are)f(using)f(a)i(gra)m -(yscale)h(monitor,)e(try)g(setting)g(the)h(colors)f(to:)630 -3937 y(XShogi*pieceColor:)40 b(gra)m(y100)630 4047 y -(XShogi*squareColor:)g(gra)m(y60)275 4419 y(COMMAND)31 -b(BUTTONS)e(AND)i(KEYS)150 4661 y(`)p Fg(Quit)p Fj(')238 -b(Quits)29 b(xshogi.)40 b(Q)30 b(or)h(q)f(is)f(a)i(k)m(eyb)s(oard)f -(equiv)-5 b(alen)m(t.)150 4814 y(`)p Fg(Reset)p Fj(')190 -b(Resets)34 b(xshogi)e(to)h(the)g(b)s(eginning)e(of)h(a)i(shogi)e -(game.)49 b(It)33 b(also)g(deselects)g(an)m(y)g(game)h(or)630 -4924 y(p)s(osition)28 b(\014les.)150 5077 y(`)p Fg(Flip)h(View)p -Fj(')630 5187 y(in)m(v)m(erts)h(the)h(view)e(of)i(the)f(shogi)g(b)s -(oard.)150 5340 y(`)p Fg(Hint)p Fj(')238 b(displa)m(ys)28 -b(a)j(mo)m(v)m(e)h(hin)m(t)d(from)h(gn)m(ushogi.)p eop -%%Page: 37 39 -37 38 bop 150 -116 a Fj(Chapter)30 b(4:)41 b(xshogi)2793 -b(37)150 299 y(`)p Fg(Load)29 b(Game)p Fj(')630 408 y(pla)m(ys)34 -b(a)h(game)g(from)f(a)h(record)f(\014le.)52 b(If)34 b(no)h(\014le)e(is) -h(sp)s(eci\014ed)f(a)h(p)s(opup)f(dialog)h(asks)g(for)630 -518 y(a)39 b(\014lename.)63 b(Game)39 b(\014les)e(are)i(found)e(in)g -(the)h(directory)g(named)g(b)m(y)g(the)g(SHOGIDIR)630 -628 y(en)m(vironmen)m(t)26 b(v)-5 b(ariable.)39 b(If)26 -b(this)g(v)-5 b(ariable)25 b(is)h(not)h(declared)f(then)h(the)g(curren) -m(t)f(directory)630 737 y(is)34 b(used)g(unless)f(the)j(\014le)e(name)h -(starts)g(with)f(a)h(/.)55 b(G)35 b(or)g(g)g(is)f(a)h(k)m(eyb)s(oard)g -(equiv)-5 b(alen)m(t.)630 847 y(The)24 b(game)i(\014le)d(parser)h(will) -e(accept)27 b(almost)d(an)m(y)h(\014le)f(that)h(con)m(tains)g(mo)m(v)m -(es)h(in)d(algebraic)630 956 y(notation.)67 b(If)38 b(the)i(\014rst)e -(line)f(b)s(egins)g(with)h(`#',)k(it)c(is)g(assumed)h(to)g(b)s(e)g(a)g -(title)g(and)f(is)630 1066 y(displa)m(y)m(ed.)64 b(T)-8 -b(ext)39 b(enclosed)g(in)e(paren)m(theses)i(or)f(square)h(brac)m(k)m -(ets)h(is)d(assumed)h(to)i(b)s(e)630 1176 y(commen)m(tary)30 -b(and)f(is)f(displa)m(y)m(ed)g(in)g(a)h(p)s(op-up)f(windo)m(w.)38 -b(An)m(y)30 b(other)f(text)h(in)e(the)i(\014le)e(is)630 -1285 y(ignored.)150 1463 y(`)p Fg(Load)h(Position)p Fj(')630 -1573 y(sets)f(up)f(a)h(p)s(osition)e(from)h(a)h(p)s(osition)e(\014le.) -39 b(If)27 b(no)h(\014le)e(is)h(sp)s(eci\014ed)f(a)i(p)s(opup)e(dialog) -h(asks)630 1682 y(for)21 b(a)g(\014lename.)36 b(P)m(osition)21 -b(\014les)e(are)i(found)f(in)f(the)i(directory)f(named)h(b)m(y)f(the)h -(SHOGIDIR)630 1792 y(en)m(vironmen)m(t)26 b(v)-5 b(ariable.)39 -b(If)26 b(this)g(v)-5 b(ariable)25 b(is)h(not)h(declared)f(then)h(the)g -(curren)m(t)f(directory)630 1902 y(is)g(used)g(unless)f(the)i(\014le)f -(name)h(starts)h(with)d(a)j(/.)40 b(P)m(osition)26 b(\014les)g(m)m(ust) -h(b)s(e)f(in)f(the)j(format)630 2011 y(that)j(the)g(Sa)m(v)m(e)g(P)m -(osition)f(command)g(writes.)150 2189 y(`)p Fg(Save)f(Game)p -Fj(')630 2299 y(sa)m(v)m(es)42 b(a)e(game)i(to)f(a)g(record)f(\014le.) -70 b(If)39 b(no)i(\014le)e(is)g(sp)s(eci\014ed)g(a)i(p)s(opup)d(dialog) -i(asks)g(for)630 2408 y(a)34 b(\014lename.)50 b(If)33 -b(the)h(\014lename)f(exists,)i(the)e(user)g(is)g(ask)m(ed)h(whether)g -(the)f(curren)m(t)h(game)630 2518 y(record)24 b(is)g(b)s(e)g(app)s -(ended)e(to)j(this)f(\014le)f(or)i(if)e(the)i(\014le)e(should)g(b)s(e)h -(replaced.)38 b(Game)25 b(\014les)f(are)630 2628 y(sa)m(v)m(ed)33 -b(in)d(the)i(directory)g(named)f(b)m(y)h(the)g(SHOGIDIR)f(en)m -(vironmen)m(t)h(v)-5 b(ariable.)44 b(If)31 b(this)630 -2737 y(v)-5 b(ariable)31 b(is)f(not)i(declared)f(then)h(the)g(curren)m -(t)f(directory)g(is)g(used)g(unless)f(the)i(\014le)f(name)630 -2847 y(starts)h(with)f(a)h(/.)46 b(Game)33 b(\014les)e(are)h(h)m -(uman-readable,)g(and)f(can)h(also)g(b)s(e)g(read)f(bac)m(k)i(b)m(y)630 -2956 y(the)38 b(Load)g(Game)h(command.)63 b(F)-8 b(urthermore,)40 -b(they)e(are)g(accepted)h(as)g(gn)m(ushogi)e(text)630 -3066 y(b)s(o)s(ok\014les.)150 3244 y(`)p Fg(Save)29 b(Position)p -Fj(')630 3354 y(sa)m(v)m(es)j(a)f(p)s(osition)d(to)k(a)e(p)s(osition)f -(\014le.)40 b(If)30 b(no)h(\014le)e(is)h(sp)s(eci\014ed)f(a)h(p)s(opup) -f(dialog)h(asks)g(for)630 3463 y(a)j(\014lename.)46 b(P)m(osition)32 -b(\014les)g(are)h(sa)m(v)m(ed)g(in)e(the)i(directory)f(named)g(b)m(y)h -(the)f(SHOGIDIR)630 3573 y(en)m(vironmen)m(t)26 b(v)-5 -b(ariable.)39 b(If)26 b(this)g(v)-5 b(ariable)25 b(is)h(not)h(declared) -f(then)h(the)g(curren)m(t)f(directory)630 3682 y(is)k(used)h(unless)e -(the)j(\014le)e(name)h(starts)h(with)e(a)i(/.)43 b(P)m(osition)31 -b(\014les)f(are)i(h)m(uman-readable,)630 3792 y(and)e(can)g(also)h(b)s -(e)e(read)i(bac)m(k)g(b)m(y)f(the)h(Load)f(P)m(osition)g(command.)150 -3970 y(`)p Fg(Machine)f(White)p Fj(')630 4080 y(forces)i(gn)m(ushogi)f -(to)h(pla)m(y)f(white.)150 4258 y(`)p Fg(Machine)f(Black)p -Fj(')630 4367 y(forces)i(gn)m(ushogi)f(to)h(pla)m(y)f(blac)m(k.)150 -4545 y(`)p Fg(Force)f(Moves)p Fj(')630 4655 y(forces)h(a)g(series)g(of) -g(mo)m(v)m(es.)41 b(That)30 b(is,)f(gn)m(ushogi)h(stops)f(pla)m(ying)g -(and)g(xshogi)g(allo)m(ws)h(y)m(ou)630 4765 y(to)h(mak)m(e)g(mo)m(v)m -(es)h(for)e(b)s(oth)g(white)f(and)h(blac)m(k.)150 4943 -y(`)p Fg(Two)g(Machines)p Fj(')630 5052 y(pla)m(ys)g(a)h(game)g(b)s(et) -m(w)m(een)g(t)m(w)m(o)h(computer)e(programs.)150 5230 -y(`)p Fg(Forward)p Fj(')94 b(mo)m(v)m(es)41 b(forw)m(ard)e(through)g(a) -h(series)e(of)i(remem)m(b)s(ered)f(mo)m(v)m(es.)69 b(F)40 -b(or)f(f)h(is)e(a)i(k)m(eyb)s(oard)630 5340 y(equiv)-5 -b(alen)m(t.)p eop -%%Page: 38 40 -38 39 bop 150 -116 a Fj(38)2734 b(GNU)31 b(Shogi)f(man)m(ual)150 -299 y(`)p Fg(Backward)p Fj(')630 408 y(mo)m(v)m(es)j(bac)m(kw)m(ard)g -(through)e(a)i(series)e(of)h(remem)m(b)s(ered)g(mo)m(v)m(es.)47 -b(As)32 b(a)g(side)f(e\013ect,)k(puts)630 518 y(xshogi)30 -b(in)m(to)g(F)-8 b(orce)32 b(Mo)m(v)m(es)g(mo)s(de.)41 -b(B)30 b(or)h(b)f(is)f(a)i(k)m(eyb)s(oard)f(equiv)-5 -b(alen)m(t.)150 683 y(`)p Fg(Pause)p Fj(')190 b(pauses)24 -b(the)g(clo)s(c)m(ks)g(or)h(\(in)e(Load)h(Game)h(mo)s(de\))f(pauses)g -(the)g(game)i(b)s(eing)c(loaded.)38 b(Press)630 792 y(P)m(ause)31 -b(again)f(to)h(con)m(tin)m(ue.)41 b(P)31 b(or)f(p)g(is)f(a)i(k)m(eyb)s -(oard)f(equiv)-5 b(alen)m(t.)150 957 y(`)p Fg(Edit)29 -b(Position)p Fj(')630 1066 y(lets)f(y)m(ou)h(set)g(up)e(an)i(arbitrary) -e(b)s(oard)g(p)s(osition.)39 b(Use)28 b(mouse)h(button)f(1)h(to)g(drag) -f(pieces)630 1176 y(to)37 b(new)f(squares,)i(or)f(to)g(delete)g(a)g -(piece)g(b)m(y)f(dragging)g(it)g(o\013)h(the)g(b)s(oard)f(or)g -(dragging)630 1285 y(an)f(empt)m(y)g(square)g(on)g(top)h(of)f(it.)54 -b(T)-8 b(o)36 b(drop)e(a)h(new)g(piece)g(on)g(a)g(square,)i(press)d -(mouse)630 1395 y(button)26 b(2)g(or)g(3)h(o)m(v)m(er)g(the)g(square.) -39 b(This)24 b(brings)g(up)h(a)i(men)m(u)f(of)g(blac)m(k)g(pieces)g -(\(button)g(2\))630 1505 y(or)32 b(white)f(pieces)h(\(button)g(3\).)46 -b(Additional)29 b(men)m(u)j(c)m(hoices)h(let)e(y)m(ou)i(empt)m(y)f(the) -g(square)630 1614 y(or)g(clear)h(the)f(b)s(oard.)45 b(Y)-8 -b(ou)33 b(can)g(set)f(the)h(side)e(to)i(pla)m(y)f(next)g(b)m(y)g(clic)m -(king)f(on)i(the)f(Blac)m(k)630 1724 y(or)e(White)h(indicator)e(at)i -(the)f(top)h(of)g(the)f(screen.)150 1888 y(`)p Fg(Challenge)p -Fj(')630 1998 y(allo)m(ws)f(y)m(ou)h(to)h(mak)m(e)g(a)f(t)m(w)m(o)h -(displa)m(y)d(game)j(b)s(et)m(w)m(een)f(t)m(w)m(o)h(h)m(uman)e(pla)m(y) -m(ers.)41 b(En)m(ter)30 b(the)630 2108 y(displa)m(y)36 -b(y)m(ou)j(w)m(an)m(t)g(to)g(connect)g(to.)65 b(If)37 -b(y)m(ou)i(are)g(allo)m(w)m(ed)f(to)g(connect,)k(a)c(new)g(b)s(oard)630 -2217 y(is)h(displa)m(y)m(ed)f(at)j(the)f(remote)h(displa)m(y)-8 -b(.)68 b(Challenge)38 b(mo)s(de)i(can)g(only)f(b)s(e)g(stopp)s(ed)g(b)m -(y)630 2327 y(pressing)29 b(\\quit".)150 2491 y(`)p Fg(Select)g(Level)p -Fj(')630 2601 y(allo)m(ws)f(y)m(ou)g(to)h(reset)g(the)f(clo)s(c)m(ks)h -(for)f(b)s(oth)f(pla)m(y)m(ers.)40 b(En)m(ter)28 b(the)h(n)m(um)m(b)s -(er)e(of)h(mo)m(v)m(es)i(and)630 2710 y(the)h(n)m(um)m(b)s(er)e(of)h -(min)m(utes)g(in)f(whic)m(h)g(the)h(mo)m(v)m(es)i(should)c(b)s(e)i -(done.)150 2875 y(`)p Fg(Move)f(NOW)p Fj(')65 b(force)31 -b(computer)f(to)h(stop)g(thinking)d(and)i(to)h(mak)m(e)g(the)g(curren)m -(t)f(b)s(est)g(mo)m(v)m(e.)150 3040 y(`)p Fg(Iconify)f(I,)g(i,)h(C)g -(or)g(c)p Fj(')630 3149 y(iconi\014es)f(xshogi.)275 3426 -y(LIMIT)-8 b(A)g(TIONS)275 3675 y(If)28 b(y)m(ou)g(press)g(the)h(P)m -(ause)f(button)h(during)d(GNU)j(Shogi's)e(turn,)h(xshogi)g(will)e(stop) -j(the)f(clo)s(c)m(ks,)i(but)150 3785 y(gn)m(ushogi)g(will)d(still)i -(mak)m(e)i(a)g(mo)m(v)m(e.)275 3924 y(After)d(a)h(mate)h(or)f(dra)m(w)f -(when)g(pla)m(ying)f(against)i(gn)m(ushogi,)g(if)e(y)m(ou)i(bac)m(k)h -(up)d(with)h(the)h(Bac)m(kw)m(ard)150 4034 y(button,)h(the)h(clo)s(c)m -(ks)f(are)h(reset)g(\(b)s(ecause)g(gn)m(ushogi)f(has)g(exited)g(and)g -(m)m(ust)g(b)s(e)g(restarted\).)275 4173 y(The)f(game)j(parser)e -(recognizes)h(only)e(algebraic)h(notation.)275 4423 y(A)m(UTHORS)275 -4672 y(Original)d(authors)j(of)h(XBoard:)41 b(Chris)28 -b(Sears)i(and)g(Dan)h(Sears.)275 4812 y(Enhancemen)m(ts)f(for)g(XBoard) -h(\(V)-8 b(ersion)30 b(2.0\):)42 b(Tim)29 b(Mann.)275 -4951 y(Con)m(v)m(ersion)g(to)j(XShogi)d(\(V)-8 b(ersion)31 -b(1.1\):)42 b(Matthias)31 b(Mutz.)275 5091 y(Curren)m(t)e(main)m -(tainer:)40 b(Mik)m(e)30 b(V)-8 b(anier.)275 5340 y(COPYRIGHT)29 -b(INF)m(ORMA)-8 b(TION)p eop -%%Page: 39 41 -39 40 bop 150 -116 a Fj(Chapter)30 b(4:)41 b(xshogi)2793 -b(39)275 299 y(XShogi)29 b(b)s(orro)m(ws)h(its)f(piece)i(bitmaps)e -(from)h(CRANES)f(Shogi.)275 433 y(Cop)m(yrigh)m(t)83 -b(1991)j(b)m(y)e(Digital)f(Equipmen)m(t)f(Corp)s(oration,)97 -b(Ma)m(ynard,)h(Massac)m(h)m(usetts.)150 543 y(Enhancemen)m(ts)39 -b(Cop)m(yrigh)m(t)f(1992)j(F)-8 b(ree)40 b(Soft)m(w)m(are)g(F)-8 -b(oundation,)41 b(Inc.)66 b(Enhancemen)m(ts)39 b(Cop)m(yrigh)m(t)150 -653 y(1993)k(Matthias)f(Mutz.)74 b(F)-8 b(urther)41 b(enhancemen)m(ts)h -(cop)m(yrigh)m(t)f(1999)i(b)m(y)f(Mic)m(hael)f(V)-8 b(anier)41 -b(and)g(the)150 762 y(F)-8 b(ree)31 b(Soft)m(w)m(are)h(F)-8 -b(oundation,)30 b(Inc.)275 897 y(The)44 b(follo)m(wing)f(terms)i(apply) -e(to)j(Digital)e(Equipmen)m(t)f(Corp)s(oration's)h(cop)m(yrigh)m(t)h -(in)m(terest)g(in)150 1006 y(XBoard:)275 1141 y(All)29 -b(Righ)m(ts)h(Reserv)m(ed)275 1275 y(P)m(ermission)f(to)j(use,)f(cop)m -(y)-8 b(,)33 b(mo)s(dify)-8 b(,)30 b(and)h(distribute)d(this)i(soft)m -(w)m(are)j(and)e(its)f(do)s(cumen)m(tation)h(for)150 -1385 y(an)m(y)36 b(purp)s(ose)e(and)g(without)h(fee)h(is)e(hereb)m(y)i -(gran)m(ted,)h(pro)m(vided)d(that)i(the)g(ab)s(o)m(v)m(e)h(cop)m(yrigh) -m(t)f(notice)150 1494 y(app)s(ear)30 b(in)f(all)g(copies)h(and)f(that)i -(b)s(oth)f(that)h(cop)m(yrigh)m(t)f(notice)h(and)f(this)f(p)s -(ermission)e(notice)k(app)s(ear)150 1604 y(in)j(supp)s(orting)e(do)s -(cumen)m(tation,)k(and)f(that)g(the)h(name)f(of)g(Digital)f(not)i(b)s -(e)e(used)g(in)g(adv)m(ertising)g(or)150 1714 y(publicit)m(y)18 -b(p)s(ertaining)g(to)j(distribution)16 b(of)21 b(the)f(soft)m(w)m(are)i -(without)d(sp)s(eci\014c,)j(written)d(prior)g(p)s(ermission.)275 -1848 y(DIGIT)-8 b(AL)24 b(DISCLAIMS)f(ALL)h(W)-10 b(ARRANTIES)23 -b(WITH)h(REGARD)h(TO)e(THIS)g(SOFTW)-10 b(ARE,)150 1958 -y(INCLUDING)26 b(ALL)f(IMPLIED)g(W)-10 b(ARRANTIES)25 -b(OF)g(MER)m(CHANT)-8 b(ABILITY)26 b(AND)g(FITNESS,)150 -2067 y(IN)41 b(NO)g(EVENT)h(SHALL)e(DIGIT)-8 b(AL)42 -b(BE)g(LIABLE)f(F)m(OR)h(ANY)f(SPECIAL,)g(INDIRECT)f(OR)150 -2177 y(CONSEQUENTIAL)50 b(D)m(AMA)m(GES)k(OR)d(ANY)h(D)m(AMA)m(GES)i -(WHA)-8 b(TSOEVER)51 b(RESUL)-8 b(TING)150 2286 y(FR)m(OM)66 -b(LOSS)d(OF)i(USE,)g(D)m(A)-8 b(T)g(A)66 b(OR)f(PR)m(OFITS,)f(WHETHER)h -(IN)g(AN)g(A)m(CTION)g(OF)150 2396 y(CONTRA)m(CT,)43 -b(NEGLIGENCE)g(OR)g(OTHER)g(TOR)-8 b(TIOUS)42 b(A)m(CTION,)h(ARISING)g -(OUT)g(OF)150 2506 y(OR)30 b(IN)g(CONNECTION)f(WITH)i(THE)f(USE)f(OR)h -(PERF)m(ORMANCE)h(OF)f(THIS)g(SOFTW)-10 b(ARE.)275 2640 -y(The)36 b(follo)m(wing)g(terms)h(apply)f(to)i(the)g(enhanced)f(v)m -(ersion)g(of)g(XShogi)g(distributed)d(b)m(y)j(the)h(F)-8 -b(ree)150 2750 y(Soft)m(w)m(are)31 b(F)-8 b(oundation:)275 -2884 y(This)28 b(\014le)i(is)f(part)h(of)h(XSHOGI.)275 -3019 y(XSHOGI)h(is)f(distributed)f(in)h(the)i(hop)s(e)e(that)i(it)f -(will)e(b)s(e)i(useful,)g(but)f(WITHOUT)h(ANY)h(W)-10 -b(AR-)150 3128 y(RANTY.)30 b(No)g(author)f(or)h(distributor)d(accepts)k -(resp)s(onsibilit)m(y)25 b(to)31 b(an)m(y)m(one)f(for)g(the)g -(consequences)g(of)150 3238 y(using)e(it)h(or)g(for)g(whether)g(it)g -(serv)m(es)h(an)m(y)f(particular)f(purp)s(ose)g(or)h(w)m(orks)g(at)h -(all,)f(unless)f(he)h(sa)m(ys)h(so)f(in)150 3347 y(writing.)39 -b(Refer)30 b(to)h(the)g(XSHOGI)f(General)g(Public)e(License)i(for)g -(full)e(details.)275 3482 y(Ev)m(ery)m(one)43 b(is)f(gran)m(ted)h(p)s -(ermission)c(to)44 b(cop)m(y)-8 b(,)47 b(mo)s(dify)40 -b(and)i(redistribute)e(XSHOGI,)j(but)f(only)150 3592 -y(under)d(the)i(conditions)e(describ)s(ed)g(in)g(the)i(XSHOGI)f -(General)h(Public)d(License.)71 b(A)41 b(cop)m(y)g(of)g(this)150 -3701 y(license)34 b(is)f(supp)s(osed)g(to)i(ha)m(v)m(e)h(b)s(een)d(giv) -m(en)i(to)g(y)m(ou)g(along)g(with)e(XSHOGI)h(so)h(y)m(ou)g(can)f(kno)m -(w)h(y)m(our)150 3811 y(righ)m(ts)f(and)h(resp)s(onsibilities.)49 -b(It)35 b(should)e(b)s(e)i(in)e(a)j(\014le)e(named)g(COPYING.)h(Among)h -(other)f(things,)150 3920 y(the)c(cop)m(yrigh)m(t)f(notice)h(and)f -(this)f(notice)i(m)m(ust)f(b)s(e)g(preserv)m(ed)g(on)g(all)f(copies.)p -eop -%%Page: 40 42 -40 41 bop 150 -116 a Fj(40)2734 b(GNU)31 b(Shogi)f(man)m(ual)p -eop -%%Page: 41 43 -41 42 bop 150 -116 a Fj(Chapter)30 b(5:)41 b(References)31 -b(and)f(links)2231 b(41)150 299 y Fh(5)80 b(References)52 -b(and)i(links)275 506 y Fj(There)30 b(are)g(v)m(ery)h(few)f -(English-language)f(b)s(o)s(oks)h(for)g(p)s(eople)g(learning)f(shogi.) -40 b(The)30 b(t)m(w)m(o)i(I)e(recom-)150 616 y(mend)f(are:)199 -835 y(1.)61 b Ff(Shogi)40 b(for)h(Beginners,)i(2nd.)71 -b(Edition)p Fj(,)42 b(b)m(y)f(John)f(F)-8 b(airbairn.)71 -b(This)39 b(is)h(a)h(sup)s(erb)e(b)s(eginner's)330 945 -y(b)s(o)s(ok)57 b(in)f(ev)m(ery)j(w)m(a)m(y)-8 b(,)66 -b(co)m(v)m(ering)58 b(all)f(phases)g(of)h(the)g(game.)123 -b(It)58 b(w)m(as)g(out)g(of)g(prin)m(t)e(for)330 1054 -y(a)k(long)e(time,)67 b(but)58 b(has)h(no)m(w)g(b)s(een)g(reprin)m(ted) -f(and)g(is)h(a)m(v)-5 b(ailable)58 b(either)h(from)g(Kiseido)330 -1164 y(\()p Fg(http://www.labnet.or.jp/~k)o(ise)o(ido)p -Fj(\))24 b(or)31 b(from)f(George)h(Ho)s(dges)g(\(see)h(b)s(elo)m(w\).) -199 1293 y(2.)61 b Ff(The)54 b(Art)g(of)g(Shogi)p Fj(,)59 -b(b)m(y)54 b(T)-8 b(on)m(y)55 b(Hoskings.)111 b(This)52 -b(is)h(one)i(step)f(up)f(from)g(the)i(F)-8 b(airbairn)330 -1403 y(b)s(o)s(ok.)120 b(It)57 b(co)m(v)m(ers)i(a)e(lot)g(of)h(ground,) -63 b(and)56 b(is)g(esp)s(ecially)f(notew)m(orth)m(y)k(for)d(its)h -(detailed)330 1512 y(treatmen)m(t)36 b(of)f(op)s(ening)e(lines.)51 -b(Y)-8 b(ou)36 b(can)e(order)g(this)g(b)s(o)s(ok)g(from)g(Amazon.com's) -i(UK)f(branc)m(h)330 1622 y(\()p Fg(http://www.amazon.co.uk)p -Fj(\).)275 1880 y(Another)25 b(b)s(o)s(ok)g(y)m(ou)h(ma)m(y)g(\014nd)e -(is)h Ff(Shogi:)38 b(Japan's)25 b(Game)h(of)g(Strategy)35 -b Fj(b)m(y)25 b(T)-8 b(rev)m(or)26 b(Leggett.)42 b(This)150 -1990 y(b)s(o)s(ok)37 b(is)g(v)m(ery)h(elemen)m(tary)h(and)e(is)g -(somewhat)h(outdated,)j(ha)m(ving)c(b)s(een)g(published)d(\014rst)j(in) -g(1966.)150 2099 y(Ho)m(w)m(ev)m(er,)c(it)d(do)s(es)g(feature)h(a)f -(pap)s(er)g(shogi)g(b)s(oard)f(and)h(punc)m(h-out)g(pieces,)g(so)h(if)e -(y)m(ou)i(w)m(an)m(t)g(a)g(really)150 2209 y(c)m(heap)g(shogi)f(set)h -(y)m(ou)g(migh)m(t)f(pic)m(k)g(this)f(b)s(o)s(ok)h(up.)39 -b(It)31 b(is)e(still)f(in)h(prin)m(t.)275 2338 y(Tw)m(o)i(b)s(o)s(oks)f -(that)h(are)h(no)f(longer)f(in)g(prin)m(t)f(but)h(are)i(de\014nitely)d -(w)m(orth)i(getting)g(if)f(y)m(ou)i(\014nd)d(them)150 -2447 y(are)35 b Ff(Guide)e(to)i(Shogi)e(Op)s(enings)j -Fj(and)e Ff(Better)h(Mo)m(v)m(es)h(for)e(Better)i(Shogi)p -Fj(,)f(b)s(oth)e(b)m(y)h(Aono)h(T)-8 b(eriuc)m(hi.)150 -2557 y(They)38 b(are)h(published)c(in)i(a)i(bilingual)c(edition)j -(\(English/Japanese\))f(and)i(are)g(the)f(only)g(b)s(o)s(oks)g(on)150 -2667 y(shogi)e(in)g(English)e(written)i(b)m(y)g(a)i(Japanese)f -(professional)e(shogi)h(pla)m(y)m(er.)60 b(John)36 b(F)-8 -b(airbairn)35 b(did)g(the)150 2776 y(translation)29 b(from)h(Japanese)h -(to)g(English.)275 2905 y(Shogi)e(sets)i(are)g(a)m(v)-5 -b(ailable)29 b(from:)390 3138 y(George)j(F.)f(Ho)s(dges)390 -3242 y(P)-8 b(.O.)31 b(Bo)m(x)g(77)390 3346 y(Bromley)-8 -b(,)31 b(Ken)m(t)390 3450 y(United)f(Kingdom)e(BR1)k(2WT)275 -3688 y(George)k(also)g(sells)d(equipmen)m(t)i(for)g(all)f(the)h -(historical)f(shogi)h(v)-5 b(arian)m(ts)35 b(\(see)h(Section)f(2.4)i -([Shogi)150 3798 y(v)-5 b(arian)m(ts],)34 b(page)f(23\))h(\(except)g -(for)e(Ky)m(oku)h(tai)g(shogi\))f(and)g(also)h(sells)e(bac)m(k)i -(issues)f(of)g(the)h(magazine)150 3908 y(\\Shogi")39 -b(whic)m(h)f(he)i(published)35 b(for)k(70)h(issues)e(in)g(the)i(late)g -(70's)g(to)g(late)g(80's.)68 b(This)38 b(magazine)i(is)150 -4017 y(STR)m(ONGL)-8 b(Y)32 b(recommended;)g(it)f(con)m(tains)h(more)g -(information)e(ab)s(out)h(shogi)g(in)g(English)e(than)j(y)m(ou)150 -4127 y(will)c(ev)m(er)j(\014nd)e(an)m(ywhere)h(else.)275 -4256 y(Here)g(are)h(some)g(useful)e(URLs:)150 4495 y(Pieter)h -(Stouten's)h(shogi)f(page:)41 b Fg(http://www.shogi.net)630 -4604 y Fj(This)29 b(is)h(the)h(main)e(shogi-related)i(site)f(on)h(the)g -(in)m(ternet,)g(with)e(links)g(to)i(almost)g(all)f(the)630 -4714 y(other)h(sites.)150 4863 y(Roger)g(Hare's)g(shogi)f(page:)42 -b Fg(http://www.ed.ac.uk/~r)o(jhar)o(e/sh)o(ogi)630 4972 -y Fj(This)29 b(has)h(lots)g(of)g(information,)f(including)e(full)h -(rules)h(to)i(most)g(of)g(the)f(shogi)g(v)-5 b(arian)m(ts.)150 -5121 y(P)m(atric)m(k)31 b(Da)m(vin's)g(Shogi)e(Nexus:)41 -b Fg(http://www.vega.or.jp/~)o(patr)o(ick/)o(sho)o(gi/)630 -5230 y Fj(There's)32 b(lots)h(of)f(co)s(ol)h(stu\013)f(on)h(this)e -(site;)j(m)m(y)f(fa)m(v)m(orite)h(is)d(the)i(extensiv)m(e)g(collection) -g(of)630 5340 y(Tsume-shogi)22 b(\(mating\))h(problems,)f(b)s(oth)g -(for)h(b)s(eginners)d(and)i(more)h(adv)-5 b(anced)23 -b(pla)m(y)m(ers.)p eop -%%Page: 42 44 -42 43 bop 150 -116 a Fj(42)2734 b(GNU)31 b(Shogi)f(man)m(ual)150 -299 y(Stev)m(e)h(Ev)-5 b(ans')31 b(shogi)e(page:)42 b -Fg(http://www.netspace.net.)o(au/~)o(tro)o(ut/i)o(ndex)o(.ht)o(ml)630 -408 y Fj(Stev)m(e)32 b(has)e(written)g(a)h(program)g(that)g(pla)m(ys)f -(almost)h(all)f(of)h(the)g(shogi)f(v)-5 b(arian)m(ts,)31 -b(unfor-)630 518 y(tunately)f(it)g(only)g(runs)e(on)j(Windo)m(ws)e -(:-\()150 677 y(Hans)h(Bo)s(dlaender's)g(c)m(hess)h(v)-5 -b(arian)m(t)30 b(pages:)41 b Fg(http://www.cs.ruu.nl/~han)o(sb/d)o(.ch) -o(essv)o(ar)630 787 y Fj(This)31 b(page)i(has)g(an)f(almost)h -(unimaginable)d(v)-5 b(ariet)m(y)33 b(of)g(rules)e(for)h(di\013eren)m -(t)g(c)m(hess)h(v)-5 b(ari-)630 897 y(an)m(ts,)31 b(including)c(man)m -(y)k(shogi)e(v)-5 b(arian)m(ts)31 b(\(historical)e(and)g -(non-historical\).)p eop -%%Page: 43 45 -43 44 bop 150 -116 a Fj(Chapter)30 b(6:)41 b(Ac)m(kno)m(wledgemen)m(ts) -2295 b(43)150 299 y Fh(6)80 b(Ac)l(kno)l(wledgemen)l(ts)275 -533 y Fj(I)30 b(w)m(ould)f(lik)m(e)g(to)j(thank)e(the)g(follo)m(wing)f -(p)s(eople:)225 752 y Fi(\017)60 b Fj(Matthias)35 b(Mutz,)h(who)e -(originally)e(dev)m(elop)s(ed)i(GNU)h(shogi)f(as)h(a)g(spin-o\013)e(of) -i(GNU)g(c)m(hess)g(and)330 862 y(who)30 b(v)m(ery)h(kindly)c(let)k(me)f -(tak)m(e)i(o)m(v)m(er)g(the)e(main)m(tenance)h(of)g(this)e(v)m(ery)i -(in)m(teresting)f(pro)5 b(ject.)225 996 y Fi(\017)60 -b Fj(Ric)m(hard)22 b(Stallman)f(and)h(the)h(F)-8 b(ree)24 -b(Soft)m(w)m(are)f(F)-8 b(oundation,)25 b(for)d(creating)h(an)g -(organization)f(where)330 1106 y(an)m(y)m(one)38 b(can)f(con)m(tribute) -f(soft)m(w)m(are)i(for)e(the)h(common)g(go)s(o)s(d)f(of)h(all,)g(for)f -(making)g(GNU/Lin)m(ux)330 1215 y(p)s(ossible,)22 b(and)h(esp)s -(ecially)e(for)i(writing)f(emacs)i(and)e(gcc,)k(without)d(whic)m(h)e(m) -m(y)j(w)m(orking)e(life)g(w)m(ould)330 1325 y(b)s(e)30 -b(in)m(tolerable.)225 1460 y Fi(\017)60 b Fj(Georges)30 -b(Ho)s(dges,)f(for)f(starting)g(the)g(Shogi)g(Asso)s(ciation)g(in)e -(England,)i(without)f(whic)m(h)g(I)h(w)m(ould)330 1569 -y(probably)i(nev)m(er)h(ha)m(v)m(e)i(heard)e(of)g(shogi,)h(for)f -(supplying)d(shogi)j(equipmen)m(t,)g(for)g(publishing)c(the)330 -1679 y(excellen)m(t)33 b(magazine)h(\\Shogi")f(\(no)m(w)g(sadly)f -(defunct\),)h(for)g(p)s(ersonally)e(answ)m(ering)h(all)f(m)m(y)i(silly) -330 1788 y(questions)c(b)m(y)i(mail,)e(and)h(for)g(b)s(eing)f(the)h(am) -m(bassador)h(of)g(shogi)e(to)j(the)e(W)-8 b(est.)225 -1923 y Fi(\017)60 b Fj(Pieter)30 b(Stouten,)g(for)g(ha)m(ving)g(the)g -(most)h(comprehensiv)m(e)e(shogi)h(site)g(on)g(the)g(W)-8 -b(orld)30 b(Wide)f(W)-8 b(eb)330 2032 y(\()p Fg(http://www.shogi.net)p -Fj(\),)27 b(and)j(for)h(main)m(taining)e(the)i(shogi-l)f(mailing)f -(list.)41 b(Go)31 b(to)h(Pieter's)330 2142 y(w)m(eb)f(site)f(for)g -(more)h(information)e(on)i(subscribing)c(to)k(the)g(list.)40 -b(Also)31 b(thanks)f(to)h(ev)m(ery)m(one)h(who)330 2252 -y(con)m(tributes)e(and)g(has)g(con)m(tributed)f(to)j(that)f(list.)225 -2386 y Fi(\017)60 b Fj(Matt)24 b(Casters,)h(for)e(testing)g(GNU)h -(shogi.)38 b(Matt)24 b(and)e(I)h(will)e(b)s(e)h(w)m(orking)g(together)j -(on)e(impro)m(ving)330 2496 y(the)31 b(solution)e(engine)g(in)g(future) -h(v)m(ersions)g(of)g(this)f(program.)p eop -%%Page: 44 46 -44 45 bop 150 -116 a Fj(44)2734 b(GNU)31 b(Shogi)f(man)m(ual)p -eop -%%Page: 45 47 -45 46 bop 150 -116 a Fj(Chapter)30 b(7:)41 b(Bugs)2848 -b(45)150 299 y Fh(7)80 b(Bugs)275 533 y Fj(The)39 b(motto)i(of)f(GNU)h -(shogi)e(is)g(\\100\045)j(bug-free)d(or)h(y)m(ou)h(don't)f(pa)m(y!")70 -b(:-\))41 b(In)e(the)h(extremely)150 643 y(unlik)m(ely)31 -b(case)k(\(*ahem*\))g(that)f(y)m(ou)g(do)g(\014nd)e(a)i(bug,)g(please)f -(send)g(me)h(\(Mik)m(e)g(V)-8 b(anier\))34 b(an)g(email)e(at)150 -752 y Fg(mvanier@cs.caltech.edu)p Fj(.)46 b(Also,)35 -b(feel)f(free)h(to)g(send)e(me)h(commen)m(ts,)j(complain)m(ts,)d -(out-and-out)150 862 y(ra)m(v)m(es,)45 b(suggestions,)g(plane)40 -b(tic)m(k)m(ets)j(to)f(Ha)m(w)m(aii,)i(and/or)d(large)g(suitcases)h -(\014lled)d(with)h(unmark)m(ed,)150 971 y(un)m(traceable)31 -b(h)m(undred-dollar)c(bills.)p eop -%%Page: 46 48 -46 47 bop 150 -116 a Fj(46)2734 b(GNU)31 b(Shogi)f(man)m(ual)p -eop -%%Page: 47 49 -47 48 bop 150 -116 a Fj(Chapter)30 b(8:)41 b(Index)2821 -b(47)150 299 y Fh(8)80 b(Index)150 623 y Fk(A)150 755 -y Fc(Ac)n(kno)n(wledgemen)n(ts)10 b Fb(.)h(.)i(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -g(.)36 b Fc(43)150 1021 y Fk(B)150 1154 y Fc(Bo)r(oks)7 -b Fb(.)14 b(.)e(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)g(.)h(.)f(.)g(.)33 b Fc(41)150 1420 y Fk(C)150 1552 -y Fc(Ch)n(u)25 b(Shogi)8 b Fb(.)13 b(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)33 b Fc(23)150 1818 y -Fk(D)150 1951 y Fc(Dai)26 b(Shogi)18 b Fb(.)13 b(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)44 b Fc(23)150 -2050 y(Dai-dai)26 b(Shogi)9 b Fb(.)j(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)34 b Fc(23)150 2150 y(Dra)n(ws)23 -b Fb(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)47 b Fc(17)150 2250 y(Drops)9 b Fb(.)j(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)35 -b Fc(16)150 2516 y Fk(G)150 2648 y Fc(gn)n(ushogi)17 -b Fb(.)c(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)43 b Fc(27)150 2748 y(GPL)12 b Fb(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 -b Fc(5)150 3014 y Fk(H)150 3146 y Fc(Handicaps)8 b Fb(.)k(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)33 -b Fc(18)150 3412 y Fk(I)150 3545 y Fc(In)n(tro)r(duction)9 -b Fb(.)j(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)35 -b Fc(3)150 3811 y Fk(K)150 3943 y Fc(Ky)n(oku)24 b(T)-6 -b(ai)27 b(Shogi)9 b Fb(.)k(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)35 -b Fc(23)150 4209 y Fk(L)150 4342 y Fc(License)25 b Fb(.)12 -b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) -g(.)h(.)50 b Fc(5)150 4608 y Fk(M)150 4740 y Fc(Mailing)27 -b(lists)12 b Fb(.)i(.)e(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)37 b Fc(41)150 4840 y(Mak)l(a-dai-dai)26 b(Shogi)21 -b Fb(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)46 b Fc(23)2025 -623 y Fk(O)2025 771 y Fc(Op)r(ening)25 b(setup)10 b Fb(.)i(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)36 b Fc(15)2025 1082 -y Fk(P)2025 1230 y Fc(Piece)26 b(mo)n(v)n(es)16 b Fb(.)c(.)g(.)g(.)h(.) -f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)41 b Fc(14)2025 -1337 y(Piece)26 b(promotion)17 b Fb(.)c(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)43 b Fc(15)2025 1648 y Fk(R)2025 1796 y Fc(References)24 -b Fb(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -49 b Fc(41)2025 1903 y(Rules)17 b Fb(.)12 b(.)g(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)42 -b Fc(13)2025 2214 y Fk(S)2025 2362 y Fc(Sample)25 b(game)14 -b Fb(.)e(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)40 -b Fc(19)2025 2469 y(Shogi)26 b(v)l(arian)n(ts)17 b Fb(.)c(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)43 b Fc(23)2025 2576 -y(Shogi)26 b(vs.)34 b(Chess)8 b Fb(.)14 b(.)e(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)g(.)h(.)34 b Fc(24)2025 2886 y Fk(T)2025 3035 -y Fc(T)-6 b(ai)26 b(Shogi)d Fb(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)49 b Fc(23)2025 3142 -y(T)-6 b(enjiku)25 b(Shogi)f Fb(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)49 b Fc(23)2025 3249 y(T)-6 b(ori)26 -b(Shogi)8 b Fb(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -g(.)h(.)f(.)g(.)34 b Fc(23)2025 3559 y Fk(V)2025 3708 -y Fc(V)-6 b(arian)n(ts)23 b Fb(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)49 b Fc(23)2025 4018 -y Fk(W)2025 4167 y Fc(W)-6 b(a)25 b(Shogi)e Fb(.)12 b(.)g(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)48 b -Fc(23)2025 4274 y(W)-6 b(eb)25 b(sites)d Fb(.)12 b(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)47 b Fc(41)2025 -4381 y(Winning)25 b(the)h(game)17 b Fb(.)12 b(.)g(.)g(.)h(.)f(.)g(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)42 b Fc(17)2025 4691 y Fk(X)2025 4840 y Fc(xshogi)22 -b Fb(.)12 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)g(.)h(.)47 b Fc(33)p eop -%%Page: 48 50 -48 49 bop 150 -116 a Fj(48)2734 b(GNU)31 b(Shogi)f(man)m(ual)p -eop -%%Page: -1 51 --1 50 bop 3725 -116 a Fj(i)150 299 y Fh(T)-13 b(able)54 -b(of)g(Con)l(ten)l(ts)150 641 y Fk(GNU)45 b(Shogi)g(\(Japanese)i(c)l -(hess\))12 b Fa(.)19 b(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h -(.)f(.)g(.)h(.)f(.)h(.)56 b Fk(1)150 911 y(1)135 b(In)l(tro)t(duction) -15 b Fa(.)20 b(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h -(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)60 -b Fk(3)150 1181 y(GNU)45 b(GENERAL)g(PUBLIC)g(LICENSE)31 -b Fa(.)19 b(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)75 b Fk(5)449 -1318 y Fj(Pream)m(ble)16 b Fd(.)e(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)h(.)f(.)g(.)g(.)g(.)g(.)45 b Fj(5)449 1427 y(TERMS)29 -b(AND)j(CONDITIONS)d(F)m(OR)h(COPYING,)h(DISTRIBUTION)631 -1537 y(AND)g(MODIFICA)-8 b(TION)24 b Fd(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)54 b Fj(6)449 1646 -y(Ho)m(w)31 b(to)g(Apply)e(These)h(T)-8 b(erms)30 b(to)h(Y)-8 -b(our)31 b(New)f(Programs)15 b Fd(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f -(.)g(.)g(.)44 b Fj(11)150 1889 y Fk(2)135 b(Ab)t(out)44 -b(the)h(game)h(of)f(shogi)30 b Fa(.)20 b(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.) -f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)74 b Fk(13)449 2026 -y Fj(2.1)92 b(The)30 b(rules)f(of)h(shogi)21 b Fd(.)15 -b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)51 b Fj(13)748 2135 y(2.1.1)93 b(The)29 b(mo)m(v)m(es)j(of)f -(the)f(pieces)18 b Fd(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)47 b Fj(14)748 -2245 y(2.1.2)93 b(The)29 b(op)s(ening)g(setup)15 b Fd(.)g(.)g(.)h(.)f -(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)g(.)g(.)g(.)g(.)45 b Fj(15)748 2355 y(2.1.3)93 -b(Promotion)30 b(of)g(pieces)14 b Fd(.)g(.)h(.)h(.)f(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)43 b Fj(15)748 2464 y(2.1.4)93 b(Drops)9 b Fd(.)15 -b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.) -f(.)g(.)g(.)g(.)g(.)38 b Fj(16)748 2574 y(2.1.5)93 b(Winning)28 -b(the)i(game)18 b Fd(.)f(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)48 -b Fj(17)748 2683 y(2.1.6)93 b(Dra)m(ws)24 b Fd(.)15 b(.)g(.)g(.)g(.)g -(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)54 -b Fj(17)748 2793 y(2.1.7)93 b(Handicaps)28 b Fd(.)15 -b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.) -58 b Fj(18)748 2902 y(2.1.8)93 b(Notes)31 b(for)f(c)m(hess)h(pla)m(y)m -(ers)21 b Fd(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)50 b Fj(19)449 -3012 y(2.2)92 b(Sample)29 b(game)g Fd(.)15 b(.)g(.)g(.)g(.)h(.)f(.)g(.) -g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)57 -b Fj(19)449 3122 y(2.3)92 b(Mating)31 b(problems)18 b -Fd(.)13 b(.)i(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)g(.)g(.)47 b Fj(22)449 3231 y(2.4)92 b(Shogi)29 -b(v)-5 b(arian)m(ts)10 b Fd(.)15 b(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)39 -b Fj(23)449 3341 y(2.5)92 b(Di\013erences)31 b(b)s(et)m(w)m(een)g -(shogi)e(and)h(c)m(hess)10 b Fd(.)15 b(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g -(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)39 -b Fj(24)150 3583 y Fk(3)135 b(gn)l(ushogi)33 b Fa(.)20 -b(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f -(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)78 -b Fk(27)150 3853 y(4)135 b(xshogi)10 b Fa(.)20 b(.)g(.)f(.)g(.)h(.)f(.) -h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f -(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)55 b Fk(33)150 -4123 y(5)135 b(References)46 b(and)f(links)29 b Fa(.)20 -b(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h -(.)f(.)h(.)f(.)74 b Fk(41)150 4393 y(6)135 b(Ac)l(kno)l(wledgemen)l(ts) -12 b Fa(.)21 b(.)f(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g -(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)57 b Fk(43)150 4663 -y(7)135 b(Bugs)19 b Fa(.)g(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h -(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.) -g(.)h(.)f(.)h(.)f(.)h(.)f(.)64 b Fk(45)150 4932 y(8)135 -b(Index)30 b Fa(.)19 b(.)g(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f -(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.) -h(.)f(.)h(.)f(.)g(.)75 b Fk(47)p eop -%%Page: -2 52 --2 51 bop 150 -116 a Fj(ii)2772 b(GNU)31 b(Shogi)f(man)m(ual)p -eop -%%Trailer -end -userdict /end-hook known{end-hook}if -%%EOF diff --git a/doc/gnushogi_1.html b/doc/gnushogi_1.html deleted file mode 100644 index de4eb33..0000000 --- a/doc/gnushogi_1.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - -GNU Shogi manual: Introduction - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -

1. Introduction

- -

- -GNU shogi is a program that plays shogi, the Japanese version of chess, -against a human (or computer) opponent. This file describes how to use -GNU shogi and also gives background information about the game of shogi. -

- -This file describes GNU shogi version 1.3.2. It was written by me, Mike -Vanier, the current maintainer of GNU shogi. My email address is -mvanier@cs.caltech.edu. -

- -GNU shogi is actually two programs: -

- -

- -
`gnushogi' -
is the text-based program which also contains the game-playing engine. -

- -

`xshogi' -
is the X-windows graphical interface to gnushogi. -

- -

-

- -Since xshogi invokes gnushogi, most players will just type "xshogi" -and start playing. -

- -Disclaimer: I use the personal pronouns "him", "his" etc. to refer -to a shogi player regardless of gender. That's easier than writing -"his or her" all over the place. I don't mean to infer that women -don't play shogi; in fact shogi is very popular in Japan among women as -well as men. -

- - -


-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_10.html b/doc/gnushogi_10.html deleted file mode 100644 index 5302c76..0000000 --- a/doc/gnushogi_10.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - -GNU Shogi manual: Drops - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.1.4 Drops

- -

- -When a player captures a piece, that piece is not removed from play. -Instead, it becomes the property of the capturer and can re-enter play -by being placed on (almost) any vacant square during the player's move. -This is known as a "drop" and counts as a full move (in other words, -you can either move a piece on the board or drop a piece onto the board -during your move, but not both). All pieces drop in the unpromoted -state. Pieces may be legally dropped in their promotion zone, but they -do not promote on that turn. -

- -There are several restrictions on drops: -

- -

    - -
  1. A pawn may not be dropped onto a file if there is already an -unpromoted pawn belonging to the same player on that file. It is legal -to drop a pawn on a file which contains a promoted pawn belonging -to the same player, however. -

    - -

  2. A pawn may not be dropped to give immediate checkmate on the -move. A pawn is, however, permitted to be moved on the board to give -immediate checkmate. This is a curious rule, and if anyone knows the -reason for it I would appreciate it if they would contact me and explain -it to me :-) -

    - -

  3. A pawn or piece may not be dropped onto a square from which they -would have no legal move. This means that pawns and lances may not be -dropped onto the last rank, and the knight may not be dropped onto the -last or second-to-last rank. -

    - -

-

- -It is entirely permissible (and often advisable) to drop a piece or pawn -between one's King and an attacking ranging piece. For this reason, -the final checkmating move is nearly always an attack on the King from -an adjacent square (except for an attack by a Knight). -

- -Captured pieces are said to be pieces "in hand". -

- -The drop is the primary distinguishing feature of Japanese chess, shared -with no other popular chess-type game. It gives shogi a very aggressive -quality, and dramatically increases the number of possible moves once a -few pieces have been captured. Another interesting feature of shogi is -that exchanges complicate play rather than simplifying it (as in -international chess), because of the drop rule. -

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_11.html b/doc/gnushogi_11.html deleted file mode 100644 index 4b0b2e5..0000000 --- a/doc/gnushogi_11.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - -GNU Shogi manual: Winning the game - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.1.5 Winning the game

- -

- -A game of shogi is won by capturing the opponent's king. In general, -this is done by checkmating the king: attacking the king in such a way -that the king cannot be defended no matter what the defending player -moves. Note, though, that there is no rule that requires a player to -defend a king which is being attacked. However, if he does not defend -his king, the opponent is entirely free to capture it on the next move, -thus winning the game. As in international chess, in practice most -games end by resignation when one player realizes that he cannot escape -checkmate. -

- - -


-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_12.html b/doc/gnushogi_12.html deleted file mode 100644 index 2273f7a..0000000 --- a/doc/gnushogi_12.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - -GNU Shogi manual: Draws - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.1.6 Draws

- -

- -There are very few draws in shogi; only about 1-2% of professional games -end in a draw. One reason for this is that material can never be -depleted as in chess, because captured pieces are constantly re-entering -play as a consequence of the drop rule. In fact, most of the ways a -game can be drawn in chess are not allowed in shogi: -

- -

    - -
  • Draws cannot be offered. -

    - -

  • There is no fifty-move rule. -

    - -

  • A stalemate counts as a win for the stalemater. Stated otherwise: -if you can't move, you lose. -

    - -

  • Perpetual check is illegal (see below). -

    - -

-

- -There are only two legal ways in which a draw can occur: -

- -

    - -
  1. A position (including the pieces in hand) occurs 4 times with the same -player to move (called "Sennichite"). However, if this is caused by -consecutive checks (direct attacks on the King, threatening to capture -it on the next move) by one side, the player giving these checks loses -the game. In other words, perpetual check results in a loss for the -attacker who recreates the same position the 4th time. -

    - -

  2. Both players have moved their King into the the promotion zone (or they -cannot be prevented from doing so) and the Kings cannot be checkmated. -A King who has entered the promotion zone is known as an "entering -King"; due to the forward orientation of most shogi pieces, it is very -hard to mate such a King. In that case the players may decide to count -their pieces as follows: the King does not count, the Rook and Bishop -count as 5 points, and all other pieces as one point. Promotion is -disregarded. If both players have at least 24 points the game is a draw -(called "Jishogi"). If a player has less, he loses the game. -

    - -Of course, a player can refuse to count pieces when he still has mating -chances or chances to gain material which would affect the outcome of -the counting. There is no strict rule about what to do if this is not -the case, but nonetheless a player refuses to count up (e.g. because he -does not have enough points for a draw). It has been generally accepted -that in such a case the game ends and the pieces are counted after one -player has managed to get all his pieces protected in the promotion -zone. -

    - -

-

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_13.html b/doc/gnushogi_13.html deleted file mode 100644 index 1598b55..0000000 --- a/doc/gnushogi_13.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - -GNU Shogi manual: Handicaps - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.1.7 Handicaps

- -

- -Unlike international chess, shogi has a well-established handicap system -which is used when players of different strengths play against each -other. Handicaps range from small to huge, which makes it possible for -weak players to play against even very strong players and have an even -chance of winning. -

- -Shogi players are ranked as follows: the weakest rank is around 15 -"kyu", which represents a beginner. 14 kyu is higher than 15 kyu, 13 -kyu is higher still, and so on until you get to 1 kyu. The next highest -rank is 1 "dan", followed by 2 dan, 3 dan and so forth. The highest -amateur rank is 6 dan; professionals go up to 9 dan. However, -professional ranks are not the same as amateur ranks; a professional 1 -dan is much stronger than an amateur 1 dan. This system is -similar to that used by go players (and also other Japanese sports such -as karate). -

- -A handicap consists of the stronger player playing White and removing -one or more pieces from his side of the board at the start of the game. -These pieces are permanently removed from play; they are not in hand. -

- -The following is a list of the accepted handicaps, from weakest to -strongest. The degree of the handicap, represented by the position in -the list, represents the difference in rank between the two players for -which the handicap is appropriate. These rules are taken from the books -"Shogi for Beginners" by John Fairbairn and "The Art of Shogi" by -Tony Hoskings (see section 5. References and links) and, I believe, represent -current Japanese practice. -

- -

    - -
  1. -The stronger player removes his left lance (on 1a). -

    - -

  2. -The players play a two-game match; in the first game the stronger player -removes his left lance (on 1a), while in the second game he removes his -bishop. -

    - -

  3. -The stronger player removes his bishop. -

    - -

  4. -The stronger player removes his rook. -

    - -

  5. -The stronger player removes his rook and left lance. -

    - -

  6. -The players play a two-game match; in the first game the stronger player -removes his rook and left lance (on 1a), while in the second game he -removes his rook and bishop. -

    - -

  7. -The stronger player removes his rook and bishop. This is usually called -a "two-piece" handicap. -

    - -

  8. -The stronger player removes his rook, bishop, and both lances. This is -called a "four-piece" handicap. -

    - -

  9. -The stronger player removes his rook, bishop, both lances, and both -knights. This is called a "six-piece" handicap. -

    - -

  10. -The stronger player removes his rook, bishop, both lances, both knights, -and both silvers. This is called an "eight-piece" handicap. -

    - -

-

- -Another advantage of playing handicap games is that the handicaps alter -the optimal strategy for both players. For instance, handicaps all have -their own opening lines which may bear little or no resemblance to those -used in non-handicap shogi. This means that when learning handicap -shogi, you are essentially learning completely new games which use the -same equipment! -

- -The reader may wonder how on earth a player giving an eight-piece -handicap, say, could possibly hope to win. Don't forget, though, that -in shogi the opponent's pieces can be captured and then become part of -one's own army. Thus, if the opponent plays badly enough, the number of -pieces will soon even out. -

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_14.html b/doc/gnushogi_14.html deleted file mode 100644 index 6058e6d..0000000 --- a/doc/gnushogi_14.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - -GNU Shogi manual: Notes for chess players - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.1.8 Notes for chess players

- -

- -Here are a few miscellaneous things that may confuse chess players. -Some of these have been mentioned elsewhere, but they bear repeating. -

- -

    -
  1. There is no queen. -

    - -

  2. Pawns capture the same way they move. There is no initial -two-space pawn move and no en-passant move. -

    - -

  3. There is no special castling move. There are a large -number of possible defensive formations referred to as "castles" -(see section 2.2 Sample game) but there is no need for special moves to create -them. -

    - -

  4. A given piece can only promote to one other kind of piece. -

    - -

-

- - -


-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_15.html b/doc/gnushogi_15.html deleted file mode 100644 index 2ac7677..0000000 --- a/doc/gnushogi_15.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - -GNU Shogi manual: Sample game - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.2 Sample game

- -

- -This game was annotated by Pieter Stouten (see section 5. References and links). I have made some minor corrections. Note that captures are -denoted by the "x" symbol e.g. Rx3f and drops are denoted by the "*" -symbol e.g. R*3f. Check is indicated by a "+" after the move, -e.g. R3f+. I recommend you use gnushogi/xshogi to play along with this -game. In xshogi simply hit the "Force Moves" button after starting -up, while in gnushogi enter the word "force" at the prompt. This will -allow you to enter moves for both sides. -

- -Note also that the move numbering system used here is the chess-type -system where one move means one move by each player. The Japanese count -one move made by each player as two moves. -

- ---------------------------------------------------------------------------- -

- -Below you will find (the English translation of) an annotated game which -was published in the Dutch Shogi magazine "81" and in the Dutch -beginners booklet. It has proven to be a very useful game to explain -some basic principles of Shogi. Also, it is a rather straightforward -game compared to professional games where in most cases very diffuse -middle game fights take place. -

- - Pieter Stouten, 14th May 1990. -

- ---------------------------------------------------------------------------- -

- -Black: Michael Trent (1-dan). White: David Murphy (2-dan). -

- - 1. P2f P3d 2. P2e B3c
-[ This move is necessary, as otherwise white can exchange pawns: 3. P2d -Px2d 4. Rx2d. He would thus get a pawn in hand and open up his rook -file. ] -

- - 3. P7f P4d
-[ White closes the bishop diagonal again. He plans to play ranging rook -(the rook goes to 5b, 4b, 3 or 2b; a defensive strategy) and in that -case he'd better avoid an exchange of bishops. One of the reasons is -that he will have problems developing his pieces without leaving holes -for bishop drops. ] -

- - 4. S4h R3b 5. P3f S4b 6. K6h K6b
-[ In general the rook plays an important role in the attacks. It is -wise to move the king away from the area where the initial fights will -be and both players act according to the Shogi proverb "keep the rook -and king apart". ] -

- - 7. K7h K7b 8. P5f P5d 9. G4i-5h G4a-5b
-[ Both players use their second gold general to build their castle. ] -

- - 10. S6h
-[ In itself this move is not bad. However, it will become clear that -black plans a quick attack and in that case it is wiser to omit this -move. ] -

- - 10... S5c 11. P1f P1d
-[ The advance of the edge pawns must be timed very well. The remark at -black's tenth move applies here too: this move is good if black wants to -play a slow game, because it eliminates a future B1e. ] -

- - 12. P4f K8b 13. N3g S7b
-[ Black develops his knight in order to start an attack over the second, -third and fourth files. White strengthens his king's position and -awaits the attack. He aims at a counterattack as soon as black has -broken through into the white camp. Probably white's breakthrough will -take place later, but he has good compensation in the form of a stronger -castle. This theme occurs very often in static rook versus ranging rook -games. ] -

- - 14. P4e R4b
-[ Black starts his attack and white puts up a very passive defence. His -rook has a hard task now to penetrate the black position. Moreover, he -blocks his own bishop. It seems much better to start a counterattack -with 14... P3e, later to be followed by B2b, B5a or Bx4d in order to use -his rook more actively. ] -

- - 15. Px4d Sx4d 16. P*4e S5c
-[ 16... Sx4e is more active. A silver general is normally more valuable -than a knight, but white gets two pawns in hand and black none, while -the knight might come in handy for white too. ] -

- - 17. Bx3c+ Nx3c 18. P2d Px2d
-[ Black threatens to break through and white has to consider taking the -pawn on 2d or starting a counterattack with Nx4e. If he chooses the -latter, black can play Px2c+ followed by +P3c. The disadvantage is the -black "tokin" (=promoted pawn) that white will get in his camp; the -advantage is that it will cost black two more moves to promote his rook. -Because white did not trust that the result after engaging in a -"semeai" (=mutual attack) with 18...Nx4e would give a positive result, -he captured the pawn on 2d. Making the right decision in moments like -this often makes the difference between a win and a loss: miss one -attacking chance and you will be forced to defend the whole game until -the unavoidable defeat; on the other hand, an unsound attack can destroy -all "aji" (=potential, meaning possibilities, threats) without getting -anything in return. ] -

- - 19. Rx2d Nx4e 20. Nx4e Rx4e 21. R2a+ P*4g
-[ Now it becomes clear why black's 10. S6h was not good. Had this move -been omitted, then white would not have had the time to play 13... S7b -and after R2a+ the gold on 6a would hang. Thus black would have kept -"sente" (=initiative). Instead of 21... P*4g, B*6d is a very good -move, because after 22. P*2h black does not have a pawn in hand anymore -and he is being threatened with the annoying 22... N*4f 23. G5g N3h+ -24. S4g +N4h also. Black can also counter 21... B*6d with 22. N*3g. -White would then reply with 22... R4b 23. B*3c P*4g 24. Bx4b+ Sx4b. The -white rook has played its role and instead of spending moves on saving -it white starts to scatter black's defences by successive pawn drops on -the fourth file: 25. Gx4g P*4f 26. G5g N*6e 27. G5h P4g+ 28. Gx4g P*4f. -This analysis was provided by Kato Hifumi, 9-dan professional (the -highest regular grade). Destroying the coherence of the enemy pieces -(their shape) by dropping pawns is one of the most important Shogi -techniques. With the actual move 21... P*4g white missed a good -chance. ] -

- - 22. Sx4g P*4f 23. B*3g Px4g+ 24. +Rx6a +Px3g
-[ 23. B*3g seems pointless, but a closer look reveals that it is -actually quite mean. On move 24 white cannot capture black's "Ryu" -(=dragon =promoted rook) with his silver: 24... Sx6a 25. N*7d K7b -26. G*8b mate. By attacking the front of the white castle and -threatening to mate him there, black has the chance to break down the -white defences from the side. ] -

- - 25. +Rx5b S*6b
-[ Here 25... B*4d would be much better, because it is defensive and -attacking at the same time. After e.g. 26. G*4c Bx9i+ 27. Gx5c black -threatens 28. +Rx7b Kx7b 29. S*6a K8b 30. S*7a Kx7a 31. G*7b mate. -White is one move quicker, however. He has the following beautiful -"tsume" (mating sequence where every move is check): 27... N*8f 28. Px8f -S*8g 29. Kx8g B*9h 30. K7h Bx8i+ 31. K8g +B8i-8h 32. K9f L*9e mate. -This illustrates the sharpness of Shogi: one move can make the -difference between winning and losing. ] -

- - 26. P*4f Rx4f
-[ This move eliminates white's last chances. 26... R4b 27. +Rx4b Sx4b -28. R*4a seems annoying, but after 28... B*3c 29. S7g B*3b white wins -the rook and with his "tokin" on 3g there still is some hope. ] -

- - 27. N*6e +P4g
-[ White cannot defend anymore, so he starts a desperate attack. Black -does not lose the right track, however. ] -

- - 28. Nx5c+ +Px5h 29. +Nx6b +Px6h 30. Gx6h N*8f 31. Px8f B*6i 32. Gx6i - R4h+ 33. N*6h +Rx6h 34. Gx6h S*8g 35. Kx8g N*9e 36. K7h Resigns
-[ White resigns here, because after 36... B*8g 27. K7g his attack has -petered out. ] -

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_16.html b/doc/gnushogi_16.html deleted file mode 100644 index f6953fc..0000000 --- a/doc/gnushogi_16.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - -GNU Shogi manual: Mating problems - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.3 Mating problems

- -

- -One good way to improve at shogi is to solve mating problems. There are -several types of these problems, but the most common is called a -"tsume-shogi" problem, or "tsume" problem for short. In a tsume -problem, all pieces that are not on the board are assumed to be in the -opponent's hand (except for your King, which is usually not shown). -Every move you make must be check until the final checkmate. Your -opponent may play any piece on the board or drop any of his pieces in -hand in order to prevent the mate. In a properly constructed tsume -problem, all of your pieces on the board and in hand must be essential -to the solution. One consequence of this is that all of your pieces in -hand must be played during the solution. There should only be one -correct solution for the given number of moves. Tsume problems use -Japanese-style move numbering; thus, a problem where you move (and give -check), your opponent moves, and you move to give checkmate is called a -three-mover. Here is a really trivial three-mover: -

- - 3 2 1
-----------------+
-| | | | a
-----------------+
-| | | wK | b
-----------------+
-| | | | c
-----------------+
-| bN | | | d
-----------------+
-| | | | e
-----------------+
-| | bN | | f
-----------------+
-

- -Black in hand: S, G -

- -Here, Black plays G*2b, White plays K1c, and Black plays G*1d mate. -More typical tsume problems range from 5 moves to arbitrarily high -numbers of moves, and they can be quite brain-busting. Tsume problems -may seem artificial, but in the closing stages of the game where both -players have a lot of pieces in hand, it is often necessary to give -check at every move, or else your opponent will start a counterattack -and will mate you before you mate him. A tsume problem is a worst-case -scenario for the attacker: you have to mate your opponent even though he -has every piece not on the board in hand, which means you have to -develop sharp attacking skills. Many more tsume problems can be found -on the internet; I particularly recommend Patrick Davin's "Shogi -Nexus" (see section 5. References and links). -

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_17.html b/doc/gnushogi_17.html deleted file mode 100644 index a822bd6..0000000 --- a/doc/gnushogi_17.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - -GNU Shogi manual: Shogi variants - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.4 Shogi variants

- -

- -Several historical variants of shogi exist. Most of these were invented -before modern shogi (in some cases hundreds of years before), are much -larger than modern shogi and are not played with drops. Thus, in many -ways they are really more like giant chess games than like modern shogi. -The only one of these games to have survived in Japan is Chu (middle) -shogi, which is still played a little bit. Thanks to the efforts of -George Hodges and John Fairbairn of the Shogi Association (two British -shogi enthusiasts), these games were resurrected and rules and sets for -them can still be purchased from George Hodges (see section 5. References and links). I hope to eventually extend GNU shogi so that it can play at -least some of these games. There are also several non-historical -variants of shogi; I don't know much about them but you can find -information about them on the internet (see section 5. References and links). -

- -The historical variants include: -

- -

    - -
  1. -Tori (bird) shogi, played on a 7x7 board with 32 pieces in all; this is -the only variant that is known to have been played with drops. -

    - -

  2. -Wa shogi, played on an 11x11 board with 54 pieces. This game can be -played with or without drops but the historical evidence favors the view -that it was played without drops. However, most people who have tried -it claim it is a much better game with drops, being even more intricate -than standard shogi. -

    - -

  3. -Chu (middle) shogi, played on a 12x12 board with 92 pieces. This was -(and is) by far the most popular of the variants, and has 21 different -kinds of pieces in the starting line-up alone (along with several others -that appear upon promotion). Unlike modern shogi, there are a -tremendous number of ranging pieces and the game is definitely not -played with drops. There is also an amazing piece called the Lion which -has a double king move and can capture two pieces at once! Chu shogi -has a small but fanatical following, some of whom consider it better -than modern shogi. -

    - -

  4. -Dai (great) shogi, played on a 15x15 board with 130 pieces. Other than -the larger board, this game is very similar to Chu shogi. -

    - -

  5. -Tenjiku (exotic) shogi, played on a 16x16 board with 176 pieces. This -game is possibly the most complex tactical game in existence. There are -many astoundingly powerful pieces, including one (the Fire Demon) that -can capture up to eight opposing pieces in a single move! Despite the -size of the game, checkmates can occur very suddenly (and often very -early on) if one player makes a wrong move. Tenjiku also has a small -but fanatical following, one of whom (Colin Adams) has written a book on -the game which is available for download at -http://www.colina.demon.co.uk/tenjiku.html. -

    - -

  6. -Dai-dai (great-great) shogi, played on a 17x17 board with 192 pieces. -The opening setup alone has 64 different kinds of pieces! This game and -the larger ones that follow sound pretty outlandish, but they have -actually been played; a game of Dai-dai can supposedly be played in -about 12 hours. -

    - -

  7. -Maka-dai-dai (great-great-great) shogi, played on a 19x19 board with 192 -pieces. For those for whom Dai-dai shogi is just too small :-) -

    - -

  8. -Tai (grand) shogi, played on a 25x25 board with 354 pieces! Until -recently, this was thought to be the biggest chess game ever devised, -but now there is... -

    - -

  9. -Kyoku tai (extremely grand?) shogi, played on a 36x36 board with 402 -pieces. The rules for this have just been unearthed in an old Japanese -book. Hopefully someone will soon organize a postal Kyoku tai shogi -championship; maybe their distant ancestors could finish it :-) -

    - -It is thought that the really huge games (Dai-dai and up) were never -really played to any significant extent (gee, wonder why?) and were -devised merely so that the creators could have the fun of inventing -enormous games, amazing their friends and confounding their enemies. -However, the games up to Tenjiku shogi at least appear to be quite -playable, assuming one has the time. -

    - -

-

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_18.html b/doc/gnushogi_18.html deleted file mode 100644 index 090d18f..0000000 --- a/doc/gnushogi_18.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - - -GNU Shogi manual: Differences between shogi and chess - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.5 Differences between shogi and chess

- -

- -Some differences between shogi and international chess have been -mentioned elsewhere in this document; I summarize them here for people -who are interested in game comparisons. I won't try to deal with the -thorny question of which game is "better" although my bias may have -already come through :-) In fact, the drop rule makes the two games so -different in character that arguing over which game is better is like -comparing apples to oranges (you'd be better off comparing chess to Chu -shogi (see section 2.4 Shogi variants). However, I believe that if you are a -chess fan you'll really like shogi as well, and shogi is also popular -with many people who don't particularly like chess. -

- -Here are the significant differences between chess and shogi: -

- -

    - -
  1. -In shogi, captured pieces become the property of the capturer and can -re-enter play by being dropped onto almost any vacant square. In chess, -captured pieces are out of the game. Thus, in shogi, piece exchanges -complicate the play significantly while in chess they simplify it. -

    - -

  2. -The shogi board is 9x9; the chess board is 8x8. -

    - -

  3. -Shogi has five pieces with no counterpart in chess: the gold and silver -generals, the lance, the promoted rook and the promoted bishop. Chess -has one piece with no counterpart in shogi: the queen. The knight's -move in shogi is much more restrictive than in chess. Pieces in shogi -generally have a much smaller range of movement than in chess (unless -they are in hand). -

    - -

  4. -In shogi, all pieces except the gold general and the king can promote, -but only to one kind of piece. Promotion is easier in shogi because the -promotion zone is closer to the starting position of the pieces -(especially pawns). In chess, only the pawn can promote, but it can -promote to any other piece except the king. -

    - -

  5. -In shogi, pawns capture the same way they move. There is no initial -two-space pawn move and hence no en-passant captures. In chess, -pawns capture diagonally which means that opposing pawns can block each -other. -

    - -

  6. -In shogi, you only have one rook and one bishop. Note that the bishop -is not restricted to only one "color" square (squares in shogi aren't -colored, but never mind) because promoted bishops can also move one -square orthogonally. -

    - -

  7. -There is no special castling move in shogi. The term "castle" is -used in shogi to denote a defensive formation consisting of (usually) -three generals which protect the king. There are many such castles -(about 40 or so have names). See section 2.2 Sample game. -

    - -

  8. -Draws are much rarer in shogi than in chess. Perpetual check is not -allowed. Stalemate is a virtual impossibility, and is a loss for the -stalematee. -

    - -

  9. -Since pieces are never out of play in shogi, chess-type endgames -involving only a few pieces do not occur. -

    - -

  10. -Shogi games are generally longer than chess games (about 60-70 moves is -typical). -

    - -

  11. -Shogi has a well-developed handicap system which is in general use; -chess does not. -

    - -

-

- -The effects of all these differences on play include (in my opinion): -

- -

    - -
  1. -Piece/pawn structures in chess are more rigid than in shogi. Pawns -block each other and pawns, once advanced, cannot ever retreat. In -shogi, you can repair the hole caused by a pawn advance by exchanging -the pawn and dropping it back where you want it. Thus shogi is more -fluid than chess and less "structural". -

    - -

  2. -Counterattack is MUCH more common in shogi than in chess. Games -typically end in mutual mating attacks, where each player is trying to -checkmate the other player before being checkmated himself. This makes -tempo incredibly important and also makes sacrificial play quite common. -

    - -

  3. -Attacks involving only ranging pieces are more a feature of chess than -of shogi. A shogi attack typically uses a ranging piece or pieces to -support an attack by short-range pieces (especially generals). It is -very rare to mate a king with a non-adjacent ranging piece in shogi -since the player whose king is threatened can almost always interpose by -dropping a piece. -

    - -

-

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_19.html b/doc/gnushogi_19.html deleted file mode 100644 index 2d6247f..0000000 --- a/doc/gnushogi_19.html +++ /dev/null @@ -1,558 +0,0 @@ - - - - - -GNU Shogi manual: gnushogi - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

3. gnushogi

- -

- -This section describes how to run the "gnushogi" program. -

- -SYNOPSIS - -

- -gnushogi [ [[-]a] [-b bookfile] [-B binbookfile] [-C] [-h langfile] -[-L langfile] [-r length] [-R] [-s pathname] [-l pathname] [-S binbooksize] -[-t] [-c size] [-T size] [-v] [-x] [-X] arg1 arg2 ] -

- -DESCRIPTION -

- -GNU shogi (gnushogi) plays a game of japanese chess (shogi) against the -user or it plays against itself. -

- -At startup gnushogi reads the binbook file if it is present. It then -looks for a book file. If it is present it adds its contents to the -binbook data. If the binbook file is writable a new combined binbook -file is written. -

- -Gnushogi is a modified version of the gnuchess program. It has a simple -alphanumeric board display, or it can be used with the xshogi program -under X windows. The program gets its opening moves from the file -gnushogi.bbk which is located in a directory specified in the Makefile. -To invoke the program type: -

- -

- -
`gnushogi -C' -
simple curses based version -

- -

`gnushogi -X (or just gnushogi)' -
xshogi compatible version -

- -

`gnushogi -R' -
raw test display version -
-

- -TIME CONTROLS -

- -If one argument is given, it is the search time per move in -[minutes:]seconds. So gnushogi 30 will generate one move every 30 -seconds, while gnushogi 5:00 will generate one move every 5 minutes. -

- -If two or more arguments are given, they will be used to set tournament -time controls with the first argument of each pair being the number of -moves and the second being the total clock time in minutes[:seconds]. -Thus, entering gnushogi 60 5 will set the clocks for 5 minutes (300 -seconds) for the first 60 moves, and gnushogi 30 3:30 will allow 3 -minutes and 30 seconds for 30 moves. -

- -gnushogi 30 5 1 :30 will allow 5 minutes for the first 30 moves and 30 -seconds for each move after that. Up to 4 pairs of controls may be -specified. -

- -If no argument is given the program will prompt the user for level of -play. -

- -For use with xshogi see the documentation on that program. -See section 4. xshogi. -

- -BOOK -

- -The book gnushogi.tbk consists of a sequence of openings. An opening -begins with a line starting with a # (the rest of the line is a comment). -Following this is a series of moves in algebraic notation alternating -between black and white separated by whitespace. A move may have a ? -after it indicating this move should never be made in this position. Moves -are stored as position:move so transpositions between openings can take -place. -

- -HASHFILE -

- -The hashfile if created should be on the order of 4 megabytes; you can -create such a hashfile by typing "gnushogi -c 22" (see below). This -file contains positions and moves learned from previous games. If a -hashfile is used the computer makes use of the experience it gained in -past games. Tests run so far show that it plays no worse with the -hashfile than without, but it is not clear yet whether it provides a -real advantage. -

- -LEGAL MOVES -

- -Note: Piece letters are determined by the language file. What is -specified here is the default (English). -

- -Once gnushogi is invoked, the program will display the board and prompt -the user for a move. To enter a move, use the notation 7g7f where the -first letter-number pair indicates the origin square and the second -letter-number pair indicates the destination square. An alternative is -to use the notation P7f where the first letter indicates the piece type -(P,L,N,S,G,B,R,K). To promote append a + the type of the new piece to -the move, as in 2d2c+ or P2c+. Note that you must use capital letters -for the pieces by default. -

- -COMMAND-LINE OPTIONS -

- -

- -
`-a' -
Do not search on opponent's time. -

- -

`a' -
Do search on opponent's time. -

- -

`-b bookfile' -
Use bookfile for opening book. -

- -

`-B binbookfile' -
Use binbookfile for binary opening book. -

- -

`-c size' -
Create a new HASHFILE. File size is 2^size entries of approximately 65+? -bytes. -

- -

`-C' -
Use curses-based display mode. -

- -

`-h' -
Do not use hashfile. -

- -

`h' -
Do use hashfile. -

- -

`-l pathname' -
Pathname of the loadfile used with get or xget. -

- -

`-L lang' -
Use language lang from the file gnushogi.lang. If -L is not specified -it uses the first language in the file. -

- -

`-P plylevels' -
Number of plys to include in the binbookfile. For generating a -binbookfile. -

- -

`-r length' -
Rehash length times in searching entries for position in -transposition table. -

- -

`-R' -
Use raw text display mode. This can be used for dumb terminals or for -systems that don't have curses. -

- -

`-s pathname' -
Pathname of the save file to use with the save command. -

- -

`-S size' -
Size of binbookfile for memory based books. For creating a binbookfile. -

- -

`-t' -
Show statistics for HASHFILE. -

- -

`-T size' -
Set the transposition table size to 2^size entries. -

- -

`-v' -
Show version and patchlevel. -

- -

`-x value' -
Use value as the evaluation window xwndw. -

- -

`-X' -
Use xshogi display mode (the default). -

- -

-

- -COMMANDS -

- -In addition to legal moves, the following commands can be entered at the -gnushogi prompt. Note: command names are determined by the language -file and may vary with the implementation. The default language is -English. -

- -

- -
`alg' -
allow algebraic input (not implemented). -

- -

`Awindow' -
change Alpha window (default score + 90). -

- -

`Bwindow' -
change Beta window (default score - 90). -

- -

`beep' -
toggles beeping after each move (default: on). -

- -

`bd' -
updates the current board position on the display. -

- -

`book' -
turns off use of the opening library. -

- -

`both' -
causes the computer to play both sides of a shogi game. -

- -

`black' -
causes the computer to play as White, if the computer was to move -first. -

- -

`bsave' -
saves a game to disk as a book textfile. The program will prompt the -user for a file name. -

- -

`gamein' -
toggles game mode time control. Assumes the time specified for time -control is the time for a complete game. Input with the level command -should be the game time and the expected number of moves in a game. go -command must be given. -

- -

`coords' -
show coordinates on the display (visual only). -

- -

`contempt' -
allows the value of contempt to be modified. -

- -

`debug' -
asks for a piece as color piece, as wb or bn, and shows its calculated -value on each square. -

- -

`debuglevel' -
sets level of debugging output if compiled with debug options. -

- -

`depth' -
allows the user to change the search depth of the program. The maximum -depth is 29 ply. Normally the depth is set to 29 and the computer -terminates its search based on elapsed time rather than depth. If depth -is set to (say) 4 ply, the program will search until all moves have been -examined to a depth of 4 ply (with extensions up to 11 additional ply -for sequences of checks and captures). If you set a maximum time per -move and also use the depth command, the search will stop at the -specified time or the specified depth, whichever comes first. -

- -

`easy' -
toggles easy mode (thinking on opponents time) on and off. The default -is easy mode ON. If easy mode is disabled, the keyboard is polled for -input every so often and when input is seen the search is terminated. It -may also be terminated with a sigint. -

- -

`edit' -
allows the user to set up a board position. -
    - -
  • # -clear the board. -

    - -

  • c -toggle piece color. -

    - -

  • . -command will exit setup mode. -

    - -

  • p3b -place a pawn on 3b -

    - -

  • p3b+ -place a promoted pawn on 3b -

    - -

  • p* -place a pawn in hand (among the captured pieces) -

    - -

-

- -Pieces are entered by typing a letter (p,l,n,s,g,b,r,k) for -the piece followed by the coordinate. Here, letter case is ignored. -

- -The usual warning about the language file applies. -

- -

`exit' -
exits gnushogi. -

- -

`first' -
tells the computer to move first. Computer begins searching for a move. -(same as "go"). -

- -

`force' -
allows the user to enter moves for both sides. To get the program to -play after a sequence of moves has been entered use the "black" or -"white" commands. -

- -

`get' -
retrieves a game from disk. The program will prompt the user for a file -name. -

- -

`go' -
tells the computer to move first. Computer begins searching for a move. -(same as "first"). -

- -

`hash' -
use/don't use hashfile. -

- -

`hashdepth' -
allows the user to change the minimum depth for using the hashfile and -the number of moves from the beginning of the game to use it. -

- -

`help' -
displays a short description of the commands and the current status of -options. -

- -

`hint' -
causes the program to supply the user with its predicted move. -

- -

`level' -
allows the user to set time controls such as 60 moves in 5 minutes etc. -In tournament mode, the program will vary the time it takes for each -move depending on the situation. If easy mode is disabled (using the -"easy" command), the program will often respond with its move -immediately, saving time on its clock for use later on. -

- -

`list' -
writes the game moves and some statistics on search depth, nodes, and -time to the file "shogi.lst". -

- -

`material' -
toggle material flag - draws on no pawns and both sides < rook. -

- -

`new' -
starts a new game. -

- -

`p' -
evaluates the board and shows the point score for each piece. The total -score for a position is the sum of these individual piece scores. -

- -

`post' -
causes the program to display the principal variation and the score -during the search. A score of 100 is equivalent to a 1 pawn advantage -for the computer. -

- -

`quit' -
exits the game. -

- -

`random' -
causes the program to randomize its move selection slightly. -

- -

`rcptr' -
set recapture mode. -

- -

`remove' -
backout the last level for both sides. Equal to 2 undo's. -

- -

`reverse' -
causes the board display to be reversed. That is, the Black's pieces will -now appear at the top of the board. -

- -

`rv' -
reverse board display. -

- -

`save' -
saves a game to disk. The program will prompt the user for a file name. -

- -

`switch' -
causes the program to switch places with the opponent and begin -searching. -

- -

`test' -
performs some speed tests for MoveList and CaptureList generation, and -ScorePosition position scoring for the current board. -

- -

`time' -
set computer's time remaining, intended for synchronizing clocks among -multiple players. -

- -

`tsume' -
toggle tsume mode. In tsume mode, not all possible moves will be -generated. If a king is in check, only moves that get the king out of -check are generated. If the king is not in check, only moves that give -check to the opponent's king are generated. -

- -

`undo' -
undoes the last move whether it was the computer's or the human's. You -may also type "remove". This is equivalent to two "undo"'s -(e.g. retract one move for each side). -

- -

`white' -
causes the computer to play as Black; if the computer is to move -first the go command must be given. -

- -

`xget' -
read an xshogi position file. -

- -

`xsave' -
save as an xshogi position file. -

- -

`xwndw' -
change X window. The window around alpha/beta used to determine whether -the position should be scored or just estimated. Note: this has -nothing to do with xshogi or X windows; the terms are completely -separate. -

- -

-

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_2.html b/doc/gnushogi_2.html deleted file mode 100644 index 961df44..0000000 --- a/doc/gnushogi_2.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - -GNU Shogi manual: License - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

GNU GENERAL PUBLIC LICENSE

- -
- Version 2, June 1991 -
-

- -
 
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-675 Mass Ave, Cambridge, MA 02139, USA
-
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-

- -


-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_20.html b/doc/gnushogi_20.html deleted file mode 100644 index 56c31c5..0000000 --- a/doc/gnushogi_20.html +++ /dev/null @@ -1,547 +0,0 @@ - - - - - -GNU Shogi manual: xshogi - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

4. xshogi

- -

- -This section describes how to run the "xshogi" program. -

- -SYNOPSIS -

- -xshogi [ options ] -

- -DESCRIPTION -

- -xshogi provides an X11/Xt/Athena Widgets user interface for gnushogi. -With xshogi you can play gnushogi, set up arbitrary positions, force -variations, or watch xshogi manage a game between two shogi programs. -Furthermore, it can be used as an interface between two players on -different displays. -

- -xshogi can also be used as a shogi board to play out games. It will -read through a game file or allow a player to play through a variation -manually (force mode). This is useful for keeping track of email postal -games or browsing games off the net. -

- -After starting xshogi, you can make moves by pressing mouse button 1 -while the cursor is over a square with your piece on it and dragging the -mouse to another square. If the move is illegal, gnushogi will not -allow it. xshogi will then retract the move. -

- -COMMAND-LINE OPTIONS -

- -The following command line options also correspond to X resources that -you can set in your .Xdefaults file. -

- -

- -
`[standard Xt options]' -
xshogi accepts standard Xt options like -display, -geometry, and --iconic. -

- -

`-tc or -timeControl minutes[:seconds]' -
Amount of time for a set of moves determined by movesPerSession. If -this number of moves is played within the time control period, xshogi -resets the time clocks. Default: 5 minutes. -

- -

`-mps or -movesPerSession moves' -
Number of moves in a time control period. Default: 40 moves. -

- -

`-st or -searchTime minutes[:seconds]' -
Tell gnushogi to spend at most the given amount of time searching for -each of its moves. Without this option, gnushogi chooses its search -time based on the number of moves and amount of time remaining until the -next time control. Setting this option also sets -clockMode to False. -

- -

`-sd or -searchDepth number' -
Tell gnushogi to look ahead at most the given number of moves when -searching for a move to make. Without this option, gnushogi chooses -its search depth based on the number of moves and amount of time -remaining until the next time control. Setting this option also sets --clockMode to False. -

- -

`-clock or -clockMode (True | False)' -
Determines whether or not to use the clock. If clockMode is False, the -clock does not run, but the side that is to play next is still -highlighted. -

- -

`-td or -timeDelay seconds' -
Time delay between moves during "Load Game". This doesn't have to be -a round number. Try -td 0.4. Default: 1 second. -

- -

`-nsp or -noShogiProgram (True | False)' -
If this option is True, xshogi acts as a passive shogi board; it does -not try to start a shogi program, not even to check whether moves made -in Force mode are legal. It also sets -clockMode to False. Default: -False. -

- -

`-fsp or -firstShogiProgram program' -
Name of first shogi program. In matches between two machines, this -program plays white. Default: "gnushogi". -

- -

`-ssp or -secondShogiProgram program' -
Name of second shogi program, if needed. In matches between two -machines, this program plays black; otherwise it is not started. -Default: "gnushogi". -

- -

`-fh or -firstHost host' -
Name of host the first shogi program plays on. Default: "localhost". -

- -

`-sh or -secondHost host' -
Name of host the second shogi program plays on. Default: "localhost". -

- -

`-rsh or -remoteShell shell_name' -
Some systems do not use rsh as the remote shell. This option allows a -user to name the remote shell command. This should be done in the -resource file. -

- -

`-mm or -matchMode (False | Init | Position | Opening)' -
Automatically run a game between firstShogiProgram and -secondShogiProgram. If matchMode is set to Init, xshogi will start the -game with the initial shogi position. If matchMode is set to Position, -xshogi will start the game with the position specified by the -loadPositionFile resource. If matchMode is set to Opening, xshogi will -play out the opening moves specified by the -loadGameFile resource. If -the -saveGameFile resource is set, a move record for the match will be -saved in the specified file. Default: "False". -

- -

`-lgf or -loadGameFile file' -
Name of file to read a game record from. Game files are found in the -directory named by the SHOGIDIR environment variable. If this variable -is not set, the current directory is used unless the file name starts -with a /. -

- -

`-lpf or -loadPositionFile file' -
Name of file to read a game position from. Position files are found in -the directory named by the SHOGIDIR environment variable. If this -variable is not set, the current directory is used unless the file name -starts with a /. -

- -

`-sgf or -saveGameFile file' -
Name of file to save a game record to. Game files are saved in the -directory named by the SHOGIDIR environment variable. If this variable -is not set, the current directory is used unless the file name starts -with a /. -

- -

`-spf or -savePositionFile file' -
Name of file to save a game position to. Position files are saved in -the directory named by the SHOGIDIR environment variable. If this -variable is not set, the current directory is used unless the file name -starts with a /. -

- -

`-coords or -showCoords (True | False)' -
If this option is True, xshogi displays algebraic coordinates along the -board's left and bottom edges. The default is False. The coordFont -resource specifies what font to use. -

- -

`-mono or -monoMode (True | False)' -
Determines whether xshogi displays its pieces and squares with two -colors or four. You shouldn't have to specify monochrome. xshogi will -determine if this is necessary. -

- -

`-pc or -pieceColor color' -
Color specification for pieces suitable for XParseColor(). -Default: #FFFFD7. -

- -

`-sc or -squareColor color' -
Same for squares. Default: #EBDFB0. -

- -

`-wps or -westernPieceSet (True | False)' -
Choose the Western style piece set. -

- -

`-npb or -normalPawnBitmap file' -
`-nnb or -normalKnightBitmap file' -
`-nbb or -normalBishopBitmap file' -
`-nrb or -normalRookBitmap file' -
`-nkb or -normalKingBitmap file' -
Names of the bitmap files for the bitmap piece icons. -

- -

`-rpb or -reversePawnBitmap file' -
`-rnb or -reverseKnightBitmap file' -
`-rbb or -reverseBishopBitmap file' -
`-rrb or -reverseRookBitmap file' -
`-rkb or -reverseKingBitmap file' -
Names of the bitmap files for the outline piece icons. -

- -

`-debug or -debugMode (True | False)' -
Turns on debugging printout. -

- -

-

- -OTHER X RESOURCES -

- -

- -
`initString' -
The actual string that is sent to initialize the shogi program can be -set from .Xdefaults. It can't be set from the command line because of -syntax problems. The default value is "new\nbeep\nrandom\neasy\n". -The "new" and "beep" commands are required. You can remove the -"random" command if you like; including it causes gnushogi to -randomize its move selection slightly so that it doesn't play the same -moves in every game. Even without "random", gnushogi randomizes its -choice of moves from its opening book. You can also remove "easy" if -you like; including it toggles easy mode off, causing gnushogi to think -on your time. That is, if "easy" is included in the initString, GNU -Shogi thinks on your time; if not, it does not. (Yes, this does seem -backwards, doesn't it.) You can also try adding other commands to the -initString; see the gnushogi documentation (see section 3. gnushogi) for -details. -

- -

`blackString and whiteString' -
These resources control what is sent when the Machine Black and Machine -White buttons are selected. This is mostly for compatibility with -obsolete versions of gnushogi. -

- -Alternate bitmaps for piece icons can be specified either by choosing -one of the built-in sets or with the file name resources described -above. There are three built-in sets of piece bitmaps available, large -(the default), medium, or small. It is easiest to select the set you -prefer in the .Xdefaults file: -

- - XShogi*boardSize: Medium -

- -The font used for button labels and comments can be changed in the -.Xdefaults file. You may want to choose a smaller font if you are using -the small pieces: -

- - XShogi*font: helvetica_oblique12 -

- -The font used for coordinates (when the showCoords option is True) can -be set similarly: -

- - XShogi*coordFont: helvetica_10 -

- -If you are using a grayscale monitor, try setting the colors to: -

- - XShogi*pieceColor: gray100
- XShogi*squareColor: gray60
-

- -

-

- -COMMAND BUTTONS AND KEYS -

- -

- -
`Quit' -
Quits xshogi. Q or q is a keyboard equivalent. -

- -

`Reset' -
Resets xshogi to the beginning of a shogi game. It also deselects any -game or position files. -

- -

`Flip View' -
inverts the view of the shogi board. -

- -

`Hint' -
displays a move hint from gnushogi. -

- -

`Load Game' -
plays a game from a record file. If no file is specified a popup dialog -asks for a filename. Game files are found in the directory named by the -SHOGIDIR environment variable. If this variable is not declared then -the current directory is used unless the file name starts with a /. G -or g is a keyboard equivalent. The game file parser will accept almost -any file that contains moves in algebraic notation. If the first line -begins with `#', it is assumed to be a title and is displayed. Text -enclosed in parentheses or square brackets is assumed to be commentary -and is displayed in a pop-up window. Any other text in the file is -ignored. -

- -

`Load Position' -
sets up a position from a position file. If no file is specified a -popup dialog asks for a filename. Position files are found in the -directory named by the SHOGIDIR environment variable. If this variable -is not declared then the current directory is used unless the file name -starts with a /. Position files must be in the format that the Save -Position command writes. -

- -

`Save Game' -
saves a game to a record file. If no file is specified a popup dialog -asks for a filename. If the filename exists, the user is asked whether -the current game record is be appended to this file or if the file -should be replaced. Game files are saved in the directory named by the -SHOGIDIR environment variable. If this variable is not declared then -the current directory is used unless the file name starts with a /. -Game files are human-readable, and can also be read back by the Load -Game command. Furthermore, they are accepted as gnushogi text bookfiles. -

- -

`Save Position' -
saves a position to a position file. If no file is specified a popup -dialog asks for a filename. Position files are saved in the directory -named by the SHOGIDIR environment variable. If this variable is not -declared then the current directory is used unless the file name starts -with a /. Position files are human-readable, and can also be read back -by the Load Position command. -

- -

`Machine White' -
forces gnushogi to play white. -

- -

`Machine Black' -
forces gnushogi to play black. -

- -

`Force Moves' -
forces a series of moves. That is, gnushogi stops playing and xshogi -allows you to make moves for both white and black. -

- -

`Two Machines' -
plays a game between two computer programs. -

- -

`Forward' -
moves forward through a series of remembered moves. F or f is a -keyboard equivalent. -

- -

`Backward' -
moves backward through a series of remembered moves. As a side effect, -puts xshogi into Force Moves mode. B or b is a keyboard equivalent. -

- -

`Pause' -
pauses the clocks or (in Load Game mode) pauses the game being loaded. -Press Pause again to continue. P or p is a keyboard equivalent. -

- -

`Edit Position' -
lets you set up an arbitrary board position. Use mouse button 1 to drag -pieces to new squares, or to delete a piece by dragging it off the board -or dragging an empty square on top of it. To drop a new piece on a -square, press mouse button 2 or 3 over the square. This brings up a -menu of black pieces (button 2) or white pieces (button 3). Additional -menu choices let you empty the square or clear the board. You can set -the side to play next by clicking on the Black or White indicator at the -top of the screen. -

- -

`Challenge' -
allows you to make a two display game between two human players. Enter -the display you want to connect to. If you are allowed to connect, a -new board is displayed at the remote display. Challenge mode can only -be stopped by pressing "quit". -

- -

`Select Level' -
allows you to reset the clocks for both players. Enter the number of -moves and the number of minutes in which the moves should be done. -

- -

`Move NOW' -
force computer to stop thinking and to make the current best move. -

- -

`Iconify I, i, C or c' -
iconifies xshogi. -

- -

-

- -LIMITATIONS -

- -If you press the Pause button during GNU Shogi's turn, -xshogi will stop the clocks, but gnushogi will still make a -move. -

- -After a mate or draw when playing against gnushogi, if you -back up with the Backward button, the clocks are reset -(because gnushogi has exited and must be restarted). -

- -The game parser recognizes only algebraic notation. -

- -AUTHORS -

- -Original authors of XBoard: Chris Sears and Dan Sears. -

- -Enhancements for XBoard (Version 2.0): Tim Mann. -

- -Conversion to XShogi (Version 1.1): Matthias Mutz. -

- -Current maintainer: Mike Vanier. -

- -COPYRIGHT INFORMATION -

- -XShogi borrows its piece bitmaps from CRANES Shogi. -

- -Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts. -Enhancements Copyright 1992 Free Software Foundation, Inc. Enhancements -Copyright 1993 Matthias Mutz. Further enhancements copyright 1999 by -Michael Vanier and the Free Software Foundation, Inc. -

- -The following terms apply to Digital Equipment Corporation's copyright -interest in XBoard: -

- -All Rights Reserved -

- -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be used in -advertising or publicity pertaining to distribution of the software -without specific, written prior permission. -

- -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. -

- -The following terms apply to the enhanced version of XShogi distributed -by the Free Software Foundation: -

- -This file is part of XSHOGI. -

- -XSHOGI is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY. No author or distributor accepts responsibility to anyone -for the consequences of using it or for whether it serves any particular -purpose or works at all, unless he says so in writing. Refer to the -XSHOGI General Public License for full details. -

- -Everyone is granted permission to copy, modify and redistribute XSHOGI, -but only under the conditions described in the XSHOGI General Public -License. A copy of this license is supposed to have been given to you -along with XSHOGI so you can know your rights and responsibilities. It -should be in a file named COPYING. Among other things, the copyright -notice and this notice must be preserved on all copies. -

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_21.html b/doc/gnushogi_21.html deleted file mode 100644 index cea9a7d..0000000 --- a/doc/gnushogi_21.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - -GNU Shogi manual: References and links - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

5. References and links

- -

- -There are very few English-language books for people learning shogi. -The two I recommend are: -

- -

    - -
  1. -Shogi for Beginners, 2nd. Edition, by John Fairbairn. This is a -superb beginner's book in every way, covering all phases of the game. -It was out of print for a long time, but has now been reprinted and is -available either from Kiseido (http://www.labnet.or.jp/~kiseido) -or from George Hodges (see below). -

    - -

  2. -The Art of Shogi, by Tony Hoskings. This is one step up from the -Fairbairn book. It covers a lot of ground, and is especially noteworthy -for its detailed treatment of opening lines. You can order this book -from Amazon.com's UK branch (http://www.amazon.co.uk). -

    - -

-

- -Another book you may find is Shogi: Japan's Game of Strategy by -Trevor Leggett. This book is very elementary and is somewhat outdated, -having been published first in 1966. However, it does feature a paper -shogi board and punch-out pieces, so if you want a really cheap shogi -set you might pick this book up. It is still in print. -

- -Two books that are no longer in print but are definitely worth getting -if you find them are Guide to Shogi Openings and Better -Moves for Better Shogi, both by Aono Teriuchi. They are published in a -bilingual edition (English/Japanese) and are the only books on shogi in -English written by a Japanese professional shogi player. John Fairbairn -did the translation from Japanese to English. -

- -Shogi sets are available from: -

- -

-George F. Hodges
-P.O. Box 77
-Bromley, Kent
-United Kingdom BR1 2WT -
-

- -George also sells equipment for all the historical shogi variants -(see section 2.4 Shogi variants) (except for Kyoku tai shogi) and also sells -back issues of the magazine "Shogi" which he published for 70 issues -in the late 70's to late 80's. This magazine is STRONGLY recommended; -it contains more information about shogi in English than you will ever -find anywhere else. -

- -Here are some useful URLs: -

- -

- -
Pieter Stouten's shogi page: http://www.shogi.net -
This is the main shogi-related site on the internet, with links to -almost all the other sites. -

- -

Roger Hare's shogi page: http://www.ed.ac.uk/~rjhare/shogi -
This has lots of information, including full rules to most of the shogi -variants. -

- -

Patrick Davin's Shogi Nexus: http://www.vega.or.jp/~patrick/shogi/ -
There's lots of cool stuff on this site; my favorite is the extensive -collection of Tsume-shogi (mating) problems, both for beginners and -more advanced players. -

- -

Steve Evans' shogi page: http://www.netspace.net.au/~trout/index.html -
Steve has written a program that plays almost all of the shogi variants, -unfortunately it only runs on Windows :-( -

- -

Hans Bodlaender's chess variant pages: http://www.cs.ruu.nl/~hansb/d.chessvar -
This page has an almost unimaginable variety of rules for different -chess variants, including many shogi variants (historical and non-historical). -

- -

-

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_22.html b/doc/gnushogi_22.html deleted file mode 100644 index 3475627..0000000 --- a/doc/gnushogi_22.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - -GNU Shogi manual: Acknowledgements - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

6. Acknowledgements

- -

- -I would like to thank the following people: -

- -

    - -
  • -Matthias Mutz, who originally developed GNU shogi as a spin-off of GNU -chess and who very kindly let me take over the maintenance of this very -interesting project. -

    - -

  • -Richard Stallman and the Free Software Foundation, for creating an -organization where anyone can contribute software for the common good of -all, for making GNU/Linux possible, and especially for writing emacs and -gcc, without which my working life would be intolerable. -

    - -

  • -Georges Hodges, for starting the Shogi Association in England, without -which I would probably never have heard of shogi, for supplying shogi -equipment, for publishing the excellent magazine "Shogi" (now sadly -defunct), for personally answering all my silly questions by mail, and -for being the ambassador of shogi to the West. -

    - -

  • -Pieter Stouten, for having the most comprehensive shogi site on the -World Wide Web (http://www.shogi.net), and for -maintaining the shogi-l mailing list. Go to Pieter's web site for more -information on subscribing to the list. Also thanks to everyone who -contributes and has contributed to that list. -

    - -

  • -Matt Casters, for testing GNU shogi. Matt and I will be working -together on improving the solution engine in future versions of this -program. -

    - -

-

- - -


-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_23.html b/doc/gnushogi_23.html deleted file mode 100644 index a157af7..0000000 --- a/doc/gnushogi_23.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - -GNU Shogi manual: Bugs - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

7. Bugs

- -

- -The motto of GNU shogi is "100% bug-free or you don't pay!" :-) In the -extremely unlikely case (*ahem*) that you do find a bug, please send me -(Mike Vanier) an email at mvanier@cs.caltech.edu. Also, feel -free to send me comments, complaints, out-and-out raves, suggestions, -plane tickets to Hawaii, and/or large suitcases filled with unmarked, -untraceable hundred-dollar bills. -

- - -


-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_24.html b/doc/gnushogi_24.html deleted file mode 100644 index fc5d9b5..0000000 --- a/doc/gnushogi_24.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - -GNU Shogi manual: Index - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

8. Index

- -

- -
Jump to:   A -   -B -   -C -   -D -   -G -   -H -   -I -   -K -   -L -   -M -   -O -   -P -   -R -   -S -   -T -   -V -   -W -   -X -   -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Index Entry Section

A
Acknowledgements6. Acknowledgements

B
Books5. References and links

C
Chu Shogi2.4 Shogi variants

D
Dai Shogi2.4 Shogi variants
Dai-dai Shogi2.4 Shogi variants
Draws2.1.6 Draws
Drops2.1.4 Drops

G
gnushogi3. gnushogi
GPLGNU GENERAL PUBLIC LICENSE

H
Handicaps2.1.7 Handicaps

I
Introduction1. Introduction

K
Kyoku Tai Shogi2.4 Shogi variants

L
LicenseGNU GENERAL PUBLIC LICENSE

M
Mailing lists5. References and links
Maka-dai-dai Shogi2.4 Shogi variants

O
Opening setup2.1.2 The opening setup

P
Piece moves2.1.1 The moves of the pieces
Piece promotion2.1.3 Promotion of pieces

R
References5. References and links
Rules2.1 The rules of shogi

S
Sample game2.2 Sample game
Shogi variants2.4 Shogi variants
Shogi vs. Chess2.5 Differences between shogi and chess

T
Tai Shogi2.4 Shogi variants
Tenjiku Shogi2.4 Shogi variants
Tori Shogi2.4 Shogi variants

V
Variants2.4 Shogi variants

W
Wa Shogi2.4 Shogi variants
Web sites5. References and links
Winning the game2.1.5 Winning the game

X
xshogi4. xshogi

Jump to:   A -   -B -   -C -   -D -   -G -   -H -   -I -   -K -   -L -   -M -   -O -   -P -   -R -   -S -   -T -   -V -   -W -   -X -   -

- -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_3.html b/doc/gnushogi_3.html deleted file mode 100644 index 07889c7..0000000 --- a/doc/gnushogi_3.html +++ /dev/null @@ -1,405 +0,0 @@ - - - - - -GNU Shogi manual: Preamble - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

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. -

- -

- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -
-

- -

    -
  1. -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. -

    - -

  2. -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. -

    - -

  3. -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: -

    - -

      -
    1. -You must cause the modified files to carry prominent notices -stating that you changed the files and the date of any change. -

      - -

    2. -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. -

      - -

    3. -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. -

    - -

  4. -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: -

    - -

      -
    1. -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, -

      - -

    2. -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, -

      - -

    3. -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. -

    - -

  5. -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. -

    - -

  6. -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. -

    - -

  7. -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. -

    - -

  8. -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. -

    - -

  9. -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. -

    - -

  10. -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. -

    - -

  11. -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 -
    -

    - -

  12. -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. -

    - -

  13. -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 -
-

- -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_4.html b/doc/gnushogi_4.html deleted file mode 100644 index 016b2a5..0000000 --- a/doc/gnushogi_4.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - -GNU Shogi manual: How to Apply These Terms to Your New Programs - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

How to Apply These Terms to Your New Programs

- -

- - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. -

- - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. -

- -
 
one line to give the program's name and a brief idea of what it does.
-Copyright (C) 19yy  name of author
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-

- -Also add information on how to contact you by electronic and paper mail. -

- -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: -

- -
 
Gnomovision version 69, Copyright (C) 19yy name of author
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details 
-type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
-

- -The hypothetical commands `show w' and `show c' should show -the appropriate parts of the General Public License. Of course, the -commands you use may be called something other than `show w' and -`show c'; they could even be mouse-clicks or menu items--whatever -suits your program. -

- -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: -

- -
 
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-`Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-signature of Ty Coon, 1 April 1989
-Ty Coon, President of Vice
-

- -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. -

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_5.html b/doc/gnushogi_5.html deleted file mode 100644 index 962bf94..0000000 --- a/doc/gnushogi_5.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - -GNU Shogi manual: About shogi - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2. About the game of shogi

- - -

- -

-"Japanese chess cedes nothing in depth or beauty to the European -game... it is at least as interesting." -

- ---- Alexander Alekhine
-(quoted in David Pritchard, The Encyclopedia of Chess Variants) -

- -"... shogi [is] by far the most complex form of chess that has ever -achieved widespread popularity." -

- ---- R. Wayne Schmittberger, New Rules for Classic Games -

-

- -Shogi is the version of chess played in Japan. It is strikingly -different from standard chess (which I shall refer to henceforth as -"international chess") and also to all other regional variants, -because captured pieces can re-enter play on the side of the capturer. -This has several interesting effects on the play of the game: -

- -

    -
  1. -Shogi is much more complex than international chess, at least in -terms of the average number of possible moves per turn (estimated at -about 35 for chess and at about 80 for shogi). -

    - -

  2. -There are almost no draws (about 1-2% of all games in professional play). -

    - -

  3. -Exchanges complicate the play rather than simplifying it. -

    - -

  4. -There are no "endgames" in the standard chess sense; all pieces remain -in play throughout the game. Games typically end in a race to -checkmate the other player before being checkmated oneself. -

    - -

  5. -Ownership of a piece is not indicated by the color of the piece; -instead, pieces are wedge-shaped and point towards the opponent. The -name of the piece is inscribed in Kanji characters on the front of the -piece. -

    - -

  6. -Most importantly: it's more fun than other forms of chess :-) -

    - -

-

- -Shogi is extremely popular in Japan; it has been estimated that 20 -million Japanese can play shogi, of which perhaps 1 million are active -players. It is even more popular there than the game of go, Japan's -other favorite board game. There are a number of professional players -who make a considerable amount of money playing in shogi tournaments, -and the game receives extensive newpaper and television coverage. -Despite this, the game has yet to become popular outside of Japan. Part -of this is because the Kanji characters on the pieces scare away some -people, but mostly it's due, I think, to lack of exposure to the game -and to the difficulty of finding opponents. I hope that GNU shogi will -help introduce shogi to a wider audience. -

- -

- - - - - -
2.1 The rules of shogi  
2.2 Sample game  
2.3 Mating problems  
2.4 Shogi variants  
2.5 Differences between shogi and chess  
-

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_6.html b/doc/gnushogi_6.html deleted file mode 100644 index 24910cf..0000000 --- a/doc/gnushogi_6.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - -GNU Shogi manual: The rules of shogi - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.1 The rules of shogi

- -

- -Shogi is a two-person abstract strategy board game with full information -(i.e. all pieces and moves are visible to both players at all times). -It is in the chess family, being descended from the same ancestral game -as international chess: the Indian game of Chaturanga. The two players -are referred to as "Black" and "White", with Black moving first -(unlike in international chess, where White moves first), and with -movement alternating between the two players. Note that "Black" and -"White" are just names; the pieces are not colored. Instead, they are -flat, wedge-shaped pieces which point towards the opponent. The -identity of a given piece is indicated by two Japanese Kanji characters -on each piece. In fact, only the top character is needed to identify -the piece and thus only the top character is used in shogi diagrams. I -will use alphabetical equivalents in the diagrams here; to see what the -Kanji characters look like, start up xshogi (see section 4. xshogi) and compare -the starting setup there with the starting setup in this file -(see section 2.1.2 The opening setup). -

- -The object of the game is to capture the opponent's King. The board is -a grid of 9x9 uncolored squares, and pieces are placed on the squares. -Each player begins with 20 pieces, described in the next section. -Capture is by displacement, as in international chess. -

- -

- - - - - - - - -
2.1.1 The moves of the pieces  
2.1.2 The opening setup  
2.1.3 Promotion of pieces  
2.1.4 Drops  
2.1.5 Winning the game  
2.1.6 Draws  
2.1.7 Handicaps  
2.1.8 Notes for chess players  
-

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_7.html b/doc/gnushogi_7.html deleted file mode 100644 index 8e17843..0000000 --- a/doc/gnushogi_7.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - -GNU Shogi manual: The moves of the pieces - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.1.1 The moves of the pieces

- -

- -Each player at the beginning of a shogi game has a total of 20 pieces of -eight different types. The moves of the shogi pieces can be divided -into three classes: "stepping" pieces, that only move one square at a -time; "ranging" pieces that move any number of unobstructed squares in -a line, and "jumping" pieces that can jump over obstructing pieces to -reach their destination squares. Most pieces can also promote to -different (usually stronger) pieces under certain circumstances (see the -next section). All pieces capture the same way that they move (even -pawns). The piece moves and promotions are as follows; each piece name -is followed by the standard piece abbreviation: -

- -

    - -
  1. -The king (K). The king can move one square in any horizontal, vertical, -or diagonal direction, just like the king in international chess. The -king does not promote. -

    - -

  2. -The rook (R). The rook can move any number of squares in a horizontal -or vertical direction. The rook is the same as the rook in -international chess (except that it can promote). A rook promotes to a -"dragon king" or "dragon" for short (often just referred to as a -"promoted rook"), which can move as a rook or can move one square in -any diagonal direction. -

    - -

  3. -The bishop (B). The bishop can move any number of squares in a diagonal -direction. The bishop is the same as the bishop in international chess -(except that it can promote). A bishop promotes to a "dragon horse" -or "horse" for short (often just referred to as a "promoted -bishop"), which can move as a bishop or can move one square in any -horizontal or vertical direction. Note: the horse should not be -confused with a knight (see below), as they are two completely different -pieces. -

    - -

  4. -The gold general (G). A gold general can move one square in any -horizontal or vertical direction, or one square in a forward diagonal -direction. Gold generals do not promote. -

    - -

  5. -The silver general (S). A silver general can move one square in any -diagonal direction, or one square straight forward. A silver general -promotes to a gold general. -

    - -

  6. -The knight (N). A knight can move one square straight forward followed -by one square to either forward diagonal, jumping over intervening -pieces if any. In other words, a knight moves like its international -chess counterpart, but forward only. A knight promotes to a gold -general. The knight is the only jumping piece, as in chess. -

    - -

  7. -The lance (L). A lance can move any number of squares straight forward. -A lance promotes to a gold general. -

    - -

  8. -The pawn (P). A pawn can move one square straight forward. The pawn -captures the same way that it moves, in contrast to international chess. -There is also no initial two-space move for pawns and no -en-passant capture. A pawn promotes to a gold general; a -promoted pawn is usually known as a "Tokin". -

    - -

-

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_8.html b/doc/gnushogi_8.html deleted file mode 100644 index 131365f..0000000 --- a/doc/gnushogi_8.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - -GNU Shogi manual: The opening setup - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.1.2 The opening setup

- -

- -The opening setup for shogi is as follows: -

- - 9 8 7 6 5 4 3 2 1 -+---------------------------------------------+
-| wL | wN | wS | wG | wK | wG | wS | wN | wL | a
-+---------------------------------------------+
-| | wR | | | | | | wB | | b
-+---------------------------------------------+
-| wP | wP | wP | wP | wP | wP | wP | wP | wP | c
-+---------------------------------------------+
-| | | | | | | | | | d
-+---------------------------------------------+
-| | | | | | | | | | e
-+---------------------------------------------+
-| | | | | | | | | | f
-+---------------------------------------------+
-| bP | bP | bP | bP | bP | bP | bP | bP | bP | g
-+---------------------------------------------+
-| | bB | | | | | | bR | | h
-+---------------------------------------------+
-| bL | bN | bS | bG | bK | bG | bS | bN | bL | i
-+---------------------------------------------+ -

- -Here, "b" stands for "black" and "w" stands for "white", so -that, for instance, "bL" means "black lance". The numbers above the -files and the letters to the right of the ranks represent the most -common notation system used for shogi by westerners (the Japanese also -use Arabic numerals for the files but use Japanese numerals for the -ranks). -

- - -


-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_9.html b/doc/gnushogi_9.html deleted file mode 100644 index 0c08b13..0000000 --- a/doc/gnushogi_9.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - -GNU Shogi manual: Promotion of pieces - - - - - - - - - - - - - - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
-

2.1.3 Promotion of pieces

- -

- -In sharp contrast to international chess, where only pawns can promote -to higher-ranked pieces, most of the pieces in shogi can promote. The -promoted ranks are discussed in the section on piece moves (see section 2.1.1 The moves of the pieces) but are repeated here for reference: -

- -

- -
Pawn -
promotes to gold general (called a `tokin' in this case only). -

- -

Lance -
promotes to gold general. -

- -

Knight -
promotes to gold general. -

- -

Silver general -
promotes to gold general. -

- -

Gold general -
does not promote. -

- -

Bishop -
promotes to "dragon horse" or just "horse" for short. The horse can -move as a bishop or can move one square in any orthogonal direction. -

- -

Rook -
promotes to "dragon king" or just "dragon" for short. The dragon -can move as a rook or can move one square in any diagonal direction. -

- -

King -
does not promote. -

- -

-

- -The three ranks furthest away from each player constitute his/her -"promotion zone". A player may, but is not required to, promote a -piece after making a move in which the piece begins and/or ends in the -promotion zone. Thus you can promote a piece when moving the piece into -the promotion zone, out of the promotion zone, or entirely within the -promotion zone. Promotion is mandatory in these cases: -

- -

    - -
  1. You must promote a pawn or a lance after moving it to the last rank. -

    - -

  2. You must promote a knight after moving it to either of the last -two ranks. -

    - -

-

- -These forced promotions ensure that a piece cannot be moved to a square -from which it would have no further move. -

- -Pieces "dropped" onto the board (see section 2.1.4 Drops) always drop in the -unpromoted state, even if they drop into the promotion zone. -

- - -


- - - - - - - - - - -
[ < ][ > ]   [ << ][ Up ][ >> ]         [Top][Contents][Index][ ? ]
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_abt.html b/doc/gnushogi_abt.html deleted file mode 100644 index 1d685a1..0000000 --- a/doc/gnushogi_abt.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - - -GNU Shogi manual: About this document - - - - - - - - - - - - - - - - - -
[Top][Contents][Index][ ? ]
-
-

About this document

-This document was generated by Michael C. Vanier on July, 7 2004 -using texi2html -

-The buttons in the navigation panels have the following meaning: -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Button Name Go to From 1.2.3 go to
- [ < ] -Back - -previous section in reading order - -1.2.2 -
- [ > ] -Forward - -next section in reading order - -1.2.4 -
- [ << ] -FastBack - -previous or up-and-previous section - -1.1 -
- [ Up ] -Up - -up section - -1.2 -
- [ >> ] -FastForward - -next or up-and-next section - -1.3 -
- [Top] -Top - -cover (top) of document - -   -
- [Contents] -Contents - -table of contents - -   -
- [Index] -Index - -concept index - -   -
- [ ? ] -About - -this page - -   -
-

-where the Example assumes that the current position -is at Subsubsection One-Two-Three of a document of -the following structure: -
    -
  • 1. Section One
  • -
      -
    • 1.1 Subsection One-One
    • -
        -
      • ...
      • -
      -
    • 1.2 Subsection One-Two
    • -
        -
      • 1.2.1 Subsubsection One-Two-One -
      • 1.2.2 Subsubsection One-Two-Two -
      • 1.2.3 Subsubsection One-Two-Three     -<== Current Position -
      • 1.2.4 Subsubsection One-Two-Four -
      -
    • 1.3 Subsection One-Three
    • -
        -
      • ...
      • -
      -
    • 1.4 Subsection One-Four
    • -
    -
- -
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_ovr.html b/doc/gnushogi_ovr.html deleted file mode 100644 index b31d284..0000000 --- a/doc/gnushogi_ovr.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - -GNU Shogi manual: Short Table of Contents - - - - - - - - - - - - - - - - - -
[Top][Contents][Index][ ? ]
-
-

Short Table of Contents

-
-1. Introduction -
-GNU GENERAL PUBLIC LICENSE -
-2. About the game of shogi -
-3. gnushogi -
-4. xshogi -
-5. References and links -
-6. Acknowledgements -
-7. Bugs -
-8. Index -
- -
-
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/gnushogi_toc.html b/doc/gnushogi_toc.html deleted file mode 100644 index eec04f7..0000000 --- a/doc/gnushogi_toc.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - -GNU Shogi manual: Table of Contents - - - - - - - - - - - - - - - - - -
[Top][Contents][Index][ ? ]
-
-

Table of Contents

- -
-
- -This document was generated -by Michael C. Vanier on July, 7 2004 -using texi2html - - - diff --git a/doc/texinfo.tex b/doc/texinfo.tex index 7421f88..85f184c 100644 --- a/doc/texinfo.tex +++ b/doc/texinfo.tex @@ -1,17 +1,18 @@ % texinfo.tex -- TeX macros to handle Texinfo files. -% +% % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{1999-05-25.6}% +\def\texinfoversion{2013-02-01.11} % -% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 -% Free Software Foundation, Inc. +% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +% 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. % -% This texinfo.tex file is free software; you can redistribute it and/or +% This texinfo.tex file 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, or (at -% your option) any later version. +% published by the Free Software Foundation, either version 3 of the +% License, or (at your option) any later version. % % This texinfo.tex file is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -19,25 +20,20 @@ % General Public License for more details. % % You should have received a copy of the GNU General Public License -% along with this texinfo.tex file; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -% Boston, MA 02111-1307, USA. +% along with this program. If not, see . % -% In other words, you are welcome to use, share and improve this program. -% You are forbidden to forbid anyone else to use, share and improve -% what you give them. Help stamp out software-hoarding! +% As a special exception, when this file is read by TeX when processing +% a Texinfo source document, you may use the result without +% restriction. This Exception is an additional permission under section 7 +% of the GNU General Public License, version 3 ("GPLv3"). % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: -% ftp://ftp.gnu.org/pub/gnu/texinfo.tex -% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) -% ftp://tug.org/tex/texinfo.tex -% ftp://ctan.org/macros/texinfo/texinfo.tex -% (and all CTAN mirrors, finger ctan@ctan.org for a list). -% /home/gd/gnu/doc/texinfo.tex on the GNU machines. -% The texinfo.tex in any given Texinfo distribution could well be out +% http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or +% http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or +% http://www.gnu.org/software/texinfo/ (the Texinfo home page) +% The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. -% There is a small home page for Texinfo at http://texinfo.org/. % % Send bug reports to bug-texinfo@gnu.org. Please include including a % complete document in each bug report with which we can reproduce the @@ -50,13 +46,17 @@ % texindex foo.?? % tex foo.texi % tex foo.texi -% dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps. -% The extra runs of TeX get the cross-reference information correct. +% dvips foo.dvi -o # or whatever; this makes foo.ps. +% The extra TeX runs get the cross-reference information correct. % Sometimes one run after texindex suffices, and sometimes you need more % than two; texi2dvi does it as many times as necessary. % -% It is possible to adapt texinfo.tex for other languages. You can get -% the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/. +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. + \message{Loading texinfo [version \texinfoversion]:} @@ -66,7 +66,13 @@ \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} -% Save some parts of plain tex whose names we will redefine. +\chardef\other=12 + +% We never want plain's \outer definition of \+ in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + +% Save some plain tex macros whose names we will redefine. \let\ptexb=\b \let\ptexbullet=\bullet \let\ptexc=\c @@ -76,38 +82,46 @@ \let\ptexend=\end \let\ptexequiv=\equiv \let\ptexexclam=\! +\let\ptexfootnote=\footnote +\let\ptexgtr=> +\let\ptexhat=^ \let\ptexi=\i +\let\ptexindent=\indent +\let\ptexinsert=\insert \let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexnewwrite\newwrite +\let\ptexnoindent=\noindent +\let\ptexplus=+ +\let\ptexraggedright=\raggedright \let\ptexrbrace=\} +\let\ptexslash=\/ \let\ptexstar=\* \let\ptext=\t - -% We never want plain's outer \+ definition in Texinfo. -% For @tex, we can use \tabalign. -\let\+ = \relax - -% Get ready for pdf. -\newif\ifpdf -\ifx\pdfoutput\undefined\else - \input pdfcolor - \pdfoutput=1 - \pdftrue -\fi - -\message{Basics,} -\chardef\other=12 +\let\ptextop=\top +{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode % If this character appears in an error message or help string, it % starts a new line in the output. \newlinechar = `^^J +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + % Set up fixed words for English if not already set. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putworderror\undefined \gdef\putworderror{error}\fi \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi \ifx\putwordin\undefined \gdef\putwordin{in}\fi -\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi -\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi @@ -139,46 +153,101 @@ \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi -\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi -\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi + +% Since the category of space is not known, we have to be careful. +\chardef\spacecat = 10 +\def\spaceisspace{\catcode`\ =\spacecat} + +% sometimes characters are active, so we need control sequences. +\chardef\ampChar = `\& +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dashChar = `\- +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\hashChar = `\# +\chardef\lquoteChar= `\` +\chardef\questChar = `\? +\chardef\rquoteChar= `\' +\chardef\semiChar = `\; +\chardef\slashChar = `\/ +\chardef\underChar = `\_ % Ignore a token. % \def\gobble#1{} -\hyphenation{ap-pen-dix} -\hyphenation{mini-buf-fer mini-buf-fers} -\hyphenation{eshell} -\hyphenation{white-space} +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} + +% Hyphenation fixes. +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} % Margin to add to right of even pages, to left of odd pages. -\newdimen \bindingoffset -\newdimen \normaloffset +\newdimen\bindingoffset +\newdimen\normaloffset \newdimen\pagewidth \newdimen\pageheight +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt } + % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, -% since that produces some useless output on the terminal. +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. % \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% -\ifx\eTeXversion\undefined -\def\loggingall{\tracingcommands2 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \showboxbreadth\maxdimen\showboxdepth\maxdimen -}% -\else -\def\loggingall{\tracingcommands3 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \tracingscantokens1 \tracingassigns1 \tracingifs1 - \tracinggroups1 \tracingnesting2 - \showboxbreadth\maxdimen\showboxdepth\maxdimen +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\thisisundefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines16 }% -\fi -% For @cropmarks command. +% @errormsg{MSG}. Do the index-like expansions on MSG, but if things +% aren't perfect, it's not the end of the world, being an error message, +% after all. +% +\def\errormsg{\begingroup \indexnofonts \doerrormsg} +\def\doerrormsg#1{\errmessage{#1}} + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} + % Do @cropmarks to get crop marks. % \newif\ifcropmarks @@ -192,6 +261,50 @@ \newdimen\cornerthick \cornerthick=.3pt \newdimen\topandbottommargin \topandbottommargin=.75in +% Output a mark which sets \thischapter, \thissection and \thiscolor. +% We dump everything together because we only have one kind of mark. +% This works because we only use \botmark / \topmark, not \firstmark. +% +% A mark contains a subexpression of the \ifcase ... \fi construct. +% \get*marks macros below extract the needed part using \ifcase. +% +% Another complication is to let the user choose whether \thischapter +% (\thissection) refers to the chapter (section) in effect at the top +% of a page, or that at the bottom of a page. The solution is +% described on page 260 of The TeXbook. It involves outputting two +% marks for the sectioning macros, one before the section break, and +% one after. I won't pretend I can describe this better than DEK... +\def\domark{% + \toks0=\expandafter{\lastchapterdefs}% + \toks2=\expandafter{\lastsectiondefs}% + \toks4=\expandafter{\prevchapterdefs}% + \toks6=\expandafter{\prevsectiondefs}% + \toks8=\expandafter{\lastcolordefs}% + \mark{% + \the\toks0 \the\toks2 + \noexpand\or \the\toks4 \the\toks6 + \noexpand\else \the\toks8 + }% +} +% \topmark doesn't work for the very first chapter (after the title +% page or the contents), so we use \firstmark there -- this gets us +% the mark with the chapter defs, unless the user sneaks in, e.g., +% @setcolor (or @url, or @link, etc.) between @contents and the very +% first @chapter. +\def\gettopheadingmarks{% + \ifcase0\topmark\fi + \ifx\thischapter\empty \ifcase0\firstmark\fi \fi +} +\def\getbottomheadingmarks{\ifcase1\botmark\fi} +\def\getcolormarks{\ifcase2\topmark\fi} + +% Avoid "undefined control sequence" errors. +\def\lastchapterdefs{} +\def\lastsectiondefs{} +\def\prevchapterdefs{} +\def\prevsectiondefs{} +\def\lastcolordefs{} + % Main output routine. \chardef\PAGE = 255 \output = {\onepageout{\pagecontents\PAGE}} @@ -209,7 +322,9 @@ % % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). + \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% % {% @@ -217,11 +332,18 @@ % take effect in \write's, yet the group defined by the \vbox ends % before the \shipout runs. % - \escapechar = `\\ % use backslash in output files. \indexdummies % don't expand commands in the output. \normalturnoffactive % \ in index entries must not stay \, e.g., if - % the page break happens to be in the middle of an example. + % the page break happens to be in the middle of an example. + % We don't want .vr (or whatever) entries like this: + % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} + % "\acronym" won't work when it's read back in; + % it needs to be + % {\code {{\tt \backslashcurfont }acronym} \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi + % \ifcropmarks \vbox to \outervsize\bgroup \hsize = \outerhsize \vskip-\topandbottommargin @@ -245,14 +367,12 @@ \pagebody{#1}% \ifdim\ht\footlinebox > 0pt % Only leave this space if the footline is nonempty. - % (We lessened \vsize for it in \oddfootingxxx.) + % (We lessened \vsize for it in \oddfootingyyy.) % The \baselineskip=24pt in plain's \makefootline has no effect. - \vskip 2\baselineskip + \vskip 24pt \unvbox\footlinebox \fi % - \ifpdf\pdfmkdest{\the\pageno}\fi - % \ifcropmarks \egroup % end of \vbox\bgroup \hfil\egroup % end of (centering) \line\bgroup @@ -270,7 +390,7 @@ \egroup % \vbox from first cropmarks clause \fi }% end of \shipout\vbox - }% end of group with \turnoffactive + }% end of group with \indexdummies \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } @@ -283,7 +403,7 @@ % marginal hacks, juha@viisa.uucp (Juha Takala) \ifvoid\margin\else % marginal info is present \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi -\dimen@=\dp#1 \unvbox#1 +\dimen@=\dp#1\relax \unvbox#1\relax \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi \ifr@ggedbottom \kern-\dimen@ \vfil \fi} } @@ -303,195 +423,161 @@ % the input line (except we remove a trailing comment). #1 should be a % macro which expects an ordinary undelimited TeX argument. % -\def\parsearg#1{% - \let\next = #1% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\argtorun{#2}% \begingroup \obeylines - \futurelet\temp\parseargx -} - -% If the next token is an obeyed space (from an @example environment or -% the like), remove it and recurse. Otherwise, we're done. -\def\parseargx{% - % \obeyedspace is defined far below, after the definition of \sepspaces. - \ifx\obeyedspace\temp - \expandafter\parseargdiscardspace - \else - \expandafter\parseargline - \fi + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. } -% Remove a single space (as the delimiter token to the macro call). -{\obeyspaces % - \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} - {\obeylines % \gdef\parseargline#1^^M{% \endgroup % End of the group started in \parsearg. - % - % First remove any @c comment, then any @comment. - % Result of each macro is put in \toks0. - \argremovec #1\c\relax % - \expandafter\argremovecomment \the\toks0 \comment\relax % - % - % Call the caller's macro, saved as \next in \parsearg. - \expandafter\next\expandafter{\the\toks0}% + \argremovecomment #1\comment\ArgTerm% }% } -% Since all \c{,omment} does is throw away the argument, we can let TeX -% do that for us. The \relax here is matched by the \relax in the call -% in \parseargline; it could be more or less anything, its purpose is -% just to delimit the argument to the \c. -\def\argremovec#1\c#2\relax{\toks0 = {#1}} -\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} -% \argremovec{,omment} might leave us with trailing spaces, though; e.g., +% Each occurrence of `\^^M' or `\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., % @end itemize @c foo -% will have two active spaces as part of the argument with the -% `itemize'. Here we remove all active spaces from #1, and assign the -% result to \toks0. -% -% This loses if there are any *other* active characters besides spaces -% in the argument -- _ ^ +, for example -- since they get expanded. -% Fortunately, Texinfo does not define any such commands. (If it ever -% does, the catcode of the characters in questionwill have to be changed -% here.) But this means we cannot call \removeactivespaces as part of -% \argremovec{,omment}, since @c uses \parsearg, and thus the argument -% that \parsearg gets might well have any character at all in it. -% -\def\removeactivespaces#1{% - \begingroup - \ignoreactivespaces - \edef\temp{#1}% - \global\toks0 = \expandafter{\temp}% - \endgroup +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. +% +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm } -% Change the active space to expand to nothing. +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \argtorun. +% (Similarly, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. % -\begingroup +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ \obeyspaces - \gdef\ignoreactivespaces{\obeyspaces\let =\empty} -\endgroup + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} -%% These are used to keep @begin/@end levels from running away -%% Call \inENV within environments (after a \begingroup) -\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} -\def\ENVcheck{% -\ifENV\errmessage{Still within an environment; press RETURN to continue} -\endgroup\fi} % This is not perfect, but it should reduce lossage +% Define the framework for environments in texinfo.tex. It's used like this: +% +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as environments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) -% @begin foo is the same as @foo, for now. -\newhelp\EMsimple{Press RETURN to continue.} -\outer\def\begin{\parsearg\beginxxx} +% At run-time, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty -\def\beginxxx #1{% -\expandafter\ifx\csname #1\endcsname\relax -{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else -\csname #1\endcsname\fi} +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} -% @end foo executes the definition of \Efoo. -% -\def\end{\parsearg\endxxx} -\def\endxxx #1{% - \removeactivespaces{#1}% - \edef\endthing{\the\toks0}% - % - \expandafter\ifx\csname E\endthing\endcsname\relax - \expandafter\ifx\csname \endthing\endcsname\relax - % There's no \foo, i.e., no ``environment'' foo. - \errhelp = \EMsimple - \errmessage{Undefined command `@end \endthing'}% - \else - \unmatchedenderror\endthing - \fi +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp \else - % Everything's ok; the right environment has been started. - \csname E\endthing\endcsname + \badenverr \fi } -% There is an environment #1, but it hasn't been started. Give an error. -% -\def\unmatchedenderror#1{% +% Environment mismatch, #1 expected: +\def\badenverr{% \errhelp = \EMsimple - \errmessage{This `@end #1' doesn't have a matching `@#1'}% + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% } - -% Define the control sequence \E#1 to give an unmatched @end error. -% -\def\defineunmatchedend#1{% - \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% +\def\inenvironment#1{% + \ifx#1\empty + outside of any environment% + \else + in environment \expandafter\string#1% + \fi } - -% Single-spacing is done by various environments (specifically, in -% \nonfillstart and \quotations). -\newskip\singlespaceskip \singlespaceskip = 12.5pt -\def\singlespace{% - % Why was this kern here? It messes up equalizing space above and below - % environments. --karl, 6may93 - %{\advance \baselineskip by -\singlespaceskip - %\kern \baselineskip}% - \setleading \singlespaceskip +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv +% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal. + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi } -%% Simple single-character @ commands - -% @@ prints an @ -% Kludge this until the fonts are right (grr). -\def\@{{\tt\char64}} - -% This is turned off because it was never documented -% and you can use @w{...} around a quote to suppress ligatures. -%% Define @` and @' to be the same as ` and ' -%% but suppressing ligatures. -%\def\`{{`}} -%\def\'{{'}} - -% Used to generate quoted braces. -\def\mylbrace {{\tt\char123}} -\def\myrbrace {{\tt\char125}} -\let\{=\mylbrace -\let\}=\myrbrace -\begingroup - % Definitions to produce actual \{ & \} command in an index. - \catcode`\{ = 12 \catcode`\} = 12 - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\@ = 0 \catcode`\\ = 12 - @gdef@lbracecmd[\{]% - @gdef@rbracecmd[\}]% -@endgroup - -% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. -\let\, = \c -\let\dotaccent = \. -\def\ringaccent#1{{\accent23 #1}} -\let\tieaccent = \t -\let\ubaraccent = \b -\let\udotaccent = \d +\newhelp\EMsimple{Press RETURN to continue.} -% Other special characters: @questiondown @exclamdown -% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. -\def\questiondown{?`} -\def\exclamdown{!`} - -% Dotless i and dotless j, used for accents. -\def\imacro{i} -\def\jmacro{j} -\def\dotless#1{% - \def\temp{#1}% - \ifx\temp\imacro \ptexi - \else\ifx\temp\jmacro \j - \else \errmessage{@dotless can be used only with i or j}% - \fi\fi -} % Be sure we're in horizontal mode when doing a tie, since we make space % equivalent to this in @example-like environments. Otherwise, a space @@ -509,16 +595,34 @@ \def\:{\spacefactor=1000 } % @* forces a line break. -\def\*{\hfil\break\hbox{}\ignorespaces} +\def\*{\unskip\hfil\break\hbox{}\ignorespaces} + +% @/ allows a line break. +\let\/=\allowbreak % @. is an end-of-sentence period. -\def\.{.\spacefactor=3000 } +\def\.{.\spacefactor=\endofsentencespacefactor\space} % @! is an end-of-sentence bang. -\def\!{!\spacefactor=3000 } +\def\!{!\spacefactor=\endofsentencespacefactor\space} % @? is an end-of-sentence query. -\def\?{?\spacefactor=3000 } +\def\?{?\spacefactor=\endofsentencespacefactor\space} + +% @frenchspacing on|off says whether to put extra space after punctuation. +% +\def\onword{on} +\def\offword{off} +% +\parseargdef\frenchspacing{% + \def\temp{#1}% + \ifx\temp\onword \plainfrenchspacing + \else\ifx\temp\offword \plainnonfrenchspacing + \else + \errhelp = \EMsimple + \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% + \fi\fi +} % @w prevents a word break. Without the \leavevmode, @w at the % beginning of a paragraph, when TeX is still in vertical mode, would @@ -533,47 +637,24 @@ % therefore, no glue is inserted, and the space between the headline and % the text is small, which looks bad. % -\def\group{\begingroup - \ifnum\catcode13=\active \else +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% +\envdef\group{% + \ifnum\catcode`\^^M=\active \else \errhelp = \groupinvalidhelp \errmessage{@group invalid in context where filling is enabled}% \fi + \startsavinginserts % - % The \vtop we start below produces a box with normal height and large - % depth; thus, TeX puts \baselineskip glue before it, and (when the - % next line of text is done) \lineskip glue after it. (See p.82 of - % the TeXbook.) Thus, space below is not quite equal to space - % above. But it's pretty close. - \def\Egroup{% - \egroup % End the \vtop. - \endgroup % End the \group. - }% - % - \vtop\bgroup - % We have to put a strut on the last line in case the @group is in - % the midst of an example, rather than completely enclosing it. - % Otherwise, the interline space between the last line of the group - % and the first line afterwards is too small. But we can't put the - % strut in \Egroup, since there it would be on a line by itself. - % Hence this just inserts a strut at the beginning of each line. - \everypar = {\strut}% - % - % Since we have a strut on every line, we don't need any of TeX's - % normal interline spacing. - \offinterlineskip - % - % OK, but now we have to do something about blank - % lines in the input in @example-like environments, which normally - % just turn into \lisppar, which will insert no space now that we've - % turned off the interline space. Simplest is to make them be an - % empty paragraph. - \ifx\par\lisppar - \edef\par{\leavevmode \par}% - % - % Reset ^^M's definition to new definition of \par. - \obeylines - \fi - % + \setbox\groupbox = \vtop\bgroup % Do @comment since we are called inside an environment such as % @example, where each end-of-line in the input causes an % end-of-line in the output. We don't want the end-of-line after @@ -583,6 +664,32 @@ \comment } % +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% % TeX puts in an \escapechar (i.e., `@') at the beginning of the help % message, so this ends up printing `@group can only ...'. % @@ -595,81 +702,50 @@ where each line of input produces a line of output.} \newdimen\mil \mil=0.001in -\def\need{\parsearg\needx} - -% Old definition--didn't work. -%\def\needx #1{\par % -%% This method tries to make TeX break the page naturally -%% if the depth of the box does not fit. -%{\baselineskip=0pt% -%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak -%\prevdepth=-1000pt -%}} - -\def\needx#1{% - % Go into vertical mode, so we don't make a big box in the middle of a +\parseargdef\need{% + % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. \par % - % Don't add any leading before our big empty box, but allow a page - % break, since the best break might be right here. - \allowbreak - \nointerlineskip - \vtop to #1\mil{\vfil}% - % - % TeX does not even consider page breaks if a penalty added to the - % main vertical list is 10000 or more. But in order to see if the - % empty box we just added fits on the page, we must make it consider - % page breaks. On the other hand, we don't want to actually break the - % page after the empty box. So we use a penalty of 9999. - % - % There is an extremely small chance that TeX will actually break the - % page at this \penalty, if there are no other feasible breakpoints in - % sight. (If the user is using lots of big @group commands, which - % almost-but-not-quite fill up a page, TeX will have a hard time doing - % good page breaking, for example.) However, I could not construct an - % example where a page broke at this \penalty; if it happens in a real - % document, then we can reconsider our strategy. - \penalty9999 - % - % Back up by the size of the box, whether we did a page break or not. - \kern -#1\mil - % - % Do not allow a page break right after this kern. - \nobreak + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi } -% @br forces paragraph break +% @br forces paragraph break (and is undocumented). \let\br = \par -% @dots{} output an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \leavevmode - \hbox to 2em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% - \spacefactor=3000 -} - - -% @page forces the start of a new page +% @page forces the start of a new page. % \def\page{\par\vfill\supereject} @@ -681,78 +757,196 @@ where each line of input produces a line of output.} \newskip\exdentamount % This defn is used inside fill environments such as @defun. -\def\exdent{\parsearg\exdentyyy} -\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} % This defn is used inside nofill environments such as @example. -\def\nofillexdent{\parsearg\nofillexdentyyy} -\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount -\leftline{\hskip\leftskip{\rm#1}}}} +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} -% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph. - -\def\inmargin#1{% -\strut\vadjust{\nobreak\kern-\strutdepth - \vtop to \strutdepth{\baselineskip\strutdepth\vss - \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}} +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. Not documented, written for gawk manual. +% \newskip\inmarginspacing \inmarginspacing=1cm \def\strutdepth{\dp\strutbox} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). This command +% is not documented, not supported, and doesn't work. +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} -%\hbox{{\rm#1}}\hfil\break}} - -% @include file insert text of that file as input. -% Allow normal characters that we make active in the argument (a file name). -\def\include{\begingroup - \catcode`\\=12 - \catcode`~=12 - \catcode`^=12 - \catcode`_=12 - \catcode`|=12 - \catcode`<=12 - \catcode`>=12 - \catcode`+=12 - \parsearg\includezzz} -% Restore active chars for included file. -\def\includezzz#1{\endgroup\begingroup - % Read the included file in a group so nested @include's work. +% @include FILE -- \input text of FILE. +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack \def\thisfile{#1}% - \input\thisfile -\endgroup} + {% + \makevalueexpandable % we want to expand any @value in FILE. + \turnoffactive % and allow special characters in the expansion + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @include of #1^^J}% + \edef\temp{\noexpand\input #1 }% + % + % This trickery is to read FILE outside of a group, in case it makes + % definitions, etc. + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \catcode`-=\other + \catcode`\`=\other + \catcode`\'=\other +} -\def\thisfile{} +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} -% @center line outputs that line, centered +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} +% +\def\thisfile{} -\def\center{\parsearg\centerzzz} -\def\centerzzz #1{{\advance\hsize by -\leftskip -\advance\hsize by -\rightskip -\centerline{#1}}} +% @center line +% outputs that line, centered. +% +\parseargdef\center{% + \ifhmode + \let\centersub\centerH + \else + \let\centersub\centerV + \fi + \centersub{\hfil \ignorespaces#1\unskip \hfil}% + \let\centersub\relax % don't let the definition persist, just in case +} +\def\centerH#1{{% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break +}} +% +\newcount\centerpenalty +\def\centerV#1{% + % The idea here is the same as in \startdefun, \cartouche, etc.: if + % @center is the first thing after a section heading, we need to wipe + % out the negative parskip inserted by \sectionheading, but still + % prevent a page break here. + \centerpenalty = \lastpenalty + \ifnum\centerpenalty>10000 \vskip\parskip \fi + \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi + \line{\kern\leftskip #1\kern\rightskip}% +} % @sp n outputs n lines of vertical space - -\def\sp{\parsearg\spxxx} -\def\spxxx #1{\vskip #1\baselineskip} +% +\parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment % @ignore ... @end ignore is another way to write a comment - +% \def\comment{\begingroup \catcode`\^^M=\other% \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% \commentxxx} {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} - +% \let\c=\comment % @paragraphindent NCHARS % We'll use ems for NCHARS, close enough. -% We cannot implement @paragraphindent asis, though. -% +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. +% \def\asisword{asis} % no translation, these are keywords \def\noneword{none} % -\def\paragraphindent{\parsearg\doparagraphindent} -\def\doparagraphindent#1{% +\parseargdef\paragraphindent{% \def\temp{#1}% \ifx\temp\asisword \else @@ -769,8 +963,7 @@ where each line of input produces a line of output.} % We'll use ems for NCHARS like @paragraphindent. % It seems @exampleindent asis isn't necessary, but % I preserve it to make it similar to @paragraphindent. -\def\exampleindent{\parsearg\doexampleindent} -\def\doexampleindent#1{% +\parseargdef\exampleindent{% \def\temp{#1}% \ifx\temp\asisword \else @@ -782,26 +975,58 @@ where each line of input produces a line of output.} \fi } -% @asis just yields its argument. Used with @table, for example. +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indent at such +% paragraphs. % -\def\asis#1{#1} +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\def\insertword{insert} +% +\parseargdef\firstparagraphindent{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi +} -% @math means output in math mode. -% We don't use $'s directly in the definition of \math because control -% sequences like \math are expanded when the toc file is written. Then, -% we read the toc file back, the $'s will be normal characters (as they -% should be, according to the definition of Texinfo). So we must use a -% control sequence to switch into and out of math mode. +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. % -% This isn't quite enough for @math to work properly in indices, but it -% seems unlikely it will ever be needed there. +% We also make \indent itself not actually do anything until the next +% paragraph. % -\let\implicitmath = $ -\def\math#1{\implicitmath #1\implicitmath} +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent + }% + \global\everypar = {% + \kern -\parindent + \restorefirstparagraphindent + }% +} + +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} -% @bullet and @minus need the same treatment as @math, just above. -\def\bullet{\implicitmath\ptexbullet\implicitmath} -\def\minus{\implicitmath-\implicitmath} % @refill is a no-op. \let\refill=\relax @@ -817,20 +1042,20 @@ where each line of input produces a line of output.} % So open here the files we need to have open while reading the input. % This makes it possible to make a .fmt file for texinfo. \def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. \iflinks - \readauxfile + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux \fi % \openindices needs to do some work in any case. \openindices - \fixbackslash % Turn off hack to swallow `\input texinfo'. - \global\let\setfilename=\comment % Ignore extra @setfilename cmds. + \let\setfilename=\comment % Ignore extra @setfilename cmds. % % If texinfo.cnf is present on the system, read it. % Useful for site-wide @afourpaper, etc. - % Just to be on the safe side, close the input stream before the \input. \openin 1 texinfo.cnf - \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi - \closein1 - \temp + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 % \comment % Ignore the actual filename. } @@ -852,154 +1077,716 @@ where each line of input produces a line of output.} \message{pdf,} % adobe `portable' document format - \newcount\tempnum \newcount\lnkcount \newtoks\filename \newcount\filenamelength \newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest -\ifpdf -\def\pdfmkdest#1{\pdfdest name{#1@} xyz} -\def\pdfmkpgn#1{#1@} - -% Adding outlines to PDF; macros for calculating structure of outlines -% come from Petr Olsak -\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% - \else \csname#1\endcsname \fi} -\def\advancenumber#1{\tempnum=\expnumber{#1}\relax - \advance\tempnum by1 - \expandafter\xdef\csname#1\endcsname{\the\tempnum}} -\def\pdfmakeoutlines{{% - \openin 1 \jobname.toc - \ifeof 1\else\bgroup - \closein 1 - \def\code##1{##1} - \def\file##1{##1} - \def\TeX##1{TeX} - \def\tt{} - \def\char{char} - \def\samp##1{##1} - \def\kbd##1{##1} - \def\key##1{##1} - \def\rawbackslashxx{\string\\} - \def\chapentry ##1##2##3{} - \def\unnumbchapentry ##1##2{} - \def\secentry ##1##2##3##4{\advancenumber{chap##2}} - \def\unnumbsecentry ##1##2{} - \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}} - \def\unnumbsubsecentry ##1##2{} - \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}} - \def\unnumbsubsubsecentry ##1##2{} - \input \jobname.toc - \def\chapentry ##1##2##3{% - \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}} - \def\unnumbchapentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \def\secentry ##1##2##3##4{% - \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}} - \def\unnumbsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \def\subsecentry ##1##2##3##4##5{% - \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}} - \def\unnumbsubsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \def\subsubsecentry ##1##2##3##4##5##6{% - \pdfoutline goto name{\pdfmkpgn{##6}}{##1}} - \def\unnumbsubsubsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \input \jobname.toc - \egroup\fi -}} -\pdfmakeoutlines - -\def\makelinks #1,{% - \def\params{#1}\def\E{END}% - \ifx\params\E - \let\nextmakelinks=\relax +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as being undefined. +\ifx\pdfoutput\thisisundefined +\else + \ifx\pdfoutput\relax \else - \let\nextmakelinks=\makelinks - \ifnum\lnkcount>0,\fi - \picknum{#1}% - \Blue\pdfannotlink attr{/Border [0 0 0]} - goto name{\pdfmkpgn{\the\pgn}}% - #1% - \advance\lnkcount by 1% - \Black\pdfendlink + \ifcase\pdfoutput + \else + \pdftrue + \fi \fi - \nextmakelinks -} +\fi -\def\picknum#1{\expandafter\pn#1} -\def\pn#1{% - \def\p{#1}% - \ifx\p\lbrace - \let\nextpn=\ppn +% PDF uses PostScript string constants for the names of xref targets, +% for display in the outlines, and in other places. Thus, we have to +% double any backslashes. Otherwise, a name like "\node" will be +% interpreted as a newline (\n), followed by o, d, e. Not good. +% +% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and +% related messages. The final outcome is that it is up to the TeX user +% to double the backslashes and otherwise make the string valid, so +% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to +% do this reliably, so we use it. + +% #1 is a control sequence in which to do the replacements, +% which we \xdef. +\def\txiescapepdf#1{% + \ifx\pdfescapestring\thisisundefined + % No primitive available; should we give a warning or log? + % Many times it won't matter. \else - \let\nextpn=\ppnn - \def\first{#1} + % The expandable \pdfescapestring primitive escapes parentheses, + % backslashes, and other special chars. + \xdef#1{\pdfescapestring{#1}}% \fi - \nextpn } -\def\ppn#1{\pgn=#1\gobble} -\def\ppnn{\pgn=\first} -\def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} -\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} -\def\skipspaces#1{\def\PP{#1}\def\D{|}% - \ifx\PP\D\let\nextsp\relax - \else\let\nextsp\skipspaces - \ifx\p\space\else\addtokens{\filename}{\PP}% +\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images +with PDF output, and none of those formats could be found. (.eps cannot +be supported due to the design of the PDF format; use regular TeX (DVI +output) for that.)} + +\ifpdf + % + % Color manipulation macros based on pdfcolor.tex, + % except using rgb instead of cmyk; the latter is said to render as a + % very dark gray on-screen and a very dark halftone in print, instead + % of actual black. + \def\rgbDarkRed{0.50 0.09 0.12} + \def\rgbBlack{0 0 0} + % + % k sets the color for filling (usual text, etc.); + % K sets the color for stroking (thin rules, e.g., normal _'s). + \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} + % + % Set color, and create a mark which defines \thiscolor accordingly, + % so that \makeheadline knows which color to restore. + \def\setcolor#1{% + \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \domark + \pdfsetcolor{#1}% + } + % + \def\maincolor{\rgbBlack} + \pdfsetcolor{\maincolor} + \edef\thiscolor{\maincolor} + \def\lastcolordefs{} + % + \def\makefootline{% + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}% + } + % + \def\makeheadline{% + \vbox to 0pt{% + \vskip-22.5pt + \line{% + \vbox to8.5pt{}% + % Extract \thiscolor definition from the marks. + \getcolormarks + % Typeset the headline with \maincolor, then restore the color. + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% + }% + \vss + }% + \nointerlineskip + } + % + % + \pdfcatalog{/PageMode /UseOutlines} + % + % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). + \def\dopdfimage#1#2#3{% + \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% + \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% + % + % pdftex (and the PDF format) support .pdf, .png, .jpg (among + % others). Let's try in that order, PDF first since if + % someone has a scalable image, presumably better to use that than a + % bitmap. + \let\pdfimgext=\empty + \begingroup + \openin 1 #1.pdf \ifeof 1 + \openin 1 #1.PDF \ifeof 1 + \openin 1 #1.png \ifeof 1 + \openin 1 #1.jpg \ifeof 1 + \openin 1 #1.jpeg \ifeof 1 + \openin 1 #1.JPG \ifeof 1 + \errhelp = \nopdfimagehelp + \errmessage{Could not find image file #1 for pdf}% + \else \gdef\pdfimgext{JPG}% + \fi + \else \gdef\pdfimgext{jpeg}% + \fi + \else \gdef\pdfimgext{jpg}% + \fi + \else \gdef\pdfimgext{png}% + \fi + \else \gdef\pdfimgext{PDF}% + \fi + \else \gdef\pdfimgext{pdf}% + \fi + \closein 1 + \endgroup + % + % without \immediate, ancient pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) + \ifnum\pdftexversion < 14 + \immediate\pdfimage + \else + \immediate\pdfximage + \fi + \ifdim \wd0 >0pt width \pdfimagewidth \fi + \ifdim \wd2 >0pt height \pdfimageheight \fi + \ifnum\pdftexversion<13 + #1.\pdfimgext + \else + {#1.\pdfimgext}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + % + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code, and characters + % such as \, aren't expanded when present in a section title. + \indexnofonts + \turnoffactive + \makevalueexpandable + \def\pdfdestname{#1}% + \txiescapepdf\pdfdestname + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + }} + % + % used to mark target names; must be expandable. + \def\pdfmkpgn#1{#1} + % + % by default, use a color that is dark enough to print on paper as + % nearly black, but still distinguishable for online viewing. + \def\urlcolor{\rgbDarkRed} + \def\linkcolor{\rgbDarkRed} + \def\endlink{\setcolor{\maincolor}\pdfendlink} + % + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by 1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + % + % #1 is the section text, which is what will be displayed in the + % outline by the pdf viewer. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node text, + % which might be empty if this toc entry had no corresponding node. + % #4 is the page number + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worth the trouble, since most documents are normally structured. + \edef\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty + \def\pdfoutlinedest{#4}% + \else + \txiescapepdf\pdfoutlinedest + \fi + % + % Also escape PDF chars in the display string. + \edef\pdfoutlinetext{#1}% + \txiescapepdf\pdfoutlinetext + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% + } + % + \def\pdfmakeoutlines{% + \begingroup + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\partentry##1##2##3##4{}% ignore parts in the outlines + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \def\thissubsecnum{0}% + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \def\thischapnum{0}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + % + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \readdatafile{toc}% + % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % TODO this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Too + % much work for too little return. Just use the ASCII equivalents + % we use for the index sort strings. + % + \indexnofonts + \setupdatafile + % We can have normal brace characters in the PDF outlines, unlike + % Texinfo index files. So set that up. + \def\{{\lbracecharliteral}% + \def\}{\rbracecharliteral}% + \catcode`\\=\active \otherbackslash + \input \tocreadfilename + \endgroup + } + {\catcode`[=1 \catcode`]=2 + \catcode`{=\other \catcode`}=\other + \gdef\lbracecharliteral[{]% + \gdef\rbracecharliteral[}]% + ] + % + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \addtokens{\filename}{\PP}% \advance\filenamelength by 1 \fi + \nextsp} + \def\getfilename#1{% + \filenamelength=0 + % If we don't expand the argument now, \skipspaces will get + % snagged on things like "@value{foo}". + \edef\temp{#1}% + \expandafter\skipspaces\temp|\relax + } + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink \fi - \nextsp} -\def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + % make a live url in pdf output. + \def\pdfurl#1{% + \begingroup + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty + \makevalueexpandable + % do we want to go so far as to use \indexnofonts instead of just + % special-casing \var here? + \def\var##1{##1}% + % + \leavevmode\setcolor{\urlcolor}% + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \setcolor{\linkcolor}#1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\else + % non-pdf mode + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\setcolor = \gobble + \let\pdfsetcolor = \gobble + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput -\def\pdflink#1{% - \leavevmode\Red - \begingroup - \normalturnoffactive\def\@{@}% - \pdfannotlink - attr{/Border [0 0 0]}% - user{/Subtype /Link /A << /S /URI /URI (#1) >>}% - \endgroup + +\message{fonts,} + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font } -\else -\let\pdflink = \gobble -\fi % end \ifpdf +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} -\message{fonts,} -% Font-change commands. +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Unfortunately, we have to override this for titles and the like, since +% in those cases "rm" is bold. Sigh. +\def\rmisbold{\rm\def\curfontstyle{bf}} % Texinfo sort of supports the sans serif font style, which plain TeX does not. -% So we set up a \sf analogous to plain's \rm, etc. +% So we set up a \sf. \newfam\sffam -\def\sf{\fam=\sffam \tensf} +\def\sf{\fam=\sffam \setfontstyle{sf}} \let\li = \sf % Sometimes we call it \li, not \sf. -% We don't need math for this one. -\def\ttsl{\tenttsl} +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} -% Use Computer Modern fonts at \magstephalf (11pt). -\newcount\mainmagstep -\mainmagstep=\magstephalf -% Set the font macro #1 to the font named #2, adding on the -% specified font prefix (normally `cm'). -% #3 is the font's design size, #4 is a scale factor -\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +% can get a sort of poor man's double spacing by redefining this. +\def\baselinefactor{1} +% +\newdimen\textleading +\def\setleading#1{% + \dimen0 = #1\relax + \normalbaselineskip = \baselinefactor\dimen0 + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} + +% PDF CMaps. See also LaTeX's t1.cmap. +% +% do nothing with this by default. +\expandafter\let\csname cmapOT1\endcsname\gobble +\expandafter\let\csname cmapOT1IT\endcsname\gobble +\expandafter\let\csname cmapOT1TT\endcsname\gobble + +% if we are producing pdf, and we have \pdffontattr, then define cmaps. +% (\pdffontattr was introduced many years ago, but people still run +% older pdftex's; it's easy to conditionalize, so we do.) +\ifpdf \ifx\pdffontattr\thisisundefined \else + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1-0) +%%Title: (TeX-OT1-0 TeX OT1 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1) +/Supplement 0 +>> def +/CMapName /TeX-OT1-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<23> <26> <0023> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +40 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1IT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1IT-0) +%%Title: (TeX-OT1IT-0 TeX OT1IT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1IT) +/Supplement 0 +>> def +/CMapName /TeX-OT1IT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<25> <26> <0025> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +42 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<23> <0023> +<24> <00A3> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1IT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1TT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1TT-0) +%%Title: (TeX-OT1TT-0 TeX OT1TT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1TT) +/Supplement 0 +>> def +/CMapName /TeX-OT1TT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +5 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<21> <26> <0021> +<28> <5F> <0028> +<61> <7E> <0061> +endbfrange +32 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <2191> +<0C> <2193> +<0D> <0027> +<0E> <00A1> +<0F> <00BF> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<20> <2423> +<27> <2019> +<60> <2018> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1TT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +\fi\fi + + +% Set the font macro #1 to the font named \fontprefix#2. +% #3 is the font's design size, #4 is a scale factor, #5 is the CMap +% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit). +% Example: +% #1 = \textrm +% #2 = \rmshape +% #3 = 10 +% #4 = \mainmagstep +% #5 = OT1 +% +\def\setfont#1#2#3#4#5{% + \font#1=\fontprefix#2#3 scaled #4 + \csname cmap#5\endcsname#1% +} +% This is what gets called when #5 of \setfont is empty. +\let\cmap\gobble +% +% (end of cmaps) % Use cm as the default font prefix. % To specify the font prefix, you must define \fontprefix % before you read in texinfo.tex. -\ifx\fontprefix\undefined +\ifx\fontprefix\thisisundefined \def\fontprefix{cm} \fi % Support font families that don't use the same naming scheme as CM. \def\rmshape{r} -\def\rmbshape{bx} %where the normal face is bold +\def\rmbshape{bx} % where the normal face is bold \def\bfshape{b} \def\bxshape{bx} \def\ttshape{tt} @@ -1014,201 +1801,618 @@ where each line of input produces a line of output.} \def\scshape{csc} \def\scbshape{csc} -\ifx\bigger\relax -\let\mainmagstep=\magstep1 -\setfont\textrm\rmshape{12}{1000} -\setfont\texttt\ttshape{12}{1000} -\else -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} -\fi -% Instead of cmb10, you many want to use cmbx10. -% cmbx10 is a prettier font on its own, but cmb10 -% looks better when embedded in a line with cmr10. -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} +% Definitions for a main text size of 11pt. (The default in Texinfo.) +% +\def\definetextfontsizexi{% +% Text fonts (11.2pt, magstep1). +\def\textnominalsize{11pt} +\edef\mainmagstep{\magstephalf} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep - -% A few fonts for @defun, etc. -\setfont\defbf\bxshape{10}{\magstep1} %was 1314 -\setfont\deftt\ttshape{10}{\magstep1} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} - -% Fonts for indices and small examples (9pt). -% We actually use the slanted font rather than the italic, -% because texinfo normally uses the slanted fonts for that. -% Do not make many font distinctions in general in the index, since they -% aren't very useful. -\setfont\ninett\ttshape{9}{1000} -\setfont\ninettsl\ttslshape{10}{900} -\setfont\indrm\rmshape{9}{1000} -\setfont\indit\itshape{9}{1000} -\setfont\indsl\slshape{9}{1000} -\let\indtt=\ninett -\let\indttsl=\ninettsl -\let\indsf=\indrm -\let\indbf=\indrm -\setfont\indsc\scshape{10}{900} -\font\indi=cmmi9 -\font\indsy=cmsy9 - -% Fonts for title page: -\setfont\titlerm\rmbshape{12}{\magstep3} -\setfont\titleit\itbshape{10}{\magstep4} -\setfont\titlesl\slbshape{10}{\magstep4} -\setfont\titlett\ttbshape{12}{\magstep3} -\setfont\titlettsl\ttslshape{10}{\magstep4} -\setfont\titlesf\sfbshape{17}{\magstep1} +\def\textecsize{1095} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1}{OT1} +\setfont\deftt\ttshape{10}{\magstep1}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm -\setfont\titlesc\scbshape{10}{\magstep4} +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 -\def\authorrm{\secrm} +\def\titleecsize{2074} % Chapter (and unnumbered) fonts (17.28pt). -\setfont\chaprm\rmbshape{12}{\magstep2} -\setfont\chapit\itbshape{10}{\magstep3} -\setfont\chapsl\slbshape{10}{\magstep3} -\setfont\chaptt\ttbshape{12}{\magstep2} -\setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{17}{1000} +\def\chapnominalsize{17pt} +\setfont\chaprm\rmbshape{12}{\magstep2}{OT1} +\setfont\chapit\itbshape{10}{\magstep3}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep3}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} +\setfont\chapsf\sfbshape{17}{1000}{OT1} \let\chapbf=\chaprm -\setfont\chapsc\scbshape{10}{\magstep3} +\setfont\chapsc\scbshape{10}{\magstep3}{OT1} \font\chapi=cmmi12 scaled \magstep2 \font\chapsy=cmsy10 scaled \magstep3 +\def\chapecsize{1728} % Section fonts (14.4pt). -\setfont\secrm\rmbshape{12}{\magstep1} -\setfont\secit\itbshape{10}{\magstep2} -\setfont\secsl\slbshape{10}{\magstep2} -\setfont\sectt\ttbshape{12}{\magstep1} -\setfont\secttsl\ttslshape{10}{\magstep2} -\setfont\secsf\sfbshape{12}{\magstep1} +\def\secnominalsize{14pt} +\setfont\secrm\rmbshape{12}{\magstep1}{OT1} +\setfont\secit\itbshape{10}{\magstep2}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep2}{OT1} +\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\secsf\sfbshape{12}{\magstep1}{OT1} \let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep2} +\setfont\secsc\scbshape{10}{\magstep2}{OT1} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 - -% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad. -% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded. -% \setfont\ssecsl\slshape{10}{\magstep1} -% \setfont\ssectt\ttshape{10}{\magstep1} -% \setfont\ssecsf\sfshape{10}{\magstep1} - -%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx. -%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than -%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1. -%\setfont\ssectt\ttshape{10}{1315} -%\setfont\ssecsf\sfshape{10}{1315} - -%\let\ssecbf=\ssecrm +\def\sececsize{1440} % Subsection fonts (13.15pt). -\setfont\ssecrm\rmbshape{12}{\magstephalf} -\setfont\ssecit\itbshape{10}{1315} -\setfont\ssecsl\slbshape{10}{1315} -\setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{1315} -\setfont\ssecsf\sfbshape{12}{\magstephalf} +\def\ssecnominalsize{13pt} +\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} +\setfont\ssecit\itbshape{10}{1315}{OT1IT} +\setfont\ssecsl\slbshape{10}{1315}{OT1} +\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} +\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} \let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{\magstep1} +\setfont\ssecsc\scbshape{10}{1315}{OT1} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 -% The smallcaps and symbol fonts should actually be scaled \magstep1.5, -% but that is not a standard magnification. +\def\ssececsize{1200} + +% Reduced fonts for @acro in text (10pt). +\def\reducednominalsize{10pt} +\setfont\reducedrm\rmshape{10}{1000}{OT1} +\setfont\reducedtt\ttshape{10}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{1000}{OT1} +\setfont\reducedit\itshape{10}{1000}{OT1IT} +\setfont\reducedsl\slshape{10}{1000}{OT1} +\setfont\reducedsf\sfshape{10}{1000}{OT1} +\setfont\reducedsc\scshape{10}{1000}{OT1} +\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 +\def\reducedecsize{1000} + +\textleading = 13.2pt % line spacing for 11pt CM +\textfonts % reset the current fonts +\rm +} % end of 11pt text font size definitions, \definetextfontsizexi + + +% Definitions to make the main text be 10pt Computer Modern, with +% section, chapter, etc., sizes following suit. This is for the GNU +% Press printing of the Emacs 22 manual. Maybe other manuals in the +% future. Used with @smallbook, which sets the leading to 12pt. +% +\def\definetextfontsizex{% +% Text fonts (10pt). +\def\textnominalsize{10pt} +\edef\mainmagstep{1000} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1000} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstephalf}{OT1} +\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\titleecsize{2074} + +% Chapter fonts (14.4pt). +\def\chapnominalsize{14pt} +\setfont\chaprm\rmbshape{12}{\magstep1}{OT1} +\setfont\chapit\itbshape{10}{\magstep2}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep2}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\chapsf\sfbshape{12}{\magstep1}{OT1} +\let\chapbf\chaprm +\setfont\chapsc\scbshape{10}{\magstep2}{OT1} +\font\chapi=cmmi12 scaled \magstep1 +\font\chapsy=cmsy10 scaled \magstep2 +\def\chapecsize{1440} + +% Section fonts (12pt). +\def\secnominalsize{12pt} +\setfont\secrm\rmbshape{12}{1000}{OT1} +\setfont\secit\itbshape{10}{\magstep1}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep1}{OT1} +\setfont\sectt\ttbshape{12}{1000}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} +\setfont\secsf\sfbshape{12}{1000}{OT1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep1}{OT1} +\font\seci=cmmi12 +\font\secsy=cmsy10 scaled \magstep1 +\def\sececsize{1200} + +% Subsection fonts (10pt). +\def\ssecnominalsize{10pt} +\setfont\ssecrm\rmbshape{10}{1000}{OT1} +\setfont\ssecit\itbshape{10}{1000}{OT1IT} +\setfont\ssecsl\slbshape{10}{1000}{OT1} +\setfont\ssectt\ttbshape{10}{1000}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} +\setfont\ssecsf\sfbshape{10}{1000}{OT1} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1000}{OT1} +\font\sseci=cmmi10 +\font\ssecsy=cmsy10 +\def\ssececsize{1000} + +% Reduced fonts for @acro in text (9pt). +\def\reducednominalsize{9pt} +\setfont\reducedrm\rmshape{9}{1000}{OT1} +\setfont\reducedtt\ttshape{9}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{900}{OT1} +\setfont\reducedit\itshape{9}{1000}{OT1IT} +\setfont\reducedsl\slshape{9}{1000}{OT1} +\setfont\reducedsf\sfshape{9}{1000}{OT1} +\setfont\reducedsc\scshape{10}{900}{OT1} +\setfont\reducedttsl\ttslshape{10}{900}{OT1TT} +\font\reducedi=cmmi9 +\font\reducedsy=cmsy9 +\def\reducedecsize{0900} + +\divide\parskip by 2 % reduce space between paragraphs +\textleading = 12pt % line spacing for 10pt CM +\textfonts % reset the current fonts +\rm +} % end of 10pt text font size definitions, \definetextfontsizex + + +% We provide the user-level command +% @fonttextsize 10 +% (or 11) to redefine the text font size. pt is assumed. +% +\def\xiword{11} +\def\xword{10} +\def\xwordpt{10pt} +% +\parseargdef\fonttextsize{% + \def\textsizearg{#1}% + %\wlog{doing @fonttextsize \textsizearg}% + % + % Set \globaldefs so that documents can use this inside @tex, since + % makeinfo 4.8 does not support it, but we need it nonetheless. + % + \begingroup \globaldefs=1 + \ifx\textsizearg\xword \definetextfontsizex + \else \ifx\textsizearg\xiword \definetextfontsizexi + \else + \errhelp=\EMsimple + \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} + \fi\fi + \endgroup +} + % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since -% texinfo doesn't allow for producing subscripts and superscripts, we -% don't bother to reset \scriptfont and \scriptscriptfont (which would -% also require loading a lot more fonts). +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). % \def\resetmathfonts{% - \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy - \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf - \textfont\ttfam = \tentt \textfont\sffam = \tensf + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf } - % The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this so that font changes will continue to work -% in math mode, where it is the current \fam that is relevant in most -% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam -% \tenbf}, for example. By redefining \tenbf, we obviate the need to -% redefine \bf itself. +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% \def\textfonts{% \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc - \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl - \resetmathfonts} + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\curfontsize{text}% + \def\lsize{reduced}\def\lllsize{smaller}% + \resetmathfonts \setleading{\textleading}} \def\titlefonts{% \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy \let\tenttsl=\titlettsl - \resetmathfonts \setleading{25pt}} -\def\titlefont#1{{\titlefonts\rm #1}} + \def\curfontsize{title}% + \def\lsize{chap}\def\lllsize{subsec}% + \resetmathfonts \setleading{27pt}} +\def\titlefont#1{{\titlefonts\rmisbold #1}} \def\chapfonts{% \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc - \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy + \let\tenttsl=\chapttsl + \def\curfontsize{chap}% + \def\lsize{sec}\def\lllsize{text}% \resetmathfonts \setleading{19pt}} \def\secfonts{% \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc - \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\curfontsize{sec}% + \def\lsize{subsec}\def\lllsize{reduced}% \resetmathfonts \setleading{16pt}} \def\subsecfonts{% \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc - \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\curfontsize{ssec}% + \def\lsize{text}\def\lllsize{small}% \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? -\def\indexfonts{% - \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl - \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc - \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl - \resetmathfonts \setleading{12pt}} +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\curfontsize{reduced}% + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \def\curfontsize{small}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \def\curfontsize{smaller}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{9.5pt}} -% Set up the default fonts, so we can use them for creating boxes. -% -\textfonts +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000}{OT1} +\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000}{OT1} +\setfont\shortconttt\ttshape{12}{1000}{OT1TT} -% Define these so they can be easily changed for other fonts. +% Define these just so they can be easily changed for other fonts. \def\angleleft{$\langle$} \def\angleright{$\rangle$} +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \scriptfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% --karl, 24jan03. + +% Set up the default fonts, so we can use them for creating boxes. +% +\definetextfontsizexi + + +\message{markup,} + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will +% define and register \INITMACRO to be called on markup style changes. +% \INITMACRO can check \currentmarkupstyle for the innermost +% style and the set of \ifmarkupSTYLE switches for all styles +% currently in effect. +\newif\ifmarkupvar +\newif\ifmarkupsamp +\newif\ifmarkupkey +%\newif\ifmarkupfile % @file == @samp. +%\newif\ifmarkupoption % @option == @samp. +\newif\ifmarkupcode +\newif\ifmarkupkbd +%\newif\ifmarkupenv % @env == @code. +%\newif\ifmarkupcommand % @command == @code. +\newif\ifmarkuptex % @tex (and part of @math, for now). +\newif\ifmarkupexample +\newif\ifmarkupverb +\newif\ifmarkupverbatim + +\let\currentmarkupstyle\empty + +\def\setupmarkupstyle#1{% + \csname markup#1true\endcsname + \def\currentmarkupstyle{#1}% + \markupstylesetup +} + +\let\markupstylesetup\empty + +\def\defmarkupstylesetup#1{% + \expandafter\def\expandafter\markupstylesetup + \expandafter{\markupstylesetup #1}% + \def#1% +} + +% Markup style setup for left and right quotes. +\defmarkupstylesetup\markupsetuplq{% + \expandafter\let\expandafter \temp + \csname markupsetuplq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuplqdefault \else \temp \fi +} + +\defmarkupstylesetup\markupsetuprq{% + \expandafter\let\expandafter \temp + \csname markupsetuprq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuprqdefault \else \temp \fi +} + +{ +\catcode`\'=\active +\catcode`\`=\active + +\gdef\markupsetuplqdefault{\let`\lq} +\gdef\markupsetuprqdefault{\let'\rq} + +\gdef\markupsetcodequoteleft{\let`\codequoteleft} +\gdef\markupsetcodequoteright{\let'\codequoteright} +} + +\let\markupsetuplqcode \markupsetcodequoteleft +\let\markupsetuprqcode \markupsetcodequoteright +% +\let\markupsetuplqexample \markupsetcodequoteleft +\let\markupsetuprqexample \markupsetcodequoteright +% +\let\markupsetuplqkbd \markupsetcodequoteleft +\let\markupsetuprqkbd \markupsetcodequoteright +% +\let\markupsetuplqsamp \markupsetcodequoteleft +\let\markupsetuprqsamp \markupsetcodequoteright +% +\let\markupsetuplqverb \markupsetcodequoteleft +\let\markupsetuprqverb \markupsetcodequoteright +% +\let\markupsetuplqverbatim \markupsetcodequoteleft +\let\markupsetuprqverbatim \markupsetcodequoteright + +% Allow an option to not use regular directed right quote/apostrophe +% (char 0x27), but instead the undirected quote from cmtt (char 0x0d). +% The undirected quote is ugly, so don't make it the default, but it +% works for pasting with more pdf viewers (at least evince), the +% lilypond developers report. xpdf does work with the regular 0x27. +% +\def\codequoteright{% + \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else \char'15 \fi + \else \char'15 \fi +} +% +% and a similar option for the left quote char vs. a grave accent. +% Modern fonts display ASCII 0x60 as a grave accent, so some people like +% the code environments to do likewise. +% +\def\codequoteleft{% + \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax + \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax + % [Knuth] pp. 380,381,391 + % \relax disables Spanish ligatures ?` and !` of \tt font. + \relax`% + \else \char'22 \fi + \else \char'22 \fi +} + +% Commands to set the quote options. +% +\parseargdef\codequoteundirected{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% + \fi\fi +} +% +\parseargdef\codequotebacktick{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% + \fi\fi +} + +% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. +\def\noligaturesquoteleft{\relax\lq} + % Count depth in font-changes, for error checks \newcount\fontdepth \fontdepth=0 -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bxshape{12}{1000} -\setfont\shortcontsl\slshape{12}{1000} +% Font commands. + +% #1 is the font command (\sl or \it), #2 is the text to slant. +% If we are in a monospaced environment, however, 1) always use \ttsl, +% and 2) do not add an italic correction. +\def\dosmartslant#1#2{% + \ifusingtt + {{\ttsl #2}\let\next=\relax}% + {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% + \next +} +\def\smartslanted{\dosmartslant\sl} +\def\smartitalic{\dosmartslant\it} + +% Output an italic correction unless \next (presumed to be the following +% character) is such as not to need one. +\def\smartitaliccorrection{% + \ifx\next,% + \else\ifx\next-% + \else\ifx\next.% + \else\ptexslash + \fi\fi\fi + \aftersmartic +} -%% Add scribe-like font environments, plus @l for inline lisp (usually sans -%% serif) and @ii for TeX italic +% Unconditional use \ttsl, and no ic. @var is set to this for defuns. +\def\ttslanted#1{{\ttsl #1}} -% \smartitalic{ARG} outputs arg in italics, followed by an italic correction -% unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} -\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx} +% @cite is like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} + +\def\aftersmartic{} +\def\var#1{% + \let\saveaftersmartic = \aftersmartic + \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% + \smartslanted{#1}% +} \let\i=\smartitalic -\let\var=\smartslanted +\let\slanted=\smartslanted \let\dfn=\smartslanted \let\emph=\smartitalic -\let\cite=\smartslanted +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @b, explicit bold. Also @strong. \def\b#1{{\bf #1}} \let\strong=\b +% @sansserif, explicit sans. +\def\sansserif#1{{\sf #1}} + % We can't just use \exhyphenpenalty, because that only has effect at % the end of a paragraph. Restore normal hyphenation at the end of the % group within which \nohyphenation is presumably called. @@ -1216,30 +2420,39 @@ where each line of input produces a line of output.} \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} \def\restorehyphenation{\hyphenchar\font = `- } +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\plainfrenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + \def\endofsentencespacefactor{1000}% for @. and friends + } + \def\plainnonfrenchspacing{% + \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 + \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 + \def\endofsentencespacefactor{3000}% for @. and friends + } +\catcode`@=\other +\def\endofsentencespacefactor{3000}% default + +% @t, explicit typewriter. \def\t#1{% - {\tt \rawbackslash \frenchspacing #1}% + {\tt \rawbackslash \plainfrenchspacing #1}% \null } -\let\ttfont=\t -\def\samp#1{`\tclose{#1}'\null} -\setfont\smallrm\rmshape{8}{1000} -\font\smallsy=cmsy9 -\def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{% - \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% - \vbox{\hrule\kern-0.4pt - \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% - \kern-0.4pt\hrule}% - \kern-.06em\raise0.4pt\hbox{\angleright}}}} -% The old definition, with no lozenge: -%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} -\def\ctrl #1{{\tt \rawbackslash \hat}#1} -% @file, @option are the same as @samp. -\let\file=\samp -\let\option=\samp +% @samp. +\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} -% @code is a modification of @t, -% which makes spaces the same size as normal in the surrounding text. +% @indicateurl is \samp, that is, with quotes. +\let\indicateurl=\samp + +% @code (and similar) prints in typewriter, but with spaces the same +% size as normal in the surrounding text, without hyphenation, etc. +% This is a subroutine for that. \def\tclose#1{% {% % Change normal interword space to be same as for the current font. @@ -1255,88 +2468,96 @@ where each line of input produces a line of output.} \nohyphenation % \rawbackslash - \frenchspacing + \plainfrenchspacing #1% }% - \null + \null % reset spacefactor to 1000 } -% We *must* turn on hyphenation at `-' and `_' in \code. +% We *must* turn on hyphenation at `-' and `_' in @code. % Otherwise, it is too hard to avoid overfull hboxes % in the Emacs manual, the Library manual, etc. - +% % Unfortunately, TeX uses one parameter (\hyphenchar) to control % both hyphenation at - and hyphenation within words. % We must therefore turn them both off (\tclose does that) % and arrange explicitly to hyphenate at a dash. % -- rms. { - \catcode`\-=\active - \catcode`\_=\active + \catcode`\-=\active \catcode`\_=\active + \catcode`\'=\active \catcode`\`=\active + \global\let'=\rq \global\let`=\lq % default definitions % \global\def\code{\begingroup - \catcode`\-=\active \let-\codedash - \catcode`\_=\active \let_\codeunder + \setupmarkupstyle{code}% + % The following should really be moved into \setupmarkupstyle handlers. + \catcode\dashChar=\active \catcode\underChar=\active + \ifallowcodebreaks + \let-\codedash + \let_\codeunder + \else + \let-\normaldash + \let_\realunder + \fi \codex } - % - % If we end up with any active - characters when handling the index, - % just treat them as a normal -. - \global\def\indexbreaks{\catcode`\-=\active \let-\realdash} } -\def\realdash{-} -\def\codedash{-\discretionary{}{}{}} -\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}} \def\codex #1{\tclose{#1}\endgroup} -%\let\exp=\tclose %Was temporary - -% @kbd is like @code, except that if the argument is just one @key command, -% then @kbd has no effect. - -% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), -% `example' (@kbd uses ttsl only inside of @example and friends), -% or `code' (@kbd uses normal tty font always). -\def\kbdinputstyle{\parsearg\kbdinputstylexxx} -\def\kbdinputstylexxx#1{% - \def\arg{#1}% - \ifx\arg\worddistinct - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% - \else\ifx\arg\wordexample - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% - \else\ifx\arg\wordcode - \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% - \fi\fi\fi +\def\normaldash{-} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} + +% An additional complication: the above will allow breaks after, e.g., +% each of the four underscores in __typeof__. This is bad. +% @allowcodebreaks provides a document-level way to turn breaking at - +% and _ on and off. +% +\newif\ifallowcodebreaks \allowcodebreakstrue + +\def\keywordtrue{true} +\def\keywordfalse{false} + +\parseargdef\allowcodebreaks{% + \def\txiarg{#1}% + \ifx\txiarg\keywordtrue + \allowcodebreakstrue + \else\ifx\txiarg\keywordfalse + \allowcodebreaksfalse + \else + \errhelp = \EMsimple + \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% + \fi\fi } -\def\worddistinct{distinct} -\def\wordexample{example} -\def\wordcode{code} -% Default is kbdinputdistinct. (Too much of a hassle to call the macro, -% the catcodes are wrong for parsearg to work.) -\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} - -\def\xkey{\key} -\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% -\ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\kbdfont\look}}\fi -\else{\tclose{\kbdfont\look}}\fi} - -% For @url, @env, @command quotes seem unnecessary, so use \code. -\let\url=\code -\let\env=\code +% For @command, @env, @file, @option quotes seem unnecessary, +% so use \code rather than \samp. \let\command=\code +\let\env=\code +\let\file=\code +\let\option=\code % @uref (abbreviation for `urlref') takes an optional (comma-separated) % second argument specifying the text to display and an optional third % arg as text to display instead of (rather than in addition to) the url -% itself. First (mandatory) arg is the url. Perhaps eventually put in -% a hypertex \special here. -% -\def\uref#1{\douref #1,,,\finish} -\def\douref#1,#2,#3,#4\finish{% - \pdflink{#1}% +% itself. First (mandatory) arg is the url. +% (This \urefnobreak definition isn't used now, leaving it for a while +% for comparison.) +\def\urefnobreak#1{\dourefnobreak #1,,,\finish} +\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that @@ -1352,58 +2573,623 @@ where each line of input produces a line of output.} \code{#1}% only url given, so show it \fi \fi - % - \ifpdf - \Black\pdfendlink + \endlink +\endgroup} + +% This \urefbreak definition is the active one. +\def\urefbreak{\begingroup \urefcatcodes \dourefbreak} +\let\uref=\urefbreak +\def\dourefbreak#1{\urefbreakfinish #1,,,\finish} +\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \urefcode{#1}% only url given, so show it + \fi \fi + \endlink +\endgroup} + +% Allow line breaks around only a few characters (only). +\def\urefcatcodes{% + \catcode\ampChar=\active \catcode\dotChar=\active + \catcode\hashChar=\active \catcode\questChar=\active + \catcode\slashChar=\active +} +{ + \urefcatcodes + % + \global\def\urefcode{\begingroup + \setupmarkupstyle{code}% + \urefcatcodes + \let&\urefcodeamp + \let.\urefcodedot + \let#\urefcodehash + \let?\urefcodequest + \let/\urefcodeslash + \codex + } + % + % By default, they are just regular characters. + \global\def&{\normalamp} + \global\def.{\normaldot} + \global\def#{\normalhash} + \global\def?{\normalquest} + \global\def/{\normalslash} +} + +% we put a little stretch before and after the breakable chars, to help +% line breaking of long url's. The unequal skips make look better in +% cmtt at least, especially for dots. +\def\urefprestretch{\urefprebreak \hskip0pt plus.13em } +\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } +% +\def\urefcodeamp{\urefprestretch \&\urefpoststretch} +\def\urefcodedot{\urefprestretch .\urefpoststretch} +\def\urefcodehash{\urefprestretch \#\urefpoststretch} +\def\urefcodequest{\urefprestretch ?\urefpoststretch} +\def\urefcodeslash{\futurelet\next\urefcodeslashfinish} +{ + \catcode`\/=\active + \global\def\urefcodeslashfinish{% + \urefprestretch \slashChar + % Allow line break only after the final / in a sequence of + % slashes, to avoid line break between the slashes in http://. + \ifx\next/\else \urefpoststretch \fi + } +} + +% One more complication: by default we'll break after the special +% characters, but some people like to break before the special chars, so +% allow that. Also allow no breaking at all, for manual control. +% +\parseargdef\urefbreakstyle{% + \def\txiarg{#1}% + \ifx\txiarg\wordnone + \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordbefore + \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordafter + \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak} + \else + \errhelp = \EMsimple + \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% + \fi\fi\fi } +\def\wordafter{after} +\def\wordbefore{before} +\def\wordnone{none} + +\urefbreakstyle after + +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref % rms does not like angle brackets --karl, 17may97. % So now @email is just like @uref, unless we are pdf. -% +% %\def\email#1{\angleleft{\tt #1}\angleright} \ifpdf \def\email#1{\doemail#1,,\finish} - \def\doemail#1,#2,#3\finish{% - \pdflink{mailto:#1}% + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi - \Black\pdfendlink - } + \endlink + \endgroup} \else \let\email=\uref \fi -% Check if we are currently using a typewriter font. Since all the -% Computer Modern typewriter fonts have zero interword stretch (and -% shrink), and it is reasonable to expect all typewriter fonts to have -% this property, we can check that font parameter. -% -\def\ifmonospace{\ifdim\fontdimen3\font=0pt } +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct'. +\kbdinputstyle distinct + +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. +\def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}} + +\def\xkey{\key} +\def\kbdsub#1#2#3\par{% + \def\one{#1}\def\three{#3}\def\threex{??}% + \ifx\one\xkey\ifx\threex\three \key{#2}% + \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi + \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi +} + +% definition of @key that produces a lozenge. Doesn't adjust to text size. +%\setfont\keyrm\rmshape{8}{1000}{OT1} +%\font\keysy=cmsy9 +%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% +% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% +% \vbox{\hrule\kern-0.4pt +% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% +% \kern-0.4pt\hrule}% +% \kern-.06em\raise0.4pt\hbox{\angleright}}}} + +% definition of @key with no lozenge. If the current font is already +% monospace, don't change it; that way, we respect @kbdinputstyle. But +% if it isn't monospace, then use \tt. +% +\def\key#1{{\setupmarkupstyle{key}% + \nohyphenation + \ifmonospace\else\tt\fi + #1}\null} + +% @clicksequence{File @click{} Open ...} +\def\clicksequence#1{\begingroup #1\endgroup} + +% @clickstyle @arrow (by default) +\parseargdef\clickstyle{\def\click{#1}} +\def\click{\arrow} % Typeset a dimension, e.g., `in' or `pt'. The only reason for the % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. % \def\dmn#1{\thinspace #1} -\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} - % @l was never documented to mean ``switch to the Lisp font'', % and it is not used as such in any manual I can find. We need it for % Polish suppressed-l. --karl, 22sep96. %\def\l#1{{\li #1}\null} -% Explicit font changes: @r, @sc, undocumented @ii. -\def\r#1{{\rm #1}} % roman font -\def\sc#1{{\smallcaps#1}} % smallcaps font -\def\ii#1{{\it #1}} % italic font +% @acronym for "FBI", "NATO", and the like. +% We print this one point size smaller, since it's intended for +% all-uppercase. +% +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi + \null % reset \spacefactor=1000 +} + +% @abbr for "Comput. J." and the like. +% No font change, but don't do end-of-sentence spacing. +% +\def\abbr#1{\doabbr #1,,\finish} +\def\doabbr#1,#2,#3\finish{% + {\plainfrenchspacing #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi + \null % reset \spacefactor=1000 +} + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode`\_ = \active + \gdef\mathunderscore{% + \catcode`\_=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a math (or tt) \. +% FYI, plain.tex uses \\ as a temporary control sequence (for no +% particular reason), but this is not advertised and we don't care. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + % make the texinfo accent commands work in math mode + \let\"=\ddot + \let\'=\acute + \let\==\bar + \let\^=\hat + \let\`=\grave + \let\u=\breve + \let\v=\check + \let\~=\tilde + \let\dotaccent=\dot + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \catcode`' = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + \let' = \ptexquoteright + } +} + +% ctrl is no longer a Texinfo command, but leave this definition for fun. +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + +% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. +% Ignore unless FMTNAME == tex; then it is like @iftex and @tex, +% except specified as a normal braced arg, so no newlines to worry about. +% +\def\outfmtnametex{tex} +% +\long\def\inlinefmt#1{\doinlinefmt #1,\finish} +\long\def\doinlinefmt#1,#2,\finish{% + \def\inlinefmtname{#1}% + \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi +} +% For raw, must switch into @tex before parsing the argument, to avoid +% setting catcodes prematurely. Doing it this way means that, for +% example, @inlineraw{html, foo{bar} gets a parse error instead of being +% ignored. But this isn't important because if people want a literal +% *right* brace they would have to use a command anyway, so they may as +% well use a command to get a left brace too. We could re-use the +% delimiter character idea from \verb, but it seems like overkill. +% +\long\def\inlineraw{\tex \doinlineraw} +\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} +\def\doinlinerawtwo#1,#2,\finish{% + \def\inlinerawname{#1}% + \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi + \endgroup % close group opened by \tex. +} + + +\message{glyphs,} +% and logos. + +% @@ prints an @, as does @atchar{}. +\def\@{\char64 } +\let\atchar=\@ + +% @{ @} @lbracechar{} @rbracechar{} all generate brace characters. +% Unless we're in typewriter, use \ecfont because the CM text fonts do +% not have braces, and we don't want to switch into math. +\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} +\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} +\let\{=\mylbrace \let\lbracechar=\{ +\let\}=\myrbrace \let\rbracechar=\} +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux/toc files. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup -% @acronym downcases the argument and prints in smallcaps. -\def\acronym#1{{\smallcaps \lowercase{#1}}} +% @comma{} to avoid , parsing problems. +\let\comma = , -% @pounds{} is a sterling sign. +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \ptexc +\let\dotaccent = \ptexdot +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \ptext +\let\ubaraccent = \ptexb +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi + \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{% + \ifx\textnominalsize\xwordpt + % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. + % Revert to plain's \scriptsize, which is 7pt. + \count255=\the\fam $\fam\count255 \scriptstyle A$% + \else + % For 11pt, we can use our lllsize. + \selectfonts\lllsize A% + \fi + }% + \vss + }}% + \kern-.15em + \TeX +} + +% Some math mode symbols. +\def\bullet{$\ptexbullet$} +\def\geq{\ifmmode \ge\else $\ge$\fi} +\def\leq{\ifmmode \le\else $\le$\fi} +\def\minus{\ifmmode -\else $-$\fi} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in the cm +% typewriter fonts as three actual period characters; on the other hand, +% in other typewriter fonts three periods are wider than 1.5em. So do +% whichever is larger. +% +\def\dots{% + \leavevmode + \setbox0=\hbox{...}% get width of three periods + \ifdim\wd0 > 1.5em + \dimen0 = \wd0 + \else + \dimen0 = 1.5em + \fi + \hbox to \dimen0{% + \hskip 0pt plus.25fil + .\hskip 0pt plus1fil + .\hskip 0pt plus1fil + .\hskip 0pt plus.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, they should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} +\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} + +% @pounds{} is a sterling sign, which Knuth put in the CM italic font. +% \def\pounds{{\it\$}} +% @euro{} comes from a separate font, depending on the current style. +% We use the free feym* fonts from the eurosym package by Henrik +% Theiling, which support regular, slanted, bold and bold slanted (and +% "outlined" (blackboard board, sort of) versions, which we don't need). +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% +% Although only regular is the truly official Euro symbol, we ignore +% that. The Euro is designed to be slightly taller than the regular +% font height. +% +% feymr - regular +% feymo - slanted +% feybr - bold +% feybo - bold slanted +% +% There is no good (free) typewriter version, to my knowledge. +% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. +% Hmm. +% +% Also doesn't work in math. Do we need to do math with euro symbols? +% Hope not. +% +% +\def\euro{{\eurofont e}} +\def\eurofont{% + % We set the font at each command, rather than predefining it in + % \textfonts and the other font-switching commands, so that + % installations which never need the symbol don't have to have the + % font installed. + % + % There is only one designed size (nominal 10pt), so we always scale + % that to the current nominal size. + % + % By the way, simply using "at 1em" works for cmr10 and the like, but + % does not work for cmbx10 and other extended/shrunken fonts. + % + \def\eurosize{\csname\curfontsize nominalsize\endcsname}% + % + \ifx\curfontstyle\bfstylename + % bold: + \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize + \else + % regular: + \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize + \fi + \thiseurofont +} + +% Glyphs from the EC fonts. We don't use \let for the aliases, because +% sometimes we redefine the original macro, and the alias should reflect +% the redefinition. +% +% Use LaTeX names for the Icelandic letters. +\def\DH{{\ecfont \char"D0}} % Eth +\def\dh{{\ecfont \char"F0}} % eth +\def\TH{{\ecfont \char"DE}} % Thorn +\def\th{{\ecfont \char"FE}} % thorn +% +\def\guillemetleft{{\ecfont \char"13}} +\def\guillemotleft{\guillemetleft} +\def\guillemetright{{\ecfont \char"14}} +\def\guillemotright{\guillemetright} +\def\guilsinglleft{{\ecfont \char"0E}} +\def\guilsinglright{{\ecfont \char"0F}} +\def\quotedblbase{{\ecfont \char"12}} +\def\quotesinglbase{{\ecfont \char"0D}} +% +% This positioning is not perfect (see the ogonek LaTeX package), but +% we have the precomposed glyphs for the most common cases. We put the +% tests to use those glyphs in the single \ogonek macro so we have fewer +% dummy definitions to worry about for index entries, etc. +% +% ogonek is also used with other letters in Lithuanian (IOU), but using +% the precomposed glyphs for those is not so easy since they aren't in +% the same EC font. +\def\ogonek#1{{% + \def\temp{#1}% + \ifx\temp\macrocharA\Aogonek + \else\ifx\temp\macrochara\aogonek + \else\ifx\temp\macrocharE\Eogonek + \else\ifx\temp\macrochare\eogonek + \else + \ecfont \setbox0=\hbox{#1}% + \ifdim\ht0=1ex\accent"0C #1% + \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% + \fi + \fi\fi\fi\fi + }% +} +\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} +\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} +\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} +\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} +% +% Use the ec* fonts (cm-super in outline format) for non-CM glyphs. +\def\ecfont{% + % We can't distinguish serif/sans and italic/slanted, but this + % is used for crude hacks anyway (like adding French and German + % quotes to documents typeset with CM, where we lose kerning), so + % hopefully nobody will notice/care. + \edef\ecsize{\csname\curfontsize ecsize\endcsname}% + \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% + \ifmonospace + % typewriter: + \font\thisecfont = ectt\ecsize \space at \nominalsize + \else + \ifx\curfontstyle\bfstylename + % bold: + \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize + \else + % regular: + \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \fi + \fi + \thisecfont +} + +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% + }$% +} + +% @textdegree - the normal degrees sign. +% +\def\textdegree{$^\circ$} + +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\thisisundefined +\def\Orb{\mathhexbox20D} +\fi + +% Quotes. +\chardef\quotedblleft="5C +\chardef\quotedblright=`\" +\chardef\quoteleft=`\` +\chardef\quoteright=`\' + \message{page headings,} @@ -1422,85 +3208,116 @@ where each line of input produces a line of output.} \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue -\def\shorttitlepage{\parsearg\shorttitlepagezzz} -\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% - \endgroup\page\hbox{}\page} +\parseargdef\shorttitlepage{% + \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} -\def\titlepage{\begingroup \parindent=0pt \textfonts - \let\subtitlerm=\tenrm - \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% - % - \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% - % - % Leave some space at the very top of the page. - \vglue\titlepagetopglue - % - % Now you can print the title using @title. - \def\title{\parsearg\titlezzz}% - \def\titlezzz##1{\leftline{\titlefonts\rm ##1} - % print a rule at the page bottom also. - \finishedtitlepagefalse - \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% - % No rule at page bottom unless we print one at the top with @title. - \finishedtitlepagetrue - % - % Now you can put text using @subtitle. - \def\subtitle{\parsearg\subtitlezzz}% - \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% - % - % @author should come last, but may come many times. - \def\author{\parsearg\authorzzz}% - \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi - {\authorfont \leftline{##1}}}% - % - % Most title ``pages'' are actually two pages long, with space - % at the top of the second. We don't want the ragged left on the second. - \let\oldpage = \page - \def\page{% +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% \iffinishedtitlepage\else - \finishtitlepage + \finishtitlepage \fi - \oldpage \let\page = \oldpage - \hbox{}}% -% \def\page{\oldpage \hbox{}} + \page + \null + }% } \def\Etitlepage{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - % It is important to do the page break before ending the group, - % because the headline and footline are only empty inside the group. - % If we use the new definition of \page, we always get a blank page - % after the title page, which we certainly don't want. - \oldpage - \endgroup - % - % If they want short, they certainly want long too. - \ifsetshortcontentsaftertitlepage - \shortcontents - \contents - \global\let\shortcontents = \relax - \global\let\contents = \relax - \fi - % - \ifsetcontentsaftertitlepage - \contents - \global\let\contents = \relax - \global\let\shortcontents = \relax - \fi - % - \HEADINGSon + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi } \def\finishtitlepage{% - \vskip4pt \hrule height 2pt width \hsize - \vskip\titlepagebottomglue - \finishedtitlepagetrue + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue +} + +% Settings used for typesetting titles: no hyphenation, no indentation, +% don't worry much about spacing, ragged right. This should be used +% inside a \vbox, and fonts need to be set appropriately first. Because +% it is always used for titles, nothing else, we call \rmisbold. \par +% should be specified before the end of the \vbox, since a vbox is a group. +% +\def\raggedtitlesettings{% + \rmisbold + \hyphenpenalty=10000 + \parindent=0pt + \tolerance=5000 + \ptexraggedright +} + +% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\parseargdef\title{% + \checkenv\titlepage + \vbox{\titlefonts \raggedtitlesettings #1\par}% + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% } -%%% Set up page headings and footings. +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\secfonts\rmisbold \leftline{#1}}% + \fi +} + + +% Set up page headings and footings. \let\thispage=\folio @@ -1509,7 +3326,7 @@ where each line of input produces a line of output.} \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages -% Now make Tex use those variables +% Now make TeX use those variables \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}} \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline @@ -1523,43 +3340,64 @@ where each line of input produces a line of output.} % @evenfooting @thisfile|| % @oddfooting ||@thisfile -\def\evenheading{\parsearg\evenheadingxxx} -\def\oddheading{\parsearg\oddheadingxxx} -\def\everyheading{\parsearg\everyheadingxxx} - -\def\evenfooting{\parsearg\evenfootingxxx} -\def\oddfooting{\parsearg\oddfootingxxx} -\def\everyfooting{\parsearg\everyfootingxxx} - -{\catcode`\@=0 % -\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} -\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% +\def\evenheading{\parsearg\evenheadingxxx} +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} -\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} -\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} -\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% -\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} -\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} -\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} -\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. - \global\advance\pageheight by -\baselineskip - \global\advance\vsize by -\baselineskip + \global\advance\pageheight by -12pt + \global\advance\vsize by -12pt } -\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + +% @evenheadingmarks top \thischapter <- chapter at the top of a page +% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page +% +% The same set of arguments for: % -}% unbind the catcode of @. +% @oddheadingmarks +% @evenfootingmarks +% @oddfootingmarks +% @everyheadingmarks +% @everyfootingmarks + +\def\evenheadingmarks{\headingmarks{even}{heading}} +\def\oddheadingmarks{\headingmarks{odd}{heading}} +\def\evenfootingmarks{\headingmarks{even}{footing}} +\def\oddfootingmarks{\headingmarks{odd}{footing}} +\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} + \headingmarks{odd}{heading}{#1} } +\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} + \headingmarks{odd}{footing}{#1} } +% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. +\def\headingmarks#1#2#3 {% + \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname + \global\expandafter\let\csname get#1#2marks\endcsname \temp +} + +\everyheadingmarks bottom +\everyfootingmarks bottom % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. @@ -1573,16 +3411,20 @@ where each line of input produces a line of output.} \def\headings #1 {\csname HEADINGS#1\endcsname} -\def\HEADINGSoff{ -\global\evenheadline={\hfil} \global\evenfootline={\hfil} -\global\oddheadline={\hfil} \global\oddfootline={\hfil}} -\HEADINGSoff +\def\headingsoff{% non-global headings elimination + \evenheadline={\hfil}\evenfootline={\hfil}% + \oddheadline={\hfil}\oddfootline={\hfil}% +} + +\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting +\HEADINGSoff % it's the default + % When we turn headings on, set the page number to 1. % For double-sided printing, put current file name in lower left corner, % chapter name on inside top of right hand pages, document % title on inside top of left hand pages, and page numbers on outside top % edge of all pages. -\def\HEADINGSdouble{ +\def\HEADINGSdouble{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} @@ -1594,7 +3436,7 @@ where each line of input produces a line of output.} % For single-sided printing, chapter title goes across top left of page, % page number on top right. -\def\HEADINGSsingle{ +\def\HEADINGSsingle{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} @@ -1624,7 +3466,10 @@ where each line of input produces a line of output.} } % Subroutines used in generating headings -% Produces Day Month Year style of output. +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\thisisundefined \def\today{% \number\day\space \ifcase\month @@ -1633,16 +3478,16 @@ where each line of input produces a line of output.} \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec \fi \space\number\year} +\fi % @settitle line... specifies the title of the document, for headings. % It generates no output of its own. \def\thistitle{\putwordNoTitle} -\def\settitle{\parsearg\settitlezzz} -\def\settitlezzz #1{\gdef\thistitle{#1}} +\def\settitle{\parsearg{\gdef\thistitle}} \message{tables,} -% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). +% Tables -- @table, @ftable, @vtable, @item(x). % default indentation of table text \newdimen\tableindent \tableindent=.8in @@ -1654,7 +3499,7 @@ where each line of input produces a line of output.} % used internally for \itemindent minus \itemmargin \newdimen\itemmax -% Note @table, @vtable, and @vtable define @item, @itemx, etc., with +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with % these defs. % They also define \itemindex % to index the item name in whatever manner is desired (perhaps none). @@ -1666,22 +3511,10 @@ where each line of input produces a line of output.} \def\internalBitem{\smallbreak \parsearg\itemzzz} \def\internalBitemx{\itemxpar \parsearg\itemzzz} -\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} -\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} - -\def\internalBkitem{\smallbreak \parsearg\kitemzzz} -\def\internalBkitemx{\itemxpar \parsearg\kitemzzz} - -\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% - \itemzzz {#1}} - -\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% - \itemzzz {#1}} - \def\itemzzz #1{\begingroup % \advance\hsize by -\rightskip \advance\hsize by -\tableindent - \setbox0=\hbox{\itemfont{#1}}% + \setbox0=\hbox{\itemindicate{#1}}% \itemindex{#1}% \nobreak % This prevents a break before @itemx. % @@ -1697,7 +3530,7 @@ where each line of input produces a line of output.} \begingroup \advance\leftskip by-\tableindent \advance\hsize by\tableindent - \advance\rightskip by0pt plus1fil + \advance\rightskip by0pt plus1fil\relax \leavevmode\unhbox0\par \endgroup % @@ -1705,10 +3538,14 @@ where each line of input produces a line of output.} % \parskip glue -- logically it's part of the @item we just started. \nobreak \vskip-\parskip % - % Stop a page break at the \parskip glue coming up. Unfortunately - % we can't prevent a possible page break at the following - % \baselineskip glue. - \nobreak + % Stop a page break at the \parskip glue coming up. However, if + % what follows is an environment such as @example, there will be no + % \parskip glue; then the negative vskip we just inserted would + % cause the example and the item to crash together. So we use this + % bizarre value of 10001 as a signal to \aboveenvbreak to insert + % \parskip glue after all. Section titles are handled this way also. + % + \penalty 10001 \endgroup \itemxneedsnegativevskipfalse \else @@ -1727,97 +3564,116 @@ where each line of input produces a line of output.} \fi } -\def\item{\errmessage{@item while not in a table}} -\def\itemx{\errmessage{@itemx while not in a table}} -\def\kitem{\errmessage{@kitem while not in a table}} -\def\kitemx{\errmessage{@kitemx while not in a table}} -\def\xitem{\errmessage{@xitem while not in a table}} -\def\xitemx{\errmessage{@xitemx while not in a table}} - -% Contains a kludge to get @end[description] to work. -\def\description{\tablez{\dontindex}{1}{}{}{}{}} +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} % @table, @ftable, @vtable. -\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} -{\obeylines\obeyspaces% -\gdef\tablex #1^^M{% -\tabley\dontindex#1 \endtabley}} - -\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} -{\obeylines\obeyspaces% -\gdef\ftablex #1^^M{% -\tabley\fnitemindex#1 \endtabley -\def\Eftable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} -{\obeylines\obeyspaces% -\gdef\vtablex #1^^M{% -\tabley\vritemindex#1 \endtabley -\def\Evtable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\dontindex #1{} -\def\fnitemindex #1{\doind {fn}{\code{#1}}}% -\def\vritemindex #1{\doind {vr}{\code{#1}}}% - -{\obeyspaces % -\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% -\tablez{#1}{#2}{#3}{#4}{#5}{#6}}} - -\def\tablez #1#2#3#4#5#6{% -\aboveenvbreak % -\begingroup % -\def\Edescription{\Etable}% Necessary kludge. -\let\itemindex=#1% -\ifnum 0#3>0 \advance \leftskip by #3\mil \fi % -\ifnum 0#4>0 \tableindent=#4\mil \fi % -\ifnum 0#5>0 \advance \rightskip by #5\mil \fi % -\def\itemfont{#2}% -\itemmax=\tableindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \tableindent % -\exdentamount=\tableindent -\parindent = 0pt -\parskip = \smallskipamount -\ifdim \parskip=0pt \parskip=2pt \fi% -\def\Etable{\endgraf\afterenvbreak\endgroup}% -\let\item = \internalBitem % -\let\itemx = \internalBitemx % -\let\kitem = \internalBkitem % -\let\kitemx = \internalBkitemx % -\let\xitem = \internalBxitem % -\let\xitemx = \internalBxitemx % +\envdef\table{% + \let\itemindex\gobble + \tablecheck{table}% +} +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablecheck{ftable}% +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablecheck{vtable}% +} +\def\tablecheck#1{% + \ifnum \the\catcode`\^^M=\active + \endgroup + \errmessage{This command won't work in this context; perhaps the problem is + that we are \inenvironment\thisenv}% + \def\next{\doignore{#1}}% + \else + \let\next\tablex + \fi + \next +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx } +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable % This is the counter used by @enumerate, which is really @itemize \newcount \itemno -\def\itemize{\parsearg\itemizezzz} +\envdef\itemize{\parsearg\doitemize} -\def\itemizezzz #1{% - \begingroup % ended by the @end itemize - \itemizey {#1}{\Eitemize} +\def\doitemize#1{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + % + % Try typesetting the item mark that if the document erroneously says + % something like @itemize @samp (intending @table), there's an error + % right away at the @itemize. It's not the best error message in the + % world, but it's better than leaving it to the @item. This means if + % the user wants an empty mark, they have to say @w{} not just @w. + \def\itemcontents{#1}% + \setbox0 = \hbox{\itemcontents}% + % + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + % + \let\item=\itemizeitem } -\def\itemizey #1#2{% -\aboveenvbreak % -\itemmax=\itemindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \itemindent % -\exdentamount=\itemindent -\parindent = 0pt % -\parskip = \smallskipamount % -\ifdim \parskip=0pt \parskip=2pt \fi% -\def#2{\endgraf\afterenvbreak\endgroup}% -\def\itemcontents{#1}% -\let\item=\itemizeitem} - -% Set sfcode to normal for the chars that usually have another value. -% These are `.?!:;,' -\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 - \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + % + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} % \splitoff TOKENS\endmark defines \first to be the first token in % TOKENS, and \rest to be the remainder. @@ -1828,11 +3684,8 @@ where each line of input produces a line of output.} % or number, to specify the first label in the enumerated list. No % argument is the same as `1'. % -\def\enumerate{\parsearg\enumeratezzz} -\def\enumeratezzz #1{\enumeratey #1 \endenumeratey} +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} \def\enumeratey #1 #2\endenumeratey{% - \begingroup % ended by the @end enumerate - % % If we were given no argument, pretend we were given `1'. \def\thearg{#1}% \ifx\thearg\empty \def\thearg{1}\fi @@ -1903,13 +3756,13 @@ where each line of input produces a line of output.} }% } -% Call itemizey, adding a period to the first argument and supplying the +% Call \doitemize, adding a period to the first argument and supplying the % common last two arguments. Also subtract one from the initial value in % \itemno, since @item increments \itemno. % \def\startenumeration#1{% \advance\itemno by -1 - \itemizey{#1.}\Eenumerate\flushcr + \doitemize{#1.}\flushcr } % @alphaenumerate and @capsenumerate are abbreviations for giving an arg @@ -1920,16 +3773,6 @@ where each line of input produces a line of output.} \def\Ealphaenumerate{\Eenumerate} \def\Ecapsenumerate{\Eenumerate} -% Definition of @item while inside @itemize. - -\def\itemizeitem{% -\advance\itemno by 1 -{\let\par=\endgraf \smallbreak}% -\ifhmode \errmessage{In hmode at itemizeitem}\fi -{\parskip=0in \hskip 0pt -\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% -\vadjust{\penalty 1200}}% -\flushcr} % @multitable macros % Amy Hendrickson, 8/18/94, 3/6/96 @@ -1956,24 +3799,14 @@ where each line of input produces a line of output.} % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item ... % using the widest term desired in each column. -% -% For those who want to use more than one line's worth of words in -% the preamble, break the line within one argument and it -% will parse correctly, i.e., -% -% @multitable {Column 1 template} {Column 2 template} {Column 3 -% template} -% Not: -% @multitable {Column 1 template} {Column 2 template} -% {Column 3 template} % Each new table line starts with @item, each subsequent new column % starts with @tab. Empty columns may be produced by supplying @tab's % with nothing between them for as many times as empty columns are needed, % ie, @tab@tab@tab will produce two empty columns. -% @item, @tab, @multitable or @end multitable do not need to be on their -% own lines, but it will not hurt if they are. +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. % Sample multitable: @@ -2017,13 +3850,12 @@ where each line of input produces a line of output.} \def\xcolumnfractions{\columnfractions} \newif\ifsetpercent -% #1 is the part of the @columnfraction before the decimal point, which -% is presumably either 0 or the empty string (but we don't check, we -% just throw it away). #2 is the decimal part, which we use as the -% percent of \hsize for this column. -\def\pickupwholefraction#1.#2 {% +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% \global\advance\colcount by 1 - \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}% + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% \setuptable } @@ -2040,8 +3872,8 @@ where each line of input produces a line of output.} \let\go\pickupwholefraction \else \global\advance\colcount by 1 - \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator; - % typically that is always in the input, anyway. + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% \fi \fi @@ -2056,18 +3888,40 @@ where each line of input produces a line of output.} \go } -% This used to have \hskip1sp. But then the space in a template line is -% not enough. That is bad. So let's go back to just & until we -% encounter the problem it was intended to solve again. -% --karl, nathan@acm.org, 20apr99. -\def\tab{&} +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. \everycr resets \everytab so we don't have to +% undo it ourselves. +\def\headitemfont{\b}% for people to use in the template row; not changeable +\def\headitem{% + \checkenv\multitable + \crcr + \global\everytab={\bf}% can't use \headitemfont since the parsing differs + \the\everytab % for the first item +}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we again encounter the problem the 1sp was intended to solve. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% % @multitable ... @end multitable definitions: % -\def\multitable{\parsearg\dotable} -\def\dotable#1{\bgroup +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% \vskip\parskip - \let\item\crcr + \startsavinginserts + % + % @item within a multitable starts a normal row. + % We use \def instead of \let so that if one of the multitable entries + % contains an @itemize, we don't choke on the \item (seen as \crcr aka + % \endtemplate) expanding \doitemize. + \def\item{\crcr}% + % \tolerance=9500 \hbadness=9500 \setmultitablespacing @@ -2075,370 +3929,281 @@ where each line of input produces a line of output.} \parindent=\multitableparindent \overfullrule=0pt \global\colcount=0 - \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}% % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% + }% + % + \parsearg\domultitable +} +\def\domultitable#1{% % To parse everything between @multitable and @item: \setuptable#1 \endsetuptable % - % \everycr will reset column counter, \colcount, at the end of - % each line. Every column entry will cause \colcount to advance by one. - % The table preamble - % looks at the current \colcount to find the correct column width. - \everycr{\noalign{% - % - % \filbreak%% keeps underfull box messages off when table breaks over pages. - % Maybe so, but it also creates really weird page breaks when the table - % breaks over pages. Wouldn't \vfil be better? Wait until the problem - % manifests itself, so it can be fixed for real --karl. - \global\colcount=0\relax}}% - % % This preamble sets up a generic column definition, which will % be used as many times as user calls for columns. % \vtop will set a single line and will also let text wrap and % continue for many paragraphs if desired. - \halign\bgroup&\global\advance\colcount by 1\relax - \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname - % - % In order to keep entries from bumping into each other - % we will add a \leftskip of \multitablecolspace to all columns after - % the first one. - % - % If a template has been used, we will add \multitablecolspace - % to the width of each template entry. - % - % If the user has set preamble in terms of percent of \hsize we will - % use that dimension as the width of the column, and the \leftskip - % will keep entries from bumping into each other. Table will start at - % left margin and final column will justify at right margin. - % - % Make sure we don't inherit \rightskip from the outer environment. - \rightskip=0pt - \ifnum\colcount=1 - % The first column will be indented with the surrounding text. - \advance\hsize by\leftskip - \else - \ifsetpercent \else - % If user has not set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace. - \advance\hsize by \multitablecolspace - \fi - % In either case we will make \leftskip=\multitablecolspace: - \leftskip=\multitablecolspace - \fi - % Ignoring space at the beginning and end avoids an occasional spurious - % blank line, when TeX decides to break the line at the space before the - % box from the multistrut, so the strut ends up on a line by itself. - % For example: - % @multitable @columnfractions .11 .89 - % @item @code{#} - % @tab Legal holiday which is valid in major parts of the whole country. - % Is automatically provided with highlighting sequences respectively marking - % characters. - \noindent\ignorespaces##\unskip\multistrut}\cr -} - -\def\setmultitablespacing{% test to see if user has set \multitablelinespace. -% If so, do nothing. If not, give it an appropriate dimension based on -% current baselineskip. + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse +} + +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. \ifdim\multitablelinespace=0pt -%% strut to put in table in case some entry doesn't have descenders, -%% to keep lines equally spaced -\let\multistrut = \strut -%% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. -%% If so, set to same dimension as multitablelinespace. -\else -\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 -width0pt\relax} \fi +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 +\fi +% Test to see if parskip is larger than space between lines of +% table. If not, do nothing. +% If so, set to same dimension as multitablelinespace. \ifdim\multitableparskip>\multitablelinespace \global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. +\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller + % than skip between lines in the table. \fi% \ifdim\multitableparskip=0pt \global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. +\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller + % than skip between lines in the table. \fi} \message{conditionals,} -% Prevent errors for section commands. -% Used in @ignore and in failing conditionals. -\def\ignoresections{% - \let\chapter=\relax - \let\unnumbered=\relax - \let\top=\relax - \let\unnumberedsec=\relax - \let\unnumberedsection=\relax - \let\unnumberedsubsec=\relax - \let\unnumberedsubsection=\relax - \let\unnumberedsubsubsec=\relax - \let\unnumberedsubsubsection=\relax - \let\section=\relax - \let\subsec=\relax - \let\subsubsec=\relax - \let\subsection=\relax - \let\subsubsection=\relax - \let\appendix=\relax - \let\appendixsec=\relax - \let\appendixsection=\relax - \let\appendixsubsec=\relax - \let\appendixsubsection=\relax - \let\appendixsubsubsec=\relax - \let\appendixsubsubsection=\relax - \let\contents=\relax - \let\smallbook=\relax - \let\titlepage=\relax -} - -% Used in nested conditionals, where we have to parse the Texinfo source -% and so want to turn off most commands, in case they are used -% incorrectly. -% -\def\ignoremorecommands{% - \let\defcodeindex = \relax - \let\defcv = \relax - \let\deffn = \relax - \let\deffnx = \relax - \let\defindex = \relax - \let\defivar = \relax - \let\defmac = \relax - \let\defmethod = \relax - \let\defop = \relax - \let\defopt = \relax - \let\defspec = \relax - \let\deftp = \relax - \let\deftypefn = \relax - \let\deftypefun = \relax - \let\deftypeivar = \relax - \let\deftypevar = \relax - \let\deftypevr = \relax - \let\defun = \relax - \let\defvar = \relax - \let\defvr = \relax - \let\ref = \relax - \let\xref = \relax - \let\printindex = \relax - \let\pxref = \relax - \let\settitle = \relax - \let\setchapternewpage = \relax - \let\setchapterstyle = \relax - \let\everyheading = \relax - \let\evenheading = \relax - \let\oddheading = \relax - \let\everyfooting = \relax - \let\evenfooting = \relax - \let\oddfooting = \relax - \let\headings = \relax - \let\include = \relax - \let\lowersections = \relax - \let\down = \relax - \let\raisesections = \relax - \let\up = \relax - \let\set = \relax - \let\clear = \relax - \let\item = \relax -} - -% Ignore @ignore ... @end ignore. + +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. % -\def\ignore{\doignore{ignore}} +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 +} +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} -% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text. +% Ignore @ignore, @ifhtml, @ifinfo, and the like. % -\def\ifinfo{\doignore{ifinfo}} +\def\direntry{\doignore{direntry}} +\def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} +\def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} \def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} \def\ifnottex{\doignore{ifnottex}} -\def\html{\doignore{html}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} \def\menu{\doignore{menu}} -\def\direntry{\doignore{direntry}} - -% @dircategory CATEGORY -- specify a category of the dir file -% which this file should belong to. Ignore this in TeX. -\let\dircategory = \comment +\def\xml{\doignore{xml}} -% Ignore text until a line `@end #1'. +% Ignore text until a line `@end #1', keeping track of nested conditionals. % +% A count to remember the depth of nesting. +\newcount\doignorecount + \def\doignore#1{\begingroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define a command to swallow text until we reach `@end #1'. - % This @ is a catcode 12 token (that is the normal catcode of @ in - % this texinfo.tex file). We change the catcode of @ below to match. - \long\def\doignoretext##1@end #1{\enddoignore}% + % Scan in ``verbatim'' mode: + \obeylines + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other % % Make sure that spaces turn into tokens that match what \doignoretext wants. - \catcode32 = 10 - % - % Ignore braces, too, so mismatched braces don't cause trouble. - \catcode`\{ = 9 - \catcode`\} = 9 - % - % We must not have @c interpreted as a control sequence. - \catcode`\@ = 12 - % - % Make the letter c a comment character so that the rest of the line - % will be ignored. This way, the document can have (for example) - % @c @end ifinfo - % and the @end ifinfo will be properly ignored. - % (We've just changed @ to catcode 12.) - \catcode`\c = 14 - % - % And now expand that command. - \doignoretext -} - -% What we do to finish off ignored text. -% -\def\enddoignore{\endgroup\ignorespaces}% - -\newif\ifwarnedobs\warnedobsfalse -\def\obstexwarn{% - \ifwarnedobs\relax\else - % We need to warn folks that they may have trouble with TeX 3.0. - % This uses \immediate\write16 rather than \message to get newlines. - \immediate\write16{} - \immediate\write16{WARNING: for users of Unix TeX 3.0!} - \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} - \immediate\write16{If you are running another version of TeX, relax.} - \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} - \immediate\write16{ Then upgrade your TeX installation if you can.} - \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)} - \immediate\write16{If you are stuck with version 3.0, run the} - \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} - \immediate\write16{ to use a workaround.} - \immediate\write16{} - \global\warnedobstrue - \fi + \spaceisspace + % + % Count number of #1's that we've seen. + \doignorecount = 0 + % + % Swallow text until we reach the matching `@end #1'. + \dodoignore{#1}% } -% **In TeX 3.0, setting text in \nullfont hangs tex. For a -% workaround (which requires the file ``dummy.tfm'' to be installed), -% uncomment the following line: -%%%%%\font\nullfont=dummy\let\obstexwarn=\relax - -% Ignore text, except that we keep track of conditional commands for -% purposes of nesting, up to an `@end #1' command. -% -\def\nestedignore#1{% - \obstexwarn - % We must actually expand the ignored text to look for the @end - % command, so that nested ignore constructs work. Thus, we put the - % text into a \vbox and then do nothing with the result. To minimize - % the change of memory overflow, we follow the approach outlined on - % page 401 of the TeXbook: make the current font be a dummy font. +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % % - \setbox0 = \vbox\bgroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define `@end #1' to end the box, which will in turn undefine the - % @end command again. - \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% + \gdef\dodoignore#1{% + % #1 contains the command name as a string, e.g., `ifinfo'. % - % We are going to be parsing Texinfo commands. Most cause no - % trouble when they are used incorrectly, but some commands do - % complicated argument parsing or otherwise get confused, so we - % undefine them. + % Define a command to find the next `@end #1'. + \long\def\doignoretext##1^^M@end #1{% + \doignoretextyyy##1^^M@#1\_STOP_}% % - % We can't do anything about stray @-signs, unfortunately; - % they'll produce `undefined control sequence' errors. - \ignoremorecommands + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% % - % Set the current font to be \nullfont, a TeX primitive, and define - % all the font commands to also use \nullfont. We don't use - % dummy.tfm, as suggested in the TeXbook, because not all sites - % might have that installed. Therefore, math mode will still - % produce output, but that should be an extremely small amount of - % stuff compared to the main input. - % - \nullfont - \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont - \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont - \let\tensf = \nullfont - % Similarly for index fonts (mostly for their use in - % smallexample) - \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont - \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont - \let\indsf = \nullfont - % - % Don't complain when characters are missing from the fonts. - \tracinglostchars = 0 - % - % Don't bother to do space factor calculations. - \frenchspacing - % - % Don't report underfull hboxes. - \hbadness = 10000 - % - % Do minimal line-breaking. - \pretolerance = 10000 - % - % Do not execute instructions in @tex - \def\tex{\doignore{tex}}% - % Do not execute macro definitions. - % `c' is a comment character, so the word `macro' will get cut off. - \def\macro{\doignore{ma}}% + % And now expand that command. + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). + \fi + \next #1% the token \_STOP_ is present just after this macro. +} + +% We have to swallow the remaining "\_STOP_". +% +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next +} + +% Finish off ignored text. +{ \obeylines% + % Ignore anything after the last `@end #1'; this matters in verbatim + % environments, where otherwise the newline after an ignored conditional + % would result in a blank line in the output. + \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% } + % @set VAR sets the variable VAR to an empty value. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. % % Since we want to separate VAR from REST-OF-LINE (which might be % empty), we can't just use \parsearg; we have to insert a space of our % own to delimit the rest of the line, and then take it out again if we -% didn't need it. Make sure the catcode of space is correct to avoid -% losing inside @example, for instance. +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. % -\def\set{\begingroup\catcode` =10 - \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. - \parsearg\setxxx} -\def\setxxx#1{\setyyy#1 \endsetyyy} +\parseargdef\set{\setyyy#1 \endsetyyy} \def\setyyy#1 #2\endsetyyy{% - \def\temp{#2}% - \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty - \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. - \fi - \endgroup + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% } -% Can't use \xdef to pre-expand #2 and save some time, since \temp or -% \next or other control sequences that we've defined might get us into -% an infinite loop. Consider `@set foo @cite{bar}'. -\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} % @clear VAR clears (i.e., unsets) the variable VAR. % -\def\clear{\parsearg\clearxxx} -\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} % @value{foo} gets the text saved in variable foo. +\def\value{\begingroup\makevalueexpandable\valuexxx} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} { - \catcode`\_ = \active + \catcode`\- = \active \catcode`\_ = \active % - % We might end up with active _ or - characters in the argument if - % we're called from @code, as @code{@value{foo-bar_}}. So \let any - % such active characters to their normal equivalents. - \gdef\value{\begingroup - \catcode`\-=12 \catcode`\_=12 - \indexbreaks \let_\normalunderscore - \valuexxx} + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\normaldash \let_\normalunderscore + } } -\def\valuexxx#1{\expandablevalue{#1}\endgroup} % We have this subroutine so that we can handle at least some @value's -% properly in indexes (we \let\value to this in \indexdummies). Ones -% whose names contain - or _ still won't work, but we can't do anything -% about that. The command has to be fully expandable, since the result -% winds up in the index file. This means that if the variable's value -% contains other Texinfo commands, it's almost certain it will fail -% (although perhaps we could fix that with sufficient work to do a -% one-level expansion on the result, instead of complete). +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). % \def\expandablevalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% \else \csname SET#1\endcsname \fi @@ -2447,66 +4212,65 @@ width0pt\relax} \fi % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % -\def\ifset{\parsearg\ifsetxxx} -\def\ifsetxxx #1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifsetfail - \else - \expandafter\ifsetsucceed - \fi +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next } -\def\ifsetsucceed{\conditionalsucceed{ifset}} -\def\ifsetfail{\nestedignore{ifset}} -\defineunmatchedend{ifset} +\def\ifsetfail{\doignore{ifset}} -% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% @ifclear VAR ... @end executes the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % -\def\ifclear{\parsearg\ifclearxxx} -\def\ifclearxxx #1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifclearsucceed - \else - \expandafter\ifclearfail - \fi -} -\def\ifclearsucceed{\conditionalsucceed{ifclear}} -\def\ifclearfail{\nestedignore{ifclear}} -\defineunmatchedend{ifclear} - -% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text -% following, through the first @end iftex (etc.). Make `@end iftex' -% (etc.) valid only after an @iftex. -% -\def\iftex{\conditionalsucceed{iftex}} -\def\ifnothtml{\conditionalsucceed{ifnothtml}} -\def\ifnotinfo{\conditionalsucceed{ifnotinfo}} -\defineunmatchedend{iftex} -\defineunmatchedend{ifnothtml} -\defineunmatchedend{ifnotinfo} - -% We can't just want to start a group at @iftex (for example) and end it -% at @end iftex, since then @set commands inside the conditional have no -% effect (they'd get reverted at the end of the group). So we must -% define \Eiftex to redefine itself to be its previous value. (We can't -% just define it to fail again with an ``unmatched end'' error, since -% the @ifset might be nested.) -% -\def\conditionalsucceed#1{% - \edef\temp{% - % Remember the current value of \E#1. - \let\nece{prevE#1} = \nece{E#1}% - % - % At the `@end #1', redefine \E#1 to be its previous value. - \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% - }% - \temp +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. +% +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} + +% @ifcommandisdefined CMD ... @end executes the `...' if CMD (written +% without the @) is in fact defined. We can only feasibly check at the +% TeX level, so something like `mathcode' is going to considered +% defined even though it is not a Texinfo command. +% +\makecond{ifcommanddefined} +\def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}} +% +\def\doifcmddefined#1#2{{% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname #2\endcsname\relax + #1% If not defined, \let\next as above. + \fi + \expandafter + }\next } +\def\ifcmddefinedfail{\doignore{ifcommanddefined}} -% We need to expand lots of \csname's, but we don't want to expand the -% control sequences after we've constructed them. -% -\def\nece#1{\expandafter\noexpand\csname#1\endcsname} +% @ifcommandnotdefined CMD ... handled similar to @ifclear above. +\makecond{ifcommandnotdefined} +\def\ifcommandnotdefined{% + \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}} +\def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}} + +% Set the `txicommandconditionals' variable, so documents have a way to +% test if the @ifcommand...defined conditionals are available. +\set txicommandconditionals + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment % @defininfoenclose. \let\definfoenclose=\comment @@ -2516,9 +4280,8 @@ width0pt\relax} \fi % Index generation facilities % Define \newwrite to be identical to plain tex's \newwrite -% except not \outer, so it can be used within \newindex. -{\catcode`\@=11 -\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} +% except not \outer, so it can be used within macros and \if's. +\edef\newwrite{\makecsname{ptexnewwrite}} % \newindex {foo} defines an index named foo. % It automatically defines \fooindex such that @@ -2538,42 +4301,48 @@ width0pt\relax} \fi } % @defindex foo == \newindex{foo} - +% \def\defindex{\parsearg\newindex} % Define @defcodeindex, like @defindex except put all entries in @code. - +% +\def\defcodeindex{\parsearg\newcodeindex} +% \def\newcodeindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 \fi \expandafter\xdef\csname#1index\endcsname{% - \noexpand\docodeindex{#1}} + \noexpand\docodeindex{#1}}% } -\def\defcodeindex{\parsearg\newcodeindex} % @synindex foo bar makes index foo feed into index bar. % Do this instead of @defindex foo if you don't want it as a separate index. -% The \closeout helps reduce unnecessary open files; the limit on the -% Acorn RISC OS is a mere 16 files. -\def\synindex#1 #2 {% - \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname - \expandafter\closeout\csname#1indfile\endcsname - \expandafter\let\csname#1indfile\endcsname=\synindexfoo - \expandafter\xdef\csname#1index\endcsname{% define \xxxindex - \noexpand\doindex{#2}}% -} - +% % @syncodeindex foo bar similar, but put all entries made for index foo % inside @code. -\def\syncodeindex#1 #2 {% - \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname - \expandafter\closeout\csname#1indfile\endcsname - \expandafter\let\csname#1indfile\endcsname=\synindexfoo - \expandafter\xdef\csname#1index\endcsname{% define \xxxindex - \noexpand\docodeindex{#2}}% +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \relax + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% } % Define \doindex, the driver for all \fooindex macros. @@ -2593,266 +4362,493 @@ width0pt\relax} \fi \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% \def\indexdummies{% -\def\ { }% -% Take care of the plain tex accent commands. -\def\"{\realbackslash "}% -\def\`{\realbackslash `}% -\def\'{\realbackslash '}% -\def\^{\realbackslash ^}% -\def\~{\realbackslash ~}% -\def\={\realbackslash =}% -\def\b{\realbackslash b}% -\def\c{\realbackslash c}% -\def\d{\realbackslash d}% -\def\u{\realbackslash u}% -\def\v{\realbackslash v}% -\def\H{\realbackslash H}% -% Take care of the plain tex special European modified letters. -\def\oe{\realbackslash oe}% -\def\ae{\realbackslash ae}% -\def\aa{\realbackslash aa}% -\def\OE{\realbackslash OE}% -\def\AE{\realbackslash AE}% -\def\AA{\realbackslash AA}% -\def\o{\realbackslash o}% -\def\O{\realbackslash O}% -\def\l{\realbackslash l}% -\def\L{\realbackslash L}% -\def\ss{\realbackslash ss}% -% Take care of texinfo commands likely to appear in an index entry. -% (Must be a way to avoid doing expansion at all, and thus not have to -% laboriously list every single command here.) -\def\@{@}% will be @@ when we switch to @ as escape char. -% Need these in case \tex is in effect and \{ is a \delimiter again. -% But can't use \lbracecmd and \rbracecmd because texindex assumes -% braces and backslashes are used only as delimiters. -\let\{ = \mylbrace -\let\} = \myrbrace -\def\_{{\realbackslash _}}% -\def\w{\realbackslash w }% -\def\bf{\realbackslash bf }% -%\def\rm{\realbackslash rm }% -\def\sl{\realbackslash sl }% -\def\sf{\realbackslash sf}% -\def\tt{\realbackslash tt}% -\def\gtr{\realbackslash gtr}% -\def\less{\realbackslash less}% -\def\hat{\realbackslash hat}% -\def\TeX{\realbackslash TeX}% -\def\dots{\realbackslash dots }% -\def\result{\realbackslash result}% -\def\equiv{\realbackslash equiv}% -\def\expansion{\realbackslash expansion}% -\def\print{\realbackslash print}% -\def\error{\realbackslash error}% -\def\point{\realbackslash point}% -\def\copyright{\realbackslash copyright}% -\def\tclose##1{\realbackslash tclose {##1}}% -\def\code##1{\realbackslash code {##1}}% -\def\uref##1{\realbackslash uref {##1}}% -\def\url##1{\realbackslash url {##1}}% -\def\env##1{\realbackslash env {##1}}% -\def\command##1{\realbackslash command {##1}}% -\def\option##1{\realbackslash option {##1}}% -\def\dotless##1{\realbackslash dotless {##1}}% -\def\samp##1{\realbackslash samp {##1}}% -\def\,##1{\realbackslash ,{##1}}% -\def\t##1{\realbackslash t {##1}}% -\def\r##1{\realbackslash r {##1}}% -\def\i##1{\realbackslash i {##1}}% -\def\b##1{\realbackslash b {##1}}% -\def\sc##1{\realbackslash sc {##1}}% -\def\cite##1{\realbackslash cite {##1}}% -\def\key##1{\realbackslash key {##1}}% -\def\file##1{\realbackslash file {##1}}% -\def\var##1{\realbackslash var {##1}}% -\def\kbd##1{\realbackslash kbd {##1}}% -\def\dfn##1{\realbackslash dfn {##1}}% -\def\emph##1{\realbackslash emph {##1}}% -\def\acronym##1{\realbackslash acronym {##1}}% -% -% Handle some cases of @value -- where the variable name does not -% contain - or _, and the value does not contain any -% (non-fully-expandable) commands. -\let\value = \expandablevalue -% -\unsepspaces -% Turn off macro expansion -\turnoffmacros -} - -% If an index command is used in an @example environment, any spaces -% therein should become regular spaces in the raw index file, not the -% expansion of \tie (\\leavevmode \penalty \@M \ ). -{\obeyspaces - \gdef\unsepspaces{\obeyspaces\let =\space}} - -% \indexnofonts no-ops all font-change commands. -% This is used when outputting the strings to sort the index by. -\def\indexdummyfont#1{#1} -\def\indexdummytex{TeX} -\def\indexdummydots{...} + \escapechar = `\\ % use backslash in output files. + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % + % Need these unexpandable (because we define \tt as a dummy) + % definitions when @{ or @} appear in index entry text. Also, more + % complicated, when \tex is in effect and \{ is a \delimiter again. + % We can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. Perhaps we + % should define @lbrace and @rbrace commands a la @comma. + \def\{{{\tt\char123}}% + \def\}{{\tt\char125}}% + % + % I don't entirely understand this, but when an index entry is + % generated from a macro call, the \endinput which \scanmacro inserts + % causes processing to be prematurely terminated. This is, + % apparently, because \indexsorttmp is fully expanded, and \endinput + % is an expandable command. The redefinition below makes \endinput + % disappear altogether for that purpose -- although logging shows that + % processing continues to some further point. On the other hand, it + % seems \endinput does not hurt in the printed index arg, since that + % is still getting written without apparent harm. + % + % Sample source (mac-idx3.tex, reported by Graham Percival to + % help-texinfo, 22may06): + % @macro funindex {WORD} + % @findex xyz + % @end macro + % ... + % @funindex commtest + % + % The above is not enough to reproduce the bug, but it gives the flavor. + % + % Sample whatsit resulting: + % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} + % + % So: + \let\endinput = \empty + % + % Do the redefinitions. + \commondummies +} + +% For the aux and toc files, @ is the escape character. So we want to +% redefine everything using @ as the escape character (instead of +% \realbackslash, still used for index files). When everything uses @, +% this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % Do the redefinitions. + \commondummies + \otherbackslash +} +% Called from \indexdummies and \atdummies. +% +\def\commondummies{% + % + % \definedummyword defines \#1 as \string\#1\space, thus effectively + % preventing its expansion. This is used only for control words, + % not control letters, because the \space would be incorrect for + % control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword ##1{\def##1{\string##1\space}}% + \def\definedummyletter##1{\def##1{\string##1}}% + \let\definedummyaccent\definedummyletter + % + \commondummiesnofonts + % + \definedummyletter\_% + \definedummyletter\-% + % + % Non-English letters. + \definedummyword\AA + \definedummyword\AE + \definedummyword\DH + \definedummyword\L + \definedummyword\O + \definedummyword\OE + \definedummyword\TH + \definedummyword\aa + \definedummyword\ae + \definedummyword\dh + \definedummyword\exclamdown + \definedummyword\l + \definedummyword\o + \definedummyword\oe + \definedummyword\ordf + \definedummyword\ordm + \definedummyword\questiondown + \definedummyword\ss + \definedummyword\th + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword\bf + \definedummyword\gtr + \definedummyword\hat + \definedummyword\less + \definedummyword\sf + \definedummyword\sl + \definedummyword\tclose + \definedummyword\tt + % + \definedummyword\LaTeX + \definedummyword\TeX + % + % Assorted special characters. + \definedummyword\arrow + \definedummyword\bullet + \definedummyword\comma + \definedummyword\copyright + \definedummyword\registeredsymbol + \definedummyword\dots + \definedummyword\enddots + \definedummyword\entrybreak + \definedummyword\equiv + \definedummyword\error + \definedummyword\euro + \definedummyword\expansion + \definedummyword\geq + \definedummyword\guillemetleft + \definedummyword\guillemetright + \definedummyword\guilsinglleft + \definedummyword\guilsinglright + \definedummyword\lbracechar + \definedummyword\leq + \definedummyword\minus + \definedummyword\ogonek + \definedummyword\pounds + \definedummyword\point + \definedummyword\print + \definedummyword\quotedblbase + \definedummyword\quotedblleft + \definedummyword\quotedblright + \definedummyword\quoteleft + \definedummyword\quoteright + \definedummyword\quotesinglbase + \definedummyword\rbracechar + \definedummyword\result + \definedummyword\textdegree + % + % We want to disable all macros so that they are not expanded by \write. + \macrolist + % + \normalturnoffactive + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable +} + +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +\def\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ogonek + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sansserif + \definedummyword\sc + \definedummyword\slanted + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\abbr + \definedummyword\acronym + \definedummyword\anchor + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\dmn + \definedummyword\email + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\image + \definedummyword\indicateurl + \definedummyword\inforef + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\pxref + \definedummyword\ref + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + \definedummyword\xref +} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% \def\indexnofonts{% -% Just ignore accents. -\let\,=\indexdummyfont -\let\"=\indexdummyfont -\let\`=\indexdummyfont -\let\'=\indexdummyfont -\let\^=\indexdummyfont -\let\~=\indexdummyfont -\let\==\indexdummyfont -\let\b=\indexdummyfont -\let\c=\indexdummyfont -\let\d=\indexdummyfont -\let\u=\indexdummyfont -\let\v=\indexdummyfont -\let\H=\indexdummyfont -\let\dotless=\indexdummyfont -% Take care of the plain tex special European modified letters. -\def\oe{oe}% -\def\ae{ae}% -\def\aa{aa}% -\def\OE{OE}% -\def\AE{AE}% -\def\AA{AA}% -\def\o{o}% -\def\O{O}% -\def\l{l}% -\def\L{L}% -\def\ss{ss}% -\let\w=\indexdummyfont -\let\t=\indexdummyfont -\let\r=\indexdummyfont -\let\i=\indexdummyfont -\let\b=\indexdummyfont -\let\emph=\indexdummyfont -\let\strong=\indexdummyfont -\let\cite=\indexdummyfont -\let\sc=\indexdummyfont -%Don't no-op \tt, since it isn't a user-level command -% and is used in the definitions of the active chars like <, >, |... -%\let\tt=\indexdummyfont -\let\tclose=\indexdummyfont -\let\code=\indexdummyfont -\let\url=\indexdummyfont -\let\uref=\indexdummyfont -\let\env=\indexdummyfont -\let\command=\indexdummyfont -\let\option=\indexdummyfont -\let\file=\indexdummyfont -\let\samp=\indexdummyfont -\let\kbd=\indexdummyfont -\let\key=\indexdummyfont -\let\var=\indexdummyfont -\let\TeX=\indexdummytex -\let\dots=\indexdummydots -\def\@{@}% -} - -% To define \realbackslash, we must make \ not be an escape. -% We must first make another character (@) an escape -% so we do not become unable to do a definition. - -{\catcode`\@=0 \catcode`\\=\other - @gdef@realbackslash{\}} + % Accent commands should become @asis. + \def\definedummyaccent##1{\let##1\asis}% + % We can just ignore other control letters. + \def\definedummyletter##1{\let##1\empty}% + % All control words become @asis by default; overrides below. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + \def\ { }% + \def\@{@}% + \def\_{\normalunderscore}% + \def\-{}% @- shouldn't affect sorting + % + % Unfortunately, texindex is not prepared to handle braces in the + % content at all. So for index sorting, we map @{ and @} to strings + % starting with |, since that ASCII character is between ASCII { and }. + \def\{{|a}% + \def\lbracechar{|a}% + % + \def\}{|b}% + \def\rbracechar{|b}% + % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\DH{DZZ}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\TH{ZZZ}% + \def\aa{aa}% + \def\ae{ae}% + \def\dh{dzz}% + \def\exclamdown{!}% + \def\l{l}% + \def\oe{oe}% + \def\ordf{a}% + \def\ordm{o}% + \def\o{o}% + \def\questiondown{?}% + \def\ss{ss}% + \def\th{zzz}% + % + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% + % + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\arrow{->}% + \def\bullet{bullet}% + \def\comma{,}% + \def\copyright{copyright}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\euro{euro}% + \def\expansion{==>}% + \def\geq{>=}% + \def\guillemetleft{<<}% + \def\guillemetright{>>}% + \def\guilsinglleft{<}% + \def\guilsinglright{>}% + \def\leq{<=}% + \def\minus{-}% + \def\point{.}% + \def\pounds{pounds}% + \def\print{-|}% + \def\quotedblbase{"}% + \def\quotedblleft{"}% + \def\quotedblright{"}% + \def\quoteleft{`}% + \def\quoteright{'}% + \def\quotesinglbase{,}% + \def\registeredsymbol{R}% + \def\result{=>}% + \def\textdegree{o}% + % + \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax + \else \indexlquoteignore \fi + % + % We need to get rid of all macros, leaving only the arguments (if present). + % Of course this is not nearly correct, but it is the best we can do for now. + % makeinfo does not expand macros in the argument to @deffn, which ends up + % writing an index entry, and texindex isn't prepared for an index sort entry + % that starts with \. + % + % Since macro invocations are followed by braces, we can just redefine them + % to take a single TeX argument. The case of a macro invocation that + % goes to end-of-line is not handled. + % + \macrolist +} + +% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us +% ignore left quotes in the sort term. +{\catcode`\`=\active + \gdef\indexlquoteignore{\let`=\empty}} \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? -% For \ifx comparisons. -\def\emptymacro{\empty} - % Most index entries go through here, but \dosubind is the general case. -% -\def\doind#1#2{\dosubind{#1}{#2}\empty} +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} % Workhorse for all \fooindexes. % #1 is name of index, #2 is stuff to put there, #3 is subentry -- -% \empty if called from \doind, as we usually are. The main exception -% is with defuns, which call us directly. +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). % \def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \safewhatsit\dosubindwrite + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% % Put the index entry in the margin if desired. \ifx\SETmarginindex\relax\else - \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% \fi - {% - \count255=\lastpenalty - {% - \indexdummies % Must do this here, since \bf, etc expand at this stage - \escapechar=`\\ - {% - \let\folio = 0% We will expand all macros now EXCEPT \folio. - \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. - % - \def\thirdarg{#3}% - % - % If third arg is present, precede it with space in sort key. - \ifx\thirdarg\emptymacro - \let\subentry = \empty - \else - \def\subentry{ #3}% - \fi - % - % First process the index entry with all font commands turned - % off to get the string to sort by. - {\indexnofonts \xdef\indexsorttmp{#2\subentry}}% - % - % Now the real index entry with the fonts. - \toks0 = {#2}% - % - % If third (subentry) arg is present, add it to the index - % string. And include a space. - \ifx\thirdarg\emptymacro \else - \toks0 = \expandafter{\the\toks0 \space #3}% - \fi - % - % Set up the complete index entry, with both the sort key - % and the original text, including any font commands. We write - % three arguments to \entry to the .?? file, texindex reduces to - % two when writing the .??s sorted result. - \edef\temp{% - \write\csname#1indfile\endcsname{% - \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% - }% - % - % If a skip is the last thing on the list now, preserve it - % by backing up by \lastskip, doing the \write, then inserting - % the skip again. Otherwise, the whatsit generated by the - % \write will make \lastskip zero. The result is that sequences - % like this: - % @end defun - % @tindex whatever - % @defun ... - % will have extra space inserted, because the \medbreak in the - % start of the @defun won't see the skip inserted by the @end of - % the previous defun. - % - % But don't do any of this if we're not in vertical mode. We - % don't want to do a \vskip and prematurely end a paragraph. - % - % Avoid page breaks due to these extra skips, too. - % - \iflinks - \ifvmode - \skip0 = \lastskip - \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi - \fi - % - \temp % do the write - % - % - \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi - \fi - }% - }% - \penalty\count255 + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp } +% Take care of unwanted page breaks/skips around a whatsit: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write or \pdfdest will make \lastskip zero. The result is that +% sequences like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +\newskip\whatsitskip +\newcount\whatsitpenalty +% +% ..., ready, GO: +% +\def\safewhatsit#1{\ifhmode + #1% + \else + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \whatsitskip = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \whatsitpenalty = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\whatsitskip glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\whatsitskip + \fi + % + #1% + % + \ifx\lastskipmacro\zeroskipmacro + % If \lastskip was zero, perhaps the last item was a penalty, and + % perhaps it was >=10000, e.g., a \nobreak. In that case, we want + % to re-insert the same penalty (values >10000 are used for various + % signals); since we just inserted a non-discardable item, any + % following glue (such as a \parskip) would be a breakpoint. For example: + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\whatsitskip + \fi +\fi} + % The index entry written in the file actually looks like % \entry {sortstring}{page}{topic} % or @@ -2888,13 +4884,13 @@ width0pt\relax} \fi % @printindex causes a particular index (the ??s file) to get printed. % It does not print any chapter heading (usually an @unnumbered). % -\def\printindex{\parsearg\doprintindex} -\def\doprintindex#1{\begingroup +\parseargdef\printindex{\begingroup \dobreak \chapheadingskip{10000}% % - \indexfonts \rm + \smallfonts \rm \tolerance = 9500 - \indexbreaks + \plainfrenchspacing + \everypar = {}% don't want the \kern\-parindent from indentation suppression. % % See if the index file exists and is nonempty. % Change catcode of @ here so that if the index file contains @@ -2921,7 +4917,7 @@ width0pt\relax} \fi % Index files are almost Texinfo source, but we use \ as the escape % character. It would be better to use @, but that's too big a change % to make right now. - \def\indexbackslash{\rawbackslashxx}% + \def\indexbackslash{\backslashcurfont}% \catcode`\\ = 0 \escapechar = `\\ \begindoublecolumns @@ -2943,7 +4939,10 @@ width0pt\relax} \fi \removelastskip % % We like breaks before the index initials, so insert a bonus. - \penalty -300 + \nobreak + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip % % Typeset the initial. Making this add up to a whole number of % baselineskips increases the chance of the dots lining up from column @@ -2953,89 +4952,123 @@ width0pt\relax} \fi % No shrink because it confuses \balancecolumns. \vskip 1.67\baselineskip plus .5\baselineskip \leftline{\secbf #1}% - \vskip .33\baselineskip plus .1\baselineskip - % % Do our best not to break after the initial. \nobreak + \vskip .33\baselineskip plus .1\baselineskip }} -% This typesets a paragraph consisting of #1, dot leaders, and then #2 -% flush to the right margin. It is used for index and table of contents -% entries. The paragraph is indented by \leftskip. -% -\def\entry#1#2{\begingroup - % - % Start a new paragraph if necessary, so our assignments below can't - % affect previous text. - \par - % - % Do not fill out the last line with white space. - \parfillskip = 0in - % - % No extra space above this paragraph. - \parskip = 0in - % - % Do not prefer a separate line ending with a hyphen to fewer lines. - \finalhyphendemerits = 0 - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - % \hangafter is reset to 1 (which is the value we want) at the start - % of each paragraph, so we need not do anything with that. - \hangindent = 2em - % - % When the entry text needs to be broken, just fill out the first line - % with blank space. - \rightskip = 0pt plus1fil - % - % A bit of stretch before each entry for the benefit of balancing columns. - \vskip 0pt plus1pt - % - % Start a ``paragraph'' for the index entry so the line breaking - % parameters we've set above will have an effect. - \noindent - % - % Insert the text of the index entry. TeX will do line-breaking on it. - #1% - % The following is kludged to not output a line of dots in the index if - % there are no page numbers. The next person who breaks this will be - % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#2}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd\ \else% +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. +% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this freezes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 - \null\nobreak\indexdotfill % Have leaders before the page number. + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. - \ #2% The page number ends the paragraph. - \fi% - \par -\endgroup} + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % When reading the text of entry, convert explicit line breaks + % from @* into spaces. The user might give these in long section + % titles, for instance. + \def\*{\unskip\space\ignorespaces}% + \def\entrybreak{\hfil\break}% + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\entrybreak{\unskip\space\ignorespaces}% +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \setbox\boxA = \hbox{#1}% + \ifdim\wd\boxA = 0pt + \ % + \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi + \fi + \par + \endgroup +} -% Like \dotfill except takes at least 1 em. +% Like plain.tex's \dotfill, except uses up at least 1 em. \def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} + \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} \def\primary #1{\line{#1\hfil}} \newskip\secondaryindent \secondaryindent=0.5cm - -\def\secondary #1#2{ -{\parfillskip=0in \parskip=0in -\hangindent =1in \hangafter=1 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par }} % Define two-column mode, which we use to typeset indexes. @@ -3095,7 +5128,6 @@ width0pt\relax} \fi % % Double the \vsize as well. (We don't need a separate register here, % since nobody clobbers \vsize.) - \advance\vsize by -\ht\partialpage \vsize = 2\vsize } @@ -3109,6 +5141,7 @@ width0pt\relax} \fi % previous page. \dimen@ = \vsize \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage % % box0 will be the left-hand column, box2 the right. \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ @@ -3116,16 +5149,47 @@ width0pt\relax} \fi \unvbox255 \penalty\outputpenalty } +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. \def\pagesofar{% - % Re-output the contents of the output page -- any previous material, - % followed by the two boxes we just split, in box0 and box2. \unvbox\partialpage % \hsize = \doublecolumnhsize \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% } +% +% All done with double columns. \def\enddoublecolumns{% + % The following penalty ensures that the page builder is exercised + % _before_ we change the output routine. This is necessary in the + % following situation: + % + % The last section of the index consists only of a single entry. + % Before this section, \pagetotal is less than \pagegoal, so no + % break occurs before the last section starts. However, the last + % section, consisting of \initial and the single \entry, does not + % fit on the page and has to be broken off. Without the following + % penalty the page builder will not be exercised until \eject + % below, and by that time we'll already have changed the output + % routine to the \balancecolumns version, so the next-to-last + % double-column page will be processed with \balancecolumns, which + % is wrong: The two columns will go to the main vertical list, with + % the broken-off section in the recent contributions. As soon as + % the output routine finishes, TeX starts reconsidering the page + % break. The two columns and the broken-off section both fit on the + % page, because the two columns now take up only half of the page + % goal. When TeX sees \eject from below which follows the final + % section, it invokes the new output routine that we've set after + % \balancecolumns below; \onepageout will try to fit the two columns + % and the final section into the vbox of \pageheight (see + % \pagebody), causing an overfull box. + % + % Note that glue won't work here, because glue does not exercise the + % page builder, unlike penalties (see The TeXbook, pp. 280-281). + \penalty0 + % \output = {% % Split the last of the double-column material. Leave it on the % current page, no automatic page break. @@ -3149,8 +5213,9 @@ width0pt\relax} \fi % \endgroup where \vsize got restored). \pagegoal = \vsize } +% +% Called at the end of the double column material. \def\balancecolumns{% - % Called at the end of the double column material. \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. \dimen@ = \ht0 \advance\dimen@ by \topskip @@ -3180,26 +5245,87 @@ width0pt\relax} \fi \message{sectioning,} % Chapters, sections, etc. +% Let's start with @part. +\outer\parseargdef\part{\partzzz{#1}} +\def\partzzz#1{% + \chapoddpage + \null + \vskip.3\vsize % move it down on the page a bit + \begingroup + \noindent \titlefonts\rmisbold #1\par % the text + \let\lastnode=\empty % no node to associate with + \writetocentry{part}{#1}{}% but put it in the toc + \headingsoff % no headline or footline on the part page + \chapoddpage + \endgroup +} + +% \unnumberedno is an oxymoron. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 \newcount\chapno \newcount\secno \secno=0 \newcount\subsecno \subsecno=0 \newcount\subsubsecno \subsubsecno=0 % This counter is funny since it counts through charcodes of letters A, B, ... -% The \the is necessary, despite appearances, because \appendixletter is -% expanded while writing the .toc file. \char\appendixno is not -% expandable, thus it is written literally, thus all appendixes come out -% with the same letter (or @) in the toc without it. \newcount\appendixno \appendixno = `\@ -\def\appendixletter{\char\the\appendixno} - -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise. +% +% \def\appendixletter{\char\the\appendixno} +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +% +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% Each @chapter defines these (using marks) as the number+name, number +% and name of the chapter. Page headings and footings can use +% these. @section does likewise. \def\thischapter{} +\def\thischapternum{} +\def\thischaptername{} \def\thissection{} +\def\thissectionnum{} +\def\thissectionname{} \newcount\absseclevel % used to calculate proper heading level -\newcount\secbase\secbase=0 % @raise/lowersections modify this count +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count % @raisesections: treat @section as chapter, @subsection as section, etc. \def\raisesections{\global\advance\secbase by -1} @@ -3209,334 +5335,311 @@ width0pt\relax} \fi \def\lowersections{\global\advance\secbase by 1} \let\down=\lowersections % original BFox name -% Choose a numbered-heading macro -% #1 is heading level if unmodified by @raisesections or @lowersections -% #2 is text for heading -\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \chapterzzz{#2} -\or - \seczzz{#2} -\or - \numberedsubseczzz{#2} -\or - \numberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \chapterzzz{#2} +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achieve this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unnlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 \else - \numberedsubsubseczzz{#2} + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi \fi -\fi -} - -% like \numhead, but chooses appendix heading levels -\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \appendixzzz{#2} -\or - \appendixsectionzzz{#2} -\or - \appendixsubseczzz{#2} -\or - \appendixsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \appendixzzz{#2} + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unnlevel + \chardef\unnlevel = \absseclevel + \fi \else - \appendixsubsubseczzz{#2} + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unnlevel + \def\headtype{U}% + \else + \chardef\unnlevel = 3 + \fi \fi -\fi -} - -% like \numhead, but chooses numberless heading levels -\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \unnumberedzzz{#2} -\or - \unnumberedseczzz{#2} -\or - \unnumberedsubseczzz{#2} -\or - \unnumberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \unnumberedzzz{#2} + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi \else - \unnumberedsubsubseczzz{#2} + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi \fi -\fi + \suppressfirstparagraphindent +} + +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} + +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + % \putwordChapter can contain complex things in translations. + \toks0=\expandafter{\putwordChapter}% + \message{\the\toks0 \space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz +% +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + % \putwordAppendix can contain complex things in translations. + \toks0=\expandafter{\putwordAppendix}% + \message{\the\toks0 \space \appendixletter}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec } -% @chapter, @appendix, @unnumbered. -\def\thischaptername{No Chapter Title} -\outer\def\chapter{\parsearg\chapteryyy} -\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz -\def\chapterzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% -\chapmacro {#1}{\the\chapno}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -% We don't substitute the actual chapter name into \thischapter -% because we don't want its macros evaluated now. -\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\the\chapno}}}% -\temp -\donoderef -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec -} - -\outer\def\appendix{\parsearg\appendixyyy} -\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz -\def\appendixzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \appendixno by 1 -\message{\putwordAppendix\space \appendixletter}% -\chapmacro {#1}{\putwordAppendix{} \appendixletter}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\putwordAppendix{} \appendixletter}}}% -\temp -\appendixnoderef -\global\let\section = \appendixsec -\global\let\subsection = \appendixsubsec -\global\let\subsubsection = \appendixsubsubsec +% normally unnmhead0 calls unnumberedzzz: +\outer\parseargdef\unnumbered{\unnmhead0{#1}} +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the to achieve this: TeX expands \the only once, + % simply yielding the contents of . (We also do this for + % the toc entries.) + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% + % + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec } % @centerchap is like @unnumbered, but the heading is centered. -\outer\def\centerchap{\parsearg\centerchapyyy} -\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} % @top is like @unnumbered. -\outer\def\top{\parsearg\unnumberedyyy} - -\outer\def\unnumbered{\parsearg\unnumberedyyy} -\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz -\def\unnumberedzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -% -% This used to be simply \message{#1}, but TeX fully expands the -% argument to \message. Therefore, if #1 contained @-commands, TeX -% expanded them. For example, in `@unnumbered The @cite{Book}', TeX -% expanded @cite (which turns out to cause errors because \cite is meant -% to be executed, not expanded). -% -% Anyway, we don't want the fully-expanded definition of @cite to appear -% as a result of the \message, we just want `@cite' itself. We use -% \the to achieve this: TeX expands \the only once, -% simply yielding the contents of . (We also do this for -% the toc entries.) -\toks0 = {#1}\message{(\the\toks0)}% -% -\unnumbchapmacro {#1}% -\gdef\thischapter{#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}% -\temp -\unnumbnoderef -\global\let\section = \unnumberedsec -\global\let\subsection = \unnumberedsubsec -\global\let\subsubsection = \unnumberedsubsubsec -} +\let\top\unnumbered % Sections. -\outer\def\numberedsec{\parsearg\secyyy} -\def\secyyy #1{\numhead1{#1}} % normally calls seczzz -\def\seczzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\the\chapno}{\the\secno}}}% -\temp -\donoderef -\nobreak -} - -\outer\def\appendixsection{\parsearg\appendixsecyyy} -\outer\def\appendixsec{\parsearg\appendixsecyyy} -\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz -\def\appendixsectionzzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\appendixletter}{\the\secno}}}% -\temp -\appendixnoderef -\nobreak -} - -\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} -\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz -\def\unnumberedseczzz #1{% -\plainsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak +% +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% +} + +% normally calls appendixsectionzzz: +\outer\parseargdef\appendixsection{\apphead1{#1}} +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% +} +\let\appendixsec\appendixsection + +% normally calls unnumberedseczzz: +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. -\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} -\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz -\def\numberedsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}}}% -\temp -\donoderef -\nobreak -} - -\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} -\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz -\def\appendixsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}}}% -\temp -\appendixnoderef -\nobreak -} - -\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} -\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz -\def\unnumberedsubseczzz #1{% -\plainsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry% - {\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak +% +% normally calls numberedsubseczzz: +\outer\parseargdef\numberedsubsec{\numhead2{#1}} +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% +} + +% normally calls appendixsubseczzz: +\outer\parseargdef\appendixsubsec{\apphead2{#1}} +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% +} + +% normally calls unnumberedsubseczzz: +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% } % Subsubsections. -\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} -\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz -\def\numberedsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\donoderef -\nobreak -} - -\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} -\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz -\def\appendixsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\appendixnoderef -\nobreak -} - -\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} -\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz -\def\unnumberedsubsubseczzz #1{% -\plainsubsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry% - {\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak -} - -% These are variants which are not "outer", so they can appear in @ifinfo. -% Actually, they should now be obsolete; ordinary section commands should work. -\def\infotop{\parsearg\unnumberedzzz} -\def\infounnumbered{\parsearg\unnumberedzzz} -\def\infounnumberedsec{\parsearg\unnumberedseczzz} -\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} -\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} - -\def\infoappendix{\parsearg\appendixzzz} -\def\infoappendixsec{\parsearg\appendixseczzz} -\def\infoappendixsubsec{\parsearg\appendixsubseczzz} -\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} - -\def\infochapter{\parsearg\chapterzzz} -\def\infosection{\parsearg\sectionzzz} -\def\infosubsection{\parsearg\subsectionzzz} -\def\infosubsubsection{\parsearg\subsubsectionzzz} +% +% normally numberedsubsubseczzz: +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% normally appendixsubsubseczzz: +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% normally unnumberedsubsubseczzz: +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% +} % These macros control what the section commands do, according % to what kind of chapter we are in (ordinary, appendix, or unnumbered). % Define them by default for a numbered chapter. -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec % Define @majorheading, @heading and @subheading -% NOTE on use of \vbox for chapter headings, section headings, and such: -% 1) We use \vbox rather than the earlier \line to permit -% overlong headings to fold. -% 2) \hyphenpenalty is set to 10000 because hyphenation in a -% heading is obnoxious; this forbids it. -% 3) Likewise, headings look best if no \parindent is used, and -% if justification is not attempted. Hence \raggedright. - - -\def\majorheading{\parsearg\majorheadingzzz} -\def\majorheadingzzz #1{% -{\advance\chapheadingskip by 10pt \chapbreak }% -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} +\def\majorheading{% + {\advance\chapheadingskip by 10pt \chapbreak }% + \parsearg\chapheadingzzz +} -\def\chapheading{\parsearg\chapheadingzzz} -\def\chapheadingzzz #1{\chapbreak % -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% + \vbox{\chapfonts \raggedtitlesettings #1\par}% + \nobreak\bigskip \nobreak + \suppressfirstparagraphindent +} % @heading, @subheading, @subsubheading. -\def\heading{\parsearg\plainsecheading} -\def\subheading{\parsearg\plainsubsecheading} -\def\subsubheading{\parsearg\plainsubsubsecheading} +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} % These macros generate a chapter, section, etc. heading only % (including whitespace, linebreaking, etc. around it), % given all the information in convenient, parsed form. -%%% Args are the skip and penalty (usually negative) +% Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} - -%%% Define plain chapter starts, and page on/off switching for it % Parameter controlling skip before chapter headings (if needed) - \newskip\chapheadingskip +% Define plain chapter starts, and page on/off switching for it. \def\chapbreak{\dobreak \chapheadingskip {-4000}} \def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} +% Because \domark is called before \chapoddpage, the filler page will +% get the headings for the next chapter, which is wrong. But we don't +% care -- we just disable all headings on the filler page. +\def\chapoddpage{% + \chappager + \ifodd\pageno \else + \begingroup + \headingsoff + \null + \chappager + \endgroup + \fi +} \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} @@ -3551,7 +5654,7 @@ width0pt\relax} \fi \global\let\pagealignmacro=\chappager \global\def\HEADINGSon{\HEADINGSsingle}} -\def\CHAPPAGodd{ +\def\CHAPPAGodd{% \global\let\contentsalignmacro = \chapoddpage \global\let\pchapsepmacro=\chapoddpage \global\let\pagealignmacro=\chapoddpage @@ -3559,107 +5662,293 @@ width0pt\relax} \fi \CHAPPAGon -\def\CHAPFplain{ -\global\let\chapmacro=\chfplain -\global\let\unnumbchapmacro=\unnchfplain -\global\let\centerchapmacro=\centerchfplain} - -% Plain chapter opening. -% #1 is the text, #2 the chapter number or empty if unnumbered. -\def\chfplain#1#2{% +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% + % Insert the first mark before the heading break (see notes for \domark). + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% + \gdef\thissection{}}% + % + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{\thischaptername}}% + \else\ifx\temptype\Yomitfromtockeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{}}% + \else\ifx\temptype\Yappendixkeyword + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\appendixletter}% + % \noexpand\putwordAppendix avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} + \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \else + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\the\chapno}% + % \noexpand\putwordChapter avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thischapter{\noexpand\putwordChapter{} + \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \fi\fi\fi + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert the chapter heading break. \pchapsepmacro + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \domark + % {% - \chapfonts \rm - \def\chapnum{#2}% - \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 \centerparametersmaybe + \chapfonts \rmisbold + % + % Have to define \lastsection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\lastsection{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. + \nobreak % Avoid page breaks at the interline glue. + \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% \nobreak\bigskip % no page break after a chapter title \nobreak } -% Plain opening for unnumbered. -\def\unnchfplain#1{\chfplain{#1}{}} - % @centerchap -- centered and unnumbered. \let\centerparametersmaybe = \relax -\def\centerchfplain#1{{% - \def\centerparametersmaybe{% - \advance\rightskip by 3\rightskip - \leftskip = \rightskip - \parfillskip = 0pt - }% - \chfplain{#1}{}% -}} +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} -\CHAPFplain % The default +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% \def\unnchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\nobreak + \chapoddpage + \vbox{\chapfonts \raggedtitlesettings #1\par}% + \nobreak\bigskip\nobreak } - \def\chfopen #1#2{\chapoddpage {\chapfonts \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% \par\penalty 5000 % } - \def\centerchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt - \hfill {\rm #1}\hfill}}\bigskip \par\nobreak + \chapoddpage + \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}% + \nobreak\bigskip \nobreak } - -\def\CHAPFopen{ -\global\let\chapmacro=\chfopen -\global\let\unnumbchapmacro=\unnchfopen -\global\let\centerchapmacro=\centerchfopen} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} -% Section titles. +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% \newskip\secheadingskip -\def\secheadingbreak{\dobreak \secheadingskip {-1000}} -\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} -\def\plainsecheading#1{\sectionheading{sec}{}{#1}} +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} % Subsection titles. -\newskip \subsecheadingskip -\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} -\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} -\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} % Subsubsection titles. -\let\subsubsecheadingskip = \subsecheadingskip -\let\subsubsecheadingbreak = \subsecheadingbreak -\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} -\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} -% Print any size section title. +% Print any size, any type, section title. % -% #1 is the section type (sec/subsec/subsubsec), #2 is the section -% number (maybe empty), #3 the text. -\def\sectionheading#1#2#3{% - {% - \expandafter\advance\csname #1headingskip\endcsname by \parskip - \csname #1headingbreak\endcsname - }% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\seckeyword{sec} +% +\def\sectionheading#1#2#3#4{% {% + \checkenv{}% should not be in an environment. + % % Switch to the right set of fonts. - \csname #1fonts\endcsname \rm + \csname #2fonts\endcsname \rmisbold % - % Only insert the separating space if we have a section number. - \def\secnum{#2}% - \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% + \def\sectionlevel{#2}% + \def\temptype{#3}% % - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 % zero if no section number - \unhbox0 #3}% + % Insert first mark before the heading break (see notes for \domark). + \let\prevsectiondefs=\lastsectiondefs + \ifx\temptype\Ynothingkeyword + \ifx\sectionlevel\seckeyword + \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% + \gdef\thissection{\thissectionname}}% + \fi + \else\ifx\temptype\Yomitfromtockeyword + % Don't redefine \thissection. + \else\ifx\temptype\Yappendixkeyword + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + % \noexpand\putwordSection avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thissection{\noexpand\putwordSection{} + \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \else + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + % \noexpand\putwordSection avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thissection{\noexpand\putwordSection{} + \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \fi\fi\fi + % + % Go into vertical mode. Usually we'll already be there, but we + % don't want the following whatsit to end up in a preceding paragraph + % if the document didn't happen to have a blank line. + \par + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert space above the heading. + \csname #2headingbreak\endcsname + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevsectiondefs=\lastsectiondefs + \domark + % + % Only insert the space after the number if we have a section number. + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\lastsection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \lastsection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\lastsection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\lastsection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chapmacro. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chapmacro. + \donoderef{#3}% + % + % Interline glue will be inserted when the vbox is completed. + % That glue will be a valid breakpoint for the page, since it'll be + % preceded by a whatsit (usually from the \donoderef, or from the + % \writetocentry if there was no node). We don't want to allow that + % break, since then the whatsits could end up on page n while the + % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. + \nobreak + % + % Output the actual section heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% }% - \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. + \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) However, when a paragraph is not started next + % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out + % or the negative glue will cause weirdly wrong output, typically + % obscuring the section heading with something else. + \vskip-\parskip + % + % This is so the last item on the main vertical list is a known + % \penalty > 10000, so \startdefun, etc., can recognize the situation + % and do the needful. + \penalty 10001 } @@ -3668,156 +5957,238 @@ width0pt\relax} \fi \newwrite\tocfile % Write an entry to the toc file, opening it if necessary. -% Called from @chapter, etc. We supply {\folio} at the end of the -% argument, which will end up as the last argument to the \...entry macro. +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. % -% We open the .toc file here instead of at @setfilename or any other -% given time so that @contents can be put in the document anywhere. +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. % \newif\iftocfileopened -\def\writetocentry#1{% - \iftocfileopened\else - \immediate\openout\tocfile = \jobname.toc - \global\tocfileopenedtrue +\def\omitkeyword{omit}% +% +\def\writetocentry#1#2#3{% + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + {\atdummies + \edef\temp{% + \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% + \temp + }% + \fi \fi - \iflinks \write\tocfile{#1{\folio}}\fi + % + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi +} + + +% These characters do not print properly in the Computer Modern roman +% fonts, so we must take special care. This is more or less redundant +% with the Texinfo input format setup at the end of this file. +% +\def\activecatcodes{% + \catcode`\"=\active + \catcode`\$=\active + \catcode`\<=\active + \catcode`\>=\active + \catcode`\\=\active + \catcode`\^=\active + \catcode`\_=\active + \catcode`\|=\active + \catcode`\~=\active +} + + +% Read the toc file, which is essentially Texinfo input. +\def\readtocfile{% + \setupdatafile + \activecatcodes + \input \tocreadfilename } \newskip\contentsrightmargin \contentsrightmargin=1in \newcount\savepageno \newcount\lastnegativepageno \lastnegativepageno = -1 -% Finish up the main text and prepare to read what we've written -% to \tocfile. +% Prepare to read what we've written to \tocfile. % \def\startcontents#1{% - % If @setchapternewpage on, and @headings double, the contents should - % start on an odd page, unlike chapters. Thus, we maintain - % \contentsalignmacro in parallel with \pagealignmacro. - % From: Torbjorn Granlund - \contentsalignmacro - \immediate\closeout\tocfile - % - % Don't need to put `Contents' or `Short Contents' in the headline. - % It is abundantly clear what they are. - \unnumbchapmacro{#1}\def\thischapter{}% - \savepageno = \pageno - \begingroup % Set up to handle contents files properly. - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 - % We can't do this, because then an actual ^ in a section - % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. - %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi - \raggedbottom % Worry more about breakpoints than the bottom. - \advance\hsize by -\contentsrightmargin % Don't use the full line length. - % - % Roman numerals for page numbers. - \ifnum \pageno>0 \pageno = \lastnegativepageno \fi + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } +% redefined for the two-volume lispref. We always output on +% \jobname.toc even if this is redefined. +% +\def\tocreadfilename{\jobname.toc} % Normal (long) toc. +% \def\contents{% - \startcontents{\putwordTOC}% - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \endgroup - \lastnegativepageno = \pageno - \pageno = \savepageno + \startcontents{\putwordTOC}% + \openin 1 \tocreadfilename\space + \ifeof 1 \else + \readtocfile + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno } % And just the chapters. \def\summarycontents{% - \startcontents{\putwordShortTOC}% - % - \let\chapentry = \shortchapentry - \let\unnumbchapentry = \shortunnumberedentry - % We want a true roman here for the page numbers. - \secfonts - \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl - \rm - \hyphenpenalty = 10000 - \advance\baselineskip by 1pt % Open it up a little. - \def\secentry ##1##2##3##4{} - \def\unnumbsecentry ##1##2{} - \def\subsecentry ##1##2##3##4##5{} - \def\unnumbsubsecentry ##1##2{} - \def\subsubsecentry ##1##2##3##4##5##6{} - \def\unnumbsubsubsecentry ##1##2{} - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \endgroup - \lastnegativepageno = \pageno - \pageno = \savepageno + \startcontents{\putwordShortTOC}% + % + \let\partentry = \shortpartentry + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \tocreadfilename\space + \ifeof 1 \else + \readtocfile + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno } \let\shortcontents = \summarycontents -\ifpdf - \pdfcatalog{/PageMode /UseOutlines}% -\fi +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. +% +\def\shortchaplabel#1{% + % This space should be enough, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% +} % These macros generate individual entries in the table of contents. % The first argument is the chapter or section name. % The last argument is the page number. % The arguments in between are the chapter number, section number, ... -% Chapter-level things, for both the long and short contents. -\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} - -% See comments in \dochapentry re vbox and related settings -\def\shortchapentry#1#2#3{% - \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}% +% Parts, in the main contents. Replace the part number, which doesn't +% exist, with an empty box. Let's hope all the numbers have the same width. +% Also ignore the page number, which is conventionally not printed. +\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} +\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}} +% +% Parts, in the short toc. +\def\shortpartentry#1#2#3#4{% + \penalty-300 + \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip + \shortchapentry{{\bf #1}}{\numeralbox}{}{}% } -% Typeset the label for a chapter or appendix for the short contents. -% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter. -% We could simplify the code here by writing out an \appendixentry -% command in the toc file for appendices, instead of using \chapentry -% for both, but it doesn't seem worth it. -\setbox0 = \hbox{\shortcontrm \putwordAppendix } -\newdimen\shortappendixwidth \shortappendixwidth = \wd0 - -\def\shortchaplabel#1{% - % We typeset #1 in a box of constant width, regardless of the text of - % #1, so the chapter titles will come out aligned. - \setbox0 = \hbox{#1}% - \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi - % - % This space should be plenty, since a single number is .5em, and the - % widest letter (M) is 1em, at least in the Computer Modern fonts. - % (This space doesn't include the extra space that gets added after - % the label; that gets put in by \shortchapentry above.) - \advance\dimen0 by 1.1em - \hbox to \dimen0{#1\hfil}% +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% } -\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} -\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}} +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} + +% Unnumbered chapters. +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} % Sections. -\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} -\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}} +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} % Subsections. -\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} -\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}} +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} % And subsubsections. -\def\subsubsecentry#1#2#3#4#5#6{% - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} -\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}} +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} % This parameter controls the indentation of the various levels. -\newdimen\tocindent \tocindent = 3pc +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt % Now for the actual typesetting. In all these, #1 is the text and #2 is the % page number. @@ -3828,37 +6199,28 @@ width0pt\relax} \fi \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip \begingroup \chapentryfonts - \tocentry{#1}{\dopageno{#2}}% + \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup \nobreak\vskip .25\baselineskip plus.1\baselineskip } \def\dosecentry#1#2{\begingroup \secentryfonts \leftskip=\tocindent - \tocentry{#1}{\dopageno{#2}}% + \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsecentry#1#2{\begingroup \subsecentryfonts \leftskip=2\tocindent - \tocentry{#1}{\dopageno{#2}}% + \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsubsecentry#1#2{\begingroup \subsubsecentryfonts \leftskip=3\tocindent - \tocentry{#1}{\dopageno{#2}}% + \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} -% Final typesetting of a toc entry; we use the same \entry macro as for -% the index entries, but we want to suppress hyphenation here. (We -% can't do that in the \entry macro, since index entries might consist -% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) -\def\tocentry#1#2{\begingroup - \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks - % Do not use \turnoffactive in these arguments. Since the toc is - % typeset in cmr, so characters such as _ would come out wrong; we - % have to do the usual translation tricks. - \entry{#1}{#2}% -\endgroup} +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry % Space between chapter (or whatever) number and the title. \def\labelspace{\hskip1em \relax} @@ -3868,74 +6230,36 @@ width0pt\relax} \fi \def\chapentryfonts{\secfonts \rm} \def\secentryfonts{\textfonts} -\let\subsecentryfonts = \textfonts -\let\subsubsecentryfonts = \textfonts +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} \message{environments,} % @foo ... @end foo. -% Since these characters are used in examples, it should be an even number of -% \tt widths. Each \tt character is 1en, so two makes it 1em. -% Furthermore, these definitions must come after we define our fonts. -\newbox\dblarrowbox \newbox\longdblarrowbox -\newbox\pushcharbox \newbox\bullbox -\newbox\equivbox \newbox\errorbox - -%{\tentt -%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil} -%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil} -%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil} -%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil} -% Adapted from the manmac format (p.420 of TeXbook) -%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex -% depth .1ex\hfil} -%} - -% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. -\def\point{$\star$} -\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} -\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} -\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} -\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} - -% Adapted from the TeXbook's \boxit. -{\tentt \global\dimen0 = 3em}% Width of the box. -\dimen2 = .55pt % Thickness of rules -% The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} - -\global\setbox\errorbox=\hbox to \dimen0{\hfil - \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. - \advance\hsize by -2\dimen2 % Rules. - \vbox{ - \hrule height\dimen2 - \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. - \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. - \kern3pt\vrule width\dimen2}% Space to right. - \hrule height\dimen2} - \hfil} - -% The @error{} command. -\def\error{\leavevmode\lower.7ex\copy\errorbox} - -% @tex ... @end tex escapes into raw Tex temporarily. +% @tex ... @end tex escapes into raw TeX temporarily. % One exception: @ is still an escape character, so that @end tex works. -% But \@ or @@ will get a plain tex @ character. +% But \@ or @@ will get a plain @ character. -\def\tex{\begingroup +\envdef\tex{% + \setupmarkupstyle{tex}% \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 - \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie \catcode `\%=14 - \catcode 43=12 % plus - \catcode`\"=12 - \catcode`\==12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other + \catcode`\`=\other + \catcode`\'=\other \escapechar=`\\ % + % ' is active in math mode (mathcode"8000). So reset it, and all our + % other math active characters (just in case), to plain's definitions. + \mathactive + % \let\b=\ptexb \let\bullet=\ptexbullet \let\c=\ptexc @@ -3945,20 +6269,26 @@ width0pt\relax} \fi \let\equiv=\ptexequiv \let\!=\ptexexclam \let\i=\ptexi + \let\indent=\ptexindent + \let\noindent=\ptexnoindent \let\{=\ptexlbrace \let\+=\tabalign \let\}=\ptexrbrace + \let\/=\ptexslash \let\*=\ptexstar \let\t=\ptext + \expandafter \let\csname top\endcsname=\ptextop % outer + \let\frenchspacing=\plainfrenchspacing % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% \def\@{@}% -\let\Etex=\endgroup} +} +% There is no need to define \Etex. -% Define @lisp ... @endlisp. -% @lisp does a \begingroup so it can rebind things, -% including the definition of @endlisp (which normally is erroneous). +% Define @lisp ... @end lisp. +% @lisp environment forms a group so it can rebind things, +% including the definition of @end lisp (which normally is erroneous). % Amount to narrow the margins by for @lisp. \newskip\lispnarrowing \lispnarrowing=0.4in @@ -3968,34 +6298,34 @@ width0pt\relax} \fi % have any width. \def\lisppar{\null\endgraf} -% Make each space character in the input produce a normal interword -% space in the output. Don't allow a line break at this space, as this -% is used only in environments like @example, where each line of input -% should produce a line of output anyway. -% -{\obeyspaces % -\gdef\sepspaces{\obeyspaces\let =\tie}} - -% Define \obeyedspace to be our active space, whatever it is. This is -% for use in \parsearg. -{\sepspaces% -\global\let\obeyedspace= } - % This space is always present above and below environments. \newskip\envskipamount \envskipamount = 0pt % Make spacing and below environment symmetrical. We use \parskip here % to help in doing that, since in @example-like environments \parskip % is reset to zero; thus the \afterenvbreak inserts no space -- but the -% start of the next paragraph will insert \parskip -% -\def\aboveenvbreak{{\advance\envskipamount by \parskip -\endgraf \ifdim\lastskip<\envskipamount -\removelastskip \penalty-50 \vskip\envskipamount \fi}} +% start of the next paragraph will insert \parskip. +% +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty<10000 \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} \let\afterenvbreak = \aboveenvbreak -% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will +% also clear it, so that its embedded environments do the narrowing again. \let\nonarrowing=\relax % @cartouche ... @end cartouche: draw rectangle w/rounded corners around @@ -4019,705 +6349,843 @@ width0pt\relax} \fi % \newskip\lskip\newskip\rskip -\long\def\cartouche{% -\begingroup - \lskip=\leftskip \rskip=\rightskip - \leftskip=0pt\rightskip=0pt %we want these *outside*. - \cartinner=\hsize \advance\cartinner by-\lskip - \advance\cartinner by-\rskip - \cartouter=\hsize - \advance\cartouter by 18.4pt % allow for 3pt kerns on either -% side, and for 6pt waste from -% each corner char, and rule thickness - \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip - % Flag to tell @lisp, etc., not to narrow margin. - \let\nonarrowing=\comment - \vbox\bgroup - \baselineskip=0pt\parskip=0pt\lineskip=0pt - \carttop - \hbox\bgroup - \hskip\lskip - \vrule\kern3pt - \vbox\bgroup - \hsize=\cartinner - \kern3pt - \begingroup - \baselineskip=\normbskip - \lineskip=\normlskip - \parskip=\normpskip - \vskip -\parskip +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing = t% + % + % If this cartouche directly follows a sectioning command, we need the + % \parskip glue (backspaced over by default) or the cartouche can + % collide with the section heading. + \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi + % + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of def\group. +} \def\Ecartouche{% - \endgroup - \kern3pt - \egroup - \kern3pt\vrule - \hskip\rskip - \egroup - \cartbot - \egroup -\endgroup -}} + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} % This macro is called at the beginning of all the @example variants, % inside a group. +\newdimen\nonfillparindent \def\nonfillstart{% \aboveenvbreak - \inENV % This group ends at the end of the body \hfuzz = 12pt % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. - \singlespace \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt + % Turn off paragraph indentation but redefine \indent to emulate + % the normal \indent. + \nonfillparindent=\parindent \parindent = 0pt + \let\indent\nonfillindent + % \emergencystretch = 0pt % don't try to avoid overfull boxes - % @cartouche defines \nonarrowing to inhibit narrowing - % at next level down. \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing \exdentamount=\lispnarrowing - \let\exdent=\nofillexdent - \let\nonarrowing=\relax + \else + \let\nonarrowing = \relax \fi + \let\exdent=\nofillexdent } -% Define the \E... control sequence only if we are inside the particular -% environment, so the error checking in \end will work. -% -% To end an @example-like environment, we first end the paragraph (via -% \afterenvbreak's vertical glue), and then the group. That way we keep -% the zero \parskip that the environments set -- \parskip glue will be -% inserted at the beginning of the next paragraph in the document, after -% the environment. -% -\def\nonfillfinish{\afterenvbreak\endgroup} - -% @lisp: indented, narrowed, typewriter font. -\def\lisp{\begingroup - \nonfillstart - \let\Elisp = \nonfillfinish - \tt - \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. - \gobble % eat return +\begingroup +\obeyspaces +% We want to swallow spaces (but not other tokens) after the fake +% @indent in our nonfill-environments, where spaces are normally +% active and set to @tie, resulting in them not being ignored after +% @indent. +\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% +\gdef\nonfillindentcheck{% +\ifx\temp % +\expandafter\nonfillindentgobble% +\else% +\leavevmode\nonfillindentbox% +\fi% +}% +\endgroup +\def\nonfillindentgobble#1{\nonfillindent} +\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + % end paragraph for sake of leading, in case document has no blank + % line. This is redundant with what happens in \aboveenvbreak, but + % we need to do it before changing the fonts, and it's inconvenient + % to change the fonts afterward. + \ifnum \lastpenalty=10000 \else \endgraf \fi + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \ifnum \lastpenalty=10000 \else \endgraf \fi + \smallexamplefonts \rm + \fi } -% @example: Same as @lisp. -\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} +% We often define two environments, @foo and @smallfoo. +% Let's do it in one command. #1 is the env name, #2 the definition. +\def\makedispenvdef#1#2{% + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} -% @small... is usually equivalent to the non-small (@smallbook -% redefines). We must call \example (or whatever) last in the -% definition, since it reads the return following the @example (or -% whatever) command. +% Define two environment synonyms (#1 and #2) for an environment. +\def\maketwodispenvdef#1#2#3{% + \makedispenvdef{#1}{#3}% + \makedispenvdef{#2}{#3}% +} % -% This actually allows (for example) @end display inside an -% @smalldisplay. Too bad, but makeinfo will catch the error anyway. +% @lisp: indented, narrowed, typewriter font; +% @example: same as @lisp. % -\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display} -\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp} -\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format} -\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp} - -% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts. +% @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel@xerox. -\def\smalllispx{\begingroup - \def\Esmalllisp{\nonfillfinish\endgroup}% - \def\Esmallexample{\nonfillfinish\endgroup}% - \indexfonts - \lisp +% +\maketwodispenvdef{lisp}{example}{% + \nonfillstart + \tt\setupmarkupstyle{example}% + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return } - -% @display: same as @lisp except keep current font. +% @display/@smalldisplay: same as @lisp except keep current font. % -\def\display{\begingroup +\makedispenvdef{display}{% \nonfillstart - \let\Edisplay = \nonfillfinish \gobble } -% @smalldisplay (when @smallbook): @display plus smaller fonts. +% @format/@smallformat: same as @display except don't narrow margins. % -\def\smalldisplayx{\begingroup - \def\Esmalldisplay{\nonfillfinish\endgroup}% - \indexfonts \rm - \display +\makedispenvdef{format}{% + \let\nonarrowing = t% + \nonfillstart + \gobble } -% @format: same as @display except don't narrow margins. -% -\def\format{\begingroup - \let\nonarrowing = t +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% \nonfillstart - \let\Eformat = \nonfillfinish \gobble } +\let\Eflushleft = \afterenvbreak -% @smallformat (when @smallbook): @format plus smaller fonts. +% @flushright. % -\def\smallformatx{\begingroup - \def\Esmallformat{\nonfillfinish\endgroup}% - \indexfonts \rm - \format +\envdef\flushright{% + \let\nonarrowing = t% + \nonfillstart + \advance\leftskip by 0pt plus 1fill\relax + \gobble +} +\let\Eflushright = \afterenvbreak + + +% @raggedright does more-or-less normal line breaking but no right +% justification. From plain.tex. +\envdef\raggedright{% + \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax +} +\let\Eraggedright\par + +\envdef\raggedleft{% + \parindent=0pt \leftskip0pt plus2em + \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt + \hbadness=10000 % Last line will usually be underfull, so turn off + % badness reporting. } +\let\Eraggedleft\par -% @flushleft (same as @format). +\envdef\raggedcenter{% + \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em + \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt + \hbadness=10000 % Last line will usually be underfull, so turn off + % badness reporting. +} +\let\Eraggedcenter\par + + +% @quotation does normal linebreaking (hence we can't use \nonfillstart) +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. % -\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format} +\makedispenvdef{quotation}{\quotationstart} +% +\def\quotationstart{% + \indentedblockstart % same as \indentedblock, but increase right margin too. + \ifx\nonarrowing\relax + \advance\rightskip by \lispnarrowing + \fi + \parsearg\quotationlabel +} -% @flushright. +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. % -\def\flushright{\begingroup - \let\nonarrowing = t - \nonfillstart - \let\Eflushright = \nonfillfinish - \advance\leftskip by 0pt plus 1fill - \gobble +\def\Equotation{% + \par + \ifx\quotationauthor\thisisundefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% } +\def\Esmallquotation{\Equotation} -% @quotation does normal linebreaking (hence we can't use \nonfillstart) -% and narrows the margins. +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi +} + +% @indentedblock is like @quotation, but indents only on the left and +% has no optional argument. +% +\makedispenvdef{indentedblock}{\indentedblockstart} % -\def\quotation{% - \begingroup\inENV %This group ends at the end of the @quotation body +\def\indentedblockstart{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip - \singlespace \parindent=0pt - % We have retained a nonzero parskip for the environment, since we're - % doing normal filling. So to avoid extra space below the environment... - \def\Equotation{\parskip = 0pt \nonfillfinish}% % % @cartouche defines \nonarrowing to inhibit narrowing at next level down. \ifx\nonarrowing\relax \advance\leftskip by \lispnarrowing - \advance\rightskip by \lispnarrowing \exdentamount = \lispnarrowing + \else \let\nonarrowing = \relax \fi } +% Keep a nonzero parskip for the environment, since we're doing normal filling. +% +\def\Eindentedblock{% + \par + {\parskip=0pt \afterenvbreak}% +} +\def\Esmallindentedblock{\Eindentedblock} -\message{defuns,} -% @defun etc. - -% Allow user to change definition object font (\df) internally -\def\setdeffont #1 {\csname DEF#1\endcsname} - -\newskip\defbodyindent \defbodyindent=.4in -\newskip\defargsindent \defargsindent=50pt -\newskip\deftypemargin \deftypemargin=12pt -\newskip\deflastargmargin \deflastargmargin=18pt - -\newcount\parencount -% define \functionparens, which makes ( and ) and & do special things. -% \functionparens affects the group it is contained in. -\def\activeparens{% -\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active -\catcode`\[=\active \catcode`\]=\active} - -% Make control sequences which act like normal parenthesis chars. -\let\lparen = ( \let\rparen = ) - -{\activeparens % Now, smart parens don't turn on until &foo (see \amprm) -% Be sure that we always have a definition for `(', etc. For example, -% if the fn name has parens in it, \boldbrax will not be in effect yet, -% so TeX would otherwise complain about undefined control sequence. -\global\let(=\lparen \global\let)=\rparen -\global\let[=\lbrack \global\let]=\rbrack - -\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } -\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} -% This is used to turn on special parens -% but make & act ordinary (given that it's active). -\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} - -% Definitions of (, ) and & used in args for functions. -% This is the definition of ( outside of all parentheses. -\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested - \global\advance\parencount by 1 +% LaTeX-like @verbatim...@end verbatim and @verb{...} +% If we want to allow any as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% + % Don't do the quotes -- if we do, @set txicodequoteundirected and + % @set txicodequotebacktick will not have effect on @verb and + % @verbatim, and ?` and !` ligatures won't get disabled. + %\do\`\do\'% } % -% This is the definition of ( when already inside a level of parens. -\gdef\opnested{\char`\(\global\advance\parencount by 1 } +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=\other}\dospecials} % -\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. - % also in that case restore the outer-level definition of (. - \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi - \global\advance \parencount by -1 } -% If we encounter &foo, then turn on ()-hacking afterwards -\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } -% -\gdef\normalparens{\boldbrax\let&=\ampnr} -} % End of definition inside \activeparens -%% These parens (in \boldbrax) actually are a little bolder than the -%% contained text. This is especially needed for [ and ] -\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } -\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } -\let\ampnr = \& -\def\lbrb{{\bf\char`\[}} -\def\rbrb{{\bf\char`\]}} - -% Active &'s sneak into the index arguments, so make sure it's defined. -{ - \catcode`& = 13 - \global\let& = \ampnr -} - -% First, defname, which formats the header line itself. -% #1 should be the function name. -% #2 should be the type of definition, such as "Function". - -\def\defname #1#2{% -% Get the values of \leftskip and \rightskip as they were -% outside the @def... -\dimen2=\leftskip -\advance\dimen2 by -\defbodyindent -\noindent -\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% -\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations -\parshape 2 0in \dimen0 \defargsindent \dimen1 -% Now output arg 2 ("Function" or some such) -% ending at \deftypemargin from the right margin, -% but stuck inside a box of width 0 so it does not interfere with linebreaking -{% Adjust \hsize to exclude the ambient margins, -% so that \rightline will obey them. -\advance \hsize by -\dimen2 -\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}% -% Make all lines underfull and no complaints: -\tolerance=10000 \hbadness=10000 -\advance\leftskip by -\defbodyindent -\exdentamount=\defbodyindent -{\df #1}\enskip % Generate function name -} - -% Actually process the body of a definition -% #1 should be the terminating control sequence, such as \Edefun. -% #2 should be the "another name" control sequence, such as \defunx. -% #3 should be the control sequence that actually processes the header, -% such as \defunheader. - -\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\activeparens\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % 61 is `=' -\obeylines\activeparens\spacesplit#3} - -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence for consecutive fns (which we define). -% #3 is the control sequence to call to resume processing. -% #4, delimited by the space, is the class name. -% -\def\defmethparsebody#1#2#3#4 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#4}}} - -% @deftypemethod has an extra argument that nothing else does. Sigh. -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence for consecutive fns (which we define). -% #3 is the control sequence to call to resume processing. -% #4, delimited by the space, is the class name. -% #5 is the method's return type. -% -\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} - -\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#5}}} - -% These parsing functions are similar to the preceding ones -% except that they do not make parens into active characters. -% These are used for "variables" since they have no arguments. - -\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % -\obeylines\spacesplit#3} - -% This is used for \def{tp,vr}parsebody. It could probably be used for -% some of the others, too, with some judicious conditionals. -% -\def\parsebodycommon#1#2#3{% - \begingroup\inENV % - \medbreak % - % Define the end token that this defining construct specifies - % so that it will exit this group. - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \setupmarkupstyle{verb}% + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces } -\def\defvrparsebody#1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \spacesplit{#3{#4}}% -} +% Setup for the @verbatim environment +% +% Real tab expansion. +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +% We typeset each line of the verbatim in an \hbox, so we can handle +% tabs. The \global is in case the verbatim line starts with an accent, +% or some other command that starts with a begin-group. Otherwise, the +% entire \verbbox would disappear at the corresponding end-group, before +% it is typeset. Meanwhile, we can't have nested verbatim commands +% (can we?), so the \global won't be overwriting itself. +\newbox\verbbox +\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} +% +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab + \divide\dimen\verbbox by\tabw + \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw + \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw + \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox + }% + } +\endgroup -% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the -% type is just `struct', because we lose the braces in `{struct -% termios}' when \spacesplit reads its undelimited argument. Sigh. -% \let\deftpparsebody=\defvrparsebody +% start the verbatim environment. +\def\setupverbatim{% + \let\nonarrowing = t% + \nonfillstart + \tt % easiest (and conventionally used) font for verbatim + % The \leavevmode here is for blank lines. Otherwise, we would + % never \starttabox and the \egroup would end verbatim mode. + \def\par{\leavevmode\egroup\box\verbbox\endgraf}% + \tabexpand + \setupmarkupstyle{verbatim}% + % Respect line breaks, + % print special symbols as themselves, and + % make each space count. + % Must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'#1'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: % -% So, to get around this, we put \empty in with the type name. That -% way, TeX won't find exactly `{...}' as an undelimited argument, and -% won't strip off the braces. +% \def\doverbatim#1@end verbatim{#1} % -\def\deftpparsebody #1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \spacesplit{\parsetpheaderline{#3{#4}}}\empty +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. +\endgroup +% +\envdef\verbatim{% + \setupverbatim\doverbatim } +\let\Everbatim = \afterenvbreak + -% Fine, but then we have to eventually remove the \empty *and* the -% braces (if any). That's what this does. +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} % -\def\removeemptybraces\empty#1\relax{#1} +\def\doverbatiminclude#1{% + {% + \makevalueexpandable + \setupverbatim + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% + \input #1 + \afterenvbreak + }% +} -% After \spacesplit has done its work, this is called -- #1 is the final -% thing to call, #2 the type name (which starts with \empty), and #3 -% (which might be empty) the arguments. +% @copying ... @end copying. +% Save the text away for @insertcopying later. % -\def\parsetpheaderline#1#2#3{% - #1{\removeemptybraces#2\relax}{#3}% -}% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} +\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} +% +\def\insertcopying{% + \begingroup + \parindent = 0pt % paragraph indentation looks wrong on title page + \scanexp\copyingtext + \endgroup +} -\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\spacesplit{#3{#5}}} -% Split up #2 at the first space token. -% call #1 with two arguments: -% the first is all of #2 before the space token, -% the second is all of #2 after that space token. -% If #2 contains no space token, all of it is passed as the first arg -% and the second is passed as empty. +\message{defuns,} +% @defun etc. -{\obeylines -\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% -\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% -\ifx\relax #3% -#1{#2}{}\else #1{#2}{#3#4}\fi}} +\newskip\defbodyindent \defbodyindent=.4in +\newskip\defargsindent \defargsindent=50pt +\newskip\deflastargmargin \deflastargmargin=18pt +\newcount\defunpenalty + +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak + \defunpenalty=10003 % Will keep this @deffn together with the + % following @def command, see below. + \else + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check specifically for penalty 10002, inserted + % by \printdefunline, instead of 10000, since the sectioning + % commands also insert a nobreak penalty, and we don't want to allow + % a break between a section heading and a defun. + % + % As a further refinement, we avoid "club" headers by signalling + % with penalty of 10003 after the very first @deffn in the + % sequence (see above), and penalty of 10002 after any following + % @def command. + \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint + \fi + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} -% So much for the things common to all kinds of definitions. +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% + % + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% +} +\def\gobbledefun#1\startdefun{} -% Define @defun. +% \printdefunline \deffnheader{text} +% +\def\printdefunline#1#2{% + \begingroup + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil\relax + \endgraf + \nobreak\vskip -\parskip + \penalty\defunpenalty % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts + \endgroup +} -% First, define the processing that is wanted for arguments of \defun -% Use this to expand the args and terminate the paragraph they make up +\def\Edefun{\endgraf\medbreak} -\def\defunargs#1{\functionparens \sl -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Set the font temporarily and use \font in case \setfont made \tensl a macro. -{\tensl\hyphenchar\font=0}% -#1% -{\tensl\hyphenchar\font=45}% -\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remaining is to define \deffnheader. +% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp } -\def\deftypefunargs #1{% -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Use \boldbraxnoamp, not \functionparens, so that & is not special. -\boldbraxnoamp -\tclose{#1}% avoid \code because of side effects on active chars -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak +% \domakedefun \deffn \deffnx \deffnheader +% +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. +% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \doingtypefnfalse % distinguish typed functions from all else + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% } -% Do complete processing of one @defun or @defunx line already parsed. +\newif\ifdoingtypefn % doing typed function? +\newif\ifrettypeownline % typeset return type on its own line? -% @deffn Command forward-char nchars +% @deftypefnnewline on|off says whether the return type of typed functions +% are printed on their own line. This affects @deftypefn, @deftypefun, +% @deftypeop, and @deftypemethod. +% +\parseargdef\deftypefnnewline{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @txideftypefnnl value `\temp', + must be on|off}% + \fi\fi +} -\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} +% Untyped functions: -\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% -\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} -% @defun == @deffn Function +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} -\def\defun{\defparsebody\Edefun\defunx\defunheader} +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } -\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDeffunc}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +% \deffngeneral {subind}category name args +% +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% } -% @deftypefun int foobar (int @var{foo}, float @var{bar}) +% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} -\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } -% #1 is the data type. #2 is the name and args. -\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} -% #1 is the data type, #2 the name, #3 the args. -\def\deftypefunheaderx #1#2 #3\relax{% -\doind {fn}{\code{#2}}% Make entry in function index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}% -\deftypefunargs {#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +% \deftypefngeneral {subind}category type name args +% +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \doingtypefntrue + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } -% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) +% Typed variables: -\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} -% \defheaderxcond#1\relax$$$ -% puts #1 in @code, followed by a space, but does nothing if #1 is null. -\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi} +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} -% #1 is the classification. #2 is the data type. #3 is the name and args. -\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} -% #1 is the classification, #2 the data type, #3 the name, #4 the args. -\def\deftypefnheaderx #1#2#3 #4\relax{% -\doind {fn}{\code{#3}}% Make entry in function index -\begingroup -\normalparens % notably, turn off `&' magic, which prevents -% at least some C++ text from working -\defname {\defheaderxcond#2\relax$$$#3}{#1}% -\deftypefunargs {#4}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args +% +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } -% @defmac == @deffn Macro +% Untyped variables: -\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } -\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDefmac}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} -% @defspec == @deffn Special Form +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } -\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} +% Types: -\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDefspec}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% } -% @defop CATEGORY CLASS OPERATION ARG... -% -\def\defop #1 {\def\defoptype{#1}% -\defopparsebody\Edefop\defopx\defopheader\defoptype} -% -\def\defopheader #1#2#3{% -\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index -\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}% -\defunargs {#3}\endgroup % -} +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} -% @deftypemethod CLASS RETURN-TYPE METHOD ARG... +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. % -\def\deftypemethod{% - \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} +% We are followed by (but not passed) the arguments, if any. % -% #1 is the class name, #2 the data type, #3 the method name, #4 the args. -\def\deftypemethodheader#1#2#3#4{% - \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}% - \deftypefunargs{#4}% - \endgroup +\def\defname#1#2#3{% + \par + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % Determine if we are typesetting the return type of a typed function + % on a line by itself. + \rettypeownlinefalse + \ifdoingtypefn % doing a typed function specifically? + % then check user option for putting return type on its own line: + \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else + \rettypeownlinetrue + \fi + \fi + % + % How we'll format the category name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. We'll always have at + % least two. + \tempnum = 2 + % + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % + % If doing a return type on its own line, we'll have another line. + \ifrettypeownline + \advance\tempnum by 1 + \def\maybeshapeline{0in \hsize}% + \else + \def\maybeshapeline{}% + \fi + % + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % + % The final paragraph shape: + \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 + % + % Put the category name at the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% text of the return type + \ifx\temp\empty\else + \tclose{\temp}% typeset the return type + \ifrettypeownline + % put return type on its own line; prohibit line break following: + \hfil\vadjust{\nobreak}\break + \else + \space % type on same line, so just followed by a space + \fi + \fi % no return type + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. } -% @deftypeivar CLASS TYPE VARNAME +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. % -\def\deftypeivar{% - \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader} -% -% #1 is the class name, #2 the data type, #3 the variable name. -\def\deftypeivarheader#1#2#3{% - \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index - \begingroup - \defname{#3}{\putwordInstanceVariableof\ \code{#1}}% - \defvarargs{#3}% - \endgroup +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. We used to recommend @var for that, so + % leave the code in, but it's strange for @var to lead to typewriter. + % Nowadays we recommend @code, since the difference between a ttsl hyphen + % and a tt hyphen is pretty tiny. @code also disables ?` !`. + \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% + #1% + \sl\hyphenchar\font=45 } -% @defmethod == @defop Method -% -\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} +% We want ()&[] to print specially on the defun line. % -% #1 is the class name, #2 the method name, #3 the args. -\def\defmethodheader#1#2#3{% - \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{#2}{\putwordMethodon\ \code{#1}}% - \defunargs{#3}% - \endgroup +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active } -% @defcv {Class Option} foo-class foo-flag +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) -\def\defcv #1 {\def\defcvtype{#1}% -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& -\def\defcvarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index -\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}% -\defvarargs {#3}\endgroup % + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} } -% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME -% -\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} -% -\def\defivarheader#1#2#3{% - \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index - \begingroup - \defname{#2}{\putwordInstanceVariableof\ #1}% - \defvarargs{#3}% - \endgroup -} - -% @defvar -% First, define the processing that is wanted for arguments of @defvar. -% This is actually simple: just print them in roman. -% This must expand the args and terminate the paragraph they make up -\def\defvarargs #1{\normalparens #1% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak} - -% @defvr Counter foo-count - -\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} - -\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% -\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} - -% @defvar == @defvr Variable - -\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} +\newcount\parencount -\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{\putwordDefvar}% -\defvarargs {#2}\endgroup % +% If we encounter &foo, then turn on ()-hacking afterwards +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} + +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi } - -% @defopt == @defvr {User Option} - -\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} - -\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{\putwordDefopt}% -\defvarargs {#2}\endgroup % +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi } +\def\bfafterword#1 {#1 \bf} -% @deftypevar int foobar - -\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} - -% #1 is the data type. #2 is the name, perhaps followed by text that -% is actually part of the data type, which should not be put into the index. -\def\deftypevarheader #1#2{% -\dovarind#2 \relax% Make entry in variables index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak -\endgroup} -\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} - -% @deftypevr {Global Flag} int enable - -\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} - -\def\deftypevrheader #1#2#3{\dovarind#3 \relax% -\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1} -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak -\endgroup} - -% Now define @deftp -% Args are printed in bold, a slight difference from @defvar. - -\def\deftpargs #1{\bf \defvarargs{#1}} - -% @deftp Class window height width ... - -\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} -\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% -\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} -% These definitions are used if you use @defunx (etc.) -% anywhere other than immediately after a @defun or @defunx. -% -\def\defcvx#1 {\errmessage{@defcvx in invalid context}} -\def\deffnx#1 {\errmessage{@deffnx in invalid context}} -\def\defivarx#1 {\errmessage{@defivarx in invalid context}} -\def\defmacx#1 {\errmessage{@defmacx in invalid context}} -\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}} -\def\defoptx #1 {\errmessage{@defoptx in invalid context}} -\def\defopx#1 {\errmessage{@defopx in invalid context}} -\def\defspecx#1 {\errmessage{@defspecx in invalid context}} -\def\deftpx#1 {\errmessage{@deftpx in invalid context}} -\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}} -\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}} -\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}} -\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}} -\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}} -\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}} -\def\defunx#1 {\errmessage{@defunx in invalid context}} -\def\defvarx#1 {\errmessage{@defvarx in invalid context}} -\def\defvrx#1 {\errmessage{@defvrx in invalid context}} +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi +} +% these should not use \errmessage; the glibc manual, at least, actually +% has such constructs (when documenting function pointers). +\def\badparencount{% + \message{Warning: unbalanced parentheses in @def...}% + \global\parencount=0 +} +\def\badbrackcount{% + \message{Warning: unbalanced square brackets in @def...}% + \global\brackcount=0 +} \message{macros,} @@ -4725,43 +7193,74 @@ width0pt\relax} \fi % To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. -\ifx\eTeXversion\undefined - \newwrite\macscribble - \def\scanmacro#1{% - \begingroup \newlinechar`\^^M - % Undo catcode changes of \startcontents and \doprintindex - \catcode`\@=0 \catcode`\\=12 \escapechar=`\@ - % Append \endinput to make sure that TeX does not see the ending newline. - \toks0={#1\endinput}% - \immediate\openout\macscribble=\jobname.tmp - \immediate\write\macscribble{\the\toks0}% - \immediate\closeout\macscribble - \let\xeatspaces\eatspaces - \input \jobname.tmp - \endgroup -} -\else -\def\scanmacro#1{% -\begingroup \newlinechar`\^^M -% Undo catcode changes of \startcontents and \doprintindex -\catcode`\@=0 \catcode`\\=12 \escapechar=`\@ -\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} +\ifx\eTeXversion\thisisundefined + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } \fi +\def\scanmacro#1{\begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % + % ... and for \example: + \spaceisspace + % + % The \empty here causes a following catcode 5 newline to be eaten as + % part of reading whitespace after a control sequence. It does not + % eat a catcode 13 newline. There's no good way to handle the two + % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX + % would then have different behavior). See the Macro Details node in + % the manual for the workaround we recommend for macros and + % line-oriented commands. + % + \scantokens{#1\empty}% +\endgroup} + +\def\scanexp#1{% + \edef\temp{\noexpand\scanmacro{#1}}% + \temp +} + \newcount\paramno % Count of parameters \newtoks\macname % Macro name \newif\ifrecursive % Is it recursive? -\def\macrolist{} % List of all defined macros in the form - % \do\macro1\do\macro2... + +% List of all defined macros in the form +% \definedummyword\macro1\definedummyword\macro2... +% Currently is also contains all @aliases; the list can be split +% if there is a need. +\def\macrolist{} + +% Add the macro to \macrolist +\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} +\def\addtomacrolistxxx#1{% + \toks0 = \expandafter{\macrolist\definedummyword#1}% + \xdef\macrolist{\the\toks0}% +} % Utility routines. -% Thisdoes \let #1 = #2, except with \csnames. +% This does \let #1 = #2, with \csnames; that is, +% \let \csname#1\endcsname = \csname#2\endcsname +% (except of course we have to play expansion games). +% \def\cslet#1#2{% -\expandafter\expandafter -\expandafter\let -\expandafter\expandafter -\csname#1\endcsname -\csname#2\endcsname} + \expandafter\let + \csname#1\expandafter\endcsname + \csname#2\endcsname +} % Trim leading and trailing spaces off a string. % Concepts from aro-bend problem 15 (see CTAN). @@ -4774,7 +7273,7 @@ width0pt\relax} \fi } % Trim a single trailing ^^M off a string. -{\catcode`\^^M=12\catcode`\Q=3% +{\catcode`\^^M=\other \catcode`\Q=3% \gdef\eatcr #1{\eatcra #1Q^^MQ}% \gdef\eatcra#1^^MQ{\eatcrb#1Q}% \gdef\eatcrb#1Q#2Q{#1}% @@ -4782,147 +7281,403 @@ width0pt\relax} \fi % Macro bodies are absorbed as an argument in a context where % all characters are catcode 10, 11 or 12, except \ which is active -% (as in normal texinfo). It is necessary to change the definition of \. - +% (as in normal texinfo). It is necessary to change the definition of \ +% to recognize macro arguments; this is the job of \mbodybackslash. +% +% Non-ASCII encodings make 8-bit characters active, so un-activate +% them to avoid their expansion. Must do this non-globally, to +% confine the change to the current group. +% % It's necessary to have hard CRs when the macro is executed. This is -% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. +% +\def\scanctxt{% used as subroutine + \catcode`\"=\other + \catcode`\+=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\@=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\~=\other + \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi +} + +\def\scanargctxt{% used for copying and captions, not macros. + \scanctxt + \catcode`\\=\other + \catcode`\^^M=\other +} + +\def\macrobodyctxt{% used for @macro definitions + \scanctxt + \catcode`\{=\other + \catcode`\}=\other + \catcode`\^^M=\other + \usembodybackslash +} + +\def\macroargctxt{% used when scanning invocations + \scanctxt + \catcode`\\=0 +} +% why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" +% for the single characters \ { }. Thus, we end up with the "commands" +% that would be written @\ @{ @} in a Texinfo document. +% +% We already have @{ and @}. For @\, we define it here, and only for +% this purpose, to produce a typewriter backslash (so, the @\ that we +% define for @math can't be used with @macro calls): +% +\def\\{\normalbackslash}% +% +% We would like to do this for \, too, since that is what makeinfo does. +% But it is not possible, because Texinfo already has a command @, for a +% cedilla accent. Documents must use @comma{} instead. +% +% \anythingelse will almost certainly be an error of some kind. -\def\macrobodyctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\{=12 - \catcode`\}=12 - \catcode`\@=12 - \catcode`\^^M=12 - \usembodybackslash} - -\def\macroargctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\@=12 - \catcode`\\=12} % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N % where N is the macro parameter number. % We define \csname macarg.\endcsname to be \realbackslash, so % \\ in macro replacement text gets you a backslash. - +% {\catcode`@=0 @catcode`@\=@active @gdef@usembodybackslash{@let\=@mbodybackslash} @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} } \expandafter\def\csname macarg.\endcsname{\realbackslash} +\def\margbackslash#1{\char`\#1 } + \def\macro{\recursivefalse\parsearg\macroxxx} \def\rmacro{\recursivetrue\parsearg\macroxxx} \def\macroxxx#1{% - \getargs{#1}% now \macname is the macname and \argl the arglist + \getargs{#1}% now \macname is the macname and \argl the arglist \ifx\argl\empty % no arguments - \paramno=0% + \paramno=0\relax \else \expandafter\parsemargdef \argl;% + \if\paramno>256\relax + \ifx\eTeXversion\thisisundefined + \errhelp = \EMsimple + \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} + \fi + \fi \fi \if1\csname ismacro.\the\macname\endcsname \message{Warning: redefining \the\macname}% \else \expandafter\ifx\csname \the\macname\endcsname \relax - \else \errmessage{The name \the\macname\space is reserved}\fi + \else \errmessage{Macro name \the\macname\space already defined}\fi \global\cslet{macsave.\the\macname}{\the\macname}% \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% - % Add the macroname to \macrolist - \toks0 = \expandafter{\macrolist\do}% - \xdef\macrolist{\the\toks0 - \expandafter\noexpand\csname\the\macname\endcsname}% + \addtomacrolist{\the\macname}% \fi \begingroup \macrobodyctxt \ifrecursive \expandafter\parsermacbody \else \expandafter\parsemacbody \fi} -\def\unmacro{\parsearg\unmacroxxx} -\def\unmacroxxx#1{% +\parseargdef\unmacro{% \if1\csname ismacro.#1\endcsname \global\cslet{#1}{macsave.#1}% \global\expandafter\let \csname ismacro.#1\endcsname=0% - % Remove the macro name from \macrolist + % Remove the macro name from \macrolist: \begingroup - \edef\tempa{\expandafter\noexpand\csname#1\endcsname}% - \def\do##1{% - \def\tempb{##1}% - \ifx\tempa\tempb - % remove this - \else - \toks0 = \expandafter{\newmacrolist\do}% - \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}% - \fi}% - \def\newmacrolist{}% - % Execute macro list to define \newmacrolist - \macrolist - \global\let\macrolist\newmacrolist + \expandafter\let\csname#1\endcsname \relax + \let\definedummyword\unmacrodo + \xdef\macrolist{\macrolist}% \endgroup \else \errmessage{Macro #1 not defined}% \fi } +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx #1\relax + % remove this + \else + \noexpand\definedummyword \noexpand#1% + \fi +} + % This makes use of the obscure feature that if the last token of a % is #, then the preceding argument is delimited by % an opening brace, and that opening brace is not consumed. \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} -\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} +% For macro processing make @ a letter so that we can make Texinfo private macro names. +\edef\texiatcatcode{\the\catcode`\@} +\catcode `@=11\relax + % Parse the optional {params} list. Set up \paramno and \paramlist -% so \defmacro knows what to do. Define \macarg.blah for each blah -% in the params list, to be ##N where N is the position in that list. +% so \defmacro knows what to do. Define \macarg.BLAH for each BLAH +% in the params list to some hook where the argument si to be expanded. If +% there are less than 10 arguments that hook is to be replaced by ##N where N +% is the position in that list, that is to say the macro arguments are to be +% defined `a la TeX in the macro body. +% % That gets used by \mbodybackslash (above). - +% % We need to get `macro parameter char #' into several definitions. -% The technique used is stolen from LaTeX: let \hash be something +% The technique used is stolen from LaTeX: let \hash be something % unexpandable, insert that wherever you need a #, and then redefine % it to # just before using the token list produced. % % The same technique is used to protect \eatspaces till just before % the macro is used. - -\def\parsemargdef#1;{\paramno=0\def\paramlist{}% - \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +% +% If there are 10 or more arguments, a different technique is used, where the +% hook remains in the body, and when macro is to be expanded the body is +% processed again to replace the arguments. +% +% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the +% argument N value and then \edef the body (nothing else will expand because of +% the catcode regime underwhich the body was input). +% +% If you compile with TeX (not eTeX), and you have macros with 10 or more +% arguments, you need that no macro has more than 256 arguments, otherwise an +% error is produced. +\def\parsemargdef#1;{% + \paramno=0\def\paramlist{}% + \let\hash\relax + \let\xeatspaces\relax + \parsemargdefxxx#1,;,% + % In case that there are 10 or more arguments we parse again the arguments + % list to set new definitions for the \macarg.BLAH macros corresponding to + % each BLAH argument. It was anyhow needed to parse already once this list + % in order to count the arguments, and as macros with at most 9 arguments + % are by far more frequent than macro with 10 or more arguments, defining + % twice the \macarg.BLAH macros does not cost too much processing power. + \ifnum\paramno<10\relax\else + \paramno0\relax + \parsemmanyargdef@@#1,;,% 10 or more arguments + \fi +} \def\parsemargdefxxx#1,{% \if#1;\let\next=\relax \else \let\next=\parsemargdefxxx - \advance\paramno by 1% + \advance\paramno by 1 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname {\xeatspaces{\hash\the\paramno}}% \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} +\def\parsemmanyargdef@@#1,{% + \if#1;\let\next=\relax + \else + \let\next=\parsemmanyargdef@@ + \edef\tempb{\eatspaces{#1}}% + \expandafter\def\expandafter\tempa + \expandafter{\csname macarg.\tempb\endcsname}% + % Note that we need some extra \noexpand\noexpand, this is because we + % don't want \the to be expanded in the \parsermacbody as it uses an + % \xdef . + \expandafter\edef\tempa + {\noexpand\noexpand\noexpand\the\toks\the\paramno}% + \advance\paramno by 1\relax + \fi\next} + % These two commands read recursive and nonrecursive macro bodies. % (They're different since rec and nonrec macros end differently.) +% +\catcode `\@\texiatcatcode \long\def\parsemacbody#1@end macro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \long\def\parsermacbody#1@end rmacro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\catcode `\@=11\relax + +\let\endargs@\relax +\let\nil@\relax +\def\nilm@{\nil@}% +\long\def\nillm@{\nil@}% + +% This macro is expanded during the Texinfo macro expansion, not during its +% definition. It gets all the arguments values and assigns them to macros +% macarg.ARGNAME +% +% #1 is the macro name +% #2 is the list of argument names +% #3 is the list of argument values +\def\getargvals@#1#2#3{% + \def\macargdeflist@{}% + \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. + \def\paramlist{#2,\nil@}% + \def\macroname{#1}% + \begingroup + \macroargctxt + \def\argvaluelist{#3,\nil@}% + \def\@tempa{#3}% + \ifx\@tempa\empty + \setemptyargvalues@ + \else + \getargvals@@ + \fi +} + +% +\def\getargvals@@{% + \ifx\paramlist\nilm@ + % Some sanity check needed here that \argvaluelist is also empty. + \ifx\argvaluelist\nillm@ + \else + \errhelp = \EMsimple + \errmessage{Too many arguments in macro `\macroname'!}% + \fi + \let\next\macargexpandinbody@ + \else + \ifx\argvaluelist\nillm@ + % No more arguments values passed to macro. Set remaining named-arg + % macros to empty. + \let\next\setemptyargvalues@ + \else + % pop current arg name into \@tempb + \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% + \expandafter\@tempa\expandafter{\paramlist}% + % pop current argument value into \@tempc + \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% + \expandafter\@tempa\expandafter{\argvaluelist}% + % Here \@tempb is the current arg name and \@tempc is the current arg value. + % First place the new argument macro definition into \@tempd + \expandafter\macname\expandafter{\@tempc}% + \expandafter\let\csname macarg.\@tempb\endcsname\relax + \expandafter\def\expandafter\@tempe\expandafter{% + \csname macarg.\@tempb\endcsname}% + \edef\@tempd{\long\def\@tempe{\the\macname}}% + \push@\@tempd\macargdeflist@ + \let\next\getargvals@@ + \fi + \fi + \next +} + +\def\push@#1#2{% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter#2% + \expandafter\expandafter\expandafter{% + \expandafter#1#2}% +} + +% Replace arguments by their values in the macro body, and place the result +% in macro \@tempa +\def\macvalstoargs@{% + % To do this we use the property that token registers that are \the'ed + % within an \edef expand only once. So we are going to place all argument + % values into respective token registers. + % + % First we save the token context, and initialize argument numbering. + \begingroup + \paramno0\relax + % Then, for each argument number #N, we place the corresponding argument + % value into a new token list register \toks#N + \expandafter\putargsintokens@\saveparamlist@,;,% + % Then, we expand the body so that argument are replaced by their + % values. The trick for values not to be expanded themselves is that they + % are within tokens and that tokens expand only once in an \edef . + \edef\@tempc{\csname mac.\macroname .body\endcsname}% + % Now we restore the token stack pointer to free the token list registers + % which we have used, but we make sure that expanded body is saved after + % group. + \expandafter + \endgroup + \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% + } + +\def\macargexpandinbody@{% + %% Define the named-macro outside of this group and then close this group. + \expandafter + \endgroup + \macargdeflist@ + % First the replace in body the macro arguments by their values, the result + % is in \@tempa . + \macvalstoargs@ + % Then we point at the \norecurse or \gobble (for recursive) macro value + % with \@tempb . + \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname + % Depending on whether it is recursive or not, we need some tailing + % \egroup . + \ifx\@tempb\gobble + \let\@tempc\relax + \else + \let\@tempc\egroup + \fi + % And now we do the real job: + \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% + \@tempd +} -% This defines the macro itself. There are six cases: recursive and -% nonrecursive macros of zero, one, and many arguments. +\def\putargsintokens@#1,{% + \if#1;\let\next\relax + \else + \let\next\putargsintokens@ + % First we allocate the new token list register, and give it a temporary + % alias \@tempb . + \toksdef\@tempb\the\paramno + % Then we place the argument value into that token list register. + \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname + \expandafter\@tempb\expandafter{\@tempa}% + \advance\paramno by 1\relax + \fi + \next +} + +% Save the token stack pointer into macro #1 +\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} +% Restore the token stack pointer from number in macro #1 +\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} +% newtoks that can be used non \outer . +\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} + +% Tailing missing arguments are set to empty +\def\setemptyargvalues@{% + \ifx\paramlist\nilm@ + \let\next\macargexpandinbody@ + \else + \expandafter\setemptyargvaluesparser@\paramlist\endargs@ + \let\next\setemptyargvalues@ + \fi + \next +} + +\def\setemptyargvaluesparser@#1,#2\endargs@{% + \expandafter\def\expandafter\@tempa\expandafter{% + \expandafter\def\csname macarg.#1\endcsname{}}% + \push@\@tempa\macargdeflist@ + \def\paramlist{#2}% +} + +% #1 is the element target macro +% #2 is the list macro +% #3,#4\endargs@ is the list value +\def\pop@#1#2#3,#4\endargs@{% + \def#1{#3}% + \def#2{#4}% +} +\long\def\longpop@#1#2#3,#4\endargs@{% + \long\def#1{#3}% + \long\def#2{#4}% +} + +% This defines a Texinfo @macro. There are eight cases: recursive and +% nonrecursive macros of zero, one, up to nine, and many arguments. % Much magic with \expandafter here. % \xdef is used so that macro definitions will survive the file % they're defined in; @include reads the file inside a group. +% \def\defmacro{% \let\hash=##% convert placeholders to macro parameter chars \ifrecursive @@ -4937,17 +7692,25 @@ width0pt\relax} \fi \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup\noexpand\scanmacro{\temp}}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \else + \ifnum\paramno<10\relax % at most 9 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \else % 10 or more + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble + \fi \fi \else \ifcase\paramno @@ -4964,119 +7727,159 @@ width0pt\relax} \fi \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% + \else % at most 9 + \ifnum\paramno<10\relax + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % 10 or more: + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse + \fi \fi \fi} +\catcode `\@\texiatcatcode\relax + \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} % \braceorline decides whether the next nonwhitespace character is a % {. If so it reads up to the closing }, if not, it reads the whole % line. Whatever was read is then fed to the next control sequence -% as an argument (by \parsebrace or \parsearg) -\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} +% as an argument (by \parsebrace or \parsearg). +% +\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% \ifx\nchar\bgroup\else \expandafter\parsearg - \fi \next} - -% We mant to disable all macros during \shipout so that they are not -% expanded by \write. -\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% - \edef\next{\macrolist}\expandafter\endgroup\next} + \fi \macnamexxx} % @alias. -\def\alias#1=#2{\gdef#1{#2}} +% We need some trickery to remove the optional spaces around the equal +% sign. Make them active and then expand them all to nothing. +% +\def\alias{\parseargusing\obeyspaces\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \addtomacrolist{#1}% + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} \message{cross references,} -% @xref etc. \newwrite\auxfile - \newif\ifhavexrefs % True if xref values are known. \newif\ifwarnedxrefs % True if we warned once that they aren't known. % @inforef is relatively simple. \def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, +\def\inforefzzz #1,#2,#3,#4**{% + \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} -% @node's job is to define \lastnode. -\def\node{\ENVcheck\parsearg\nodezzz} -\def\nodezzz#1{\nodexxx [#1,]} -\def\nodexxx[#1,#2]{\gdef\lastnode{#1}} +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + \let\nwnode=\node -\let\lastnode=\relax - -% The sectioning commands (@chapter, etc.) call these. -\def\donoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Ysectionnumberandtype}% - \global\let\lastnode=\relax - \fi -} -\def\unnumbnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}% - \global\let\lastnode=\relax - \fi -} -\def\appendixnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Yappendixletterandtype}% - \global\let\lastnode=\relax +\let\lastnode=\empty + +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty \fi } - % @anchor{NAME} -- define xref target at arbitrary point. % -{ \catcode`\@ = 11 -% From latex.ltx, to make @anchor truely invisible. -\newdimen\@savsk -\newcount\@savsf -\gdef\@bsphack{\relax - \ifhmode \@savsk\lastskip \@savsf\spacefactor \fi -} -\gdef\@esphack{\relax - \ifhmode \spacefactor\@savsf - \ifdim\@savsk>\z@ \ignorespaces \fi +\newcount\savesfregister +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} + +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \lastsection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. +% +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. +% +\def\setref#1#2{% + \pdfmkdest{#1}% + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\lastsection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout + }% \fi } -\gdef\anchor#1{\@bsphack \setref{#1}{Ynothing}\@esphack} -} -% \setref{NAME}{SNT} defines a cross-reference point NAME, namely -% NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have -% to set \indexdummies so commands such as @code in a section title -% aren't expanded. It would be nicer not to expand the titles in the -% first place, but there's so many layers that that is hard to do. -% -\def\setref#1#2{{% - \indexdummies - \ifpdf \pdfmkdest{#1}\fi - \dosetq{#1-title}{Ytitle}% - \dosetq{#1-pg}{Ypagenumber}% - \dosetq{#1-snt}{#2}% -}} +% @xrefautosectiontitle on|off says whether @section(ing) names are used +% automatically in xrefs, if the third arg is not explicitly specified. +% This was provided as a "secret" @set xref-automatic-section-title +% variable, now it's official. +% +\parseargdef\xrefautomaticsectiontitle{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', + must be on|off}% + \fi\fi +} +% % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed % node name, #4 the name of the Info file, #5 the name of the printed @@ -5085,142 +7888,232 @@ width0pt\relax} \fi \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} \def\ref#1{\xrefX[#1,,,,,,,]} +% +\newbox\toprefbox +\newbox\printedrefnamebox +\newbox\infofilenamebox +\newbox\printedmanualbox +% \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces + % + % Get args without leading/trailing spaces. + \def\printedrefname{\ignorespaces #3}% + \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% + % + \def\infofilename{\ignorespaces #4}% + \setbox\infofilenamebox = \hbox{\infofilename\unskip}% + % \def\printedmanual{\ignorespaces #5}% - \def\printednodename{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual}% - \setbox0=\hbox{\printednodename}% - \ifdim \wd0 = 0pt + \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% + % + % If the printed reference name (arg #3) was not explicitly given in + % the @xref, figure out what we want to use. + \ifdim \wd\printedrefnamebox = 0pt % No printed node name was explicitly given. - \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax - % Use the node name inside the square brackets. - \def\printednodename{\ignorespaces #1}% + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax + % Not auto section-title: use node name inside the square brackets. + \def\printedrefname{\ignorespaces #1}% \else - % Use the actual chapter/section title appear inside - % the square brackets. Use the real section title if we have it. - \ifdim \wd1 > 0pt - % It is in another manual, so we don't have it. - \def\printednodename{\ignorespaces #1}% + % Auto section-title: use chapter/section title inside + % the square brackets if we have it. + \ifdim \wd\printedmanualbox > 0pt + % It is in another manual, so we don't have it; use node name. + \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs - % We know the real title if we have the xref values. - \def\printednodename{\refx{#1-title}{}}% + % We (should) know the real title if we have the xref values. + \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. - \def\printednodename{\ignorespaces #1}% + \def\printedrefname{\ignorespaces #1}% \fi% \fi \fi \fi % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. + % Make link in pdf output. \ifpdf - \leavevmode - \getfilename{#4}% - \ifnum\filenamelength>0 - \pdfannotlink attr{/Border [0 0 0]}% - goto file{\the\filename.pdf} name{#1@}% - \else - \pdfannotlink attr{/Border [0 0 0]}% - goto name{#1@}% - \fi - \BlueGreen + {\indexnofonts + \turnoffactive + \makevalueexpandable + % This expands tokens, so do it after making catcode changes, so _ + % etc. don't get their TeX definitions. This ignores all spaces in + % #4, including (wrongly) those in the middle of the filename. + \getfilename{#4}% + % + % This (wrongly) does not take account of leading or trailing + % spaces in #1, which should be ignored. + \edef\pdfxrefdest{#1}% + \ifx\pdfxrefdest\empty + \def\pdfxrefdest{Top}% no empty targets + \else + \txiescapepdf\pdfxrefdest % escape PDF special chars + \fi + % + \leavevmode + \startlink attr{/Border [0 0 0]}% + \ifnum\filenamelength>0 + goto file{\the\filename.pdf} name{\pdfxrefdest}% + \else + goto name{\pdfmkpgn{\pdfxrefdest}}% + \fi + }% + \setcolor{\linkcolor}% \fi % - \ifdim \wd1 > 0pt - \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}% + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd\printedrefnamebox = 0pt + \refx{#1-snt}{}% + \else + \printedrefname + \fi + % + % If the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd\printedmanualbox > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi \else - % _ (for example) has to be the character _ for the purposes of the - % control sequence corresponding to the node, but it has to expand - % into the usual \leavevmode...\vrule stuff for purposes of - % printing. So we \turnoffactive for the \refx-snt, back on for the - % printing, back off for the \refx-pg. - {\normalturnoffactive - % Only output a following space if the -snt ref is nonempty; for - % @unnumbered and @anchor, it won't be. - \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% - \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi - }% - % [mynode], - [\printednodename],\space - % page 3 - \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + % node/anchor (non-float) references. + % + % If we use \unhbox to print the node names, TeX does not insert + % empty discretionaries after hyphens, which means that it will not + % find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, + % this is a loss. Therefore, we give the text of the node name + % again, so it is as if TeX is seeing it for the first time. + % + \ifdim \wd\printedmanualbox > 0pt + % Cross-manual reference with a printed manual name. + % + \crossmanualxref{\cite{\printedmanual\unskip}}% + % + \else\ifdim \wd\infofilenamebox > 0pt + % Cross-manual reference with only an info filename (arg 4), no + % printed manual name (arg 5). This is essentially the same as + % the case above; we output the filename, since we have nothing else. + % + \crossmanualxref{\code{\infofilename\unskip}}% + % + \else + % Reference within this manual. + % + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via the macro below so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \fi\fi \fi - \ifpdf \Black\pdfendlink \fi + \endlink \endgroup} -% \dosetq is the interface for calls from other macros - -% Use \normalturnoffactive so that punctuation chars such as underscore -% and backslash work in node names. (\turnoffactive doesn't do \.) -\def\dosetq#1#2{% - {\let\folio=0% - \normalturnoffactive - \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% - \iflinks - \next - \fi - }% +% Output a cross-manual xref to #1. Used just above (twice). +% +% Only include the text "Section ``foo'' in" if the foo is neither +% missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply +% "see The Foo Manual", the idea being to refer to the whole manual. +% +% But, this being TeX, we can't easily compare our node name against the +% string "Top" while ignoring the possible spaces before and after in +% the input. By adding the arbitrary 7sp below, we make it much less +% likely that a real node name would have the same width as "Top" (e.g., +% in a monospaced font). Hopefully it will never happen in practice. +% +% For the same basic reason, we retypeset the "Top" at every +% reference, since the current font is indeterminate. +% +\def\crossmanualxref#1{% + \setbox\toprefbox = \hbox{Top\kern7sp}% + \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% + \ifdim \wd2 > 7sp % nonempty? + \ifdim \wd2 = \wd\toprefbox \else % same as Top? + \putwordSection{} ``\printedrefname'' \putwordin{}\space + \fi + \fi + #1% } -% \internalsetq {foo}{page} expands into -% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} -% When the aux file is read, ' is the escape character - -\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} - -% Things to be expanded by \internalsetq - -\def\Ypagenumber{\folio} - -\def\Ytitle{\thissection} - -\def\Ynothing{} - -\def\Ysectionnumberandtype{% -\ifnum\secno=0 \putwordChapter\xreftie\the\chapno % -\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\def\Yappendixletterandtype{% -\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% -\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\gdef\xreftie{'tie} +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since square brackets don't work well in some documents. Particularly +% one that Bob is working on :). +% +\def\xrefprintnodename#1{[#1]} -% Use TeX 3.0's \inputlineno to get the line number, for better error -% messages, but if we're using an old version of TeX, don't do anything. +% Things referred to by \setref. % -\ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Non-3.0. -\else - \def\linenumber{\the\inputlineno:\space} -\fi +\def\Ynothing{} +\def\Yomitfromtoc{} +\def\Ynumbered{% + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} +\def\Yappendix{% + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. % If its value is nonempty, SUFFIX is output afterward. - +% \def\refx#1#2{% - \expandafter\ifx\csname X#1\endcsname\relax + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname XR#1\endcsname + }% + \ifx\thisrefX\relax % If not defined, say something at least. \angleleft un\-de\-fined\angleright \iflinks \ifhavexrefs - \message{\linenumber Undefined cross reference `#1'.}% + {\toks0 = {#1}% avoid expansion of possibly-complex value + \message{\linenumber Undefined cross reference `\the\toks0'.}}% \else \ifwarnedxrefs\else \global\warnedxrefstrue @@ -5230,22 +8123,59 @@ width0pt\relax} \fi \fi \else % It's defined, so just use it. - \csname X#1\endcsname + \thisrefX \fi #2% Output the suffix in any case. } -% This is the macro invoked by entries in the aux file. +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. % -\def\xrdef#1{\begingroup - % Reenable \ as an escape while reading the second argument. - \catcode`\\ = 0 - \afterassignment\endgroup - \expandafter\gdef\csname X#1\endcsname +\def\xrdef#1#2{% + {% The node name might contain 8-bit characters, which in our current + % implementation are changed to commands like @'e. Don't let these + % mess up the control sequence name. + \indexnofonts + \turnoffactive + \xdef\safexrefname{#1}% + }% + % + \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR\safexrefname\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 + {\safexrefname}}% + \fi } % Read the last existing aux file, if any. No error if none exists. -\def\readauxfile{\begingroup +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readdatafile{aux}% + \global\havexrefstrue + \fi + \closein 1 +} + +\def\setupdatafile{% \catcode`\^^@=\other \catcode`\^^A=\other \catcode`\^^B=\other @@ -5273,9 +8203,7 @@ width0pt\relax} \fi \catcode`\^^]=\other \catcode`\^^^=\other \catcode`\^^_=\other - \catcode`\@=\other - \catcode`\^=\other - % It was suggested to define this as 7, which would allow ^^e4 etc. + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. % in xref tags, i.e., node names. But since ^^e4 notation isn't % supported in the main text, it doesn't seem desirable. Furthermore, % that is not enough: for node names that actually contain a ^ @@ -5288,6 +8216,9 @@ width0pt\relax} \fi % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter % and then to call \auxhat in \setq. % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... \catcode`\~=\other \catcode`\[=\other \catcode`\]=\other @@ -5299,41 +8230,43 @@ width0pt\relax} \fi \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other + \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off - % Make the characters 128-255 be printing characters + % + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. {% - \count 1=128 + \count1=128 \def\loop{% - \catcode\count 1=\other - \advance\count 1 by 1 - \ifnum \count 1<256 \loop \fi + \catcode\count1=\other + \advance\count1 by 1 + \ifnum \count1<256 \loop \fi }% }% - % The aux file uses ' as the escape (for now). - % Turn off \ as an escape so we do not lose on - % entries which were dumped with control sequences in their names. - % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ - % Reference to such entries still does not work the way one would wish, - % but at least they do not bomb out when the aux file is read in. + % + % @ is our escape character in .aux files, and we need braces. \catcode`\{=1 \catcode`\}=2 - \catcode`\%=\other - \catcode`\'=0 - \catcode`\\=\other - % - \openin 1 \jobname.aux - \ifeof 1 \else - \closein 1 - \input \jobname.aux - \global\havexrefstrue - \global\warnedobstrue - \fi - % Open the new aux file. TeX will close it automatically at exit. - \openout\auxfile=\jobname.aux + \catcode`\@=0 +} + +\def\readdatafile#1{% +\begingroup + \setupdatafile + \input\jobname.#1 \endgroup} -% Footnotes. +\message{insertions,} +% including footnotes. \newcount \footnoteno @@ -5344,40 +8277,42 @@ width0pt\relax} \fi % space to prevent strange expansion errors.) \def\supereject{\par\penalty -20000\footnoteno =0 } -% @footnotestyle is meaningful for info output only. +% @footnotestyle is meaningful for Info output only. \let\footnotestyle=\comment -\let\ptexfootnote=\footnote - {\catcode `\@=11 % % Auto-number footnotes. Otherwise like plain. \gdef\footnote{% + \let\indent=\ptexindent + \let\noindent=\ptexnoindent \global\advance\footnoteno by \@ne \edef\thisfootno{$^{\the\footnoteno}$}% % % In case the footnote comes at the end of a sentence, preserve the % extra spacing after we do the footnote number. \let\@sf\empty - \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi % % Remove inadvertent blank space before typesetting the footnote number. \unskip \thisfootno\@sf - \footnotezzz + \dofootnote }% % Don't bother with the trickery in plain.tex to not require the % footnote text as a parameter. Our footnotes don't need to be so general. % -% Oh yes, they do; otherwise, @ifset and anything else that uses -% \parseargline fail inside footnotes because the tokens are fixed when +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. % -\long\gdef\footnotezzz{\insert\footins\bgroup +\gdef\dofootnote{% + \insert\footins\bgroup % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. + \hsize=\pagewidth \interlinepenalty\interfootnotelinepenalty \splittopskip\ht\strutbox % top baseline for broken footnotes \splitmaxdepth\dp\strutbox @@ -5388,76 +8323,89 @@ width0pt\relax} \fi \xspaceskip\z@skip \parindent\defaultparindent % - % Hang the footnote text off the number. - \hang + \smallfonts \rm + % + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% \textindent{\thisfootno}% % % Don't crash into the line above the footnote text. Since this % expands into a box, it must come within the paragraph, lest it % provide a place where TeX can split the footnote. \footstrut + % + % Invoke rest of plain TeX footnote routine. \futurelet\next\fo@t } -\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t - \else\let\next\f@t\fi \next} -\def\f@@t{\bgroup\aftergroup\@foot\let\next} -\def\f@t#1{#1\@foot} -\def\@foot{\strut\egroup} - }%end \catcode `\@=11 -% Set the baselineskip to #1, and the lineskip and strut size -% correspondingly. There is no deep meaning behind these magic numbers -% used as factors; they just match (closely enough) what Knuth defined. -% -\def\lineskipfactor{.08333} -\def\strutheightpercent{.70833} -\def\strutdepthpercent {.29167} +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarly, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. % -\def\setleading#1{% - \normalbaselineskip = #1\relax - \normallineskip = \lineskipfactor\normalbaselineskip - \normalbaselines - \setbox\strutbox =\hbox{% - \vrule width0pt height\strutheightpercent\baselineskip - depth \strutdepthpercent \baselineskip - }% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi } -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. % -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = } +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% +} + +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin -% For a final copy, take out the rectangles -% that mark overfull boxes (in case you have decided -% that the text looks ok even though it passes the margin). -% -\def\finalout{\overfullrule=0pt} % @image. We use the macros from epsf.tex to support this. % If epsf.tex is not installed and @image is used, we complain. @@ -5467,12 +8415,12 @@ width0pt\relax} \fi % undone and the next image would fail. \openin 1 = epsf.tex \ifeof 1 \else - \closein 1 - % Do not bother showing banner with post-v2.7 epsf.tex (available in - % doc/epsf.tex until it shows up on ctan). + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). \def\epsfannounce{\toks0 = }% \input epsf.tex \fi +\closein 1 % % We will only complain once about lack of epsf.tex. \newif\ifwarnednoepsf @@ -5481,84 +8429,1239 @@ width0pt\relax} \fi it from ftp://tug.org/tex/epsf.tex.} % \def\image#1{% - \ifx\epsfbox\undefined + \ifx\epsfbox\thisisundefined \ifwarnednoepsf \else \errhelp = \noepsfhelp \errmessage{epsf.tex not found, images will be ignored}% \global\warnednoepsftrue \fi \else - \imagexxx #1,,,\finish + \imagexxx #1,,,,,\finish \fi } % % Arguments to @image: % #1 is (mandatory) image filename; we tack on .eps extension. % #2 is (optional) width, #3 is (optional) height. -% #4 is just the usual extra ignored arg for parsing this stuff. -\def\imagexxx#1,#2,#3,#4\finish{% - \ifx\pdfoutput\undefined +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \imagevmodetrue + \else \ifx\centersub\centerV + % for @center @image, we need a vbox so we can have our vertical space + \imagevmodetrue + \vbox\bgroup % vbox has better behavior than vtop herev + \fi\fi + % + \ifimagevmode + \nobreak\medskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \fi + % + % Leave vertical mode so that indentation from an enclosing + % environment such as @quotation is respected. + % However, if we're at the top level, we don't want the + % normal paragraph indentation. + % On the other hand, if we are in the case of @center @image, we don't + % want to start a paragraph, which will create a hsize-width box and + % eradicate the centering. + \ifx\centersub\centerV\else \noindent \fi + % + % Output the image. + \ifpdf + \dopdfimage{#1}{#2}{#3}% + \else % \epsfbox itself resets \epsf?size at each figure. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi - \begingroup - \catcode`\^^M = 5 % in case we're inside an example - % If the image is by itself, center it. - \ifvmode - \nobreak\bigskip - % Usually we'll have text after the image which will insert - % \parskip glue, so insert it here too to equalize the space - % above and below. - \nobreak\vskip\parskip - \nobreak - \centerline{\epsfbox{#1.eps}}% - \bigbreak - \else - % In the middle of a paragraph, no extra space. - \epsfbox{#1.eps}% + \epsfbox{#1.eps}% + \fi + % + \ifimagevmode + \medskip % space after a standalone image + \fi + \ifx\centersub\centerV \egroup \fi +\endgroup} + + +% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, +% etc. We don't actually implement floating yet, we always include the +% float "here". But it seemed the best name for the future. +% +\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} + +% There may be a space before second and/or third parameter; delete it. +\def\eatcommaspace#1, {#1,} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \lastsection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\lastsection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% \fi - \endgroup + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline{\scanexp\thiscaption}% + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + % + % Space below caption. + \vskip\parskip + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies + % + % since we read the caption text in the macro world, where ^^M + % is turned into a normal character, we have to scan it back, so + % we don't write the literal three characters "^^M" into the aux file. + \scanexp{% + \xdef\noexpand\gtemp{% + \ifx\thisshortcaption\empty + \thiscaption + \else + \thisshortcaption + \fi + }% + }% + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident + \ifx\gtemp\empty \else : \gtemp \fi}}% + }% + \fi + \egroup % end of \vtop + % + % place the captured inserts + % + % BEWARE: when the floats start floating, we have to issue warning + % whenever an insert appears inside a float which could possibly + % float. --kasal, 26may04 + % + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\def\appendtomacro#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2}% +} + +% @caption, @shortcaption +% +\def\caption{\docaption\thiscaption} +\def\shortcaption{\docaption\thisshortcaption} +\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} +\def\defcaption#1#2{\egroup \def#1{#2}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \lastsection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi \else - \centerline{\pdfimage #1.pdf}% + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup \fi } +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} + \message{localization,} -% and i18n. -% @documentlanguage is usually given very early, just after -% @setfilename. If done too late, it may not override everything -% properly. Single argument is the language abbreviation. -% It would be nice if we could set up a hyphenation file here. +% For single-language documents, @documentlanguage is usually given very +% early, just after @documentencoding. Single argument is the language +% (de) or locale (de_DE) abbreviation. % -\def\documentlanguage{\parsearg\dodocumentlanguage} -\def\dodocumentlanguage#1{% +{ + \catcode`\_ = \active + \globaldefs=1 +\parseargdef\documentlanguage{\begingroup + \let_=\normalunderscore % normal _ character for filenames \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. + % Read the file by the name they passed if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \documentlanguagetrywithoutunderscore{#1_\finish}% + \else + \globaldefs = 1 % everything in the txi-LL files needs to persist + \input txi-#1.tex + \fi + \closein 1 + \endgroup % end raw TeX +\endgroup} +% +% If they passed de_DE, and txi-de_DE.tex doesn't exist, +% try txi-de.tex. +% +\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% \openin 1 txi-#1.tex - \ifeof1 + \ifeof 1 \errhelp = \nolanghelp \errmessage{Cannot read language file txi-#1.tex}% - \let\temp = \relax \else - \def\temp{\input txi-#1.tex }% + \globaldefs = 1 % everything in the txi-LL files needs to persist + \input txi-#1.tex \fi - \temp - \endgroup + \closein 1 } +}% end of special _ catcode +% \newhelp\nolanghelp{The given language definition file cannot be found or -is empty. Maybe you need to install it? In the current directory -should work if nowhere else does.} - +is empty. Maybe you need to install it? Putting it in the current +directory should work if nowhere else does.} + +% This macro is called from txi-??.tex files; the first argument is the +% \language name to set (without the "\lang@" prefix), the second and +% third args are \{left,right}hyphenmin. +% +% The language names to pass are determined when the format is built. +% See the etex.log file created at that time, e.g., +% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. +% +% With TeX Live 2008, etex now includes hyphenation patterns for all +% available languages. This means we can support hyphenation in +% Texinfo, at least to some extent. (This still doesn't solve the +% accented characters problem.) +% +\catcode`@=11 +\def\txisetlanguage#1#2#3{% + % do not set the language if the name is undefined in the current TeX. + \expandafter\ifx\csname lang@#1\endcsname \relax + \message{no patterns for #1}% + \else + \global\language = \csname lang@#1\endcsname + \fi + % but there is no harm in adjusting the hyphenmin values regardless. + \global\lefthyphenmin = #2\relax + \global\righthyphenmin = #3\relax +} -% @documentencoding should change something in TeX eventually, most -% likely, but for now just recognize it. -\let\documentencoding = \comment +% Helpers for encodings. +% Set the catcode of characters 128 through 255 to the specified number. +% +\def\setnonasciicharscatcode#1{% + \count255=128 + \loop\ifnum\count255<256 + \global\catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} +\def\setnonasciicharscatcodenonglobal#1{% + \count255=128 + \loop\ifnum\count255<256 + \catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} -% Page size parameters. +% @documentencoding sets the definition of non-ASCII characters +% according to the specified encoding. % +\parseargdef\documentencoding{% + % Encoding being declared for the document. + \def\declaredencoding{\csname #1.enc\endcsname}% + % + % Supported encodings: names converted to tokens in order to be able + % to compare them with \ifx. + \def\ascii{\csname US-ASCII.enc\endcsname}% + \def\latnine{\csname ISO-8859-15.enc\endcsname}% + \def\latone{\csname ISO-8859-1.enc\endcsname}% + \def\lattwo{\csname ISO-8859-2.enc\endcsname}% + \def\utfeight{\csname UTF-8.enc\endcsname}% + % + \ifx \declaredencoding \ascii + \asciichardefs + % + \else \ifx \declaredencoding \lattwo + \setnonasciicharscatcode\active + \lattwochardefs + % + \else \ifx \declaredencoding \latone + \setnonasciicharscatcode\active + \latonechardefs + % + \else \ifx \declaredencoding \latnine + \setnonasciicharscatcode\active + \latninechardefs + % + \else \ifx \declaredencoding \utfeight + \setnonasciicharscatcode\active + \utfeightchardefs + % + \else + \message{Unknown document encoding #1, ignoring.}% + % + \fi % utfeight + \fi % latnine + \fi % latone + \fi % lattwo + \fi % ascii +} + +% A message to be logged when using a character that isn't available +% the default font encoding (OT1). +% +\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} + +% Take account of \c (plain) vs. \, (Texinfo) difference. +\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} + +% First, make active non-ASCII characters in order for them to be +% correctly categorized when TeX reads the replacement text of +% macros containing the character definitions. +\setnonasciicharscatcode\active +% +% Latin1 (ISO-8859-1) character definitions. +\def\latonechardefs{% + \gdef^^a0{\tie} + \gdef^^a1{\exclamdown} + \gdef^^a2{\missingcharmsg{CENT SIGN}} + \gdef^^a3{{\pounds}} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\missingcharmsg{YEN SIGN}} + \gdef^^a6{\missingcharmsg{BROKEN BAR}} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\copyright} + \gdef^^aa{\ordf} + \gdef^^ab{\guillemetleft} + \gdef^^ac{$\lnot$} + \gdef^^ad{\-} + \gdef^^ae{\registeredsymbol} + \gdef^^af{\={}} + % + \gdef^^b0{\textdegree} + \gdef^^b1{$\pm$} + \gdef^^b2{$^2$} + \gdef^^b3{$^3$} + \gdef^^b4{\'{}} + \gdef^^b5{$\mu$} + \gdef^^b6{\P} + % + \gdef^^b7{$^.$} + \gdef^^b8{\cedilla\ } + \gdef^^b9{$^1$} + \gdef^^ba{\ordm} + % + \gdef^^bb{\guillemetright} + \gdef^^bc{$1\over4$} + \gdef^^bd{$1\over2$} + \gdef^^be{$3\over4$} + \gdef^^bf{\questiondown} + % + \gdef^^c0{\`A} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\~A} + \gdef^^c4{\"A} + \gdef^^c5{\ringaccent A} + \gdef^^c6{\AE} + \gdef^^c7{\cedilla C} + \gdef^^c8{\`E} + \gdef^^c9{\'E} + \gdef^^ca{\^E} + \gdef^^cb{\"E} + \gdef^^cc{\`I} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\"I} + % + \gdef^^d0{\DH} + \gdef^^d1{\~N} + \gdef^^d2{\`O} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\~O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\O} + \gdef^^d9{\`U} + \gdef^^da{\'U} + \gdef^^db{\^U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\TH} + \gdef^^df{\ss} + % + \gdef^^e0{\`a} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\~a} + \gdef^^e4{\"a} + \gdef^^e5{\ringaccent a} + \gdef^^e6{\ae} + \gdef^^e7{\cedilla c} + \gdef^^e8{\`e} + \gdef^^e9{\'e} + \gdef^^ea{\^e} + \gdef^^eb{\"e} + \gdef^^ec{\`{\dotless i}} + \gdef^^ed{\'{\dotless i}} + \gdef^^ee{\^{\dotless i}} + \gdef^^ef{\"{\dotless i}} + % + \gdef^^f0{\dh} + \gdef^^f1{\~n} + \gdef^^f2{\`o} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\~o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\o} + \gdef^^f9{\`u} + \gdef^^fa{\'u} + \gdef^^fb{\^u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\th} + \gdef^^ff{\"y} +} + +% Latin9 (ISO-8859-15) encoding character definitions. +\def\latninechardefs{% + % Encoding is almost identical to Latin1. + \latonechardefs + % + \gdef^^a4{\euro} + \gdef^^a6{\v S} + \gdef^^a8{\v s} + \gdef^^b4{\v Z} + \gdef^^b8{\v z} + \gdef^^bc{\OE} + \gdef^^bd{\oe} + \gdef^^be{\"Y} +} + +% Latin2 (ISO-8859-2) character definitions. +\def\lattwochardefs{% + \gdef^^a0{\tie} + \gdef^^a1{\ogonek{A}} + \gdef^^a2{\u{}} + \gdef^^a3{\L} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\v L} + \gdef^^a6{\'S} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\v S} + \gdef^^aa{\cedilla S} + \gdef^^ab{\v T} + \gdef^^ac{\'Z} + \gdef^^ad{\-} + \gdef^^ae{\v Z} + \gdef^^af{\dotaccent Z} + % + \gdef^^b0{\textdegree} + \gdef^^b1{\ogonek{a}} + \gdef^^b2{\ogonek{ }} + \gdef^^b3{\l} + \gdef^^b4{\'{}} + \gdef^^b5{\v l} + \gdef^^b6{\'s} + \gdef^^b7{\v{}} + \gdef^^b8{\cedilla\ } + \gdef^^b9{\v s} + \gdef^^ba{\cedilla s} + \gdef^^bb{\v t} + \gdef^^bc{\'z} + \gdef^^bd{\H{}} + \gdef^^be{\v z} + \gdef^^bf{\dotaccent z} + % + \gdef^^c0{\'R} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\u A} + \gdef^^c4{\"A} + \gdef^^c5{\'L} + \gdef^^c6{\'C} + \gdef^^c7{\cedilla C} + \gdef^^c8{\v C} + \gdef^^c9{\'E} + \gdef^^ca{\ogonek{E}} + \gdef^^cb{\"E} + \gdef^^cc{\v E} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\v D} + % + \gdef^^d0{\DH} + \gdef^^d1{\'N} + \gdef^^d2{\v N} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\H O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\v R} + \gdef^^d9{\ringaccent U} + \gdef^^da{\'U} + \gdef^^db{\H U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\cedilla T} + \gdef^^df{\ss} + % + \gdef^^e0{\'r} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\u a} + \gdef^^e4{\"a} + \gdef^^e5{\'l} + \gdef^^e6{\'c} + \gdef^^e7{\cedilla c} + \gdef^^e8{\v c} + \gdef^^e9{\'e} + \gdef^^ea{\ogonek{e}} + \gdef^^eb{\"e} + \gdef^^ec{\v e} + \gdef^^ed{\'{\dotless{i}}} + \gdef^^ee{\^{\dotless{i}}} + \gdef^^ef{\v d} + % + \gdef^^f0{\dh} + \gdef^^f1{\'n} + \gdef^^f2{\v n} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\H o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\v r} + \gdef^^f9{\ringaccent u} + \gdef^^fa{\'u} + \gdef^^fb{\H u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\cedilla t} + \gdef^^ff{\dotaccent{}} +} + +% UTF-8 character definitions. +% +% This code to support UTF-8 is based on LaTeX's utf8.def, with some +% changes for Texinfo conventions. It is included here under the GPL by +% permission from Frank Mittelbach and the LaTeX team. +% +\newcount\countUTFx +\newcount\countUTFy +\newcount\countUTFz + +\gdef\UTFviiiTwoOctets#1#2{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\endcsname} +% +\gdef\UTFviiiThreeOctets#1#2#3{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} +% +\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} + +\gdef\UTFviiiDefined#1{% + \ifx #1\relax + \message{\linenumber Unicode char \string #1 not defined for Texinfo}% + \else + \expandafter #1% + \fi +} + +\begingroup + \catcode`\~13 + \catcode`\"12 + + \def\UTFviiiLoop{% + \global\catcode\countUTFx\active + \uccode`\~\countUTFx + \uppercase\expandafter{\UTFviiiTmp}% + \advance\countUTFx by 1 + \ifnum\countUTFx < \countUTFy + \expandafter\UTFviiiLoop + \fi} + + \countUTFx = "C2 + \countUTFy = "E0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiTwoOctets\string~}} + \UTFviiiLoop + + \countUTFx = "E0 + \countUTFy = "F0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiThreeOctets\string~}} + \UTFviiiLoop + + \countUTFx = "F0 + \countUTFy = "F4 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiFourOctets\string~}} + \UTFviiiLoop +\endgroup + +\begingroup + \catcode`\"=12 + \catcode`\<=12 + \catcode`\.=12 + \catcode`\,=12 + \catcode`\;=12 + \catcode`\!=12 + \catcode`\~=13 + + \gdef\DeclareUnicodeCharacter#1#2{% + \countUTFz = "#1\relax + %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% + \begingroup + \parseXMLCharref + \def\UTFviiiTwoOctets##1##2{% + \csname u8:##1\string ##2\endcsname}% + \def\UTFviiiThreeOctets##1##2##3{% + \csname u8:##1\string ##2\string ##3\endcsname}% + \def\UTFviiiFourOctets##1##2##3##4{% + \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter + \gdef\UTFviiiTmp{#2}% + \endgroup} + + \gdef\parseXMLCharref{% + \ifnum\countUTFz < "A0\relax + \errhelp = \EMsimple + \errmessage{Cannot define Unicode char value < 00A0}% + \else\ifnum\countUTFz < "800\relax + \parseUTFviiiA,% + \parseUTFviiiB C\UTFviiiTwoOctets.,% + \else\ifnum\countUTFz < "10000\relax + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% + \else + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiA!% + \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% + \fi\fi\fi + } + + \gdef\parseUTFviiiA#1{% + \countUTFx = \countUTFz + \divide\countUTFz by 64 + \countUTFy = \countUTFz + \multiply\countUTFz by 64 + \advance\countUTFx by -\countUTFz + \advance\countUTFx by 128 + \uccode `#1\countUTFx + \countUTFz = \countUTFy} + + \gdef\parseUTFviiiB#1#2#3#4{% + \advance\countUTFz by "#10\relax + \uccode `#3\countUTFz + \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} +\endgroup + +\def\utfeightchardefs{% + \DeclareUnicodeCharacter{00A0}{\tie} + \DeclareUnicodeCharacter{00A1}{\exclamdown} + \DeclareUnicodeCharacter{00A3}{\pounds} + \DeclareUnicodeCharacter{00A8}{\"{ }} + \DeclareUnicodeCharacter{00A9}{\copyright} + \DeclareUnicodeCharacter{00AA}{\ordf} + \DeclareUnicodeCharacter{00AB}{\guillemetleft} + \DeclareUnicodeCharacter{00AD}{\-} + \DeclareUnicodeCharacter{00AE}{\registeredsymbol} + \DeclareUnicodeCharacter{00AF}{\={ }} + + \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} + \DeclareUnicodeCharacter{00B4}{\'{ }} + \DeclareUnicodeCharacter{00B8}{\cedilla{ }} + \DeclareUnicodeCharacter{00BA}{\ordm} + \DeclareUnicodeCharacter{00BB}{\guillemetright} + \DeclareUnicodeCharacter{00BF}{\questiondown} + + \DeclareUnicodeCharacter{00C0}{\`A} + \DeclareUnicodeCharacter{00C1}{\'A} + \DeclareUnicodeCharacter{00C2}{\^A} + \DeclareUnicodeCharacter{00C3}{\~A} + \DeclareUnicodeCharacter{00C4}{\"A} + \DeclareUnicodeCharacter{00C5}{\AA} + \DeclareUnicodeCharacter{00C6}{\AE} + \DeclareUnicodeCharacter{00C7}{\cedilla{C}} + \DeclareUnicodeCharacter{00C8}{\`E} + \DeclareUnicodeCharacter{00C9}{\'E} + \DeclareUnicodeCharacter{00CA}{\^E} + \DeclareUnicodeCharacter{00CB}{\"E} + \DeclareUnicodeCharacter{00CC}{\`I} + \DeclareUnicodeCharacter{00CD}{\'I} + \DeclareUnicodeCharacter{00CE}{\^I} + \DeclareUnicodeCharacter{00CF}{\"I} + + \DeclareUnicodeCharacter{00D0}{\DH} + \DeclareUnicodeCharacter{00D1}{\~N} + \DeclareUnicodeCharacter{00D2}{\`O} + \DeclareUnicodeCharacter{00D3}{\'O} + \DeclareUnicodeCharacter{00D4}{\^O} + \DeclareUnicodeCharacter{00D5}{\~O} + \DeclareUnicodeCharacter{00D6}{\"O} + \DeclareUnicodeCharacter{00D8}{\O} + \DeclareUnicodeCharacter{00D9}{\`U} + \DeclareUnicodeCharacter{00DA}{\'U} + \DeclareUnicodeCharacter{00DB}{\^U} + \DeclareUnicodeCharacter{00DC}{\"U} + \DeclareUnicodeCharacter{00DD}{\'Y} + \DeclareUnicodeCharacter{00DE}{\TH} + \DeclareUnicodeCharacter{00DF}{\ss} + + \DeclareUnicodeCharacter{00E0}{\`a} + \DeclareUnicodeCharacter{00E1}{\'a} + \DeclareUnicodeCharacter{00E2}{\^a} + \DeclareUnicodeCharacter{00E3}{\~a} + \DeclareUnicodeCharacter{00E4}{\"a} + \DeclareUnicodeCharacter{00E5}{\aa} + \DeclareUnicodeCharacter{00E6}{\ae} + \DeclareUnicodeCharacter{00E7}{\cedilla{c}} + \DeclareUnicodeCharacter{00E8}{\`e} + \DeclareUnicodeCharacter{00E9}{\'e} + \DeclareUnicodeCharacter{00EA}{\^e} + \DeclareUnicodeCharacter{00EB}{\"e} + \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} + \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} + \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} + \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} + + \DeclareUnicodeCharacter{00F0}{\dh} + \DeclareUnicodeCharacter{00F1}{\~n} + \DeclareUnicodeCharacter{00F2}{\`o} + \DeclareUnicodeCharacter{00F3}{\'o} + \DeclareUnicodeCharacter{00F4}{\^o} + \DeclareUnicodeCharacter{00F5}{\~o} + \DeclareUnicodeCharacter{00F6}{\"o} + \DeclareUnicodeCharacter{00F8}{\o} + \DeclareUnicodeCharacter{00F9}{\`u} + \DeclareUnicodeCharacter{00FA}{\'u} + \DeclareUnicodeCharacter{00FB}{\^u} + \DeclareUnicodeCharacter{00FC}{\"u} + \DeclareUnicodeCharacter{00FD}{\'y} + \DeclareUnicodeCharacter{00FE}{\th} + \DeclareUnicodeCharacter{00FF}{\"y} + + \DeclareUnicodeCharacter{0100}{\=A} + \DeclareUnicodeCharacter{0101}{\=a} + \DeclareUnicodeCharacter{0102}{\u{A}} + \DeclareUnicodeCharacter{0103}{\u{a}} + \DeclareUnicodeCharacter{0104}{\ogonek{A}} + \DeclareUnicodeCharacter{0105}{\ogonek{a}} + \DeclareUnicodeCharacter{0106}{\'C} + \DeclareUnicodeCharacter{0107}{\'c} + \DeclareUnicodeCharacter{0108}{\^C} + \DeclareUnicodeCharacter{0109}{\^c} + \DeclareUnicodeCharacter{0118}{\ogonek{E}} + \DeclareUnicodeCharacter{0119}{\ogonek{e}} + \DeclareUnicodeCharacter{010A}{\dotaccent{C}} + \DeclareUnicodeCharacter{010B}{\dotaccent{c}} + \DeclareUnicodeCharacter{010C}{\v{C}} + \DeclareUnicodeCharacter{010D}{\v{c}} + \DeclareUnicodeCharacter{010E}{\v{D}} + + \DeclareUnicodeCharacter{0112}{\=E} + \DeclareUnicodeCharacter{0113}{\=e} + \DeclareUnicodeCharacter{0114}{\u{E}} + \DeclareUnicodeCharacter{0115}{\u{e}} + \DeclareUnicodeCharacter{0116}{\dotaccent{E}} + \DeclareUnicodeCharacter{0117}{\dotaccent{e}} + \DeclareUnicodeCharacter{011A}{\v{E}} + \DeclareUnicodeCharacter{011B}{\v{e}} + \DeclareUnicodeCharacter{011C}{\^G} + \DeclareUnicodeCharacter{011D}{\^g} + \DeclareUnicodeCharacter{011E}{\u{G}} + \DeclareUnicodeCharacter{011F}{\u{g}} + + \DeclareUnicodeCharacter{0120}{\dotaccent{G}} + \DeclareUnicodeCharacter{0121}{\dotaccent{g}} + \DeclareUnicodeCharacter{0124}{\^H} + \DeclareUnicodeCharacter{0125}{\^h} + \DeclareUnicodeCharacter{0128}{\~I} + \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} + \DeclareUnicodeCharacter{012A}{\=I} + \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} + \DeclareUnicodeCharacter{012C}{\u{I}} + \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} + + \DeclareUnicodeCharacter{0130}{\dotaccent{I}} + \DeclareUnicodeCharacter{0131}{\dotless{i}} + \DeclareUnicodeCharacter{0132}{IJ} + \DeclareUnicodeCharacter{0133}{ij} + \DeclareUnicodeCharacter{0134}{\^J} + \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} + \DeclareUnicodeCharacter{0139}{\'L} + \DeclareUnicodeCharacter{013A}{\'l} + + \DeclareUnicodeCharacter{0141}{\L} + \DeclareUnicodeCharacter{0142}{\l} + \DeclareUnicodeCharacter{0143}{\'N} + \DeclareUnicodeCharacter{0144}{\'n} + \DeclareUnicodeCharacter{0147}{\v{N}} + \DeclareUnicodeCharacter{0148}{\v{n}} + \DeclareUnicodeCharacter{014C}{\=O} + \DeclareUnicodeCharacter{014D}{\=o} + \DeclareUnicodeCharacter{014E}{\u{O}} + \DeclareUnicodeCharacter{014F}{\u{o}} + + \DeclareUnicodeCharacter{0150}{\H{O}} + \DeclareUnicodeCharacter{0151}{\H{o}} + \DeclareUnicodeCharacter{0152}{\OE} + \DeclareUnicodeCharacter{0153}{\oe} + \DeclareUnicodeCharacter{0154}{\'R} + \DeclareUnicodeCharacter{0155}{\'r} + \DeclareUnicodeCharacter{0158}{\v{R}} + \DeclareUnicodeCharacter{0159}{\v{r}} + \DeclareUnicodeCharacter{015A}{\'S} + \DeclareUnicodeCharacter{015B}{\'s} + \DeclareUnicodeCharacter{015C}{\^S} + \DeclareUnicodeCharacter{015D}{\^s} + \DeclareUnicodeCharacter{015E}{\cedilla{S}} + \DeclareUnicodeCharacter{015F}{\cedilla{s}} + + \DeclareUnicodeCharacter{0160}{\v{S}} + \DeclareUnicodeCharacter{0161}{\v{s}} + \DeclareUnicodeCharacter{0162}{\cedilla{t}} + \DeclareUnicodeCharacter{0163}{\cedilla{T}} + \DeclareUnicodeCharacter{0164}{\v{T}} + + \DeclareUnicodeCharacter{0168}{\~U} + \DeclareUnicodeCharacter{0169}{\~u} + \DeclareUnicodeCharacter{016A}{\=U} + \DeclareUnicodeCharacter{016B}{\=u} + \DeclareUnicodeCharacter{016C}{\u{U}} + \DeclareUnicodeCharacter{016D}{\u{u}} + \DeclareUnicodeCharacter{016E}{\ringaccent{U}} + \DeclareUnicodeCharacter{016F}{\ringaccent{u}} + + \DeclareUnicodeCharacter{0170}{\H{U}} + \DeclareUnicodeCharacter{0171}{\H{u}} + \DeclareUnicodeCharacter{0174}{\^W} + \DeclareUnicodeCharacter{0175}{\^w} + \DeclareUnicodeCharacter{0176}{\^Y} + \DeclareUnicodeCharacter{0177}{\^y} + \DeclareUnicodeCharacter{0178}{\"Y} + \DeclareUnicodeCharacter{0179}{\'Z} + \DeclareUnicodeCharacter{017A}{\'z} + \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} + \DeclareUnicodeCharacter{017C}{\dotaccent{z}} + \DeclareUnicodeCharacter{017D}{\v{Z}} + \DeclareUnicodeCharacter{017E}{\v{z}} + + \DeclareUnicodeCharacter{01C4}{D\v{Z}} + \DeclareUnicodeCharacter{01C5}{D\v{z}} + \DeclareUnicodeCharacter{01C6}{d\v{z}} + \DeclareUnicodeCharacter{01C7}{LJ} + \DeclareUnicodeCharacter{01C8}{Lj} + \DeclareUnicodeCharacter{01C9}{lj} + \DeclareUnicodeCharacter{01CA}{NJ} + \DeclareUnicodeCharacter{01CB}{Nj} + \DeclareUnicodeCharacter{01CC}{nj} + \DeclareUnicodeCharacter{01CD}{\v{A}} + \DeclareUnicodeCharacter{01CE}{\v{a}} + \DeclareUnicodeCharacter{01CF}{\v{I}} + + \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} + \DeclareUnicodeCharacter{01D1}{\v{O}} + \DeclareUnicodeCharacter{01D2}{\v{o}} + \DeclareUnicodeCharacter{01D3}{\v{U}} + \DeclareUnicodeCharacter{01D4}{\v{u}} + + \DeclareUnicodeCharacter{01E2}{\={\AE}} + \DeclareUnicodeCharacter{01E3}{\={\ae}} + \DeclareUnicodeCharacter{01E6}{\v{G}} + \DeclareUnicodeCharacter{01E7}{\v{g}} + \DeclareUnicodeCharacter{01E8}{\v{K}} + \DeclareUnicodeCharacter{01E9}{\v{k}} + + \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} + \DeclareUnicodeCharacter{01F1}{DZ} + \DeclareUnicodeCharacter{01F2}{Dz} + \DeclareUnicodeCharacter{01F3}{dz} + \DeclareUnicodeCharacter{01F4}{\'G} + \DeclareUnicodeCharacter{01F5}{\'g} + \DeclareUnicodeCharacter{01F8}{\`N} + \DeclareUnicodeCharacter{01F9}{\`n} + \DeclareUnicodeCharacter{01FC}{\'{\AE}} + \DeclareUnicodeCharacter{01FD}{\'{\ae}} + \DeclareUnicodeCharacter{01FE}{\'{\O}} + \DeclareUnicodeCharacter{01FF}{\'{\o}} + + \DeclareUnicodeCharacter{021E}{\v{H}} + \DeclareUnicodeCharacter{021F}{\v{h}} + + \DeclareUnicodeCharacter{0226}{\dotaccent{A}} + \DeclareUnicodeCharacter{0227}{\dotaccent{a}} + \DeclareUnicodeCharacter{0228}{\cedilla{E}} + \DeclareUnicodeCharacter{0229}{\cedilla{e}} + \DeclareUnicodeCharacter{022E}{\dotaccent{O}} + \DeclareUnicodeCharacter{022F}{\dotaccent{o}} + + \DeclareUnicodeCharacter{0232}{\=Y} + \DeclareUnicodeCharacter{0233}{\=y} + \DeclareUnicodeCharacter{0237}{\dotless{j}} + + \DeclareUnicodeCharacter{02DB}{\ogonek{ }} + + \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} + \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} + \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} + \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} + \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} + \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} + \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} + \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} + \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} + \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} + \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} + \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} + + \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} + \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} + + \DeclareUnicodeCharacter{1E20}{\=G} + \DeclareUnicodeCharacter{1E21}{\=g} + \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} + \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} + \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} + \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} + \DeclareUnicodeCharacter{1E26}{\"H} + \DeclareUnicodeCharacter{1E27}{\"h} + + \DeclareUnicodeCharacter{1E30}{\'K} + \DeclareUnicodeCharacter{1E31}{\'k} + \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} + \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} + \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} + \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} + \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} + \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} + \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} + \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} + \DeclareUnicodeCharacter{1E3E}{\'M} + \DeclareUnicodeCharacter{1E3F}{\'m} + + \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} + \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} + \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} + \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} + \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} + \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} + \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} + \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} + \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} + \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} + + \DeclareUnicodeCharacter{1E54}{\'P} + \DeclareUnicodeCharacter{1E55}{\'p} + \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} + \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} + \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} + \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} + \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} + \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} + \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} + \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} + + \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} + \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} + \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} + \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} + \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} + \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} + \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} + \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} + \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} + \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} + + \DeclareUnicodeCharacter{1E7C}{\~V} + \DeclareUnicodeCharacter{1E7D}{\~v} + \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} + \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} + + \DeclareUnicodeCharacter{1E80}{\`W} + \DeclareUnicodeCharacter{1E81}{\`w} + \DeclareUnicodeCharacter{1E82}{\'W} + \DeclareUnicodeCharacter{1E83}{\'w} + \DeclareUnicodeCharacter{1E84}{\"W} + \DeclareUnicodeCharacter{1E85}{\"w} + \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} + \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} + \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} + \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} + \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} + \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} + \DeclareUnicodeCharacter{1E8C}{\"X} + \DeclareUnicodeCharacter{1E8D}{\"x} + \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} + \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} + + \DeclareUnicodeCharacter{1E90}{\^Z} + \DeclareUnicodeCharacter{1E91}{\^z} + \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} + \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} + \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} + \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} + \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} + \DeclareUnicodeCharacter{1E97}{\"t} + \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} + \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} + + \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} + \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} + + \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} + \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} + \DeclareUnicodeCharacter{1EBC}{\~E} + \DeclareUnicodeCharacter{1EBD}{\~e} + + \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} + \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} + \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} + \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} + + \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} + \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} + + \DeclareUnicodeCharacter{1EF2}{\`Y} + \DeclareUnicodeCharacter{1EF3}{\`y} + \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} + + \DeclareUnicodeCharacter{1EF8}{\~Y} + \DeclareUnicodeCharacter{1EF9}{\~y} + + \DeclareUnicodeCharacter{2013}{--} + \DeclareUnicodeCharacter{2014}{---} + \DeclareUnicodeCharacter{2018}{\quoteleft} + \DeclareUnicodeCharacter{2019}{\quoteright} + \DeclareUnicodeCharacter{201A}{\quotesinglbase} + \DeclareUnicodeCharacter{201C}{\quotedblleft} + \DeclareUnicodeCharacter{201D}{\quotedblright} + \DeclareUnicodeCharacter{201E}{\quotedblbase} + \DeclareUnicodeCharacter{2022}{\bullet} + \DeclareUnicodeCharacter{2026}{\dots} + \DeclareUnicodeCharacter{2039}{\guilsinglleft} + \DeclareUnicodeCharacter{203A}{\guilsinglright} + \DeclareUnicodeCharacter{20AC}{\euro} + + \DeclareUnicodeCharacter{2192}{\expansion} + \DeclareUnicodeCharacter{21D2}{\result} + + \DeclareUnicodeCharacter{2212}{\minus} + \DeclareUnicodeCharacter{2217}{\point} + \DeclareUnicodeCharacter{2261}{\equiv} +}% end of \utfeightchardefs + + +% US-ASCII character definitions. +\def\asciichardefs{% nothing need be done + \relax +} + +% Make non-ASCII characters printable again for compatibility with +% existing Texinfo documents that may use them, even without declaring a +% document encoding. +% +\setnonasciicharscatcode \other + + +\message{formatting,} + \newdimen\defaultparindent \defaultparindent = 15pt \chapheadingskip = 15pt plus 4pt minus 2pt @@ -5568,10 +9671,10 @@ should work if nowhere else does.} % Prevent underfull vbox error messages. \vbadness = 10000 -% Don't be so finicky about underfull hboxes, either. -\hbadness = 2000 +% Don't be very finicky about underfull hboxes, either. +\hbadness = 6666 -% Following George Bush, just get rid of widows and orphans. +% Following George Bush, get rid of widows and orphans. \widowpenalty=10000 \clubpenalty=10000 @@ -5589,11 +9692,14 @@ should work if nowhere else does.} \fi } -% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; -% 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can -% set \parskip and call \setleading for \baselineskip. +% Parameters in order: 1) textheight; 2) textwidth; +% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; +% 7) physical page height; 8) physical page width. % -\def\internalpagesizes#1#2#3#4#5#6{% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% \voffset = #3\relax \topskip = #6\relax \splittopskip = \topskip @@ -5612,6 +9718,17 @@ should work if nowhere else does.} \normaloffset = #4\relax \bindingoffset = #5\relax % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + % if we don't reset these, they will remain at "1 true in" of + % whatever layout pdftex was dumped with. + \pdfhorigin = 1 true in + \pdfvorigin = 1 true in + \fi + % + \setleading{\textleading} + % \parindent = \defaultparindent \setemergencystretch } @@ -5619,76 +9736,140 @@ should work if nowhere else does.} % @letterpaper (the default). \def\letterpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt - \setleading{13.2pt}% + \textleading = 13.2pt % % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}% + \internalpagesizes{607.2pt}{6in}% that's 46 lines + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% }} -% Use @smallbook to reset parameters for 7x9.5 (or so) format. +% Use @smallbook to reset parameters for 7x9.25 trim size. \def\smallbook{{\globaldefs = 1 \parskip = 2pt plus 1pt - \setleading{12pt}% + \textleading = 12pt % - \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}% + \internalpagesizes{7.5in}{5in}% + {-.2in}{0in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% % \lispnarrowing = 0.3in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt - \deftypemargin = 0pt \defbodyindent = .5cm +}} + +% Use @smallerbook to reset parameters for 6x9 trim size. +% (Just testing, parameters still in flux.) +\def\smallerbook{{\globaldefs = 1 + \parskip = 1.5pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.4in}{4.8in}% + {-.2in}{-.4in}% + {0pt}{14pt}% + {9in}{6in}% % - \let\smalldisplay = \smalldisplayx - \let\smallexample = \smalllispx - \let\smallformat = \smallformatx - \let\smalllisp = \smalllispx + \lispnarrowing = 0.25in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .4cm }} % Use @afourpaper to print on European A4 paper. \def\afourpaper{{\globaldefs = 1 - \setleading{12pt}% \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt % - \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}% + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{673.2pt}{160mm}% that's 51 lines + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% % \tolerance = 700 \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm }} -% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin -% 29mm, hence bottom margin 28mm, nominal side margin 3cm. -\def\afourlatex{{\globaldefs = 1 - \setleading{13.6pt}% +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. +\def\afourlatex{{\globaldefs = 1 \afourpaper - \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}% + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% % + % Must explicitly reset to 0 because we call \afourpaper. \globaldefs = 0 }} -% Use @afourwide to print on European A4 paper in wide format. -\def\afourwide{% +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 \afourpaper - \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}% - % + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% \globaldefs = 0 -} +}} % @pagesizes TEXTHEIGHT[,TEXTWIDTH] % Perhaps we should allow setting the margins, \topskip, \parskip, % and/or leading, also. Or perhaps we should compute them somehow. % -\def\pagesizes{\parsearg\pagesizesxxx} -\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish} +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} \def\pagesizesyyy#1,#2,#3\finish{{% \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi \globaldefs = 1 % \parskip = 3pt plus 2pt minus 1pt - \setleading{13.2pt}% + \setleading{\textleading}% + % + \dimen0 = #1\relax + \advance\dimen0 by \voffset % - \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}% + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% }} % Set default to letter. @@ -5698,28 +9879,24 @@ should work if nowhere else does.} \message{and turning on texinfo input format.} +\def^^L{\par} % remove \outer, so ^L can appear in an @comment + +% DEL is a comment character, in case @c does not suffice. +\catcode`\^^? = 14 + % Define macros to output various characters with catcode for normal text. -\catcode`\"=\other -\catcode`\~=\other -\catcode`\^=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode`\+=\other -\catcode`\$=\other -\def\normaldoublequote{"} -\def\normaltilde{~} -\def\normalcaret{^} -\def\normalunderscore{_} -\def\normalverticalbar{|} -\def\normalless{<} -\def\normalgreater{>} -\def\normalplus{+} -\def\normaldollar{$} - -% This macro is used to make a character print one way in ttfont -% where it can probably just be output, and another way in other fonts, +\catcode`\"=\other \def\normaldoublequote{"} +\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix +\catcode`\+=\other \def\normalplus{+} +\catcode`\<=\other \def\normalless{<} +\catcode`\>=\other \def\normalgreater{>} +\catcode`\^=\other \def\normalcaret{^} +\catcode`\_=\other \def\normalunderscore{_} +\catcode`\|=\other \def\normalverticalbar{|} +\catcode`\~=\other \def\normaltilde{~} + +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, % where something hairier probably needs to be done. % % #1 is what to print if we are indeed using \tt; #2 is what to print @@ -5751,8 +9928,9 @@ should work if nowhere else does.} \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} +\let\realunder=_ % Subroutine for the previous macro. -\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } \catcode`\|=\active \def|{{\tt\char124}} @@ -5765,16 +9943,7 @@ should work if nowhere else does.} \catcode`\+=\active \def+{{\tt \char 43}} \catcode`\$=\active -\def${\ifusingit{{\sl\$}}\normaldollar} -%\catcode 27=\active -%\def^^[{$\diamondsuit$} - -% Set up an active definition for =, but don't enable it most of the time. -{\catcode`\==\active -\global\def={{\tt \char 61}}} - -\catcode`+=\active -\catcode`\_=\active +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix % If a .fmt file is being used, characters that might appear in a file % name cannot be active until we have parsed the command line. @@ -5782,46 +9951,69 @@ should work if nowhere else does.} % \otherifyactive is called near the end of this file. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} +% Used sometimes to turn off (effectively) the active characters even after +% parsing them. +\def\turnoffactive{% + \normalturnoffactive + \otherbackslash +} + \catcode`\@=0 -% \rawbackslashxx output one backslash character in current font -\global\chardef\rawbackslashxx=`\\ -%{\catcode`\\=\other -%@gdef@rawbackslashxx{\}} - -% \rawbackslash redefines \ as input to do \rawbackslashxx. -{\catcode`\\=\active -@gdef@rawbackslash{@let\=@rawbackslashxx }} - -% \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\rawbackslashxx}} - -% \catcode 17=0 % Define control-q -\catcode`\\=\active - -% Used sometimes to turn off (effectively) the active characters -% even after parsing them. -@def@turnoffactive{@let"=@normaldoublequote -@let\=@realbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar} - -@def@normalturnoffactive{@let"=@normaldoublequote -@let\=@normalbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar} +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work + +% \realbackslash is an actual character `\' with catcode other, and +% \doublebackslash is two of them (for the pdf outlines). +{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} + +% In texinfo, backslash is an active character; it prints the backslash +% in fixed width font. +\catcode`\\=\active % @ for escape char from now on. + +% The story here is that in math mode, the \char of \backslashcurfont +% ends up printing the roman \ from the math symbol font (because \char +% in math mode uses the \mathcode, and plain.tex sets +% \mathcode`\\="026E). It seems better for @backslashchar{} to always +% print a typewriter backslash, hence we use an explicit \mathchar, +% which is the decimal equivalent of "715c (class 7, e.g., use \fam; +% ignored family value; char position "5C). We can't use " for the +% usual hex value because it has already been made active. +@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} +@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents. + +% On startup, @fixbackslash assigns: +% @let \ = @normalbackslash +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. We switch back and forth between these. +@gdef@rawbackslash{@let\=@backslashcurfont} +@gdef@otherbackslash{@let\=@realbackslash} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. Also revert - to its normal character, in +% case the active - from code has slipped in. +% +{@catcode`- = @active + @gdef@normalturnoffactive{% + @let-=@normaldash + @let"=@normaldoublequote + @let$=@normaldollar %$ font-lock fix + @let+=@normalplus + @let<=@normalless + @let>=@normalgreater + @let\=@normalbackslash + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let~=@normaltilde + @markupsetuplqdefault + @markupsetuprqdefault + @unsepspaces + } +} % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. @@ -5835,9 +10027,9 @@ should work if nowhere else does.} @global@let\ = @eatinput % On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\{ in the file would cause an error. This macro tries to fix +% the first `\' in the file would cause an error. This macro tries to fix % that, assuming it is called before the first `\' could plausibly occur. -% Also back turn on active characters that might appear in the input +% Also turn back on active characters that might appear in the input % file name, in case not using a pre-dumped format. % @gdef@fixbackslash{% @@ -5849,20 +10041,39 @@ should work if nowhere else does.} % Say @foo, not \foo, in error messages. @escapechar = `@@ -% These look ok in all fonts, so just make them not special. -@catcode`@& = @other -@catcode`@# = @other -@catcode`@% = @other - -@c Set initial fonts. -@textfonts -@rm - +% These (along with & and #) are made active for url-breaking, so need +% active definitions as the normal characters. +@def@normaldot{.} +@def@normalquest{?} +@def@normalslash{/} + +% These look ok in all fonts, so just make them not special. +% @hashchar{} gets its own user-level command, because of #line. +@catcode`@& = @other @def@normalamp{&} +@catcode`@# = @other @def@normalhash{#} +@catcode`@% = @other @def@normalpercent{%} + +@let @hashchar = @normalhash + +@c Finally, make ` and ' active, so that txicodequoteundirected and +@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we +@c don't make ` and ' active, @code will not get them as active chars. +@c Do this last of all since we use ` in the previous @catcode assignments. +@catcode`@'=@active +@catcode`@`=@active +@markupsetuplqdefault +@markupsetuprqdefault @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) @c page-delimiter: "^\\\\message" @c time-stamp-start: "def\\\\texinfoversion{" -@c time-stamp-format: "%:y-%02m-%02d.%H" +@c time-stamp-format: "%:y-%02m-%02d.%02H" @c time-stamp-end: "}" @c End: + +@c vim:sw=2: + +@ignore + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 +@end ignore -- 1.7.0.4