÷ƒ’À;è TeX output 1996.03.05:1542‹ÿÿÿÿ <æ� ýÊ}ü ‚���� þ-}þ�‘?VHó0X«Q cmr12ÛCarrying–ê¨on“Dialog“with“T�‘þ ‘Ÿ•UEŽ‘‘!XŽŸ�����‘ZÍ[Micš¬rhael–ê¨J.“Do˜wnesŽŽ¤��‘a§y49–ê¨W‘ÿVeeks“StreetŽŽ¡��‘E ´North–ê¨Smith eld,“RI“02895ŽŽ¡��‘DFáE-mail:‘8àó6߆µT cmtt12ámjd@math.ams.orgŽŽŽŽŽŸAˆ‹�‘c{aÛNo•¬rv“em“b�SŽer‘ê¨1994ŽŸ'Ä�‘Õºâó5ÂÖN  cmbx12àCon• ten“tsŽ©��‘Õºâó#ò"V cmbx10Î1Ž‘äºãIn�®9tro�QÇduction�’U"2ŽŽ¤ ��‘äºãóKñ`y cmr10²1.1Ž‘ûºçT‘ÿ*ªerminology‘Ü ��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘  2ŽŽ¡��‘äºã1.2Ž‘ûºçBasic–UUdialog“principles‘8L��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘  3ŽŽ¦��‘ÕºâÎ2Ž‘äºãT�‘þ<Ÿ8ãEŽ‘3sX's–ÕTMessage-Sending“Capabilities�’ ¥Ç3ŽŽ¡��‘äºã²2.1Ž‘ûºçThe–UUó$ßêŸ'MŽ‘ ‹S‘€²-T�‘þU>Ÿ'EŽ‘ãxX's“Ï\printoptions“²command‘V*��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ17ŽŽ¡��’Y7 5.2Ž’p7Ï^^M–UU²at“the“end“of“a“line‘Ã��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ18ŽŽ¡��’Y7 5.3Ž’p7Upp�Gercasing‘UUinput‘ͱ��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ18ŽŽ¡��’Y7 5.4Ž’p7Default‘UUresp�Gonses‘ñJ��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ18ŽŽ¡��’Y7 5.5Ž’p7A–UUnew“Ï\printoptions‘\ ��‘ü².ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ19ŽŽ¡��’Y7 5.6Ž’p7Matc�¸ãhing‘UUbraces‘ê.��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ19ŽŽ¡��’Y7 5.7Ž’p7Outer‘UUmacros‘�Ì��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ19ŽŽ¡��’Y7 5.8Ž’p7Catco�Gdes‘ÆÁ��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ20ŽŽ¡��’Y7 5.9Ž’p7ÏLatex.tex²:‘qÇÏ\typeout–UU²and“Ï\typein�qM��‘ü².ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ21ŽŽ¡��’Y7 5.10Ž’p7ÏDocstrip.tex²:‘qÇÏ\typeout²,–UUÏ\typein²,“progress“rep�Gorts‘\��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ21ŽŽ¦��’J7 Î6Ž’Y7 Miscellaneous�’ ¤s22ŽŽ¡��’Y7 ²6.1Ž’p7Checš¸ãking–UUa“resp�Gonse“for“v‘ÿqÇalidit˜y‘ÿ>��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ22ŽŽ¡��’Y7 6.2Ž’p7emT�‘þU>Ÿ'EŽ‘ãxX8-bit‘UUoutput‘¸r��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ24ŽŽ¡��’Y7 6.3Ž’p7User‘UUHelp‘#4��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ24ŽŽ¦��’J7 Î7Ž’Y7 Summary�’¥ 25ŽŽ¡��’Y7 ²7.1Ž’p7Sending‘UUmessages‘ÔØ��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ25ŽŽ¡��’Y7 7.2Ž’p7Reading–UUuser“input‘ã��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ25ŽŽ¦��’J7 ÎApp�QÇendix‘ÕTAŽ’‹7Animals.tex�’áËâ25ŽŽ¡��’Y7 ²A.1Ž’p7animals.tex‘�Ò��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ25ŽŽ¡��’Y7 A.2Ž’p7animals2.tex‘�Ñ��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ28ŽŽ¡��’Y7 A.3Ž’p7animal.dat‘ã.��‘ü.ŽŽ–Ç��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ“��‘ü.ŽŽ�‘ Ÿ28ŽŽ¦��’J7 ÎApp�QÇendix‘ÕTBŽ’‹7Basix.tex�’ïhO29ŽŽ¦��’J7 App�QÇendix‘ÕTCŽ’‹7T‘ÿ «ables.tex�’êôÂ29ŽŽ¦��’J7 App�QÇendix‘ÕTDŽ’‹7F‘ÿ «on•®9tmen“u.tex�’Ù¯29ŽŽŽŽŽŽŽŒ‹* <æ� ýÊ}ü��’ódØóo´‹Ç cmr9ÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’©ö²2ŽŽ ‚���� þ }ü��‘Õºâà1Ž‘éúâIn� tro�`ductionŽŸç�‘Õºâ²A‘Bcommon–BEtask“in“an�¸ãy“programming“language“is“to“send“a“question“to“the“user,ޤ �‘Õºâand–úto“read“(and“act“on)“the“user's“resp�Gonse.‘ñ·In“T�‘þU>Ÿ'EŽ‘ãxX,‘Ê£this“usually“in•¸ãv“olv“es‘útheŽ¡�‘ÕºâÏ\read²,–BÏ\message²,“and–«Ï\write“²commands.‘©ÊThe“use“of“these“commands,‘Bho•¸ãw“ev“er,Ž¡�‘Õºâis–Jb�Geset“at“evš¸ãery“turn“b˜y“o�Gdd“hindrances“and“tec˜hnical“stum˜bling“blo�Gc˜ks,‘P‡so“thatŽ¡�‘Õºâev�¸ãen–qsexp�Gerienced“macro“writers,‘¸{faced“with“an“application“that“requires“a“bit“ofŽ¡�‘Õºâdialog,›*usually– ß nd“it“troublesome“to“mak�¸ãe“that“bit“of“dialog“go•Go“d-lo“oking,˜reliable,Ž¡�‘Õºâcon•¸ãv“enien“t–«for“the“user,‘€Àand“toleranš¸ãt“of“t˜ypical“h˜uman“mistak˜es“suc˜h“as“minorŽ¡�‘Õºâmist�¸ãyping–ßøin“a“respšGonse.‘°The“purp˜ose“of“this“article“is“to“analyze“the“capabilitiesŽ¡�‘Õºâthat–½åT�‘þU>Ÿ'EŽ‘ãxX“has“for“dialog“and“survš¸ãey“all“the“b�Gest“relev‘ÿqÇan˜t“macro-writing“tec˜hniquesŽ¡�‘Õºâthat–UUfall“within“the“scopšGe“of“m�¸ãy“exp˜erience“and“researc�¸ãh.��Ÿü^ÿóÙ“ Rcmr7±1ŽŽŽ¡�‘äºâ²In›UUó!ý': cmti10ÌThe‘“çT�‘þKß'EŽ‘Í-Xb–ÿ}'o“ok²,˜near˜the˜end˜of˜Chapter˜20,˜Kn�¸ãuth˜writesŽ©Qd�‘îºäIt's–ç•easy“to“ha•¸ãv“e–ç•dialogs“with“the“user,‘ýˆb�¸ãy“using“Ï\read“²together“with“theŽ¡�‘îºäÏ\message‘UU²commandަ�‘Õºâand–þ there“folloš¸ãws“a“brief“example“in˜v˜olving“reading“the“user's“name“in˜to“a“macroŽ¡�‘ÕºâÏ\myname².‘ îeIt's–~ßclear“from“this“passage“that“Knš¸ãuth“means,‘ Ab˜y“Ìdialo‘ÿ}'g²,‘ AordinaryŽ¡�‘Õºâcomm•¸ãunication›6[b�Get“w“een˜computer˜programs˜and˜users˜at˜the˜early-1980s˜lev“el˜ofŽ¡�‘Õºâtec•¸ãhnology:‘£¦prin“ting›nDc“haracter-based˜information˜on˜a˜video˜screen,‘ô€displa“yingŽ¡�‘Õºâmen�¸ãus,–�3asking›^équestions,“and˜handling˜user˜resp•Gonses.‘¤(Sp“eec•¸ãh˜recognition˜and˜v“oiceŽ¡�‘Õºâsynš¸ãthesis–{are“not“part“of“the“picture“for“most“T�‘þU>Ÿ'EŽ‘ãxX“users,‘„uy˜et.)‘âàF‘ÿ*ªor“the“purp�Goses“ofŽ¡�‘Õºâthis–ëŠarticle,‘I‘ëdde ne“Ìdialo‘ÿ}'g“²as“anš¸ãy“comm˜unication“b�Get˜w˜een“T�‘þU>Ÿ'EŽ‘ãxX“and“the“user“thatŽ¡�‘Õºâtakš¸ães–‘Gplace“while“T�‘þU>Ÿ'EŽ‘ãxX“is“running.‘%�F‘ÿ*ªorms“of“comm˜unication“that“do“not“tak˜e“placeŽ¡�‘Õºâwhile–›õT�‘þU>Ÿ'EŽ‘ãxX“is“running“are“excluded:‘ÿfor“example,‘­�the“blacš¸ãk“b�Go˜x“that“T�‘þU>Ÿ'EŽ‘ãxX“prin˜ts“toŽ¡�‘Õºâindicate–Õ=an“o•¸ãv“erfull–Õ=line“in“a“paragraph“is“useful“information,‘îÜbut“not“dialog“b�GecauseŽ¡�‘Õºâthe–ýcomm�¸ãunication“ošGccurs“after“T�‘þU>Ÿ'EŽ‘ãxX“has“stopp˜ed“running.��Ÿü^ÿ±2ŽŽ‘Ò²On“the“other“hand,‘ÛtheŽ¡�‘ÕºâÏOverfull‘?ý\hbox–Jó²message“prinš¸ãted“on“screen“whenev˜er“T�‘þU>Ÿ'EŽ‘ãxX“adds“a“blac˜k“b�Go˜x“to“theŽ¡�‘Õºâcurren�¸ãt–UUparagraph“Ìis“²dialog,“bšGecause“it“do˜es“o˜ccur“while“T�‘þU>Ÿ'EŽ‘ãxX“is“running.Ž¡�‘äºâSince–uåthe“enš¸ãtire“section“of“ÌThe‘±ÜT�‘þKß'EŽ‘Í-Xb–ÿ}'o“ok–uå²where“Kn˜uth's“dialog“example“app�GearsŽ¡�‘Õºâis–RÌmarkš¸ãed“o “with“double“dangerous“b�Gend“signs,‘SNit“seems“that“Kn˜uth“didn't“in˜tendŽ¡�‘Õºâhis–Ùwš¸ãords“\It's“easy"“to“b�Ge“tak˜en“completely“literally|particularly“when“w˜e“lo�Gok“atŽ¡�‘Õºâthe–UUnext“thing“in“that“section,“Exercise“20.18,“whic�¸ãh“reads,ަ�‘îºäThe–ÃCÏ\myname“²example“just“givš¸ãen“do�Gesn't“w˜ork“quite“righ˜t,‘Þ¾b�Gecause“theŽ¡�‘îºä¸h²return¸i–¬Å²at“the“end“of“the“line“gets“translated“in�¸ãto“a“space.‘xFigure“outŽ¡�‘îºähoš¸ãw–UUto“ x“that“glitc˜h.ަ�‘ÕºâThat–Èýline-ending“space“is“only“one“of“a“n•¸ãum“bšGer–Èýof“complications“that“can“hamp˜erŽ¡�‘Õºâthe–Úæe orts“of“macro“writers“to“write“dialog“for“practical“applications.‘zIn“fact,‘üJtheŽ‘ÕºâŸ€ß‰ff�ýåŸ J=����‘ "5Ÿý-:ó¹Aa¨cmr6º1ŽŽŽ‘LÜó|{Ycmr8ÀThis–dis“an“o•ÃŽv“erhauled–dand“ampli ed“všÃŽersion“of“m˜y“papš����‘ "5Ÿý-:º2ŽŽŽ‘LÜÀThis–º distinction“is“blurring,›óRho•ÃŽw“ev“er,˜with–º the“adv•ÃŽen“t–º of“soft•ÃŽw“are›º lik“e˜Blue˜Sky˜Researc“h'sŽ¡�Ligh�ÃŽtning‘ÕXT‘ÿJªextures.ŽŽŽ�� þ }ü�’J7 ²wš¸ãord–èÊÌe‘ÿ}'asy“²is“far“from“the“ rst“adjectiv˜e“that“comes“to“mind“when“I‘èbremem˜b�Gerޤ �’J7 m•¸ãy›qwo“wn˜early˜attempts˜at˜writing˜dialogical˜macros.‘Æ.Though˜m“y˜thrashing˜andŽ¡�’J7 oundering–éfor“the“most“part“tošGok“place“b˜ehind“the“scenes,‘Mõin�¸ãvisible“to“others,Ž¡�’J7 it›^¸ev•¸ãen“tually˜reac“hed˜the˜p�Goin“t˜of˜threatening˜m“y˜secret˜b�Gelief˜that˜I‘^sw“as˜a˜hot-Ž¡�’J7 shot–¸šmacro“writer.‘›•That“spurred“me“to“start“paš¸ãying“sp�Gecial“atten˜tion“to“an˜ythingŽ¡�’J7 related–öÀto“the“idea“of“dialog“in“T�‘þU>Ÿ'EŽ‘ãxX,‘ ªand“accum�¸ãulating“scraps“and“pieces“of“assortedŽ¡�’J7 useful–—1tecš¸ãhniques.‘7ZThis“article“is“more“or“less“a“surv˜ey“of“what“I'v˜e“learned“so“far.Ž¡�’J7 Sections–“2“and“3“review“the“functions“T�‘þU>Ÿ'EŽ‘ãxX“pro�¸ãvides“to“supp�Gort“dialog;‘}2sections“4Ž¡�’J7 and–UU5“discuss“common“diculties“and“ho�¸ãw“to“handle“them.ŽŸþ6��’J7 à1.1Ž’h÷ T‘þàerminologyŽŸuT�’J7 ²Rather–Ü´than“assume“all“readers“knoš¸ãw“w˜ell“enough“the“meaning“of“terms“lik˜eŽ¡�’J7 Ìprimitive²,–.GÌtoken²,“or›ϱÌc–ÿ}'ontr“ol‘ïþwor“d˜²that˜will˜b•Ge˜bandied˜ab“out˜hereinafter,‘.GI‘ÏOo erŽ¡�’J7 a–$Øquicš¸ãk“review“of“some“standard“T�‘þU>Ÿ'EŽ‘ãxX“terminology‘ÿ*ª,‘.‹to“aid“those“who“w˜an˜t“it,‘.‹and“toŽ¡�’J7 b•Ge›UUskipp“ed˜b•¸ãy˜the˜rest˜of˜y“ou.Ž¡�’Y7 A‘zÎT�‘þU>Ÿ'EŽ‘ãxX–{command“is“either“a“Ìc–ÿ}'ontr“ol‘¢+se“quenc“e²|a–{string“of“c�¸ãharacters“startingŽ¡�’J7 with–<Ìan“Ìesc–ÿ}'ap“e›}Uchar“acter²|or–<Ìa“single“Ìactive˜char‘ÿ}'acter²,‘Aµsuc�¸ãh“as“Ï~².‘išThe“usual“escap�GeŽ¡�’J7 cš¸ãharacter–Ìis“the“Ìb‘ÿ}'ackslash²,‘éÆÏ\².‘Ö A‘Ë÷con˜trol“sequence“that“consists“of“a“bac˜kslash“plusŽ¡�’J7 one–Äönonletter“cš¸ãharacter“is“called“a“Ìc–ÿ}'ontr“ol‘symb“ol²;‘õa–Äöcon˜trol“sequence“that“consists“ofŽ¡�’J7 a–œwbac�¸ãkslash“plus“one“or“more“letters“is“called“a“Ìc–ÿ}'ontr“ol‘éÔwor“d².‘4(Spaces–œware“ignored“afterŽ¡�’J7 a–tjconš¸ãtrol“w˜ord,‘|/but“not“after“a“con˜trol“sym˜b�Gol.‘ÏA‘tbcon˜trol“sequence“is“either“a“ÌT�‘þKß'EŽ‘Í-XŽ¡�’J7 primitive²|a–‹icommand“built“in�¸ãto“the“T�‘þU>Ÿ'EŽ‘ãxX“program|or“a“macro:‘Ýïa“comp�Gosition“ofŽ¡�’J7 primitivš¸ães–ÊÝor“other“macros,‘æ�de ned“b˜y“the“user“or“b˜y“a“Ìmacr–ÿ}'o‘„p“ackage–Êݲsuc˜h“as“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxXŽ¡�’J7 or–Èó[Œ-ø cmcsc10ë[plain‘ª®²T�‘þU>Ÿ'EŽ‘ãxX.‘ÑA‘“conš¸ãtrol“sequence“ma˜y“require“one“or“more“follo˜wing“Ìar‘ÿ}'guments²;Ž¡�’J7 an–�argumenš¸ãt“is“a“piece“of“text“that“is“grabb�Ged“up“b˜y“the“con˜trol“sequence“in“orderŽ¡�’J7 to–ido“something“with“it.‘­Argumenš¸ãts“t˜ypically“are“enclosed“in“Ìcurly‘¦br–ÿ}'ac“es–iÏ{“²and“Ï}².Ž¡�’J7 F‘ÿ*ªor–Jexample,›LQthe“command“Ï\sqrt“²is“a“macro“with“one“argumen�¸ãt,˜and“is“used“th�¸ãus:Ž¡�’J7 Ï\sqrt{x^2+y^2}²,–UUpro�Gducing“the“prin�¸ãted“output��“Ÿ÷8àóú±u cmex10«pŽ�‘ UVŸ÷8à‰fe +ØŸÇ �ó  b> cmmi10µx�Ÿýr±2Ž‘µS²+‘8àµy��[ÙŸýr±2ŽŽŽŽ‘-�.².Ž¡�’Y7 Macros–%,are“Ìexp‘ÿ}'andable²;‘ some“primitiv�¸ães“are“expandable,‘™"more“are“not.‘ áMAnŽ¡�’J7 expandable–8•conš¸ãtrol“sequence“will“b�Ge“replaced“b˜y“its“expansion“if“it“is“used“insideŽ¡�’J7 the–xxargumenš¸ãt“of“a“Ï\message“²command,‘@or“an˜ywhere“else“where“T�‘þU>Ÿ'EŽ‘ãxX“is“in“anŽ¡�’J7 expansiv�¸ãe›´émo•Go“d˜(Ï\write²,–LÍÏ\errmessage²,“Ï\edef²,“Ï\xdef²,“Ï\mark²,“Ï\special˜²[ÌTheŽ¡�’J7 T�‘þKß'EŽ‘Í-Xb–ÿ}'o“ok²,‘UUp216]).Ž¡�’Y7 The–vóterm“Ìp–ÿ}'ar“ameter–vó²is“used“to“mean“a“nš¸ãumeric“or“dimensional“v‘ÿqÇariable“suc˜h“asŽ¡�’J7 Ï\hyphenpenalty²,–c[Ï\hsize²,“or–-ZÏ\baselineskip².‘ùÖA‘-"Ìtoken“²is“eithera“c�¸ãharacter“(withŽ¡�’J7 asso•Gciated›catco“de)˜or˜a˜con�¸ãtrol˜sequence,‘!îÌafter‘(¡²it˜has˜b“een˜read˜b�¸ãy˜T�‘þU>Ÿ'EŽ‘ãxX˜from˜someŽ¡�’J7 le–Ë“and“enš¸ãtered“in˜to“T�‘þU>Ÿ'EŽ‘ãxX's“activ˜e“memory‘ÿ*ª.‘CÜCharacter“tok˜ens“can“only“ha˜v˜e“categoryŽ¡�’J7 co�Gdes›3C1{4,–:6{8,“or˜10{13;‘>žthere's˜no˜suc•¸ãh˜thing˜as˜a˜`c“haracter˜tok“en'˜with˜categoryŽ¡�’J7 co�Gde›¯s0,–Åû5,“9,“14,“or˜15:‘&those˜catco•Gdes˜only˜con�¸ãtrol˜the˜pro“cess˜of˜creating˜tok�¸ãens,Ž¡�’J7 they–UUaren't“designed“for“pšGermanen�¸ãt“asso˜ciation“to“a“tok�¸ãen.Ž¡�’Y7 Under–^ normal“circumstances,‘`8eacš¸ãh“line“in“a“ le“is“understo•Go“d–^ b˜y“T�‘þU>Ÿ'EŽ‘ãxX“to“ha˜v˜e“aŽŽŽŽŽŽŒ‹9* <æ� ýÊ}ü��’ódØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’©ö²3ŽŽ ‚���� þ }ü�‘ÕºâÏ^^M– ¨²c�¸ãharacter,›eë[asci�8ãi“²13,˜at“the“end“of“it,˜evš¸ãen“if“y˜our“text“editor“actually“puts“someޤ �‘Õºâother–ªcš¸ãharacter,‘3or“no“c˜haracter,‘3at“the“end“of“a“line“when“y˜ou“press“the“ë[return“²orŽ¡�‘Õºâë[enter‘UU²k�¸ãey‘ÿ*ª.ŽŸ¹J��‘Õºâà1.2Ž‘ôzâBasic–€dialog“principlesŽŸuT�‘Õºâ²It's–UUnot“hard“to“idenš¸ãtify“a“n˜um˜b�Ger“of“principles“that“mak˜e“for“go•Go“d‘UUdialog:ŽŸ¿Ø����‘áóÆ1.ŽŽŽ‘îºäWhen–reaskš¸ãed“a“y˜es/no“question,‘ŸÈusers“should“b�Ge“able“to“en˜ter“Ïy²,–ŸÈÏyes²,“or–reev˜en“Ïye²,Ž¡�‘îºäin›CÛlo•¸ãw“ercase,–GZupp�Gercase,“or˜ev�¸ãen˜mixed˜case,“and˜ha•¸ãv“e˜the˜answ“er˜understo•Go“dŽ¡�‘îºäto–UUb�Ge“\y�¸ães".Ž©_ì����‘áóÆ2.ŽŽŽ‘îºäF‘ÿ*ªor–>òanš¸ãy“men˜u“or“question,‘yYa“default“answ˜er“should“b�Ge“pro˜vided“(when“thisŽ¡�‘îºämakš¸ães–ÕMsense),‘õJand“the“default“answ˜er“should“bšGe“made“as“easy“as“p˜ossible“toŽ¡�‘îºäselect.ަ����‘áóÆ3.ŽŽŽ‘îºäUsers'–7answ�¸ãers“should“bšGe“rep˜eated“bacš¸ãk“to“them,‘=to“allo˜w“them“to“v˜erify“thatŽ¡�‘îºäthe–Uprogram's“impression“of“the“answš¸ãer“en˜tered“b˜y“the“user“is“indeed“correct.ަ����‘áóÆ4.ŽŽŽ‘îºäUsers–bLshould“b�Ge“givš¸ãen“a“c˜hance“to“undo“mistak˜es,–¥Še.g.,“b˜y–bLgoing“bac˜k“to“aŽ¡�‘îºäsp•Geci ed›Ó¹p“oin•¸ãt˜earlier˜in˜the˜dialog˜and˜starting˜o“v“er˜from˜there.‘F“F‘ÿ*ªor˜example,Ž¡�‘îºäit–UUshouldn't“b�Ge“necessary“to“stop“T�‘þU>Ÿ'EŽ‘ãxX“and“restart“just“to“ x“a“t�¸ãyping“error.ަ����‘áóÆ5.ŽŽŽ‘îºäWhen–4practical,‘kÎusers'“answš¸ãers“should“b�Ge“c˜hec˜k˜ed“to“mak˜e“sure“they're“notŽ¡�‘îºänonsense;‘&for–àƒexample,›Oif“a“program“requests“an“in�¸ãteger,˜it“should“c•¸ãhec“k‘àƒtheŽ¡�‘îºäresp�Gonse–x`to“makš¸ãe“sure“the“user“didn't“en˜ter“something“else“en˜tirely‘ÿ*ª,‘Á#ratherŽ¡�‘îºäthan–b assume“an“inš¸ãteger“w˜as“en˜tered“and“start“to“pšGerform“op˜erations“on“it.Ž¡�‘îºäIn–+T�‘þU>Ÿ'EŽ‘ãxX“this“wš¸ãould“create“a“risk“of“losing“con˜trol“to“lo˜w-lev˜el“errors“suc˜h“asŽ¡�‘îºäÏMissing–?ýnumber,“treated“as“0–UU²or“ÏArithmetic‘?ýoverflow².ަ����‘áóÆ6.ŽŽŽ‘îºäInformation–`šgivš¸ãen“to“users“should“b�Ge“pro˜vided“in“the“\bšGest“p˜ossible“form",Ž¡�‘îºäwhere–³Zthe“meaning“of“\bšGest“p˜ossible"“m�¸ãust“b˜e“determined“b�¸ãy“common“senseŽ¡�‘îºäfrom–jMthe“circumstances“of“a“particular“application“and“the“targeted“user“group.Ž¡�‘îºäF‘ÿ*ªor–eØexample,‘iùa“straigh•¸ãtforw“ard–eØuse“of“the“Ï\the“²command“to“rep�Gort“the“v‘ÿqÇalueŽ¡�‘îºäof–6a“T�‘þU>Ÿ'EŽ‘ãxX“dimension“parameter“suc�¸ãh“as“Ï\vsize“²to“the“user“will“pro�Gduce“theŽ¡�‘îºäv‘ÿqÇalue–­ in“pšGoin•¸ãts,‘Âùdo“wn–­ to“ v�¸ãe“or“six“decimal“places.‘xêIt“will“normally“b˜e“moreŽ¡�‘îºäuseful–5çto“repšGort“the“v‘ÿqÇalue“rounded“to“the“nearest“whole“p˜oin�¸ãt,‘n or“to“rep˜ortŽ¡�‘îºäit–¡ in“picas,–³ùincš¸ãhes,“or–¡ cen˜timeters|whatev˜er“is“most“con˜v˜enien˜t“for“the“user.Ž¡�‘îºäA‘vwt�¸ãypšGographical–vÁdesigner“or“comp˜ositor“w�¸ãould“probably“prefer“picas,‘¿whileŽ¡�‘îºäsomeone–Gkwith“little“knoš¸ãwledge“of“t˜yp�Gograph˜y“w˜ould“probably“prefer“inc˜hes“orŽ¡�‘îºäcen�¸ãtimeters.ŽŸÌØ��‘Õºâà2Ž‘éúâT�‘ý¿áŸªªEŽ‘ìSX's–€Message-Sending“CapabilitiesŽŸç�‘Õºâ²T‘ÿ*ªable–UUA“lists“the“v‘ÿqÇarious“means“in“T�‘þU>Ÿ'EŽ‘ãxX“for“sending“messages“to“the“user.ŽŽŽ�� þ }ü�’Y7 Although–.¾it“could“b�Ge“argued“that“the“tokš¸ãen“register“Ï\errhelp“²is“another“w˜a˜y“ofޤ �’J7 sending–ƒa“message,‘PÏit“is“excluded“from“T‘ÿ*ªable“A“on“the“grounds“that“it“is“passiv�¸ãeŽ¡�’J7 rather–&%than“activ•¸ãe,‘šXunlik“e–&%the“other“commands“listed.‘ ä6T›ÿ*ªo“put“it“another“w•¸ãa“y˜,Ž¡�’J7 Ï\errhelp–)C²is“merely“a“storage“area“asso�Gciated“with“Ï\errmessage²,‘^>where“auxiliaryŽ¡�’J7 text––can“b�Ge“placed;‘ÕØthe“user“wš¸ãon't“ev˜er“see“Ï\errhelp“²except“b˜y“w˜a˜y“of“Ï\errmessage².ŽŸþ6��’J7 à2.1Ž’h÷ The–€á\message“àprimitiv� eŽŸuT�’J7 ²The–]•Ï\message“²command“is“a“T�‘þU>Ÿ'EŽ‘ãxX“primitivš¸ãe“that“prin˜ts“its“argumen˜t“on“screen.‘2If“theŽ¡�’J7 curren�¸ãt– Ÿscreen“pšGosition“is“not“at“the“b˜eginning“of“a“line,‘*T�‘þU>Ÿ'EŽ‘ãxX“will“add“a“blank“spaceŽ¡�’J7 at–Âmthe“b�Geginning“of“the“message“text“to“separate“it“from“the“preceding“material|Ž¡�’J7 except–uÇthat“if“there“isn't“enough“ro�Gom“on“the“currenš¸ãt“line“to“ t“the“en˜tire“messageŽ¡�’J7 text,›Qëthen–gT�‘þU>Ÿ'EŽ‘ãxX“will“go“to“the“next“line“b�Gefore“starting“to“prin�¸ãt“the“message,˜andŽ¡�’J7 not–p1add“an“extra“blank“at“the“b�Geginning.‘Â[The“maxim�¸ãum“length“of“message“lines“isŽ¡�’J7 con•¸ãtrolled›Aób“y˜the˜constan“t˜ÌmaxÏ_ÌprintÏ_Ìline²,‘EÓwhic“h˜is˜compiled˜in“to˜T�‘þU>Ÿ'EŽ‘ãxX;‘Hithe˜normalŽ¡�’J7 v‘ÿqÇalue–Û÷is“79.‘IS(In“a“windoš¸ãwing“en˜vironmen˜t“the“width“of“the“curren˜t“windo˜w“ma˜y“alsoŽ¡�’J7 a ect–UUthe“maxim�¸ãum“length“of“message“lines.)Ž¡�’Y7 Thš¸ãus–æ€one“w˜a˜y“to“force“a“message“to“start“on“a“new“line“is“to“add“lots“of“Ï\space²'sŽ¡�’J7 at––tthe“end.‘5$But“a“b�Getter“w•¸ãa“y––tto“start“a“message“on“a“new“line,‘æ»or“break“up“aŽ¡�’J7 long–—message“inš¸ãto“lines,‘-çis“to“indicate“line“breaks“with“the“curren˜t“Ï\newlinecharŽ¡�’J7 ²c•¸ãharacter.‘X•F‘ÿ*ªor›÷šexample,‘ *w“e˜can˜set˜the˜newline˜c“haracter˜to˜b�Ge˜Ï+˜²and˜use˜it˜in˜aŽ¡�’J7 message–UUas“follo�¸ãws:Ž©ŒÉ�’J7 Ï\begingroup‘?ý\newlinechar=`+��Ÿü^ÿ±3ŽŽŽ¤ ŒÉ�’J7 Ï\message{+This–?ýis“a+three-line+message“...}Ž¡�’J7 \endgroupŽŸ�’J7 ²whicš¸ãh–5Kpro�Gduces“on“screen“(regardless“of“the“length“of“an˜y“immediately“precedingŽŸ �’J7 message)ަ�’J7 ÏThis–?ýis“aŽ¡�’J7 three-lineŽ¡�’J7 message‘?ý...ŽŸ�’J7 ²In–n�anš¸ãy“one“message,‘´ïa“giv˜en“c˜haracter“can“either“pro�Gduce“newlines,‘´ïor“represen˜tޤ �’J7 itself,›Šäbut–€.not“b�Goth.‘òQAs“a“consequence,˜if“wš¸ãe“w˜an˜ted“a“plus“c˜haracter“in“a“messageŽ¡�’J7 to–/Äactually“prinš¸ãt“on“screen“instead“of“causing“a“line“break,‘f`w˜e“w˜ould“ha˜v˜e“to“setŽ¡�’J7 Ï\newlinechar–fÚ²to“some“other“v‘ÿqÇalue“b�Gefore“sending“the“message.‘"IF‘ÿ*ªrom“this“kno�¸ãwledgeŽ¡�’J7 it's–»Ýa“short“step“to“the“insighš¸ãt“that“for“general“message-sending“purp�Goses“it“w˜ouldŽ¡�’J7 b�Ge›ö•con•¸ãv“enien“t˜to˜set˜Ï\newlinechar˜²to˜the˜c“haracter˜that˜is˜least˜lik“ely˜to˜b�Ge˜neededŽ¡�’J7 in–Üa“message“text.‘[ôThe“nonprinš¸ãting“ASCI�GI‘Ëc˜haracters“in“the“range“0{31“are“ob˜viousŽ¡�’J7 candidates.Ž’J7 Ÿff‰ff�ýåŸ J=����‘ "5Ÿý-:º3ŽŽŽ‘LÜÀUse–Qof“óHßCÊscmtt8ëH\+“Àinstead“of“ëH+“Àhere“w�ÃŽould“normally“b�‘?ý\footnote=macro:ޤ �’ý ->\@ifnextchar–?ý[{\@xfootnote“}“...Ž¡�’ý l.218‘?ý\show\footnoteŽŽŽŽŸ;¹‰ffÞøQ¡��\showtheŽ�‘\¾›\showthe\textwidthŽ���’ý >‘?ý570.93257pt.ŽŸ �’ý l.219‘?ý\showthe\textwidthŽŽŽŽŸ;¹‰ffÞøQ¡��\showboxŽ�‘\¾›\showbox‘?ý0Ž���’ý >‘?ý\box0=ޤ �’ý \hbox(0.0+0.0)x15.0Ž¡¡�’ý !‘?ýOK.Ž¡�’ý l.220‘?ý\showbox0ŽŽŽŽŸ4;¹‰ffÞøQ¡��\showlistsŽ�‘\¾›\showlistsŽ���’ý ###–?ývertical“mode“entered“at“line“0ޤ �’ý ###–?ýcurrent“page:Ž¡�’ý \glue(\topskip)‘?ý3.75Ž¡�’ý ...Ž¡�’ý total–?ýheight“403.47491“plus“14.64996“minus“8.77498Ž¡�’ý goal–?ýheight“751.60756Ž¡�’ý prevdepth–?ý0.0,“prevgraf“2“linesŽ¡¡�’ý !‘ úOK.Ž¡�’ý l.221‘?ý\showlistsŽŽŽŽŸp;¹‰ffÞøQŽ �½Í����ŸŽB3�‘äºâ²But–Õµhere“wš¸ãe“encoun˜ter“an“incon˜v˜enien˜t“idiosyncrasy“of“T�‘þU>Ÿ'EŽ‘ãxX:‘ r‡A‘ÔÎcon˜trolޤ �‘Õºâc•¸ãharacter|suc“h–œlas“conš¸ãtrol-J,“or“Ï^^J‘œZ²(using“T�‘þU>Ÿ'EŽ‘ãxX's“double“caret“notation),‘®2whic˜h“isŽ¡�‘Õºâthe–z›default“v‘ÿqÇalue“for“Ï\newlinechar“²in“ó¾KÈ cmsy8ÂA�‘þ•AŸ¸ãMŽ‘¢ýS�lβ-T�‘þU>Ÿ'EŽ›ãxX“and“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ˜X|došGesn't“ev�¸ãer“pro˜duceŽ¡�‘Õºâline–…Cbreaks“in“a“Ï\message²,‘®àevš¸ãen“if“it“is“curren˜tly“selected“as“Ï\newlinechar².��Ÿü^ÿ±4ŽŽ‘¨ß²Instead,Ž¡�‘Õºâit–nÇwill“alw•¸ãa“ys–nÇb�Ge“prinš¸ãted“as“three“c˜haracters“using“the“double“caret“con˜v˜en˜tion.��Ÿü^ÿ±5ŽŽŽ¡�‘Õºâ²Therefore,‘Þbif–Âùyš¸ãou“w˜an˜t“to“use“Ï\message“²as“y˜our“normal“message-sending“function,Ž‘ÕºâŸŸJ‰ff�ýåŸ J=����‘ "5Ÿý-:º4ŽŽŽ‘LÜÀOr– Êrather,‘æit“didn't“up“unšÃŽtil“v˜ersion“3.141“or“so“of“T�‘þ•AŸ¸ãEŽ‘MX.‘duSee“also“the“men˜tion“of“emT�‘þ•AŸ¸ãEŽ‘MX's“ëH/rޤ €�Àoption–ÕX(whicšÃŽh“allo˜ws“y˜ou“to“use“con˜trol“c˜haracters“for“output“purp�����‘ "5Ÿý-:º5ŽŽŽ‘LÜÀThis–Fusuggests“the“follošÃŽwing“exp�Ÿ'EŽ›ãxX“and“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ˜X“a•¸ãv“oid‘takingŽ¡�’J7 anš¸ãy–UUof“the“prin˜table“c˜haracters“out“of“circulation“for“dialog“purp�Goses.Ž¡�’Y7 If–çno“line“breaks“are“indicated“in“a“Ï\message“²that“is“longer“than“ÌmaxÏ_ÌprintÏ_Ìline²,Ž¡�’J7 T�‘þU>Ÿ'EŽ‘ãxX–z|will“in�¸ãtro�Gduce“arbitrary“breaks“at“the“screen“column“equal“to“ÌmaxÏ_ÌprintÏ_Ìline²,ŽŽŽŽŽŽŽŒ‹tÙ <æ� ýÊ}ü��’ódØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’©ö²5ŽŽ ‚���� þ }ü�‘Õºâwhic�¸ãh–UUusually“meansŽŸ€��ŸîŽ9�‘nÏrandom‘?ýbreaޤ �‘nks–?ýin“the“mŽ¡�‘niddle–?ýof“woŽ¡�‘nrds.ŽŽŽŸ]�‘Õºâ²Those–†Öof“yš¸ãou“who“use“Ï\tracingmacros“²will“ha˜v˜e“noticed“that“its“output“also“has“lineޤ �‘Õºâbreaks–Û�likš¸ãe“this.‘I+Whic˜h“can“mak˜e“it“rather“dicult“to“searc˜h“for“instances“of“a“giv˜enŽ¡�‘Õºâstring–"œin“the“trace“log;‘‰@to“ nd“all“instances“of“Ïxyz“²y�¸ãou“need“a“regular“expressionŽ¡�‘Õºâsomething‘UUlik�¸ãeŽŸÜ�‘ÕºâÏx\n?y\n?zŽŸ|�‘Õºâ²(Ï\n–UU²meaning“`newline',“Ï?“²meaning“0“or“1“o�Gccurrences“of“the“preceding“subpattern).ŽŸª´��‘Õºâà2.2Ž‘ôzâThe–€á\write“àprimitiv� eŽŸuT�‘Õºâ²The–ãFÏ\write“²command,›FÂlik�¸ãe“Ï\message²,˜just“prin�¸ãts“a“message.‘ šBut“the“messageŽ¡�‘ÕºâdošGesn't–Ô©necessarily“app˜ear“on“screen,‘ô~b˜ecause“comm�¸ãunication“with“the“user“is“notŽ¡�‘Õºâthe–:Æpurp�Gose“for“whicš¸ãh“Ï\write“²w˜as“originally“designed:‘<ªIts“initial“purp�Gose“w˜as“toŽ¡�‘Õºâsend–Zªindex“or“table“of“con•¸ãten“ts–Zªinformation,‘[ÿincluding“the“assošGciated“page“n•¸ãum“b˜er,Ž¡�‘Õºâto–:Âan“auxiliary“ le“for“later“pro�Gcessing.‘hëBecause“this“kind“of“use“is“closely“link�¸ãed“toŽ¡�‘Õºâpage›ªXn•¸ãum“b�Gering,‘¿™Ï\write˜²commands˜on˜the˜curren“t˜page˜are˜normally˜sa“v“ed˜up˜toŽ¡�‘ÕºâbšGe–´Ýexecuted“when“the“page“is“actually“shipp˜ed“out,‘Ì¿after“the“page“break“has“b˜eenŽ¡�‘Õºâdetermined.‘ÏEIf–*sucš¸ãh“p•Gostp“onemen˜t–*is“not“w˜an˜ted,‘QŸÏ\write“²m˜ust“b�Ge“used“with“theŽ¡�‘ÕºâÏ\immediate‘UU²pre x.Ž¡�‘äºâIn–‚order“to“alloš¸ãw“in˜tersequen˜tial“writing“to“di eren˜t“output“ les,‘ÍÉthe“Ï\writeŽ¡�‘Õºâ²command–>ptakš¸ães“an“extra“ rst“argumen˜t,‘Ca“n˜um˜bšGer“b˜et•¸ãw“een–>p¸²1“and“16“inclusiv�¸ãe,‘CtoŽ¡�‘Õºâindicate–t the“output“ le“to“whicš¸ãh“the“text“should“b�Ge“sen˜t.‘ÍïOutput“ les“0{15“can“b�GeŽ¡�‘Õºâasso�Gciated–Pwith“a“particular“ le“on“yš¸ãour“system“b˜y“the“Ï\openout“²command;‘/RoutputŽ¡�‘Õºâ le–¯­¸²1“is“the“T�‘þU>Ÿ'EŽ‘ãxX“log“ le,‘ÆCand“output“ le“16“is“the“user's“terminal“screen“(ec�¸ãho�GedŽ¡�‘Õºâin–UUthe“log“ le“as“w�¸ãell).Ž¡�‘äºâLine–ôÂbreaks“in“the“argumenš¸ãt“of“a“Ï\write“²command“can“b�Ge“obtained“b˜y“insertingŽ¡�‘ÕºâÏ\newlinechar›D¬²c•¸ãharacters;‘J:unlik“e˜Ï\message˜²(¸x²2.1)˜and˜Ï\errmessage˜²(¸x²2.3),‘HÏ\writeŽ¡�‘Õºâ²will›alw•¸ãa“ys˜start˜a˜new˜line˜for˜eac“h˜newline˜c“haracter,‘Oev“en˜when˜it˜is˜a˜con“trolŽ¡�‘Õºâc•¸ãharacter›H”suc“h˜as˜Ï^^J².˜Also,‘K!the˜text˜of˜a˜Ï\write˜²command˜alw“a“ys˜starts˜on˜a˜newŽ¡�‘Õºâline–—dand“ nishes“on“a“new“line.‘2wThe“existence“of“the“ nal“newline“maš¸ãy“b�Ge“observ˜ed“inŽ¡�‘Õºâthe–ïÄon-screen“result“of“a“Ï\message“²folloš¸ãwing“a“Ï\write²:‘>ÿthe“message“text“will“alw˜a˜ysŽ¡�‘Õºâstart–,ïon“the“next“line“regardless“of“the“total“length“of“the“Ï\message“²and“Ï\writeŽ¡�‘Õºâ²texts,‘Kwhereas–ð€a“Ï\message“²folloš¸ãwing“another“Ï\message“²or“one“of“T�‘þU>Ÿ'EŽ‘ãxX's“in˜ternallyŽ¡�‘Õºâgenerated– èmessages“(suc�¸ãh“as“input“ le“names)“will“not“start“on“a“new“line“unlessŽ¡�‘Õºâthere–UUisn't“enough“ro�Gom“remaining“on“the“curren�¸ãt“line.Ž¡�‘äºâCorollary:‘`ÆIf–3Syš¸ãou“prompt“the“user“for“some“input“and“y˜ou“w˜an˜t“the“user's“inputŽ¡�‘Õºâto–išapp�Gear“on“the“same“line“as“the“prompt“text,‘n«use“Ï\message“²instead“of“Ï\write“²toŽ¡�‘Õºâsend–UUthe“prompt“text|or“at“least“the“last“line“of“the“prompt“text.ŽŽŽ�� þ }ü�’J7 ÎNonimmediate–ÕTÏ\write“ÎmessagesŽŸuT�’J7 ²Sometimes–÷�it's“useful“to“lea•¸ãv“e–÷�o “the“Ï\immediate“²pre x“of“a“Ï\write“²command“ev�¸ãenޤ �’J7 when–únot“writing“information“to“an“index“ le“or“table“of“con•¸ãten“ts–ú le:‘NšF‘ÿ*ªor“instance,Ž¡�’J7 if–âOyš¸ãou“are“w˜orking“on“page“breaks“in“a“long“do�Gcumen˜t“and“w˜an˜t“to“ nd“out,‘ùPwithoutŽ¡�’J7 previewing–?æor“prinš¸ãting,‘D/if“a“nonforcing“pagebreak“command“had“the“e ect“that“y˜ouŽ¡�’J7 w•¸ãan“ted,‘\y“ou–ßÁcould“insert“a“nonimmediate“Ï\write16“²just“b�Gefore“and“just“after“theŽ¡�’J7 in�¸ãtended–UUpage“break:Ž©8O�’J7 Ï\write16{Before–?ýthe“attempted“pagebreak.}ޤ ŒÉ�’J7 \penalty-9999Ž¡�’J7 \write16{After–?ýthe“attempted“pagebreak.}ŽŸ«†�’J7 ²The–ø message“from“a“nonimmediate“Ï\write16“²will“appšGear“b˜efore“the“closing“Ï]“²of“theޤ �’J7 Ï[‘ª®]–“²pair“that“enclose“the“relev‘ÿqÇanš¸ãt“page“n˜um˜b�Ger.‘\ÜSo“if“all“w˜en˜t“w˜ell,‘# one“of“the“ab�Go˜v˜eŽ¡�’J7 messages–#Ëwill“appšGear“with“one“page“n•¸ãum“b˜er–#Ëand“the“next“message“with“the“nextŽ¡�’J7 page›UUn•¸ãum“b�Ger,˜lik“e˜this:ަ�’J7 Ï[4]‘?ý[5ޤ ŒÉ�’J7 Before–?ýthe“attempted“pagebreak.Ž¡�’J7 ]‘?ý[6Ž¡�’J7 After–?ýthe“attempted“pagebreak.Ž¡�’J7 ]–?ý[7]“[8]“[9]“...ŽŸ«†�’Y7 ²In–nSprošGducing“this“article“(using“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX)“I‘m†had“some“trouble“getting“go˜o˜dޤ �’J7 placemenš¸ãt–s·for“the“ oating“tables“and“examples;‘èto“help“me“exp�Gerimen˜t,‘»OI‘smaddedŽ¡�’J7 some–öºco�Gde“that“wš¸ãould“prin˜t“on“screen“the“page“n˜um˜b�Gers.‘ UõA˜t“the“b�Geginning“ofŽ¡�’J7 Example–UU2“(for“example)“there“is“a“line“that“sa�¸ãysަ�’J7 Ï\write16{Example–?ý2:“Page“\thepage}%ŽŸ«†�’J7 ²The–UUÏ\immediate“²pre x“mš¸ãust“b�Ge“omitted“in“order“to“get“the“page“n˜um˜b�Ger“correct.ŽŸ´ë��’J7 à2.3Ž’h÷ The–€á\errmessage“àprimitiv� eŽŸuT�’J7 ²The–Ž}Ï\errmessage“²command“prinš¸ãts“its“argumen˜t“on“screen,‘œÇstarting“on“a“new“line,Ž¡�’J7 with–Ðan“exclamation“pšGoin�¸ãt“and“a“space“added“at“the“b˜eginning,‘&„and“a“p˜erio˜d“addedŽ¡�’J7 at–UUthe“end.‘qÇF‘ÿ*ªor“example,“Ï\errmessage{Surprise}“²pro�Gducesަ�’J7 Ï!‘?ýSurprise.ŽŸ«†�’J7 ²on–Uscreen.‘]Ï\errmessage“²also“shoš¸ãws“the“Ìcurr–ÿ}'ent‘¨'c“ontext²,‘ˆTwhic˜h–Umeans“the“curren˜t“lineŽ¡�’J7 from–?‡the“currenš¸ãt“input“ le,‘Cäalong“with“the“line“n˜um˜b�Ger,‘Cäand“additional“informationŽ¡�’J7 if–ó³there“is“anš¸ãy“(suc˜h“as“the“surrounding“parts“of“curren˜t“macro“expansions).��Ÿü^ÿ±6ŽŽ‘ͯ²So“theŽ¡�’J7 ÏSurprise–\¶²error“message“wš¸ãould“sho˜w“additional“information“on“screen.‘‡ëSupp�Gose“w˜eŽ¡�’J7 de neŽ’J7 Ÿ¼)‰ff�ýåŸ J=����‘ "5Ÿý-:º6ŽŽŽ‘LÜÀIf–ÕXthe“parameter“ëH\errorcontextlines“Àis“set“high“enough.ŽŽŽŽŽŽŒ‹ƒ? <æ� ýÊ}ü��’ódØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’©ö²6ŽŽ ‚���� þ }ü�‘ÕºâÏ\def\test{\errmessage{Surprise}\relax}Ž©¥�‘Õºâ²Then–UUthe“additional“information“will“lo�Gok“something“lik�¸ãe:ŽŸ1à�‘ÕºâÏ!‘?ýSurprise.ޤ ŒÉ�‘Õºâ\test–?ý->\errmessage“{Surprise}Ž¡�‘s:ˆ\relaxŽ¡�‘Õºâl.454‘?ý\testŽ¡�‘º¾and–?ýsome“more“text.Ž¡�‘Õºâ?ަ�‘Õºâ²This–O>example“maš¸ãy“b�Ge“in˜terpreted“as“follo˜ws:‘n»Line“454“of“the“curren˜t“ le“consists“ofŽŸ1à�‘ÕºâÏ\test–?ýand“some“more“text.ަ�‘Õºâ²The–°ÿline“break“in“the“con�¸ãtext“listing“means“that“T�‘þU>Ÿ'EŽ‘ãxX“is“pro�Gcessing“Ï\test“²and“hasޤ �‘Õºânot–ðßyš¸ãet“started“to“t˜yp�Geset“the“w˜ord“`Ïand²'.‘PKAb�Go˜v˜e“the“Ïl.454²,‘÷the“expansion“of“Ï\testŽ¡�‘Õºâ²is–Nshoš¸ãwn.‘VÅThe“line“break“after“Ï{Surprise}“²indicates“that“T�‘þU>Ÿ'EŽ‘ãxX“has“not“y˜et“executedŽ¡�‘Õºâthe–UUÏ\relax“²command.Ž¡�‘äºâThe–kµbšGeha�¸ãvior“of“Ï\errmessage“²with“resp˜ect“to“newline“cš¸ãharacters“and“con˜trolŽ¡�‘Õºâc�¸ãharacters–\‘is“the“same“as“for“Ï\message²|i.e.,‘^`Ï\errmessage“²will“start“a“new“line“forŽ¡�‘Õºâeacš¸ãh–XÏ\newlinechar“²in“its“argumen˜t“[unless“the“curren˜t“v‘ÿqÇalue“of“Ï\newlinechar“²isŽ¡�‘Õºâoutside–UUthe“visible“ë[asci�8ãi“²range“32{126“and“the“v�¸ãersion“of“T�‘þU>Ÿ'EŽ‘ãxX“is“less“than“3.141].Ž¡�‘äºâAš¸ãt–Èlthe“end“of“an“error“message,‘%1the“user“is“presen˜ted“with“a“question-markŽ¡�‘Õºâprompt,‘S2and–R©a“cš¸ãhoice“of“sev˜eral“pšGossible“resp˜onses.‘pãThese“will“b˜e“discussed“later“inŽ¡�‘Õºâthe–UUsection“on“T�‘þU>Ÿ'EŽ‘ãxX's“capabilities“for“receiving“user“input“(¸x²3.2).ŽŸ|l��‘Õºâà2.4Ž‘ôzâThe–€á\show“àand“á\showthe“àprimitiv� esŽŸuT�‘Õºâ²The–®ýÏ\show“²command,‘Ågused“for“shoš¸ãwing“the“curren˜t“meaning“of“a“con˜trol“sequenceŽ¡�‘Õºâ(or–2‡indeed“of“anš¸ãy“tok˜en),‘9}is“rather“similar“to“the“Ï\errmessage“²command“in“what“itŽ¡�‘Õºâpro�Gduces–¨non“screen.‘8%The“pre x“is“a“greater-than“c�¸ãharacter“instead“of“an“exclamationŽ¡�‘Õºâp�Goin�¸ãt.‘qÇHere's–UUthe“result“of“Ï\newcount\C“\show\C²:ŽŸ1à�‘ÕºâÏ>‘?ý\C=\count78.ŽŸ ŒÉ�‘Õºâl.1–?ý\newcount\C“\show\CŽŸ’�‘Õºâ?ަ�‘Õºâ²As–TDwith“Ï\errmessage²,‘‡®T�‘þU>Ÿ'EŽ‘ãxX“displaš¸ãys“the“surrounding“con˜text“of“a“Ï\show“²command;‘©ôitŽ¡�‘Õºâalso–‚¡o ers“the“same“question-mark“prompt“with“the“same“range“of“pšGossible“resp˜onsesŽ¡�‘Õºâ(wš¸ãell,‘áalmost|the–‘êÏH‘‘™²option“only“giv˜es“a“generic“help“message“ab�Gout“Ï\show²,‘ánotŽ¡�‘ÕºâspšGeci c–UUhelp“ab˜out“the“item“b˜eing“sho�¸ãwn.).Ž¡�‘äºâThe–wdÏ\showthe“²command“is“lik�¸ãe“Ï\show²,‘èbut“is“applied“to“certain“kinds“of“thingsŽ¡�‘Õºâsucš¸ãh–Was“coun˜t“registers“and“tok˜en“registers,‘Šthat“ha˜v˜e“not“only“a“meaning“but“also“aŽ¡�‘Õºâcurrenš¸ãt–Øqv‘ÿqÇalue.‘H&F‘ÿ*ªor“instance,‘ñkhere's“the“result“of“Ï\C=5“\showthe\C²,“using“the“coun˜terŽ¡�‘Õºâde ned‘UUab�Go•¸ãv“e:ŽŽŽ�� þ }ü�’J7 Ï>‘?ý5.ŽŸ ŒÉ�’J7 l.3–?ý\C=5“\showthe\CŽŸ’�’J7 ?Ž©þ6��’J7 à2.5Ž’h÷ The–€á\showbox“àand“á\showlists“àprimitiv� esŽŸuT�’J7 ²The–’jcommands“Ï\showbox“²and“Ï\showlists“²are“similar“to“Ï\show“²in“what“theyޤ �’J7 prošGduce–TŠon“screen“(see“T‘ÿ*ªable“A).‘ogBecause“of“their“sp˜ecialized“nature“they“don'tŽ¡�’J7 ordinarily›UUha•¸ãv“e˜m“uc“h˜application˜in˜dialog˜b�Get“w“een˜T�‘þU>Ÿ'EŽ‘ãxX˜and˜the˜user.ަ��’J7 à2.6Ž’h÷ Piggybac� kingŽŸuT�’J7 ²Manš¸ãy–¿¸messages“prin˜ted“on“screen“b˜y“T�‘þU>Ÿ'EŽ‘ãxX“do“not“in˜v˜olv˜e“an˜y“of“the“commands“listedŽ¡�’J7 in–a3T‘ÿ*ªable“A.‘•bThese“other“messages“are“emitted“directly“bš¸ãy“T�‘þU>Ÿ'EŽ‘ãxX,‘d+outside“the“con˜trolŽ¡�’J7 of–A:the“macro“writer.‘kHo•¸ãw“ev“er,›E@with–A:a“little“imagination,˜yš¸ãou“can“often“ nd“w˜a˜ys“toŽ¡�’J7 attacš¸ãh–6=useful“information“to“those“\inaccessible"“messages.‘gjThis“is“what“I‘65mean“b˜yŽ¡�’J7 Ìpiggyb‘ÿ}'acking².Ž¡�’Y7 F‘ÿ*ªor–Þ example,›€Rwhenev�¸ãer“T�‘þU>Ÿ'EŽ‘ãxX“inputs“a“ le,˜a“message“is“prin�¸ãted“on“screenŽ¡�’J7 conš¸ãtaining–Šthe“name“of“the“ le,‘æenclosed“in“paren˜theses.‘V„So“one“w˜a˜y“to“send“a“shortŽ¡�’J7 message–Žôwš¸ãould“b�Ge“to“create“an“empt˜y“ le“whose“name“w˜as“equal“to“the“desiredŽ¡�’J7 message,–UUand“then“input“the“ le.Ž¡�’Y7 File–¿Xname“messages,›ÙÙapart“from“the“paren•¸ãtheses,˜b�Geha“v“e–¿Xthe“same“as“messagesŽ¡�’J7 prošGduced–\�b�¸ãy“the“Ï\message“²command:‘€8in“particular,‘ž[a“ le“name“message“will“b˜eŽ¡�’J7 app�Gended– Äto“the“curren�¸ãt“line,›xwith“a“preceding“space,˜unless“the“length“of“theŽ¡�’J7 message– I(including“the“t•¸ãw“o› Iparen“theses)˜will˜cause˜it˜to˜cross˜the˜ÌmaxÏ_ÌprintÏ_ÌlineŽ¡�’J7 ²b�Goundary‘ÿ*ª.Ž¡�’Y7 If– Úyš¸ãour“computer“system“allo˜ws“longer“ le“names“y˜ou“could“actually“get“prett˜yŽ¡�’J7 fancy–; with“a“ lename“message.‘iF‘ÿ*ªor“example,‘@Lon“a“Unix“system“supp�Gose“yš¸ãou“ha˜v˜e“aŽ¡�’J7 le–UUnamed“Ïtest.tex“²whose“con•¸ãten“ts‘UUareŽ©ŒÉ�’J7 Ï\newwrite\msgfileޤ ŒÉ�’J7 \immediate\openout\msgfile=Fred.your.fly.is.openŽ¡�’J7 \immediate\write\msgfile{\relax}Ž¡�’J7 \immediate\closeout\msgfileŽ¡�’J7 \input‘?ýFred.your.fly.is.openŽ¡�’J7 \endŽŸ�’J7 ²When–UUÏtest.tex“²is“prošGcessed“b�¸ãy“T�‘þU>Ÿ'EŽ‘ãxX“the“screen“output“will“b˜e“something“lik�¸ãe:ަ�’J7 ÏThis–?ýis“TeX,“C“Version“3.1“(format=plain“91.1.4)“...Ž¡�’J7 (test.tex–?ý(Fred.your.fly.is.open)“)Ž¡�’J7 No–?ýpages“of“output.ŽŽŽŽŽŽŒ‹›‚ <æ� ýÊ}ü��’ódØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’©ö²7ŽŽ ‚���� þ }ü�‘ÕºâHo•¸ãw“ev“er,‘Vˆgetting–#spaces“in“the“message“w�¸ãould“b�Ge“problematic“since“T�‘þU>Ÿ'EŽ‘ãxX“treats“aޤ �‘Õºâspace–‡Qas“a“ le“name“terminator.‘¼And“if“y�¸ãour“message“došGesn't“include“a“p˜erio˜d,Ž¡�‘ÕºâT�‘þU>Ÿ'EŽ‘ãxX–ýis“likš¸ãely“to“add“Ï.tex“²at“the“end“of“the“ le“name“when“Ï\openout“²is“in˜v˜ok˜ed.Ž¡�‘ÕºâNot–�Kto“menš¸ãtion“that“this“metho�Gd“w˜ould“quic˜kly“lead“to“incon˜v˜enien˜t“ le“clutterŽ¡�‘Õºâsince–úT�‘þU>Ÿ'EŽ‘ãxX“can't“delete“ les,‘Ê£only“create“new“ les“or“cš¸ãhange“the“con˜ten˜ts“of“pre-Ž¡�‘Õºâexisting‘UUones.Ž¡�‘äºâOr–^Êconsider“the“counš¸ãt“registers“1{9;‘°ùif“an˜y“of“these“is“nonzero,‘�its“v‘ÿqÇalue“is“rep�GortedŽ¡�‘Õºâon–† screen“whenevš¸ãer“T�‘þU>Ÿ'EŽ‘ãxX“ships“out“a“page.‘êOne“w˜a˜y“of“using“this“feature“migh˜t“b�GeŽ¡�‘Õºâto–ÀrepšGort“the“accum�¸ãulation“of“index“terms“for“a“do˜cumen•¸ãt,‘OÚb“y›Àha“ving˜eac“h˜indexŽ¡�‘Õºâcommand–UUincremenš¸ãt“coun˜t“register“n˜um˜b�Ger“1:Ž©ŒÉ�‘ÕºâÏ\countdef\indexcount=1ޤ ŒÉ�‘Õºâ\def\index{...Ž¡�‘à:Ü\global\advance\indexcount–?ý1“...}ޤ�‘Õºâ²Incremen•¸ãting›N}coun“t˜1˜lik“e˜that˜w“ould˜result˜in˜T�‘þU>Ÿ'EŽ‘ãxX˜displa“ying˜on˜screen˜somethingŽŸ �‘Õºâlik�¸ãeަ�‘ÕºâÏ[1.2]–?ý[2.7]“[3.14]“[4.15]“[5.27]“[6.38]“...Ž¡�‘Õºâ²instead–UUof“the“more“usualަ�‘ÕºâÏ[1]–?ý[2]“[3]“[4]“[5]“[6]“...Ž¡�‘Õºâ²as–UUeac�¸ãh“page“is“shipp�Ged“out.ޤ �‘äºâThese›Glt•¸ãw“o˜examples˜don't˜seem˜extremely˜practical|the˜total˜n“um“b�Ger˜of˜indexŽ¡�‘Õºâterms–…>repšGorted“in“the“latter“example“w�¸ãon't“necessarily“b˜e“correct“page“for“page,‘®Üun�¸ãtilŽ¡�‘Õºâthe–Hñend“of“the“do•Gcumenš¸ãt,‘Kkb“ecause–Hñordinary“means“for“incremen˜ting“the“coun˜ter“areŽ¡�‘Õºâimmediate–Þin“their“e ect“rather“than“sync�¸ãhronized“with“the“Ï\write“²commands“usedŽ¡�‘Õºâfor–YUcreating“the“index“ le|but“the“p�Goin�¸ãt“is“to“realize“that“the“messages“coming“out“ofŽ¡�‘ÕºâT�‘þU>Ÿ'EŽ‘ãxX's–Úªinnards“aren't“totally“b�Geyš¸ãond“reac˜h,‘ó3and“they“can“sometimes“pro˜vide“a“b�GetterŽ¡�‘Õºâw•¸ãa“y–¶“of“acš¸ãhieving“a“giv˜en“result“than“ordinary“methošGds.‘•‚A‘¶zcouple“of“b˜etter-kno�¸ãwnŽ¡�‘Õºâexamples,›z�from–sthe“hands“of“Donald“E.“Kn�¸ãuth,˜can“b�Ge“found“in“the“Ï\showhyphensŽ¡�‘Õºâ²command–UUand“in“Ïhyphen.tex“²at“the“p�Goin�¸ãt“where“Ï\patterns“²is“called.ŽŸþ6�‘ÕºâÎThe–ÕTÏ\showhyphens“ÎcommandŽŸuT�‘Õºâ²The–�ŸÏ\showhyphens“²command“(de ned“in“Ïplain.tex²)“wš¸ãorks“b˜y“exploiting“T�‘þU>Ÿ'EŽ‘ãxX'sŽ¡�‘Õºâmessages–óabšGout“underfull“b˜o�¸ãxes.‘QWhen“an“underfull“line“of“a“paragraph“is“rep˜orted,Ž¡�‘ÕºâT�‘þU>Ÿ'EŽ‘ãxX–Zprinš¸ãts“on“screen“the“elemen˜ts“of“that“line,‘'Àincluding“an˜y“discretionary“h˜yphensŽ¡�‘Õºâinserted–v»bš¸ãy“T�‘þU>Ÿ'EŽ‘ãxX“while“attempting“to“ nd“go•Go“d–v»line“breaks.‘ÕùThe“k˜ey“insigh˜t“forŽ¡�‘Õºâthinking–€up“the“Ï\showhyphens“²command“is“to“realize“that“if“yš¸ãou“can“t˜yp�Geset“a“one-Ž¡�‘Õºâline–.”paragraph,›6Tand“mak�¸ãe“sure“that“the“line“is“underfull,˜then“anš¸ãy“w˜ord“in“that“lineŽ¡�‘Õºâwill›þ ha•¸ãv“e˜its˜h“yphenation˜p�Goin“ts˜displa“y“ed˜on˜screen.‘kîThat's˜exactly˜what˜Kn“uthŽ¡�‘Õºâde ned–UUÏ\showhyphens“²to“do:ŽŽŽ�� þ }ü�’J7 Ï\def\showhyphens#1{\setbox0\vbox{\parfillskip\z@skipޤ ŒÉ�’T·\hsize\maxdimen–?ý\tenrm“\pretolerance\m@ne“\tolerance\m@neŽ¡�’T·\hbadness0\showboxdepth0\‘?ý#1}}ޤ�’J7 ²The–3­settings“of“Ï\parfillskip“²and“Ï\hsize“²ensure“that“the“paragraph“will“b�Ge“all“onŽ© �’J7 one–UUline,“and“underfull.‘qÇ(F‘ÿ*ªor“extra“bullet-pro�Go ng,ŽŸŒÉ�’T·Ï\leftskip\z@skip‘?ý\rightskip\z@skipŽ¡�’J7 ²should–UUprobably“bšGe“included“to˜o.)ަ�’Y7 The–ÿœswitcš¸ãh“to“fon˜t“Ï\tenrm“²mak˜es“sure|or“at“least“reasonably“sure|thatަ�’J7 the–‡åcurrenš¸ãt“fon˜t“is“not“one“for“whic˜h“h˜yphenation“has“b�Geen“inhibited“b˜y“settingަ�’J7 Ï\hyphenchar–O.²to“an“out-of-range“v‘ÿqÇalue.‘ _SThe“settings“of“Ï\pretolerance“²andަ�’J7 Ï\tolerance–s]²ensure“that“hš¸ãyphenation“p�Goin˜ts“will“b�Ge“added“(in“making“up“aަ�’J7 paragraph,‘weT�‘þU>Ÿ'EŽ‘ãxX–?énormally“tries“ rst“to“get“bš¸ãy“without“adding“h˜yphenation“p�Goin˜ts,‘weif“itަ�’J7 can–¿ nd“go•Go“d–¿line“breaks“using“only“the“stretc•¸ãhabilit“y–¿and“shrink‘ÿqÇabilitš¸ãy“of“in˜terw˜ordަ�’J7 glue).‘ ¸‹The––setting“of“Ï\hbadness“²ensures“that“an“ÏUnderfull‘?ý\hbox“²messageަ�’J7 will–c¹b�Ge“senš¸ãt“(otherwise,‘§Qif“the“surrounding“en˜vironmen˜t“had�“Ï\hbadnessŽ‘8-Z²=‘‰¼10000ަ�’J7 when–iëÏ\showhyphens“²wš¸ãas“called,‘¯the“message“w˜ould“b�Ge“suppressed).‘¯ŠThe“settingަ�’J7 of–½�Ï\showboxdepth“²limits“the“information“in“the“message“to“top“lev�¸ãel;‘q–otherwiseަ�’J7 comp�Gound– ìstructures“likš¸ãe“accen˜ted“letters“or“spšGecial“comp˜osites“(e.g.“Ï\AA²)“w�¸ãould“b˜eަ�’J7 shoš¸ãwn–Bin“full“detail|more“detail“than“the“user“normally“w˜an˜ts“to“see.‘ï�And“ nallyަ�’J7 the–ËÏ\ “²command“forces“enš¸ãtry“in˜to“horizon˜tal“mošGde“and,‘´more“imp˜ortan•¸ãtly‘ÿ*ª,‘´pro“videsަ�’J7 a–âGglue“item“b�Gefore“the“ rst“wš¸ãord,‘ƒwithout“whic˜h“it“w˜ould“not“b�Ge“h˜yphenated“(seeަ�’J7 the–Hÿrules“bš¸ãy“whic˜h“T�‘þU>Ÿ'EŽ‘ãxX“lo�Goks“for“h˜yphenatable“w˜ords,›KvÌThe‘ˆ�T�‘þKß'EŽ‘Í-Xb–ÿ}'o“ok²,˜App�Gendix‘HÿH).ަ�’Y7 Note–Ìthat“the“v‘ÿqÇalues“of“Ï\language²,–çÝÏ\lefthyphenmin²,“and–ÌÏ\righthyphenmin“²areަ�’J7 inherited–›‘from“conš¸ãtext;‘¾¯and“this“is“probably“what“y˜ou“w˜an˜t“for“the“Ï\showhyphensަ�’J7 ²command– U(p�Gerhaps“indeed“the“currenš¸ãt“fon˜t“should“also“b�Ge“inherited“from“con˜textަ�’J7 instead–UUof“b�Geing“set“alw•¸ãa“ys–UUto“Ï\tenrm²).ŽŸþ6�’J7 ÎUsing–ÕTerror“con�®9text“to“send“messagesŽŸuT�’J7 ²The–bUstandard“Ïhyphen.tex“²conš¸ãtaining“U.S.“English“h˜yphenation“patterns“has“aަ�’J7 commen�¸ãt–UUafter“the“Ï\patterns“²command:ŽŸŒÉ�’J7 Ï\patterns{–?ý%“just“type““if“you're“not“using“INITEXŽ¡�’J7 ²Ordinarily–�_the“macro“writer“can't“use“commenš¸ãts“to“comm˜unicate“with“the“user,ަ�’J7 b�Gecause–ÈÝcommenš¸ãts“within“the“text“of“a“macro“are“discarded“b˜y“T�‘þU>Ÿ'EŽ‘ãxX“as“the“macroަ�’J7 is–ªide ned.‘qThe“b�Geautš¸ãy“of“the“commen˜t“in“Ïhyphen.tex“²is“that“it“app�Gears“preciselyަ�’J7 when–a‰needed,‘d–b�Gecause“of“the“w•¸ãa“y–a‰T�‘þU>Ÿ'EŽ‘ãxX“displaš¸ãys“con˜text“with“error“messages:‘Š/if“y˜ouަ�’J7 Ï\input–º)hyphen.tex“²when“not“using“ë[initex²,‘Ó^T�‘þU>Ÿ'EŽ‘ãxX“will“giv�¸ãe“an“error“message“whenަ�’J7 it–;Ýencoun�¸ãters“the“Ï\patterns“²command,›@õand“as“usual,˜will“shoš¸ãw“the“con˜text“aroundަ�’J7 the–UUp�Goinš¸ãt“of“the“error,“lik˜e“this:ŽŽŽŽŽŽŒ‹°S <æ� ýÊ}ü��’ódØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’©ö²8ŽŽ ‚���� þ }ü�‘ÕºâÏ!–?ýPatterns“can“be“loaded“only“by“INITEX.ޤ ŒÉ�‘Õºâl.2‘?ý\patternsŽ¡�‘ú»{–?ý%“just“type““if“you're“not“using“INITEXŽ¡�‘Õºâ?ŽŸñI�‘Õºâ²Since–¡4learning“this“tec•¸ãhnique,‘Å;I'v“e–¡4had“o�Gccasion“more“than“once“to“apply“it“in“similarޤ �‘Õºâsituations.‘_}One–ùçsucš¸ãh“application“had“to“do“with“the“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“circle“fon˜ts.‘_}I‘ù½had“anŽ¡�‘Õºâassignmenš¸ãt–Žto“create“a“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“do�Gcumen˜tst˜yle“whose“installation“pro�Gcedures“in˜v˜olv˜edŽ¡�‘Õºârebuilding–=fthe“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“format“ le,‘B0whicš¸ãh“mean˜t“calling“for“the“Ï.tfm“² les“of“the“circleŽ¡�‘Õºâfon•¸ãts.‘ÇÃHo“w“ev“er,‘y)there›qþw“as˜at˜that˜time˜(1990{1991)˜a˜bit˜of˜confusion˜surroundingŽ¡�‘Õºâthe–^inames;‘°¸the“trend“among“distributors“of“T�‘þU>Ÿ'EŽ‘ãxX“appšGears“to“b˜e“a•¸ãw“a“y–^ifrom“the“originalŽ¡�‘Õºânames–cêÏcircle10“²and“Ïcirclew10“²and“to•¸ãw“ard–cêthe“names“Ïlcircle10“²and“Ïlcirclew10².Ž¡�‘ÕºâThe–tƒÏ.tfm“² les“are“the“same“under“either“names,‘¡zbut“I‘tJhad“to“deal“with“the“p�Gossibilit�¸ãyŽ¡�‘Õºâthat–CEsome“users“of“the“do�Gcumen•¸ãtst“yle›CEI‘CAw“as˜w“orking˜on˜w“ould˜ha“v“e˜the˜fon“ts˜underŽ¡�‘Õºâthe–UUolder“names,“while“others“wš¸ãould“ha˜v˜e“them“under“the“new“names.Ž¡�‘äºâMy–ÝRsolution“wš¸ãas“to“use“the“new˜er“names“Ïlcircle10“²and“Ïlcirclew10“²and“putŽ¡�‘Õºâcommenš¸ãts–¦›on“the“same“lines“as“the“fon˜t“assignmen˜ts,‘ºíso“that“the“commen˜ts“w˜ouldŽ¡�‘Õºâapp�Gear–Êmto“the“user“if“T�‘þU>Ÿ'EŽ‘ãxX“w�¸ãere“unable“to“ nd“the“Ï.tfm“² les“and“emitted“an“errorŽ¡�‘Õºâmessage.Ž©��‘ÕºâÏ\font\tencirc=ŽŸ ŒÉ�‘Õºâlcircle10\relax%–?ýType“x“to“exit;“see“sei.prl“for“further“info.ŽŸô:�‘Õºâ²Additional–»†commenš¸ãts“in“the“ le“Ïsei.prl“²explained“ho˜w“to“c˜hange“the“fon˜t“namesŽ¡�‘Õºâto–Šßtheir“older“v‘ÿqÇarianš¸ãts.‘fThe“Ï\relax“²is“necessary“so“that“T�‘þU>Ÿ'EŽ‘ãxX“w˜on't“pro�Gceed“to“theŽ¡�‘Õºânext–¯Éline,‘Æebš¸ãypassing“the“commen˜t,‘Æein“the“prošGcess“of“lo˜oking“for“a“mo˜di er“suc�¸ãh“asŽ¡�‘ÕºâÏscaled–>‹²or“Ïat².‘j/And“the“reason“for“the“line“break“after“the“equals“sign“is“to“ t“a“fewŽ¡�‘Õºâmore–UUcš¸ãharacters“in“the“commen˜t,“whic˜h“w˜ould“b�Ge“elided“b˜y“T�‘þU>Ÿ'EŽ‘ãxX“if“to�Go“long.ŽŸ;��‘Õºâà3Ž‘éúâW‘þàaš ys–€for“T�‘ý¿áŸªªEŽ‘ìSX“to“receiv˜e“messages“from“the“userŽŸç�‘Õºâ²T‘ÿ*ªable–—ŠB“lists“the“v‘ÿqÇarious“means“in“T�‘þU>Ÿ'EŽ‘ãxX“for“reading“input“from“the“user.‘2„The“primaryŽ¡�‘Õºâinput–#†facilit�¸ãy“is“the“Ï\read“²command;‘ŠŸthe“others“are“sp�Gecial“cases“applicable“onlyŽ¡�‘Õºâunder–UUlimited“circumstances.Ž¡�‘äºâThe–‚purp�Gose“of“getting“input“from“the“user“is“essenš¸ãtially“alw˜a˜ys“the“same:‘ì!toŽ¡�‘Õºâgivš¸ãe–»\the“user“an“opp�Gortunit˜y“to“c˜hange“the“outcome“of“the“T�‘þU>Ÿ'EŽ‘ãxX“run,‘ÔÝwhic˜h“w˜ouldŽ¡�‘Õºâotherwise–=ôb�Ge“totally“predetermined“bš¸ãy“the“con˜ten˜ts“of“the“ les“read“b˜y“T�‘þU>Ÿ'EŽ‘ãxX.‘iü(W‘ÿ*ªell,Ž¡�‘Õºâand–UUp�Gerhaps“bš¸ãy“a“few“system“v‘ÿqÇariables“suc˜h“as“Ï\time²,“Ï\day²,“etc.)ŽŸû­��‘Õºâà3.1Ž‘ôzâThe–€á\read“àprimitiv� eŽŸuT�‘Õºâ²The–UUform“of“the“Ï\read“²command“isަ�‘ÕºâÏ\read–?ý16“to“\controlseqŽŽŽ�� þ‰Ö)�Ÿ‚™š��’Ö޲T‘ÿ*ªable–UUB:“ReceivingŽŽŸ���’PVo‰ff^=c¤fd����‘Metho�GdŽŽ’ЬŸ™œ„ ffŽ���’�ß8Prompt›UUdispla•¸ãy“ed˜b“y˜T�‘þU>Ÿ'EŽ‘ãxXŽŽŽŽŸ‰ff^=c¡����‘Ï\readŽŽ’ЬŸ™œ„ffŽ���’�ß8\controlseq=ŽŽŽŽ¤����‘²error–UUmessage“in�¸ãteractionŽŽ’ЬŸ™œ„ffŽ���’�ß8Ï?ŽŽŽŽ¡����‘²`shoš¸ãw'–UUmessage“in˜teractionŽŽ’ЬŸ™œ„ffŽ���’�ß8Ï?ŽŽŽŽ¡����‘²input–UU le“not“foundŽŽ’ЬŸ™œ„ffŽ���’�ß8ÏPlease–?ýtype“another“input“file“name:ŽŽŽŽ¡����‘²output–UU le“not“writableŽŽ’ЬŸ™œ„ffŽ���’�ß8ÏPlease–?ýtype“another“output“file“name:ŽŽŽŽ¡����‘²in•¸ãterrupt‘UUk“eyŽŽ’ЬŸ™œ„ ffŽ���’�ß8noneŽŽŽŽŽŽŽŽŸÄu�’J7 where–ªbthe“n•¸ãum“bšGer–ªb16“is“the“input“stream“n•¸ãum“b˜er,‘¿¦whic“h›ªbmigh“t˜b�Ge˜an“y˜v‘ÿqÇalue˜fromޤ �’J7 ¸²1–yKto“16;‘‹Ea“n•¸ãum“b•Ger›yKb“et•¸ãw“een˜0˜and˜15˜w“ould˜indicate˜reading˜from˜a˜ le˜stored˜onŽ¡�’J7 disk,‘6èwhile–/M16“and“¸²1“indicate“reading“from“the“user's“k�¸ãeyb�Goard.‘eÏ\controlseq“²canŽ¡�’J7 b�Ge–8Ÿ'EŽ‘ãxX“will“displa�¸ãy“a“prompt“ofŽ©Q>�’J7 Ï\controlseq=ŽŸÄu�’J7 ²If–€—the“input“stream“is“¸²1,›‹gthis“prompt“will“b�Ge“omitted.‘ó�In“either“case,˜a“Ï\read‘?ý16Ž¡�’J7 ²or–éÒÏ\read‘?ý-1“²command“should“normally“b�Ge“preceded“b�¸ãy“a“message“that“lets“the“userŽ¡�’J7 knoš¸ãw–UUwhat“kind“of“input“to“pro˜vide.Ž¡�’Y7 The–ögaction“of“the“Ï\read“²command“is“similar“to“that“of“the“Ï\def“²primitiv�¸ãe.Ž¡�’J7 Both– .of“them“create“a“new“macro“conš¸ãtaining“an“unexpanded“tok˜en“list,‘’äwhic˜hŽ¡�’J7 m•¸ãust›·con“tain˜balanced˜braces.‘—The˜balancing˜required˜in˜the˜resp�Gonse˜to˜a˜Ï\readŽ¡�’J7 ²command,›̵ho•¸ãw“ev“er,˜is›´Õsligh“tly˜di eren“t˜than˜for˜a˜Ï\def²;‘ä•as˜long˜as˜there˜an˜equalŽ¡�’J7 n•¸ãum“bšGer–yof“op˜ening“and“closing“braces,‘�ìit“do˜esn't“matter“ho�¸ãw“they're“distributed|Ž¡�’J7 T�‘þU>Ÿ'EŽ‘ãxX–UUwill“bšGe“p˜erfectly“happ�¸ãy“with“the“resp˜onseަ�’J7 Ïa}}}b{{c}{{ŽŸÄu�’J7 ²as–ÅQcan“bšGe“v�¸ãeri ed“using“Ï\show\answer“²after“reading“the“ab˜o•¸ãv“e–ÅQstring“in�¸ãto“Ï\answer².��Ÿü^ÿ±7ŽŽŽ¡�’J7 ²T�‘þU>Ÿ'EŽ‘ãxX–Œewill“read“more“than“one“line,›´•if“necessary‘ÿ*ª,˜if“the“ rst“line“conš¸ãtains“an“unmatc˜hedŽ¡�’J7 brace.‘NÊThis–ì]is“a“useful“prop�Gertš¸ãy“if“y˜ou“Ìwant‘ß5²to“read“more“than“one“line“at“a“time,‘\asŽ¡�’J7 is–|ésometimes“the“case:‘Àïwrite“the“information“in“the“form“Ï{“².–ªª.“.“Ï}²,‘†Îand–|éyš¸ãou“can“ha˜v˜eŽ¡�’J7 as–UUmanš¸ãy“lines“b�Get˜w˜een“the“curly“braces“as“y˜ou“w˜an˜t.Ž¡�’Y7 T�‘þU>Ÿ'EŽ‘ãxX›¬—alw•¸ãa“ys˜reads˜line˜b“y˜line,‘Âhrather˜than˜c“haracter˜b“y˜c“haracter;‘Ø9unlik“e˜someŽ¡�’J7 other–Yprogramming“languages,‘ZT�‘þU>Ÿ'EŽ‘ãxX“proš¸ãvides“no“w˜a˜y“to“read“a“single“c˜haracter“andŽ’J7 Ÿiff�ýåŸ J=����‘ "5Ÿý-:º7ŽŽŽ‘LÜÀSee–¯halso“ÂxÀ5.7.‘UQI‘¯0questioned“the“bšŸ'EŽ‘ãxX“presen˜ts“the“user“with“a“question-Ž¡�‘Õºâmark–%/prompt.‘áTT�¸ãyping“a“second“question“mark“in“reply“to“the“prompt“will“causeŽ¡�‘ÕºâT�‘þU>Ÿ'EŽ‘ãxX–UUto“list“the“options“that“are“a�¸ãv‘ÿqÇailable:Ž©ŒÉ�‘ÕºâÏ!–?ýError“message.ޤ ŒÉ�‘êºÖ...Ž¡�‘Õºâ?‘?ý?Ž¡�‘ÕºâType–?ý“to“proceed,“S“to“scroll“future“error“messages,Ž¡�‘ÕºâR–?ýto“run“without“stopping,“Q“to“run“quietly,Ž¡�‘ÕºâI–?ýto“insert“something,“E“to“edit“your“file,Ž¡�‘Õºâ1–?ýor“...“or“9“to“ignore“the“next“1“to“9“tokens“of“input,Ž¡�‘ÕºâH–?ýfor“help,“X“to“quit.Ž¡�‘Õºâ?ŽŸ�‘Õºâ²Cho�Gosing–Gýthe“ÏH‘G¿²option“causes“T�‘þU>Ÿ'EŽ‘ãxX“to“prinš¸ãt“a“help“message“con˜taining“additionalޤ �‘Õºâinformation–cÇrelated“to“the“error“message.‘�If“the“error“message“w�¸ãas“generated“usingŽ¡�‘ÕºâÏ\errmessage²,‘:bthen–Ù`the“help“message“will“consist“of“the“currenš¸ãt“con˜ten˜ts“of“theŽ¡�‘Õºâtokš¸ãen–è�register“Ï\errhelp“²(whic˜h“should“b�Ge“ lled“with“something“useful“b˜y“the“macroŽ¡�‘Õºâwriter,›jimmediately–ñpb�Gefore“the“call“to“Ï\errmessage²).‘P{Otherwise,˜for“a“built-in“errorŽ¡�‘Õºâmessage,–UUthe“corresp�Gonding“built-in“help“message“(from“Ïtex.pool²)“is“displa•¸ãy“ed.Ž¡�‘äºâThe–ì'inš¸ãtended“use“of“the“insertion“(ÏI²)‘ë¾and“tok˜en“deletion“(Ï1...9²)“options“isŽ¡�‘Õºâfor–„error“reco•¸ãv“ery;‘ßafter›„y“ou˜lo�Gok˜at˜the˜con“text˜of˜an˜error,‘rÐy“ou˜ma“y˜b�Ge˜ableŽ¡�‘Õºâto–¾WtempšGorarily“repair“the“damage“and“con•¸ãtin“ue–¾Wpro˜cessing“the“remainder“of“theŽ¡�‘Õºâdo�Gcumen•¸ãt,‘¶b“y›oÝremo“ving˜some˜tok“ens˜and/or˜inserting˜others.‘Á_Then˜if˜an“y˜otherŽ¡�‘Õºâerrors–CÒare“unco•¸ãv“ered–CÒlater,‘pthey“can“b�Ge“ xed“at“the“same“time“as“the“ rst“error,Ž¡�‘Õºâinstead–êëof“requiring“a“second“T�‘þU>Ÿ'EŽ‘ãxX“run“to“ nd“them.›NNExample“1“illustrates“this.˜Y‘ÿ*ªouŽ¡�‘Õºâcan–ˆ¤actually“delete“up“to“99“tokš¸ãens“at“a“time“in“all“implemen˜tations“of“T�‘þU>Ÿ'EŽ‘ãxX“that“IŽ¡�‘Õºâknoš¸ãw–UUof,“ev˜en“though“the“help“message“suggests“that“9“is“the“maxim˜um.Ž¡�‘äºâThe–âAtokš¸ãen“deletion“option“can“also“serv˜e“as“the“basis“of“a“crude“men˜u“facilit˜y‘ÿ*ª.Ž¡�‘ÕºâThe–ߺidea“is“to“use“Ï\errmessage“²to“presenš¸ãt“a“men˜u“with“c˜hoices“lab�Geled“b˜y“n˜um˜b�Gers.Ž¡�‘ÕºâIf–aFthe“user“resp�Gonds“bš¸ãy“en˜tering,–¤Asa˜y‘ÿ*ª,“Ï3–aF²to“c˜ho�Gose“item“3,‘¤Athen“w˜e“m˜ust“arrangeŽ¡�‘Õºâthings–ê]so“that“after“Ï\errmessage“²do�Ges“its“normal“thing“of“deleting“three“tok�¸ãens,‘ÿÂtheŽ¡�‘Õºâfollo•¸ãwing›õ tok“en˜that˜w“as˜not˜deleted˜should˜do˜something˜to˜ensure˜that˜item˜3˜willŽ¡�‘ÕºâbšGe–UUselected.‘qÇThis“isn't“to˜o“hard“if“wš¸ãe“use“something“lik˜e“the“follo˜wing“sequence:ަ�‘ÕºâÏ\errmessage{...}\0\1\2\3\4\5\6\7‘?ý...\stopŽŸ�‘Õºâ²Clearly–ú the“deletion“of“three“tokš¸ãens“after“the“error“message“will“lea˜v˜e“Ï\3“²as“the“nextŽ¡�‘Õºâcommand– Þto“b�Ge“executed,‘�and“so“if“wš¸ãe“de ne“Ï\3“²to“do“the“righ˜t“thing“and“then“skipŽŽŽ��Ÿ‹Ö–��’J7  þv ̉ffj|( ‰‹Î�„‰‹Îff� þ‡eù�‘ ™›Example–ãÐ1:‘޽Using“error“in�¸ãteraction“pšGossibilities“to“get“past“a“p˜oten�¸ãtially“badŽŸ �‘ ™›error:‘qÇa–UUmissing“Ï\\“²b�Gefore“an“Ï\hline“²in“a“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“Ïtabular“²en•¸ãvironmen“t.ŽŸŒÉ�‘ ™›Ï!–?ýMisplaced“\noalign.ޤ ŒÉ�‘ ™›\hline‘?ý->\noalignŽ¡�‘he{\ifnum–?ý0=`}\fi“\hrule...Ž¡�‘ ™›l.120‘?ý\hlineŽ©’�‘ ™›?ŽŸ�‘ ™›²Let's–UUsee“what“the“help“information“is:ŽŸŒÉ�‘ ™›Ï?‘?ýhŽ¡�‘ ™›I–?ýexpect“to“see“\noalign“only“after“the“\cr“of“an“alignment.Ž¡�‘ ™›Proceed,–?ýand“I'll“ignore“this“case.ަ�‘ ™›?ŽŸ�‘ ™›²Let's–UUtry“skipping“one“tokš¸ãen“to“v˜erify“what“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“is“going“to“pro�Gcess“next:ŽŸŒÉ�‘ ™›Ï?‘?ý1ަ�‘ ™›\hline–?ý->\noalign“{Ž¡�‘mYb\ifnum–?ý0=`}\fi“\hrule...Ž¡�‘ ™›l.120‘?ý\hlineަ�‘ ™›?Ž©�‘ ™›²All–°Ÿrighš¸ãt,‘Çqthe“op�Gening“curly“brace“has“just“gone“b˜y–ÿ*ª.‘ƒ¤W“e–°Ÿneed“to“insert“the“Ï\\ޤ �‘ ™›²that–Zòwš¸ãas“forgotten,‘\Yand“also“replace“the“t˜w˜o“tok˜ens“Ï\noalign“²and“Ï{“²that“ha˜v˜eŽ¡�‘ ™›slipp�Ged‘UUb�¸ãy‘ÿ*ª.ŽŸŒÉ�‘ ™›Ï?–?ýi\\“\noalign{ަ�‘ ™›²And–UUnoš¸ãw“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“will“b�Ge“able“to“con˜tin˜ue“with“the“rest“of“the“table.ŽŽ’i¯\„‰‹ÎffŽžff‰ffj|(ŽŽŸ�’J7 o•¸ãv“er–Z the“folloš¸ãwing“Ï\4\5...“²corresp�Gonding“to“unselected“men˜u“c˜hoices,‘[9w˜e“get“whatޤ �’J7 w•¸ãe‘UUw“an“t.Ž¡�’Y7 If–;³the“user“just“presses“ë[return“²without“enš¸ãtering“a“n˜um˜bšGer,‘@Ôit“will“b˜e“Ï\0“²that“isŽ¡�’J7 executed|therefore–UUÏ\0“²should“bšGe“de ned“to“pro˜duce“the“default“selection.Ž¡�’Y7 One–·®thing“that“makš¸ães“me“call“this“crude“is“the“fact“that“T�‘þU>Ÿ'EŽ‘ãxX“pauses“after“an˜yŽ¡�’J7 tok�¸ãen–¨Ûdeletion“op�Geration“instead“of“barging“ahead.‘lYThis“means“that“if“the“userŽ¡�’J7 c•¸ãho�Goses›¥Ñan“ything˜other˜than˜the˜default˜selection,‘¹ðthey˜will˜ha“v“e˜to˜press˜ë[returnŽ¡�’J7 ²tš¸ãwice–UUafter“t˜yping“the“n˜um˜b�Ger,“instead“of“just“once.ŽŽŽŽŽŽŒ‹ äf <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²10ŽŽ ‚���� þ }ü�‘äºâSome–Æ3other“crudities“are“inš¸ãtro�Gduced“b˜y“the“bits“and“pieces“of“an“Ï\errmessageŽ© �‘Õºâ²that–UUcannot“b�Ge“suppressed.‘qÇThese“include:ޤ����‘äºã¸ŽŽŽ‘îºä²Exclamation–UUpšGoin�¸ãt“and“space“at“the“b˜eginning“of“the“error“message.Ž¡����‘äºã¸ŽŽŽ‘îºä²P�¸ãerio�Gd–UUat“the“end“of“the“error“message.Ž¡����‘äºã¸ŽŽŽ‘îºä²The–> expansion“of“the“currenš¸ãt“macro“(if“the“error“message“is“con˜tained“in“aަ�‘îºämacro),‘ç¥on›—/t•¸ãw“o˜lines˜with˜the˜line˜break˜immediately˜after˜the˜tok“en˜thatަ�‘îºäwš¸ãas–zVlast“pro�Gcessed“b˜y“T�‘þU>Ÿ'EŽ‘ãxX.‘àÉThis“includes,›ƒ–at“the“b�Geginning,˜the“macro“nameަ�‘îºäfollo•¸ãw“ed–±either“bš¸ãy“Ï->²,‘#9if“the“ rst“part“of“the“expansion“text“is“relativ˜ely“short,ަ�‘îºäor–#Nb�¸ãy“ellipsis“dots“Ï...“²plus“the“tail“end“of“the“ rst“part“of“the“expansion“text.Ž¡����‘äºã¸ŽŽŽ‘îºä²The–§%currenš¸ãt“line“of“the“curren˜t“ le,‘»™on“t˜w˜o“lines“with“the“break“immediatelyަ�‘îºäafter–UUthe“tokš¸ãen“that“w˜as“last“pro�Gcessed“b˜y“T�‘þU>Ÿ'EŽ‘ãxX.Ž¡����‘äºã¸ŽŽŽ‘îºä²The–UUquestion“mark“and“space“prompting“the“user“for“a“resp�Gonse.Ž¡�‘äºâI‘»rw•¸ãould›»Œha“v“e˜hop�Ged˜that˜setting˜Ï\errorcontextlines˜²to˜0˜or˜¸²1˜w“ould˜causeަ�‘Õºâthe–�`innermost'“t•¸ãw“o–�lines“of“the“error“conš¸ãtext“to“b�Ge“suppressed“but“apparen˜tly“thereަ�‘Õºâis–pno“v‘ÿqÇalue“for“Ï\errorcontextlines“²that“will“suppress“them.‘%€The“follo�¸ãwing“exampleަ�‘Õºâillustrates–UUall“of“the“nonsuppressable“parts.Ž©ŒÉ�‘ÕºâÏ!‘?ýError.ޤ ŒÉ�‘Õºâ\CM–?ý->\errmessage“{Error}Ž¡�‘Xú—\CMŽ¡�‘Õºâl.38‘?ý\CMŽ¡��ºÊ%–?ýA“comment“in“the“file,“line“38Ž¡�‘Õºâ?‘?ýxŽŸ�‘Õºâ²Except–UUfor“the“ellipsis“dots“alternativš¸ãe,“that“is.‘qÇHere's“ho˜w“that“lo�Goks:ަ�‘ÕºâÏ!–?ýLonger“message“text,“forcing“elision.Ž¡�‘Õºâ\CM–?ý...sage“{Longer“message“text,“forcing“elision}Ž¡�’Ü:L\CMŽ¡�‘Õºâl.38‘?ý\CMŽ¡��ºÊ%–?ýA“comment“in“the“file,“line“38Ž¡�‘Õºâ?ŽŸ�‘Õºâ²Although–V.the“exact“n•¸ãum“bšGer–V.can“v‘ÿqÇary“(dep˜ending“on“hoš¸ãw“y˜our“particular“v˜ersion“ofޤ �‘ÕºâT�‘þU>Ÿ'EŽ‘ãxX–(»is“con gured“at“compile“time),‘1§the“maximš¸ãum“length“of“the“ rst“line“of“con˜textŽ¡�‘Õºâis–$normally“b�Get•¸ãw“een–$40“and“50“cš¸ãharacters,‘MØand“if“the“expansion“text“w˜ould“mak˜eŽ¡�‘Õºâthe–µ˜line“longer“than“this,‘Í©it“is“truncated“at“the“b�Geginning“and“the“ellipsis“dots“areŽ¡�‘Õºâinserted.Ž¡�‘äºâV‘ÿ*ªery–/ðwš¸ãell“then.‘˜Since“w˜e“ha˜v˜e“Ï!²,–f—Ï.²,“and–/ðÏ->“²or“Ï...“²in“the“ rst“t˜w˜o“lines“(theŽ¡�‘Õºâlines–Šthat“will“b�Ge“nearest“our“menš¸ãu“text),‘—Kand“w˜e“cannot“get“rid“of“them,‘—Kthe“nextŽŽŽ�� þ }ü�’J7 bšGest–õÿthing“is“to“camou age“them.‘ROne“p˜ossibilit�¸ãy“is“setting“Ï\newlinechar=`\!“²justޤ �’J7 b�Gefore–ssending“the“Ï\errmessage²,‘ºŠso“that“the“Ï!“²c�¸ãharacter“will“cause“a“blank“lineŽ¡�’J7 rather–ÿ8than“prinš¸ãting“on“screen,‘)°and“then“putting“a“bunc˜h“of“p•Gerio“ds–ÿ8in“the“men˜uŽ¡�’J7 text–UUto“camou age“the“other“p•Gerio“ds.Ž¡�’Y7 App�Gendix–§„D“exhibits“Ïfontmenu.tex²,‘¼a“more“extensivš¸ãe“w˜orking-out“of“this“ideaŽ¡�’J7 in–ÍRwhicš¸ãh“I‘Í3tried“to“p�Gound“the“recalcitran˜t“Ï\errmessage“²in˜to“the“most“presen˜tableŽ¡�’J7 shap•Ge›UUp“ossible,˜using˜ev•¸ãery˜macro˜hac“k˜I˜could˜think˜of.Ž©þ6��’J7 à3.3Ž’h÷ Shoš w–€message“`reco˜v˜ery'ŽŸuT�’J7 ²After–&a“Ï\show²,–²ZÏ\showthe²,“Ï\showbox²,“or–&Ï\showlists“²command,‘²ZT�‘þU>Ÿ'EŽ‘ãxX“o ers“aŽ¡�’J7 question-mark–>^prompt,‘xŸand“the“same“men�¸ãu“of“options“as“after“an“error“message.Ž¡�’J7 There–ÏCis“only“one“slighš¸ãt“di erence:‘.¾The“ÏH‘Ï!²option“pro˜vides“no“access“to“the“Ï\errhelpŽ¡�’J7 ²tok�¸ãen–„œregister;‘œ?only“a“generic“help“message“ab�Gout“the“Ï\show...“²commands“isŽ¡�’J7 a�¸ãv‘ÿqÇailable.ަ��’J7 à3.4Ž’h÷ \Please–€t� yp�`e“another“input“ le“name:"ŽŸuT�’J7 ²When–*Nyš¸ãou“see“this“prompt,‘2édispla˜y˜ed“b˜y“T�‘þU>Ÿ'EŽ‘ãxX“when“it's“unable“to“ nd“an“input“ le,Ž¡�’J7 y•¸ãou›.žha“v“e˜stra“y“ed˜in“to˜one˜of˜the˜less˜friendly˜b“yw“a“ys˜of˜T�‘þU>Ÿ'EŽ‘ãxX.‘ý£If˜y“ou˜can't˜thinkŽ¡�’J7 up–Ð\a“go•Go“d–Ð\ le“name“to“givš¸ãe“as“an“answ˜er,‘ïy˜ou“could“get“stuc˜k“in“an“endless“lo�Gop.Ž¡�’J7 Evš¸ãen–Ĥsimply“pressing“the“ë[return“²k˜ey“causes“T�‘þU>Ÿ'EŽ‘ãxX,›àwon“most“computer“systems,˜toŽ¡�’J7 lo�Gok–øfor“a“ le“called“`Ï.tex²'“whicš¸ãh“will“most“lik˜ely“b�Ge“nonexisten˜t.‘V¨P˜o˜w˜er“users“kno˜wŽ¡�’J7 that–$on“manš¸ãy“systems“y˜ou“can“en˜ter“a“ le“name“of“`Ïnul²'“to“cause“T�‘þU>Ÿ'EŽ‘ãxX“to“read“in“anŽ¡�’J7 emptš¸ãy–©‰ le“named“Ïnul.tex².‘nbBut“it“is“precisely“p�Go˜w˜er“users“who“are“lik˜ely“to“kno˜wŽ¡�’J7 other›)Âw•¸ãa“ys˜of˜getting˜past˜this˜prompt˜(for˜example,‘2yon˜some˜systems˜t“yping˜a˜Ï^^ZŽ¡�’J7 ²or–¹ÜÏ^^D“²c�¸ãharacter“also“do�Ges“something“useful),‘Òýand“it“is“precisely“the“users“with“noŽ¡�’J7 other–UUclue“what“to“try“next“who“wš¸ãon't“kno˜w“ab�Gout“Ïnul.tex².Ž¡�’Y7 It–.sseems“that“it“wš¸ãould“b�Ge“useful“for“all“standard“distributions“of“T�‘þU>Ÿ'EŽ‘ãxX“to“pro˜videŽ¡�’J7 les–îmnamed“Ï.tex²,–³Ïh.tex²,“Ïhelp.tex²,“and–îmÏ?.tex“²in“the“standard“T�‘þU>Ÿ'EŽ‘ãxX“inputs“path,Ž¡�’J7 so–|’that“when“users“t�¸ãyp�Ge“Ïh“²or“Ïhelp“²or“Ï?“²or“just“press“ë[return²,‘`they“will“getŽ¡�’J7 the–[LcorrespšGonding“ le.‘ƒ«(Unfortunately‘ÿ*ª,‘œÉmost“op˜erating“systems“don't“p˜ermit“theŽ¡�’J7 question–W„mark“in“ le“names,‘ŠGwhic�¸ãh“means“that“only“the“other“three“ les“will“normallyŽ¡�’J7 b�Ge–UUviable.)‘qÇÏHelp.tex“²and“its“clones“could“con�¸ãtain“something“as“simple“as:ŽŸŒÉ�’J7 Ï\errmessage{Type–?ý?“to“see“your“options;“X“to“exit}ŽŸ�’J7 ²whic•¸ãh›çw“ould˜giv“e˜the˜user˜access˜to˜the˜full˜men“u˜of˜normal˜error˜reco“v“ery˜options.��Ÿü^ÿ±8ŽŽŽ’J7 ŸX-‰ff�ýåŸ J=����‘ "5Ÿý-:º8ŽŽŽ‘LÜÀThis–1Îidea“is“discussed“at“greater“length“in“a“recen�ÃŽt“ó#Ñf�cmti8ÃTUGb•�¥o“at–1ÎÀarticle“of“mine“(to“app�Ÿ'EŽ‘ãxX“v˜ersion),‘Êwhic˜h“has“a“statemen˜t“Ï\input“fontdef.tex²,‘Êwhere“theŽ¡�‘Õºâ le–ŸÒÏfontdef.tex“²is“normally“missing,›òpin•¸ãten“tionally‘ÿ*ª,˜and–ŸÒthe“user“is“supp�Gosed“toŽ¡�‘Õºâsubstitute–\µanother“ le“name“suc�¸ãh“as“Ïfontdef.ori“²or“Ïfontdef.max².‘‡çThe“idea“ofŽ¡�‘Õºâcommenš¸ãts–áBdesigned“to“app�Gear“through“T�‘þU>Ÿ'EŽ‘ãxX's“displa˜y“of“error“con˜text“(¸x²2.6)“couldŽ¡�‘ÕºâbšGe–">used“to“go˜o˜d“adv‘ÿqÇanš¸ãtage“here,‘Uxto“tell“the“user“what“other“ le“names“are“lik˜elyŽ¡�‘Õºâcandidates:ŽŸ`�‘ÕºâÏ\input–?ýfontdef.tex“%“Try“fontdef.ori“or“fontdef.maxŽŸŠ—�‘Õºâ²In–xþthis“kind“of“application,‘�éadditional“help“information“in“a“message“preceding“theŽ¡�‘ÕºâÏ\input–UU²statemen�¸ãt“could“also“b�Ge“useful.ŽŸäð��‘Õºâà3.5Ž‘ôzâIn• terrupt‘€k“eyަ�‘Õºâ²The–z°inš¸ãterrupt“k˜ey“is“a“k˜ey“(system-dep�Genden˜t,‘¦kbut“Ï^^C“²on“man˜y“systems)“that“allo˜wsŽ¡�‘Õºâyš¸ãou–<Àto“in˜terrupt“T�‘þU>Ÿ'EŽ‘ãxX“when“it“is“in“the“middle“of“doing“something“else.‘i•The“normalŽ¡�‘Õºâreaction–UUof“T�‘þU>Ÿ'EŽ‘ãxX“when“the“inš¸ãterrupt“k˜ey“is“pressed“is“to“prin˜t“a“messageŽŸ`�‘ÕºâÏ!‘?ýInterruption.ޤ ŒÉ�‘Õºâ...–?ý%“current“contextŽ¡�‘Õºâ?ŽŸŠ—�‘Õºâ²in–Bthe“same“form“as“an“error“message,›­complete“with“a“question-mark“prompt,˜withޤ �‘Õºâthe–UUusual“options“a�¸ãv‘ÿqÇailable“to“the“user.Ž¡�‘äºâIt's–qƒstretcš¸ãhing“the“concept“a“bit“to“claim“that“the“in˜terrupt“k˜ey“is“a“w˜a˜y“forŽ¡�‘Õºâusers–üto“send“information“to“T�‘þU>Ÿ'EŽ‘ãxX;‘Orit“has“the“ a•¸ãv“or–üof“the“story“ab�Gout“the“farmerŽ¡�‘Õºâwho–Ô£had“to“whacš¸ãk“his“m˜ule“o˜v˜er“the“head“with“an“axe“handle“\just“to“get“hisŽ¡�‘Õºâatten•¸ãtion".‘dËWhen›.by“ou˜in“terrupt˜T�‘þU>Ÿ'EŽ‘ãxX˜y“ou˜could˜easily˜ nd˜y“ourself˜in˜the˜middle˜ofŽ¡�‘Õºâsome–¨+complex“macro“where“it“wš¸ãould“b�Ge“inadvisable“to“do“an˜ything“except“use“theŽ¡�‘ÕºâÏX–UU²option“to“exit.‘qÇHo•¸ãw“ev“er,–UUthis“in“itself“is“frequen�¸ãtly“useful.ŽŸø~��‘Õºâà4Ž‘éúâStum• bling›€blo�`c“ks˜in˜the˜use˜of˜á\write˜àand˜á\messageŽŸç��‘Õºâà4.1Ž‘ôzâLine‘€breakingަ�‘Õºâ²As–Òexplained“elsewhere“(¸x²2.1)“it“is“imp�Gossible“to“use“a“conš¸ãtrol“c˜haracter“as“a“newlineŽ¡�‘Õºâcš¸ãharacter–Iúin“the“argumen˜t“of“a“Ï\message“²or“Ï\errmessage“²command.‘O¶Ì[Note‘tú(30-Ž¡�‘ÕºâOct-1993):‘Fthat's–ê%no“longer“true,‘ÿµas“of“T�‘þKß'EŽ‘Í-X“version“3.141.]‘‹²L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ›ãxX–³and“¸A�‘þU>Ÿ'MŽ‘ ‹S‘€²-T�‘þU>Ÿ'EŽ˜XŽ¡�‘Õºâuse–€bÏ\immediate\write“²instead“of“Ï\message“²in“their“all-purp�Gose“message“macrosŽ¡�‘Õºâ(Ï\typeout–Yò²and“Ï\W@²),‘Œ9whicš¸ãh“allo˜ws“them“to“ha˜v˜e“Ï^^J‘Y²²as“the“default“newline“c˜haracter,Ž¡�‘Õºâth•¸ãus›£Jlea“ving˜all˜of˜the˜prin“table˜c“haracters˜usable˜in˜message˜texts.‘[¥(If˜a˜giv“enŽŽŽ�� þ }ü�’J7 cš¸ãharacter–þ½is“the“curren˜t“Ï\newlinechar²,‘)there“really“is“no“w˜a˜y“for“T�‘þU>Ÿ'EŽ‘ãxX“to“prin˜t“itޤ �’J7 on–Òscreen.‘çÔT‘ÿ*ªry“setting“Ï\newlinechar=`\(“²and“see“what“happ�Gens“to“the“ le“nameŽ¡�’J7 messages–UUfor“input“ les.)Ž¡�’Y7 There–Ÿ'EŽ‘ãxX“without“mošGdi cations),“then“rewrite“the“ rst“line“ab˜o•¸ãv“e‘UUas:ަ�’J7 Ï\begingroup‘?ý\newlinechar=\endlinecharŽŸ ŒÉ�’J7 \catcode\endlinechar=12–?ý%“Make“it“'other'ŽŸÍ�’J7 ²Here–”üwš¸ãe“mak˜e“the“reasonable“assumption“that“Ï\endlinechar“²has“its“normal“v‘ÿqÇalueŽ¡�’J7 of–¯H13“(Ï^^M²);“evš¸ãen“this“assumption“could“b�Ge“done“without“b˜y“adding“the“statemen˜tŽ¡�’J7 Ï\endlinechar–UU=“13“²b�Gefore“the“other“assignmen�¸ãts.Ž¡�’Y7 The–¾«p�Gercenš¸ãt“sign“is“necessary“after“the“Ï\endgroup“²in“the“ rst“v‘ÿqÇarian˜t,‘Ùb�GecauseŽ¡�’J7 the–3éendline“cš¸ãharacter“for“a“giv˜en“line“is“added“when“the“line“is“initially“read,‘:˜b�GeforeŽ¡�’J7 T�‘þU>Ÿ'EŽ›ãxX–½ùb�Gegins“to“execute“the“line.‘?STherefore“b�¸ãy“the“time“T�‘þU>Ÿ'EŽ˜X“pro�Gcesses“the“Ï\endgroupŽ¡�’J7 ²and–Ayrevš¸ãerts“to“the“previous“v‘ÿqÇalue“of“Ï\endlinechar²,‘Erit“is“to�Go“late“to“prev˜en˜t“gettingŽ¡�’J7 a–UUnewline“cš¸ãharacter“at“the“end“of“the“curren˜t“line.Ž’J7 ŸòL‰ff�ýåŸ J=����‘ "5Ÿý-:º9ŽŽŽ‘LÜÀAlthough–dÓthe“ëH^^J‘dmÀcomšÃŽbination“will“b�Ÿ'EŽ‘ãxX“and“cannotޤ �‘Õºâb�Ge–3:cš¸ãhanged“b˜y“an˜y“statemen˜ts“within“that“line.‘ u(The“Ï\catcode²,–j³ho˜w˜ev˜er,“of‘3:theŽ¡�‘ÕºâÏ\endlinechar–UU²can“b�Ge“cš¸ãhanged“b˜y“statemen˜ts“within“the“line.)ŽŸþ6��‘Õºâà4.2Ž‘ôzâExpanding–€con� trol“sequencesŽŸuT�‘Õºâ²In–Imessages“to“a“T�‘þU>Ÿ'EŽ‘ãxX“user“it's“frequenš¸ãtly“necessary“to“refer“to“con˜trol“sequencesŽ¡�‘Õºâor–B]cš¸ãharacters“that“ha˜v˜e“spšGecial“category“co˜des.‘kuThis“can“sometimes“b˜e“problematicŽ¡�‘Õºâb�Gecause–7šof“the“expansion“that“is“done“in“the“argumen�¸ãt“of“a“Ï\message“²or“Ï\writeŽ¡�‘Õºâ²command.‘qÇF‘ÿ*ªor–UUexample,“the“lineަ�‘ÕºâÏ\message{Beware–?ýof“\footnote“in“a“\message!}ŽŸ�‘Õºâ²will–ZÌtš¸ãypically“generate“a“h˜undred“or“so“error“messages“when“T�‘þU>Ÿ'EŽ‘ãxX“reac˜hesŽ¡�‘ÕºâÏ\footnote².‘n©(Although‘© ë[plain‘ª®²T�‘þU>Ÿ'EŽ–ãxX,›þ³ÂA�‘þ•AŸ¸ãMŽ‘¢ýS�lβ-T�‘þU>Ÿ'EŽ“X,˜L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ“X,˜and–© other“macro“pac�¸ãk‘ÿqÇagesŽ¡�‘Õºâde ne–öšÏ\footnote“²di erenš¸ãtly‘ÿ*ª,‘žëall“the“de nitions“are“equally“explosiv˜e“inside“aŽ¡�‘ÕºâÏ\message².)‘qÇAnd–UUthe“lineަ�‘ÕºâÏ\message{Beware–?ýof“\endinput“in“a“\message!}ŽŸ�‘Õºâ²will–„cause“the“curren�¸ãt“input“ le“to“terminate“immediately!‘ þ(Ï\endinput“²is“anŽ¡�‘ÕºâÌexp‘ÿ}'andable–\<²conš¸ãtrol“sequence,‘Žfor“reasons“that“are“to�Go“tec˜hnical“to“b�Ge“w˜orth“discussingŽ¡�‘Õºâhere.)Ž¡�‘äºâThš¸ãus–¤ÿto“talk“ab�Gout“an“expandable“con˜trol“sequence“in“a“message,‘¸êy˜ou“m˜ust“doŽ¡�‘Õºâsomething–í to“inhibit“the“expansion.‘OOrdinarily“y�¸ãou“apply“Ï\string“²or“Ï\noexpand“²toŽ¡�‘Õºâthe–«Åconš¸ãtrol“sequence;‘Öþor“y˜ou“could“put“it“in˜to“a“tok˜en“register“and“use“Ï\the¸hÌtokenŽ¡�‘Õºâr–ÿ}'e“gister¸i–Ó€²in“the“message.‘ìHNonexpandable“conš¸ãtrol“sequences“can“b�Ge“prin˜ted“in“aŽ¡�‘Õºâmessage–÷without“sp�Gecial“protection,›ŠŸexcept“that,˜if“yš¸ãou“do“nothing“to“a˜v˜oid“it,‘ŠŸy˜ouŽ¡�‘Õºâwill›¥,alw•¸ãa“ys˜get˜an˜extra˜space˜after˜a˜con“trol˜w“ord,‘¹!ev“en˜in˜some˜cases˜where˜it˜isŽ¡�‘Õºâundesirable,–UUas“when“the“next“thing“is“punctuation.‘qÇF‘ÿ*ªor“example,“the“messageަ�‘ÕºâÏ\message{Enter–?ýdesired“value“for“\hangindent:“}ޤ�‘Õºâ²will–UUprin�¸ãt“on“screen“with“a“space“b�Gefore“the“colon:ަ�‘ÕºâÏEnter–?ýdesired“value“for“\hangindent“:Ž¡�‘äºâ²T‘ÿ*ªable–DC“sho�¸ãws“what“happ�Gens“to“v‘ÿqÇarious“sorts“of“things“in“a“Ï\message“²or“Ï\writeŽŸ �‘Õºâ²argumenš¸ãt,–UUas“w˜ell“as“v‘ÿqÇarious“metho�Gds“for“suppressing“expansion.ŽŽŽ�� þ }ü��’J7 à4.3Ž’h÷ Collapsing‘€spacesŽ©uT�’J7 ²If–xšyš¸ãou“w˜an˜t“to“prin˜t“on“screen“a“men˜u“or“similar“message“consisting“of“m˜ultipleޤ �’J7 columns–Pxnicely“arranged,‘„¥yš¸ãou“ha˜v˜e“to“deal“with“the“fact“that“T�‘þU>Ÿ'EŽ‘ãxX“normally“condensesŽ¡�’J7 mš¸ãultiple–Äspaces“and“tab“c˜haracters“to“a“single“space.‘U—The“easiest“w˜a˜y“to“handle“thisŽ¡�’J7 dicultš¸ãy–‹is“to“c˜hange“the“catco�Gde“of“the“space“c˜haracter“to,–˜lsa˜y‘ÿ*ª,“12–‹b�Gefore“readingŽ¡�’J7 the–UUargumen�¸ãt“of“a“Ï\message“²or“Ï\write“²command.ŽŸ×��’J7 à4.4Ž’h÷ Sp�`ecial‘€c� haractersަ�’J7 ²The–‘ïspace“cš¸ãharacter“is“but“one“example“of“a“larger“class:‘êû`sp�Gecial'“c˜haracters,‘¡thatŽ¡�’J7 is,›õŽones–Õ‚that“don't“ha•¸ãv“e–Õ‚category“11“or“12.‘òOAn“ob�¸ãvious“question“to“ask“is,˜\WhatŽ¡�’J7 other–Þúsp�Gecial“cš¸ãharacters“are“dicult“to“use“in“a“message?"‘JTT‘ÿ*ªable“C“sho˜ws“ho˜w“a“fewŽ¡�’J7 sp�Gecial–”»cš¸ãharacters“are“a ected“b˜y“the“expansion“pro�Gcess“in“a“message:‘zan“Ï&“²(categoryŽ¡�’J7 4)–�èpasses“through“unharmed,›ž�a“Ï#“²(category“6)“gets“doubled,˜and“a“Ï~“²(category“13)Ž¡�’J7 gets–nªexpanded.��Ÿü^ÿ±10ŽŽ‘ 6­²T‘ÿ*ªable“D“is“a“complete“list“of“the“v‘ÿqÇarious“categories“of“c�¸ãharacters,Ž¡�’J7 along–×Nwith“w•¸ãa“ys–×Nto“prošGduce“those“c�¸ãharacters“that“cannot“simply“b˜e“used“as“is.‘÷²AŽ¡�’J7 few–UUcategories“deservš¸ãe“more“extensiv˜e“commen˜t.ŽŸIé���’J7 ÎCategory–ÕT0|Escap�QÇe“CharacterŽŽ’ë ƒ²It's–Dnormally“not“a“problem“to“prin�¸ãt“an“escap�GeŽ¡�’c7c�¸ãharacter–еbšGecause“it“usually“o˜ccurs“as“part“of“a“conš¸ãtrol“sequence,‘ whic˜hŽ¡�’c7can–—8b�Ge“prinš¸ãted“using“Ï\string“²(and“ev˜en“that“ma˜y“not“b�Ge“necessary“if“theŽ¡�’c7conš¸ãtrol– sequence“is“nonexpandable).‘·åEv˜en“when“the“escap�Ge“c˜haracter“is“not,Ž¡�’c7logically–Žísp�Geaking,›�Spart“of“a“con�¸ãtrol“sequence,˜it“can“b�Ge“senš¸ãt“in“a“message“b˜yŽ¡�’c7letting–òit“comš¸ãbine“from“T�‘þU>Ÿ'EŽ‘ãxX's“p�Goin˜t“of“view“with“the“follo˜wing“c˜haracter(s).Ž¡�’c7F‘ÿ*ªor–ÕWexample,‘õXto“send“the“message“ÏCommands–?ýin“TeX“normally“begin“withŽ¡�’c7a–?ý`\'“character²,‘çAthe––ßbac�¸ãkslash“došGesn't“need“to“b˜e“treated“as“an“isolatedŽ¡�’c7c•¸ãharacter;‘Jˆcom“bined–E"with“the“folloš¸ãwing“ap�Gostrophe,‘H_it“forms“a“con˜trol“sym˜b�GolŽ¡�’c7to–UUwhic�¸ãh“Ï\string“²can“b�Ge“applied.ŽŸÒz�’c7The–ÕŠonly“time“this“fails“is“when“the“bacš¸ãkslash“m˜ust“b�Ge“sen˜t“as“the“v˜ery“lastŽ¡�’c7cš¸ãharacter–Jiof“a“message.‘n#Although“this“case“is“extremely“unlik˜ely‘ÿ*ª,‘L˜the“solutionŽ¡�’c7in•¸ãv“olv“es–UUa“rather“useful“little“macro:ŽŸ©,�’c7Ï\def\xstring{\expandafter\gobble\string}ŽŸ ŒÉ�’c7\def\gobble#1{}%–?ýif“this“is“not“already“definedŽŸc�’c7²With–Íthis“de nition,��Ÿü^ÿ±11ŽŽ‘ £ëÏ\xstring“²not“only“turns“a“conš¸ãtrol“sequence“in˜to“aŽ¡�’c7string–¼of“cš¸ãharacters,‘Ú­it“also“remo˜v˜es“the“leading“bac˜kslash,‘Ú­so“that“Ï\xstring\\Ž¡�’c7²will–ùJpro�Gduce“a“single“bacš¸ãkslash“c˜haracter,‘"Fas“desired.‘]¥Another“solution“thatŽ’J7 Ÿý"‰ff�ýåŸ J=����‘wŽŸý-:º10ŽŽŽ‘LÜÀT‘ÿJªo– Úb�����‘wŽŸý-:º11ŽŽŽ‘LÜÀCf.–&Bthe“answ�ÃŽer“to“Exercise“7.10“in“ÃThe‘]±T�‘þ‰gŸ¸ãEŽ‘BLXb•�¥o“okÀ.‘¹ÝThe–&Bimplicit“assumption“that“ëH\escapecharŽ¡�Àis–ÕXin“the“range“0{255“ma�ÃŽy“not“b�Ÿ'EŽ‘ãxX's“normal“rules“for“ ndingŽ¡�‘Õºâthe–UUend“of“a“con�¸ãtrol“sequence“name.Ž¡�‘äºâThe–Risolution“to“b�Goth“of“these“diculties“is“easy:‘pQuse“Ï\string“²if“yš¸ãou“don't“w˜an˜tŽ¡�‘Õºâa–_jspace“after“the“conš¸ãtrol“w˜ord,‘aïand“use“Ï\noexpand“²if“y˜ou“do“w˜an˜t“a“space.��Ÿü^ÿ±12ŽŽ‘ ì²Note:Ž¡�‘ÕºâThe– Þcš¸ãharacter“tok˜ens“pro�Gduced“b˜y“Ï\string“²can“b�Ge“passed“without“harm“throughŽ¡�‘Õºâan•¸ãy›™øn“um“b�Ger˜of˜subsequen“t˜steps,‘¿rincluding˜expansion˜via˜Ï\edef˜²or˜similar˜op�Gerators,Ž¡�‘Õºâwhile–[XÏ\noexpand“²only“protects“an“expandable“macro“through“the“ rst“expansionŽ¡�‘Õºâstep.ަ��‘Õºâà4.6Ž‘ôzâOuter–€Con� trol“SequencesŽŸuT�‘Õºâ²Y‘ÿ*ªou–0dcan't“send“an“Ï\outer“²conš¸ãtrol“sequence“in“a“Ï\message“²unless“y˜ou“do“somethingŽ¡�‘Õºâto–��get“around“the“outerness.‘JT‘ÿ*ªo“illustrate,‘›ŒI‘�rpresen�¸ãt“a“transcript“of“T�‘þU>Ÿ'EŽ‘ãxX's“reactionŽ¡�‘Õºâto–UUthe“follo�¸ãwing“line:ŽŸŒÉ�‘ÕºâÏ\message{Control-L:‘?ý^^L}Ž‘ÕºâŸŸJ‰ff�ýåŸ J=����‘wŽŸý-:º12ŽŽŽ‘LÜÀI‘û&hadn't–û0noticed“the“usefulness“of“ëH\noexpand“Àfor“this“purp�²)ŽŽ’Ÿ'EŽ‘ãxX“andŽ¡�’J7 L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX.)ŽŸŒÉ�’J7 ÏRunaway‘?ýtext?ޤ ŒÉ�’J7 Control-L:Ž¡�’J7 !–?ýForbidden“control“sequence“found“while“scanning“text“of“\message.Ž¡�’J7 Ž¡�’ž6Ü}Ž¡�’J7 Ž¡�’­öÓ^^LŽ¡�’J7 l.149–?ý\message{Control-L:“^^LŽ¡�’6”}Ž¡�’J7 ?‘?ý1Ž¡�’J7 Type–?ý“to“proceed,“S“to“scroll“future“error“messages,ŽŽŽŽŽŽŒ‹W@ <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²15ŽŽ ‚���� þ }ü�‘ÕºâÏR–?ýto“run“without“stopping,“Q“to“run“quietly,ޤ ŒÉ�‘ÕºâI–?ýto“insert“something,“E“to“edit“your“file,Ž¡�‘ÕºâH–?ýfor“help,“X“to“quit.Ž¡�‘Õºâ?‘?ýhŽ¡�‘ÕºâI–?ýsuspect“you“have“forgotten“a“`}',“causing“meŽ¡�‘Õºâto–?ýread“past“where“you“wanted“me“to“stop.Ž¡�‘ÕºâI'll–?ýtry“to“recover;“but“if“the“error“is“serious,Ž¡�‘Õºâyou'd–?ýbetter“type“`E'“or“`X'“now“and“fix“your“file.Ž¡�‘Õºâ?Ž©�‘äºâ²Notice–AIthat“when“I‘ADtried“to“tš¸ãyp�Ge“a“Ï1“²to“delete“the“o ending“Ï\outer“²tok˜en,‘EKI‘ADgotޤ �‘Õºâinstead– ïa“help“message“indicating“that“tokš¸ãen“deletion“is“not“an“option“at“this“p�Goin˜t.Ž¡�‘Õºâ(The–è reason“b�Gehind“this“lacš¸ãk“of“tok˜en“deletion“is“fairly“tec˜hnical:‘—/T�‘þU>Ÿ'EŽ‘ãxX“w˜as“in“theŽ¡�‘Õºâmiddle–Üžof“a“pro�Gcedure“called“Ìget�‘�‰ffŽ‘®token“²when“it“stumš¸ãbled“o˜v˜er“the“Ï^^L“²c˜haracter;‘ÛbutŽ¡�‘Õºâsince–s%tokš¸ãen“deletion“itself“in˜v˜olv˜es“calling“Ìget�‘�‰ffŽ‘®token²,‘º™allo˜wing“tok˜en“deletion“hereŽ¡�‘Õºâwš¸ãould–åymean“calling“Ìget�‘�‰ffŽ‘®token“²from“inside“itself|something“it“w˜as“not“designed“for.)ŽŸþ6��‘Õºâà4.7Ž‘ôzâSemi-v• erbatim‘€alternativ“eŽŸuT�‘Õºâ²An–«§alternativš¸ãe“w˜a˜y“of“handling“message“texts,‘Í—that“eliminates“the“need“to“remem˜b�GerŽ¡�‘Õºâsp•Gecial›¦metho“ds˜for˜v‘ÿqÇarious˜kinds˜of˜message˜elemen�¸ãts,‘cis˜to˜temp“orarily˜c�¸ãhange˜theŽ¡�‘ÕºâcatcošGdes–ðzof“all“sp˜ecial“cš¸ãharacters“while“reading“the“argumen˜t“of“a“message.‘C5WithŽ¡�‘Õºâthe–UUfollo�¸ãwing“de nitions:ŽŸŒÉ�‘ÕºâÏ\def\verbwrite{\begingroupޤ ŒÉ�‘à:Ü\def\do##1{\catcode`##1=12}%Ž¡�‘à:Ü\do\‘?ý\dospecialsŽ¡�‘à:Ü\catcode\endlinechar=12Ž¡�‘à:Ü\newlinechar=\endlinecharŽ¡�‘à:Ü\verbcontinue}Ž¡�‘Õºâ\begingroup‘?ý\lccode`\/=`\\Ž¡�‘Õºâ\lowercase{\endgroupŽ¡�‘Õºâ\def\verbcontinue##1/}endverbwrite{%Ž¡�‘à:Ü\immediate\write16{#1}\endgroup}ަ�‘Õºâ²yš¸ãou–UUcould“send“messages“lik˜eŽŸŒÉ�‘ÕºâÏ\verbwrite‘?ý!#$%$%#^%&*~@^^"|+Ž¡�‘Õºâ_^+\footnote_|)\\90\Ž¡�‘Õºâ\bye–?ý^^L“\endinputŽ¡�‘Õºâ\endverbwriteަ�‘Õºâ²without–‰Õregard“to“the“con•¸ãten“ts.‘-òThe–‰Õmain“limitation“of“this“approac�¸ãh“is“that“in“orderޤ �‘Õºâfor–�the“handling“of“the“sp�Gecial“cš¸ãharacters“to“w˜ork,‘žÃÏ\verbwrite“²has“to“b�Ge“executedŽ¡�‘Õºâdirectly–b,in“a“ le;‘è˜it“cannot“bšGe“em�¸ãb˜edded“in“a“macro.‘˜LF‘ÿ*ªurthermore,‘¥athe“messageŽŽŽ�� þ }ü�’J7 text–iis“unalterable:‘™#it“cannot“conš¸ãtain“a“con˜text-dep�Genden˜t“part,‘mïas“in“a“message“toޤ �’J7 displaš¸ãy–UUthe“curren˜t“fon˜t“name“on“screen:ŽŸv�’J7 Ï\message{Current–?ýfont“is“\fontname\font.}ŽŸ‘­�’J7 ²This–\Émessage“could“not“bšGe“generated“with“Ï\verbwrite“²b˜ecause“Ï\verbwrite“²w�¸ãouldŽ¡�’J7 not–UUexpand“Ï\fontname².ŽŸæv��’J7 à4.8Ž’h÷ Presen� ting–€information“in“the“bš`est“p˜ossible“formŽŸuT�’J7 ²Example:‘lIn–IÍrepšGorting“a“dimension“to“the“user,‘Lit“is“usually“desirable“to“rep˜ort“theŽ¡�’J7 v‘ÿqÇalue–rounded“to“tenš¸ãths“or“h˜undredths,‘CÈin“units“that“are“con˜v˜enien˜t“for“the“user:Ž¡�’J7 p�Goinš¸ãts–Š0for“a“fon˜t“size“or“line“spacing“v‘ÿqÇalue;‘Íçcen˜timeters,–²Ñpicas,“or–Š0inc˜hes“for“the“heigh˜tŽ¡�’J7 or–UUwidth“of“a“page“or“of“an“included“ gure.Ž¡�’Y7 The–«‰ le“Ïcnvunits.tex“²givš¸ães“some“examples“of“what“is“p�Gossible“in“this“v˜ein,Ž¡�’J7 including›¥Ãcon•¸ãv“ersions˜from˜p�Goin“ts˜to˜picas,›Èàinc“hes,˜and›¥Ãcen“timeters.‘7AThe˜con“v“ersionsŽ¡�’J7 from–~³pšGoin�¸ãts“to“other“units“are“the“most“imp˜ortan�¸ãt“ones“b˜ecause“when“Ï\the“²is“appliedŽ¡�’J7 to–’Þa“dimension“or“skip“register“T�‘þU>Ÿ'EŽ‘ãxX“alw•¸ãa“ys–’Þrep�Gorts“the“v‘ÿqÇalue“in“Ïpt“²units.‘*b(NotŽ¡�’J7 coun�¸ãting–UUÏ\muskip“²registers,“where“the“rep�Gorted“unit“is“Ïmu².)ŽŸv�’J7 Ê\newdimen\zdim–¹–\newdimen\tempdim“\newdimen\tempdimaŽ©�’J7 %–¹–Conversion“factors:ޤ �’J7 %Ž¡�’J7 %–!According‘æXScaled‘,ÂRational“PrimeŽ¡�’J7 %–¹–Unit‘ s,to“TeX‘!Points‘,ÂForm‘3ùrFactorizationŽ¡�’J7 %-----------------------------------------------------------------Ž¡�’J7 %–¹–1“sp‘ s,0.00002“pt‘,Â1‘%̰1/65536“pt‘Ÿî1“/“2^16Ž¡�’J7 %–¹–1“mm‘ s,2.84526“pt–,Â186467“7227/2540›¹–pt“3*3*11*73˜/˜2*2*5*127Ž¡�’J7 %–¹–1“cm› s,28.45274“pt˜1864679˜7227/254“pt‘æX3*3*11*73“/“2*127Ž¡�’J7 %–¹–1“pt‘ s,1.0“pt‘!65536›æX100/7227“in˜2*2*5*5“/“3*3*11*73Ž¡�’J7 %–¹–1“pc‘ s,12.0“pt‘Y„786432‘,Â12/1“ptŽ¡�’J7 %–¹–1“dd‘ s,1.07“pt‘Y„70124‘æX1238/1157“pt‘,Â2*619“/“13*89Ž¡�’J7 %–¹–1“cc› s,12.8401“pt–,Â841489“14856/1157–¹–pt˜2*2*2*3*619“/“13*89Ž¡�’J7 %–¹–1“bp‘ s,1.00374“pt‘,Â65781‘æX803/800“pt‘Ÿî11*73“/“2*2*2*2*2*5*5Ž¡�’J7 %’‰þ[1/72‘¹–in]Ž¡�’J7 %–¹–1“in› s,72.2699“pt‘,Â4736286˜7227/100“pt‘æX3*3*11*73“/“2*2*5*5Ž¡�’J7 %‘![2.54–¹–cm]‘=lž[254/100“cm]ަ�’J7 \def\points#1#2#3{\tempdim#2\relaxŽ¡�’Sª8\edef#3{\csname‘¹–cnvunits#1\expandafter\endcsname\the\tempdim}%Ž¡�’J7 }ަ�’J7 \def\inches#1#2#3{%Ž¡�’Sª8\tempdim=#2\relaxŽ¡�’Sª8\tempdima=\ifdim\tempdim<\zdim–¹–-\fi\tempdim“%“absolute“valueŽŽŽŽŽŽŒ‹mÖ <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²16ŽŽ ‚���� þ }ü�‘ß.Ê\roundup\tempdima{#1}{in}%ޤ �‘Õºâ%‘æXIn–¹–the“interest“of“maximum“accuracy“we“push“\tempdima“as“nearŽ¡�‘Õºâ%‘æXto–¹–\maxdimen“as“possible“before“dividing,“using“the“primeŽ¡�‘Õºâ%‘æXfactorization–¹–of“the“fraction“7227/100“which“is“theŽ¡�‘Õºâ%‘æXpoints/inches–¹–conversion“factor.Ž¡�‘ß.\ifdim\tempdima<.01\maxdimenŽ¡�‘è¡:\multiply\tempdima–¹–100“\divide\tempdima“7227Ž¡�‘ß.\elseŽ¡�‘è¡:\ifdim\tempdima<.1\maxdimenŽ¡�‘òf\multiply\tempdima–¹–10“\divide\tempdima“11Ž¡�‘òf\multiply\tempdima–¹–10“\divide\tempdima“657Ž¡�‘è¡:\elseŽ¡�‘òf\divide\tempdima–¹–9“\multiply\tempdima“5Ž¡�‘òf\divide\tempdima–¹–803“\multiply\tempdima“20Ž¡�‘è¡:\fiŽ¡�‘ß.\fiŽ¡�‘ß.\tempdim=\ifdim\tempdim<\zdim–¹–-\fi“\tempdimaŽ¡�‘ß.\edef#3{%Ž¡�‘è¡:\csname‘¹–cnvunits#1\expandafter\endcsname\the\tempdim}%Ž¡�‘Õºâ}Ž©�‘Õºâ%‘æXFunction–¹–\roundup“for“rounding“upward.“#1“must“be“a“dimensionŽ¡�‘Õºâ%‘æXregister.–¹–If“it“holds“a“negative“value“it“will“be“roundedŽ¡�‘Õºâ%‘æX`outward'–¹–away“from“zero“rather“than“`upward'“toward“zero.“#3Ž¡�‘Õºâ%‘æXis–¹–a“TeX“units“string“such“as“"pt"“or“"in".“If“#2“=“0“thenŽ¡�‘Õºâ%‘æXthis–¹–will“round“up“to“the“nearest“tenth;“if“#2“=“00,“nearestŽ¡�‘Õºâ%‘æXhundredth;–¹–and“so“forth“(up“to“5“zeros).“If“#2“is“empty“thenŽ¡�‘Õºâ%‘æXfull–¹–accuracy“up“to“TeX's“limits“will“be“used.Ž¡�‘Õºâ%Ž¡�‘Õºâ%‘æXThe–¹–rounded“result“will“be“returned“in“the“dimension“registerŽ¡�‘Õºâ%‘æX#1.ަ�‘Õºâ\def\roundup#1#2#3{%Ž¡�‘ß.\if‘¹–.#2.\elseŽ¡�‘è¡:\begingroupŽ¡�‘òf\ifdim#1>\zdimŽ¡�‘û‡’\advance#1-\maxdimen‘¹–\advance#1.#25#3\relaxŽ¡�‘òf\fiŽ¡�‘òf\ifdim#1<\zdimŽ¡�‘è¡:\endgroupŽ¡�‘û‡’\advance#1.#25#3Ž¡�‘òf\elseŽ¡�‘è¡:\endgroupŽ¡�‘òf\fiŽ¡�‘ß.\fiŽ¡�‘Õºâ}ŽŽŽ�� þ}ü�’J7 \begingroupޤ �’J7 \catcode`\P=12‘¹–\catcode`\T=12Ž¡�’J7 \lowercase{%Ž¡�’J7 \expandafter\gdef\csname‘¹–cnvunits\endcsname#1PT{#1}Ž¡�’J7 \expandafter\gdef\csname‘¹–cnvunits0\endcsname#1.#2PT{%Ž¡�’Sª8#1.\takeone#20\takeone}Ž¡�’J7 \expandafter\gdef\csname‘¹–cnvunits00\endcsname#1.#2PT{%Ž¡�’Sª8#1.\taketwo#200\taketwo}Ž¡�’J7 \expandafter\gdef\csname‘¹–cnvunits000\endcsname#1.#2PT{%Ž¡�’Sª8#1.\takethree#2000\takethree}Ž¡�’J7 \expandafter\gdef\csname‘¹–cnvunits0000\endcsname#1.#2PT{%Ž¡�’Sª8#1.\takefour#20000\takefour}Ž¡�’J7 \expandafter\gdef\csname‘¹–cnvunits00000\endcsname#1.#2PT{%Ž¡�’Sª8#1.\takefive#200000\takefive}Ž¡�’J7 }%Ž¡�’J7 \endgroupŽ©�’J7 \def\takeone#1#2\takeone{#1}Ž¡�’J7 \def\taketwo#1#2#3\taketwo{#1#2}Ž¡�’J7 \def\takethree#1#2#3#4\takethree{#1#2#3}Ž¡�’J7 \def\takefour#1#2#3#4#5\takefour{#1#2#3#4}Ž¡�’J7 \def\takefive#1#2#3#4#5#6\takefive{#1#2#3#4#5}ަ�’J7 \def\showinches#1{\inches{00}{#1}\convertedŽ¡�’Sª8\immediate\write16{%Ž¡�’]d#1–¹–=“(after“conversion)“\converted\space“inches}}ަ�’J7 \showinches{0in}–¹–\showinches{1in}“\showinches{2.0in}Ž¡�’J7 \showinches{2.2in}–¹–\showinches{8.5in}“\showinches{1pc}Ž¡�’J7 \showinches{6pc}–¹–\showinches{1cm}“\showinches{1mm}Ž¡�’J7 \showinches{1bp}–¹–\showinches{72bp}“\showinches{1cc}Ž¡�’J7 \showinches{1dd}–¹–\showinches{72dd}“\showinches{5000pt}Ž¡�’J7 \showinches{-5000pt}‘¹–\showinches{\maxdimen}Ž¡�’J7 \showinches{-\maxdimen}‘¹–\showinches{.999\maxdimen}Ž¡�’J7 \showinches{1pt}‘¹–\showinches{.01pt}ަ�’J7 \endinputަ�’J7 %‘æXFrom–¹–the“TeX“log:ަ�’J7 0in–¹–=“(after“conversion)“0.00“inchesŽ¡�’J7 1in–¹–=“(after“conversion)“1.00“inchesŽ¡�’J7 2.0in–¹–=“(after“conversion)“2.00“inchesŽ¡�’J7 2.2in–¹–=“(after“conversion)“2.20“inchesŽ¡�’J7 8.5in–¹–=“(after“conversion)“8.50“inchesŽŽŽŽŽŽŒ‹�¬ <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²17ŽŽ ‚���� þ }ü�‘ÕºâÊ1pc–¹–=“(after“conversion)“0.17“inchesޤ �‘Õºâ6pc–¹–=“(after“conversion)“1.00“inchesŽ¡�‘Õºâ1cm–¹–=“(after“conversion)“0.39“inchesŽ¡�‘Õºâ1mm–¹–=“(after“conversion)“0.04“inchesŽ¡�‘Õºâ1bp–¹–=“(after“conversion)“0.01“inchesŽ¡�‘Õºâ72bp–¹–=“(after“conversion)“1.00“inchesŽ¡�‘Õºâ1cc–¹–=“(after“conversion)“0.18“inchesŽ¡�‘Õºâ1dd–¹–=“(after“conversion)“0.01“inchesŽ¡�‘Õºâ72dd–¹–=“(after“conversion)“1.07“inchesŽ¡�‘Õºâ5000pt–¹–=“(after“conversion)“69.18“inchesŽ¡�‘Õºâ-5000pt–¹–=“(after“conversion)“-69.18“inchesŽ¡�‘Õºâ\maxdimen‘ s,=–¹–(after“conversion)“226.70“inchesŽ¡�‘Õºâ-\maxdimen‘ s,=–¹–(after“conversion)“-226.70“inchesŽ¡�‘Õºâ.999\maxdimen‘ s,=–¹–(after“conversion)“226.48“inchesŽ¡�‘Õºâ1pt–¹–=“(after“conversion)“0.01“inchesŽ¡�‘Õºâ.01pt–¹–=“(after“conversion)“0.00“inchesŽŸ�‘äºâ²Another–ÿ©example:‘Fñif“yš¸ãou“w˜an˜t“to“rep�Gort“the“Ï\mathcode“²of“a“particular“c˜haracterޤ �‘Õºâto–�the“user,›$¸Ï\number\mathcode`\x“²or“Ï\the\mathcode`\x“²aren't“to�Go“great,˜b�GecauseŽ¡�‘Õºâthey–¡ÇprošGduce“a“decimal“n•¸ãum“b˜er,‘4ãwhen–¡Çit“w�¸ãould“b˜e“more“con•¸ãv“enien“t–¡Çto“get“aŽ¡�‘Õºâhexadecimal›.@n•¸ãum“b�Ger˜ lled˜out˜to˜four˜digits,–d{so˜that˜the˜class,“math˜family‘ÿ*ª,“andŽ¡�‘Õºâfon�¸ãt–ÆpšGosition“information“can“b˜e“read“o “directly‘ÿ*ª.‘ ËExtending“some“ideas“fromŽ¡�‘ÕºâÏtestfont.tex–‰y²[�Kn�¸ãuth,‘UU1986cŽ‘:œ{],‘‚w�¸ãe“can“write“a“quite“friendly“Ï\reportmathcodeŽ¡�‘Õºâ²function:ŽŸŒÉ�‘ÕºâÏ%‘ÿôWhen–?ý\meaning“is“applied“to“a“\mathchar,“it“producesޤ ŒÉ�‘Õºâ%‘ÿô\mathchar"–?ýwhere““are“1“to“4“hexadecimal“digits.Ž¡�‘Õºâ%‘ÿôThe–?ýfunction“\gethex“strips“off“the“prefix“and“leaves“only“theŽ¡�‘Õºâ%‘ÿôdigits.Ž¡�‘Õºâ\def\gethex#1"{}Ž¡�‘Õºâ%‘ÿôThe–?ýfunction“\reportmathcode“takes“a“character“or“control“symbolŽ¡�‘Õºâ%‘ÿôargument–?ýand“reports“the“associated“mathcode“in“hexadecimalŽ¡�‘Õºâ%‘ÿôform,–?ýfilling“out“to“four“digits“with“leading“zeros,“ifŽ¡�‘Õºâ%‘ÿônecessary.Ž¡�‘Õºâ\def\reportmathcode#1{%Ž¡�‘à:Ü\begingroupŽ¡�‘êºÖ\mathchardef\temp=\mathcode`#1‘?ý\relaxŽ¡�‘êºÖ\edef\temp{\expandafter\gethex\meaning\temp}%Ž¡�‘êºÖ\count@="\temp\relaxŽ¡�‘êºÖ\edef\temp{%Ž¡�‘Õºâ%‘ÿôFill–?ýin“leading“zerosŽ¡�‘õ:Ð\ifnum\count@<"1000‘?ý0%Ž¡�‘õ:Ð\ifnum\count@<"100‘?ý0%Ž¡�‘õ:Ð\ifnum\count@<"10‘?ý0\fi\fi\fiŽ¡�‘õ:Ð\temp}%ŽŽŽ�� þΛ¨��’J7  ÿ3Hº‰ffj|( ÌPà�„ÌPàff� ÿD ç�‘ ™›²Example–-?2:‘!œThe“Ï\printoptions“²command“of“¸A�‘þU>Ÿ'MŽ‘ ‹S‘€²-T�‘þU>Ÿ'EŽ‘ãxX“v�¸ãersion“1.1.‘ù†Ï\W@“²isŽŸ �‘ ™›the–UU¸A�‘þU>Ÿ'MŽ‘ ‹S‘€²-T�‘þU>Ÿ'EŽ‘ãxX“abbreviation“for“Ï\immediate\write16ŽŸŒÉ�‘ ™›\def\S@{S–?ý}“\def\G@{G“}“\def\P@{P“}ޤ ŒÉ�‘ ™›\newif\ifbadans@Ž¡�‘ ™›\def\printoptions{\W@{Do–?ýyou“want“S(yntax“check),Ž¡�‘•G(alleys)–?ýor“P(ages)?^^JType“S,“G“or“P,“follow“by“:“}%Ž¡�‘Ù˜\loop–?ý\read\m@ne“to\ans@Ž¡�‘Y’\xdef\next@{\def\noexpand\Ans@{\ans@}}%Ž¡�‘Y’\uppercase\expandafter{\next@}%Ž¡�‘Y’\ifx\Ans@\S@\badans@false\syntax\elseŽ¡�‘Y’\ifx\Ans@\G@\badans@false\galleys\elseŽ¡�‘Y’\ifx\Ans@\P@\badans@false\elseŽ¡�‘Y’\badans@true\fi\fi\fiŽ¡�‘Y’\ifbadans@\W@{Type–?ýS,“G“or“P,“follow“by“:“}%Ž¡�‘Ù˜\repeat}ŽŽ’i¯\„ÌPàffŽžff‰ffj|(ŽŽŸ�’_7\message{The–?ýmathcode“of“\string#1“is:“"\temp}%ŽŸ ŒÉ�’T·\endgroup}ŽŸ%Ä��’J7 à5Ž’^w Stum• bling›€blo�`c“ks˜in˜the˜use˜of˜á\readŽŸç��’J7 à5.1Ž’h÷ An–€example:‘¸A�‘þU>Ÿ'MŽ‘ ‹S‘€à-T�‘ý¿áŸªªEŽ‘ìSX's“á\printoptions“àcommandŽŸuT�’J7 ²Consider–tkthe“Ï\printoptions“²command“of“¸A�‘þU>Ÿ'MŽ‘ ‹S‘€²-T�‘þU>Ÿ'EŽ‘ãxX“1.1“(Example“2):‘ ¯óTheޤ �’J7 de nition–Uof“this“command“shoš¸ãws“one“w˜a˜y“of“dealing“with“the“extra“space“at“theŽ¡�’J7 end–«of“a“macro“created“using“Ï\read²:‘HòDe ne“some“macros“consisting“of“the“exp�GectedŽ¡�’J7 answ�¸ãers,›Mýwith–L'the“extra“space“included,˜and“then“use“Ï\ifx“²to“compare“them“to“theŽ¡�’J7 user's–²ïresp�Gonse.‘Š–It“also“shoš¸ãws“ho˜w“to“uppšGercase“the“user's“resp˜onse“so“that“lo•¸ãw“er-Ž¡�’J7 and–¿±uppšGercase“resp˜onses“will“b˜e“treated“iden�¸ãtically‘ÿ*ª.‘°ÜThis“is“the“second“metho˜dŽ¡�’J7 givš¸ãen–in“the“answ˜er“to“ÌThe‘JT�‘þKß'EŽ‘Í-Xb–ÿ}'o“ok²'s–Exercise“20.19.‘WOne“more“notew˜orth˜y“featureŽ¡�’J7 of–qÏ\printoptions“²is“that“it“runs“a“lošGop“that“do˜esn't“quit“unš¸ãtil“the“user“giv˜es“anŽ¡�’J7 acceptable‘UUansw�¸ãer.Ž¡�’Y7 In–Ù€Ï\printoptions“²since“Ï\W@“²is“de ned“to“b�Ge“Ï\immediate\write16²,‘:‹and“theŽ¡�’J7 Ï\write–Öβcommand“alw•¸ãa“ys–ÖÎstarts“a“new“line“after“its“message“text,‘÷,w�¸ãe“can“see“thatŽ¡�’J7 the–̈reply“tš¸ãyp�Ged“b˜y“the“user“will“app�Gear“on“the“next“line“instead“of“immediately“afterŽ¡�’J7 the–gIcolon.‘§¡This“brings“up“the“question:‘•®what“if“wš¸ãe“w˜an˜t“the“user's“reply“to“app�GearŽ¡�’J7 on–UUthe“same“line?Ž¡�’Y7 One›[aw•¸ãa“y˜to˜do˜this˜is˜to˜use˜Ï\message˜²to˜send˜the˜last˜line˜of˜the˜prompt˜message,Ž¡�’J7 and–UUuse“Ï\write“²to“send“the“previous“line(s).‘qÇF‘ÿ*ªor“example:ŽŽŽŽŽŽŒ‹�î <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²18ŽŽ ‚���� þ }ü�‘ÕºâÏ\W@{Do–?ýyou“want“S(yntax“check),“G(alleys)“or“P(ages)?}%Ž© ŒÉ�‘Õºâ\message{Type–?ýS,“G“or“P,“follow“by“:“}%ŽŸ�‘Õºâ²This–Uidea“is“used“in“the“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“option“Ïchecknum.sty“²[�Hamilton–UUKelly‘ÿ*ª,“1991Ž‘\€].‘qAnޤ �‘Õºâalternativ•¸ãe›0îw“ould˜b�Ge˜to˜put˜the˜whole˜prompt˜in˜a˜single˜Ï\message˜²with˜em“b�GeddedŽ¡�‘Õºânewline–žãcš¸ãharacters“(as“long“as“y˜ou“are“careful“to“select“a“c˜haracter“for“Ï\newlinecharŽ¡�‘Õºâ²that–UUis“not“needed“in“the“text“of“the“message).ŽŸþ6��‘Õºâà5.2Ž‘ôzâá^^M–€àat“the“end“of“a“lineŽŸuT�‘Õºâ²In–€èÏ\printoptions“²separate“macros“Ï\S@²,–«eÏ\G@²,“and–€èÏ\P@“²are“de ned“for“eac�¸ãh“legitimateŽ¡�‘ÕºârespšGonse.‘ÍÂIf–sþthe“men�¸ãu“b˜ecomes“more“extensivš¸ãe,‘{¨this“tec˜hnique“is“rather“w˜asteful“ofŽ¡�‘Õºâhash–¾ýsize,›Ùfmain“memory‘ÿ*ª,˜and“other“useful“commo�Gdities.‘®¾The“problem“here“is“thatŽ¡�‘Õºâthe–‹$Ï^^M‘ŠÔ²cš¸ãharacter“at“the“end“of“the“user's“resp�Gonse“is“included“b˜y“Ï\read“²in“theŽ¡�‘Õºâmacro–­Õb�Geing“read.‘{GUnder“normal“conditions“Ï^^M‘­¾²is“con•¸ãv“erted–­Õto“a“space;‘Úho•¸ãw“ev“er,Ž¡�‘Õºâanother–zÅp�Gossibilitš¸ãy|if“the“user“just“en˜ters“ë[return“²without“t˜yping“an˜y“resp�Gonse|Ž¡�‘Õºâis–!àthat“the“Ï^^M‘!Ó²will“pro�Gduce“a“Ï\par“²tokš¸ãen“(follo˜wing“the“general“rule“that“an“empt˜yŽ¡�‘Õºâline–2éis“equiv‘ÿqÇalenš¸ãt“to“Ï\par²).‘fNThe“b�Gest“approac˜h“is“to“prev˜en˜t“the“Ï^^M‘2à²c˜haracter“fromŽ¡�‘Õºâgetting–ܼinš¸ãto“the“read“macro“in“the“ rst“place.‘I”This“can“b�Ge“done“in“t˜w˜o“w˜a˜ys:‘5zsettingŽ¡�‘Õºâthe–UUcatco�Gde“of“Ï^^M“²to“9“(\ignore"),“or“setting“Ï\endlinechar“²to“¸²1.Ž¡�‘äºâUnfortunately‘ÿ*ª,‘Nthis–íPimmediately“raises“another“dicult•¸ãy:‘¡½w“e›íPw“an“t˜to˜k“eep˜theŽ¡�‘Õºâcatco�Gde–QÃcš¸ãhange“or“Ï\endlinechar“²c˜hange“lo�Gcal“so“that“it“will“a ect“only“the“Ï\read².Ž¡�‘ÕºâThis–åcould“b�Ge“accomplished“bš¸ãy“sa˜ving“the“curren˜t“catco�Gde“or“Ï\endlinechar“²(just“inŽ¡�‘Õºâcase)–H”and“restoring“it“after“the“Ï\read“²is“done,‘K!but“it's“simpler“to“enclose“the“Ï\readŽ¡�‘Õºâ²in–UUa“group:ŽŸŒÉ�‘ÕºâÏ\begingroupަ�‘Õºâ\endlinechar=-1ަ�‘Õºâ\global\read16‘?ýto\answerަ�‘Õºâ\endgroupŽŸ�‘Õºâ²Here–ʧthe“Ï\global“²pre x“makš¸ães“Ï\answer“²retain“its“de nition“b�Gey˜ond“the“Ï\endgroup².Ž¡�‘äºâWith–UUthis“mošGdi cation“the“tests“done“b�¸ãy“Ï\printoptions“²could“b˜e“simpli ed“toŽŸŒÉ�‘ÕºâÏ\if\Ans@–?ýS“...\elseަ�‘Õºâ\if\Ans@–?ýG“...\elseަ�‘Õºâ\if\Ans@–?ýP“...\elseަ�‘Õºâ...ŽŸ�‘Õºâ²whic�¸ãh–UUrenders“the“macros“Ï\S@²,“Ï\G@²,“Ï\P@“²unnecessary‘ÿ*ª.Ž¡�‘äºâOn–E the“other“hand,‘{‘wš¸ãe“ha˜v˜e“adv‘ÿqÇanced“to“some“splendid“new“complications:‘é­Ï\Ans@Ž¡�‘Õºâ²migh•¸ãt›Þøno“w˜b�Ge˜completely˜empt“y‘ÿ*ª,‘`if˜the˜user˜just˜pressed˜the˜ë[return˜²k“ey‘ÿ*ª,‘`and˜anŽ¡�‘Õºâemptš¸ãy–þÏ\Ans@“²w˜ould“b�Gollix“up“the“Ï\if“²tests.‘kÏThis“case“is“easy“to“handle,‘(.though:Ž¡�‘Õºâadd–Can“extra“brancš¸ãh“Ï\ifx\Ans@\empty...“²at“the“b�Geginning.‘k±W‘ÿ*ªe“ha˜v˜e“the“opp�GositeŽŽŽ�� þ }ü�’J7 problem–¡ñif“the“user“tš¸ãyp�Ges“more“than“one“letter:‘on“the“true“branc˜h“(the“`none-of-the-ޤ �’J7 ab�Go•¸ãv“e'›‹Kbranc“h,‘˜Èunless˜the˜user's˜ rst˜t“w“o˜letters˜happ•Gen˜to˜b“e˜iden�¸ãtical),‘˜Èthe˜extraŽ¡�’J7 cš¸ãharacters–bcould“p�Goten˜tially“cause“spurious“t˜yp�Gesetting“activit˜y‘ÿ*ª.‘ïíAs“it“happ�Gens,‘‰åw˜eŽ¡�’J7 can–UUkill“t•¸ãw“o–UUbirds“with“one“stone,“as“w�¸ãe'll“see“in“¸x²5.4.ŽŸàl��’J7 à5.3Ž’h÷ Upp�`ercasing‘€inputŽŸuT�’J7 ²Next–63let's“lošGok“at“the“pro˜cedure“used“b�¸ãy“Ï\printoptions“²for“upp˜ercasing“the“user'sŽ¡�’J7 reply:‘qÇafter–UUreading“Ï\ans@²,“Ï\xdef“²and“Ï\uppercase“²are“applied“to“it“as“follo�¸ãws:ޤg�’J7 Ï\xdef\next@{\def\noexpand\Ans@{\ans@}}%Ž© ŒÉ�’J7 \uppercase\expandafter{\next@}%ŽŸuž�’J7 ²A–UUmore“economical“vš¸ãersion“of“the“same“tec˜hnique“w˜ould“b�Ge:Ž¡�’J7 Ï\xdef\ans@{\uppercase{%ަ�’T·\gdef\noexpand\ans@{\ans@}}}%ަ�’J7 \ans@ŽŸuž�’J7 ²If–.Ï\ans@“²con�¸ãtains“Ïs“²to“bšGegin“with,‘Mäthen“after“the“Ï\xdef“²has“b˜een“completed,‘Mätheޤ �’J7 de nition–ÿŸof“Ï\ans@“²is“Ï\uppercase{\def\ans@{s}}².‘U5Then“calling“Ï\ans@“²causes“it“toŽ¡�’J7 rede ne–¨Ïitself,‘ËPbut“not“b�Gefore“the“tokš¸ãens“in“the“argumen˜t“of“Ï\uppercase“²are“suitablyŽ¡�’J7 upp�Gercased.��Ÿü^ÿ±13ŽŽ‘ ê­²With–UUthis“c�¸ãhange,“the“auxiliary“macro“Ï\Ans@“²is“no“longer“needed.Ž¡�’Y7 T‘ÿ*ªo–¥²simplify“the“structure“of“macros“using“this“uppšGercasing“pro˜cess,‘¹Éit“could“b˜eŽ¡�’J7 emš¸ãb•Go“died–UUin“a“dedicated“function“of“its“o˜wn:ŽŸg�’J7 Ï\def\uppermac#1{\xdef#1{\uppercase{\gdef\noexpand#1{#1}}}%ަ�’T·#1}ŽŸuž�’Y7 ²A‘°gnonglobal–°Áalternativš¸ãe“ma˜y“sometimes“b�Ge“desirable,‘›ho˜w˜ev˜er.‘„ Also“the“fullŽ¡�’J7 expansion–smaš¸ãy“not“b�Ge“w˜an˜ted“in“some“cases“when“the“con˜ten˜ts“of“the“macro“b�GeingŽ¡�’J7 uppšGercased–UUare“`fragile'.‘qÇAn“alternativ�¸ãe“that“is“safer“with“resp˜ect“to“expansion:ŽŸg�’J7 Ï\def\uppermac#1{%ަ�’T·\uppercase\expandafter\expandafter\expandafter{%ަ�’_7\expandafter\toks@\expandafter{#1}}%ަ�’T·\edef#1{\the\toks@}}ŽŸàl��’J7 à5.4Ž’h÷ Default‘€resp�`onsesŽŸuT�’J7 ²One–Þâlast“re nemenš¸ãt“in“Ï\printoptions“²w˜ould“b�Ge“to“pro˜vide“a“default“resp�Gonse“if“theŽ¡�’J7 user's–‚°resp�Gonse“is“emptš¸ãy“(that“is,‘Žthe“user“only“hit“the“ë[return“²k˜ey).‘ùØOne“metho�GdŽ¡�’J7 in•¸ãv“olv“es–UUan“auxiliary“macro“lik�¸ãe“the“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“macro“Ï\@car²:Ž’J7 ŸHQ‰ff�ýåŸ J=����‘wŽŸý-:º13ŽŽŽ‘LÜÀOnly–c\the“ëHs“Àis“a ected“bš:“}%Ž¡�‘à:Ü\begingroup‘?ý\endlinechar\m@neŽ¡�‘à:Ü\global\read\m@ne‘?ýto\ans@Ž¡�‘à:Ü\endgroupŽ¡�‘à:Ü\xdef\ans@{\uppercase{%Ž¡�‘êºÖ\def\noexpand\ans@{%Ž¡�‘Õºâ%–?ýDefault“to“`P':Ž¡�‘õ:Ð\expandafter\firsttoken\ans@‘?ýP@}%Ž‘ÕºâŸŸJ‰ff�ýåŸ J=����‘wŽŸý-:º14ŽŽŽ‘LÜÀUsing–[tëH@“Àas“the“ending“delimiter“is“prettšÃŽy“safe“if“w˜e“mak˜e“sure“that“it“has“catco�Ÿ'EŽ‘ãxX“will“con˜tin˜ue“to“read“additionalŽ¡�’J7 lines–/³unš¸ãtil“equalit˜y“is“ac˜hiev˜ed“(cf.“¸x²3.1).‘eÏ\endlinechar“²w�¸ãas“set“to“¸²1“(soŽ¡�’J7 that–Žpan“empt�¸ãy“line“will“not“pro�Gduce“a“Ï\par²|see“¸x²5.2),›œ·and“second,˜the“space“thatŽ¡�’J7 w•¸ãas›4Št“yp•Ged˜at˜the˜b“eginning˜of˜the˜second˜line˜of˜the˜resp“onse˜didn't˜register˜either,Ž¡�’J7 follo�¸ãwing–_žT�‘þU>Ÿ'EŽ‘ãxX's“usual“rule“of“ignoring“spaces“at“the“b�Geginning“of“a“line“(ÌThe‘±ÙT�‘þKß'EŽ‘Í-Xb–ÿ}'o“ok²,Ž¡�’J7 Chapter–UU8,“double“dangerous“b�Gends).ަ��’J7 à5.7Ž’h÷ Outer‘€macrosŽŸuT�’J7 Ì[This–“çse›ÿ}'ction“is“p˜artly“obsolete“as“of“T�‘þKß'EŽ‘Í-X“version“3.141;“se˜e“¸xÌ3.1.]Ž¡�’Y7 ²If–¥éyš¸ãou“en˜ter“an“Ï\outer“²macro“in“resp�Gonse“to“a“Ï\read“²prompt,‘ºT�‘þU>Ÿ'EŽ‘ãxX“will“informŽ¡�’J7 y�¸ãou–1*in“an“error“message“that“it“has“inserted“a“closing“brace.‘FUnfortunately‘ÿ*ª,‘hthisŽ¡�’J7 is–Tdrather“unhelpful,‘T”since“yš¸ãou“will“then“ha˜v˜e“the“matc˜hing“brace“problem“describ�GedŽ¡�’J7 in–Ù4the“previous“section;‘#yš¸ãour“answ˜er“no˜w“con˜tains“an“unmatc˜hed“righ˜t“brace,‘ú+andŽ¡�’J7 if– gyš¸ãou“don't“t˜yp�Ge“`x'“at“the“question-mark“prompt“to“exit,‘ó+y˜ou“could“get“stuc˜k.Ž¡�’J7 F–ÿ*ªortunately“,‘6Êit– ³is“unlikš¸ãely“for“an˜y˜one“to“ev˜er“en˜ter“an“outer“macro“in“resp�Gonse“toŽ¡�’J7 a–2prompt,‘@(since“in“ë[plain‘ª®²T�‘þU>Ÿ'EŽ‘ãxX“the“set“of“sucš¸ãh“macros“is“small“and“used“relativ˜elyŽŽŽŽŽŽŒ‹ºÑ <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²20ŽŽ ‚� ÿ@É ��‘Õºâ þÁV‰ffÞøQ >~D�„>~Dff� þÒsƒ��’àR,Example–UU3:‘qÇReading“m�¸ãultiple“lines“with“a“single“Ï\read“²commandŽŽŸ �‘ ™›First,–UUthe“input“ le:Ž©ŒÉ�‘ ™›Ï\begingroup–?ý\newlinechar=`\&“\endlinechar=-1ޤ ŒÉ�‘ ™›\message{&Please–?ýenter“your“name:“}\global\read-1“to\nameŽ¡�‘ ™›\message{&And–?ýyour“Social“Security“number:“}\global\read-1“to\ssnoŽ¡�‘ ™›\endgroupŽ¡�‘ ™›\show\name‘?ý\show\ssnoŽ¡�‘ ™›...ŽŸ�‘ ™›²Noš¸ãw–UUthe“log“ le,“including“the“resp�Gonses“(a“ë[return“²w˜as“t˜yp�Ged“after“ÏFrank²):ަ�‘ ™›ÏPlease–?ýenter“your“name:“{Joe“Bob“Willie“Clark“Mark“Raphael“Ferguson“FrankŽ¡�‘Ù˜Henry–?ýJames“Percival“Emerson“Elmo“Davenport,“Jr.}Ž©’�‘ ™›And–?ýyour“Social“Security“number:“360-60-6000Ž¡�‘ ™›>‘?ý\name=macro:Ž¡�‘ ™›->{Joe–?ýBob“Willie“Clark“Mark“Raphael“Ferguson“FrankHenry“James“Percival“EmersonŽ¡�‘Ù˜Elmo–?ýDavenport,“Jr.}.Ž¡�‘ ™›l.7‘?ý\show\nameŽ¡�‘XYn\show\ssnoŽ¡�‘ ™›?Ž¡�‘ ™›>‘?ý\ssno=macro:Ž¡�‘ ™›->360-60-6000.Ž¡�‘ ™›l.7–?ý\show\name“\show\ssnoަ�‘ ™›?ŽŽ’Þ+…„>~DffŽžff‰ffÞøQŽŽ ¿6ô���� ÿ^É �‘Õºâ²infrequenš¸ãtly‘ÿ*ª,‘ÐHand–„~in“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“there“are“almost“no“Ï\outer“²macros“at“all;‘acciden˜talޤ �‘Õºâtš¸ãyping–òÒof“a“Ï^^L‘òª²c˜haracter“(whic˜h“is“activ˜e“and“outer,‘1in“ë[plain‘ª®²T�‘þU>Ÿ'EŽ›ãxX“and“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ˜X)“isŽ¡�‘ÕºâpšGerhaps–UUthe“least“unlik�¸ãely“p˜ossibilit�¸ãy‘ÿ*ª.Ž¡�‘äºâSome‘UUobserv‘ÿqÇations:Ž¡�‘äºâ|If–ëthe“user“c•¸ãhec“ks–ëthe“help“message“and“stops“to“p�Gonder“the“situation,‘.PtheyŽ¡�‘Õºâha•¸ãv“e–|Çthe“opp�Gortunit�¸ãy‘ÿ*ª,›Æ£at“least,˜to“realize“that“E›|{or“X˜to“exit“is“indeed“the“wiseŽ¡�‘Õºâcš¸ãhoice.‘qÇThey're–UUnot“Ìr–ÿ}'e“al‘‚Øly‘7Ò²stuc˜k–UUunless“they“carelessly“try“to“con˜tin˜ue.Ž¡�‘äºâ|If–ÿƒthe“user“do�Gesn't“a�¸ãv‘ÿqÇail“him/herself“of“the“E›ÿnor“X˜option,‘­just“ab�Gout“an�¸ãythingŽ¡�‘Õºâelse–Äthat“they“try“will“b�Ge“ine ectivš¸ãe.‘XBOn“some“systems“ev˜en“the“in˜terrupt“k˜ey“w˜on'tŽ¡�‘Õºâhelp–'‚here;‘6Èthat“lea•¸ãv“es›'‚essen“tially˜t“w“o˜w“a“ys˜out:‘ZÝmatc“h˜up˜the˜closing˜brace,‘0¬or˜t“yp�GeŽ¡�‘Õºâanother–‡Uouter“thing“to“get“bacš¸ãk“to“the“Ï?“²prompt“and“the“asso�Gciated“error“reco˜v˜eryŽ¡�‘Õºâopp�Gortunit�¸ãy‘ÿ*ª.ŽŽŽ�� ÿ^É ��’J7 à5.8Ž’h÷ Catco�`desŽŸuT�’J7 ²The–žŒtreatmen�¸ãt“of“a“user's“respšGonse“dep˜ends“on“the“use“to“whic�¸ãh“it“will“b˜e“put.ޤ �’J7 L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX's–‰çÏ\typein“²command“is“designed“to“tak�¸ãe“the“resp�Gonse“and“execute“it,‘× andŽ¡�’J7 therefore–¶Üreads“the“user's“respšGonse“using“normal“category“co˜des.‘<õOn“the“other“hand,Ž¡�’J7 Ïtestfont.tex–…²[�Kn�¸ãuth,‘UU1986cŽ‘:œ{]“c�¸ãhanges“the“category“cošGdes“of“the“sp˜ecial“c�¸ãharactersŽ¡�’J7 to–k12“when“reading“a“user“resp•Gonse,‘pnb“ecause–kthe“respšGonse“will“not“b˜e“executed“butŽ¡�’J7 will–×bšGe“pro˜cessed“as“simple“cš¸ãharacter“data.‘‰NThis“approac˜h“is“probably“the“b�GetterŽ¡�’J7 one–[dfor“most“applications,‘œçsince“it“a•¸ãv“oids–[dthe“p�Gossibilit�¸ãy“of“problems“with“thingsŽ¡�’J7 lik•¸ãe›Çemismatc“hed˜braces˜or˜outer˜con“trol˜sequences,‘ãéand˜since˜the˜Ï\read˜²commandŽ¡�’J7 is–used“more“often“to“read“strings“of“ordinary“c�¸ãharacters“than“to“read“executableŽ¡�’J7 con�¸ãtrol‘UUsequences.ŽŽŽŽŽŽŽŒ‹Ïù <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²21ŽŽ ‚����Ÿë±<��‘Õºâ þ*�ê‰ffj|( Õ°�„Õ°ff� þ;Ú�‘ ™›Example–‡[4:‘ÕÒOuter“conš¸ãtrol“sequence“c˜hoking“a“Ï\read“²op�Geration.‘ØCompare“thisޤ �‘ ™›to–UUthe“b�Geha�¸ãvior“of“Ï^^L“²inside“Ï\message“²as“discussed“in“¸x²4.6.Ž¡�‘ ™›Input‘UU le:ޤŒÉ�‘ ™›Ï\read16‘?ýto\x‘ ú\show\xŽ© ŒÉ�‘ ™›\endŽŸ�‘ ™›²Log‘UU le:Ž¡�‘ ™›Ï\x=^^Lަ�‘ ™›Runaway‘?ýdefinition?ަ�‘ ™›->ަ�‘ ™›!–?ýForbidden“control“sequence“found“while“scanning“definition“of“\x.ަ�‘ ™›Ž¦�‘]™k}ަ�‘ ™›“^^Lޤ’�‘ ™›l.1–?ý\read16“to\xŽ¡�‘ ™›?‘?ýhަ�‘ ™›I–?ýsuspect“you“have“forgotten“a“`}',“causing“meަ�‘ ™›to–?ýread“past“where“you“wanted“me“to“stop.ަ�‘ ™›I'll–?ýtry“to“recover;“but“if“the“error“is“serious,ަ�‘ ™›you'd–?ýbetter“type“`E'“or“`X'“now“and“fix“your“file.Ž¡�‘ ™›?‘?ý1ަ�‘ ™›Type–?ý“to“proceed,“S“to“scroll“future“error“messages,ަ�‘ ™›R–?ýto“run“without“stopping,“Q“to“run“quietly,ަ�‘ ™›I–?ýto“insert“something,“E“to“edit“your“file,ަ�‘ ™›H–?ýfor“help,“X“to“quit.ަ�‘ ™›?ަ�‘ ™›aަ�‘ ™›\ަ�‘ ™›#ަ�‘ ™›{ަ�‘ ™›>‘?ý\x=macro:ަ�‘ ™›->–?ý}“\par“a“\^^M##“{“.ަ�‘ ™›l.2‘?ý\show\xŽ¡�‘ ™›?ŽŽ’i¯\„Õ°ffŽžff‰ffj|(ŽŽŽŽ�� þ }ü��’J7 à5.9Ž’h÷ áLatex.texà:‘á\typeout–€àand“á\typeinŽ©uT�’J7 ²An–~�in�¸ãteresting“asp�Gect“of“the“Ï\typeout“²and“Ï\typein“²commands“in“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“is“thatޤ �’J7 they–`¼aren't“priv‘ÿqÇate“conš¸ãtrol“sequences“(with“Ï@“²c˜haracters“in“their“names);‘fptheyŽ¡�’J7 are– aš¸ãv‘ÿqÇailable“for“use“in“ordinary“do�Gcumen˜t“ les.‘ “One“of“the“uses“suggested“inŽ¡�’J7 the–Ð L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“manš¸ãual“is“for“en˜tering“an“Ï\includeonly“²command“in˜teractiv˜ely“eac˜hŽ¡�’J7 time–˜&a“mš¸ãultipart“do�Gcumen˜t“is“pro�Gcessed.‘:;More“commonly‘ÿ*ª,–¨Ûho˜w˜ev˜er,“Ï\typeout‘˜&²andŽ¡�’J7 Ï\typein–Êe²are“used“inš¸ãternally“in“do�Gcumen˜tst˜yle“ les,‘æ/or“in“sp�Gecial“applications“suc˜h“asŽ¡�’J7 Ïdocstrip.tex–SH²[Mittelbacš¸ãh,‘S±1991]“where“the“distinction“b�Get˜w˜een“priv‘ÿqÇate“and“publicŽ¡�’J7 conš¸ãtrol–UUsequences“is“irrelev‘ÿqÇan˜t.Ž¡�’Y7 The–­ípurp�Gose“of“Ï\typein“²is“(a)“to“prin�¸ãt“a“message“on“screen,‘Äand“(b)“to“read“aŽ¡�’J7 resp�Gonse–|�(one“line)“from“the“user,‘†[either“inš¸ãto“the“in˜ternal“macro“Ï\@typein²,‘†[or“in˜toŽ¡�’J7 a–#Àmacro“cš¸ãhosen“b˜y“the“macro“writer.‘a@If“Ï\@typein“²is“used“to“receiv˜e“the“resp�Gonse,‘-«itŽ¡�’J7 will–"GbšGe“executed“as“Ï\typein²'s“ nal“action.‘`ÃOtherwise“the“resp˜onse“will“b˜e“stored“inŽ¡�’J7 the–UUdesignated“alternate“macro,“without“execution.‘qÇ(Cf.“the“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“man�¸ãual,“¸x²4.6.)Ž¡�’Y7 I‘Ÿ­found– the“de nition“of“Ï\typein“²in“Ïlatex.tex“²more“dicult“to“understandŽ¡�’J7 than–Äalmost“anš¸ãything“else“of“comparable“length“that“I‘Ä ha˜v˜e“lo�Gok˜ed“at.‘¿EAll“theŽ¡�’J7 complications–Ain“the“de nition“servš¸ãe“t˜w˜o“goals:‘ËŸ(1)“If“the“user“simply“presses“theŽ¡�’J7 ë[return–Ѳkš¸ãey‘ÿ*ª,‘ë†the“resulting“Ï\par“²tok˜en“needs“to“b�Ge“discarded,‘ë†lea˜ving“the“macro“thatŽ¡�’J7 holds–Û@the“user“reply“emptš¸ãy;‘5and“(2)“if“the“user“reply“is“not“empt˜y›ÿ*ª,‘üºit“will“usually˜,Ž¡�’J7 but–VVnot“alw•¸ãa“ys,‘V–con“tain–VVa“ nal“space“whic�¸ãh“needs“to“b�Ge“trimmed“o .‘tÊThe“fact“thatŽ¡�’J7 the–UU nal“space“migh�¸ãt“b�Ge“missing“is“the“crucial“problem.Ž¡�’Y7 A‘NGsimpler–NŠv�¸ãersion“of“Ï\@xtypein“²could“bšGe“written“using“a“temp˜orary“deassignmen�¸ãtŽ¡�’J7 of‘UUÏ\endlinechar²:ŽŸŒÉ�’J7 Ï\def\@xtypein[#1]#2{\typeout{#2}\let\@typein\relaxޤ ŒÉ�’T·\begingroup–?ý\endlinechar\m@ne“\global\read\z@“to#1\endgroupŽ¡�’T·\@typein}ŽŸ�’J7 ²This–UUsolv�¸ães“b�Goth“the“Ï\par“²problem“and“the“trailing“space“problem.ޤ �’Y7 Ho•¸ãw“ev“er,‘!m“uc“h– of“the“initial“dev•¸ãelopmen“t– of“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“to�Gok“place“in“1982“and“1983,Ž¡�’J7 b�Gefore–†ƒthe“ultimate“release“of“T�‘þU>Ÿ'EŽ‘ãxX82,‘ÒÎvš¸ãersion“1.0“(ocially:‘Ô#Decem˜b�Ger“3,‘ÒÎ1983),Ž¡�’J7 and–&áin“old“T�‘þU>Ÿ'EŽ‘ãxX“there“wš¸ãas“no“access“to“Ï\endlinechar².‘æj(In“fact“man˜y“features“ofŽ¡�’J7 T�‘þU>Ÿ'EŽ‘ãxX82–|wš¸ãere“added“b˜y“Kn˜uth“in“respšGonse“to“rep˜orts“from“Lamp˜ort“ab˜out“v‘ÿqÇariousŽ¡�’J7 limitations–iÞof“the“language“that“he“ran“inš¸ãto“in“the“course“of“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX's“dev˜elopmen˜t.)Ž¡�’J7 If–™çLampšGort“noticed“later“that“Ï\endlinechar“²could“b˜e“applied“in“Ï\@xtypein²,‘ë heŽ¡�’J7 probably›UUin•¸ãv“ok“ed˜the˜principle˜`If˜it˜ain't˜brok“e,˜don't˜ x˜it'˜and˜left˜it˜alone.ŽŸþ6��’J7 à5.10Ž’o· áDocstrip.texà:‘á\typeoutà,–€á\typeinà,“progress“rep�`ortsަ�’J7 ²As–Ían“example“of“the“use“of“Ï\typeout“²and“Ï\typein²,‘k consider“Ïdocstrip.texŽ¡�’J7 ²[�Mittelbac�¸ãh,‘UU1991Ž‘IU`].‘fäThis–4­is“a“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“utilit�¸ãy“used“for“prošGcessing“a“do˜cumen�¸ãted“macroŽ¡�’J7 le–±xto“remo•¸ãv“e›±xcommen“ts˜(the˜stripp�Ged-do“wn˜v“ersion˜of˜a˜large˜macro˜ le˜will˜loadŽ¡�’J7 signi canš¸ãtly–6�faster“at“run-time,‘nîat“least“on“less“p�Go˜w˜erful“computers).‘žThe“use“ofŽŽŽŽŽŽŒ‹Ý> <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²22ŽŽ ‚���� þ }ü�‘ÕºâÏ\typeout–ç°²in“Ïdocstrip.tex“²is“mainly“a“con•¸ãv“enience,‘ýžto›ç°a“v“oid˜the˜more˜cum“b�Gersomeޤ �‘Õºâphrase–Ö/Ï\immediate\write16²,‘6ebut“Ï\typein“²has“a“more“signi canš¸ãt“adv‘ÿqÇan˜tage|itŽ¡�‘Õºâtakš¸ães–UUcare“of“remo˜ving“a“space“at“the“end“of“the“user“resp�Gonse,“if“presen˜t.Ž¡�‘äºâIn–ìthe“folloš¸ãwing“fragmen˜t“from“Ïdocstrip.tex²,‘Q¾the“user“is“informed“that“anŽ¡�‘Õºâauxiliary–Y le“named“Ïdocstrip.cmd“²has“b�Geen“detected,‘‹�and“is“ask�¸ãed“whether“it“shouldŽ¡�‘ÕºâbšGe–UUused.‘qÇThe“resp˜onse“is“read“in�¸ãto“the“macro“Ï\answer².ŽŸ„�‘ÕºâÏ\typeout{*************************************************}ޤ ŒÉ�‘Õºâ\typeout{*–?ýBatch“file“docstrip.cmd“found.“Use“it“?“(y/n)“*}Ž¡�‘Õºâ\typein[\answer]Ž¡�‘êºÖ{*************************************************}Ž¡�‘Õºâ\def\@tempa{y}%Ž¡�‘Õºâ\ifx\@tempa\answer–?ý\process@batchfile“\fiŽ¡¤{»�‘Õºâ²An–€Banalysis“of“the“tecš¸ãhnique“in“this“fragmen˜t“brings“out“a“few“notew˜orth˜yŽ© �‘Õºâobserv‘ÿqÇations.Ž¡����‘äºã¸ŽŽŽ‘îºä²In–UUthe“prompt“(line“2)“the“acceptable“resp�Gonses“are“listed:‘qÇÏy“²or“Ïn².ޤ=Þ����‘äºã¸ŽŽŽ‘îºä²Since–”ßÏ\typein“²došGesn't“c�¸ãhange“the“case“of“the“user's“resp˜onse,‘¤Áand“there's“noަ�‘îºäco�Gde–aíhere“in“Ïdocstrip.tex“²to“cš¸ãhange“case,‘ew˜e“can“deduce“that“a“resp�Gonse“ofަ�‘îºäÏY–UU²will“b�Ge“treated“as“a“No.Ž¡����‘äºã¸ŽŽŽ‘îºä²If–©3the“user“resp�Gonse“is“Ïyes²,‘þ*then“Ï\answer“²and“Ï\@tempa“²will“ha•¸ãv“e‘©3di eren“tަ�‘îºäde nitions,–UUand“the“Ï\ifx“²test“will“b�Ge“false.Ž¡����‘äºã¸ŽŽŽ‘îºä²If–¿‹the“user“is“exp�Gected“to“enš¸ãter“only“a“single“letter,‘Úw˜e“migh˜t“ask,‘Úwh˜y“is“anަ�‘îºäÏ\ifx–9õ²test“necessary?‘¨Wh�¸ãy“not“just“use“Ï\if“y\answer\process@batchfileަ�‘îºä²and–¹omit“the“extra“step“Ï\def\@tempa{y}²?‘VèHo•¸ãw“ev“er,‘Øthis›¹w“ould˜in“vite˜troubleަ�‘îºäif–ôÁthe“user“pressed“ë[return“²without“tš¸ãyping“an˜ything.‘Q–Then“Ï\answer“²w˜ould“b�Geަ�‘îºäempt�¸ãy–ÆÄ(bšGecause“of“the“sp˜ecial“handling“with“Ï\@defpar“²in“Ï\typein²)“and“b˜eforeަ�‘îºäcompleting–ò7the“ev‘ÿqÇaluation“of“the“Ï\if²,‘ T�‘þU>Ÿ'EŽ‘ãxX“wš¸ãould“con˜tin˜ue“b�Gey˜ond“Ï\answer“²toަ�‘îºäexpand–CŠÏ\process@batchfile“²in“searcš¸ãh“of“a“c˜haracter“to“compare“with“the“Ïy².ަ�‘îºäAlthough–this“wš¸ãould“giv˜e“a“correct“result“for“the“Ï\if“²test,‘1b�Gecause“the“ rstަ�‘îºänonexpandable–Vtok�¸ãen“in“the“de nition“of“Ï\process@batchfile“²is“not“a“Ïy²,‘)Vtheަ�‘îºätrouble–is“that“the“tok�¸ãen“will“bšGe“absorb˜ed“b�¸ãy“the“Ï\if“²op˜eration,‘CÉwhic�¸ãh“willަ�‘îºäthroš¸ãw–UUa“wrenc˜h“in˜to“subsequen˜t“pro�Gcessing.ŽŸ{»�‘äºâÌNote.‘æ²The–Ñjvš¸ãersion“of“Ïdocstrip.tex“²from“whic˜h“I‘ÑJto�Gok“these“examples“w˜as“anަ�‘Õºâearly‘ÿ*ª,‘FÜunp�Gerfected–C>vš¸ãersion“with“an“explicit“disclaimer“from“the“author“that“it“w˜as“aަ�‘Õºâquic•¸ãk›£khac“k,‘¶ðand˜should˜not˜b•Ge˜considered˜an˜example˜of˜his˜b“est˜macro˜writing.‘\Iަ�‘Õºâdiscuss–>ìthe“early“vš¸ãersion“here,–Cgho˜w˜ev˜er,“precisely–>ìb�Gecause“it“illustrates“so“w˜ell“someަ�‘Õºâof–UUthe“t�¸ãypical“diculties“in“writing“T�‘þU>Ÿ'EŽ‘ãxX“dialog.ަ�‘äºâAn–î¿inš¸ãteresting“feature“of“Ïdocstrip“²is“the“abilit˜y“to“see“on“screen“the“progressަ�‘ÕºâbšGeing–õ‡made“in“pro˜cessing“the“curren�¸ãt“ le.‘ R]If“this“feature“is“turned“on“(with“aŽŽŽ�� þ }ü�’J7 Ï\showprogress–;P²command),‘@„then“Ïdocstrip“²prinš¸ãts“on“screen“a“p�Gercen˜t“sign“for“eac˜hޤ �’J7 commen•¸ãt›©ðremo“v“ed˜and˜a˜p•Gerio“d˜for˜eac�¸ãh˜line˜of˜co“de˜that˜is˜k�¸ãept.‘8¦This˜kind˜of˜visualŽ¡�’J7 feedbacš¸ãk–fis“not“just“fripp�Gery“and“ornamen˜tation,‘j0b�Gells“and“whistles.‘£ÖA‘ft˜ypical“userŽ¡�’J7 b�Gegins–§×to“get“nervš¸ãous“if“a“running“program“allo˜ws“sev˜eral“seconds“to“pass“b˜y“withoutŽ¡�’J7 anš¸ãy–¥eobserv‘ÿqÇable“c˜hange“on“screen.‘a÷On“a“fast“system,‘¹iit's“straigh˜tforw˜ard“to“deduceŽ¡�’J7 that–Zfsuc�¸ãh“a“pause“means“something“has“gone“wrong,‘[ªwhereup�Gon“the“user“can“pressŽ¡�’J7 an–êßinš¸ãterrupt“k˜ey“to“in˜v˜estigate“the“problem“without“w˜asting“time.‘2fBut“on“a“slo˜wŽ¡�’J7 system–Uthe“p•Go“or–Uuser“faces“the“dilemma:‘q�AbšGort“unnecessarily‘ÿ*ª,‘Uand“a“restart“will“b˜eŽ¡�’J7 required,‘ðwith–Ñ*all“the“time“consumed“so“far“wš¸ãasted;‘or“con˜tin˜ue“w˜aiting“when“theŽ¡�’J7 program–oGmigh�¸ãt“simply“b�Ge“spinning“its“wheels“and“accomplishing“nothing.‘¿žSo“whenŽ¡�’J7 a–µŸ'EŽ‘ãxX“p�Gost“thatŽ¡�’J7 conš¸ãtained–}©Ïchecknum.sty“²[�Hamilton–UUKelly‘ÿ*ª,“1991Ž‘\€],‘‡¾whic˜h“asks“the“user“for“a“n˜um˜b�GerŽ¡�’J7 and›UUc•¸ãhec“ks˜to˜mak“e˜sure˜that˜a˜v‘ÿqÇalid˜n“um“b�Ger˜w“as˜en“tered.ŽŸs�’J7 Ê%‘æXRemoved–¹–parts“marked“by“ellipsis“dots“(mjd)ޤ �’J7 .–¹–.“.Ž©�’J7 UKTeX–¹–Digest‘æXFriday,‘ s,4“Jan“1991Ž¡�’•ÐlVolume–¹–91“:“Issue“1ަ�’J7 Today's‘¹–Topics:Ž¡�’ŸC˜RE:–¹–Testing“for“numeric-only“inputŽ¡�’¶ã†RE:–¹–Help“with“TeX“fontsŽ¡�’£ý.re:–¹–Footnotes“without“the“numberŽ¡�’£ý.metafont–¹–bombs“out“on“cmbase.mfަ�’J7 .–¹–.“.ŽŽŽŽŽŽŒ‹ñŠ <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²23ŽŽ ‚���� þ}ü�‘ÕºâÊ------------------------------------------------------------Ž©�‘ÕºâDate:‘æXTue,–¹–13“Nov“90“19:35:05“+0000ޤ �‘ÕºâFrom:‘æXTEX@UK.AC.CRANFIELD.RMCSŽ¡�‘ÕºâSubject:–¹–RE:“Testing“for“numeric-only“inputަ�‘ÕºâIn–¹–message“84“of“Tue,“13“Nov“90“11:20:22,Ž¡�‘ÕºâC20249@UK.AC.POLY-SOUTH-WEST.PRIME-A‘¹–wrote:ަ�‘Õºâ>–¹–Back“in“March,“I“wrote“to“you“asking“for“help“with“a“TeX/LaTeXŽ¡�‘Õºâ>–¹–query.“I“have“still“not“had“any“acknowledgment“or“reply.‘ s,Can“youŽ¡�‘Õºâ>–¹–please“help?“Here“is“my“query:ަ�‘ÕºâI'm–¹–sorry,“but“there“appears“to“be“no“record“of“your“submission“toŽ¡�‘ÕºâUKTeX–¹–ever“having“arrived.‘ s,Perhaps“it“came“in“when“Aston“wereŽ¡�‘Õºâexperiencing–¹–some“difficulty“in“forwarding“Janet“mail“to“the“UKTeXŽ¡�‘Õºâeditor,–¹–and“you“missed“the“``bounce''.ަ�‘Õºâ>› s,I–¹–am“writing“a“LaTeX“"program"“and“need“your“help.˜I“am“usingŽ¡�‘Õºâ>‘ s,\typein–¹–to“prompt“the“user“to“enter“a“"number"“via“the“terminal.Ž¡�‘Õºâ>‘ s,Then–¹–I“set“a“counter“to“the“value“of“the“"number"“read“in.Ž¡�‘Õºâ>Ž¡�‘Õºâ>‘%̰\typein[\mynumber]{Please–¹–type“a“number}Ž¡�‘Õºâ>‘%̰\setcounter{mycounter}{\mynumber}Ž¡�‘Õºâ>Ž¡�‘Õºâ>‘ s,What–¹–I“would“like“to“do“is“to“insert“some“TeX“logic“(beforeŽ¡�‘Õºâ>‘ s,setting–¹–the“counter)“to“check“the“validity“of“the“"number"Ž¡�‘Õºâ>‘ s,entered–¹–(it“should“consist“of“a“sequence“of“digits“0-9“only)“andŽ¡�‘Õºâ>‘ s,to–¹–prompt“the“user“again“if“it“contains“anything“else.Ž¡�‘Õºâ>Ž¡�‘Õºâ>‘ s,I–¹–have“scoured“the“TeXbook“looking“for“anything“that“might“appearŽ¡�‘Õºâ>‘ s,to–¹–be“useful“or“relevant,“but“I'm“not“a“TeXpert“and“my“search“wasŽ¡�‘Õºâ>‘ s,fruitless.ަ�‘ÕºâHaving–¹–had“a“slightly“similar“requirement“when“writing“myŽ¡�‘Õºâcrossword.sty–¹–option,“and“eventually“being“pointed“towardsŽ¡�‘Õºâ\afterassignment–¹–by“Frank“Mittelbach,“I“can“sympathize.ަ�‘ÕºâI've–¹–just“knocked“together“(and“tested!)“the“following“style“option,Ž¡�‘Õºâwhich–¹–fills“the“bill,“I“think.ަ�‘ÕºâEnjoy!!Ž¡�‘h4 Brian–¹–{Hamilton“Kelly}ަ�‘Õºâ.–¹–.“.ŽŽŽ�� þ }ü�’J7 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ŽŸ�’J7 [Start–¹–of“attached“file“CHECKNUM.STY]ޤ �’J7 %‘ s,CHECKNUM.STYŽ¡�’J7 %Ž¡�’J7 %‘ s,A–¹–style“file“providing“the“macro“\getnumber.Ž¡�’J7 %Ž¡�’J7 %– s,Usage:“\getnumber{A–¹–prompt“string}{countername}Ž¡�’J7 %‘Ÿîor:‘ s,\getnumber{A–¹–prompt“string}[default]{countername}Ž¡�’J7 %Ž¡�’J7 %‘ŸîOutputs–¹–the“specified“prompt“and“accepts“input“interactively.Ž¡�’J7 %Ž¡�’J7 %‘ŸîIf–¹–the“input“forms“a“valid“number,“it“will“be“assigned“to“theŽ¡�’J7 %‘ŸîLaTeX–¹–counter“`countername'.‘ s,Invalid“input“causes“repetitionŽ¡�’J7 %‘Ÿîof–¹–the“prompt“until“a“valid“response“is“given.Ž¡�’J7 %Ž¡�’J7 %‘ŸîThe–¹–second“form,“with“the“optional“parameter,“will“assign“theŽ¡�’J7 %‘Ÿîvalue–¹–`default'“(which“must“be“a“valid“number)“to“counternameŽ¡�’J7 %‘Ÿîif–¹–the“user“types“return“by“itself.Ž¡�’J7 %Ž¡�’J7 %– s,Caveat:“Input–¹–commencing“with“leading“zeros“will“be“spuriouslyŽ¡�’J7 %‘3ùrrejected.Ž¡�’J7 %Ž¡�’J7 %Ž¡�’J7 %– s,Author:“Brian–¹–{Hamilton“Kelly}Ž¡�’J7 %‘ s,Address:–¹–Royal“Military“College“of“Science,Ž¡�’J7 %‘3ùrShrivenham,–¹–SWINDON,“SN6~8LA,“United“KingdomŽ¡�’J7 %‘ s,Tel:‘Ÿî++44–¹–793“785252Ž¡�’J7 %– s,e-mail:“Ž¡�’J7 %‘ s,Date:‘æX13th–¹–November“1990Ž¡�’J7 %Ž¡�’J7 %‘ s,This–¹–macro“reads“and“consumes“all“following“text,“up“to“andŽ¡�’J7 %‘ s,including–¹–the“special“marker“\@nilŽ¡�’J7 \def\special@gobble‘¹–#1\@nil{}Ž¡�’J7 %–¹–This“if“allows“us“to“decide“whether“a“valid“number“was“enteredŽ¡�’J7 \newif\ifg@rbageŽ¡�’J7 %Ž¡�’J7 %‘ s,Here–¹–is“the“macro“to“be“invoked“by“the“userŽ¡�’J7 %Ž¡�’J7 \def\getnumber#1{\@ifnextchar[{\g@tnumber#1}{\g@tnumber#1[]}}Ž¡�’J7 %Ž¡�’J7 %‘ s,This–¹–is“the“macro“that“does“the“work!Ž¡�’J7 %Ž¡�’J7 \def\g@tnumber#1[#2]#3{%Ž¡�’Sª8\loopŽ¡�’J7 %‘ s,Doing–¹–things“this“way“allows“us“to“get“the“prompt“and“theŽŽŽŽŽŽŒ‹ ½ <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²24ŽŽ ‚���� þ }ü�‘ÕºâÊ%‘ s,response–¹–onto“the“same“line;“the“alternative“course“of“usingޤ �‘Õºâ%‘ s,\typein–¹–would“have“separated“these“items,“and“the“prompt“lineŽ¡�‘Õºâ%‘ s,itself–¹–would“have“read“asŽ¡�‘Õºâ%‘ s,``\@tempa=''.Ž¡�‘è¡:\typeout{}%–¹–Ensure“we“start“on“a“newline;Ž¡�‘á%–¹–prompt“&“response“then“togetherŽ¡�‘Õºâ%‘ s,If–¹–the“optional“default“value“is“provided,“include“it“in“theŽ¡�‘Õºâ%‘ s,promptŽ¡�‘è¡:\ifx–¹–#2“\@emptyŽ¡�‘òf\message{#1:‘¹–}%Ž¡�‘è¡:\elseŽ¡�‘òf\message{#1–¹–[#2]:“}%Ž¡�‘è¡:\fiŽ¡�‘Õºâ%‘ s,Read–¹–the“user's“responseŽ¡�‘è¡:\read\m@ne‘¹–to\@tempaŽŸ�‘Õºâ%‘ s,If–¹–the“user“types“just“a“return,“\@tempa“will“be“set“to“`\par“';Ž¡�‘Õºâ%› s,convert–¹–this“into“just“a“space“by“itself.˜When“we“later“performŽ¡�‘Õºâ%‘ s,the–¹–assignment“to“\@tempcnta,“the“latter“will“assume“the“valueŽ¡�‘Õºâ%‘ s,zero,–¹–so“the“expansion“of“\@tempa“will“NOT“equate“to“that“ofŽ¡�‘Õºâ%‘ s,\@tempb,–¹–and“the“input“of“a“return“by“itself“will“thus“beŽ¡�‘Õºâ%– s,rejected.“(NB–¹–\@defpar“is“defined“by“LaTeX.TeX)Ž¡�‘è¡:\ifx–¹–\@tempa\@defpar“\xdef\@tempa{#2\space}\fiŽ¡�‘Õºâ%‘ s,We'll–¹–now“assign“to“\@tempcnta“whatever“part“of“the“beginning“ofŽ¡�‘Õºâ%‘ s,the–¹–content“of“\@tempa“(read“from“the“input)“that“constitutes“aŽ¡�‘Õºâ%‘ s,legal–¹–number;“any“remaining“characters“(including“the“terminatingŽ¡�‘Õºâ%‘ s,space)–¹–will“then“be“discarded“by“the“call“of“\special@gobble,“butŽ¡�‘Õºâ%‘ s,this–¹–macro“only“takes“effect“AFTER“the“assignment“to“the“counterŽ¡�‘Õºâ%‘ s,has–¹–taken“placeŽ¡�‘è¡:\afterassignment–¹–\special@gobble“\@tempcnta=0\@tempa“\@nilŽ¡�‘Õºâ%‘ s,We–¹–define“\@tempb“to“expand“to“whatever“legal“number“was“input,Ž¡�‘Õºâ%‘ s,with–¹–a“trailing“space.Ž¡�‘è¡:\xdef\@tempb{\the\@tempcnta\space}%Ž¡�‘Õºâ%‘ s,therefore,–¹–iff“\@tempa“contained“only“digits“then“its“first-levelŽ¡�‘Õºâ%‘ s,expansion–¹–will“be“identical“to“that“of“\@tempbŽ¡�‘è¡:\ifx\@tempb\@tempaŽ¡�‘òf\g@rbagefalseŽ¡�‘è¡:\elseŽ¡�‘Õºâ%‘ s,But–¹–if“the“`number'“input“contained“non-digit“characters,“thenŽ¡�‘Õºâ%‘ s,\@tempb–¹–will“contain“something“different!Ž¡�‘òf\g@rbagetrueŽ¡�‘è¡:\fiŽ¡�‘Õºâ%‘ s,If–¹–we“didn't“get“a“valid“number,“then“tell“the“punter;“theŽ¡�‘Õºâ%‘ s,\repeat–¹–will“then“return“us“to“the“\loop“above,“and“re-prompt“forŽ¡�‘Õºâ%‘ s,input.Ž¡�‘è¡:\ifg@rbageŽŽŽ�� þ }ü�’J7 \typeout{Your–¹–response“contained“non-digit“characters;“try“again!}%ޤ �’Sª8\repeatŽ¡�’J7 %‘ s,Finally,–¹–we“can“set“the“user-provided“LaTeX“counter“and“returnŽ¡�’Sª8\setcounter{#3}{\the\@tempcnta}%Ž¡�’J7 }ŽŸ�’J7 ------------------------------Ž¡�’J7 .–¹–.“.Ž©þ6��’J7 à6.2Ž’h÷ emT�‘ý¿áŸªªEŽ‘ìSX–€8-bit“outputŽŸuT�’J7 ²One–x in�¸ãteresting“feature“of“emT�‘þU>Ÿ'EŽ‘ãxX“[�Mattes,‘UU1992Ž‘8qÏ]“is“the“8-bit“output“option.‘ÙæOnޤ �’J7 PCs,‘ðithe–Ñecš¸ãharacters“b�Get˜w˜een“176“and“223“are“b�Go˜x-dra˜wing“c˜haracters;‘mwith“the“8-Ž¡�’J7 bit–õÔoutput“option“of“emT�‘þU>Ÿ'EŽ‘ãxX,‘óputting“these“cš¸ãharacters“in˜to“a“Ï\message“²or“Ï\writeŽ¡�’J7 ²command–»Ralloš¸ãws“y˜ou“to“dra˜w“some“fairly“elabšGorate“b˜oš¸ãxes“on“screen,‘Úfor“em˜b�GellishingŽ¡�’J7 menš¸ãus–UUand“other“bits“of“dialog.‘qÇI“ha˜v˜e“only“exp�Gerimen˜ted“with“this“a“v˜ery“little.ަ��’J7 à6.3Ž’h÷ User‘€HelpŽŸuT�’J7 ²There–¬Kis“a“go•Go“d–¬Kdeal“of“ro�Gom“for“impro•¸ãv“emen“t–¬Kin“the“amoun�¸ãt“and“kind“of“helpŽ¡�’J7 information–`aš¸ãv‘ÿqÇailable“to“the“user“from“within“T�‘þU>Ÿ'EŽ‘ãxX.‘ ‡çHelp“information“pro˜videdŽ¡�’J7 externally–XÚthrough“general“help“facilities“sucš¸ãh“as“Unix“man“pages“is“w˜ell“and“go•Go“d,Ž¡�’J7 but–îanš¸ãy“help“system“that's“not“T�‘þU>Ÿ'EŽ‘ãxX-based“has“one“disadv‘ÿqÇan˜tage:‘K”lac˜k“of“p�Gortabilit˜yŽ¡�’J7 across–UUthe“whole“sp�Gectrum“of“computer“systems“that“can“run“T�‘þU>Ÿ'EŽ‘ãxX.Ž©����’Y7 ¸ŽŽŽ’c7²Anš¸ãy–¨\program“should“ha˜v˜e“an“announcemen˜t“near“the“b�Geginning“of“ho˜w“toŽ¡�’c7quit– Ÿwithout“destructiv�¸ãe“side“e ects;‘%†for“T�‘þU>Ÿ'EŽ‘ãxX“this“means,‘÷among“other“things,Ž¡�’c7that–¥eacš¸ãh“v˜ersion“of“the“T�‘þU>Ÿ'EŽ‘ãxX“program“should“ha˜v˜e“in“its“op�Gening“messageŽ¡�’c7instructions–ìon“hoš¸ãw“to“break“out“of“an“in nite“lo�Gop“or“in“general“ho˜wŽ¡�’c7to–*Óinš¸ãterrupt“T�‘þU>Ÿ'EŽ‘ãxX“b�Gefore“it“has“ nished“its“curren˜t“run.‘ òBIn“ÌT‘ÿ;¼extur‘ÿ}'es‘üô²thisŽ¡�’c7requiremenš¸ãt–ÂIis“satis ed“b˜y“the“`P˜ause'“button,‘ß²alw˜a˜ys“visible.‘@ÃIn“DOS‘Â$v˜ersionsŽ¡�’c7of–ð*T�‘þU>Ÿ'EŽ‘ãxX“the“inš¸ãterrupt“k˜ey“is“normally“the“Con˜trol-Break“or“Con˜trol-C‘ïÁk˜eyŽ¡�’c7(dep�Gending– Îpartly“on“the“particular“implemen�¸ãtation“of“T�‘þU>Ÿ'EŽ‘ãxX);‘j in“V‘þã�AX/VMSŽ¡�’c7it–L´is“Conš¸ãtrol-C‘L²or“Con˜trol-Y,“with“the“latter“reserv˜ed“for“emergency“use“only‘ÿ*ª,Ž¡�’c7since–UUit“will“lea•¸ãv“e›UUy“ou˜without˜a˜log˜ le˜for˜reference.ŽŸ����’Y7 ¸ŽŽŽ’c7²Resp�Gonse–UUto“the“promptަ��ŸÿqÇ�’h×%ÏI–?ýcan't“find“file“xxx.‘ úPlease“type“another“input“file“name:ŽŽŽ¦�’c7²The–lŽnoš¸ãvice“user“should“b�Ge“able“to“t˜yp�Ge“the“reasonable“guesses“Ïhelp“²and“ÏhŽ¡�’c7²and–ûÏ?²;‘tÍthe“easiest“w•¸ãa“y–ûto“do“this“w�¸ãould“b�Ge“to“put“ les“Ïhelp.tex²,‘DäÏh.tex“²orŽ¡�’c7Ï?.tex–¶q²in“the“T�‘þU>Ÿ'EŽ‘ãxX“inputs“directory/folder/area.‘<Ñ(Except“that“man�¸ãy“OS's“don'tŽ¡�’c7alloš¸ãw–ÍÏ?.tex“²as“a“ le“name).‘Ø×Already“man˜y“systems“ha˜v˜e“a“ le“Ïnull.tex“²orŽŽŽŽŽŽŒ‹£ <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²25ŽŽ ‚���� þ }ü�‘îºäÏnul.tex–ø²to“alloš¸ãw“y˜ou“to“ab�Gort“reasonably“gracefully“if“y˜ou“kno˜w“enough“toޤ �‘îºäenš¸ãter–¼›Ïnull“²or“Ïnul“²in“resp�Gonse“to“the“prompt.‘§˜V‘ÿ*ªery“few“T�‘þU>Ÿ'EŽ‘ãxX“users,‘Ölho˜w˜ev˜er,Ž¡�‘îºäwill– äevš¸ãer“think“of“en˜tering“Ïnul“²without“reading“abšGout“it“in“the“do˜cumen�¸ãtationŽ¡�‘îºäor–UUhearing“abšGout“it“from“a“more“exp˜erienced“user.Ž©����‘äºã¸ŽŽŽ‘îºä²Some–¥of“T�‘þU>Ÿ'EŽ‘ãxX's“Ìbuilt-in‘ig²error/help“messages“are“sp�Geci c“to“Ïplain.tex².‘`ÓSomeŽ¡�‘îºäbig–ïWmacro“pacš¸ãk‘ÿqÇages“suc˜h“as“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“migh˜t“prefer“to“c˜hange“some“of“the“w˜ordingŽ¡�‘îºäat–eleast.‘ ÝF‘ÿ*ªor“example,‘hôthere“are“references“in“some“of“T�‘þU>Ÿ'EŽ‘ãxX's“compiled-in“helpŽ¡�‘îºämessages–Ö_to“things“likš¸ãe“Ï\def“²and“Ï\eqalign“²that“are“do�Gcumen˜ted“no˜whereŽ¡�‘îºäin–rthe“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“b•Go“ok.‘ÈAnd–rif“y�¸ãou“press“ë[return“²at“a“Ï*“²prompt“after“gettingŽ¡�‘îºäinš¸ãto–dêT�‘þU>Ÿ'EŽ‘ãxX's“in˜teractiv˜e“mo�Gde“(in˜ten˜tionally“or“acciden˜tally),‘hÏT�‘þU>Ÿ'EŽ‘ãxX“urges“y˜ou“toŽ¡�‘îºäenš¸ãter–_¼a“command“or“t˜ypšGe“Ï\end²|the“latter“b˜eing“w�¸ãorse“than“useless“in“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxXŽ¡�‘îºä(where–aHÏ\stop“²or“Ï\end{document}“²are“what“is“required):‘‰®after“t�¸ãyping“Ï\endŽ¡�‘îºä²and–¦·ë[return²,‘»nothing“happšGens“b˜ecause“L�Ÿýó5�‘üff±AŽŽ‘͉²T�‘þU>Ÿ'EŽ‘ãxX“is“wš¸ãaiting“for“the“argumen˜t“ofŽ¡�‘îºäthe–UUÏ\end“²command.ަ����‘äºã¸ŽŽŽ‘îºä²Long–·}help“and“error“messages“use“string“p•Go“ol–·}and“main“memory‘ÿ*ª.‘=*Storing“themŽ¡�‘îºäin–ê¢external“ les“wš¸ãould“pro˜vide“more“space“(at“the“cost“of“slo˜w˜er“access;‘5IbutŽ¡�‘îºäof–¸course,›¤once“y�¸ãou“get“an“error“message,˜prošGcessing“sp˜eed“is“scarcely“relev‘ÿqÇan�¸ãtŽ¡�‘îºäan�¸ãy‘UUlonger).ŽŸÄ��‘Õºâà7Ž‘éúâSummaryŽŸç��‘Õºâ7.1Ž‘ôzâSending‘€messagesŽ©uT�‘Õºâ²Recommendations:‘ÌÝUn•¸ãtil›‚àv“ersions˜of˜T�‘þU>Ÿ'EŽ‘ãxX˜earlier˜than˜3.141˜are˜sucien“tly˜phasedŽ¡�‘Õºâout,‘Vy�¸ãou–¼Yhad“b�Getter“use“Ï\immediate\write“²rather“than“Ï\message“²for“genericŽ¡�‘Õºâmessage-sending–Fimacros,‘Ieso“that“all“\prinš¸ãtable"“c˜haracters“remain“a˜v‘ÿqÇailable“for“useŽ¡�‘Õºâin–¿,the“message“text.‘¯KUse“Ï\message“²instead“of“Ï\immediate\write“²for“pro�Gducing“aŽ¡�‘Õºâprompt–žÜif“yš¸ãou“w˜an˜t“the“user's“respšGonse“to“app˜ear“on“the“same“line.‘N\Uncatco˜de“allŽ¡�‘Õºâsp�Gecial–æyc�¸ãharacters“while“constructing“the“text“of“a“message,‘ Âif“the“message“text“isŽ¡�‘Õºâcompletely›3“in•¸ãv‘ÿqÇarian“t˜b�Get“w“een˜one˜use˜and˜the˜next.‘f†Use˜Ï\string˜²if˜y“ou˜don't˜w“an“tŽ¡�‘Õºâa–UUspace“after“a“conš¸ãtrol“w˜ord,“and“use“Ï\noexpand“²if“y˜ou“do“w˜an˜t“a“space.ŽŸþ6��‘Õºâà7.2Ž‘ôzâReading–€user“inputަ�‘Õºâ²Recommendations:‘>Set–ªCthe“catcošGde“of“Ï\endlinechar“²temp˜orarily“to“9“while“readingŽ¡�‘Õºâa–RrespšGonse,‘R±to“a•¸ãv“oid–Rgetting“an“extra“space“at“the“end“from“the“Ï^^M².‘p­Uncatco˜de“allŽ¡�‘Õºâsp•Gecial›Žc�¸ãharacters,‘Cesp“ecially˜op“ening˜and˜closing˜braces.‘¬rIf˜it˜is˜not˜uncatco“ded,Ž¡�‘Õºâremo•¸ãv“e–À"the“outerness“from“Ï^^L²,“at“least“while“reading“a“user“resp�Gonse,‘Ýúand“similarly‘ÿ*ª,Ž¡�‘Õºâif–nÊthe“bacš¸ãkslash“is“not“uncatco�Gded“and“y˜ou“w˜an˜t“to“b�Ge“supremely“cautious,‘u(remo˜v˜eŽ¡�‘Õºâthe–âouterness“from“anš¸ãy“other“outer“con˜trol“sequences“(e.g.,‘BÏ\newif²)“if“they“migh˜tŽ¡�‘Õºâreasonably›ÿ*ª,–UUor“ev�¸ãen“unreasonably˜,“turn“up“in“a“user's“resp�Gonse.ŽŽŽ�� þ }ü�’J7 àReferencesŽŸç���’M±³Å[Co•¾9w“an,‘T1987]ŽŽ’‹8·Co•¾9w“an,‘5Ra“y‘ÿ:«.– ®Êtables.styÅ.“1987.“This“is“deriv�¾9ed“from“Êtables.texÅ;‘:I‘ ¬foundޤ �’\·it–Tat“Êsun.soe.clarkson.eduÅ,“directory:‘pÊpub/tex/latex-styleÅ.Ž©���’M±³[Greene,‘T1989]ŽŽ’ŒX,Greene,‘ö­Andrew–É›Marc.“\T�‘þuAŸïÿEŽ›˜ŸXreation|Pla�¾9ying“games“with“T�‘þuAŸïÿEŽ˜X's“mind."Ž¡�’\·ó¼j‘¹ cmti9ÈTUGb•‡o“at–TÅ10(4),“pages“691{705,“1989.“Includes“a“listing“of“Êanimals.texÅ.ަ���’M±³[Greene,‘T1990]ŽŽ’ŒX,Greene,‘ÈŽAndrew–µ\Marc.“\BaSiX:“An“in�¾9terpreter“written“in“T�‘þuAŸïÿEŽ‘˜ŸX."“ÈTUGb•‡o“atŽ¡�’\·Å11(3),–Tpages“381{392,“1990.ަ���’M±³[Hamilton–TKelly‘ÿ:«,“1991]ŽŽ’­eEHamilton–œ½Kelly,›¾—Brian.“Êchecknum.styÅ.“ÈUKT�‘þlóŸïÿEŽ‘ƒX“Å91(1),˜4“Jan�¾9uaryŽ¡�’\·1991.ަ���’M±³[Kn�¾9uth,‘T1986b]ŽŽ’�Kn�¾9uth,›/Donald–)ñE.“ó`”q[˜ cmsl9ë`T�‘þuAŸïÿEŽ‘˜ŸX:‘EªThe“programÅ.“Reading,˜Mass.:‘EªAddison-W–ÿ:«esley“,Ž¡�’\·1986.ަ���’M±³[Kn�¾9uth,‘T1986c]ŽŽ’Ž èKnš¾9uth,‘¼Donald–àE.“Êtestfont.texÅ.“ë`The“MET‘ÿ:«AF˜ONTb•AÇo“okÅ,‘¼App“endix‘àH,Ž¡�’\·section– �4.“Reading,›NMass.:‘ Addison-W–ÿ:«esley“,˜1986.– �This“ le“is“included“in“all“standardŽ¡�’\·distributions–Tof“óaÒoÇw cmss9ëaMET‘ÿ:«AF�¾9ONTÅ.ަ���’M±³[Lamp�AÇort,‘T1985]ŽŽ’“UÚLamp�AÇort,‘1Leslie.–+�Êlatex.texÅ.“V‘ÿ:«ersion“2.09“(1985{1992).“Main“source“ leŽ¡�’\·for–TL�Ÿýó5�‘ü«‡ºAŽŽ‘© ÅT�‘þuAŸïÿEŽ‘˜ŸX,“included“with“an�¾9y“standard“distribution.ަ���’M±³[Mattes,‘T1992]ŽŽ’Œ »Mattes,‘õmEb�AÇerhard.–b5emT�‘þuAŸïÿEŽ‘˜ŸX.“V‘ÿ:«ersion“3.1415.“A‘a�comprehensiv�¾9e“suite“ofŽ¡�’\·programs–\5including“T�‘þuAŸïÿEŽ‘˜ŸX,–ííëaMET‘ÿ:«AFš¾9ONTÅ,“prin˜ter‘\5driv˜ers,“preview˜ers,“BibT�‘þuAŸïÿEŽ‘˜ŸX,“.–Šª.“.“.Ž¡�’\·Av‘ÿ|railable–?Þbš¾9y“anon˜ymous“ftp“from“Êniord.shsu.edu“Å(USA)‘?Óor“Êftp.uni-stuttgart.deŽ¡�’\·Å(Europ�AÇe)–Tand“other“ ne“arc•¾9hiv“es.ަ���’M±³[Mittelbac�¾9h,‘T1991]ŽŽ’›ªþMittelbac�¾9h,‘,ÒF›ÿ:«rank.–( Êdocstrip.texÅ.“V˜ersion“1.1l,‘,Ò1991.“This“ le“is“partŽ¡�’\·of–ý4the“Êmulticol“Åpacš¾9k‘ÿ|rage“a˜v‘ÿ|railable“b˜y“anon˜ymous“FTP‘ý.from“man˜y“arc˜hiv˜es,‘includingŽ¡�’\·Êftp.uni-stuttgart.de–TÅand“Êymir.claremont.eduÅ.ŽŸ#Ä��’J7 àApp�`endix‘€AŽ’ }Animals.texŽŸç�’J7 ²This›m¤I‘mžha•¸ãv“e˜cleaned˜up˜a˜bit˜b“y˜making˜upp�Gercase˜and˜lo“w“ercase˜resp�Gonses˜equallyޤ �’J7 acceptable,‘”–and–debš¸ãy“making“a“lo�Gop“so“that“y˜ou“can“rep�Geat“the“game“without“restartingŽ¡�’J7 T�‘þU>Ÿ'EŽ‘ãxX–UUeacš¸ãh“time.‘qÇSource“credit“is“in“the“bibliograph˜y“[�Greene,“1989Ž‘8Ô].ŽŸþ6��’J7 àA.1Ž’lhÓanimals.texŽŸuT�’J7 Ê%–,ÂAnimals“(in–¹–TeX,“no“less!!!)ޤ �’J7 %Ž¡�’J7 %‘,ÂThis–¹–is“the“program“that“uses“a“binary“tree“of“questions“toŽ¡�’J7 %‘,Âguess–¹–the“type“of“animal“of“which“the“user“is“thinking.Ž¡�’J7 %Ž¡�’J7 %‘,ÂAndrew–¹–Marc“Greene,“March-April“1988Ž¡�’J7 %Ž¡�’J7 %%%–¹–modified“May“1991,“Michael“Downes:Ž¡�’J7 %%%‘,Â---removed–¹–path“names“to“leave“bare“file“namesŽŽŽŽŽŽŒ‹/ <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²26ŽŽ ‚���� þ }ü�‘ÕºâÊ%%%‘,Â---added–¹–animals2.tex“so“that“you“can“repeat“withoutޤ �‘Õºâ%%%‘Y„restarting‘¹–TeXŽ¡�‘Õºâ%%%‘,Â---added–¹–code“so“that“lowercase“and“uppercase“userŽ¡�‘Õºâ%%%‘Y„responses–¹–will“both“be“recognized.Ž¡�‘Õºâ%Ž¡�‘Õºâ%‘,ÂMoral–¹–support“(i.e.,“``You“can't“do“that!‘ s,Show“us!'')Ž¡�‘Õºâ%‘,Âprovided–¹–by“the“Student“Information“Processing“BoardŽ¡�‘Õºâ%‘,Âof‘¹–MIT.Ž¡�‘Õºâ%Ž¡�‘Õºâ%–¹–Instructions“on“running“this“program:Ž¡�‘Õºâ%Ž¡�‘Õºâ%‘Ÿîtex‘¹–animalsŽ¡�‘Õºâ%Ž¡�‘Õºâ%–¹–Think“of“an“animal.‘ s,The“program“will“try“to“guess“your“animal.Ž¡�‘Õºâ%Ž¡�‘Õºâ%–¹–You“will“be“asked“a“whole“bunch“of“yes/no“questions.‘ s,This“is“aŽ¡�‘Õºâ%–¹–spartan“implementation,“so“answer“with“a“capital“Y“or“N.‘ s,WhenŽ¡�‘Õºâ%–¹–the“program“finishes“going“through“its“tree,“it“will“either“haveŽ¡�‘Õºâ%–¹–guessed“your“animal“or“it“will“ask“you“to“enter“a“question“thatŽ¡�‘Õºâ%–¹–it“can“ask“to“differentiate“between“your“animal“and“its“guess.Ž¡�‘Õºâ%–¹–It“will“then“ask“you“which“one“is“`yes.'Ž©�‘Õºâ%–¹–Here's“where“I“declare“all“my“variables,“etc.Ž¡�‘Õºâ%Ž¡�‘Õºâ%–¹–``curcode''“is“the“current“index“into“the“data“file.Ž¡�‘Õºâ%–¹–``temp''“is“a“temporary“holding“variable.Ž¡�‘Õºâ%–¹–``lc''“is“a“loop“counterŽ¡�‘Õºâ%–¹–``ifamg''“is“a“general-purpose“flag.‘ s,amg“are“my“initials.Ž¡�‘Õºâ%–¹–``ifreploop''“controls“loop“repetitions.Ž¡�‘Õºâ%–¹–``ifmainlooprep''“controls“repetitions“of“the“main“loop.Ž¡�‘Õºâ%–¹–``inp''“is“the“input“file.Ž¡�‘Õºâ%–¹–``outp''“is“the“output“file.Ž¡�‘Õºâ%–¹–``amgY''“and“``amgN''“are“character“constants.‘ s,Why“I“did“it“this“way“IŽ¡�‘Õºâ%‘qfdon't‘¹–remember.Ž¡�‘Õºâ%Ž¡�‘Õºâ\newcount\curcode\curcode=1\newcount\temp\temp=0\newcount\lcŽ¡�‘Õºâ\newif\ifamg\newif\ifyn\newif\ifreploop\newif\ifmainlrepŽ¡�‘Õºâ\newread\inp\newwrite\outp\def\foo{}Ž¡�‘Õºâ\def\amgY{Y}\def\amgN{N}ަ�‘Õºâ%–¹–The“data“file“consists“of“records“stored“in“the“following“format:Ž¡�‘Õºâ%Ž¡�‘Õºâ%–¹–Record“Number“Ž¡�‘Õºâ%–¹–Question“Ž¡�‘Õºâ%–¹–If-Yes-Goto-Record“Number“Ž¡�‘Õºâ%–¹–If-No-Goto-Record“Number“ŽŽŽ�� þ }ü�’J7 %ޤ �’J7 %–¹–The“following“routine“scans“the“data“file“until“it“reaches“theŽ¡�’J7 %–¹–record“requested“in“\curcodeŽ¡�’J7 %Ž¡�’J7 \def\Scan{%Ž¡�’J7 {\loopŽ¡�’Nð¢\global\read\inp–¹–to“\fooŽ¡�’Nð¢\ifnum\foo=\curcode\amgfalse\else\amgtrue\fiŽ¡�’Nð¢\ifamg\read\inp–¹–to“\foo\read\inp“to“\foo\read\inp“to“\fooŽ¡�’J7 \repeat}}Ž©�’J7 %–¹–The“following“routine“displays“the“question“and“waits“for“a“Y“or“NŽ¡�’J7 %‘¹–answerŽ¡�’J7 %Ž¡�’J7 \def\Query{%Ž¡�’J7 {\read\inp–¹–to“\fooŽ¡�’J7 \immediate\write16{}%Ž¡�’J7 \message{\foo}%Ž¡�’J7 \GetYNŽ¡�’J7 \ifynŽ¡�’Sª8\read\inp–¹–to“\foo\global\curcode=\foo\read\inp“to“\fooŽ¡�’J7 \elseŽ¡�’Sª8\read\inp–¹–to“\foo\read\inp“to“\foo\global\curcode=\fooŽ¡�’J7 \fiŽ¡�’J7 }}ަ�’J7 %–¹–The“following“routines“deal“with“the“user's“input.Ž¡�’J7 %–¹–\vread“(verbatim“read)“ignores“s“and“makes“s“normalŽ¡�’J7 %–¹–\GetYN“gets“input“and“repeats“until“it“gets“a“Y“or“N“response.Ž¡�’J7 %Ž¡�’J7 \def\vread#1{{\catcode`\^^M=9\catcode`\–¹–=12\global\read-1“to“#1}}Ž¡�’J7 \def\first#1#2\end{#1}Ž¡�’J7 %Ž¡�’J7 \def\GetYN{%Ž¡�’J7 {\loopŽ¡�’J7 \vread{\bar}%Ž¡�’J7 \edef\bar{\uppercase{\def\noexpand\bar{%Ž¡�’Sª8\expandafter\first\bar\empty\end}}}\barŽ¡�’J7 \reploopfalseŽ¡�’J7 \if‘¹–Y\bar\global\yntrue\elseŽ¡�’Nð¢\if‘¹–N\bar\global\ynfalse\else\replooptrue\fi\fiŽ¡�’J7 \ifreploopŽ¡�’J7 \immediate\write16{Hey,–¹–you!‘ s,Answer“Y“or“N,“please.}%Ž¡�’J7 \message{Please–¹–enter“Y“or“N“-->“}%Ž¡�’J7 \repeatŽ¡�’J7 }}ŽŽŽŽŽŽŒ‹HÞ <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²27ŽŽ ‚���� þ}ü�‘ÕºâÊ%–¹–The“following“routine“is“called“if“the“``Goto-Record''“is“-1,ޤ �‘Õºâ%–¹–meaning“that“the“program“didn't“guess“correctly“and“is“clueless.Ž¡�‘Õºâ%–¹–It“gets“the“new“animal“and“the“differentiating“question,“andŽ¡�‘Õºâ%–¹–modifies“the“data“file.‘ s,Actually,“it“makes“a“modified“copy“ofŽ¡�‘Õºâ%–¹–the“file,“then“copies“the“temporary“new“one“over“the“old“outdatedŽ¡�‘Õºâ%‘¹–one.Ž¡�‘Õºâ%Ž¡�‘Õºâ\def\NewAnimal{Ž¡�‘Õºâ\immediate\write16{Well,–¹–I'm“stumped.‘ s,What“animal“did“you“have“in“mind?}Ž¡�‘Õºâ\vread{\usersanimal}Ž¡�‘Õºâ\immediate\write16{OK.‘ s,What–¹–question“would“let“me“tell“the“difference?}Ž¡�‘Õºâ\vread{\userquery}Ž¡�‘Õºâ\immediate\write16{Is–¹–the“answer“to“that“question“Yes“or“No“if“I“ask“about}Ž¡�‘Õºâ\message{\usersanimal?‘¹–}Ž¡�‘Õºâ\GetYNŽ¡�‘Õºâ\curcode=-1Ž¡�‘Õºâ\ScanŽ¡�‘Õºâ\read\inp–¹–to“\lastcode\lc=\lastcodeŽ¡�‘Õºâ\closein\inpŽ¡�‘Õºâ%Ž¡�‘Õºâ%–¹–Open“up“the“files.‘ s,These“names“are“system-dependent.‘,Â*FLAG*Ž¡�‘Õºâ%Ž¡�‘Õºâ\openin\inp=animal.datŽ¡�‘Õºâ\ifeof\inp–¹–\errmessage{Unable“to“open“animal.dat!}\fiŽ¡�‘Õºâ\immediate\openout\outp=newaniml.datŽ¡�‘Õºâ%Ž¡�‘Õºâ%–¹–Read“through“the“inp“file,“copying“all“records“that“don't“need“toŽ¡�‘Õºâ%–¹–be“changed,“outputting“modified“versions“of“the“changed“ones“(andŽ¡�‘Õºâ%–¹–discarding“the“old),“and“appending“the“new“records.Ž¡�‘Õºâ%Ž¡�‘Õºâ{\loopŽ¡�‘Útx\read\inp–¹–to“\fooŽ¡�‘Útx\amgtrueŽ¡�‘Útx\ifnum\foo=\temp\amgfalse\fiŽ¡�‘Útx\ifnum\foo=-1‘¹–\amgfalse\fiŽ¡�‘Útx\ifamg\immediate\write\outp{\foo}%Ž¡�‘ß.\read\inp–¹–to“\foo\immediate\write\outp{\foo}%Ž¡�‘ß.\read\inp–¹–to“\foo\immediate\write\outp{\foo}%Ž¡�‘ß.\read\inp–¹–to“\foo\immediate\write\outp{\foo}%Ž¡�‘ß.\amgtrueŽ¡�‘Útx\else\ifnum\foo=\tempŽ¡�‘ß.\immediate\write\outp{\foo}%Ž¡�‘ß.\immediate\write\outp{\userquery}%Ž¡�‘ß.\immediate\write\outp{\number\lc}%Ž¡�‘ß.\global\advance\lc–¹–by“1ŽŽŽ�� þ }ü�’Sª8\immediate\write\outp{\number\lc}%ޤ �’Sª8\read\inp–¹–to“\animal\read\inp“to“\foo\read\inp“to“\fooŽ¡�’Sª8\amgtrueŽ¡�’Nð¢\elseŽ¡�’Sª8\lc=\lastcodeŽ¡�’Sª8\ifyn\WriteUsers\WriteAnimalŽ¡�’Sª8\else\WriteAnimal\WriteUsersŽ¡�’Sª8\amgfalse\fiŽ¡�’Nð¢\fi\fiŽ¡�’Nð¢\ifamgŽ¡�’J7 \repeat}Ž¡�’J7 \closein\inpŽ¡�’J7 \immediate\write\outp{-1}Ž¡�’J7 \immediate\write\outp{\number\lc}Ž¡�’J7 \immediate\closeout\outpŽ¡�’J7 %Ž¡�’J7 %–¹–Now“copy“the“temporary“file“over“the“original“oneŽ¡�’J7 %Ž¡�’J7 %–¹–These“filenames“are“also“system-dependent.‘3ùr*FLAG*Ž¡�’J7 %Ž¡�’J7 \openin\inp=newaniml.datŽ¡�’J7 \ifeof\inp–¹–\errmessage{Unable“to“open“newaniml.dat!}\fiŽ¡�’J7 \immediate\openout\outp=animal.datŽ¡�’J7 {\endlinechar=-1Ž¡�’Sª8\loopŽ¡�’Sª8\read\inp–¹–to“\fooŽ¡�’Sª8\immediate\write\outp{\foo}Ž¡�’Sª8\amgtrueŽ¡�’Sª8\ifeof\inp\amgfalse\fiŽ¡�’Nð¢\ifamg\repeat}Ž¡�’J7 \immediate\closeout\outpŽ¡�’J7 }Ž¡�’J7 %Ž¡�’J7 %–¹–This“routine“is“called“by“NewAnimal“and“writes“the“record“forŽ¡�’J7 %–¹–the“user's“new“animalŽ¡�’J7 %Ž¡�’J7 \def\WriteUsers{Ž¡�’J7 \immediate\write\outp{\number\lc}Ž¡�’J7 \immediate\write\outp{Is–¹–it“\usersanimal?}Ž¡�’J7 \immediate\write\outp{0}Ž¡�’J7 \immediate\write\outp{-1}Ž¡�’J7 \global\advance\lc–¹–by“1“}ŽŸ�’J7 %–¹–This“one“writes“the“modified“old“animalŽ¡�’J7 %Ž¡�’J7 \def\WriteAnimal{ŽŽŽŽŽŽŒ‹Wj <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²28ŽŽ ‚���� þ }ü�‘ÕºâÊ\immediate\write\outp{\number\lc}ޤ �‘Õºâ\immediate\write\outp{\animal}Ž¡�‘Õºâ\immediate\write\outp{0}Ž¡�‘Õºâ\immediate\write\outp{-1}Ž¡�‘Õºâ\global\advance\lc–¹–by“1“}Ž©�‘Õºâ%–¹–Now“we“get“into“the“main“routine.Ž¡�‘Õºâ%–¹–It“simply“repeats“the“scan-query“loop“until“it“gets“a“0“(right“answer)Ž¡�‘Õºâ%–¹–or“a“-1“(wrong“answer,“I'm“stumped),“and“calls“the“appropriate“routine.Ž¡�‘Õºâ%Ž¡�‘Õºâ\def\maybecontinue{\input‘¹–animals2.texŽ¡�‘ß.\maybecontinue}ަ�‘Õºâ\maybecontinueަ�‘Õºâ%–¹–Ah,“the“joys“of“a“job“well-done.‘ s,We“can“now“exit“to“the“system,“knowingŽ¡�‘Õºâ%–¹–that“the“world“is“a“slightly“better“place“for“our“efforts.Ž¡�‘Õºâ%Ž¡�‘Õºâ%–¹–The“following“line“of“code,“probably“the“most“profound“in“the“entireŽ¡�‘Õºâ%–¹–program,“sums“up“this“philosophy“of“life“in“four“characters.‘ s,TheŽ¡�‘Õºâ%–¹–Puritan“work“ethic“is“embodied“in“this“amazingly“meaning-ladenŽ¡�‘Õºâ%–¹–command“designed“by“Donald“Knuth.ަ�‘Õºâ\endŽŸþ6��‘ÕºâàA.2Ž‘÷ì©animals2.texŽŸuT�‘ÕºâÊ\openin\inp=animal.datŽ¡�‘Õºâ\ifeof\inp–¹–\errmessage{Unable“to“open“animal.dat!}\fiŽ¡�‘Õºâ\loopŽ¡�‘Útx\temp=\curcodeŽ¡�‘Útx\ScanŽ¡�‘Útx\QueryŽ¡�‘Útx\mainlreptrueŽ¡�‘Útx\ifnum\curcode=0Ž¡�‘ãç¤\immediate\write16{%Ž¡�‘íZÐThank–¹–you“for“using“Animals.‘ s,I'm“glad“I“got“it“right.}Ž¡�‘ãç¤\mainlrepfalseŽ¡�‘Útx\elseŽ¡�‘ãç¤\ifnum\curcode=-1‘¹–\NewAnimal\mainlrepfalse\fiŽ¡�‘Útx\fiŽ¡�‘Õºâ\ifmainlrepŽ¡�‘Õºâ\repeatަ�‘Õºâ\closein\inpŽ¡�‘Õºâ\message{Wanna–¹–go“again?“}%ŽŽŽ�� þ }ü�’J7 \GetYNޤ �’J7 \ifynŽ¡�’Sª8\curcode=1–¹–%“initializationŽ¡�’J7 \elseŽ¡�’Sª8\def\maybecontinue{}%Ž¡�’J7 \fiŽ¡�’J7 \endinputŽŸþ6��’J7 àA.3Ž’lhÓanimal.datŽŸuT�’J7 ²A‘IRtš¸ãypical–IU le“Ïanimal.dat“²is“sho˜wn“here,‘K»in“part.‘mÇBut“the“nature“of“the“game“is“forޤ �’J7 yš¸ãou–+Nto“create“y˜our“o˜wn“v˜ersion“of“this“ le“based“on“the“answ˜ers“that“y˜ou“giv˜e“whileŽ¡�’J7 pla�¸ãying.ŽŸŒÉ�’J7 Ï1ޤ ŒÉ�’J7 Does–?ýit“have“four“legs?Ž¡�’J7 2Ž¡�’J7 3Ž¡�’J7 2Ž¡�’J7 Is–?ýit“an“amphibian?Ž¡�’J7 4Ž¡�’J7 5Ž¡�’J7 3Ž¡�’J7 Does–?ýit“have“six“legs?Ž¡�’J7 6Ž¡�’J7 7Ž¡�’J7 4Ž¡�’J7 Does–?ýit“have“a“tail?Ž¡�’J7 36Ž¡�’J7 37Ž¡�’J7 5Ž¡�’J7 Is–?ýit“a“big“kind“of“cat?Ž¡�’J7 10Ž¡�’J7 11Ž¡�’J7 6Ž¡�’J7 Does–?ýit“have“big“hind“legs“used“for“jumping?Ž¡�’J7 40Ž¡�’J7 41Ž¡�’J7 7Ž¡�’J7 Is–?ýit“a“fish?Ž¡�’J7 8Ž¡�’J7 9Ž¡�’J7 8Ž¡�’J7 ...ŽŽŽŽŽŽŒ‹d� <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²29ŽŽ ‚���� þ }ü��‘ÕºâàApp�`endix‘€BŽ‘*îpBasix.texŽ©ç�‘Õºâ²Another–§÷e ort“b�¸ãy“Andrew“Marc“Greene,‘ʤwith“clear“relev‘ÿqÇance“to“the“sub‘Ž8ject“of“dialogޤ �‘Õºâin–šÏT�‘þU>Ÿ'EŽ‘ãxX,‘Àis“his“prototš¸ãyp�Ge“Basic“in˜terpreter“describ�Ged“in“[�Greene,‘UU1990Ž‘8Ô].‘3›I‘š had“plannedŽ¡�‘Õºâto–3Âgivš¸ãe“here“a“closer“study“of“the“dialog“concepts“used“b˜y“Ïbasix.tex“²but“it“seems“IŽ¡�‘Õºâwill–UUnot“ha•¸ãv“e–UUenough“time.ŽŸÄ��‘ÕºâàApp�`endix‘€CŽ‘+ŒT‘þàables.texަ�‘Õºâ²The–% le“Ïtables.tex“²[�Co•¸ãw“an,‘UU1987Ž‘7Ž@]“proš¸ãvides“table“macros“with“the“unique“prop�Gert˜yŽ¡�‘Õºâthat–­Ua“preamš¸ãble“line“sp�Gecifying“the“format“of“eac˜h“ro˜w“is“not“required;‘ÙUthe“formatŽ¡�‘Õºâis–Éßdetermined“automatically“bš¸ãy“an“analysis“of“the“table“con˜ten˜ts.‘ÏdThe“dialog“partŽ¡�‘Õºâconsists–UUof“a“message“suc�¸ãh“asŽŸŒÉ�‘ÕºâÏ[Nrows=9,‘?ýNcols=2]ŽŸ�‘Õºâ²that–F˜is“prinš¸ãted“on“screen“for“eac˜h“table.‘lÝThis“pro˜vides“con rmation“at“run-time“forŽ¡�‘Õºâthe–Šuser“of“the“general“structure“of“eacš¸ãh“table.‘In“the“w˜orst“case,‘—Mif“the“n˜um˜b�Ger“ofŽ¡�‘Õºâroš¸ãws–1†or“columns“is“wildly“wrong,‘8°the“user“can“press“the“in˜terrupt“k˜ey“and“go“ x“upŽ¡�‘Õºâthe–UUtable“b�Gefore“trying“again.ŽŸÄ��‘ÕºâàApp�`endix‘€DŽ‘+®pF‘þàon• tmen“u.texަ�‘Õºâ²The–ú le“Ïfontmenu.tex“²demonstrates“a“crude“menš¸ãu“system“based“on“the“tok˜enŽ¡�‘Õºâdeletion–avoption“after“an“error“message.‘–+There“are“ vš¸ãe“tok˜ens“Ï\ComputerModern²,Ž¡�‘ÕºâÏ\Garamond²,–\šetc.,“corresp�Gonding–'òto“the“ vš¸ãe“fon˜t“c˜hoices.‘éŸThey“are“so“de ned“andŽ¡�‘Õºâarranged–i�that“if“the“user“en•¸ãters,›n›sa“y‘ÿ*ª,˜2–i�to“select“Garamond“fon�¸ãts,˜then“the“deletionŽ¡�‘Õºâof› ;t•¸ãw“o˜tok“ens˜will˜lea“v“e˜the˜Ï\Garamond˜²tok“en˜sho“wing˜on˜screen˜(as˜the˜last˜tok“enŽ¡�‘Õºâdeleted–e$bš¸ãy“the“user),‘©and“then“the“next“tok˜en“(Ï\Helvetica²)“will“de ne“the“fon˜tŽ¡�‘Õºâbase–”jto“b�Ge“`Garamond'“and“gobble“the“remainder“of“the“list.‘/The“e ect“of“thisŽ¡�‘Õºâarrangemen�¸ãt–•is“that“the“user“sees“the“'Ï\Garamond²'“on“screen“as“a“con rmation“ofŽ¡�‘Õºâtheir–�selection“after“they“enš¸ãter“the“n˜um˜bšGer“and“b˜efore“they“press“the“ë[return“²k�¸ãey“aŽ¡�‘Õºâsecond‘UUtime.ŽŸ�‘ÕºâÊ\def\ComputerModern{\gdef\fontbase{Times}\gobble}ޤ �‘Õºâ\def\Garamond{\gdef\fontbase{Computer‘¹–Modern}\gobble}Ž¡�‘Õºâ\def\Helvetica{\gdef\fontbase{Garamond}\gobble}Ž¡�‘Õºâ\def\Malibu{\gdef\fontbase{Helvetica}\gobble}Ž¡�‘Õºâ\def\Times{\gdef\fontbase{Malibu}\gobble}ޤ�‘Õºâ\def\gobble#1\endgobble{}Ž¡�‘Õºâ%‘æXMake–¹–sure“we“have“a“reasonable“\newlinecharŽŸ �‘Õºâ\newlinechar=`\^^J‘¹–\catcode\newlinechar=12ŽŽŽ�� þ}ü�’J7 \begingroupޤ �’J7 \catcode`\<=1–¹–\catcode`\“=2\relaxŽ¡�’J7 \gdef\menustart{\errmessage<%Ž¡�’J7 .......................................‘¹–}%Ž¡�’J7 \endlinechar\newlinechar\catcode`\‘¹–=12\relaxŽ¡�’J7 \gdef\menutext{Ž¡�’Nð¢.......................................Ž¡�’Nð¢.......................................ޤ�’Sª8Select–¹–the“font“base“you“wish“to“use:Ž¡�’Sª8[1]–¹–Computer“Modern‘%̰[4]“Malibuޤ �’Sª8[2]–¹–Garamond‘FßÊ[5]“TimesŽ¡�’Sª8[3]‘¹–HelveticaŽ©�’Sª8(Default:‘¹–Times)}%Ž¡�’J7 \endgroup%–¹–percent“here“to“avoid“extra“\newlinecharަ�’J7 \begingroupŽ¡�’J7 \immediate\write16{\menutext}Ž¡�’J7 %‘æXIf–¹–the“user“accidentally“types“33“instead“of“3“they“will“get“pastŽ¡�’J7 %‘æXall–¹–the“legitimate“menu“choices.“So“to“keep“that“from“causingŽ¡�’J7 %‘æXtrouble,–¹–we“throw“in“a“bunch“of“~“characters“below“to“performŽ¡�’J7 %‘æXerror–¹–recovery.“The“standard“maximum“number“of“tokens“that“TeXŽ¡�’J7 %‘æXwill–¹–delete“at“one“time“is“99.Ž¡�’J7 \catcode`\~=\active–¹–%“just“to“make“sureŽ¡�’J7 \def~{\newlinechar`\^^J%–¹–restore“normal“valueŽ¡�’Sª8\message{%Ž¡�’J7 Whoops!–¹–Well,“you“got“Times“as“your“font“base,“I“think}%Ž¡�’Sª8\gobble}Ž¡�’J7 %‘æXMinimize–¹–unwanted“error“context“(note:“settingŽ¡�’J7 %‘æXthis–¹–to“-1“doesn't“suppress“any“more“information)Ž¡�’J7 \errorcontextlines‘¹–0Ž¡�’J7 \newlinechar=`\!–¹–%“to“hide“the“automatic“!“from“\errmessageŽ¡�’J7 \gdef\fontbase{Times}Ž¡�’J7 %‘æXInside–¹–the“next“group“we“make“the“space“characterŽ¡�’J7 %‘æXactive–¹–so“that“we“can‘ s,use“it“to“call“\menustart,Ž¡�’J7 %‘æXand–¹–then“we“use“\expandafter“so“that“the“firstŽ¡�’J7 %‘æXspace–¹–on“the“next“line“gets“that“catcode“beforeŽ¡�’J7 %‘æXthe–¹–\endgroup“makes“it“revert“to“normal.“All“thisŽ¡�’J7 %‘æXso–¹–that“the“user“does“not“see“`\menustart'“onŽ¡�’J7 %‘æXscreen,–¹–only“a“space.Ž¡�’J7 \begingroupŽ¡�’J7 \catcode`\–¹–=\active\let“=\menustart\expandafter\endgroup%Ž¡�’Nð¢%–¹–Enter“a“number“(1...5)“and“press“Return“TWICEŽŽŽŽŽŽŒ‹n8 <æ� ýÊ}ü��’ðäØÅCARR‘ÿ:«YING–TON“DIALOG“WITH“T�‘þuAŸïÿEŽ‘˜ŸX’)ö²30ŽŽ ‚���� þ }ü�‘ÕºâÊ\ComputerModern%–¹–Press“Return“to“continueޤ �‘Õºâ\Garamond%–¹–Press“Return“to“continueŽ¡�‘Õºâ\Helvetica%–¹–Press“Return“to“continueŽ¡�‘Õºâ\Malibu%–¹–Press“Return“to“continueŽ¡�‘Õºâ\Times%–¹–Press“Return“to“continueŽ¡�‘Õºâ\gobble%Ž¡�‘Õºâ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%Ž¡�‘Õºâ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%Ž¡�‘Õºâ\endgobble\endgroup%Ž¡�‘Õºâ\show\fontbaseŽ¡�‘Õºâ\endŽ©�‘äºâ²And–UUhere“is“screen“output“of“a“t�¸ãypical“run“through“Ïfontmenu.tex²:ŽŸ�‘ÕºâÊThis–¹–is“emTeX,“Version“3.0“[3a]“(preloaded“format=plain“93.9.20)Ž¡�‘ß.30–¹–OCT“1993“23:41Ž¡�‘Õºâ**&plain‘¹–fontmenuŽ¡�‘Õºâ(fontmenu.texަ�‘Útx.......................................Ž¡�‘Útx.......................................ަ�‘ß.Select–¹–the“font“base“you“wish“to“use:ަ�‘ß.[1]–¹–Computer“Modern‘%̰[4]“MalibuŽ¡�‘ß.[2]–¹–Garamond‘FßÊ[5]“TimesŽ¡�‘ß.[3]‘¹–Helveticaަ�‘ß.(Default:‘¹–Times)ަ�‘Útx........................................Ž¡�‘Útx........................................ަ�‘Õºâl.56Ž¡�‘òf%–¹–Enter“a“number“(1...5)“and“press“Return“TWICEŽ¡�‘Õºâ?‘¹–4Ž¡�‘Õºâl.60‘¹–\MalibuŽ¡�‘mê%–¹–Press“Return“to“continueŽ¡�‘Õºâ?Ž¡�‘Õºâ>‘¹–\fontbase=macro:Ž¡�‘Õºâ->Malibu.Ž¡�‘Õºâl.66‘¹–\show\fontbaseަ�‘Õºâ?‘¹–xŽ¡�‘ÕºâNo–¹–pages“of“output.ŽŽŽŽŽŽŒø€òƒ’À;è<æ´³3óaÒoÇw cmss9ó`”q[˜ cmsl9ó[Œ-ø cmcsc10óR¡8)Ïcmsl8óPŒ-ø cmcsc10óHßCÊscmtt8ó6߆µT cmtt12ó5ÂÖN  cmbx12ó0X«Q cmr12ó$ßê cmmi10óKñ`y cmr10óÙ“ Rcmr7óú±u cmex10ù†}ßßßß