├── appendixA.tex ├── appendixB.tex ├── appendixC.tex ├── appendixD.tex ├── appendixE.tex ├── appendixF.tex ├── appendixG.tex ├── appendixH.tex ├── appendixI.tex ├── appendixJ.tex ├── artwork ├── Chapter1.png ├── Chapter10.png ├── Chapter11.png ├── Chapter12.png ├── Chapter13.png ├── Chapter14.png ├── Chapter15.png ├── Chapter16.png ├── Chapter17.png ├── Chapter18.png ├── Chapter19.png ├── Chapter2.png ├── Chapter20.png ├── Chapter21.png ├── Chapter22.png ├── Chapter23.png ├── Chapter24.png ├── Chapter25.png ├── Chapter26.png ├── Chapter27.png ├── Chapter3.png ├── Chapter4.png ├── Chapter5.png ├── Chapter6.png ├── Chapter7.png ├── Chapter8.png ├── Chapter9.png ├── cover.png ├── ctan_lion.png ├── letter1a.png ├── letter1b.png ├── letter2a.png └── letter2b.png ├── chapter01.tex ├── chapter02.tex ├── chapter03.tex ├── chapter04.tex ├── chapter05.tex ├── chapter06.tex ├── chapter07.tex ├── chapter08.tex ├── chapter09.tex ├── chapter10.tex ├── chapter11.tex ├── chapter12.tex ├── chapter13.tex ├── chapter14.tex ├── chapter15.tex ├── chapter16.tex ├── chapter17.tex ├── chapter18.tex ├── chapter19.tex ├── chapter20.tex ├── chapter21.tex ├── chapter22.tex ├── chapter23.tex ├── chapter24.tex ├── chapter25.tex ├── chapter26.tex ├── chapter27.tex ├── content.tex ├── cover.tex ├── front.tex ├── letter1.tex ├── letter2.tex ├── letterformat.tex ├── macros.tex ├── preface.tex ├── texbookc.tex └── xeCJK-base.tex /appendixA.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | % \beginchapter Appendix A. Answers to\\All the\\Exercises 6 | \beginchapter Appendix A. 练习答案 7 | 8 | The preface to this manual points out the wisdom of trying to figure out 9 | each exercise before you look up the answer here. But these answers are intended 10 | to be read, since they occasionally provide additional information that 11 | you are best equipped to understand when you have just worked on a problem. 12 | 13 | \immediate\closeout\ans % this makes the answers file ready 14 | \ninepoint 15 | \input answers 16 | 17 | \endchapter 18 | 19 | If you can't solve a problem, 20 | you can always look up the answer. 21 | But please, try first to solve it by yourself; 22 | then you'll learn more and you'll learn faster. 23 | \author DONALD E. ^{KNUTH}, {\sl The \TeX book\/} (1983) 24 | 25 | \bigskip 26 | 27 | How answer you for your selues? 28 | \author WILLIAM ^{SHAKESPEARE}, {\sl Much Adoe About Nothing\/} (1598) 29 | % Act IV, Scene 2, line 25 30 | 31 | %\eject 32 | \eject\byebye 33 | -------------------------------------------------------------------------------- /appendixC.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | % \beginchapter Appendix C. Character\\Codes 6 | \beginchapter Appendix C. 字符编码 7 | 8 | %\ninepoint 9 | %Different computers tend to have different ways of representing the 10 | %characters in files of text, but \TeX\ gives the same results on 11 | %all machines, because it converts everything to a standard internal 12 | %code when it reads a file. \TeX\ also converts back from its internal 13 | %representation to the appropriate external code, when it writes 14 | %a file of text; therefore most users need not be aware of the fact 15 | %that the ^{codes} have actually switched back and forth inside the machine. 16 | \ninepoint 17 | 不同的计算机往往用不同的方式表示文本文件的字符, 18 | 但 \TeX\ 在所有机器上都给出相同的结果, 19 | 因为它在读取文件时将所有东西都转换为标准的内部编码。 20 | 而 \TeX\ 在写入文本文件时也将内部编码转回恰当的外部编码; 21 | 因此大多数用户不会意识到实际上字符^{编码}在机器中来回转换过。 22 | 23 | %The purpose of this appendix is to define \TeX's internal code, 24 | %which has the same characteristics on all implementations of \TeX. 25 | %The existence of such a code is important, because it 26 | %makes \TeX\ constructions ``portable.'' For example, \TeX\ allows 27 | %^{alphabetic constants} like |`b| to be used as numbers; the fact 28 | %that |`b| always denotes the integer~98 means that we can 29 | %write machine-independent macros that decide, for instance, whether 30 | %a given character is a digit between |0| and |9|. 31 | %Furthermore the internal code of \TeX\ also survives in its ^|dvi| 32 | %output files, which can be printed by software that knows nothing 33 | %about where the |dvi| data originated; essentially the same 34 | %output will be obtained from all implementations of \TeX, regardless 35 | %of the host computer, because the |dvi| data is expressed in a 36 | %machine-independent code. 37 | 这个附录的目的是定义 \TeX\ 的内部编码,它在所有 \TeX\ 实现中都是一致的。 38 | 这种编码的存在性是重要的,因为它使得 \TeX\ 是``可移植的''。 39 | 例如,\TeX\ 允许将类似 |`b| 的^{字母表常数}作为整数使用; 40 | |`b| 永远表示整数~98 意味着我们可以编写机器无关的宏, 41 | 用于确定给定的字符是否为一个在 |0| 和 |9| 之间的数字。 42 | 此外,\TeX\ 的内部编码还用于它的 ^|dvi| 输出文件; 43 | 打印 |dvi| 文件的软件不知道其数据来自哪里, 44 | 但在任何主机的 \TeX\ 实现中将得到完全相同的输出, 45 | 因为 |dvi| 数据是用机器无关的编码表示的。 46 | 47 | %\smallskip 48 | %\TeX's internal code is based on the American Standard Code for 49 | %Information Interchange, known popularly as ``^{ASCII}.'' There are 50 | %128 codes, numbered 0~to~127; we conventionally express the numbers 51 | %in octal notation, from \oct{000} to \oct{177}, or in 52 | %hexadecimal notation, from \hex{00} to \hex{7F}. Thus, the value of 53 | %|`b| is normally called \oct{142} or \hex{62}, not 98. In the 54 | %ASCII scheme, codes \oct{000} through \oct{040} and 55 | %code \oct{177} are~assigned to special functions; for example, 56 | %code \oct{007} is called |BEL|, and it means ``Ring the bell.'' 57 | %The other 94 codes are assigned to visible symbols. Here is a 58 | %chart that shows ASCII codes in such a way that octal and hexadecimal 59 | %equivalents can easily be read off: 60 | \smallskip 61 | \TeX\ 的内部编码基于``^{ASCII}''(American Standard Code for 62 | Information Interchange)。其中一共有 128 个代码,以 0~到~127 编号; 63 | 习惯上对这些数字我们用 \oct{000} 到 \oct{177} 的八进制表示, 64 | 或者用 \hex{00} 到 \hex{7F} 的十六进制表示。 65 | 因此,|`b| 的值通常被称为 \oct{142} 或 \hex{62},而不是 98。 66 | 在 ASCII 体制中,从 \oct{000} 到 \oct{040} 以及 \oct{177} 67 | 的代码分配给特殊功能;例如,编码 \oct{007} 称为 |BEL|, 68 | 它的意思为 ``Ring the bell''。另外 94 个代码分配给可见符号。 69 | 这里有个图表显示了 ASCII 编码,在其中很容易看出八进制和十六进制的对应: 70 | \beginchart{\global\count@='41\tentt 71 | \def\chartstrut{\lower4.3pt\vbox to13.6pt{}}} 72 | &\oct{00x}&&NUL&&SOH&&STX&&ETX&&EOT&&ENQ&&ACK&&BEL&&\oddline0 73 | &\oct{01x}&&BS&&HT&&LF&&VT&&FF&&CR&&SO&&SI&\evenline 74 | &\oct{02x}&&DLE&&DC1&&DC2&&DC3&&DC4&&NAK&&SYN&&ETB&&\oddline1 75 | &\oct{03x}&&CAN&&EM&&SUB&&ESC&&FS&&GS&&RS&&US&\evenline 76 | &\oct{04x}&&SP&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline2 77 | &\oct{05x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline 78 | &\oct{06x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline3 79 | &\oct{07x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline 80 | &\oct{10x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline4 81 | &\oct{11x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline 82 | &\oct{12x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline5 83 | &\oct{13x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline 84 | &\oct{14x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline6 85 | &\oct{15x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline 86 | &\oct{16x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline7 87 | &\oct{17x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&DEL&\evenline 88 | \endchart 89 | 90 | %Ever since ASCII was established in the early 1960s, people have had 91 | %different ideas about what to do with positions \oct{000}--\oct{037} and 92 | %\oct{177}, because most of the functions assigned to those codes are 93 | %appropriate only for special purposes like file transmission, not for 94 | %applications to printing or to interactive computing. It turned out that 95 | %manufacturers soon started producing line printers that were capable of 96 | %generating 128 characters, 33~of~which were tailored to the special needs 97 | %of particular customers; part of the advantage of a standard code was 98 | %therefore lost. On the other hand, the remaining 95~codes (including 99 | %\oct{40}=|SP|, a blank space) have become widely adopted, and they are now 100 | %implanted within most of today's computer terminals. When an ASCII 101 | %keyboard is available, you can specify each of the 128 codes to \TeX\ in 102 | %terms of the 95 standard characters, as follows: 103 | 自从 1960 年代 ASCII 建立之后, 104 | 人们对如何对待位置 \oct{000}--\oct{037} 和 \oct{177} 有不同的想法, 105 | 因为这些编码对应的功能仅在文件传输等特殊目的中才用得到,在打印或者交互计算中用不到。 106 | 结果是制造商很快就开始生产可以生成 128 个字符的行式打印机, 107 | 其中的 33 个字符被按照特定客户的特别需求而定制;标准编码因此丢失了部分优势。 108 | 另一方面,剩下的 95 个编码(包括 \oct{40}=|SP|,即空格)被广泛采用, 109 | 并在今天的大多数计算机终端中扎根。在有 ASCII 键盘可用时, 110 | 你可以用 95 个标准字符给 \TeX\ 指定 128 个编码中任何一个,方法如下: 111 | \beginchart{\def\?{\char`^\char`^\:}\global\count@='100 112 | \postdisplaypenalty=0 \tentt} 113 | &\oct{00x}&&\?&&\?&&\?&&\?&&\?&&\?&&\?&&\?&&\oddline0 114 | &\oct{01x}&&\?&&\?&&\?&&\?&&\?&&\?&&\?&&\?&\evenline 115 | &\oct{02x}&&\?&&\?&&\?&&\?&&\?&&\?&&\?&&\?&&\oddline1 116 | &\oct{03x}&&\?&&\?&&\?&&\?&&\?&&\?&&\?&&\?&\evenline 117 | &\global\count@='40 118 | \oct{04x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline2 119 | &\oct{05x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline 120 | &\oct{06x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline3 121 | &\oct{07x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline 122 | &\oct{10x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline4 123 | &\oct{11x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline 124 | &\oct{12x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline5 125 | &\oct{13x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline 126 | &\oct{14x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline6 127 | &\oct{15x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline 128 | &\oct{16x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline7 129 | &\oct{17x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\char`^\char`^?&\evenline 130 | \endchart 131 | %(Here `|^^|' ^^{uparrow uparrow} doesn't necessarily mean two 132 | %circumflex characters; it means two identical characters whose 133 | %current |\catcode| is~7. In such cases \TeX\ simply adds or 134 | %subtracts \oct{100} from the internal code of the character 135 | %that immediately follows. For example, |*|~can also be typed as |^^j|; 136 | %|j|~can also be typed as |^^*|.) 137 | (这里的 `|^^|' ^^{uparrow uparrow} 并不一定非得是两个扬抑符; 138 | 两个当前 |\catcode| 为~7 的字符也可以。 139 | 在这种用法中,\TeX\ 就将后面跟随的字符的内部编码加上或减去 \oct{100}。 140 | 例如,输入 |^^j| 可以得到 |*|;而输入 |^^*| 可以得到|j|。) 141 | 142 | %An extended ASCII code intended for text editing and interactive computing 143 | % was developed at several universities about 1965, and 144 | %for many years there have been terminals in use at Stanford, MIT, 145 | %Carnegie-Mellon, and elsewhere that have 120 or~121 symbols, not just~95. 146 | %Aficionados of these keyboards (like the author of this book) 147 | %are loath to give up their extra characters; it seems that 148 | %such people make heavy use of about 5~of the extra~25, and occasional 149 | %use of the other~20, although 150 | %different people have different groups of five. For example, the 151 | %author developed \TeX\ on a keyboard that includes the symbols 152 | %{\tentex\char'30},~{\tentex\char1}, {\tentex\char'32}, {\tentex\char'34}, 153 | %and~{\tentex\char'35}, and he finds that this makes it much more pleasant 154 | %to type class notes, 155 | %technical papers, and computer programs of the kind he likes to write; 156 | %his logician friends make heavy use of the {\tentex\char'24} and 157 | %{\tentex\char'25} keys; and so on. It is recommended that \TeX\ 158 | %implementations on systems with large character sets be consistent with the 159 | %following codes: 160 | %\beginchart{\tentex\postdisplaypenalty=0} 161 | %\normalchart 162 | %\endchart 163 | %Of course, designers of \TeX\ macro packages that are intended to be 164 | %widely used should stick to the standard ASCII characters. 165 | 在 1965 年左右,有些大学开发了一个面向文本编辑和交互计算的扩展 ASCII 编码, 166 | 而在 Stanford、MIT、Carnegie-Mellon 和其他大学使用多年的一种终端有 167 | 120 或 121 个符号,不仅仅是 95 个。 168 | 这些键盘的爱好者(如本书作者)不愿意放弃他们的附加字符; 169 | 看起来这些人经常使用这 25 个补充字符的其中 5 个,而偶尔使用另外 20 个, 170 | 虽然常使用的 5 个字符对不同人来说是不同的。 171 | 例如,作者在一个包含符号 {\tentex\char'30}、{\tentex\char1}、{\tentex\char'32}、 172 | {\tentex\char'34} 和 {\tentex\char'35} 的键盘上开发 \TeX , 173 | 他发现这可以更加愉快地输入课程笔记、技术论文以及他喜欢编写的那些计算机程序; 174 | 而他的逻辑学朋友经常使用 {\tentex\char'24} 和 {\tentex\char'25} 按键;等等。 175 | 建议在拥有大字符集的系统上的 \TeX\ 实现与下面的编码保持一致: 176 | \beginchart{\tentex\postdisplaypenalty=0} 177 | \normalchart 178 | \endchart 179 | 当然,面向广大用户的 \TeX\ 宏包的设计者应当只使用标准的 ASCII 字符。 180 | 181 | %Incidentally, the ASCII character |^| that appears in position \oct{136} 182 | %is sometimes called a ``^{caret},'' but dictionaries of English tell us 183 | %that a caret is a larger symbol, more like character \oct{004} in the 184 | %extended set above. The correct name for |^| is ``^{circumflex},'' but 185 | %this is quite a mouthful, so a shorter name like ``^{hat}'' is preferable. 186 | %It seems desirable to preserve the traditional distinction between 187 | %caret and hat. 188 | Incidentally, the ASCII character |^| that appears in position \oct{136} 189 | is sometimes called a ``^{caret},'' but dictionaries of English tell us 190 | that a caret is a larger symbol, more like character \oct{004} in the 191 | extended set above. The correct name for |^| is ``^{circumflex},'' but 192 | this is quite a mouthful, so a shorter name like ``^{hat}'' is preferable. 193 | It seems desirable to preserve the traditional distinction between 194 | caret and hat. 195 | 196 | %The extended code shown above was developed at MIT; it is similar to, but 197 | %slightly better than, the code implemented at Stanford. Seven of the codes 198 | %are conventionally assigned to the standard ASCII control functions 199 | %|NUL| (^\), |HT| (^\), |LF| (^\), |FF| 200 | %(^\), |CR| (^\), |ESC| (^\), and 201 | %|DEL| (^\), and they appear in the standard ASCII positions; hence the 202 | %corresponding seven characters 203 | %{\tentex\char0~\char'11~\char'12~\char'14~\char'15~\char'33~\char'177} 204 | %do not actually appear on the keyboard. These seven ``hidden'' 205 | %characters show up only on certain output devices. 206 | The extended code shown above was developed at MIT; it is similar to, but 207 | slightly better than, the code implemented at Stanford. Seven of the codes 208 | are conventionally assigned to the standard ASCII control functions 209 | |NUL| (^\), |HT| (^\), |LF| (^\), |FF| 210 | (^\), |CR| (^\), |ESC| (^\), and 211 | |DEL| (^\), and they appear in the standard ASCII positions; hence the 212 | corresponding seven characters 213 | {\tentex\char0~\char'11~\char'12~\char'14~\char'15~\char'33~\char'177} 214 | do not actually appear on the keyboard. These seven ``hidden'' 215 | characters show up only on certain output devices. 216 | 217 | %Modern keyboards allow 256 codes to be input, not just 128; so \TeX\ 218 | %represents characters internally as numbers in the range 0--255 (i.e., 219 | %\oct{000}--\oct{377}, or \hex{00}--\hex{FF}). Implementations of \TeX\ 220 | %differ in which characters they will accept in input files and which 221 | %they will transmit to output files; these subsets can be specified 222 | %independently. A completely permissive version of \TeX\ allows full 223 | %256-character input and output; other versions might ignore all 224 | %but the visible characters of ASCII; still other versions might 225 | %distinguish the tab character (code \oct{011}) from a space on input, 226 | %but might output each tab as a sequence of three characters |^^I|. 227 | Modern keyboards allow 256 codes to be input, not just 128; so \TeX\ 228 | represents characters internally as numbers in the range 0--255 (i.e., 229 | \oct{000}--\oct{377}, or \hex{00}--\hex{FF}). Implementations of \TeX\ 230 | differ in which characters they will accept in input files and which 231 | they will transmit to output files; these subsets can be specified 232 | independently. A completely permissive version of \TeX\ allows full 233 | 256-character input and output; other versions might ignore all 234 | but the visible characters of ASCII; still other versions might 235 | distinguish the tab character (code \oct{011}) from a space on input, 236 | but might output each tab as a sequence of three characters |^^I|. 237 | 238 | %Many people, unfortunately, have the opposite problem:\ Instead of the 239 | %95~standard characters and some others, they have fewer than~95 symbols 240 | %actually available. What can be done in such cases? Well, it's possible 241 | %to use \TeX\ with fewer symbols, by invoking more control 242 | %sequences; for example, plain \TeX\ defines ^|\lq|, ^|\rq|, ^|\lbrack|, 243 | %^|\rbrack|, ^|\sp|, and ^|\sb|, so that you need not type |`|,~|'|, |[|, |]|, 244 | %|^|, and~|_|, respectively. 245 | Many people, unfortunately, have the opposite problem:\ Instead of the 246 | 95~standard characters and some others, they have fewer than~95 symbols 247 | actually available. What can be done in such cases? Well, it's possible 248 | to use \TeX\ with fewer symbols, by invoking more control 249 | sequences; for example, plain \TeX\ defines ^|\lq|, ^|\rq|, ^|\lbrack|, 250 | ^|\rbrack|, ^|\sp|, and ^|\sb|, so that you need not type |`|,~|'|, |[|, |]|, 251 | |^|, and~|_|, respectively. 252 | 253 | %A person who implements \TeX\ on computer systems that do not have 254 | %95~externally representable symbols should adhere to the following 255 | %guidelines: \ (a)~Stay as close as possible to the ASCII conventions. 256 | %\ (b)~Make sure that codes \oct{041}--\oct{046}, \oct{060}--\oct{071}, 257 | %\oct{141}--\oct{146}, and \oct{160}--\oct{171} are present and that 258 | %each unrepresentable 259 | %internal code $<\null$\oct{200} leads to a representable code when \oct{100} is 260 | %added or subtracted; then all 256 codes can be input and output. 261 | %\ (c)~Cooperate with everyone else who shares 262 | %the same constraints, so that you all adopt the same policy. 263 | %\ (See Appendix~J for information about the \TeX\ Users Group.) 264 | A person who implements \TeX\ on computer systems that do not have 265 | 95~externally representable symbols should adhere to the following 266 | guidelines: \ (a)~Stay as close as possible to the ASCII conventions. 267 | \ (b)~Make sure that codes \oct{041}--\oct{046}, \oct{060}--\oct{071}, 268 | \oct{141}--\oct{146}, and \oct{160}--\oct{171} are present and that 269 | each unrepresentable 270 | internal code $<\null$\oct{200} leads to a representable code when \oct{100} is 271 | added or subtracted; then all 256 codes can be input and output. 272 | \ (c)~Cooperate with everyone else who shares 273 | the same constraints, so that you all adopt the same policy. 274 | \ (See Appendix~J for information about the \TeX\ Users Group.) 275 | 276 | %\def\Russiantt#1{{\tt\hbox to.5em{\hss\eighttt\char#1\hss}}} 277 | %Very few conventions about character codes are hardwired into \TeX: 278 | %Almost everything can be changed by a format package that changes parameters 279 | %like |\escapechar| and sets up the |\catcode|, |\mathcode|, |\uccode|, 280 | %|\lccode|, |\sfcode|, and |\delcode| tables. 281 | %Thus a \TeX\ manuscript that has been written in ^{Denmark}, say, 282 | %can be run in California, and vice versa, even though quite different 283 | %conventions might be used in different countries. The only character codes 284 | %that \TeX\ actually ``knows'' are these: \ (1)~|INITEX| initializes 285 | %the code tables as described in Appendix~B\null; the same initialization is 286 | %done by all implementations of \TeX. \ (2)~\TeX\ uses the character codes 287 | %\]|+-.,`'"<=>0123456789ABCDEF| in its syntax rules (Chapters 20, 24, and 288 | %Appendix~H\null), and it 289 | %uses most of the uppercase and lowercase letters in its ^{keywords} 290 | %|pt|, |to|, |plus|, etc. These same codes and keywords are used in 291 | %all implementations of \TeX. For example, when \TeX\ is implemented 292 | %for ^{Cyrillic} ^^{Russian} keyboards, the letter `\Russiantt5' should be 293 | %assigned to code \oct{160} and `\Russiantt{`T}' to code \oct{164}, so that 294 | %`\Russiantt5\Russiantt{`T}' still means `|pt|'; or else control sequences 295 | %should be defined so that what \TeX\ sees is equivalent to the keywords 296 | %it needs. \ (3)~The operations |\number|, 297 | %|\romannumeral|, |\the|, and |\meaning| can generate letters, digits, spaces, 298 | %decimal points, minus signs, double quotes, colons, and `|>|' signs; these same 299 | %codes are generated in all implementations of \TeX. 300 | %\ (4)~The |\hyphenation| and |\pattern| commands described in Appendix~H 301 | %give special interpretation to the ten digits and to the characters 302 | %`|.|' and~`|-|'. \ (5)~The codes for the four characters |$|~|.|~|{|~|}| 303 | %are inserted when \TeX\ recovers from certain errors, and braces are 304 | %inserted around an ^|\output| routine; appropriate catcodes are attached 305 | %to these tokens, so it doesn't matter if these symbols have their plain 306 | %\TeX\ meanings or not. \ (6)~There is a special convention for 307 | %representing characters 0--255 in the hexadecimal forms 308 | %|^^00|--|^^ff|, explained in Chapter~8. This convention is always 309 | %acceptable as input, when |^| is any character of catcode~7. Text 310 | %output is produced with this convention only when representing 311 | %characters of code $\ge128$ that a \TeX\ installer has chosen not to 312 | %output directly. 313 | \def\Russiantt#1{{\tt\hbox to.5em{\hss\eighttt\char#1\hss}}} 314 | Very few conventions about character codes are hardwired into \TeX: 315 | Almost everything can be changed by a format package that changes parameters 316 | like |\escapechar| and sets up the |\catcode|, |\mathcode|, |\uccode|, 317 | |\lccode|, |\sfcode|, and |\delcode| tables. 318 | Thus a \TeX\ manuscript that has been written in ^{Denmark}, say, 319 | can be run in California, and vice versa, even though quite different 320 | conventions might be used in different countries. The only character codes 321 | that \TeX\ actually ``knows'' are these: \ (1)~|INITEX| initializes 322 | the code tables as described in Appendix~B\null; the same initialization is 323 | done by all implementations of \TeX. \ (2)~\TeX\ uses the character codes 324 | \]|+-.,`'"<=>0123456789ABCDEF| in its syntax rules (Chapters 20, 24, and 325 | Appendix~H\null), and it 326 | uses most of the uppercase and lowercase letters in its ^{keywords} 327 | |pt|, |to|, |plus|, etc. These same codes and keywords are used in 328 | all implementations of \TeX. For example, when \TeX\ is implemented 329 | for ^{Cyrillic} ^^{Russian} keyboards, the letter `\Russiantt5' should be 330 | assigned to code \oct{160} and `\Russiantt{`T}' to code \oct{164}, so that 331 | `\Russiantt5\Russiantt{`T}' still means `|pt|'; or else control sequences 332 | should be defined so that what \TeX\ sees is equivalent to the keywords 333 | it needs. \ (3)~The operations |\number|, 334 | |\romannumeral|, |\the|, and |\meaning| can generate letters, digits, spaces, 335 | decimal points, minus signs, double quotes, colons, and `|>|' signs; these same 336 | codes are generated in all implementations of \TeX. 337 | \ (4)~The |\hyphenation| and |\pattern| commands described in Appendix~H 338 | give special interpretation to the ten digits and to the characters 339 | `|.|' and~`|-|'. \ (5)~The codes for the four characters |$|~|.|~|{|~|}| 340 | are inserted when \TeX\ recovers from certain errors, and braces are 341 | inserted around an ^|\output| routine; appropriate catcodes are attached 342 | to these tokens, so it doesn't matter if these symbols have their plain 343 | \TeX\ meanings or not. \ (6)~There is a special convention for 344 | representing characters 0--255 in the hexadecimal forms 345 | |^^00|--|^^ff|, explained in Chapter~8. This convention is always 346 | acceptable as input, when |^| is any character of catcode~7. Text 347 | output is produced with this convention only when representing 348 | characters of code $\ge128$ that a \TeX\ installer has chosen not to 349 | output directly. 350 | 351 | \endchapter 352 | 353 | %Code sets obtained by modifying the standard as shown above 354 | %or by other replacements are nonstandard. 355 | %\author ASA SUBCOMMITTEE X3.2, {\sl American Standard\break % 356 | % Code for Information Interchange\/^^{ASCII}} (1963) 357 | %% in {\sl Communications of the ACM\/} 358 | Code sets obtained by modifying the standard as shown above 359 | or by other replacements are nonstandard. 360 | \author ASA SUBCOMMITTEE X3.2, {\sl American Standard\break % 361 | Code for Information Interchange\/^^{ASCII}} (1963) 362 | % in {\sl Communications of the ACM\/} 363 | 364 | \bigskip 365 | 366 | %Both the Stanford and DEC uses of the ASCII control characters 367 | %are in violation of the USA Standard Code, 368 | %but no Federal Marshal is likely to come running out 369 | %and arrest people who type control-T to their computers. 370 | %\author BRIAN ^{REID}, {\sl SCRIBE Introductory User's Manual\/} (1978) % p82 371 | Both the Stanford and DEC uses of the ASCII control characters 372 | are in violation of the USA Standard Code, 373 | but no Federal Marshal is likely to come running out 374 | and arrest people who type control-T to their computers. 375 | \author BRIAN ^{REID}, {\sl SCRIBE Introductory User's Manual\/} (1978) % p82 376 | 377 | %\eject 378 | \eject\byebye 379 | -------------------------------------------------------------------------------- /appendixH.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | % \beginchapter Appendix H. Hyphenation 6 | \beginchapter Appendix H. 连字算法 7 | 8 | It's better to break a word with a hyphen than to stretch interword spaces 9 | too much. Therefore \TeX\ tries to divide words into syllables when 10 | there's no good alternative available. 11 | 12 | But computers are notoriously bad at ^{hyphenation}. When the type\-setting of 13 | newspapers began to be fully automated, ^{jokes} about ``the-rapists who 14 | pre-ached on wee-knights'' soon began to circulate. 15 | 16 | It's not hard to understand why machines have behaved poorly at this task, 17 | because hyphenation is quite a difficult problem. For example, the word 18 | `record' is supposed to be broken as `rec-ord' when it is a noun, but 19 | `re-cord' when it is a verb. The word `hyphenation' itself is somewhat 20 | exceptional; if `hy-phen-a-tion' is compared to similar words like 21 | `con-cat-e-na-tion', it's not immediately clear why the `n' should 22 | be attached to the `e' in one case but not the other. Examples like 23 | `dem-on-stra-tion' vs.~`de-mon-stra-tive' show that the alteration of 24 | two letters can actually affect hyphens that are nine positions away. 25 | 26 | A good solution to the problem was discovered by Frank M. ^{Liang} during 27 | 1980--1982, and \TeX\ incorporates the new method. Liang's algorithm 28 | works quickly and finds nearly all of the legitimate places to insert 29 | hyphens; yet it makes few if any errors, and it takes up comparatively 30 | little space in the computer. Moreover, the method is flexible enough 31 | to be adapted to any language, and it can also be used to hyphenate 32 | words in two languages simultaneously. Liang's Ph.D. thesis, 33 | published by Stanford University's Department of Computer Science in~1983, 34 | explains how to take a dictionary of hyphenated words and teach it to \TeX; 35 | i.e., it explains how to compute tables by which \TeX\ will be able to 36 | reconstruct most of the hyphens in the given dictionary, without error. 37 | 38 | \def\\#1{$_{\kern\scriptspace#1}$} 39 | \TeX\ hyphenates a given word by first looking for it in an ``^{exception 40 | dictionary},'' which specifies the hyphen positions for words that deserve 41 | special treatment. If the word isn't there, \TeX\ looks for {\sl^{patterns}\/} 42 | in the word, and this is the key idea underlying Liang's method. Here's how 43 | it works, using the word `hyphenation' as an example, when \TeX\ is 44 | operating with the English-oriented patterns of plain \TeX\ format: 45 | The given word is first extended by special markers at either end; in this 46 | case we obtain 47 | \begintt 48 | .hyphenation. 49 | \endtt 50 | if `|.|' denotes the special marker. The extended word has subwords 51 | \begintt 52 | . h y p h e n a t i o n . 53 | \endtt 54 | of length one, 55 | \begintt 56 | .h hy yp ph he en na at ti io on n. 57 | \endtt 58 | of length two, 59 | \begintt 60 | .hy hyp yph phe hen ena nat ati tio ion on. 61 | \endtt 62 | of length three, 63 | and so on. Each subword of length $k$ is a pattern that defines $k+1$ small 64 | integer values relating to the desirability of hyphens in the positions 65 | between and adjacent to its letters. We can show these values by attaching 66 | them as subscripts; for example, 67 | `{\tt\\0h\\0e\\2n\\0}' means that the values corresponding to the 68 | subword `|hen|' are 0,~0, 2, and~0, where the~2 relates to hyphens 69 | between the `|e|' and the `|n|'. The interletter values are entirely zero 70 | for all subwords except those that match an entry in \TeX's current 71 | ``^{pattern dictionary}''; and in this case, only the subwords 72 | \begindisplay 73 | \tt\\0h\\0y$_3$p\\0h\\0 \\0h\\0e\\2n\\0 \\0h\\0e\\0n\\0a\\4\cr 74 | \qquad\tt\\0h\\0e\\0n\\5a\\0t\\0 \\1n\\0a\\0 \\0n\\2a\\0t\\0 75 | \\1t\\0i\\0o\\0 \\2i\\0o\\0 \\0o\\2n\\0\cr 76 | \enddisplay 77 | occur as special patterns. \TeX\ now computes the maximum interletter 78 | value that occurs at each subword touching each interletter position. 79 | For example, between `|e|' and `|n|' there are four relevant values 80 | in this case (2~from {\tt\\0h\\0e\\2n\\0}, 81 | 0~from {\tt\\0h\\0e\\0n\\0a\\4}, 82 | 0~from {\tt\\0h\\0e\\0n\\5a\\0t\\0}, 83 | and 1~from {\tt\\1n\\0a\\0}); the maximum of these is~2. 84 | The result of all the maximizations is 85 | \begindisplay 86 | \tt.\\0h\\0y$_3$p\\0h\\0e\\2n\\5a\\4t\\2i\\0o\\2n\\0. 87 | \enddisplay 88 | Now comes the final step: A hyphen is considered to be acceptable 89 | between two letters if the associated interletter value is {\sl odd}. 90 | Thus, two potential breakpoints have been found: `|hy-phen-ation|'. 91 | Similarly, the word `|concatenation|' contains the patterns 92 | \begindisplay 93 | \tt\\0o\\2n\\0 94 | \\0o\\0n\\1c\\0 95 | \\1c\\0a\\0 96 | \\1n\\0a\\0 97 | \\0n\\2a\\0t\\0 98 | \\1t\\0i\\0o\\0 99 | \\2i\\0o\\0 100 | \\0o\\2n\\0 101 | \enddisplay 102 | and this yields `{\tt\\0c\\0o\\2n\\1c\\0a\\0t\\0e\\1n\\2a\\1t\\2i\\0o\\2n\\0}', 103 | i.e., `|con-cate-na-tion|'. 104 | 105 | Let's try a 34-letter word: 106 | `|supercalifragilisticexpialidocious|' matches the plain \TeX\ patterns 107 | \begindisplay 108 | \tt u\\1pe r\\1c \\1ca al\\1i ag\\1i gil\\4 il\\1i il\\4ist is\\1ti st\\2i\cr 109 | \qquad\tt s\\1tic 110 | \\1exp x\\3p pi\\3a \\2i\\1a i\\2al \\2id \\1do \\1ci \\2io \\2us\cr 111 | \enddisplay 112 | (where subscripts that aren't shown are zero), and this yields 113 | $$\centerline{% 114 | \tt.\\0s\\0u\\1p\\0e\\0r\\1c\\0a\\0l\\1i\\0f\\0r\\0a\\0g\\1i\\0l\\4i% 115 | \\0s\\1t\\2i\\0c\\1e\\0x\\3p\\2i\\3a\\0l\\2i\\1d\\0o\\1c\\2i\\0o\\2u\\0s\\0.}$$ 116 | The \stretch resulting \stretch hyphens \stretch 117 | `|su-|\stretch|per-|\stretch|cal-|\stretch|ifrag-|\stretch|ilis-|\stretch 118 | |tic-|\stretch|ex-|\stretch|pi-|\stretch|ali-|\stretch|do-|\stretch|cious|' 119 | agree with Random House's {\sl Unabridged Dictionary\/} (which also 120 | shows a few more: `|su-per-cal-i-frag-i-lis-tic-ex-pi-al-i-do-cious|'). 121 | 122 | Plain \TeX\ loads exactly 4447 patterns into \TeX's memory, beginning with 123 | `{\tt\\0.\\0a\\0c\\0h\\4}' and ending with `{\tt\\4z\\1z\\2}' and 124 | `{\tt\\0z\\4z\\0y$_0$}'. The interletter values in these patterns are all 125 | between 0 and~5; a large odd value like the 5 in `{\tt\\0h\\5e\\0l\\0o\\0}' 126 | forces desirable hyphen points in words like `|bach-e-lor|' and 127 | `|ech-e-lon|', while a large even value like the 4 in `{\tt\\0h\\0a\\0c\\0h\\4}' 128 | suppresses undesirable hyphens in words like `|tooth-aches|'. Liang 129 | derived these patterns by preparing a special version of {\sl Webster's 130 | Pocket Dictionary\/} (Merriam, 1966) that contains about 50,000 words including 131 | derived forms. Then he checked a preliminary set of patterns obtained from 132 | this data against an up-to-date hyphenation dictionary of about 133 | 115,000 words obtained from a publisher; errors found in this run 134 | led to the addition of about 1000 words like |camp-fire|, 135 | |Af-ghan-i-stan|, and |bio-rhythm| to the pocket dictionary list. He 136 | weighted a few thousand common words more heavily so that they would be more 137 | likely to be hyphenated; as a result, the patterns of plain \TeX\ guarantee 138 | complete hyphenation of the 700 or so most common words of English, 139 | as well as common technical words like |al-go-rithm|. These patterns 140 | find 89.3\% of the hyphens in Liang's dictionary as a whole, and 141 | they insert no hyphens that are not present. 142 | 143 | Patterns derived from the common words of a language tend to work well 144 | on uncommon or newly coined words that are not in the original dictionary. 145 | For example, Liang's patterns find a correct subset of the hyphens in the 146 | word that all of today's unabridged dictionaries agree is the longest 147 | in English, namely 148 | \begintt 149 | pneu-monoul-tra-mi-cro-scop-ic-sil-i-co-vol-canoco-nio-sis. 150 | \endtt 151 | They even do fairly well on words from other languages that aren't 152 | too distant from English; for example, the pseudo-^{German} utterances 153 | of Mark ^{Twain}'s {\sl Connecticut Yankee\/} come out with only six or 154 | seven bad hyphens: 155 | \begintt 156 | Con-stanti-nop-o-li-tanis-cher- 157 | dudel-sack-spfeifen-mach-ers-ge-sellschafft; 158 | Ni-hilis-ten-dy-na-mitthe- 159 | aterkaestchensspren-gungsat-ten-taetsver-suchun-gen; 160 | Transvaal-trup-pen-tropen-trans-port- 161 | tram-pelth-iertreib-er-trau-ungsthrae-nen-tra-goedie; 162 | Mekka-musel-man-nen-massen-menchen- 163 | mo-er-der-mohren-mut-ter-mar-mor-mon-u-menten-machen. 164 | \endtt 165 | But when plain \TeX\ is tried on the name of a famous ^{Welsh} city, 166 | ^^{Llanfair P. G.} 167 | \begintt 168 | Llan-fair-p-wll-gwyn-gyll-gogerych- 169 | wyrn-drob-wl-l-l-lan-tysil-i-o-gogogoch, 170 | \endtt 171 | linguistic differences became quite evident, since the correct hyphens are 172 | \begintt 173 | Llan-fair-pwll-gwyn-gyll-go-ger-y- 174 | chwyrn-dro-bwll-llan-ty-sil-i-o-go-go-goch. 175 | \endtt 176 | Appropriate pattern values for other languages can be derived by applying 177 | Liang's method to suitable dictionaries of hyphen points. 178 | 179 | ^{Dictionaries} of English do not always agree on where syllable boundaries 180 | occur. For example, the {\sl American Heritage Dictionary\/} says 181 | `|in-de-pend-ent|' while {\sl Webster's\/} says `|in-de-pen-dent|'. 182 | Plain \TeX\ generally follows Webster except in a few cases where other 183 | authorities seem preferable. 184 | 185 | \begingroup 186 | \hyphenpenalty=-1000 \pretolerance=-1 \tolerance=1000 187 | \doublehyphendemerits=-100000 \finalhyphendemerits=-100000 188 | [From here to the end of this appendix, \TeX\ will be typesetting with 189 | \begindisplay 190 | ^|\hyphenpenalty||=-1000 |^|\pretolerance||=-1 |^|\tolerance||=1000|\cr 191 | ^|\doublehyphendemerits||=-100000 |^|\finalhyphendemerits||=-100000|\cr 192 | \enddisplay 193 | so that hyphens will be inserted much more often than usual.] 194 | 195 | \looseness-1 196 | The fact that plain \TeX\ finds only 90\% of the permissible hyphen points 197 | in a large dictionary is, of course, no cause for alarm. When word 198 | frequency is taken into account, the probability rises to well over 95\%. 199 | Since \TeX's line-breaking algorithm often succeeds in finding a way to 200 | break a paragraph without needing hyphens at all, and since there's a good 201 | chance of finding a different hyphen point near to one that is missed by 202 | \TeX's patterns, it is clear that manual intervention to correct or insert 203 | hyphenations in \TeX\ output is rarely needed, and that such refinements 204 | take a negligible amount of time compared to the normal work of 205 | keyboarding and proofreading. 206 | 207 | But you can always insert words into \TeX's ^{exception dictionary}, if 208 | you find that the patterns aren't quite right for your application. 209 | For example, this book was typeset with three exceptional words added: 210 | The format in Appendix~E includes the command 211 | \begintt 212 | \hyphenation{man-u-script man-u-scripts ap-pen-dix} 213 | \endtt 214 | which tells \TeX\ how to hyphenate the words `manuscript', `manuscripts', 215 | and `appendix'. Notice that both singular and plural forms of 216 | `manuscript' were entered, since the exception dictionary affects 217 | hyphenation only when a word agrees completely with an exceptional 218 | entry. \ (Precise rules for the ^|\hyphenation| command are 219 | discussed below.) 220 | 221 | If you want to see all of the hyphens that plain \TeX\ will find in some 222 | random text, you can say `^|\showhyphens||{|\|}|' and the 223 | results will appear on your terminal (and in the log file). For example, 224 | \begintt 225 | *\showhyphens{random manuscript manuscripts appendix} 226 | |smallskip 227 | Underfull \hbox (badness 10000) detected at line 0 228 | [] \tenrm ran-dom manuscript manuscripts ap-pendix 229 | \endtt 230 | shows the hyphen positions that would have been found in this book 231 | without the addition of any ^|\hyphenation| exceptions. Somehow the word 232 | `manuscript' slips through all of the ordinary patterns; the author added it 233 | as an exception for this particular job because he used it 80~times (not 234 | counting its appearances in this appendix). 235 | 236 | The |\showhyphens| macro creates an hbox that is intentionally 237 | ^{underfull}, so you should ignore the warning about `|badness 10000|'; 238 | this spurious message comes out because \TeX\ displays hyphens in compact 239 | form only when it is displaying the contents of anomalous 240 | hboxes. \ (\TeX\ wizards may enjoy studying the way |\showhyphens| 241 | is defined in Appendix~B.) 242 | 243 | \danger If you want to add one or more words to the exception dictionary, 244 | just say ^|\hyphenation||{|\|}| where \ consists of one 245 | or more \ items separated by spaces. A \ must consist entirely 246 | of letters and hyphens; more precisely, a ``hyphen'' in this context is 247 | the token |-|\\{12}. A ``letter'' in this context is a character token whose 248 | category code is 11 or~12, or a control sequence defined by ^|\chardef|, 249 | or ^|\char|\<8-bit number>, such that the corresponding character has a nonzero 250 | ^|\lccode|. \TeX\ uses the |\lccode| to convert each letter to ``^{lowercase}'' 251 | form; a word-to-be-hyphenated will match an entry in the exception 252 | dictionary if and only if both words have the same lowercase form after 253 | conversion to lowercase. 254 | 255 | \danger \TeX\ will henceforth insert discretionary hyphens in the specified 256 | positions, whenever it attempts to hyphenate a word that matches an entry 257 | in the exception dictionary, except that hyphens are never inserted after the 258 | very first letter or before the last or second-last letter of a word. 259 | You must insert your own discretionary hyphens if you want to allow them 260 | in such positions. A |\hyphenation| entry might contain no hyphens at all; 261 | then \TeX\ will insert no hyphens in the word. 262 | 263 | \danger The exception dictionary is global; i.e., exceptions do not disappear 264 | at the end of a ^{group}. If you specify |\hyphenation| of the same word more 265 | than once, its most recently specified hyphen positions are used. 266 | 267 | \ddanger The exception dictionary is dynamic, but the pattern dictionary 268 | is static: To change \TeX's current set of hyphenation patterns, you 269 | must give an entirely new set, and \TeX\ will spend a little time putting them 270 | into a form that makes the hyphenation algorithm efficient. The 271 | command format is ^|\patterns||{|\|}|, where \ is a 272 | sequence of \ items separated by spaces. This command 273 | is available only in ^|INITEX|, not in production versions of \TeX, since 274 | the process of pattern compression requires extra memory that can be put 275 | to better use in a production system. |INITEX| massages the patterns and 276 | outputs a format file that production versions can load at high speed. 277 | 278 | \ddanger A \ in the |\patterns| list has a more restricted form 279 | than a \ in the |\hyphenation| list, since patterns are supposed to 280 | be prepared by experts who are paid well for their expertise. Each 281 | \ consists of one or more occurrences of \\, 282 | followed by \. Here \ is either a digit (|0|\\{12} to |9|\\{12}) 283 | or empty; an empty \ stands for zero. For example, the pattern 284 | `{\tt\\0a\\1b\\0}' can be represented as |0a1b0| or |a1b0| or |0a1b| or 285 | simply |a1b|. A \ is a character token of category 11 or~12 whose 286 | |\lccode| is nonzero. If you want to use a ^{digit} as a \, you 287 | must precede it by a nonempty \; for example, if for some reason you 288 | want the pattern `{\tt\\1a\\01\\2}' you can obtain it by typing 289 | `|1a012|', assuming that |\lccode`1| is nonzero. Exception: The character 290 | `|.|'~is treated as if it were a \ of code~0 291 | when it appears in a pattern. Code~0 (which obviously cannot match a nonzero 292 | |\lccode|) is used by \TeX\ to represent the 293 | left or right edge of a word when it is being hyphenated. 294 | 295 | \ddanger Plain \TeX\ inputs a file called |hyphen.tex| that sets up the 296 | pattern dictionary and the initial exception dictionary. The file has the 297 | form 298 | \begindisplay 299 | |\patterns{.ach4 .ad4der .af1t .al3t|\quad$\cdots$\quad|zte4 4z1z2 z4zy}|\cr 300 | |\hyphenation{as-so-ciate as-so-ciates dec-li-na-tion oblig-a-tory|\cr 301 | | phil-an-thropic present presents project projects reci-procity|\cr 302 | | re-cog-ni-zance ref-or-ma-tion ret-ri-bu-tion ta-ble}|\cr 303 | \enddisplay 304 | The first thirteen exceptions keep \TeX\ from inserting incorrect 305 | hyphens; for example, `|pro-ject|' and `|pre-sent|' are words like 306 | `|re-cord|', that cannot be hyphenated without knowing the context. 307 | The other exception, `|ta-ble|', is included just to meet the claim 308 | that plain \TeX\ fully hyphenates the 700 or so most common words 309 | of English. 310 | 311 | \looseness-1 312 | \ddanger But how does \TeX\ decide what sequences of letters are ``words'' 313 | that should be hyphenated? Let's recall that \TeX\ is working on a 314 | horizontal list that contains boxes, glue, rules, ^{ligatures}, ^{kerns}, 315 | discretionaries, marks, whatsits, etc., in addition to simple characters; 316 | somehow it has to pick out things to hyphenate when it is unable to 317 | find suitable breakpoints without hyphenation. The presence of 318 | punctuation marks before and/or after a word should not make a word 319 | unrecognizable or unhyphenatable; neither should the presence of 320 | ligatures and kerns within a word. On the other hand, it is desirable to 321 | do hyphenation quickly, not spending too much time trying to handle 322 | unusual situations that might be hyphenatable but hard to recognize 323 | \hbox{mechanically}. 324 | 325 | \ddanger \TeX\ looks for potentially hyphenatable words by searching 326 | ahead from each glue item that is not in a math formula. The search 327 | bypasses characters whose |\lccode| is zero, or ligatures that begin 328 | with such characters; it also bypasses whatsits and {\sl^{implicit kern}\/} 329 | items, i.e., kerns that were inserted by \TeX\ itself because of information 330 | stored with the font. If the search 331 | finds a character with nonzero |\lccode|, or if it finds a ligature 332 | that begins with such a character, that character is called the 333 | {\sl starting letter}. But if any other type of item occurs before a suitable 334 | starting letter is found, hyphenation is abandoned (until after the next 335 | glue item). Thus, a box or rule or mark, or a kern that was explicitly 336 | inserted by ^|\kern| or~|\/|, must not intervene between glue and a 337 | hyphenatable word. If the starting letter is not lowercase (i.e., 338 | if it doesn't equal its own |\lccode|), hyphenation is abandoned unless 339 | ^|\uchyph| is positive. 340 | 341 | \ddanger If a suitable starting letter is found, let it be in font~$f$. 342 | Hyphenation is abandoned unless the ^|\hyphenchar| of~$f$ is between 343 | 0 and~255, and unless a character of that number exists in the font. 344 | If this test is passed, \TeX\ continues to scan forward 345 | until coming to something that's not one of the following three 346 | ``admissible items'': (1)~a character in font~$f$ whose |\lccode| 347 | is nonzero; (2)~a ligature formed entirely from characters of type~(1); 348 | (3)~an implicit kern. The first inadmissible item terminates this part of 349 | the process; the trial word consists of all the letters found in admissible 350 | items. Notice that all of these letters are in font~$f$. 351 | 352 | \ddanger If a trial word $l_1\ldots l_n$ has been found by this process, 353 | hyphenation will still be abandoned unless $n\ge\lambda+\rho$, where 354 | $\lambda=\max(1,\hbox{|\lefthyphenmin|})$ and 355 | $\rho=\max(1,\hbox{|\righthyphenmin|})$. 356 | ^^|\lefthyphenmin| ^^|\righthyphenmin| 357 | \ (Plain \TeX\ takes $\lambda=2$ and $\rho=3$.) \ Furthermore, the items 358 | immediately following the trial word must consist of zero or more 359 | characters, ligatures, and implicit kerns, followed immediately by 360 | either glue or an explicit kern or a penalty item or a whatsit or an 361 | item of vertical mode material from ^|\mark|, ^|\insert|, or ^|\vadjust|. 362 | Thus, a box or rule or math formula or discretionary following too closely 363 | upon the trial word will inhibit hyphenation. (Since \TeX\ inserts 364 | empty discretionaries after ^{explicit hyphens}, these rules imply that 365 | already-hyphenated compound words will not be further hyphenated by 366 | the algorithm.) 367 | 368 | \ddanger Trial words $l_1\ldots l_n$ that pass all these tests are submitted 369 | to the hyphenation algorithm described earlier. Hyphens are not inserted 370 | before $l_\lambda$ or after $l_{n+1-\rho}$. 371 | If other hyphenation points are found, 372 | one or more discretionary items are inserted in the word; ligatures 373 | and implicit kerns are reconstituted at the same time. 374 | 375 | \ddanger Since ligatures and kerns are treated in quite a general manner, 376 | it's possible that one hyphenation point might preclude another because the 377 | ligatures that occur with hyphenation might overlap the ligatures 378 | that occur without hyphenation. This anomaly probably won't occur in real-life 379 | situations; therefore \TeX's interesting approach to the problem will 380 | not be discussed here. 381 | 382 | \ddanger According to the rules above, there's an important distinction 383 | between implicit and explicit kerns, because \TeX\ recomputes implicit 384 | kerns when it finds at least one hyphen point in a word. You can 385 | see the difference between these two types of kerns when \TeX\ displays 386 | lists of items in its ^{internal format}, if you look closely: 387 | `|\kern2.0|' denotes an implicit kern of $2\pt$, and `|\kern 2.0|' 388 | denotes an explicit kern of the same magnitude. The ^{italic correction} 389 | command~|\/| inserts an explicit kern. 390 | 391 | \ddanger The control sequence ^|\-| is equivalent to 392 | |\discretionary{\char|$\,h$|}{}{}|, where $h$ is the 393 | ^|\hyphenchar| of the current font, provided that $h$ lies 394 | between 0 and~255. Otherwise |\-| is equivalent to 395 | |\discretionary{}{}{}|. 396 | 397 | \ddanger \looseness=-1 398 | So far we have assumed that \TeX\ knows only one style of 399 | hyphenation at a time; but in fact \TeX\ can remember up to 256 400 | distinct sets of rules, if you have enough memory in your computer. An 401 | integer parameter called ^|\language| selects the rules actually used; 402 | every ^|\hyphenation| and ^|\patterns| specification appends new rules 403 | to those previously given for the current value of\/ |\language|. 404 | \ (If\/ |\language| is negative or greater than 255, \TeX\ acts as if 405 | |\language|$\null=0$.) \ All |\patterns| for all languages must be 406 | given before a paragraph is typeset, if |INITEX| is used for 407 | typesetting. 408 | 409 | \ddanger \TeX\ is able to work with several languages in the same 410 | paragraph, because it operates as follows. At the beginning of a 411 | paragraph the ``current language'' is defined to be~0. Whenever a 412 | character is added to the current paragraph (i.e., in unrestricted 413 | horizontal mode), the current language is compared to |\language|; if 414 | they differ, the current language is reset and a whatsit node 415 | specifying the new current language is inserted before the character. 416 | Thus, if you say `|\def\french{\language1...}|' and `|mix| |{\french 417 | franc/ais}| |with| |English|', \TeX\ will put whatsits before the |f| 418 | and the~|w|; hence it will use language~1 rules when hyphenating 419 | |franc/ais|, after which it will revert to language~0. You can insert 420 | the whatsit yourself (even in restricted horizontal mode) by saying 421 | ^|\setlanguage|\; this changes the current language but it 422 | does not change |\language|. Each whatsit records the current 423 | |\lefthyphenmin| and |\righthyphenmin|. 424 | ^^{French} 425 | 426 | \endgroup 427 | \endchapter 428 | 429 | If all problems of hyphenation have not been solved, 430 | at least some progress has been made since that night, 431 | when according to legend, an RCA Marketing Manager received 432 | a phone call from a disturbed customer. His 301 had just hyphenated ``God.'' 433 | \author PAUL E. ^{JUSTUS}, {\sl There's More to Typesetting Than % 434 | Setting Type\/} (1972) 435 | % in {\sl IEEE Transactions on Professional Commun. vol PC-15, pp. 13-15 436 | 437 | \bigskip 438 | 439 | The committee skeptically re- 440 | commended more study for a bill 441 | to require warning labels on rec- 442 | ords with subliminal messages re- 443 | corded backward. 444 | \author THE PENINSULA ^{TIMES TRIBUNE} (April 28, 1982) 445 | 446 | %\eject 447 | \eject\byebye 448 | -------------------------------------------------------------------------------- /appendixJ.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | % \beginchapter Appendix J. Joining the\\\TeX\ Community 6 | \beginchapter Appendix J. 加入社团 7 | 8 | This appendix is about grouping of another kind: \TeX\ users from around the 9 | world have banded together to form the \TeX\ Users Group (TUG), in order 10 | to exchange information about common problems and solutions. 11 | 12 | A newsletter/journal called {\sl TUGboat\/} has been published 13 | since 1980, featuring articles about all aspects of \TeX\ and \MF\null. 14 | ^^{METAFONT} 15 | TUG has a network of ``site coordinators'' who serve as focal points of 16 | communication for people with the same computer configurations. 17 | Occasional short courses are given in order 18 | to provide concentrated training in special topics; videotapes of 19 | these courses are available for rental. 20 | Meetings of the entire TUG membership are held at least once a year. 21 | You can buy \TeX\ T-shirts at these meetings. 22 | 23 | Information about membership in TUG and subscription to {\sl TUGboat\/} 24 | is available from 25 | \begintt 26 | {\obeylines 27 | \TeX\ Users Group 28 | P.O. Box 9506 29 | Providence RI 02940\kern.05em-9506, USA. 30 | } 31 | \endtt 32 | Don't delay, write today! That number again is 33 | 34 | \smallskip 35 | {\obeylines 36 | \TeX\ Users Group 37 | P.O. Box 9506 38 | Providence RI 02940\kern.05em-9506, USA. 39 | } 40 | 41 | 42 | \endchapter 43 | 44 | [The printer] should refuse to employ wandering men, 45 | foreigners who, after having committed some grievous error, 46 | can easily disappear and return to their own country. 47 | \author HIERONYMUS ^{HORNSCHUCH}, '$O\rho\mkern1mu\theta o\mkern1mu % 48 | \tau\upsilon\pi o\gamma\mkern-1mu % 49 | \rho\alpha\phi\acute\iota\alpha\varsigma$ (1608) 50 | 51 | ^^|\upsilon| ^^|\varsigma| 52 | \bigskip 53 | 54 | An author writing an article for publication in TUGboat 55 | is encouraged to create it on a computer file and submit it on magnetic tape. 56 | \author BARBARA ^{BEETON}, {\sl {\tt\bslash title} How to Prepare a File\/% 57 | {\tt\bslash cr}\phantom{\rm\enskip(1981)}\break % 58 | For Publication in TUGboat\/{\tt\bslash cr}} (1981) % TUGboat 2,1 p53 59 | 60 | %\eject 61 | \eject\byebye 62 | -------------------------------------------------------------------------------- /artwork/Chapter1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter1.png -------------------------------------------------------------------------------- /artwork/Chapter10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter10.png -------------------------------------------------------------------------------- /artwork/Chapter11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter11.png -------------------------------------------------------------------------------- /artwork/Chapter12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter12.png -------------------------------------------------------------------------------- /artwork/Chapter13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter13.png -------------------------------------------------------------------------------- /artwork/Chapter14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter14.png -------------------------------------------------------------------------------- /artwork/Chapter15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter15.png -------------------------------------------------------------------------------- /artwork/Chapter16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter16.png -------------------------------------------------------------------------------- /artwork/Chapter17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter17.png -------------------------------------------------------------------------------- /artwork/Chapter18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter18.png -------------------------------------------------------------------------------- /artwork/Chapter19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter19.png -------------------------------------------------------------------------------- /artwork/Chapter2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter2.png -------------------------------------------------------------------------------- /artwork/Chapter20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter20.png -------------------------------------------------------------------------------- /artwork/Chapter21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter21.png -------------------------------------------------------------------------------- /artwork/Chapter22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter22.png -------------------------------------------------------------------------------- /artwork/Chapter23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter23.png -------------------------------------------------------------------------------- /artwork/Chapter24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter24.png -------------------------------------------------------------------------------- /artwork/Chapter25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter25.png -------------------------------------------------------------------------------- /artwork/Chapter26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter26.png -------------------------------------------------------------------------------- /artwork/Chapter27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter27.png -------------------------------------------------------------------------------- /artwork/Chapter3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter3.png -------------------------------------------------------------------------------- /artwork/Chapter4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter4.png -------------------------------------------------------------------------------- /artwork/Chapter5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter5.png -------------------------------------------------------------------------------- /artwork/Chapter6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter6.png -------------------------------------------------------------------------------- /artwork/Chapter7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter7.png -------------------------------------------------------------------------------- /artwork/Chapter8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter8.png -------------------------------------------------------------------------------- /artwork/Chapter9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/Chapter9.png -------------------------------------------------------------------------------- /artwork/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/cover.png -------------------------------------------------------------------------------- /artwork/ctan_lion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/ctan_lion.png -------------------------------------------------------------------------------- /artwork/letter1a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/letter1a.png -------------------------------------------------------------------------------- /artwork/letter1b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/letter1b.png -------------------------------------------------------------------------------- /artwork/letter2a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/letter2a.png -------------------------------------------------------------------------------- /artwork/letter2b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnWall2016/the-texbook-cn/b4efef46ae4cb6a1e3733616be1886fc1ae8ea6a/artwork/letter2b.png -------------------------------------------------------------------------------- /chapter01.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | % \beginchapter Chapter 1. The Name of\\the Game 6 | \beginchapter Chapter 1. 此名有诗意 7 | 8 | \origpageno=1 9 | 10 | %\pageno=1 % This is page number 1, number 1, 11 | %English words like `technology' stem from a Greek root beginning with 12 | %the letters $\tau\epsilon\chi\ldots\,$; and this same Greek word means {\sl 13 | %art\/} as well as technology. Hence the name \TeX, which is an 14 | %uppercase form of $\tau\epsilon\chi$.^^{TeX (actually \TeX), meaning of} 15 | %^^|\tau|^^|\epsilon|^^|\chi| 16 | \pageno=1\1 % This is page number 1, number 1, 17 | 英语单词``technology''来源于以字母 $\tau\epsilon\chi\ldots\,$ 开头的希腊词根;% 18 | 并且这个希腊单词除了 technology 的意思外也有 art 的意思。% 19 | 因此,名称 \TeX\ 是 $\tau\epsilon\chi$ 的大写格式。 20 | 21 | %Insiders pronounce the $\chi$ of \TeX\ as a Greek chi, not as an `x', so that 22 | %\TeX\ rhymes with the word blecchhh. It's the `ch' sound in Scottish words 23 | %like {\sl loch\/} or German words like {\sl ach\/}; it's a Spanish `j' and a 24 | %Russian `kh'. When you say it correctly to your computer, the terminal 25 | %may become slightly moist. 26 | 在发音时,\TeX\ 的 $\chi$ 的发音与希腊的 chi 一样,而不是``x'', % 27 | 所以 \TeX\ 与 blecchhh 押韵。% 28 | ``ch''听起来象苏格兰单词中的 {\sl loch\/} 或者德语单词中的 {\sl ach\/}; % 29 | 它在西班牙语中是``j'', 在俄语中是``kh''。% 30 | 当你对着计算机正确读出时,终端屏幕上可能有点雾。 31 | 32 | %The purpose of this pronunciation exercise is to remind you that \TeX\ is 33 | %primarily concerned with high-quality technical manuscripts: Its emphasis is 34 | %on art and technology, as in the underlying Greek word. If you merely want 35 | %to produce a passably good document---something acceptable and basically 36 | %readable but not really beautiful---a simpler system will usually suffice. 37 | %With \TeX\ the goal is to produce the {\sl finest\/} quality; this requires 38 | %more attention to detail, but you will not find it much harder to go the 39 | %extra distance, and you'll be able to take special pride in the finished 40 | %product. ^^{beauty} % since truth is indexed, ... 41 | 这个发音练习是提醒你,\TeX\ 主要处理的是高质量的专业书稿:% 42 | 它的重点在艺术和专业方面,就象希腊单词的含义一样。% 43 | 如果你仅仅想得到一个过得去——可读下去但不那么漂亮——的文书,% 44 | 那么简单的系统一般就够用了。% 45 | 使用 \TeX\ 的目的是得到{\KT{10}最好的}质量;% 46 | 这就要在细节上花功夫,但是你不会认为它难到哪里去,并且你会为所完成的作品感到% 47 | 特别骄傲。 48 | 49 | %On the other hand, it's important to notice another thing about \TeX's name: 50 | %The `E' is out of kilter. This ^^{logo} 51 | %displaced `E' is a reminder that \TeX\ is about typesetting, and it 52 | %distinguishes \TeX\ from other system names. In fact, ^{TEX} (pronounced 53 | %{\sl tecks\/}) is the admirable {\sl Text EXecutive\/} processor developed by 54 | %^{Honeywell Information Systems}. Since these two system names are 55 | %^^{Bemer, Robert, see TEX, ASCII} 56 | %pronounced quite differently, they should also be spelled differently. The 57 | %correct way to refer to \TeX\ in a computer file, or when using some other 58 | %medium that doesn't allow lowering of the `E', is to type `^|TeX|'. Then 59 | %there will be no confusion with similar names, and people will be 60 | %primed to pronounce everything properly. 61 | 另一方面重要的是要注意到与 \TeX\ 名称有关的另一件事:% 62 | ``E''是错位的。% 63 | 这个偏移``E''的标识提醒人们,\TeX\ 与排版有关,并且把 \TeX\ 从其它系统的名称% 64 | 区别开来。% 65 | 实际上,TEX~(读音为 {\sl tecks\/}) 是 Honeywell Information Systems 的% 66 | 极好的{\sl Text EXecutive\/}处理器。% 67 | 因为这两个系统的名称读音差别很大,所以它们的拼写也不同。% 68 | 在计算机中表明 \TeX\ 文件的正确方法,或者当所用的方式无法降低``E''时,% 69 | 就要写作``TeX''。% 70 | 这样,就与类似的名称不会产生混淆,并且为人们可以正确发音提供了条件。 71 | 72 | %\exercise After you have mastered the material in this book, what will 73 | %you be: a \TeX pert, or a \TeX nician? 74 | %\answer A \TeX nician (underpaid); sometimes also called a \TeX acker. 75 | \exercise 当你已经掌握本书中的知识后,你属于 \TeX\ 专家还是 \TeX\ 爱好者? 76 | \answer \TeX\ 爱好者(酬不抵劳);有时称为 \TeX\ 黑客。 77 | 78 | \endchapter 79 | 80 | They do certainly give 81 | very strange and new-fangled names to diseases. 82 | \author ^{PLATO}, {\sl The Republic}, Book 3 (c.\ 375 B.C.) % 405c 83 | 84 | \bigskip 85 | 86 | Technique! The very word is like the shriek 87 | Of outraged Art. It is the idiot name 88 | Given to effort by those who are too weak, 89 | Too weary, or too dull to play the game. 90 | \author LEONARD ^{BACON}, {\sl Sophia Trenton\/} (1920) % composed at Stanford 91 | 92 | \vfill\eject\byebye 93 | -------------------------------------------------------------------------------- /chapter02.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | % \beginchapter Chapter 2. Book Printing\\versus\\Ordinary Typing 6 | \beginchapter Chapter 2. 书籍排版与普通排版 7 | 8 | \origpageno=3 9 | 10 | %When you first started using a computer terminal, you probably had to adjust 11 | %to the difference between the digit `1' and the lowercase letter `l'. 12 | %When you take the next step to the level of typography that is common in 13 | %book publishing, a few more adjustments of the same kind need to be made; 14 | %your eyes and your fingers need to learn to make a few more distinctions. 15 | \1当你第一次使用计算机终端时,可能不得不校准数字``1''和小写``l''的差别。% 16 | 当你进行到一般书籍出版的排印步骤时,还要做出几个同样的校准;% 17 | 你的眼睛和手指需要知道这几个差别。 18 | 19 | %In the first place, there are two kinds of ^{quotation marks} in books, but 20 | %only one kind on the typewriter. Even your computer terminal, which has 21 | %more characters than an ordinary typewriter, probably has only a 22 | %non-oriented double-quote mark (|"|), because the standard ^{ASCII} code 23 | %for computers was not invented with book publishing in mind. However, your 24 | %terminal probably does have two flavors of single-quote marks, namely |`| 25 | %and |'|; the second of these is useful also as an ^{apostrophe}. 26 | %American keyboards usually contain a left-quote character that shows up 27 | %as something like {\tt\char'22}, and an apostrophe or right-quote that 28 | %looks like {\tt\char'15} or {\tt\char'23}. 29 | 首先,在书中有两种^{引号},但是在打字机上只有一种。 30 | 即使在比普通打字机的字符更多的计算机键盘上,也可能只有一种无方向的双引号(|"|), 31 | 因为计算机的标准 ^{ASCII} 码不是专门为书籍出版而发明的。 32 | 但是,你的计算机可能确实有两种不同的单引号,即 |`| 和 |'| ; 33 | 第二个也用作缩写号【译注:比如 |don't| 】。 34 | 美国键盘包含一个看起来象 {\tt\char'22} 的左引号, 35 | 和一个看起来象 {\tt\char'15} 或 {\tt\char'23} 的缩写号或右引号。 36 | 37 | %To produce double-quote marks with \TeX, you simply type two single-quote marks 38 | %of the appropriate kind. For example, to get the phrase 39 | %\begindisplay 40 | %``I understand.'' 41 | %\enddisplay 42 | %(including the quotation marks) you should type 43 | %\begintt 44 | %``I understand.'' 45 | %\endtt 46 | %to your computer. 47 | 为了用 \TeX\ 得到双引号,可直接键入两个相应类型的单引号。% 48 | 比如,为了得到习惯用语 49 | \begindisplay 50 | ``I understand.'' 51 | \enddisplay 52 | (包括双引号), 应该在计算机中键入 53 | \begintt 54 | ``I understand.'' 55 | \endtt 56 | 57 | %A typewriter-like style of type will be used throughout this manual to indicate 58 | %\TeX\ constructions that you might type on your terminal, so that the 59 | %symbols actually typed are readily distinguishable from the output \TeX\ would 60 | %produce and from the comments in the manual itself. Here are the symbols to be 61 | %used in the examples: 62 | %\begintt 63 | %ABCDEFGHIJKLMNOPQRSTUVWXYZ 64 | %abcdefghijklmnopqrstuvwxyz 65 | %0123456789"#$%&@*+-=,.:;?! 66 | %()<>[]{}`'\||/_^~ 67 | %\endtt 68 | %If your computer terminal doesn't happen to have all of these, don't 69 | %despair; \TeX\ can make~do with the ones you have. An additional symbol 70 | %\begindisplay 71 | %\] 72 | %\enddisplay 73 | %is used to stand for a {\sl ^{blank space}}, in case it is important 74 | %to emphasize that a blank space is being typed; thus, what you {\sl 75 | %really\/} type in the example above is 76 | %\begintt 77 | %``I|]understand.'' 78 | %\endtt 79 | %Without such a symbol you would have 80 | %difficulty seeing the invisible parts of certain constructions. But we 81 | %won't be using `\]' very often, because spaces are usually visible enough. 82 | 类似打字机风格将在本手册通篇使用,以显示可在你的终端上键入的 \TeX\ 的用词,% 83 | 使得实际键入的符号容易从 \TeX\ 产生的输出和手册自身的注解区分开。% 84 | 下面是在例子中要用到的符号: 85 | \begintt 86 | ABCDEFGHIJKLMNOPQRSTUVWXYZ 87 | abcdefghijklmnopqrstuvwxyz 88 | 0123456789"#$%&@*+-=,.:;?! 89 | ()<>[]{}`'\||/_^~ 90 | \endtt 91 | 如果你的计算机终端凑巧不能包含所有这些字符,别失望;% 92 | \TeX\ 可设法应付它。% 93 | 另外一个符号 94 | \begindisplay 95 | \] 96 | \enddisplay 97 | 用来表示一个 {\sl {blank space}}~(空格)——如果要重点强调所键入的空格;% 98 | 因此,你{\KT{10}真正}要在上面的例子中键入的是 99 | \begintt 100 | ``I|]understand.'' 101 | \endtt 102 | 如果没有这样的符号,就很难知道某些用词的看不见的部分。% 103 | 但是我们不会太频繁使用``\]'', 因为空格一般足以被看见。 104 | 105 | %Book printing differs significantly from ordinary typing with respect to 106 | %^{dashes}, ^{hyphens}, and ^{minus signs}. In good math books, 107 | %these symbols are all different; in fact there usually are at least four 108 | %different symbols: 109 | %\begindisplay 110 | %a hyphen (-);\cr 111 | %an en-dash (--);\cr 112 | %an em-dash (---);\cr 113 | %a minus sign ($-$).\cr 114 | %\enddisplay 115 | %Hyphens are used for compound words like `daughter-in-law' and `X-rated'. 116 | %^{En-dash}es are used for number ranges like `pages 13--34', and also in 117 | %contexts like `exercise 1.2.6--52'. ^{Em-dash}es are used for punctuation in 118 | %sentences---they are what we often call simply dashes. And minus signs are 119 | %used in formulas. A conscientious user of \TeX\ will be careful to distinguish 120 | %these four usages, and here is how to do it: 121 | %\begindisplay 122 | %for a hyphen, type a hyphen (|-|);\cr 123 | %for an en-dash, type two hyphens (|--|);\cr 124 | %for an em-dash, type three hyphens (|---|);\cr 125 | %for a minus sign, type a hyphen in mathematics mode (|$-$|).\cr 126 | %\enddisplay 127 | %(Mathematics mode occurs between dollar signs; it is discussed later, so you 128 | %needn't worry about it now.) 129 | \1书籍排版和普通排版在横线号、连字符和减号方面明显不同。 130 | 在优秀的数学书籍中,这些符号都是不同的;实际上,一般至少有四种不同的符号: 131 | \begindisplay 132 | 连字符 (-);\cr 133 | 连接号 (--);\cr 134 | 破折号 (---);\cr 135 | 减号 ($-$).\cr 136 | \enddisplay 137 | 连字符用在像 ``daughter-in-law'' 和 ``X-rated'' 这样的复合单词中。 138 | 连接号用在像 ``pages 13--34'' 以及像本书中 ``exercise 1.2.6--52'' 139 | 这样的数字区间方面。 140 | 破折号用作句子中的标点——就是我们通常所称的简单横线号。 141 | 而减号用在公式中。 142 | 原则性强的 \TeX\ 用户要仔细区分这四种用法,说明如下: 143 | \begindisplay 144 | 对连字符,键入一个连字符 (|-|);\cr 145 | 对连接号,键入两个连字符 (|--|);\cr 146 | 对破折号,键入三个连字符 (|---|);\cr 147 | 对减号,把连字符放在数学模式中 (|$-$|)。\cr 148 | \enddisplay 149 | (数学模式出现在美元符号之间;这将在后面讨论,因此你现在不必考虑它。) 150 | 151 | %\exercise Explain how to type the following sentence to \TeX: Alice said, 152 | %``I always use an en-dash instead of a hyphen when specifying page numbers 153 | %like `480--491' in a ^{bibliography}.'' 154 | %\answer |Alice said, ``I always use an en-dash instead of a hyphen when|\break 155 | %|specifying page numbers like `480--491' in a bibliography.''| \ 156 | %(The wrong answer to this question ends with |'480-49l' in a bibliography."|) 157 | \exercise 看看怎样在 \TeX\ 中键入下列句子: 158 | Alice said, 159 | ``I always use an en-dash instead of a hyphen when specifying page numbers 160 | like `480--491' in a bibliography.'' 161 | \answer |Alice said, ``I always use an en-dash instead of a hyphen when|\break 162 | |specifying page numbers like `480--491' in a bibliography.''|% 163 | (这个问题的容易犯错误的是在结尾处键入了 |'480-49l' in a bibliography."|) 164 | 165 | %\exercise What do you think happens when you type four hyphens in a row? 166 | %\answer You get em-dash and hyphen (----), which looks awful. 167 | \exercise 当你在一行中连续键入四个连字符时,会得到什么结果? 168 | \answer 你会得到一个破折号和一个连字符(----),看起来很丑吧。 169 | \smallskip 170 | 171 | %If you look closely at most well-printed books, you will find that certain 172 | %combinations of letters are treated as a unit. For example, this is true 173 | %of the `f' and the `i' of `find'. Such combinations are called {\sl 174 | %^{ligatures}}, and professional typesetters have traditionally been 175 | %trained to watch for letter combinations such as |ff|, |fi|, |fl|, |ffi|, and 176 | %|ffl|. \ (The reason is that words like `f{}ind' don't look very good in 177 | %most styles of type unless a ligature is substituted for the letters that 178 | %clash. It's somewhat surprising how often the traditional ligatures appear 179 | %in English; other combinations are important in other languages.) 180 | 如果你仔细查看大多数排版精良的书籍,就会发现某些字母组合会当成一个字母来处理。 181 | 例如,``find'' 中的 ``f' 和 ``i'' 就是这样。 182 | 这样的组合称为{\sl 连写}(ligature),而专业排版工通常会经过培训以留意诸如 183 | |ff|、|fi|、|fl|、|ffi| 和 |ffl| 的字母组合。(原因是像 ``f{}ind'' 184 | 这样的单词在大多数排版风格上不太好看,除非用连写代替这些冲突的字母。 185 | 有点令人惊讶的是,传统的连写在英语中经常出现;其他组合在其他语言中很重要。 186 | 187 | %\exercise Think of an English word that contains two ligatures. 188 | %\answer fluffier firefly fisticuffs, flagstaff fireproofing, 189 | %chiffchaff and riffraff. 190 | \exercise 给出一个包含两个连写的英语单词。 191 | \answer fluffier firefly fisticuffs,flagstaff fireproofing, 192 | chiffchaff and riffraff。 193 | \smallskip 194 | 195 | %The good news is that you do 196 | %{\sl not\/} have to concern yourself with ligatures: \TeX\ is perfectly 197 | %capable of handling such things by itself, using the 198 | %same mechanism that converts `|--|' into `--'. In fact, \TeX\ will also look 199 | %for combinations of adjacent letters (like `|A|' next to `|V|'\thinspace) 200 | %that ought to be moved closer together for better appearance; this is 201 | %called {\sl ^{kerning}}. 202 | 还好,你{\KT{10}不必}管这些连写:\TeX\ 完全有能力自己解决这些问题, 203 | 方法同把 ``|--|'' 转换成 ``--'' 一样。实际上,为了得到更好的观感, 204 | \TeX\ 还把应当更接近的相邻字母(象紧跟 ``|V|'' 的 ``|A|'')看作组合; 205 | 这称为{\KT{10}字距调整}。 206 | 207 | %\medbreak 208 | %To summarize this chapter: When using \TeX\ for straight copy, you type 209 | %the copy as on an ordinary typewriter, except that you need to be careful 210 | %about quotation marks, the number 1, and various kinds of hyphens/dashes. 211 | %\TeX\ will automatically take care of other niceties like ligatures and 212 | %kerning. 213 | \medbreak 214 | \1总结:当用 \TeX\ 直接排版时,就像在普通打字机上键入书稿一样, 215 | 但是需要注意引号,数字 1 和各种连字符/破折号。 216 | 其它诸如连写和字距调整这样的精细调整由 \TeX\ 自动完成。 217 | 218 | %\danger (Are you sure you should be reading this paragraph? The 219 | %``^{dangerous bend}'' sign here is meant to warn you about material that 220 | %ought to be skipped on first reading. And maybe also on second reading. 221 | %The reader-beware paragraphs sometimes refer to concepts that aren't 222 | %explained until later chapters.) 223 | \danger (你准备好看本段了吗?% 224 | 这里的``危险''标志就是提醒你,这些材料应当在首次阅读时跳过\hbox{去。}% 225 | 可能已经是第二遍了吧。% 226 | 提醒读者的这些段落有时用到了后面章节中的概念。) 227 | 228 | %\danger If your keyboard does not contain a left-quote symbol, you can 229 | %type ^|\lq|, followed by a space if the next character is a letter, or 230 | %followed by a |\| if the next character is a space. Similarly, ^|\rq| 231 | %yields a right-quote character. Is that clear? 232 | %\begintt 233 | %\lq\lq|]I|]understand.\rq\rq\|] 234 | %\endtt 235 | \danger 如果你的键盘没有左引号符号,那么你可以键入 |\lq|, 如果下一个字符是字母,% 236 | 就应该紧接一个空格,如果下一个字符是空格,就应该紧接一个 |\|。% 237 | 类似地,|\rq| 得到一个右引号字符。清楚了吗? 238 | \begintt 239 | \lq\lq|]I|]understand.\rq\rq\|] 240 | \endtt 241 | 242 | %\danger In case you need to type ^{quotes within quotes}, for example a 243 | %single quote followed by a double quote, you can't simply type 244 | %\thinspace|'''|\thinspace\ because \TeX\ will interpret this as ''' 245 | %(namely, double quote followed by single quote). If you have already read 246 | %Chapter~5, you might expect that the solution will be to use 247 | %grouping---namely, to type something like \thinspace|{'}''|. But it turns 248 | %out that this doesn't produce the desired result, because there is usually 249 | %less space following a single right quote than there is following a double 250 | %right quote: What you get is {'}'', which is indeed a single quote 251 | %followed by a double quote (if you look at it closely enough), but it 252 | %looks almost like three equally spaced single quotes. On the other hand, 253 | %you certainly won't want to type \thinspace|'|\]|''|, because that space 254 | %is much too large---it's just as large as the space between words---and 255 | %\TeX\ might even start a new line at such a space when making up a 256 | %paragraph! The solution is to type \thinspace|'\thinspace''|, which 257 | %produces '\thinspace'' as desired.^^|\thinspace| 258 | \danger 如果你想键入引号中的引号,比如右单引号后跟一个右双引号, 259 | 那么你不能直接键入 |'''|, 因为 \TeX\ 将把它看成 '''(即右双引号后面跟右单引号)。% 260 | 如果你已经看过第5章,可能认为解决之道是采用编组——即键入所谓的 |{'}''|。% 261 | 但是,却得不到想看到的结果,因为单右引号后面的间距比双右引号后面的要小: 262 | 得到的是 {'}'', 这的确是一个单引号后面跟一个双引号(如果你仔细观察的话), 263 | 但是看起来却几乎是三个一样的单引号。% 264 | 另一方面,当然也不要键入 |'|\]|''|, 否则间距太大——就象单词之间的空格那么大, 265 | 并且当 \TeX\ 在生成段落时会在这样的空格处断行! 266 | 解决的方法是键入 |'\thinspace''|, 就得到所要的 '\thinspace'' 了。 267 | 268 | %\dangerexercise OK, now you know how to produce ''' and '\thinspace''; 269 | %how do you get ``\thinspace` and `{}``\thinspace? 270 | %\answer |``\thinspace`|; and either |`{}``| or |{`}``| or something similar. 271 | %Reason: There's usually less space {\sl preceding\/} a single left quote than 272 | %there is preceding a double left quote. \ (Left and right are opposites.) 273 | \dangerexercise 好了,现在你知道怎样得到 ''' 和 '\thinspace'' 了; 274 | 那么你怎样得到 ``\thinspace` 和 `{}``\thinspace 呢? 275 | \answer |``\thinspace`|,以及 |`{}``| 或 |{`}``| 或其他类似写法。 276 | 原因是:通常在左单引号{\sl 之前}的空白比在左双引号之前的要小。% 277 | (左引号和和右引号的情形相反。) 278 | 279 | %\dangerexercise Why do you think the author introduced the control 280 | %sequence |\thinspace| to solve the adjacent-quotes problem, instead of 281 | %recommending the trickier construction |'$|^|\,||$''| (which also works)? 282 | %\answer Eliminating ^|\thinspace| would mean that a user need not learn 283 | %the term; but it is not advisable to minimize terminology by ``overloading'' 284 | %math mode with tricky constructions. For example, a user who wishes to 285 | %take advantage of \TeX's ^|\mathsurround| feature would be thwarted by 286 | %non-mathematical uses of dollar signs. \ (Incidentally, neither |\thinspace| 287 | %nor ^|\,| are built into \TeX; both are defined in terms of more 288 | %primitive features, in Appendix~B.) 289 | \dangerexercise 想一下作者为什么用控制系列|\thinspace|来解决相邻引号问题而% 290 | 不是用更巧妙的 |'$|^|\,||$''|~(它也可以胜任)? 291 | \answer 剔除 ^|\thinspace| 意味着用户无需学习该术语; 292 | 但是为让术语最少而过多使用数学模式的巧妙构造是不可取的。 293 | 举个例子,当用户希望使用 \TeX\ 的 ^|\mathsurround| 特性时, 294 | 在非数学情形中使用的 |$| 将给他造成障碍。% 295 | (顺带说一下,|\thinspace| 和 ^|\,| 都不是 \TeX\ 内置的, 296 | 这两者都是用更原始的特性定义的,见附录 B 。) 297 | 298 | \endchapter 299 | 300 | In modern Wit all printed Trash, is 301 | Set off with num'rous\/ {\rm Breaks}\raise.5ex\vbox{\hrule width 2em}% 302 | and\/ {\rm Dashes}\raise.5ex\vbox{\hrule width 1em} 303 | % no period after the em-dash: stet! 304 | % Sir Walter Scott ruined this quote in his edition of Swift! 305 | \author JONATHAN ^{SWIFT}, {\sl On Poetry: A Rapsody\/} (1733) % lines 93--94 306 | % Rapsody: stet! 307 | 308 | \bigskip 309 | 310 | Some compositors still object to work 311 | in offices where type-composing machines are introduced. 312 | \author WILLIAM STANLEY ^{JEVONS}, {\sl Political Economy\/} (1878) % sec 55 313 | % "They are all afraid that if the work is done too easily and rapidly, 314 | % they will not be wanted to do it." 315 | % Jevons goes on to say that justifying and page makeup can't be done 316 | % profitably by machines, so the employees needn't fear losing their jobs. 317 | 318 | \vfill\eject\byebye 319 | -------------------------------------------------------------------------------- /chapter03.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | % \beginchapter Chapter 3. Controlling\\\TeX 6 | \beginchapter Chapter 3. 控制系列 7 | 8 | \origpageno=7 9 | 10 | %Your keyboard has very few keys compared to the large number of symbols that you 11 | %may want to specify. In order to make a limited keyboard sufficiently versatile, 12 | %one of the characters that you can type is reserved for special use, and 13 | %it is called the {\sl ^{escape character}}. Whenever you want to type 14 | %something that controls the format of your manuscript, or something that 15 | %doesn't use the keyboard in the ordinary way, you should type the escape 16 | %character followed by an indication of what you want to do. 17 | \1你的键盘所含的字符与所期望得到的符号相比太少了。% 18 | 为了充分利用有限的键盘,你可以键入的某个字符被保留为特殊用途,即所谓% 19 | 的转义符(escape cha\-racter)。% 20 | 只要你要键入控制文稿格式的信息或不能直接使用键盘的内容, 21 | 就应该键入转义符,再在后面跟上对应的指令。 22 | 23 | %Note: Some computer terminals have a key marked `|ESC|', but that is {\sl not\/} 24 | %your escape character! It is a key that sends a special message to the operating 25 | %system, so don't confuse it with what this manual calls ``escape.'' 26 | 注意:有些计算机终端上有一个标记为`|ESC|'的键, 27 | 但不是你的转义符! 28 | 它是一个向操作系统发送特殊指令的键,所以不要把它与本手册的``转义(escape)''混淆。 29 | 30 | %\TeX\ allows any character to be used for escapes, but the ``^{backslash}'' 31 | %character `|\|' is usually adopted for this purpose, since backslashes are 32 | %reasonably convenient to type and they are rarely needed in ordinary text. 33 | %Things work out best when different \TeX\ users do things consistently, 34 | %so we shall escape via backslashes in all the examples of this manual. 35 | \TeX\ 允许使用任何字符作为转义符,但是一般采用反斜线字符`|\|', 36 | 因为反斜线较方便键入且在一般文本中很少使用。% 37 | 当不同的 \TeX\ 用户统一规则时,做事就最有效, 38 | 所以我们将在本手册的所有例子中使用反斜线字符作为转义符。 39 | 40 | %Immediately after typing `|\|' (i.e., immediately after an escape 41 | %character) you type a coded command telling \TeX\ what you have in mind. 42 | %Such commands are called {\sl ^{control sequences}}. For example, you might type 43 | %^^{markup commands, see control sequences} 44 | %\begintt 45 | %\input MS 46 | %\endtt 47 | %which (as we will see later) causes \TeX\ to begin reading a file called 48 | %`|MS.tex|'; the string of characters `^|\input|' is a control sequence. 49 | %Here's another example: 50 | %\begintt 51 | %George P\'olya and Gabor Szeg\"o. 52 | %\endtt 53 | %% sic; this is the spelling used in opening pages of their famous books 54 | %% but I give the Hungarian spellings in the index 55 | %\TeX\ converts this to `George P\'olya and Gabor Szeg\"o.' There are two 56 | %^^{Polya}^^{Szego}^^{acute}^^{umlaut} 57 | %control sequences, ^|\'| and ^|\"|, here; these control sequences 58 | %have been used to place ^{accents} over some of the letters. 59 | 键入`|\|'后,紧接(即在转义符后面紧接)着键入一个代码命令来告诉 \TeX\ 你的想法。% 60 | 这样的命令称为{\KT{10}控制系列}。% 61 | 例如,你可以键入 62 | \begintt 63 | \input MS 64 | \endtt 65 | (就象我们后面将讲述的那样)它让 \TeX\ 开始读入名字为`|MS.tex|'的文件; 66 | 字符串 `|\input|'是一个控制系列。% 67 | 另一个例子是 68 | \begintt 69 | George P\'olya and Gabor Szeg\"o. 70 | \endtt 71 | \TeX\ 把它转换为`George P\'olya and Gabor Szeg\"o.'。 72 | 这里有两个控制系列,|\'| 和 |\"|; 73 | 这些控制系列用来把重音号放在字母上。 74 | 75 | %Control sequences come in two flavors. The first kind, like |\input|, 76 | %is called a {\sl^{control word}\/}; it 77 | %consists of an escape character followed by one or more {\sl letters}, followed 78 | %by a space or by something besides a letter. \ (\TeX\ has to know where the 79 | %control sequence ends, so you must put a space after a control word if 80 | %the next character is a letter. For example, if you type `|\inputMS|', 81 | %\TeX\ will naturally interpret this as a control word with seven 82 | %letters.) \ In case you're wondering what a ``^{letter}'' is, the answer 83 | %is that \TeX\ normally regards the 52 symbols |A...Z| and |a...z| as 84 | %letters. The digits |0...9| are {\sl not\/} considered to be 85 | %letters, so they don't appear in control sequences of the first kind. 86 | 控制系列有两种类型。% 87 | 第一类象|\input|一样,称为{\KT{10}控制词}; 88 | 它由转义符后跟一个或多个{\KT{10}字母}组成,后面跟一个空格或非字母的字符。% 89 | (\TeX\ 必须知道控制系列何时结束,因此,如果下一个字符是字母,你必须在控制词后% 90 | 加一空格。% 91 | 例如,如果你键入`|\inputMS|', \TeX\ 将认为它是一个7个字母组成的控制词。) 92 | 要是对``字母''有疑问,答案就是,\TeX\ 一般把52个字母 |A...Z| 和 |a...z| 看作字母。% 93 | 数字 |0...9| 不被看作字母,所以不能出现在第一类控制系列中。 94 | 95 | %A control sequence of the other kind, like |\'|, is called a {\sl 96 | %^{control symbol}\/}; it consists of the escape 97 | %character followed by a single {\sl nonletter}. In this case you don't 98 | %need a space to separate the control sequence from a letter that follows, 99 | %since control sequences of the second kind always have exactly one 100 | %symbol after the escape character. 101 | 另一类控制系列,象 |\'| 一样,被称为{\KT{10}控制符号}; 102 | 它由转义符后跟一个单个{\KT{10}非字母}组成。% 103 | 在这种情况下,你不必用空格把控制系列与其后的字母分开, 104 | 因为第二类控制系列在转义符后永远只有一个符号。 105 | 106 | %\exercise What are the control sequences in `|\I'm \exercise3.1\\!|'\thinspace? 107 | %\answer |\I|, |\exercise|, and |\\|. (The last of these is of type~2, i.e., 108 | %a control symbol, since the second backslash is not a letter; the first 109 | %backslash keeps the second one from starting its own control sequence.) 110 | \exercise 在`|\I'm \exercise3.1\\!|'中,控制系列有哪些? 111 | \answer |\I|、|\exercise| 和 |\\| 。(最后一个属于第二种,即控制符号, 112 | 因为第二个反斜线不是一个字母;第一个反斜线阻止第二个反斜线开始自己的控制系列。) 113 | 114 | %\exercise We've seen that the input |P\'olya| yields `P\'olya'. Can 115 | %you guess how the French words `math\'ematique' and `centim\`etre' 116 | %should be specified? 117 | %\answer |math\'ematique| and |centim\`etre|.^^|\'|^^|\`| 118 | \exercise \1我们已经知道键入 |P\'olya| 就得到`P\'olya'。% 119 | 你猜出来法语单词`math\'ematique' 和`centim\`etre'怎样键入吗? 120 | \answer |math\'ematique| 和 |centim\`etre| 。^^|\'|^^|\`| 121 | 122 | %When a space comes after a control word (an all-letter control 123 | %sequence), it is ignored by 124 | %\TeX; i.e., it is not considered to be a ``real'' space belonging to the 125 | %manuscript that is being typeset. But when a space comes after a control 126 | %symbol, it's truly a space. 127 | 当空格出现在控制词(一个完全由字母组成的控制系列)后面时, 128 | 它被 \TeX\ 所忽略;即,它不会被看作属于所排版文稿的``实际''空格。% 129 | 但是,当空格出现在控制符号后面时,它就是一个实际空格。 130 | 131 | %Now the question arises, what do you do if you actually {\sl want\/} a 132 | %space to appear after a control word? We will see later that \TeX\ 133 | %treats two or more consecutive spaces as a single ^{space}, so the answer 134 | %is {\sl not\/} going to be ``type two spaces.'' The correct answer is to 135 | %type ``control space,'' ^^|\ | namely 136 | %\begintt 137 | %\|] 138 | %\endtt 139 | %(the escape character followed by a blank space); \TeX\ will treat this as 140 | %a space that is not to be ignored. Notice that |\|\] is a control 141 | %sequence of the second kind, namely a control symbol, since there is a 142 | %single nonletter (\]) following the escape character. Two consecutive 143 | %spaces are considered to be equivalent to a single space, so further 144 | %spaces immediately following |\|\] will be ignored. But if you want to 145 | %enter, say, three consecutive spaces into a manuscript you can type 146 | %`|\|\]|\|\]|\|\]'. Incidentally, typists are often taught to put two 147 | %spaces at the ends of sentences; but we will see later that \TeX\ has its 148 | %own way to produce extra space in such cases. Thus you needn't be 149 | %consistent in the number of spaces you type. 150 | 现在,出现问题了,如果真要在控制词后面得到一个空格该怎样做呢? 151 | 后面我们会看到,\TeX\ 把两个或多个连续空格看作单个空格, 152 | 所以``键入两个空格''不解决问题。 153 | 正确的方法是键入``控制空格'', 即 154 | \begintt 155 | \|] 156 | \endtt 157 | (转义符后面跟一个空格); 158 | \TeX\ 将把它看作不能忽略的空格。% 159 | 注意,控制空格是第二类控制系列,即控制符号,因为跟在转义符后面的是一个单个非字母(\])。% 160 | 两个连续空格被看作等价于单个空格,所以跟在 |\|\] 后的多余的空格将被忽略。% 161 | 但是,如果你要在文稿中键入3个连续空格,就应该键入`|\|\]|\|\]|\|\]'。% 162 | 顺便说一下,打字员通常在句子后面要键入两个空格; 163 | 但是以后我们将知道,在这种情况下,\TeX\ 用自己的方式来得到额外的间距。 164 | 因此,你不需在意所键入的空格数目的一致性。 165 | 166 | %\danger Nonprinting control characters like \ might follow 167 | %an escape character, and these lead to distinct control sequences according 168 | %to the rules. \TeX\ is initially set up to treat |\|\ and 169 | %|\|\ ^^|\|^^|\| 170 | %the same as |\|\] (control space); these special control sequences 171 | %should probably not be redefined, because you can't see the difference 172 | %between them when you look at them in a file. 173 | %^^{carriage-return, see } 174 | \danger 象 \ 这样不能显示出来的控制符也可以跟在转义符后面, 175 | 并且按照上面的规则,它们是一些独特的控制系列。% 176 | \TeX\ 从开始就把 |\|\ 和 |\|\ 看作同 |\|\]~(控制空格)一样; 177 | 这些特殊的控制系列不可能重新被定义,因为在文件中无法区分它们。 178 | 179 | %It is usually unnecessary for you to use ``control space,'' since control 180 | %sequences aren't often needed at the ends of words. But here's an example 181 | %that might shed some light on the matter: This manual itself has been 182 | %typeset by \TeX, and one of the things that occurs fairly often is the 183 | %tricky ^{logo} `\TeX', which requires backspacing and lowering the E. 184 | %There's a special control word 185 | %\begintt 186 | %\TeX 187 | %\endtt 188 | %that produces the half-dozen or so instructions necessary to typeset `\TeX'. 189 | %When a phrase like `\TeX\ ignores spaces after control words.' is 190 | %desired, the manuscript renders it as follows: 191 | %\begintt 192 | %\TeX\ ignores spaces after control words. 193 | %\endtt 194 | %Notice the extra |\| following ^|\TeX|; this produces the control space 195 | %that is necessary because \TeX\ ignores spaces after control words. 196 | %Without this extra |\|, the result would have been 197 | %\begindisplay 198 | %\TeX ignores spaces after control words. 199 | %\enddisplay 200 | %On the other hand, you can't simply put |\| after |\TeX| in all contexts. 201 | %For example, consider the phrase 202 | %\begintt 203 | %the logo `\TeX'. 204 | %\endtt 205 | %In this case an extra backslash doesn't work at all; in fact, 206 | %you get a curious result if you type 207 | %\begintt 208 | %the logo `\TeX\'. 209 | %\endtt 210 | %Can you guess what happens? \ Answer: The |\'| is a control sequence denoting 211 | %an acute accent, as in our |P\'olya| example above; the effect is 212 | %therefore to put an accent over the next nonblank character, 213 | %which happens to be a period. In other words, you get an accented 214 | %period, and the result is 215 | %\begindisplay 216 | %the logo `\TeX\'. 217 | %\enddisplay 218 | %Computers are good at following instructions, but not at reading your mind. 219 | 对你而言,通常不需要使用``控制空格'', 220 | 因为控制系列不经常出现在单词的尾部。% 221 | 但是,这里有一个这方面的典型例子: 222 | 本手册本身是用 \TeX\ 排版的,并且相当频繁出现的一个东西就是乖巧的`\TeX', 223 | 它要求回退间距和降低 E。% 224 | 这是一个特殊的控制词 225 | \begintt 226 | \TeX 227 | \endtt 228 | 为了排版`\TeX', 它使用了大概半打的指令。% 229 | 当要排版出`\TeX\ ignores spaces after control words.'\allowbreak 这样的语句时, 230 | 所键入的文稿如下: 231 | \begintt 232 | \TeX\ ignores spaces after control words. 233 | \endtt 234 | 注意,\TeX\ 后面有一个额外的 |\|; 因为 \TeX\ 忽略掉了控制词后面的空格, 235 | 所以它生成了必需的控制空格。% 236 | 如果没有这个额外的 |\|, 结果就是 237 | \begindisplay 238 | \TeX ignores spaces after control words. 239 | \enddisplay 240 | \1另外,不能在任何情况下都在 \TeX\ 后面直接跟一个 |\|。% 241 | 比如,考虑一下下列语句 242 | \begintt 243 | the logo `\TeX'. 244 | \endtt 245 | 在这种情况下,额外的 |\| 根本就不对; 246 | 实际上,如果你键入 247 | \begintt 248 | the logo `\TeX\'. 249 | \endtt 250 | 就会得到稀奇古怪的结果。 251 | 你知道得到什么吗? 252 | 答案是:|\'| 是重音符的控制系列,就象上面例子中的 |P\'olya| 一样; 253 | 因此结果是在下一个非空白的字符——凑巧是句点——上面加重音。% 254 | 换句话说,你得到一个带重音的句点,排版结果是 255 | \begindisplay 256 | the logo `\TeX\'. 257 | \enddisplay 258 | 计算机正确地执行了后面的指令,但没有正确表达你的意思。 259 | 260 | %\TeX\ understands about 900 control sequences as part of its built-in 261 | %vocabulary, and all of them are explained in this manual somewhere. But 262 | %you needn't worry about learning so many different things, because you won't 263 | %really be needing very many of them unless you are faced with unusually 264 | %complicated copy. Furthermore, the ones you do need to learn actually fall into 265 | %relatively few categories, so they can be assimilated without great difficulty. 266 | %For example, many of the control sequences are simply the names of special 267 | %characters used in math formulas; you type `^|\pi|'~to get~`$\pi$', 268 | %`^|\Pi|'~to get~`$\Pi$', 269 | %`^|\aleph|'~to get~`$\aleph$', 270 | %`^|\infty|'~to get~`$\infty$', 271 | %`^|\le|'~to get~`$\le$', 272 | %`^|\ge|'~to get~`$\ge$', 273 | %`^|\ne|'~to get~`$\ne$', 274 | %`^|\oplus|'~to get~`$\oplus$', 275 | %`^|\otimes|'~to get~`$\otimes$'. 276 | %Appendix~F contains several tables of such symbols. 277 | \TeX\ 能执行大约 900 个控制系列,这是它的内置语汇的一部分, 278 | 所有这些控制系列都阐述在本手册的某个地方。% 279 | 但是别为要掌握这么多不同的内容而担心,因为只要不是对付不常用的复杂排版, 280 | 你是不需要掌握很多控制系列的。% 281 | 再者,你需要实际掌握的那些只在相对少的几个种类\hbox{中,} 所以它们不太难理解。% 282 | 例如,许多控制系列就是数学公式中特殊字符的名字; 283 | 键入`|\pi|'就得到 $\pi$, 284 | `|\Pi|' 得到 `$\Pi$', 285 | `|\aleph|' 得到 `$\aleph$', 286 | `|\infty|' 得到 `$\infty$', 287 | `|\le|' 得到 `$\le$', 288 | `|\ge|' 得到 `$\ge$', 289 | `|\ne|' 得到 `$\ne$', 290 | `|\oplus|' 得到 `$\oplus$', 291 | `|\otimes|' 得到 `$\otimes$'。% 292 | 附录 F 包含了这类符号的几个列表。 293 | 294 | %\danger There's no built-in relationship between ^{uppercase} and ^{lowercase} 295 | %letters in control sequence names. For example, `|\pi|' and `|\Pi|' 296 | %and `|\PI|' and `|\pI|' are four different control words. 297 | \danger 在控制系列的名称中,大写和小写字母之间没有内在的等价关系。% 298 | 例如,`|\pi|', `|\Pi|, `|\PI|' 和 `|\pI|' 是四个不同的控制词。 299 | 300 | %The 900 or so control sequences that were just mentioned actually aren't 301 | %the whole story, because it's easy to define more. For example, if you 302 | %want to substitute your own favorite names for math symbols, so that you 303 | %can remember them better, you're free to go right ahead and do it; 304 | %Chapter~20 explains how. 305 | 刚刚提到的大约 900 个控制系列并不是全部,因为可以容易地定义更多的控制系列。% 306 | 例如,如果你想用自己喜欢的名字来定义数学符号,那么就更好记住它们, 307 | 你可以随心所欲地命名它们; 308 | 第 20 章告诉你这方面的内容。 309 | 310 | %About 300 of \TeX's control sequences are called {\sl ^{primitive}\/}; these 311 | %are the low-level atomic operations that are not decomposable into simpler 312 | %functions. All other control sequences are defined, ultimately, in terms 313 | %of the primitive ones. For example, ^|\input| is a primitive operation, 314 | %but ^|\'| and ^|\"| are not; the latter are defined in terms of an 315 | %^|\accent| primitive. 316 | 大约 300 个控制系列称为{\KT{10}原始控制系列}; 317 | 它们是不能分解为更简单作用的低级控制系列。% 318 | 所有其它控制系列归根结底都由这些原始控制系列来定义。% 319 | 例如,|\input| 是原始控制系列,|\'| 和 |\"| 却不是; 320 | 后者用原始控制系列 |\accent| 来定义。 321 | 322 | %People hardly ever use \TeX's primitive control sequences in their 323 | %manuscripts, because the primitives are $\ldots$ well $\ldots$ so 324 | %{\sl primitive}. You have to type a lot of instructions when you are 325 | %trying to make \TeX\ do low-level things; this takes time and invites 326 | %mistakes. It is generally better to make use of higher-level control 327 | %sequences that state what functions are desired, instead of typing 328 | %out the way to achieve each function each time. The higher-level control 329 | %sequences need to be defined only once in terms of primitives. For 330 | %example, |\TeX| is a control sequence that means ``typeset the \TeX\ logo''; 331 | %|\'| is a control sequence that means ``put an acute accent over the 332 | %next character''; and both of these control sequences might require different 333 | %combinations of primitives when the style of type changes. If \TeX's logo 334 | %were to change, the author would simply have to change one definition, and the 335 | %changes would appear automatically wherever they were needed. By contrast, 336 | %an enormous amount of work would be necessary to change the logo if it 337 | %were specified as a sequence of primitives each time. 338 | 在文稿中,人们几乎用不到 \TeX\ 的原始控制系列, 339 | 因为原始控制系列是那么 $\ldots$ 地{\KT{10}原始}。% 340 | 如果你试图做 \TeX\ 的低级事情,就必需键入许多指令; 341 | 这浪费时间且容易犯错误。% 342 | 一般最好利用规定相应功能的高级控制系列,而不要每次都把得到本功能的% 343 | 所有东西都键入。% 344 | 高级控制系列只需要用原始控制系列定义一次。% 345 | \1例如,|\TeX| 是``排版 \TeX\ 的标识符''的控制系列; 346 | |\'| 是``在下一字符上放重音''的控制系列; 347 | 并且当排版格式变化时,所有这些控制系列只需原始控制系列的不同组合即可。% 348 | 如果 \TeX\ 的标识符要改变,作者只必须改变一个定义,并且改变后的东西自动出现% 349 | 在需要出现的地方。% 350 | 相反,如果它每次作为一系列的原始控制系列而确定时,改变标识符将要花费大量劳力。 351 | 352 | %At a still higher level, there are control sequences that govern the 353 | %overall format of a document. For example, in the present book the author 354 | %typed `^|\exercise|' just before stating each exercise; this |\exercise| 355 | %command was programmed to make \TeX\ do all of the following things: 356 | 在更高级方面,有管理文档整个格式的控制系列。% 357 | 例如,在前面作者在给出每个练习之前,键入了`|\exercise|'; 358 | 359 | %\nobreak\medskip 360 | %\item\bull compute the exercise number (e.g., `3.2' for the second 361 | %exercise in Chapter~3); 362 | %\smallskip 363 | %\item\bull typeset `\thinspace{\manual\char'170\rm\kern.15em 364 | % \ninebf EXERCISE \bf3.2}' with the appropriate typefaces, on a line by 365 | % itself, and with the triangle sticking out in the left margin; 366 | %\smallskip 367 | %\item\bull leave a little extra space just before that line, or begin 368 | % a new page at that line if appropriate; 369 | %\smallskip 370 | %\item\bull prohibit beginning a new page just after that line; 371 | %\smallskip 372 | %\item\bull suppress indentation on the following line. 373 | %\medbreak\noindent 374 | %It is obviously advantageous to avoid typing all of these individual 375 | %instructions each time. And since the manual is entirely described in 376 | %terms of high-level control sequences, it could be printed in a radically 377 | %different format simply by changing a dozen or so definitions. 378 | %% and sweating over the page layout in the math and alignment chapters! 379 | \nobreak\medskip 380 | \item\bull 算出练习的编号(比如,对第三章的第二个练习得到`3.2'); 381 | \smallskip 382 | \item\bull 在同一行上,用相应的字体排版出`\thinspace{\manual\char'170\rm\kern.15em 383 | \ninebf EXERCISE \bf3.2}', 并且让三角形顶左边; 384 | \smallskip 385 | \item\bull 在行前留出额外小间距,如果需要的话在此行换页; 386 | \smallskip 387 | \item\bull 禁止在此行后换页; 388 | \smallskip 389 | \item\bull 保证接下来的行不缩进。 390 | \medbreak\noindent 391 | 明显的好处是不必每次键入所有这些单个指令。% 392 | 并且因为本手册完全用高级控制系列所描述,所以通过改变大约一打的定义, 393 | 就可以用完全不同的格式来打印出它来。 394 | 395 | %\danger How can a person distinguish a \TeX\ primitive from a control sequence 396 | %that has been defined at a higher level? There are two ways: \ (1)~The index 397 | %to this manual lists all of the control sequences that are discussed, and each 398 | %primitive is marked with an asterisk. \ (2)~You can display the meaning of a 399 | %control sequence while running \TeX\null. If you type `^|\show||\cs|' 400 | %where |\cs| is any control sequence, \TeX\ will respond with its current 401 | %meaning. For example, `|\show\input|' results in \hbox{`|> \input=\input.|'}, 402 | %because |\input| is primitive. On the other hand, `|\show|^|\thinspace|' yields 403 | %\begintt 404 | %> \thinspace=macro: 405 | %->\kern .16667em . 406 | %\endtt 407 | %This means that |\thinspace| has been defined as an abbreviation for 408 | %`|\kern|~|.16667em|~'. By typing `|\show|\penalty0|\kern|' you can verify 409 | %that ^|\kern| is primitive. The results of\/ |\show| appear on your 410 | %terminal and in the ^{log file} that you get after running \TeX. 411 | \danger 怎样从高级控制系列中区分出 \TeX\ 的原始控制系列呢? 412 | 有两种方法: 413 | (1)~本手册的索引罗列了讨论过的所有控制系列,每个原始控制系列都用星号标记了。 414 | (2)~当运行 \TeX\ 时,你可以显示出某个控制系列的含义。 415 | 如果你键入 `|\show||\cs|'(其中 |\cs| 是任意控制系列),\TeX\ 将回答出它的当前含义。 416 | 例如,`|\show\input|' 得到 \hbox{`|> \input=\input.|'}, 417 | 这是因为 |\input| 是原始控制系列。另一方面,`|show||\thinspace|' 得到 418 | \begintt 419 | > \thinspace=macro: 420 | ->\kern .16667em . 421 | \endtt 422 | 这意味着 |\thinspace| 已经被定义为 `|\kern|~|.16667em|~'。 423 | 通过键入 `|\show|\penalty0|\kern|',你可以验证 |\kern| 是原始命令。 424 | |\show| 的结果出现在你的终端和运行 \TeX\ 结束后的日志文件中。 425 | 426 | %\dangerexercise Which of the control sequences |\|\] and 427 | %|\|\ is primitive? 428 | %\answer According to the index, |\|\] is primitive but 429 | %|\|\ isn't. The command `|\def\^^M{\ }|' in 430 | %Appendix~B is what actually defines |\|\, since a 431 | %return is representable as |^^M|. Asking \TeX\ to |\show\^^M| 432 | %\looseness-1 433 | %produces the response `|>| |\^^M=macro:->\|\]|.|'. 434 | \dangerexercise 控制系列 |\|\] 和|\|\中,哪个是原始的? 435 | \answer 从索引中可以看到,|\|\] 是原始的,而 |\|\ 不是。 436 | 附录 B 中的 `|\def\^^M{\ }|' 定义了 |\|\,因为回车符用 |^^M| 表示。 437 | 用 |\show\^^M| 可以让 \TeX\ 显示 `|>| |\^^M=macro:->\|\]|.|' 。 438 | 439 | %In the following chapters we shall frequently discuss ``^{plain \TeX}'' 440 | %format, which is a set of about 600 ^{basic control sequences} that are 441 | %defined in Appendix~B\null. These control sequences, together with the 300 442 | %or so primitives, are usually present when \TeX\ begins to process a 443 | %manuscript; that is why \TeX\ claims to know roughly 900 control sequences 444 | %when it starts. We shall see how plain \TeX\ can be used to create 445 | %documents in a flexible format that meets many people's needs, using some 446 | %typefaces that come with the \TeX\ system. However, you should keep in 447 | %mind that plain \TeX\ is only one of countless ^{formats} that can be 448 | %designed on top of \TeX's primitives; if you want some other format, it 449 | %will usually be possible to adapt \TeX\ so that it will handle whatever 450 | %you have in mind. The best way to learn is probably to start with plain 451 | %\TeX\ and to change its definitions, little by little, as you gain more 452 | %experience. 453 | 在后面的章节,我们将频繁讨论``plain \TeX''格式, 454 | 它大约有 600 个基本控制系列,这些都在附录 B 中定义出。 455 | 当 \TeX\ 开始处理文稿时,这些控制系列及 300 个左右的原始控制系列通常一起出现, 456 | \1这就是为什么 \TeX\ 在一开始声称大概有 900 个控制系列。% 457 | 我们将看到 plain \TeX\ 怎样被用来得到灵活格式的文档以满足不同人们的需要, 458 | 不过要使用 \TeX\ 系统所带的一些字体。% 459 | 但是要记住,plain \TeX\ 只不过是在 \TeX\ 的原始控制系列上设计的无数格式的一种; 460 | 如果想要其它格式,通常可以改编 \TeX\ 以得到你心中想要的。% 461 | 领会的最好方法可能是从 plain \TeX\ 开始,随着经验的积累,一点一点地修改它的定义。 462 | 463 | %\danger Appendix E contains examples of formats that can be added to 464 | %Appendix~B for special applications; for example, there is a set of 465 | %definitions suitable for business correspondence. A complete specification 466 | %of the format used to typeset this manual also appears in Appendix~E\null. 467 | %Thus, if your goal is to learn how to design \TeX\ formats, you will 468 | %probably want to study Appendix~E while mastering Appendix~B\null. After you 469 | %have become skilled in the lore of control-sequence definition, you 470 | %will probably have developed some formats that other people will want 471 | %to use; you should then write a supplement to this manual, explaining 472 | %your style rules. 473 | \danger 附录 E 中含有格式的例子,它们可以与附录 B 一起满足特殊要求; 474 | 例如,其中有一组适用于商业通信的定义。% 475 | 排版本书稿的完整的格式规定也在附录 E 中。% 476 | 因此,如果你的目的是设计 \TeX\ 格式,在学会附录 B 后你可能要研究研究附录 E。% 477 | 在经过定义控制系列的知识的训练后,你就可以为其他人们编写一些格式; 478 | 那么你应该为本手册写一个附录,解释一下你的设计规则。 479 | 480 | %The main point of these remarks, as far as novice \TeX\ users are concerned, is 481 | %that it is indeed possible to define nonstandard \TeX\ control sequences. 482 | %When this manual says that something is part of ``plain \TeX,'' it means 483 | %that \TeX\ doesn't insist on doing things exactly that way; a person 484 | %could change the rules by changing one or more of the definitions in 485 | %Appendix~B\null. But you can safely rely on the control sequences of plain 486 | %\TeX\ until you become an experienced \TeX nical~typist. 487 | 就 \TeX\ 新手所关心的而言,这些讨论的重点是,的确可以定义一些非标准的 \TeX\ 控制系\hbox{列。}% 488 | 当 \TeX\ 讲什么属于``plain \TeX''时,就意味着 \TeX\ 不是只能按照这种方法才可; 489 | 你可以通过改变附录 B 中一个或多个定义来改变结果。% 490 | 但是在你成为有经验的 \TeX\ 排版专家前,确实可以依赖 plain \TeX\ 的控制系列。 491 | 492 | %\ddangerexercise How many different control sequences of length~2 493 | %(including the escape character) are possible? How many of length~3? 494 | %\answer There are 256 of length~2; most of these are undefined when \TeX\ 495 | %begins. \ (\TeX\ allows any character to be an escape, but it does not 496 | %distinguish between control sequences that start with different escape 497 | %characters.) \ 498 | %If we assume that there are 52 letters, there are exactly $52^2$ 499 | %possible control sequences of length~3 (one for each pair of letters, from 500 | %|AA| to |zz|). But Chapter~7 explains how to use ^|\catcode| to change any 501 | %character into a ``^{letter}''; therefore it's possible to use any of 502 | %$256^2$ potential control sequences of length~3. 503 | \ddangerexercise 有多少 2 个字符的不同控制系列(转义符算一个字符)? 504 | 有多少 3 个字符的? 505 | \answer 两个字符长的有 256 个;其中大部分在 \TeX\ 开始运行时是未定义的。% 506 | (\TeX\ 允许任何字符作为转义符,但它不区分以不同转义符开始的控制系列。) 507 | 如果我们假设有 52 个字母,则总共有 $52^2$ 个可能的三个字符长的控制系列% 508 | (从 |AA| 到 |zz|,一对字母对应一个控制系列)。 509 | 但第 7 章将介绍如何用 ^|\catcode| 将任何字符改为 ``^{字母}''; 510 | 因此我们可以使用 $256^2$ 个潜在的三字符长的控制系列中的任何一个。 511 | 512 | \endchapter 513 | 514 | Syllables govern the world. 515 | \author JOHN ^{SELDEN}, {\sl Table Talk\/} (1689) % section on Power 516 | 517 | \bigskip 518 | 519 | I claim not to have controlled events, 520 | but confess plainly that events have controlled me. 521 | \author ABRAHAM ^{LINCOLN} (1864) % letter to A. G. Hodges, April 4 522 | 523 | \vfill\eject\byebye 524 | -------------------------------------------------------------------------------- /chapter05.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | % \beginchapter Chapter 5. Grouping 6 | \beginchapter Chapter 5. 编组 7 | 8 | \origpageno=19 9 | 10 | %Every once in a while it is necessary to treat part of a manuscript as a 11 | %unit, so you need to indicate somehow where that part begins and where it 12 | %ends. For this purpose \TeX\ gives special interpretation to two 13 | %``^{grouping characters},'' which (like the escape character) are 14 | %treated differently from the normal symbols that you type. We assume in 15 | %this manual that |{| and |}| are the grouping characters, since they 16 | %are the ones used in plain \TeX. ^^{curly braces, see braces} 17 | \1不时地需要把文稿的一部分当成一个整体来处理,所以你应该声明此部分的开头和结尾。% 18 | 为此,\TeX\ 给两个``编组字符''赋予了特殊含义,它(象转义符一样)与所键入的正常% 19 | 符号的处理方法不同。% 20 | 在本手册中我们设定 |{| 和 |}| 是编组字符,因为在 plain \TeX\ 中如此。 21 | 22 | %We saw examples of grouping in the previous chapter, where it was mentioned 23 | %that font changes inside a group do not affect the fonts in force outside. 24 | %The same principle applies to almost anything else that is defined inside 25 | %a group, as we will see later; for example, if you define a control sequence 26 | %within some group, that definition will disappear when the group ends. 27 | %In this way you can conveniently instruct \TeX\ to do something unusual, 28 | %by changing its normal conventions temporarily inside of a group; since 29 | %the changes are invisible from outside the group, there is no need to worry 30 | %about messing up the rest of a manuscript by forgetting to restore the 31 | %normal conventions when the unusual construction has been finished. 32 | %Computer scientists have a name for this aspect of grouping, because it's 33 | %an important aspect of programming languages in general; they call it 34 | %``^{block structure},'' and definitions that are in force only within 35 | %a group are said to be ``^{local}'' to that group. 36 | 在前一章,我们已经遇见了编组的例子,那里用到的是在组中的字体变化不影响外面的字\hbox{体。}% 37 | 就象外面后面要学习的一样,同一原理可以应用到定义在组中的几乎所有内容; 38 | 例如,如果你在某些组中定义了一个控制系列,当组结束时,那些定义就消失了。% 39 | 用这种方法,通过在组中临时改变其正常规则,可简便地告诉 \TeX\ 完成特殊的工作; 40 | 因为这种变化在组外部将消失了,所以当特殊工作结束后,不必担心文稿后面的部分怎样% 41 | 才能恢复正常规则。% 42 | 因为编组一般在编程语言方面是很重要的,所以计算机方面上它有一个名字, 43 | 即``模块结构'', 只在组中起作用的定义相对于那个组是``局部的''。 44 | 45 | %You might want to use grouping even when you don't care about block 46 | %structure, just to have better control over spacing. For example, let's 47 | %consider once more the control sequence ^|\TeX| that produces 48 | %the logo `\TeX' in this manual: We observed in Chapter~3 that a blank space 49 | %after this control sequence will be gobbled up unless one types 50 | %`\hbox{|\TeX\ |}', yet it is a mistake to say `|\TeX\|' when the following 51 | %character is not a blank space. Well, in {\sl all\/} cases it would be 52 | %correct to specify the simple group 53 | %\begintt 54 | %{\TeX} 55 | %\endtt 56 | %whether or not the following character is a ^{space}, because the |}| stops 57 | %\TeX\ from absorbing an optional space into |\TeX|. This might come in 58 | %handy when you're using a text editor (e.g., when replacing all occurrences 59 | %of a particular word by a control sequence). Another thing you could do is 60 | %type 61 | %\begintt 62 | %\TeX{} 63 | %\endtt 64 | %using an {\sl empty\/} group for the same purpose: The `|{}|' here is a 65 | %group of no characters, so it produces no output, but it does have the 66 | %effect of stopping \TeX\ from skipping blanks. 67 | %^^{empty group} ^^{lbrace rbrace} 68 | 即使你不关心模块结构,就是为了更好地得到间距,你可能也要利用编组。% 69 | 例如,让外面再讨论本手册中得到标识符`\TeX'的控制系列 |\TeX|: 70 | 在第三章我们看到,如果不键入`\hbox{|\TeX\ |}', 控制系列后面的空格会被吃掉, 71 | 但是当后面跟的是非空格字符时,键入`|\TeX\|'又出现错误。% 72 | 噢,在{\KT{10}所有}情况下,给出一个简单的组: 73 | \begintt 74 | {\TeX} 75 | \endtt 76 | 总是正确的,不管跟着的字符是不是空格, 77 | 因为 |}| 使 \TeX\ 不能把可能的空格吃\hbox{掉。}% 78 | 当你正在使用文本编辑器时这更方便(比如,当用控制下列代替所有出现的特殊单词时)。% 79 | 你也可用另一种方法,就是键入 80 | \begintt 81 | \TeX{} 82 | \endtt 83 | 用{\KT{10}空}组来达到同样的目的: 84 | 这里的`|{}|'是没有字符的组,所有它没有输出结果,但是它的确有阻止 \TeX\ 吃掉空格的% 85 | 效果。 86 | 87 | %\exercise Sometimes you run into a rare word like `shelfful' that looks 88 | %better as `shelf{}ful' without the `ff' ^{ligature}. How can you fool 89 | %\TeX\ into thinking that there aren't two consecutive f's in such a word? 90 | %\answer |{shelf}ful| or |shelf{}ful|, etc.; or even |shelf\/ful|, which 91 | %yields a shelf\/ful instead of a shelf{\kern0pt}ful. 92 | %In fact, the latter idea---to 93 | %insert an ^{italic correction}---is preferable because \TeX\ will ^^|\/| 94 | %reinsert the ff ligature by itself after ^{hyphenating} |shelf{}ful|. \ 95 | %(Appendix~H points out that ligatures are put into a hyphenated word that 96 | %contains no ``^{explicit kerns},'' and an italic correction is an 97 | %explicit kern.) \ But the italic correction may be too much (especially in an 98 | %italic font); |shelf{|^|\kern||0pt}ful| is often best. 99 | \exercise 有时候,会遇到一个类似 `shelfful' 的罕见单词,不用 `ff' ^{连写}而用% 100 | `shelf{}ful' 看起来更好。想想怎样愚弄一下 \TeX ,让它认为这样的单词中的两个 f~% 101 | 不是紧接着的。 102 | \answer |{shelf}ful| 或 |shelf{}ful| 等;甚或是 |shelf\/ful|, 103 | 利用它将得到 shelf\/ful 而不是 shelf{\kern0pt}ful。 104 | 实际上,后者的想法——插入一个^{倾斜校正}——更合适,^^|\/| 105 | 因为 \TeX\ 在对 |shelf{}ful| ^{连字化}后将重新插入 ff 连写。% 106 | (附录 H 指出连写将被放入不含``^{显式紧排}''的已连字单词中, 107 | 而倾斜校正就是一个显式紧排。)但是倾斜校正也许太多了(尤其在意大利体中); 108 | |shelf{|^|\kern||0pt}ful| 通常是最好的。% 109 | 【译注:前面的“连字化”和“已连字”应该分别理解为“尝试连字化”和“已尝试连字化”。 110 | 在给一个段落断行时,\TeX\ 首先尝试不连字的方式,如果失败再尝试带连字的方式。 111 | 在第二轮尝试中每个单词的可能断行点的 |{}| 将被丢弃,因此连写可能会被重新生成。 112 | 不过段落的第一个单词是个例外,因为 \TeX\ 从不尝试对第一个单词连字化。 113 | 另外,在 Lua\TeX 中,这种添加 |{}| 以阻止连写的做法始终是无效的。】 114 | 115 | %\dangerexercise Explain how to get three blank spaces in a row without 116 | %using `|\|\]'.^^{control space} 117 | %\answer `\]|{|\]|}|\]' or `\]|{}|\]|{}|\]', etc. Plain \TeX\ also has a 118 | %^|\space| macro, so you can type |\space\space\space|. \ (These aren't 119 | %strictly equivalent to `|\|\]|\|\]|\|\]', since they adjust the spaces by 120 | %the current ``^{space factor},'' as explained later.) 121 | \dangerexercise 不用`|\|\]', 看看怎样在一排中得到 3 个空格? 122 | \answer `\]|{|\]|}|\]' 或 `\]|{}|\]|{}|\]' 等。Plain \TeX\ 中还有 123 | ^|\space| 宏,从而你也可以键入 |\space\space\space|。 124 | (这些并不严格等同于 `|\|\]|\|\]|\|\]', 125 | 因为它们将根据当前的``^{间距因子}''调整空白的大小,这会在稍后说明。) 126 | 127 | %But \TeX\ also uses grouping for another, quite different, purpose, namely 128 | %to determine how much of your text is to be governed by certain control 129 | %sequences. For example, if you want to center something on a line you can type 130 | %\begintt 131 | %\centerline{This information should be centered.} 132 | %\endtt 133 | %using the control sequence ^|\centerline| defined in plain \TeX\ format. 134 | \1但是 \TeX\ 也在另外非常不同的方面使用编组,即规定特定的控制系列作用在哪些文本上。% 135 | 例如,你要把一行中的内容居中,利用定义在 plain \TeX\ 中的控制系列 |\centerline|, 136 | 你可以键入 137 | \begintt 138 | \centerline{This information should be centered.} 139 | \endtt 140 | 141 | %Grouping is used in quite a few of \TeX's more intricate instructions; and 142 | %it's possible to have groups within groups within groups, as you can see 143 | %by glancing at Appendix~B\null. Complex grouping is generally unnecessary, 144 | %however, in ordinary manuscripts, so you needn't worry about it. Just 145 | %don't forget to finish each group that you've started, because a lost 146 | %`|}|' might cause trouble. 147 | 编组还出现在 \TeX\ 的很少几个更复杂的指令中; 148 | 当浏览附录 B 时你就会看到,可以组中套组。% 149 | 但是在普通文稿中,一般不需要复杂的编组,所以你不必担心。% 150 | 只是别忘了把每个开始的组要结束掉,因为忘记`|}|'可能会出问题。 151 | 152 | %Here's an example of two groups, one ^{nested} inside the other: 153 | %\begintt 154 | %\centerline{This information should be {\it centered}.} 155 | %\endtt 156 | %As you might expect, \TeX\ will produce a centered line that also contains 157 | %italics: 158 | %$$\hbox{This information should be {\it centered}.}$$ 159 | %But let's look at the example more closely: `|\centerline|' appears outside 160 | %the curly braces, while `|\it|' appears inside. Why are the two cases 161 | %different? And how can a beginner learn to remember which is which? 162 | %Answer: |\centerline| is a control sequence that applies only to the very next 163 | %thing that follows, so you want to put braces around the text that is to 164 | %be centered (unless that text consists of a single symbol or control sequence). 165 | %For example, to center the \TeX\ logo on a line, it would suffice to 166 | %type `|\centerline\TeX|', but to center the phrase `\TeX\ has groups' you 167 | %need braces: `|\centerline{\TeX\ has groups}|'. On the other hand, |\it| is 168 | %a control sequence that simply means ``change the current font''; it acts 169 | %without looking ahead, so it affects {\sl everything\/} that follows, at 170 | %least potentially. The braces surround |\it| in order to confine the font 171 | %change to a local region. 172 | 这里有一个两个组的例子,一个嵌套在另一个中间: 173 | \begintt 174 | \centerline{This information should be {\it centered}.} 175 | \endtt 176 | 正如所预期的一样,\TeX\ 产生了一个居中的行,其中包含 italic 字体: 177 | $$\hbox{This information should be {\it centered}.}$$ 178 | 但是,让我们更详细地讨论这个例子: 179 | `|\centerline|'出现在大括号外面,而`|\it|'出现在里面。% 180 | 为什么这两种情况不同呢? 181 | 初学者怎样才能弄清谁是谁呢? 182 | 答案是:|centerline| 这个控制系列是只作用在其后接下来的内容上, 183 | 所以你要把居中的内容放在括号中(除非其内容仅仅是一个符号或一个控制系列)。% 184 | 例如,要把标识符 \TeX\ 居中,键入 `|\centerline\TeX|' 就可以了, 185 | 但是要居中短语`\TeX\ has groups', 就需要括号:`|\centerline{\TeX\ has groups}|'。% 186 | 另一方面,|\it| 这个控制系列简单表示``改变当前字体''; 187 | 它对前面没有作用,所以它——至少暗中——对其后的{\KT{10}所有}内容起作用。% 188 | 括住 |\it| 的括号是为了把字体改变的作用限制在局部区域。 189 | 190 | %In other words, the two sets of braces in this example actually have different 191 | %functions: One serves to treat several words of the text as if they 192 | %were a single object, while the other provides local block structure. 193 | 换句话说,本例中的两组括号的作用不同: 194 | 一个是把文本的多个单词看作一个单一对象,而另一个提供了局部模块结构。 195 | 196 | %\exercise What do you think happens if you type the following: 197 | %\begintt 198 | %\centerline{This information should be {centered}.} 199 | %\centerline So should this. 200 | %\endtt 201 | %\answer In the first case, you get the same result as if the innermost 202 | %braces had not appeared at all, because you haven't used the grouping to 203 | %change fonts or to control spacing or anything. \TeX\ doesn't mind if you 204 | %want to waste your time making groups for no particular reason. 205 | %But in the second case, the necessary braces were forgotten. You get the 206 | %letter `S' centered on a line by itself, followed by a paragraph that 207 | %begins with `o should this.' on the next line. 208 | \exercise 如果你键入下列内容,会得到什么结果? 209 | \begintt 210 | \centerline{This information should be {centered}.} 211 | \centerline So should this. 212 | \endtt 213 | \answer 第一种情形中,你得到的结果与内部花括号不存在时的一样, 214 | 因为你没有利用该编组改变字体或控制间距或做其他事情。 215 | \TeX\ 不在乎你浪费时间制造没有用处的编组。 216 | 但是在第二种情形中,必需的花括号被遗漏了。 217 | 你将得到在单独一行居中的字母 `S', 218 | 在下一行跟着一个以 `o should this.' 开始的段落。 219 | 220 | %\exercise And how about this one? 221 | %\begintt 222 | %\centerline{This information should be \it centered.} 223 | %\endtt 224 | %\answer You get the same result as if another pair of braces were present 225 | %around `|\it centered|', except that the period is typeset from the 226 | %italic font. \ (Both periods look about the same.) \ The |\it| font 227 | %will not remain in force after the |\centerline|, but this is 228 | %something of a coincidence: \TeX\ uses the braces to determine what 229 | %text is to be centered, but then it removes the braces. The 230 | %|\centerline| operation, as defined in Appendix~B\null, puts the 231 | %resulting braceless text inside {\sl another\/} group; and that's why 232 | %|\it| disappears after |\centerline|. \ (If you don't understand this, 233 | %just don't risk leaving out braces in tricky situations, and you'll be OK.) 234 | \exercise 下面这个呢? 235 | \begintt 236 | \centerline{This information should be \it centered.} 237 | \endtt 238 | \answer 你得到的结果与 `|\it centered|' 被包含在另一对花括号时的一样, 239 | 除了此时句号也用意大利体排版。(这两种句号看起来几乎一样。) 240 | |\it| 字体在 |\centerline| 之后将不再生效,但这只是一个巧合: 241 | \TeX\ 用花括号确定要居中显示的文本,而后将删除花括号。 242 | 在附录 B 定义的 |\centerline|操作, 243 | 将不带花括号的结果文本放入{\sl 另一个}编组中; 244 | 这就是 |\it| 在 |\centerline| 之后失效的原因。% 245 | (如果你不能理解此事,在棘手的情况下就不要冒险去掉花括号, 246 | 这样你就不会有问题。) 247 | 248 | %\smallskip 249 | %\dangerexercise Define a control sequence |\ital| so that a user could type 250 | %`|\ital{text}|' instead of `|{\it text\/}|'. Discuss the pros and cons of 251 | %|\ital| versus |\it|. 252 | %\answer |\def\ital#1{{\it#1\/}}|. \ Pro:~Users might find this easier to 253 | %learn, because it works more like |\centerline| and they don't have to 254 | %remember to make the italic correction. \ Con:~To avoid the italic correction 255 | %just before a {\it comma} or {\it period}, users should probably be taught 256 | %another control sequence; for example, with 257 | %\begintt 258 | %\def\nocorr{\kern0pt } 259 | %\endtt 260 | %a user could type `|\ital{comma} or \ital{period\nocorr},|'. The alternative 261 | %of putting a period or comma in italics, to avoid the italic correction, 262 | %doesn't look as good. A long sequence of italics would be inefficient for 263 | %\TeX, since the entire text for the argument to |\ital| must be read into 264 | %memory only to be scanned again. 265 | \smallskip 266 | \dangerexercise 定义一个控制系列 |\ital|, 使得用户用键入`|\ital{text}|'来% 267 | 代替`|{\it text\/}|'。与 |\it| 相比,看看 |\ital| 有什么优缺点。 268 | \answer |\def\ital#1{{\it#1\/}}|。\ 269 | 优点:用户会发现这简单易学,因为它用起来很像 |\centerline|,且无须记得要作倾斜校正。\ 270 | 缺点:要避免在{\it 逗号}或{\it 句号}之前的倾斜校正,用户也许需要学会另一个控制系列; 271 | 比如利用 272 | \begintt 273 | \def\nocorr{\kern0pt } 274 | \endtt 275 | 用户可以键入 `|\ital{comma} or \ital{period\nocorr},|'。 276 | 另一种方法是将句号或逗号也放入意大利体文本中,以避免倾斜校正, 277 | 但这看起来不够好。一大段的意大利体文本将降低 \TeX\ 的效率, 278 | 因为 |\ital| 的整个参量文本必须先读入内存才能进行再次扫描 。 279 | 280 | %\ddanger Subsequent chapters describe many primitive operations of \TeX\ for 281 | %which the locality of grouping is important. For example, if one of \TeX's 282 | %internal parameters is changed within a group, the previous contents of 283 | %that parameter will be restored when the group ends. Sometimes, however, 284 | %it's desirable to make a definition that transcends its current group. This 285 | %effect can be obtained by prefixing `^|\global|' to the definition. For 286 | %example, \TeX\ keeps the current page number in a register called~|\count0|, 287 | %and the routine that outputs a page wants to increase the 288 | %^{page number}. ^{Output routines} are always protected by enclosing them 289 | %in groups, so that they do not inadvertently mess up the rest of \TeX; but 290 | %the change to |\count0| would disappear if it were kept local to the 291 | %output group. The command 292 | %\begintt 293 | %\global\advance\count0 by 1 294 | %\endtt 295 | %^^|\advance| 296 | %solves the problem; it increases |\count0| and makes this value stick around 297 | %at the end of the output routine. In general, |\global| makes the immediately 298 | %following definition pertain to all existing groups, not just to the 299 | %innermost one. 300 | \ddanger \1后面的章节规定了许多 \TeX\ 的原始操作,其中编组的局部性很重要。% 301 | 例如,当 \TeX\ 的一个内部参数在组中变化了,当组结束时,此参数会恢复为原先的内容。% 302 | 但是有时候,希望一个定义能不限在当前组中。% 303 | 这可以通过在定义上加前缀`|\global|'而实现。% 304 | 例如,\TeX\ 把当前的页码放在叫做 |\count0| 的寄存器中, 305 | 并且输出一页的程序要增大页数。% 306 | 总是通过把输出程序放在组中来保护它们,使得它们不会混淆 \TeX\ 的其它内容; 307 | 但是如果对输出组而言 |\count0| 是局部的,那么产生的变化就会被掩盖。% 308 | 命令 309 | \begintt 310 | \global\advance\count0 by 1 311 | \endtt 312 | 就解决了这个问题;它增大 |count0|, 并且使其值在输出程序结束时保留下来。 313 | 一般地,|\global| 使其后紧接的定义适用于所有存在的组,而不仅仅是最内层的组。 314 | 315 | %\ddangerexercise If you think you understand local and global definitions, 316 | %here's a little test to make sure: Suppose |\c| stands for `|\count1=|', 317 | %|\g| stands for `|\global\count1=|', and |\s| stands for 318 | %`|\showthe\count1|'. What values will be shown? 319 | %\begintt 320 | %{\c1\s\g2{\s\c3\s\g4\s\c5\s}\s\c6\s}\s 321 | %\endtt 322 | %\answer |{1 {2 3 4 5} 4 6} 4|. 323 | \ddangerexercise 如果你认为自己掌握了局部和整体的定义,这里有一个小测验: 324 | 设 |\c| 代表`|\count1=|', |\g| 代表`|\global\count1=|', |\s| 代表% 325 | `|\showthe\count1|'。下面的结果是什么? 326 | \begintt 327 | {\c1\s\g2{\s\c3\s\g4\s\c5\s}\s\c6\s}\s 328 | \endtt 329 | \answer |{1 {2 3 4 5} 4 6} 4|. 330 | 331 | %\ddanger Another way to obtain block structure with \TeX\ is to use the 332 | %primitives ^|\begingroup| and ^|\endgroup|. These control sequences make it 333 | %easy to begin a group within one control sequence and end it within 334 | %another. The text that \TeX\ actually executes, after control sequences 335 | %have been expanded, must have properly ^{nested groups}, i.e., groups that 336 | %don't overlap. For example, 337 | %\begintt 338 | %{ \begingroup } \endgroup 339 | %\endtt 340 | %is not legitimate. 341 | \ddanger 利用 \TeX\ 得到模块结构的另一种方法是用原始的 |\begingroup| 和 |\endgroup|。% 342 | 这些控制系列很容易在一个控制系列中开始一个组,并且在另一个控制系列中结束组。% 343 | 在控制系列展开后,\TeX\ 实际执行的文本必须是真正的嵌套组,即,组不能交叉。% 344 | 例如, 345 | \begintt 346 | { \begingroup } \endgroup 347 | \endtt 348 | 是不合法的。 349 | 350 | %\ddangerexercise Define control sequences |\beginthe|\ and 351 | %|\endthe|\ that provide a ``named'' block structure. In other 352 | %words, 353 | %\begintt 354 | %\beginthe{beguine}\beginthe{waltz}\endthe{waltz}\endthe{beguine} 355 | %\endtt 356 | %should be permissible, but not 357 | %\begintt 358 | %\beginthe{beguine}\beginthe{waltz}\endthe{beguine}\endthe{waltz}. 359 | %\endtt 360 | %\answer |\def\beginthe#1{\begingroup\def\blockname{#1}}|\parbreak 361 | %|\def\endthe#1{\def\test{#1}%|\parbreak 362 | %| \ifx\test\blockname\endgroup|\parbreak 363 | %| \else\errmessage{You should have said|\parbreak 364 | %| \string\endthe{\blockname}}\fi}| 365 | \ddangerexercise 定义一个控制系列 |\beginthe|\ 和 % 366 | |\endthe|\, 它给出一个``命名''模块结构。 367 | 换句话说, 368 | \begintt 369 | \beginthe{beguine}\beginthe{waltz}\endthe{waltz}\endthe{beguine} 370 | \endtt 371 | 是允许的,但是不允许 372 | \begintt 373 | \beginthe{beguine}\beginthe{waltz}\endthe{beguine}\endthe{waltz}. 374 | \endtt 375 | \answer |\def\beginthe#1{\begingroup\def\blockname{#1}}|\parbreak 376 | |\def\endthe#1{\def\test{#1}%|\parbreak 377 | | \ifx\test\blockname\endgroup|\parbreak 378 | | \else\errmessage{You should have said|\parbreak 379 | | \string\endthe{\blockname}}\fi}| 380 | 381 | \endchapter 382 | 383 | I have had recourse to varieties of type, 384 | and to braces. 385 | \author JAMES ^{MUIRHEAD}, {\sl The Institutes of Gaius\/} (1880) % p. xii 386 | % he actually said braces for what we call brackets 387 | 388 | \bigskip 389 | 390 | An encounter group is a gathering, for a few hours or a few days, 391 | of twelve or eighteen personable, responsible, certifiably normal 392 | and temporarily smelly people. 393 | \author JANE ^{HOWARD}, {\sl Please Touch\/} (1970) 394 | 395 | \vfill\eject\byebye 396 | -------------------------------------------------------------------------------- /chapter09.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | % \beginchapter Chapter 9. \TeX's\\Roman Fonts 6 | \beginchapter Chapter 9. 罗马字体 7 | 8 | \origpageno=51 9 | 10 | %When you're typing a manuscript for \TeX, you need to know what symbols 11 | %are available. The plain \TeX\ format of Appendix~B is based on the 12 | %Computer Modern fonts, which provide the characters needed to typeset a 13 | %wide variety of documents. It's time now to discuss what a person can do 14 | %with plain \TeX\ when typing straight text. We've already touched on some of 15 | %the slightly subtle things---for example, dashes and quotation marks 16 | %were considered in Chapter~2, and certain kinds of accents appeared in the 17 | %examples of Chapters 3 and~6. The purpose of this chapter is to give a 18 | %more systematic summary of the possibilities, by putting all the facts 19 | %together. 20 | \1当你输入 \TeX\ 文稿时,你需要知道有哪些可用的符号。% 21 | 附录 B 的 plain \TeX\ 格式使用的基本字体是 Computer Modern 字体, 22 | 它可用于多种文档。% 23 | 现在来看看当直接输入文本时 plain \TeX\ 可用干些什么。% 24 | 我们已经遇到过一些有点微妙的问题——例如,在第二章讨论的破折号和引号, 25 | 在第三和第六章出现的一些重音符。% 26 | 本章的目的是通过汇总所有的情况,得到更系统的总结。 27 | 28 | %Let's begin with the rules for the normal roman font (|\rm| or |\tenrm|); 29 | %plain \TeX\ will use this font for everything unless you specify 30 | %otherwise. Most of the ordinary symbols that you need are readily available 31 | %and you can type them in the ordinary way: There's nothing special about 32 | %\begindisplay \openup1pt 33 | %the ^{letters} |A| to |Z| and |a| to |z|\cr 34 | %the ^{digits} |0| to |9|\cr 35 | %common ^{punctuation} marks |: ; ! ? ( ) [ ] ` ' - * / . , @|\cr 36 | %\enddisplay 37 | %except that \TeX\ recognizes certain combinations as ^{ligatures}: 38 | %$$\openup1pt\halign{\indent#\hfil\cr 39 | %|ff| yields ff\thinspace;$\!$\quad |fi| yields fi\thinspace;$\!$\quad 40 | %|fl| yields fl\thinspace;$\!$\quad 41 | %|ffi| yields ffi\thinspace;$\!$\quad |ffl| yields ffl\thinspace;\cr 42 | %|``| yields``\thinspace;\qquad |''| yields ''\thinspace;\qquad 43 | %|!||`| yields !`\thinspace;\qquad |?||`| yields ?`\thinspace;\cr 44 | %|--| yields --\thinspace;\qquad |---| yields ---\thinspace.\cr}$$ 45 | %^^{Spanish ligatures} 46 | %You can also type |+| and |=|, to get the corresponding 47 | %symbols + and~=; but it's much better to use such characters 48 | %only in math mode, i.e., enclosed between two |$| signs, since that tells 49 | %\TeX\ to insert the proper spacing for mathematics. Math mode is 50 | %explained later; for now, it's just a good idea to remember that formulas 51 | %and text should be segregated. A non-mathematical hyphen and a non-mathematical 52 | %slash should be specified by typing `|-|' and `|/|' outside of mathematics 53 | %mode, but subtraction and division should be specified by typing `|-|' and 54 | %`|/|' between |$|~signs. 55 | %^^{Colon} 56 | %^^{Semicolon} 57 | %^^{Exclamation point}^^{Shriek, see exclamation point} 58 | %^^{Question mark} 59 | %^^{Parentheses} 60 | %^^{Brackets} 61 | %^^{Apostrophe} ^^{Reverse apostrophe} 62 | %^^{Hamza, see apostrophe} ^^{Ain, see reverse apostrophe} 63 | %^^{Hyphen} ^^{Dash} 64 | %^^{Asterisk} 65 | %^^{At sign} 66 | %^^{Virgule, see slash} 67 | %^^{Solidus, see slash} 68 | %^^{Shilling sign, see slash} 69 | %^^{Slash} 70 | %^^{Period} ^^{Full stop, see period} 71 | %^^{Comma} 72 | %^^{Plus sign} 73 | %^^{Equals sign} 74 | 首先以正常的 roman 字体(|\rm| 或 |\tenrm|)的规则开始; 75 | 如果你不给出字体,那么 plain \TeX\ 将在所有情况下使用本字体。% 76 | 你需要的大部分普通符号都容易得到,并且你可以正常地输入它\hbox{们:} 77 | 对于 78 | \begindisplay \openup1pt 79 | 字母 |A| 到 |Z| 和 |a| 到 |z|\cr 80 | 数字 |0| to |9|\cr 81 | 一般的标点符号 |: ; ! ? ( ) [ ] ` ' - * / . , @|\cr 82 | \enddisplay 83 | 没有什么特别之处,但是 \TeX\ 将把下列组合视为^{连写}: 84 | $$\openup1pt\halign{\indent#\hfil\hbox{ 得到 }&#\hfil& 85 | &\qquad#\hfil\hbox{ 得到 }&#\hfil\cr 86 | |ff|&ff;&|ffi|&ffi;&|``|&``\thinspace;&|!||`|&!`\thinspace;\cr 87 | |fi|&fi;&|ffl|&ffl;&|''|&''\thinspace;&|?||`|&?`.\cr 88 | |fl|&fl;&|--|&--\thinspace;&|---|&---\thinspace;\cr}$$ 89 | 还可以输入 |+| 和 |=| 来得到相应的符号 + 和 =; 90 | 但是只在数学模式中使用它们更好一些,即用两个 |$| 把它们夹起来, 91 | 因为这会告诉 \TeX\ 要插入适当的数学间距。% 92 | 数学模式在后面讨论; 93 | 现在,只需要记住公式和文本要隔开。% 94 | 非数学的连字符和斜线应该在数学环境外输入为`|-|'和`|/|', 95 | 而减号和除号应该是 |$| 号之间输入`|-|'和`|/|'。% 96 | 97 | %The previous paragraph covers 80 of the 94 visible characters of standard 98 | %ASCII; so your keyboard probably contains at least 14 more symbols, and 99 | %you should learn to watch out for the remaining ones, since they are special. 100 | %Four of these are pre\"empted by plain \TeX; if your manuscript requires 101 | %the symbols 102 | %\begintt 103 | %$ # % & 104 | %\endtt 105 | %^^{dollar sign} ^^{sharp sign, see hash mark} ^^{number sign, see hash mark} 106 | %^^{hash mark} ^^{percent sign} ^^{ampersand} 107 | %you should remember to type them as 108 | %\begintt 109 | %\$ \# \% \& 110 | %\endtt 111 | %respectively. Plain \TeX\ also reserves the six symbols 112 | %\begintt 113 | %\ { } ^ _ ~ 114 | %\endtt 115 | %^^{backslash} ^^{braces} ^^{curly braces, see braces} ^^{hat, see circumflex} 116 | %^^{circumflex} ^^{underline} ^^{tilde} 117 | %but you probably don't mind losing these, since they don't appear in 118 | %normal copy. Braces and backslashes are available via control sequences 119 | %in math mode. 120 | 前一段讨论了标准 ASCII 的 94 个可见字符中的 80 个; 121 | 因此,你的键盘可能还包含至少 14 个符号, 122 | 并且对剩下的符号你应当小心,因为它们是特殊符号。% 123 | 它们中的四个被 plain \TeX\ 预先占用了; 124 | 如果你的文稿需要下列符号: 125 | \begintt 126 | $ # % & 127 | \endtt 128 | 那么你应该分别这样输入它们: 129 | \begintt 130 | \$ \# \% \& 131 | \endtt 132 | Plain \TeX\ 还保留了六个符号: 133 | \begintt 134 | \ { } ^ _ ~ 135 | \endtt 136 | 但是你可能并不在乎失去它们,因为一般的文档不需要它们。% 137 | 在数学模式中,通过控制系列可以使用括号和反斜线。 138 | 139 | %\goodbreak 140 | %There are four remaining special characters in the standard ASCII set: 141 | %\begintt 142 | %" || < > 143 | %\endtt 144 | %Again, you don't really want them when you're typesetting text. \ (Double-quote 145 | %marks should be replaced either by |``| or by |''|; vertical 146 | %lines and relation signs are needed only in math mode.) 147 | %^^{double-quote mark} ^^{vertical line, see norm} ^^{norm symbol} 148 | %^^{less than sign} ^^{greater than sign} 149 | \goodbreak 150 | \1在标准 ASCII 集中,还有四个剩下的特殊符号: 151 | \begintt 152 | " || < > 153 | \endtt 154 | 当你排版文本时,并不真正要用它们。% 155 | (双引号可以用 |``| 或 |''| 来代替; 156 | 竖线和关系号只在数学模式下用到。) 157 | 158 | %Scholarly publications in English often refer to other languages, so 159 | %plain \TeX\ makes it possible to typeset the most commonly used ^{accents}: 160 | %$$\halign{\indent\hbox to 50pt{#\hfil}&\hbox to 35pt{#\hfil}&#\hfil\cr 161 | %\it\negthinspace Type&\it to get\cr 162 | %\noalign{\smallskip} 163 | %|\`o|&\`o&(grave accent)\cr 164 | %|\'o|&\'o&(acute accent)\cr 165 | %|\^o|&\^o&(circumflex or ``hat'')\cr 166 | %|\"o|&\"o&(umlaut or dieresis)\cr 167 | %|\~o|&\~o&(tilde or ``squiggle'')\cr 168 | %|\=o|&\=o&(macron or ``bar'')\cr 169 | %|\.o|&\.o&(dot accent)\cr 170 | %|\u o|&\u o&(breve accent)\cr 171 | %|\v o|&\v o&(h\'a\v cek or ``check'')\cr 172 | %|\H o|&\H o&(long Hungarian umlaut)\cr 173 | %|\t oo|&\t oo&(tie-after accent)\cr}$$ 174 | %^^|\`| ^^{grave accent} 175 | %^^|\'| ^^{acute accent} 176 | %^^{esc hat} ^^{circumflex accent} ^^{hat accent} 177 | %^^|\"| ^^{umlaut accent} ^^{dieresis} 178 | %^^{esc tilde} ^^{tilde accent} ^^{squiggle accent} 179 | %^^|\=| ^^{macron accent} ^^{bar accent} 180 | %^^|\.| ^^{dot accent} 181 | %^^|\v| ^^{h\'a\v cek accent} ^^{check accent} 182 | %^^|\u| ^^{breve accent} 183 | %^^|\H| ^^{Hungarian umlaut} 184 | %^^|\t| ^^{tie-after accent} 185 | %^^{embellished letters, see accents} 186 | %Within the font, such accents are designed to appear at the right height 187 | %for the letter `o'; but you can use them over any letter, and \TeX\ will 188 | %raise an accent that is supposed to be taller. Notice that spaces are needed 189 | %in the last four cases, to separate the control sequences from the letters 190 | %that follow. You could, however, type `|\H{o}|' in order to avoid putting a 191 | %space in the midst of a word. 192 | 英文的学术出版物通常要用到其它语言, 193 | 所以 plain \TeX\ 可以排版最常用的重音符: 194 | $$\halign{\indent\hbox to 50pt{#\hfil}&\hbox to 35pt{#\hfil}&#\hfil\cr 195 | \it\negthinspace \hbox{输入}&\it \hbox{得到}\cr 196 | \noalign{\smallskip} 197 | |\`o|&\`o&(grave accent)\cr 198 | |\'o|&\'o&(acute accent)\cr 199 | |\^o|&\^o&(circumflex or ``hat'')\cr 200 | |\"o|&\"o&(umlaut or dieresis)\cr 201 | |\~o|&\~o&(tilde or ``squiggle'')\cr 202 | |\=o|&\=o&(macron or ``bar'')\cr 203 | |\.o|&\.o&(dot accent)\cr 204 | |\u o|&\u o&(breve accent)\cr 205 | |\v o|&\v o&(h\'a\v cek or ``check'')\cr 206 | |\H o|&\H o&(long Hungarian umlaut)\cr 207 | |\t oo|&\t oo&(tie-after accent)\cr}$$ 208 | 在字体内,这样的重音符在设计上是正好出现在字母`o'的高度; 209 | 但是可以在任意字母上使用它们, 210 | 并且字母变高时 \TeX\ 会自动升高重音符。% 211 | 注意,在后四种情况,分开控制系列和后面字母的空格是必须的。% 212 | 但是,为了避免在单词中间出现空格,应该输入`|\H{o}|'。 213 | 214 | %\medbreak 215 | %Plain \TeX\ also provides three accents that go underneath: 216 | %$$\halign{\indent\hbox to 50pt{#\hfil}&\hbox to 35pt{#\hfil}&#\hfil\cr 217 | %\it\negthinspace Type&\it to get\cr 218 | %\noalign{\smallskip} 219 | %|\c o|&\c o&(cedilla accent)\cr 220 | %|\d o|&\d o&(dot-under accent)\cr 221 | %|\b o|&\b o&(bar-under accent)\cr}$$ 222 | %^^|\c| ^^{cedilla accent} 223 | %^^|\d| ^^{dot-under accent} ^^{emphatics, see dot-under} 224 | %^^|\b| ^^{bar-under accent} 225 | %And there are a few special letters: 226 | %$$\halign{\indent\hbox to 50pt{#\hfil}&\hbox to 35pt{#\hfil}&#\hfil\cr 227 | %\it\negthinspace Type&\it to get\cr 228 | %\noalign{\smallskip} 229 | %|\oe,\OE|&\oe,\thinspace\OE&(French ligature OE)\cr 230 | %|\ae,\AE|&\ae,\thinspace\AE&(Latin ligature and Scandinavian letter AE)\cr 231 | %|\aa,\AA|&\aa,\thinspace\AA&(Scandinavian A-with-circle)\cr 232 | %|\o,\O|&\o,\thinspace\O&(Scandinavian O-with-slash)\cr 233 | %|\l,\L|&\l,\thinspace\L&(Polish suppressed-L)\cr 234 | %|\ss|&\ss&(German ``es-zet'' or sharp S)\cr}$$ 235 | %^^{Scandinavian letters} ^^{sharp S} ^^{es-zet} ^^{German} ^^{Polish} 236 | %^^{Norwegian} ^^{Danish} ^^{Swedish} ^^{suppressed-L} 237 | %^^{diphthongs, see \ae, \oe} 238 | %The |\rm| font contains also the ^{dotless letters} `\i' and `\j', 239 | %which you can obtain by typing `^|\i|' and `^|\j|'. These are needed because 240 | %`i' and `j' should lose their dots when they gain an accent. For example, 241 | %the right way to obtain `m\=\i n\u us' is to type \hbox{`|m\=\i n\u us|'} 242 | %or `|m\={\i}n\u{u}s|'. 243 | \medbreak 244 | Plain \TeX\ 还给出了出现在下面的三个重音符: 245 | $$\halign{\indent\hbox to 100pt{#\hfil}&\hbox to 35pt{#\hfil}&#\hfil\cr 246 | \it\negthinspace\hbox{输入}&\it \hbox{得到}\cr 247 | \noalign{\smallskip} 248 | |\c o|&\c o&(cedilla accent)\cr 249 | |\d o|&\d o&(dot-under accent)\cr 250 | |\d {\hbox{国}}|&\d {\hbox{国}}&(dot-under accent)\cr 251 | |\b o|&\b o&(bar-under accent)\cr}$$ 252 | 还有几个特殊的字母: 253 | $$\halign{\indent\hbox to 50pt{#\hfil}&\hbox to 35pt{#\hfil}&#\hfil\cr 254 | \it\negthinspace \hbox{输入}&\it \hbox{得到}\cr 255 | \noalign{\smallskip} 256 | |\oe,\OE|&\oe,\thinspace\OE&(French ligature OE)\cr 257 | |\ae,\AE|&\ae,\thinspace\AE&(Latin and Scandinavian ligature AE)\cr 258 | |\aa,\AA|&\aa,\thinspace\AA&(Scandinavian A-with-circle)\cr 259 | |\o,\O|&\o,\thinspace\O&(Scandinavian O-with-slash)\cr 260 | |\l,\L|&\l,\thinspace\L&(Polish suppressed-L)\cr 261 | |\ss|&\ss&(German ``es-zet'' or sharp S)\cr}$$ 262 | |rm| 字体还包含无点字母`\i'和`\j', 你可以用`|\i|'和`|\j|'来得到它们。% 263 | 这是有用的,因为当`i'和`j'得到重音符时应该去掉上面的点。% 264 | \1例如,得到`m\=\i n\u us'的正确方法是输入\hbox{`|m\=\i n\u us|'}% 265 | 或`|m\={\i}n|\allowbreak|\u{u}s|'。 266 | 267 | %This completes our summary of the |\rm| font. Exactly the same conventions 268 | %apply to |\bf|, |\sl|, and |\it|, so you don't have to do things differently 269 | %when you're using a different typeface. For example, |\bf\"o| yields 270 | %{\bf\"o} and |\it\&| yields {\it\&}. Isn't that nice? 271 | 这就完成了我们对 |\rm| 字体的总结。% 272 | 确切地说,同样的约定对 |\bf|,|\sl| 和 |\it| 也可以, 273 | 所以当使用不同字体时,不必用不同的方法。% 274 | 例如,|\bf\"o| 得到的是 {\bf\"o}, |\it\&| 得到的是 {\it\&}。% 275 | 奇妙吧? 276 | 277 | %\danger However, |\tt| is slightly different. You will be glad to know that 278 | %|ff|, |fi|, and so on are not treated as ligatures when you're using 279 | %^{typewriter type}; nor do you get ligatures from dashes and quote marks. 280 | %That's fine, because ordinary dashes and ordinary double-quotes are 281 | %appropriate when you're trying to imitate a typewriter. Most of the 282 | %accents are available too. But |\H|, |\.|, |\l|, and |\L| cannot be 283 | %used---the typewriter font contains other symbols in their place. 284 | %Indeed, you are suddenly allowed to type |"|, \|, |<|, and |>|; 285 | %^^{doublequote} ^^{vertical line} ^^{less than sign} ^^{greater than sign} 286 | %see Appendix~F\null. All of the letters, spaces, and other symbols in 287 | %|\tt| have the same width. 288 | \danger 但是,|\tt| 稍有不同。% 289 | 当你使用 typewriter 字体时,乐意见到 |ff|, |fi| 等等不被当做连写来处理; 290 | 也不会从破折号和引号得到连写。 291 | 这很好,因为当你模仿打字机时,普通破折号和普通双引号比较合适。% 292 | 大部分重音符也可以使用。% 293 | 但是 |\H|, |\.|, |\l| 和 |\L| 不能使用——typewriter 字体在这些地方% 294 | 对应于其它符号。% 295 | 当前,你忽然可以输入 |"|, \|, |<| 和 |>| 了; 296 | 见附录 F。% 297 | 在 |\tt| 中,所有的字母,空格和其它符号的宽度相同。 298 | 299 | %\exercise What's the non-naive way to type `na\"\i ve'\thinspace? 300 | %\answer |na\"\i ve| or |na{\"\i}ve| or |na\"{\i}ve|. 301 | \exercise 用非正常的方式输入`na\"\i ve'。 302 | \answer |na\"\i ve| 或 |na{\"\i}ve| 或 |na\"{\i}ve|。 303 | 304 | %\exercise List some English words that contain accented letters. 305 | %\answer Belov\`ed prot\'eg\'e; r\^ole co\"ordinator; souffl\'es, cr\^epes, 306 | %p\^at\'es, etc. 307 | \exercise 列出包含重音字母的一些英语单词。 308 | \answer Belov\`ed prot\'eg\'e;r\^ole co\"ordinator;souffl\'es,cr\^epes, 309 | p\^at\'es,等等。 310 | 311 | %\exercise How would you type `\AE sop's \OE uvres en fran\c cais'\thinspace? 312 | %\answer |\AE sop's \OE uvres en fran\c cais|. 313 | \exercise 怎样输入`\AE sop's \OE uvres en fran\c cais'\thinspace? 314 | \answer |\AE sop's \OE uvres en fran\c cais|。 315 | 316 | %\exercise Explain what to type in order to get this sentence: 317 | %{\sl Commentarii Academi\ae\ scientiarum imperialis petropolitan\ae\/} 318 | %became {\sl Akademi\t\i a Nauk SSSR, Doklady}. 319 | %\answer |{\sl Commentarii Academi\ae\ scientiarum imperialis|\hfil\break 320 | %|petropolitan\ae\/} became {\sl Akademi\t\i a Nauk SSSR, Doklady}.| 321 | \exercise 为了得到下列句子,看看应该输入什么? 322 | {\sl Commentarii Academi\ae\ scientiarum imperialis petropolitan\ae\/} is now 323 | {\sl Akademi\t\i a Nauk SSSR, Doklady}. 324 | \answer |{\sl Commentarii Academi\ae\ scientiarum imperialis|\hfil\break 325 | |petropolitan\ae\/} became {\sl Akademi\t\i a Nauk SSSR, Doklady}.| 326 | 327 | %\exercise And how would you specify the names 328 | %Ernesto ^{Ces\`aro}, 329 | %P\'al ^{Erd\H os}, 330 | %\O ystein ^{Ore}, 331 | %Stanis\l aw \'Swierczkowski, ^^{Swiercz...} 332 | %Serge\u\i\ \t Iur'ev, ^^{Iur'ev} 333 | %Mu\d hammad ibn M\^us\^a ^{al-Khw\^arizm\^\i}? 334 | %\answer |Ernesto Ces\`aro, 335 | %P\'al Erd\H os, 336 | %\O ystein Ore, 337 | %Stanis\l aw \'Swier%|\break|czkowski, 338 | %Serge\u\i\ \t Iur'ev, 339 | %Mu\d hammad ibn M\^us\^a al-Khw\^arizm\^\i.| 340 | \exercise 如何得到下列这些名字: 341 | Ernesto {Ces\`aro}, 342 | P\'al {Erd\H os}, 343 | \O ystein {Ore}, 344 | Stanis\l aw \'Swierczkowski, 345 | Serge\u\i\ \t Iur'ev, 346 | Mu\d hammad ibn M\^us\^a {al-Khw\^arizm\^\i}\thinspace ? 347 | \answer |Ernesto Ces\`aro, 348 | P\'al Erd\H os, 349 | \O ystein Ore, 350 | Stanis\l aw \'Swier%|\break|czkowski, 351 | Serge\u\i\ \t Iur'ev, 352 | Mu\d hammad ibn M\^us\^a al-Khw\^arizm\^\i.| 353 | 354 | %\dangerexercise Devise a way to typeset {\tt P\'al Erd{\bf\H{\tt o}}s} 355 | %in typewriter type. 356 | %\answer The proper umlaut is |\H|, which isn't available in |\tt|, so 357 | %it's necessary to borrow the accent from another font. For example, 358 | %\hbox{|{\tt P\'al Erd{\bf\H{\tt o}}s}|} uses a bold accent, which 359 | %is suitably dark. 360 | \dangerexercise 设计一种方法,用打字机字体排版 {\tt P\'al Erd{\bf\H{\tt o}}s}。 361 | \answer 合适的变音是 |\H|,但它在 |\tt| 中不可用, 362 | 因此需要从另一个字体中借用重音符。比如 363 | $$\hbox{|{\tt P\'al Erd{\bf\H{\tt o}}s}|}$$ 使用粗体重音符,它的黑度适合。 364 | 365 | %The following symbols come out looking exactly the same whether you are using 366 | %|\rm|, |\sl|, |\bf|, |\it|, or |\tt|: 367 | %$$\halign{\indent#\hfil\ &\hfil#\hfil&#\hfil\cr 368 | %\it\negthinspace Type&\it to get\cr 369 | %\noalign{\smallskip} 370 | %|\dag|&\dag&(dagger or obelisk)\cr 371 | %|\ddag|&\ddag&(double dagger or diesis)\cr 372 | %|\S|&\S&(section number sign)\cr 373 | %|\P|&\P&(paragraph sign or pilcrow)\cr}$$ 374 | %^^{dagger} ^^{double dagger} ^^{obelisk} ^^{obelus, see obelisk} ^^{diesis} 375 | %^^{section number sign} ^^{paragraph sign} ^^{pilcrow, see paragraph sign} 376 | %(They appear in just one style because plain \TeX\ gets them from the 377 | %math symbols font. Lots of other symbols are needed for mathematics; 378 | %we shall study them later. See Appendix~B for a few more non-math symbols.) 379 | 不管你使用 |\rm|, |\sl|, |\bf|, |\it| 或 |\tt|, 下列符号都是一样的: 380 | $$\halign{\indent#\hfil\ &\hfil#\hfil&#\hfil\cr 381 | \it\negthinspace\hbox{输入}&\it\hbox{得到}\cr 382 | \noalign{\smallskip} 383 | |\dag|&\dag&(dagger or obelisk)\cr 384 | |\ddag|&\ddag&(double dagger or diesis)\cr 385 | |\S|&\S&(section number sign)\cr 386 | |\P|&\P&(paragraph sign or pilcrow)\cr}$$ 387 | (它们仅仅以一种字体出现,因为 plain \TeX\ 是从数学符号中得到它们的。% 388 | 数学上需要许多其它符号; 389 | 我们将在后面讨论它们。% 390 | 附录 B 还有几个非数学符号。) 391 | 392 | %\exercise In plain \TeX's italic font, the `\$' sign comes out as 393 | %`{\it\$}\thinspace'. 394 | %^^{dollar sign} ^^{British pound sign} ^^{pound sterling} ^^{sterling} 395 | %This gives you a way to refer to pounds sterling, but you might want an 396 | %italic dollar sign. Can you think of a way to typeset a reference to 397 | %the book {\it Europe on {\sl\$}15.00 a day}\thinspace? 398 | %\answer |{\it Europe on {\sl\$}15.00 a day\/}| 399 | \exercise \1在 plain \TeX\ 的 italic 字体中, 400 | `\$'得到的是`{\it\$}\thinspace'。% 401 | 这是得到英镑符号的一种方法,但是你可能要一个 italic 美元符号。% 402 | 你能想出怎样排版书名 {\it Europe on {\sl\$}15.00 a day} 吗? 403 | 404 | %\ddanger Appendix B shows that plain \TeX\ handles most of the accents 405 | %by using \TeX's ^|\accent| primitive. For example, |\'#1| is equivalent 406 | %to |{\accent19 #1}|, where |#1| is the argument being accented. 407 | %The general rule is that |\accent|\ puts 408 | %an accent over the next character; the \ tells where that accent 409 | %appears in the current font. The accent is assumed to be properly 410 | %positioned for a character whose height equals the ^{x-height} of the 411 | %current font; taller or shorter characters cause the accent to be raised 412 | %or lowered, taking due account of the slantedness of the fonts of accenter 413 | %and accentee. The width of the final construction is the width of the 414 | %character being accented, regardless of the width of the accent. 415 | %Mode-independent commands like font changes may appear between the accent 416 | %number and the character to be accented, but grouping operations must not 417 | %intervene. If it turns out that no suitable character is present, the 418 | %accent will appear by itself as if you had said |\char|\ instead 419 | %of\/ |\accent|\. For example, |\'{}| produces \'{}. 420 | \ddanger 附录 B 表明,plain \TeX\ 用原始控制系列 |\accent| 来处理大多数重音符。% 421 | 例如,|\'#1| 等价于 |{\accent19 #1}|, 这里的 |#1| 是要加上重音的参量。% 422 | 一般规则是,|\accent|\ 把重音加在下一个字符上; 423 | \ 给出了当前字体中本重音出现的位置。% 424 | 假定了重音正好放在当前字体中高度为 x 的高度的字符上; 425 | 更高或更矮的字符会使重音符升高或降低, 426 | 而且还要考虑重音符和字符的字体的倾斜问题。% 427 | 最后输出字符的宽度是字符的宽度,与重音符的宽度无关。% 428 | 象字体变换这样不依赖于模式的命令可以在重音符和字符之间出现, 429 | 但是编组不能交叉。% 430 | 如果没有合适的字符,那么出现的是重音符自己,相当于 |\char|\, 431 | 而不是 |\accent|\。% 432 | 例如,|\'{}| 得到的是 \'{}。 433 | 434 | %\ddangerexercise Why do you think plain \TeX\ defines |\'#1| to be 435 | %`|{\accent19 #1}|' instead of simply letting |\'| be an abbreviation 436 | %for `|\accent19 |'\thinspace? \ (Why the extra 437 | %braces, and why the argument |#1|?) 438 | %\answer The extra braces keep font changes local. An argument makes the 439 | %use of\/ |\'| more consistent with the use of other accents like |\d|, which 440 | %are manufactured from other characters without using the |\accent| 441 | %primitive. 442 | \ddangerexercise 想想为什么 plain \TeX\ 把 |\'#1| 定义为`|{\accent19 #1}|', 443 | 而不是直接用 |\'| 来代替`|\accent19 |'\thinspace? 444 | (为什么有一个额外的括号?为什么有参量 |#1|?) 445 | 446 | %\ddanger It's important to remember that these conventions we have discussed 447 | %for accents and special letters are not built into \TeX\ itself; they belong 448 | %only to the plain \TeX\ format, which uses the Computer Modern fonts. Quite 449 | %different conventions will be appropriate when other fonts are involved; 450 | %format designers should provide rules for how to obtain accents and 451 | %special characters in their particular systems. Plain \TeX\ works well 452 | %enough when accents are infrequent, but the conventions of this chapter 453 | %are by no means recommended for large-scale applications of \TeX\ to 454 | %other languages. For example, a well-designed \TeX\ font for ^{French} 455 | %might well treat accents as ligatures, so that one could |e'crire 456 | %de cette manie`re nai"ve en franc/ais| without backslashes. (See the 457 | %remarks about Norwegian in Chapter~8.) 458 | %^^{foreign languages} 459 | \ddanger 重要的是记住,我们所讨论的重音和特殊字符的约定不是 \TeX\ 自带的; 460 | 它们只属于 plain \TeX\ 格式, 461 | 而本格式使用的是 Computer Modern 字体。% 462 | 当涉及其它字体时,相应的约定差别很大; 463 | 格式设计者应该在它们的特殊系统内提供得到重音和特殊字符的方法。% 464 | Plain \TeX\ 对不经常使用的重音也处理得很好, 465 | 但是本章的约定无法推荐给其它语言的 \TeX\ 的大范围应用。 466 | 例如,法语中设计得比较好的 \TeX\ 字体是把重音当做连写, 467 | 因此可以不用反斜线就得到 |e'crire de cette manie`re nai"ve en franc/ais|。% 468 | (见第 8 章关于挪威语的讨论。) 469 | 470 | \endchapter 471 | 472 | Let's doo't after the high Roman fashion. 473 | \author WILLIAM ^{SHAKESPEARE}, {\sl The Tragedie of % 474 | Anthony and Cleopatra\/} (1606) % Act IV, Scene 13, line 87 475 | 476 | \bigskip 477 | 478 | English is a straightforward, frank, honest, open-hearted, no-nonsense language, 479 | which has little truck with such devilish devious devices as accents; 480 | indeed U.S. editors and printers are often thrown into a dither 481 | when a foreign word insinuates itself into the language. 482 | However there is one word on which Americans seem to have closed ranks, 483 | printing it confidently, courageously, and almost invariably 484 | complete with accent---the cheese presented to us as M\"unster. 485 | \smallskip 486 | Unfortunately, ^{Munster} doesn't take an accent. 487 | \author WAVERLEY ^{ROOT}, in the {\sl International Herald Tribune\/} (1982) 488 | % Tuesday 18 May 82 page 8 489 | 490 | \vfill\eject\byebye 491 | -------------------------------------------------------------------------------- /chapter25.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | % \beginchapter Chapter 25. Summary of\\Horizontal Mode 6 | \beginchapter Chapter 25. 水平模式总结 7 | 8 | \origpageno=285 9 | 10 | %^^{horizontal mode} 11 | %Continuing the survey that was begun in Chapter 24, let us investigate 12 | %exactly what \TeX's digestive processes can do, when \TeX\ is building 13 | %lists in horizontal mode or in restricted horizontal mode. 14 | \1我们继续从第 24 章开始的总结;现在讨论 \TeX\ 15 | 在水平模式和受限水平模式下构建列表时,它的消化过程可以做的事情。 16 | 17 | %\ninepoint 18 | %\def\\{\smallbreak\textindent{$\bull$}} 19 | %\medbreak 20 | %\centerline{$*\qquad*\qquad*$} 21 | %\medskip\noindent 22 | %Three asterisks, just like those that appear here, can be found near the 23 | %end of Chapter~24. 24 | %Everything preceding the three asterisks in that chapter applies to 25 | %horizontal mode as well as to vertical mode, so we need not repeat 26 | %all those rules. In particular, Chapter~24 explains assignment commands, 27 | %and it tells how kerns, penalties, marks, insertions, adjustments, 28 | %and ``whatsits'' are put into horizontal lists. Our present goal 29 | %is to consider the commands that have an intrinsically horizontal 30 | %flavor, in the sense that they behave differently in horizontal 31 | %mode than they do in vertical or math modes. 32 | \ninepoint 33 | \def\\{\smallbreak\textindent{$\bull$}} 34 | \medbreak 35 | \centerline{$*\qquad*\qquad*$} 36 | \medskip\noindent 37 | 类似这样的三个星号在第 24 章快结束时可以找到。 38 | 在第 24 章中,在三个星号前面的所有内容都既适用于水平模式,也适用于垂直模式, 39 | 因此我们就毋需重复那些规则了。 40 | 特别地,第 24 章讨论了赋值命令,并且讨论了紧排、惩罚、标记、插入项、 41 | 调整和``无名''是如何放入水平列中的。 42 | 我们当前的目标是讨论本质上属于水平模式的命令, 43 | 即在水平模式下与在垂直和数学模式下表现不同的命令。 44 | 45 | %One of the things characteristic of horizontal mode is the ``^{space 46 | %factor},'' which modifies the width of spaces as described in Chapter~12. 47 | %If a command changes the value of\/ ^|\spacefactor|, that fact is 48 | %specifically noted here. The space factor is initially set to~1000, when 49 | %\TeX\ begins to form a horizontal list, except in the case of\/ |\valign| and 50 | %|\noalign| when the space factor of the outer list continues inside the 51 | %inner one. 52 | 水平模式一个特有的东西是``间距因子'', 它象第十二章讨论的那样来修改间距的宽度。% 53 | 如果要用命令改变 |\spacefactor| 的值,那么就要特别注意一下。% 54 | 当 \TeX\ 开始形成水平列时,间距因子最初设定为 1000, 55 | 但是在 |\valign| 和 |\noalign| 时,外层列的间距因子会延续到内层来。 56 | 57 | %\\^|\hskip|\, ^|\hfil|, ^|\hfill|, ^|\hss|, ^|\hfilneg|.\enskip 58 | %A glue item is appended to the current horizontal list. 59 | \\^|\hskip|\, ^|\hfil|, ^|\hfill|, ^|\hss|, ^|\hfilneg|.\enskip 60 | 把一个粘连项目追加到当前列。 61 | 62 | %\\\\\.\enskip 63 | %Here ^\ refers to one of the five glue-appending commands 64 | %just mentioned; the formal syntax for \ and for \ is 65 | %given in Chapter~24. A glue item that produces ^{leaders} is appended. 66 | \\\\\.\enskip 67 | 这里的 \ 指的是刚刚讨论的五个追加粘连的命令; 68 | \ 和 \ 的正式语法见第二十四章。% 69 | 生成指引线的粘连项目要追加到当前列。 70 | 71 | %\\^\.\enskip 72 | %Spaces append glue to the current list; the exact amount of glue depends on 73 | %|\spacefactor|, the current font, and the |\spaceskip| and |\xspaceskip| 74 | %parameters, as described in Chapter~12. 75 | \\^\.\enskip 76 | 空白把粘连追加到当前列; 77 | 粘连的具体量与 |\spacefactor|, 当前字体,|\spaceskip| 和 |\xspaceskip| 有关, 78 | 见第十二章的讨论。 79 | 80 | %\\|\|\].\enskip ^^{control space} 81 | %A control-space command appends glue to the current list, using the same amount 82 | %that a \ inserts when the space factor is 1000. 83 | \\|\|\].\enskip ^^{control space} 84 | 控制空格命令把粘连追加到当前列, 85 | 粘连的大小与间距因子为 1000 时 \ 所插入粘连的大小相同。 86 | 87 | %\\^\.\enskip 88 | %The box is constructed, and if the result is void nothing happens. 89 | %Otherwise the new box is appended to the current list, and 90 | %the space factor is~set~to~1000. 91 | \\^\.\enskip 92 | 构造这个盒子,并且如果所得到的是置空的就什么也不会出现。% 93 | 否则,把新盒子追加到当前列,并且把间距因子设置为 1000。 94 | 95 | %\\^|\raise|\\, ^|\lower|\\.\enskip 96 | %This acts just like an unadorned \ command, except that the new box 97 | %being appended to the horizontal list is also shifted up or down by the 98 | %specified amount. 99 | \\^|\raise|\\, ^|\lower|\\.\enskip 100 | 它与普通的 \ 命令是一样的, 101 | 但是追加到水平列的新盒子还要向上或向下平移所给定的量。 102 | 103 | %\\^|\unhbox|\<8-bit number>, ^|\unhcopy|\<8-bit number>.\enskip 104 | %If the specified box register is void, nothing happens. Otherwise that 105 | %register must contain an hbox. The horizontal list inside that box is 106 | %appended to the current horizontal list, without changing it in any way. 107 | %The value of\/ |\spacefactor| is not affected. The box register becomes void 108 | %after |\unhbox|, but it remains unchanged by |\unhcopy|. 109 | \\^|\unhbox|\<8-bit number>, ^|\unhcopy|\<8-bit number>.\enskip 110 | 如果给定的盒子寄存器是置空的,那么什么也不出现。% 111 | 否则,寄存器必须包含一个 hbox。% 112 | 在此盒子中的水平列要追加到当前水平列,而不做任何改变。% 113 | |\spacefactor| 的值不受影响。% 114 | 在 |\unhbox| 后此盒子寄存器变成置空的,在 |\unhcopy| 后它保持不变。 115 | 116 | %\\\.\enskip 117 | %The specified ^{rule} is appended to the current list, and the |\spacefactor| 118 | %is set to 1000. 119 | \\\.\enskip 120 | 把给定的标尺追加到当前列,并且把 |\spacefactor| 设置为 1000。 121 | 122 | %\\^|\valign|\|{|\|}|.\enskip 123 | %The ^\ consists of a preamble followed by zero or more 124 | %columns to be aligned; see Chapter~22. \TeX\ enters a new level of grouping, 125 | %represented by the `|{|' and `|}|', within which changes to ^|\tabskip| 126 | %will be confined. The alignment material can also contain optional 127 | %occurrences of `|\noalign|\|{|\|}|' 128 | %between columns; this adds another level of grouping. \TeX\ operates in 129 | %restricted horizontal mode while it works on the material in ^|\noalign| 130 | %\vadjust{\eject}% squeeze another line onto page 285, we need it on page 286! 131 | %groups and when it appends columns of the \hbox{alignment}; the resulting 132 | %internal horizontal list will be appended to the enclosing horizontal list 133 | %after the alignment is completed. The value of\/ |\spacefactor| at the time 134 | %of the |\valign| is used at the beginning of the internal horizontal list, 135 | %and the final value of\/ |\spacefactor| is carried to the enclosing 136 | %horizontal list when the alignment is completed. The space factor is set 137 | %to 1000 after each column; hence it affects the results only in |\noalign| 138 | %groups. \TeX\ also enters an additional level of grouping when it works 139 | %on each individual entry of the alignment, during which time it acts in 140 | %internal vertical mode; the individual entries will be vboxed as part of 141 | %the final alignment. 142 | %%No room for the following redundant remarks: 143 | %% The commands |\noalign|, |\omit|, |\span|, |\cr|, 144 | %%|\crcr|, and |&| (where |&| denotes an explicit or implicit character of 145 | %%category~4) are intercepted by the alignment process, en route to \TeX's 146 | %%stomach, so they will not appear as commands in the stomach unless \TeX\ 147 | %%has lost track of what alignment they belong to. 148 | \\^|\valign|\|{|\|}|.\enskip 149 | \ 由导言后面跟零个或更多个要对齐的栏组成; 150 | 见第二十二章。% 151 | \TeX\ 进入由`|{|'和`|}|'表示的一个新层次的编组, 152 | 其中对 |\tabskip| 的修改是受到限制的。% 153 | 对齐的内容还可以包含栏之间的`|\noalign|\|{|\|}|'; 154 | 这增加了另一个层次的编组。% 155 | 当处理 |\noalign| 组中的内容并且当追加对齐的栏时, \TeX\ 处于受限水平模式中; 156 | \1在对齐结束后,所得到的不变水平列将追加到封装的水平列。% 157 | 在 |\valign| 中 |\spacefactor| 的值使用的是内部水平列开始时的值, 158 | 当对齐结束后,~|\spacefactor| 最后的值要送到封装的水平列。% 159 | 在每栏结束后,间距因子就设置为 1000; 160 | 因此它只影响在 |\noalign| 组中的结果。% 161 | 当处理对齐的每个栏时, \TeX\ 还要进入更深层的编组, 162 | 此时它处在内部垂直模式; 163 | 各个单元都是作为最后对齐的一部分而放在 vbox 中。 164 | 165 | %\\^|\indent|.\enskip 166 | %An empty box of width ^|\parindent| is appended to the current list, and 167 | %the space factor is set to 1000. 168 | \\^|\indent|.\enskip 169 | 把宽度为 |\parindent| 的空盒子追加到当前列, 170 | 并且把间距因子设置为 1000。 171 | 172 | %\\^|\noindent|.\enskip 173 | %This command has no effect in horizontal modes. 174 | \\^|\noindent|.\enskip 175 | 此命令在水平模式下没有什么作用。 176 | 177 | %\\^|\par|.\enskip 178 | %The primitive |\par| command, also called ^|\endgraf| in plain \TeX, 179 | %does nothing in restricted horizontal mode. But it terminates horizontal 180 | %mode: The current list is finished off by doing ^|\unskip| ^|\penalty10000| 181 | %^^|\parfillskip| 182 | %|\hskip\parfillskip|, then it is broken into lines as explained in Chapter~14, 183 | %and \TeX\ returns to the enclosing vertical or internal vertical mode. 184 | %The lines of the paragraph are appended to the enclosing vertical list, 185 | %interspersed with interline glue and interline penalties, and with 186 | %the ^{migration} of vertical material that was in the horizontal list. 187 | %Then \TeX\ exercises the page builder. 188 | \\^|\par|.\enskip 189 | 原始命令 |\par|, 在 plain \TeX\ 中也称为 |\endgraf|, 190 | 它在受限水平模式下什么也不做。% 191 | 但是它终止当前水平模式:当前列通过 192 | 命令 |\unskip| |\penalty10000| |\hskip\parfillskip| 来完成, 193 | 接着,它如第十四章讨论的那样分段为行, 194 | 并且 \TeX\ 回到封装的垂直或内部垂直模式。% 195 | 把段落的行追加到封装的垂直列,其间插入行间粘连和行间惩罚,并且把水平列中% 196 | 的垂直内容转移出来。% 197 | 接着 \TeX\ 进行页面构建。 198 | 199 | %\\|{|.\enskip 200 | %A character token of category 1, or a control sequence like~|\bgroup| 201 | %that has been |\let| equal to such a character token, causes \TeX\ to 202 | %start a new level of ^{grouping}. When such a group ends---with `|}|'---\TeX\ 203 | %will undo the effects of non-global assignments without leaving whatever 204 | %mode it is in at that time. 205 | \\|{|.\enskip 206 | 类别码为 1 的字符记号,或者用 |\let| 使得它与这种字符记号相等的控制序列, 207 | 比如 |\bgroup|,将让 \TeX\ 开始一个新层级的^{编组}。 208 | 当这样的编组用 `|}|' 结束后,\TeX\ 将撤消所有的非全局赋值,并且保持其目前的模式不变。 209 | 210 | %\\Some commands are incompatible with horizontal mode because they are 211 | %intrinsically vertical. When the following commands appear in unrestricted 212 | %horizontal mode, they cause \TeX\ to conclude the current paragraph: 213 | %^^{paragraph end, implied} 214 | %\beginsyntax 215 | %\is^|\unvbox|\alt^|\unvcopy|\alt^|\halign|\alt^|\hrule| 216 | % \alt^|\vskip|\alt^|\vfil|\alt^|\vfill|\alt^|\vss|\alt^|\vfilneg|% 217 | % \alt^|\end|\alt^|\dump| 218 | %\endsyntax 219 | %The appearance of a \ in restricted horizontal mode is 220 | %forbidden, but in regular horizontal mode it causes \TeX\ to insert the 221 | %token \cstok{par} into the input; after reading and expanding this \cstok{par} 222 | %token, \TeX\ will see the \ token again. \ (The current 223 | %meaning of the control sequence ^|\par| will be used; \cstok{par} might no 224 | %longer stand for \TeX's |\par| primitive.) 225 | \\某些命令与水平模式不相容,因为它们在本质上是垂直模式的。% 226 | 当下列命令出现在非受限水平模式中时,会使 \TeX\ 结束当前段落: 227 | \beginsyntax 228 | \is^|\unvbox|\alt^|\unvcopy|\alt^|\halign|\alt^|\hrule| 229 | \alt^|\vskip|\alt^|\vfil|\alt^|\vfill|\alt^|\vss|\alt^|\vfilneg|% 230 | \alt^|\end|\alt^|\dump| 231 | \endsyntax 232 | 在受限水平模式下,不允许出现一个 \, 233 | 但是在正常水平模式下,这会使得 \TeX\ 把记号 \cstok{par} 插入到输入中; 234 | 在读入和展开这个 \cstok{par} 后, \TeX\ 就再次遇见了 \ 记号。% 235 | (要用到控制系列 |\par| 当前的意思; 236 | \cstok{par} 可能不再表示 \TeX\ 的原始命令 |\par|。) 237 | 238 | %\\\, \, \kern-1pt^|\char|\<8-bit number>, \, 239 | %\kern-1pt^|\noboundary|.\enskip 240 | %The most common commands of all are the character commands that tell 241 | %\TeX\ to append a character to the current horizontal 242 | %list, using the current font. 243 | %If two or more commands of this type occur in succession, \TeX\ processes 244 | %them all as a unit, converting to ligatures and/or 245 | %inserting kerns as directed by the font information. \ (Ligatures and 246 | %kerns may be influenced by invisible ``boundary'' characters at the left 247 | %and right, unless |\noboundary| appears.) \ Each character 248 | %command adjusts ^|\spacefactor|, using 249 | %the ^|\sfcode| table as described in Chapter~12. 250 | %In unrestricted horizontal mode, a 251 | %`|\discretionary{}{}{}|' item is appended after a character whose code is 252 | %the ^|\hyphenchar| of its font, or after a ligature formed from a sequence 253 | %that ends with such a character. ^^|\discretionary| 254 | \\\, \, \kern-1pt^|\char|\<8-bit number>, \, 255 | \kern-1pt^|\noboundary|.\enskip 256 | 所有命令中最常用的字符命令,它把一个当前字体的字符追加到当前水平列。 257 | 如果两个或多个这种命令连续出现,\TeX\ 就把它们看作一个整体, 258 | 按照字体中的信息将它们连写和/或插入紧排。(如果 |\noboundary| 不出现的话, 259 | 连写和紧排可能会受字符左右两边看不见的``边界''的影响。) 260 | 每个字符命令都用第 12 章讨论的 |\sfcode| 表调整 |\spacefactor|。 261 | 在非受限水平模式中,在当前字体的 |\hyphenchar| 的字符后面, 262 | 或者在以这个字符结尾的序列所形成的连写后面。要添加 `|\discretionary{}{}{}|' 项。 263 | 264 | %\\^|\accent|\<8-bit number>\. 265 | %Here ^\ stands for zero or more \ 266 | %commands other than ^|\setbox|. 267 | %If the assignments are not followed by a \, where 268 | %\ stands for any of the commands just discussed in the previous 269 | %paragraph, \TeX\ treats |\accent| as if it were |\char|, except that 270 | %the space factor is set to 1000. Otherwise the character that follows 271 | %the assignment is accented by the character that corresponds to the 272 | %\<8-bit number>. \ (The purpose of the intervening assignments is to 273 | %allow the accenter and accentee to be in different fonts.) \ If the 274 | %accent must be moved up or down, it is put into an hbox that is 275 | %raised or lowered. Then the accent is effectively superposed on the 276 | %character by means of kerns, in such a way that the width of the accent 277 | %does not influence the width of the resulting horizontal list. 278 | %Finally, \TeX\ sets |\spacefactor=1000|. 279 | \\^|\accent|\<8-bit number>\. 280 | 这里的 \ 表示零个或多个不为 ^|\setbox| 的 \ 命令。 281 | 如果紧随赋值之后的不是一个 \, 282 | 其中 \ 表示前一个段落刚刚讨论的任何命令, 283 | 那么 \TeX\ 把 |\accent| 当成 |\char| 来处理,但是间距因子为 1000。 284 | \1否则,跟在赋值后面的字符就被对应于 \<8-bit number> 的字符加上重音。% 285 | (中间可以有赋值,目的在于允许所加的重音符和被加重音的字符为不同的字体。) 286 | 如果这个重音必须向上或向下移动,那么就把它放在一个 hbox 中来升降。 287 | 这样重音就通过调整间距的方式叠放在字符上,按照这种方法, 288 | 重音的宽度不会影响所得到的水平列的宽度。 289 | 最后,\TeX\ 设置 |\spacefactor=1000|。 290 | 291 | %\\^|\/|.\enskip 292 | %If the last item on the current list is a character or ligature, an 293 | %explicit kern for its ^{italic correction} is appended. 294 | \\^|\/|.\enskip 295 | 如果当前列上的最后一个项目是字符或连写,则会追加倾斜校正所需的显式紧排。 296 | 297 | %\\^|\discretionary|\\\.\enskip 298 | %The three general texts are processed in restricted horizontal mode. They 299 | %should contain only fixed-width things; hence they aren't really very 300 | %general in this case. More precisely, the horizontal list formed by each 301 | %discretionary general text must consist only of characters, ligatures, 302 | %kerns, boxes, and rules; there should be no glue or penalty items, etc. 303 | %This command appends a discretionary item to the current list; see 304 | %Chapter~14 for the meaning of a discretionary item. The space factor is 305 | %not changed. 306 | \\^|\discretionary|\\\.\enskip 307 | 这三个通用文本在受限水平模式下来处理。它们只包含宽度固定的内容; 308 | 因此,在这种情况下它们不真那么通用。更准确地说, 309 | 由任意可断点的通用文本形成的水平列只能包含字符、连写、紧排、盒子和标尺; 310 | 不应该有粘连或惩罚项等。这个命令把一个任意可断点项目追加到当前列; 311 | 见第 14 章任意可断点的含义的讨论。它不改变间距因子。 312 | 313 | %\\^|\-|.\enskip 314 | %This ``discretionary hyphen'' command is defined in Appendix H. 315 | \\^|\-|.\enskip 316 | 这个``任意连字符''命令在附录 H 中给出定义。 317 | 318 | %\\^|\setlanguage|\.\enskip 319 | %See the conclusion of Appendix H. 320 | \\^|\setlanguage|\.\enskip 321 | 见附录 H 的结果。 322 | 323 | %\\|$|.\enskip 324 | %A ``^{math shift}'' character causes \TeX\ to enter math mode or display math 325 | %mode in the following way: 326 | %\TeX\ looks at the following token without expanding it. If that token 327 | %is a~|$| and if \TeX\ is currently in unrestricted horizontal mode, 328 | %then \TeX\ breaks the current paragraph into lines as explained above 329 | %(unless the current list is empty), returns to the enclosing vertical 330 | %mode or internal vertical mode, calculates values like |\prevgraf| 331 | %and |\displaywidth| and |\predisplaysize|, enters a new level of grouping, 332 | %inserts the |\everydisplay| tokens into the input, exercises the page 333 | %builder, processes `\|$$|' in display math mode, puts 334 | %the display into the enclosing vertical list as explained in Chapter~19 335 | %(letting vertical material ^{migrate}), exercises the page builder again, 336 | %increases |\prevgraf| by~3, and resumes horizontal mode again, with an 337 | %empty list and with the space factor equal to~1000. \ (You got that?) \ 338 | %Otherwise \TeX\ puts the looked-at token back into the 339 | %input, enters a new level of grouping, inserts the |\everymath| tokens, 340 | %and processes `\|$|'; the math mode material 341 | %is converted to a horizontal list and appended to the current list, 342 | %surrounded by ``math-on'' and ``math-off'' items, and the space factor 343 | %is set to~1000. One consequence of these rules is that `|$$|' in 344 | %restricted horizontal mode simply yields an empty math formula. 345 | \\|$|.\enskip 346 | ``数学转换''符使 \TeX\ 按下列方式进入数学模式或陈列数学模式: 347 | \TeX\ 遇见下列记号而不展开它们。% 348 | 如果此记号是一个 |$| 并且 \TeX\ 目前处在非受限水平模式中, 349 | 那么 \TeX\ 象上面讨论的那样把当前段落分为行(除非当前列是空的), 350 | 再返回封装的垂直模式或内部垂直模式,计算象 |\prevdepth|, 351 | |\displaywidth| 和 |\predisplaysize| 的值,进入新一层次的编组, 352 | 把记号 |\everydisplay| 插入到输入中,进行页面构建,在陈列数学模式下处理% 353 | `\|$$|', 象第十九章讨论的那样把此陈列公式放在% 354 | 封装的垂直列中(把垂直内容转移处理), 355 | 再次进行页面构建,把 |\prevgraf| 增加 3, 并且再回到水平模式, 356 | 开始一个空列并且设置间距因子为 1000。% 357 | (你看懂了吗") 358 | 否则, \TeX\ 就把所读入的记号放回输入,进入一个新层次的编组, 359 | 插入记号 |\everymath|, 并且处理`\|$|'; 360 | 这个数学模式的内容被转换为一个水平列并且追加到当前列, 361 | 两边放上``math-on''项目和``math-off''项目, 362 | 并且把间距因子设置为 1000。% 363 | 这些规则的一个后果就是,在受限水平模式下的`|$$|'直接得到一个空数学公式。 364 | 365 | %\\None of the above: If any other primitive command of \TeX\ occurs 366 | %in horizontal mode, an error message will be given, and \TeX\ will try 367 | %to recover in a reasonable way. For example, if a superscript or 368 | %subscript symbol appears, or if any other inherently mathematical 369 | %command is given, \TeX\ will try to insert a `|$|' just before the 370 | %offending token; this will enter math mode. 371 | %%No room for the following redundant remarks: 372 | %%On the other hand if a totally 373 | %%misplaced token like |\endcsname| or |\omit| or |\eqno| or |#| appears 374 | %%in horizontal mode, \TeX\ will simply ignore it, after reporting 375 | %%the error. You might enjoy trying to type some really stupid input, 376 | %%just to see what happens. \ (Say `|\tracingall|' first, as explained 377 | %%in Chapter~27, in order to get maximum information.) 378 | \\除上面的以外:如果任何其它 \TeX\ 的原始命令出现在水平模式中, 379 | 那么就给出错误信息, 380 | 并且 \TeX\ 试着按照合理的方式修复它。% 381 | 例如,如果出现了上标或下标,或者出现了其它数学特有的命令, 382 | 那么 \TeX\ 就试着在这个讨厌的记号紧前面插入一个`|$|'; 383 | 它就进入了数学模式。 384 | 385 | \endchapter 386 | 387 | \strut{\rm Otherwise.} % 388 | You may reduce all\/ \kern.5pt{\rm Verticals} into\/ {\rm Horizontals}. 389 | \author JOSEPH ^{MOXON}, {\sl A Tutor to Astronomie and Geographie\/} (1659) 390 | 391 | \bigskip 392 | 393 | \strut\tt!~You can't use `\bslash moveleft' in horizontal mode. 394 | \author \TeX\ (1982) 395 | 396 | \vfill\eject\byebye 397 | -------------------------------------------------------------------------------- /content.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | % % the table of contents 6 | %\titlepage 7 | %\vbox to 8pc{ 8 | %\rightline{\titlefont Contents} 9 | %\vfill} 10 | %^^{Contents of this manual, table} 11 | %\def\rhead{Contents} 12 | %\tenpoint 13 | %\begingroup 14 | %\countdef\counter=255 15 | %\def\diamondleaders{\global\advance\counter by 1 16 | % \ifodd\counter \kern-10pt \fi 17 | % \leaders\hbox to 20pt{\ifodd\counter \kern13pt \else\kern3pt \fi 18 | % .\hss}} 19 | %\baselineskip 15pt plus 5pt 20 | %\def\\#1. #2. #3.{\line{\strut 21 | % \hbox to\parindent{\bf\hbox to 1em{\hss#1}\hss}% 22 | % \rm#2\diamondleaders\hfil\hbox to 2em{\hss#3}}} 23 | %\\1. The Name of the Game. 1. 24 | %\\2. Book Printing versus Ordinary Typing. 3. 25 | %\\3. Controlling \TeX. 7. 26 | %\\4. Fonts of Type. 13. 27 | %\\5. Grouping. 19. 28 | %\\6. Running \TeX. 23. 29 | %\\7. How \TeX\ Reads What You Type. 37. 30 | %\\8. The Characters You Type. 43. 31 | %\\9. \TeX's Roman Fonts. 51. 32 | %\\10. Dimensions. 57. 33 | %\\11. Boxes. 63. 34 | %\\12. Glue. 69. 35 | %\\13. Modes. 85. 36 | %\\14. How \TeX\ Breaks Paragraphs into Lines. 91. 37 | %\\15. How \TeX\ Makes Lines into Pages. 109. 38 | %\\16. Typing Math Formulas. 127. 39 | %\\17. More about Math. 139. 40 | %\\18. Fine Points of Mathematics Typing. 161. 41 | %\\19. Displayed Equations. 185. 42 | %\\20. Definitions (also called Macros). 199. 43 | %\\21. Making Boxes. 221. 44 | %\\22. Alignment. 231. 45 | %\\23. Output Routines. 251. 46 | %\eject 47 | %\vbox to 8pc{} 48 | %\\24. Summary of Vertical Mode. 267. 49 | %\\25. Summary of Horizontal Mode. 285. 50 | %\\26. Summary of Math Mode. 289. 51 | %\\27. Recovery from Errors. 295. 52 | %\null 53 | %\leftline{\indent\bf Appendices} 54 | %\\A. Answers to All the Exercises. 305. 55 | %\\B. Basic Control Sequences. 339. 56 | %\\C. Character Codes. 367. 57 | %\\D. Dirty Tricks. 373. 58 | %\\E. Example Formats. 403. 59 | %\\F. Font Tables. 427. 60 | %\\G. Generating Boxes from Formulas. 441. 61 | %\\H. Hyphenation. 449. 62 | %\\I\hskip 1pt. Index. 457. 63 | %\\J\hskip 1pt. Joining the \TeX\ Community. 483. 64 | %\null % 17 lines so far to balance the 23 on the other page 65 | %\null % 18 66 | %\null % 19 67 | %\null % 20 68 | %\null % 21 69 | %\null % 22 70 | %\null % 23 71 | %\eject 72 | %\endgroup 73 | 74 | % the table of contents 75 | \titlepage 76 | \vbox to 8pc{ 77 | \rightline{\titlefont 目录} 78 | \vfill} 79 | \bookmark{1}{目录} 80 | ^^{Contents of this manual, table} 81 | \def\rhead{目录} 82 | \tenpoint 83 | \begingroup 84 | \countdef\counter=255 85 | \def\diamondleaders{\global\advance\counter by 1 86 | \ifodd\counter \kern-10pt \fi 87 | \leaders\hbox to 20pt{\ifodd\counter \kern13pt \else\kern3pt \fi 88 | .\hss}} 89 | \baselineskip 15pt plus 5pt 90 | \def\\#1. #2. #3.{\line{\strut 91 | \hbox to\parindent{\bf\hbox to 1em{\hss#1}\hss}% 92 | \rm#2\diamondleaders\hfil\hbox to 2em{\hss#3}}} 93 | \\1. 此名有诗意. 1. 94 | \\2. 书籍排版与普通排版. 3. 95 | \\3. 控制系列. 7. 96 | \\4. 字体风格. 12. 97 | \\5. 编组. 19. 98 | \\6. 运行程序. 22. 99 | \\7. 工作原理. 37. 100 | \\8. 字符输入. 43. 101 | \\9. 罗马字体. 51. 102 | \\10. 尺寸. 57. 103 | \\11. 盒子. 63. 104 | \\12. 粘连. 68. 105 | \\13. 模式. 85. 106 | \\14. 分段为行. 91. 107 | \\15. 组行为页. 109. 108 | \\16. 数学公式. 128. 109 | \\17. 数学排版进阶. 141. 110 | \\18. 精致的数学排版. 165. 111 | \\19. 陈列公式. 189. 112 | \\20. 宏定义. 203. 113 | \\21. 盒子制作. 227. 114 | \\22. 对齐阵列. 236. 115 | \\23. 输出例行程序. 258. 116 | \eject 117 | \vbox to 8pc{} 118 | \\24. 垂直模式总结. 275. 119 | \\25. 水平模式总结. 295. 120 | \\26. 数学模式总结. 299. 121 | \\27. 错误修复. 306. 122 | \null 123 | \leftline{\indent\bf 附录} 124 | \\A. 练习答案. 318. 125 | \\B. 基本控制系列. 357. 126 | \\C. 字符编码. 391. 127 | \\D. 诡计多端. 399. 128 | \\E. 版式举例. 437. 129 | \\F. 字体表. 469. 130 | \\G. 公式的盒子. 489. 131 | \\H. 连字算法. 499. 132 | \\I. 索引. 509. 133 | \\J. 加入社团. 535. 134 | 135 | \null % 17 lines so far to balance the 23 on the other page 136 | \null % 18 137 | \null % 19 138 | \null % 20 139 | \null % 21 140 | \null % 22 141 | \null % 23 142 | \eject 143 | \endgroup 144 | \byebye 145 | 146 | -------------------------------------------------------------------------------- /cover.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | \font\auth=cmssdc10 scaled\magstep4 % used only on the title page 6 | \font\elevenbf=cmbx10 scaled\magstephalf % ditto 7 | \font\elevenit=cmti10 scaled\magstephalf % ditto 8 | \font\elevenrm=cmr10 scaled\magstephalf % ditto 9 | \hbox{ } 10 | \special{pdf: bgcolor [ 0.79 0.60 0.31]} 11 | \vskip 1pc 12 | \special{pdf: bc [ 0.27 0.53 0.79 ]} 13 | \line{\hfill\YY{70}特\lower15pt\vbox{\hbox{\YY{50}科}\hbox{\YY{50}可}}爱\hskip15pt\hbox{\YY{50}原本}\hfill}% 14 | %\line{\hfill\auth (The T\kern-10pt\lower13pt\hbox{E}\kern-5pt Xbook)\hfill} 15 | \vskip 1pc 16 | \special{pdf: ec} 17 | \line{\hfill\hbox to 190pt{\YY{20}著者\auth : D. \kern-1pt E. \kern-1pt KNUTH\hfil}\hfill} 18 | \bigskip 19 | \line{\hfill\hbox to 190pt{\YY{20}翻译\auth : xianxian \& zoho\hfil}\hfill} 20 | \vskip 3pc 21 | \def\leftheadline{} 22 | \def\rightheadline{} 23 | %\special{pdf: bc [ 0.79 0.12 0.52 ]} 24 | \special{pdf:image width 348pt height 0in depth 348pt (artwork/ctan_lion.png)} 25 | %\special{pdf: ec} 26 | \vfill 27 | \eject 28 | \def\leftheadline{\hbox to \pagewidth{% 29 | \vbox to 10pt{}% strut to position the baseline 30 | {\tenbf\folio}\hfil% folio to left of text 31 | \rhead% running head flush left 32 | }} 33 | \def\rightheadline{\hbox to \pagewidth{% 34 | \vbox to 10pt{}% strut to position the baseline 35 | \rhead% running head flush right 36 | \hfil{\tenbf\folio}% folio to right of text 37 | }} 38 | 39 | \byebye 40 | -------------------------------------------------------------------------------- /front.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | \special{pdf: bgcolor 1.0} 6 | %\titlepage 7 | %\pageno=-1983 8 | %\line{\cmman The\hfill T\kern-10pt\lower13pt\hbox{E}\kern-5pt Xbook} 9 | %\vfill 10 | %\iffalse 11 | %\rightline{The fine print in the upper right-hand} 12 | %\rightline{corner of each page is a draft of intended} 13 | %\rightline{index entries; it won't appear in the real book.} 14 | %\rightline{Some index entries will be in |typewriter type|} 15 | %\rightline{and/or preceded by {\tt\char`\\} or enclosed in \<$\ldots$>, etc;} 16 | %\rightline{such typographic distinctions aren't shown here.} 17 | %\rightline{An index entry often extends for several pages;} 18 | %\rightline{the actual scope will be determined later.} 19 | %\rightline{Please note things that should be indexed but aren't.} 20 | %\fi 21 | %\eject 22 | % title 23 | \font\auth=cmssdc10 scaled\magstep4 % used only on the title page 24 | \font\elevenbf=cmbx10 scaled\magstephalf % ditto 25 | \font\elevenit=cmti10 scaled\magstephalf % ditto 26 | \font\elevenrm=cmr10 scaled\magstephalf % ditto 27 | \pageno=-1 % the front matter is numbered with roman numerals 28 | %\titlepage 29 | \null\bigskip 30 | \line{\cmman The\hfill T\kern-10pt\lower13pt\hbox{E}\kern-5pt Xbook} 31 | ^^{Knuth, Donald Ervin} 32 | ^^{Bibby, Duane Robert} 33 | \vskip 1pc 34 | \baselineskip 13pt \elevenbf 35 | \halign to\hsize{#\hfil\tabskip 0pt plus 1fil&#\hfil\tabskip0pt\cr 36 | \kern5.5mm\auth DONALD \kern-1pt E. \kern-1pt KNUTH& 37 | \elevenit Stanford University\cr 38 | \special{pdf:image width 170pt height 0in depth 410pt (artwork/cover.png)}\cr 39 | \noalign{\vskip 12pc} 40 | &\elevenit I\kern.7ptllustrations by\cr 41 | &DU\kern-1ptANE BIBBY\cr 42 | \noalign{\vfill} 43 | &\setbox0=\hbox{\manual77}% 44 | \setbox2=\hbox to\wd0{\hss\manual6\hss}% 45 | \raise2.3mm\box2\kern-\wd0\box0\cr % A-W logo 46 | &ADDISON\kern.1em--WESLEY\cr 47 | &PUBLISHING COMP\kern-.13emANY\kern-1.5mm\cr 48 | \noalign{\vskip.5pc \global\elevenrm} 49 | &Reading, Massachusetts\cr 50 | &Menlo Park, California\cr 51 | &New York\cr 52 | &Don Mills, Ontario\cr 53 | &Wokingham, England\cr 54 | &Amsterdam\enspace$\cdot$\enspace Bonn\cr 55 | &Sydney\enspace$\cdot$\enspace Singapore\enspace$\cdot$\enspace Tokyo\cr 56 | &Madrid\enspace$\cdot$\enspace San Juan\cr} 57 | \eject 58 | % copyright 59 | %\titlepage 60 | \eightpoint 61 | \vbox to 8pc{} 62 | \noindent\strut 63 | This manual describes \TeX\ Version 3.0. Some 64 | of the advanced features mentioned here are absent from earlier versions. 65 | \medskip 66 | \noindent 67 | The quotation on page \sesame\ is copyright $\copyright$ 1970 by Sesame 68 | Street, Inc., and used by permission of the Children's Television Workshop. 69 | \medskip 70 | \noindent 71 | \TeX\ is a trademark of the American Mathematical Society. 72 | \medskip 73 | \noindent 74 | {\manual opqrstuq} is a trademark of Addison\kern.1em--Wesley 75 | Publishing Company. 76 | \bigskip\medskip 77 | \noindent 78 | {\bf Library of Congress cataloging in publication data} 79 | \medskip 80 | {\tt\halign{#\hfil\cr 81 | Knuth, Donald Ervin, 1938-\cr 82 | \ \ \ The TeXbook.\cr 83 | \noalign{\medskip} 84 | \ \ \ (Computers \& Typesetting ; A)\cr 85 | \ \ \ Includes index.\cr 86 | \ \ \ 1.~TeX (Computer system).\ \ 2.~Computerized\cr 87 | typesetting.\ \ 3.~Mathematics printing.\ \ I.~Title.\cr 88 | II.\ Series:\ \ Knuth, Donald Ervin, 1938-\ \ \ \ .\cr 89 | Computers \& typesetting ; A.\cr 90 | Z253.4.T47K58\ \ 1986\ \ \ \ \ \ \ \ \ 686.2\char13 2544\ \ \ \ \ \ 85-30845\cr 91 | ISBN 0-201-13447-0\cr 92 | ISBN 0-201-13448-9 (soft)\cr}} 93 | \vfill 94 | \noindent 95 | %{\sl \kern-1pt First hardcover edition, January 1986} 96 | {\sl \kern-1pt Twentieth printing, revised, May 1991} % paperback 97 | %{\sl \kern-1pt Eleventh printing, revised, May 1991} % hardcover 98 | \smallskip 99 | \noindent 100 | Copyright $\copyright$ 1984, 1986 by the American Mathematical Society 101 | \smallskip 102 | \noindent 103 | This book is published jointly by the American Mathematical Society 104 | and Addison\kern.1em--Wesley Publishing Company. 105 | All rights reserved. No part of this publication may be reproduced, stored in 106 | a retrieval system, or transmitted, in any form or by any means, 107 | electronic, mechanical, photocopying, recording, or otherwise, without 108 | the prior written permission of the publishers. Printed in the United 109 | States of America. % Published simultaneously in Canada. 110 | \medskip 111 | \noindent 112 | ISBN 0-201-13448-9\par % paperback 113 | %ISBN 0-201-13447-0\par % hardcover 114 | \noindent 115 | TUVWXYZ--DO--97654321 % paperback 116 | %KLMNOPQ--DO--97654321 % hardcover 117 | \eject 118 | % dedication 119 | \titlepage 120 | \vbox to 8pc{} 121 | \rightline{\strut\eightssi To Jill:} 122 | \vskip2pt 123 | \rightline{\eightssi For your books and brochures} 124 | \vfill 125 | \eject 126 | % blank page 127 | \titlepage 128 | \null\vfill 129 | \eject 130 | 131 | \byebye 132 | 133 | -------------------------------------------------------------------------------- /letter1.tex: -------------------------------------------------------------------------------- 1 | \magnification=\magstep1 2 | \input letterformat 3 | 4 | \rjdletterhead % (see the output on the next page) 5 | 6 | \address 7 | Prof.~Brian~K. Reid 8 | Department of Electrical Engineering 9 | Stanford University 10 | Stanford, CA 94305 11 | 12 | \body 13 | Dear Prof.~Reid: 14 | 15 | I understand that you are having difficulties with 16 | Alka-Seltzer tablets. 17 | Since there are 25~pills 18 | per bottle, while the manufacturer's directions 19 | recommend ``plop,~plop, fizz,~fizz,'' my colleagues 20 | tell me that you have accumulated a substantial 21 | number of bottles in which there is one tablet 22 | left. % (See the 1978 SCRIBE User Manual, page 90.) 23 | 24 | At present I am engaged in research on the potential 25 | applications of isolated analgesics. If you would 26 | be so kind as to donate your Alka-Seltzer collection 27 | to our project, I would be more than happy to send 28 | you preprints of any progress reports that we may 29 | publish concerning this critical problem. 30 | 31 | \closing 32 | Sincerely, 33 | R. J. Drofnats 34 | Professor 35 | 36 | \annotations 37 | RJD/dek 38 | cc: {\sl The \TeX book} 39 | 40 | \ps 41 | P. S. \ If you like, I will check into the 42 | possibility that your donation and the meals that 43 | you have been eating might be tax-deductible, in 44 | connection with our research. 45 | \endletter 46 | \makelabel 47 | \end 48 | -------------------------------------------------------------------------------- /letter2.tex: -------------------------------------------------------------------------------- 1 | \magnification=\magstep1 2 | \input letterformat 3 | 4 | \rjdletterhead % (see the output on the next page) 5 | 6 | \address 7 | Prof.~Brian~K. Reid 8 | Department of Electrical Engineering 9 | Stanford University 10 | Stanford, CA 94305 11 | 12 | \body 13 | Dear Prof.~Reid: 14 | 15 | I understand that you are having difficulties with 16 | Alka-Seltzer tablets. 17 | Since there are 25~pills 18 | per bottle, while the manufacturer's directions 19 | recommend ``plop,~plop, fizz,~fizz,'' my colleagues 20 | tell me that you have accumulated a substantial 21 | number of bottles in which there is one tablet 22 | left. % (See the 1978 SCRIBE User Manual, page 90.) 23 | 24 | At present I am engaged in research on the potential 25 | applications of isolated analgesics. If you would 26 | be so kind as to donate your Alka-Seltzer collection 27 | to our project, I would be more than happy to send 28 | you preprints of any progress reports that we may 29 | publish concerning this critical problem. 30 | 31 | At present I am engaged in research on the potential 32 | applications of isolated analgesics. If you would 33 | be so kind as to donate your Alka-Seltzer collection 34 | to our project, I would be more than happy to send 35 | you preprints of any progress reports that we may 36 | publish concerning this critical problem. 37 | 38 | At present I am engaged in research on the potential 39 | applications of isolated analgesics. If you would 40 | be so kind as to donate your Alka-Seltzer collection 41 | to our project, I would be more than happy to send 42 | you preprints of any progress reports that we may 43 | publish concerning this critical problem. 44 | 45 | At present I am engaged in research on the potential 46 | applications of isolated analgesics. If you would 47 | be so kind as to donate your Alka-Seltzer collection 48 | to our project, I would be more than happy to send 49 | you preprints of any progress reports that we may 50 | publish concerning this critical problem. 51 | 52 | At present I am engaged in research on the potential 53 | applications of isolated analgesics. If you would 54 | be so kind as to donate your Alka-Seltzer collection 55 | to our project, I would be more than happy to send 56 | you preprints of any progress reports that we may 57 | publish concerning this critical problem. 58 | 59 | \closing 60 | Sincerely, 61 | R. J. Drofnats 62 | Professor 63 | 64 | \annotations 65 | RJD/dek 66 | cc: {\sl The \TeX book} 67 | 68 | \ps 69 | P. S. \ If you like, I will check into the 70 | possibility that your donation and the meals that 71 | you have been eating might be tax-deductible, in 72 | connection with our research. 73 | \endletter 74 | \makelabel 75 | \end 76 | -------------------------------------------------------------------------------- /letterformat.tex: -------------------------------------------------------------------------------- 1 | % This macro file is for business letters 2 | 3 | \def\today{\ifcase\month\or 4 | January\or February\or March\or April\or May\or June\or 5 | July\or August\or September\or October\or November\or December\fi 6 | \space\number\day, \number\year} 7 | 8 | \raggedbottom 9 | \interlinepenalty=1000 10 | \hsize=6.25truein 11 | \voffset=24pt 12 | \advance\vsize by-\voffset 13 | \parindent=0pt 14 | \parskip=0pt 15 | \nopagenumbers 16 | \headline={\ifnum\pageno>1 17 | \tenrm To \addressee\hfil\today\hfil Page \folio 18 | \else\hfil\fi} 19 | 20 | \def\beginlinemode{\endmode 21 | \begingroup\obeylines\def\endmode{\par\endgroup}} 22 | \def\beginparmode{\endmode 23 | \begingroup\parskip=\medskipamount \def\endmode{\par\endgroup}} 24 | \let\endmode=\par 25 | \def\endletter{\endmode\vfill\supereject} 26 | 27 | \newdimen\longindentation \longindentation=4truein 28 | \newbox\theaddress 29 | \def\address{\beginlinemode\getaddress} 30 | {\obeylines\gdef\getaddress #1 31 | #2 32 | {#1\gdef\addressee{#2}% 33 | \global\setbox\theaddress=\vbox\bgroup\raggedright% 34 | \hsize=\longindentation \everypar{\hangindent2em}#2 35 | \def\endmode{\egroup\endgroup \copy\theaddress \bigskip}}} 36 | 37 | \def\body{\beginparmode} 38 | \def\closing{\beginlinemode\getclosing} 39 | {\obeylines\gdef\getclosing #1 40 | #2 41 | {#1\nobreak\bigskip \leftskip=\longindentation #2 42 | \nobreak\bigskip\bigskip\bigskip % space for signature 43 | \def 44 | {\endgraf\nobreak}}} 45 | \def\annotations{\beginlinemode\def\par{\endgraf\nobreak}\obeylines\par} 46 | \def\ps{\beginparmode\nobreak 47 | \interlinepenalty5000\def\par{\endgraf\penalty5000}} 48 | 49 | \def\up#1{\leavevmode \raise.16ex\hbox{#1}} 50 | \font\smallheadfont=cmr8 at 8truept 51 | \font\largeheadfont=cmdunh10 at 14.4truept 52 | \font\logofont=manfnt at 14.4truept 53 | \def\rjdletterhead{ 54 | \def\sendingaddress{R. J. DROFNATS, F.T.U.G.\par 55 | PROFESSOR OF FARM ECOLOGY\par 56 | TEX.RJD @ SU-SCORE.ARPA\par 57 | \up[415\up]\thinspace 497-4975\par} 58 | \def\returnaddress{R. J. Drofnats, Dept.~of Farm Ecology\par 59 | The University of St.~Anford\par 60 | P. O. Box 1009, Haga Alto, CA 94321 USA} 61 | \letterhead} 62 | \def\letterhead{\pageno=1 \def\addressee{} \univletterhead 63 | {\leftskip=\longindentation 64 | {\baselineskip9truept\smallheadfont\sendingaddress} 65 | \bigskip\bigskip\rm\today\bigskip}} 66 | \def\univletterhead{\vglue-\voffset 67 | \hbox{\hbox to\longindentation{\raise4truemm\hbox{\logofont 68 | \kern2truept X\kern-1.667truept 69 | \lower2truept\hbox{X}\kern-1.667truept X}\hfil 70 | \largeheadfont The University of St.~Anford\hfil}% 71 | \kern-\longindentation 72 | \vbox{\smallheadfont\baselineskip9truept 73 | \leftskip=\longindentation BOX 1009\par HAGA ALTO, CA 94321}} 74 | \vskip2truept\hrule\vskip4truept } 75 | \def\makelabel{\endletter\hbox{\vrule 76 | \vbox{\hrule \kern6truept 77 | \hbox{\kern6truept\vbox to 2truein{\hsize=\longindentation 78 | \smallheadfont\baselineskip9truept\returnaddress 79 | \vfill\moveright 2truein\copy\theaddress\vfill}% 80 | \kern6truept}\kern6truept\hrule}\vrule} 81 | \pageno=0\vfill\eject} 82 | -------------------------------------------------------------------------------- /macros.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | %% standalone subfiles 4 | 5 | \let\byebye = \relax 6 | \csname loaded\endcsname 7 | \let\loaded = \endinput 8 | \let\byebye = \bye 9 | 10 | %% macros for The TeXbook 11 | 12 | \input manmac 13 | 14 | %% compatable with manmac.tex 15 | 16 | \catcode `\^=7 17 | 18 | %% font definitions 19 | 20 | \def\song{SimSun} 21 | \def\hei{SimHei} 22 | \def\kai{KaiTi} 23 | \def\fang{FangSong} 24 | \def\yuan{YouYuan:embolden=3;extend=0.8} 25 | %\def\yuan{FZY3JW--GB1-0:embolden=3;extend=0.95} 26 | % 27 | \input xeCJK-base 28 | \xeCJKenablechecksingle 29 | \normalspacedchars{-} 30 | % 31 | \def\letfont{\let\CJKfont} 32 | \font\zhtenrm="\song" at 10pt 33 | \let\CJKfont\zhtenrm 34 | % 35 | \def\setecfont#1#2#3#4{ 36 | \expandafter\font\csname en#1\endcsname = #2 at #4pt 37 | \expandafter\font\csname zh#1\endcsname = "#3" at #4pt 38 | \expandafter\def\csname#1\endcsname{\csname en#1\endcsname\expandafter\letfont\csname zh#1\endcsname} 39 | } 40 | 41 | \setecfont{titlefont}{cmssdc10}{\yuan}{40} 42 | % 43 | \setecfont{tenrm}{cmr10}{\song}{10} 44 | \setecfont{ninerm}{cmr9}{\song}{9} 45 | \setecfont{eightrm}{cmr8}{\song}{8} 46 | \setecfont{sevenrm}{cmr7}{\song}{7} 47 | \setecfont{sixrm}{cmr6}{\song}{6} 48 | \setecfont{fiverm}{cmr5}{\song}{5} 49 | % 50 | \setecfont{tenbf}{cmbx10}{\hei}{10} 51 | \setecfont{ninebf}{cmbx9}{\hei}{9} 52 | \setecfont{eightbf}{cmbx8}{\hei}{8} 53 | \setecfont{sevenbf}{cmbx7}{\hei}{7} 54 | \setecfont{sixbf}{cmbx6}{\hei}{6} 55 | \setecfont{fivebf}{cmbx5}{\hei}{5} 56 | % 57 | \setecfont{tentt}{cmtt10}{\fang}{10} 58 | \setecfont{ninett}{cmtt9}{\fang}{9} 59 | \setecfont{eighttt}{cmtt8}{\fang}{8} 60 | \setecfont{seventt}{cmtt7}{\fang}{7} 61 | \setecfont{sixtt}{cmtt6}{\fang}{6} 62 | \setecfont{fivett}{cmtt5}{\fang}{5} 63 | % 64 | \setecfont{tensl}{cmsl10}{\kai}{10} 65 | \setecfont{ninesl}{cmsl9}{\kai}{9} 66 | \setecfont{eightsl}{cmsl8}{\kai}{8} 67 | \setecfont{sevensl}{cmsl7}{\kai}{7} 68 | \setecfont{sixsl}{cmsl6}{\kai}{6} 69 | \setecfont{fivesl}{cmsl5}{\kai}{5} 70 | % 71 | \setecfont{tenit}{cmti10}{\kai}{10} 72 | \setecfont{nineit}{cmti9}{\kai}{9} 73 | \setecfont{eightit}{cmti8}{\kai}{8} 74 | \setecfont{sevenit}{cmti7}{\kai}{7} 75 | \setecfont{sixit}{cmti6}{\kai}{6} 76 | \setecfont{fiveit}{cmti5}{\kai}{5} 77 | 78 | \def\ST#1{\font\tempfont="\song" at #1pt\letfont\tempfont} 79 | \def\HT#1{\font\tempfont="\hei" at #1pt\letfont\tempfont} 80 | \def\KT#1{\font\tempfont="\kai" at #1pt\letfont\tempfont} 81 | \def\FS#1{\font\tempfont="\fang" at #1pt\letfont\tempfont} 82 | \def\YY#1{\font\tempfont="\yuan" at #1pt\letfont\tempfont} 83 | 84 | %% some redefinition of manmac.tex 85 | 86 | \font\titlefonta=cmssdc10 at 20pt 87 | 88 | \def\tenpoint{\def\rm{\fam0\tenrm}% 89 | \textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm 90 | \textfont1=\teni \scriptfont1=\seveni \scriptscriptfont1=\fivei 91 | \textfont2=\tensy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy 92 | \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex 93 | \def\it{\fam\itfam\tenit}% 94 | \textfont\itfam=\tenit 95 | \def\sl{\fam\slfam\tensl}% 96 | \textfont\slfam=\tensl 97 | \def\bf{\fam\bffam\tenbf}% 98 | \textfont\bffam=\tenbf \scriptfont\bffam=\sevenbf 99 | \scriptscriptfont\bffam=\fivebf 100 | \def\tt{\fam\ttfam\tentt}% 101 | \textfont\ttfam=\tentt 102 | \tt \ttglue=.5em plus.25em minus.15em 103 | \normalbaselineskip=15pt 104 | \def\MF{{\manual META}\-{\manual FONT}}% 105 | \let\sc=\eightrm 106 | \let\big=\tenbig 107 | \setbox\strutbox=\hbox{\vrule height8.5pt depth3.5pt width\z@}% 108 | \normalbaselines\rm} 109 | % 110 | \def\ninepoint{\def\rm{\fam0\ninerm}% 111 | \textfont0=\ninerm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm 112 | \textfont1=\ninei \scriptfont1=\sixi \scriptscriptfont1=\fivei 113 | \textfont2=\ninesy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy 114 | \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex 115 | \def\it{\fam\itfam\nineit}% 116 | \textfont\itfam=\nineit 117 | \def\sl{\fam\slfam\ninesl}% 118 | \textfont\slfam=\ninesl 119 | \def\bf{\fam\bffam\ninebf}% 120 | \textfont\bffam=\ninebf \scriptfont\bffam=\sixbf 121 | \scriptscriptfont\bffam=\fivebf 122 | \def\tt{\fam\ttfam\ninett}% 123 | \textfont\ttfam=\ninett 124 | \tt \ttglue=.5em plus.25em minus.15em 125 | \normalbaselineskip=14pt 126 | \def\MF{{\manual hijk}\-{\manual lmnj}}% 127 | \let\sc=\sevenrm 128 | \let\big=\ninebig 129 | \setbox\strutbox=\hbox{\vrule height8pt depth3pt width\z@}% 130 | \normalbaselines\rm 131 | \ST{9}} 132 | % 133 | \def\eightpoint{\def\rm{\fam0\eightrm}% 134 | \textfont0=\eightrm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm 135 | \textfont1=\eighti \scriptfont1=\sixi \scriptscriptfont1=\fivei 136 | \textfont2=\eightsy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy 137 | \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex 138 | \def\it{\fam\itfam\eightit}% 139 | \textfont\itfam=\eightit 140 | \def\sl{\fam\slfam\eightsl}% 141 | \textfont\slfam=\eightsl 142 | \def\bf{\fam\bffam\eightbf}% 143 | \textfont\bffam=\eightbf \scriptfont\bffam=\sixbf 144 | \scriptscriptfont\bffam=\fivebf 145 | \def\tt{\fam\ttfam\eighttt}% 146 | \textfont\ttfam=\eighttt 147 | \tt \ttglue=.5em plus.25em minus.15em 148 | \normalbaselineskip=12pt 149 | \def\MF{{\manual opqr}\-{\manual stuq}}% 150 | \let\sc=\sixrm 151 | \let\big=\eightbig 152 | \setbox\strutbox=\hbox{\vrule height7pt depth2pt width\z@}% 153 | \normalbaselines\rm} 154 | 155 | \def\leftheadline{\hbox to \pagewidth{% 156 | \vbox to 10pt{}% strut to position the baseline 157 | {\tenbf\folio}\hfil% folio to left of text 158 | \rhead% running head flush left 159 | }} 160 | \def\rightheadline{\hbox to \pagewidth{% 161 | \vbox to 10pt{}% strut to position the baseline 162 | \rhead% running head flush right 163 | \hfil{\tenbf\folio}% folio to right of text 164 | }} 165 | 166 | \def\beginchapter#1 #2#3. #4\par{\global\exno=0 167 | \subsecno=0 168 | \def\chapno{#2#3} 169 | % \ifodd\pageno 170 | % \errmessage{You had too much text on that last page; I'm backing up} 171 | % \advance\pageno by-1 \fi 172 | \titlepage 173 | \def\\{ } % \\'s in the title will be treated as spaces 174 | \message{#1 #2#3:} % show the chapter title on the terminal 175 | \bookmark{1}{#2#3. #4} 176 | \def\MF{{\manual 89:;<=>:}} % slant the logo 177 | \xdef\rhead{#2#3: #4\unskip} 178 | {\def\TeX{T\kern-.2em\lower.5ex\hbox{E}\kern-.06em X} 179 | \def\MF{{\vbox to30pt{}\manual ()*+,-.*}} 180 | \def\\{#3} 181 | \ifx\empty\\ \rightline{\inchhigh #2\kern-.04em} 182 | \else\rightline{\inchhigh #2\kern-.06em#3\kern-.04em}\fi 183 | \vskip 1.75pc 184 | \baselineskip 36pt \lineskiplimit \titlelsl \lineskip 12pt 185 | \let\\=\cr % now the \\'s are line dividers 186 | \halign{\line{\titlefont\hfil##}\\#4\unskip\\} 187 | \vskip 4pc 188 | \special{pdf:image width 348pt height 0in depth 348pt (artwork/#1\chapno.png)} 189 | \vfill\eject} % output the chapter title page 190 | \tenpoint} 191 | 192 | \outer\def\subsection#1. {\medbreak\advance\subsecno by 1 193 | \bookmark{2}{\the\subsecno. #1} 194 | \noindent{\bf \the\subsecno.\enspace#1.\enspace}} 195 | 196 | \def\beginlines{\par\begingroup\baselineskip=12pt\nobreak\medskip\parindent\z@ \obeylines 197 | \hrule\kern1pt\nobreak \everypar{\strut}} 198 | 199 | \def\pdfdestx#1{% 200 | \special{pdf:dest (#1) [@thispage /FitH @ypos]}% 201 | } 202 | \def\pdflinkx#1#2{% 203 | \special{pdf:bann << /Type/Annot/Subtype/Link /Border [0 0 0] /A << /S/GoTo/D (#1) >> >>}% 204 | \special{pdf:bc [0 0 1]}#2\special{pdf:ec}% 205 | \special{pdf:eann}% 206 | } 207 | \def\pdfexno#1#2{\pdfdestx{ex-#1-#2}\pdflinkx{ans-#1-#2}{#1.#2}} 208 | \def\pdfansno#1#2{\pdfdestx{ans-#1-#2}\pdflinkx{ex-#1-#2}{#1.#2.}} 209 | 210 | \outer\def\exercise{\medbreak 211 | \global\advance\exno by 1 212 | \noindent\llap{\manual\char'170\rm\kern.15em}% triangle in margin 213 | {\ninebf 练习~\bf\pdfexno{\chapno}{\the\exno}}\par\nobreak\noindent} 214 | \def\dexercise{\global\advance\exno by 1 215 | \llap{\manual\char'170\rm\kern.15em}% triangle in indented space 216 | {\eightbf 练习~\bf\pdfexno{\chapno}{\the\exno}}\hfil\break} 217 | 218 | \def\ansno#1.#2:{\medbreak\noindent 219 | \hbox to\parindent{\bf\hss\pdfansno{#1}{#2}\enspace}\ignorespaces} 220 | 221 | %\let\oldanswer = \answer 222 | %\outer\def\answer{\par\noindent\hbox to\parindent{\ninebf 答案\hfil\quad}\ninepoint} 223 | 224 | \proofmodefalse % this should be false when making camera-ready copy 225 | 226 | \def\frac#1/#2{\leavevmode\kern.1em 227 | \raise.5ex\hbox{\the\scriptfont0 #1}\kern-.1em 228 | /\kern-.15em\lower.25ex\hbox{\the\scriptfont0 #2}} 229 | 230 | %% from old bookall.tex 231 | \baselineskip=14pt 232 | \lineskip=2pt 233 | \tenpoint 234 | 235 | %% paper dimensions 236 | 237 | \pdfpagewidth=7in \pdfpageheight=10in 238 | 239 | %% pdf bookmarks 240 | 241 | \def\gbmark#1{\special{pdf: out 1 << /Title /Dest [ @thispage /FitH @ypos ] >>}} 242 | 243 | \special{pdf: docview << /PageMode /UseOutlines >>} 244 | \def\bookmark#1#2{% 245 | \begingroup% 246 | \def\linebreak{}\def\TeX{TeX}\def\noindent{}\def\\{}\def\hfil{}\def\quad{}% 247 | \special{pdf:out #1 << /Title (#2) /Dest [ @thispage /FitH @ypos ] >>}% 248 | \endgroup% 249 | } 250 | 251 | %% add original page numbers 252 | 253 | \newcount\origpageno 254 | 255 | \def\strutdepth{\dp\strutbox} 256 | \def\1{\strut\vadjust{\kern-\strutdepth\pagenotext}% 257 | \pdfdestx{page\the\origpageno}\global\advance\origpageno by 1} 258 | \def\pagenotext{\vtop to \strutdepth{ 259 | \baselineskip\strutdepth\vss\llap{\tt[\the\origpageno]\qquad}\null}} 260 | 261 | %% compatable with manmac.tex 262 | 263 | \catcode `\^=13 264 | -------------------------------------------------------------------------------- /preface.tex: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | 3 | \input macros 4 | 5 | % % the preface 6 | %\titlepage 7 | %\def\rhead{Preface} 8 | %\vbox to 8pc{ 9 | %\rightline{\titlefont Preface}\vss} 10 | %{\topskip 9pc % this makes equal sinkage throughout the Preface 11 | %\vskip-\parskip 12 | %\tenpoint 13 | %\noindent\hang\hangafter-2 14 | %\smash{\lower12pt\hbox to 0pt{\hskip-\hangindent\cmman G\hfill}}\hskip-16pt 15 | %{\sc ENTLE} R{\sc EADER}: \strut This is a handbook about 16 | %\TeX, a new typesetting system intended for the creation 17 | %of beautiful books---and especially for books that contain a lot of 18 | %mathematics. By preparing a manuscript in \TeX\ format, you will be 19 | %telling a computer exactly how the manuscript is to be transformed into 20 | %pages whose typographic quality is comparable to that of the world's 21 | %finest printers; yet you won't need to do much more work than would be 22 | %involved if you were simply typing the manuscript on an ordinary 23 | %typewriter. In fact, your total work will probably be significantly less, 24 | %if you consider the time it ordinarily takes to revise a typewritten manuscript, 25 | %since computer text files are so easy to change and to reprocess. \ 26 | %(If such claims sound too good to be true, keep in mind that they were made 27 | %by \TeX's designer, on a day when \TeX\ happened to 28 | %be working, so the statements may be biased; but read on anyway.) 29 | % the preface 30 | \titlepage 31 | \def\rhead{前言} 32 | \vbox to 8pc{ 33 | \rightline{\titlefont 前言}\vss} 34 | \bookmark{1}{前言} 35 | {\topskip 9pc % this makes equal sinkage throughout the Preface 36 | \vskip-\parskip 37 | \tenpoint 38 | \noindent\hang\hangafter-2 39 | \smash{\lower15pt\hbox to 0pt{\hskip-\hangindent\KT{28}致\hfill}}% 40 | {\KT{10}尊敬的读者}:这是一本关于 \TeX\ 的指南。\TeX\ 是一款为了% 41 | 制作精美的书籍——特别是包含了大量数学内容的书籍——而设计的新的排版系统。 42 | 用 \TeX\ 的格式准备好书稿后,你就准确地告诉了计算机怎样把它变成书页, 43 | 而得到的排版质量可以与世界上最好的印刷工人相媲美; 44 | 但是你所做的工作仅仅相当于在普通打字机上把书稿直接输入进去。 45 | 实际上,如果你算上通常校订打印稿所花费的时间,那么你整个的工作量可能更少, 46 | 这是因为计算机的文本文件修改和再处理是相当容易的。% 47 | (如果这样的好话听起来不像真的,那么记住这是 \TeX\ 设计者在某天 \TeX 48 | 恰巧奏效时所说的,所以这些说法可能有失公允;但是还请继续看下去。) 49 | 50 | %This manual is intended for people who have never used \TeX\ before, as 51 | %well as for experienced \TeX\ hackers. In other words, it's supposed to 52 | %be a panacea that satisfies everybody, at the risk of satisfying nobody. 53 | %Everything you need to know about \TeX\ is explained 54 | %here somewhere, and so are a lot of things that most users don't care about. 55 | %If you are preparing a simple manuscript, you won't need to 56 | %learn much about \TeX\ at all; on the other hand, some 57 | %things that go into the printing of technical books are inherently 58 | %difficult, and if you wish to achieve more complex effects you 59 | %will want to penetrate some of \TeX's darker corners. In order 60 | %to make it possible for many types of users to read this manual 61 | %effectively, a special sign is used to designate material that is 62 | %for wizards only: When the symbol 63 | %$$\vbox{\hbox{\dbend}\vskip 11pt}$$ 64 | %appears at the beginning of a paragraph, it warns of a ``^{dangerous bend}'' 65 | %in the train of thought; don't read the paragraph unless you need to. 66 | %Brave and experienced drivers at the controls of \TeX\ will gradually enter 67 | %more and more of these hazardous areas, but for most applications the 68 | %details won't matter. 69 | 这个手册是为以前从未使用过 \TeX\ 以及有经验的 \TeX\ 高手所准备的。% 70 | 换句话说,它应该是满足所有人需要的万灵丹,当然也有可能谁都满足不了。% 71 | 你需要知道的 \TeX\ 的每个细节都写在本书的某个地方,并且因此许多东西是% 72 | 大多数用户所不关心的。% 73 | 如果你正在准备一个简单的手稿,那么就根本不需要知道太多的 \TeX; % 74 | 另一方面,某些排版专业书籍的技术本来就很难,而如果你想得到更复杂的% 75 | 效果,就应该参透 \TeX\ 的某些鲜为人知的知识。% 76 | 为了使不同的用户能高效地阅读本手册,我们用一个特殊的标志来标记那些只面向% 77 | 高手的内容:% 78 | 当在某段的开头出现符号 79 | $$\vbox{\hbox{\dbend}\vskip 11pt}$$ 80 | \noindent 时,它是思路上``危险转弯''的警告;% 81 | 如果你不需要,就别去看它。% 82 | 在驾驭 \TeX\ 方面勇敢且有经验的高手可逐渐地进入这些危险的区域,% 83 | 但是对大多数应用而言,这些细节是无关紧要的。 84 | 85 | %All that you really ought to know, before reading on, is how to get a 86 | %file of text into your computer using a standard editing program. This 87 | %manual explains what that file ought to look like so that \TeX\ will 88 | %understand it, but basic computer usage is not explained here. 89 | %Some previous experience with technical typing will be quite helpful 90 | %if you plan to do heavily mathematical work with \TeX, although it 91 | %is not absolutely necessary. \TeX\ will do most of the necessary 92 | %formatting of equations automatically; but users with more experience 93 | %will be able to obtain better results, since there are so many ways 94 | %to deal with formulas. 95 | 在继续阅读之前,所有你真正应该知道的是怎样在计算机上用标准的编辑器% 96 | 得到一个文本文件。% 97 | 这个手册说明了什么样的文件 \TeX\ 才能识别,但是计算机的基本用法这里没有。% 98 | 如果你打算用 \TeX\ 完成繁重的数学排版工作,已有的科技排版经验将会很有帮助, 99 | 尽管这些经验并非必须。 100 | \TeX\ 将自动完成大部分必要的公式编排;% 101 | 但是经验丰富的用户可得到更好的效果,因为可以用许多种方法来编排公式。 102 | 103 | %Some of the paragraphs in this manual are so esoteric that they are rated 104 | %$$\vcenter{\hbox{\dbend\kern1pt\dbend}\vskip 11pt}\;;$$ 105 | %everything that was said about single dangerous-bend signs goes double 106 | %for these. You should probably have at least a month's experience with 107 | %\TeX\ before you attempt to fathom such doubly dangerous depths 108 | %of the system; in fact, most people will never need to know \TeX\ 109 | %in this much detail, even if they use it every day. After all, it's 110 | %possible to drive a car without knowing how the engine works. 111 | %Yet the whole story is here in case you're curious. \ (About \TeX, not cars.) 112 | 本手册中,有些段落深奥到了 113 | $$\vcenter{\hbox{\dbend\kern1pt\dbend}\vskip 11pt}\;;$$ 114 | 对它们,单个危险标记的所有忠告都要加倍。% 115 | 在你试图进入系统的如此双重危险的部分前,大概应该至少使用一个月的 \TeX; % 116 | 实际上,大多数用户从不需要这么详细地了解 \TeX\ ——即使他们每天都用。% 117 | 毕竟,不知道发动机怎样工作也可以开汽车。% 118 | 但是,如果你爱钻研,那么所有东西都在这里。(当然是关于 \TeX\ 的,而不是关于汽车的。) 119 | 120 | %The reason for such different levels of complexity is that people change 121 | %as they grow accustomed to any powerful tool. When you first try to use \TeX, 122 | %you'll find that some parts of it are very easy, while other things will take 123 | %some getting used to. A day or so later, after you have successfully typeset a 124 | %few pages, you'll be a different person; the concepts that used to bother you 125 | %will now seem natural, and you'll be able to picture the final result in 126 | %your mind before it comes out of the machine. But you'll probably run into 127 | %challenges of a different kind. After another week your perspective will 128 | %change again, and you'll grow in yet another way; and so on. As years go by, 129 | %you might become involved with many different kinds of typesetting; and 130 | %you'll find that your usage of \TeX\ will keep changing as your experience 131 | %builds. That's the way it is with any powerful tool: There's always more 132 | %to learn, and there are always better ways to do what you've done before. 133 | %At every stage in the development you'll want a slightly different sort of 134 | %manual. You may even want to write one yourself. By paying attention to 135 | %the dangerous bend signs in this book you'll be better able to focus on 136 | %the level that interests you at a particular time. 137 | 设置这样不同的复杂等级的原因在于随着人们不断熟悉这个强大的工具,他们自己也在\hbox{改变。}% 138 | 当你首次使用 \TeX\ 时,会发现它的某些东西非常简单,而其它的东西就得花些功夫。% 139 | 一天以后,当你能排版几页之后,你就进了一步;以前困扰你的概念现在看起来就是简单自然的,% 140 | 并且你能在机器得出结果前在脑海中勾画出最后的结果。% 141 | 但是你可能陷入另一种挑战。% 142 | 再过一个星期,你的看法就又变了,而且进入另外一个方面;等等。% 143 | 数年过去后,你可能掌握了许多不同的排版方式中;% 144 | 并且发现随着经验的丰富,\TeX\ 的用法也在不断变换。% 145 | 这就是工具之所以强大的原因:总有更多的东西需要学习,并且总有更好的方法来处理% 146 | 你以前的工作。% 147 | 在每个发展阶段,你都希望有一个稍微不同的手册,% 148 | 可能甚至希望亲自写一本。% 149 | 只要留意本书的危险标记,你就能在特定的阶段更好地把精力集中在感兴趣的地方。 150 | 151 | %Computer system manuals usually make dull reading, but take heart: 152 | %This one contains {\sc ^{JOKES}} every once in a while, so you might actually 153 | %enjoy reading it. \ (However, most of the jokes can only be appreciated 154 | %properly if you understand a technical point that is being made---so 155 | %read {\sl carefully}.) 156 | 计算机系统手册一般读起来比较乏味,但是振作起来:% 157 | 本手册偶尔给你几个笑话,所以你实际上可能喜欢读一读。% 158 | (但是,只有你理解了所用的技术要领,大多数笑话才能真正被欣赏——% 159 | 所以要{\KT{10}仔细}点啊。) 160 | 161 | %Another noteworthy characteristic of this manual is that it doesn't 162 | %always tell the ^{truth}. When certain concepts of \TeX\ are introduced 163 | %informally, general rules will be stated; afterwards you will find that the 164 | %rules aren't strictly true. In general, the later chapters contain more 165 | %reliable information than the earlier ones do. The author feels that this 166 | %technique of deliberate lying will actually make it easier for you to 167 | %learn the ideas. Once you understand a simple but false rule, it will not 168 | %be hard to supplement that rule with its exceptions. 169 | 本手册的另一个值得注意的特征是,它并不总是那么确切。% 170 | 当非正式地引入 \TeX\ 的某些概念时,我们给出大致的规则;% 171 | 在后面,你会发现这些规则并不严格正确。% 172 | 一般地,后面的章节比前面的章节所描述的更确切。% 173 | 作者感到,这种善意的谎言实际上使你更容易接受这些概念。% 174 | 一旦你吃透了一个明显错误的规则,那么不难把那个规则的例外情形补充上。 175 | 176 | %In order to help you internalize what you're reading, 177 | %{\sc ^{EXERCISES}} are sprinkled through this manual. It is generally intended 178 | %that every reader should try every exercise, except for questions that appear 179 | %in the ``dangerous bend'' areas. If you can't solve a problem, you 180 | %can always look up the answer. 181 | %But please, try first to solve it by yourself; then you'll learn more 182 | %and you'll learn faster. Furthermore, if you think you do know the solution, 183 | %you should turn to Appendix~A and check it out, just to make sure. 184 | 为了帮助你吸收所学的知识,大量的练习都散布在整个手册中。% 185 | 一般希望每个读者把每个练习都做一下,当然除了出现在``危险''部分的问题。% 186 | 如果你做不出哪个问题,那么可以去查阅\hbox{答案。}% 187 | 但是务必请先自己做一下;那么你会更快地学会更多的知识。% 188 | 还有,如果你认为的确得到了答案,那么应当到附录 A 去对一下答案,仅仅是确认一下。 189 | 190 | %The \TeX\ language described in this book is similar to the author's first 191 | %attempt at a document formatting language, but the new system differs 192 | %from the old~one in literally thousands of details. Both languages have 193 | %been called \TeX; but henceforth the old language should be called 194 | %\TeX78, and its use should rapidly fade away. Let's keep the name \TeX\ 195 | %for the language described here, since it is so much better, and since 196 | %it is not going to change any more. ^^{TeX78} 197 | 在本书中所用的 \TeX\ 代码类似于作者第一次在文档格式代码的尝试,% 198 | 但是新系统与旧系统在差不多几千个细节上有差别。% 199 | 两种代码都叫做 \TeX; 但是以后旧代码应该称为 \TeX78, 并且将很快淡出。% 200 | 我们把名字 \TeX\ 保留给这里陈述的代码,因为它是如此优秀并且不再改动。 201 | 202 | %I wish to thank the hundreds of people who have helped me to formulate 203 | %this ``definitive edition'' of the \TeX\ language, based on their 204 | %experiences with preliminary versions of the system. My work at Stanford 205 | %has been generously supported by the ^{National Science Foundation}, the 206 | %^{Office of Naval Research}, the ^{IBM Corporation}, and the ^{System 207 | %Development Foundation}. I also wish to thank the ^{American Mathematical 208 | %Society} for its encouragement, for establishing the \TeX\ Users Group, 209 | %and for publishing the {\sl ^{TUGboat}\/} newsletter (see Appendix~J). 210 | 我要感谢帮助我完成这个 \TeX\ 代码``成熟版''的几百个人,因为本版本是以他们的经验以及% 211 | 系统的初版为基础的。% 212 | 我在 Stanford 的工作得到了 National Science Foundation, Office of Naval Research, 213 | IBM Corporation 和 System Development Foundation 的大力支持。% 214 | 我还要感谢 American Mathematical Society 的鼓励,并谢谢它建立 \TeX\ Users Group~% 215 | 以及出版 TUGboat 快报(见附录 J)。 216 | 217 | %\medskip 218 | %\line{{\sl Stanford, California}\hfil--- D. E. K.}^^{Knuth, Don} 219 | %\line{\sl June 1983\hfil} 220 | \medskip 221 | \line{{\sl Stanford, California}\hfil--- D. E. K.} 222 | \line{\sl June 1983\hfil} 223 | 224 | } % end of the special \topskip 225 | \endchapter 226 | 227 | `Tis pleasant, sure, to see one's name in print; 228 | A book's a book, although there's nothing in 't. 229 | \author {BYRON}, {\sl English Bards and Scotch Reviewers\/} (1809) 230 | 231 | \bigskip 232 | 233 | A question arose as to whether we were covering the field 234 | that it was intended we should fill with this manual. 235 | \author RICHARD R. {DONNELLEY}, {\sl Proceedings, United % 236 | Typothet{\ae} of America\/} (1897) 237 | 238 | \vfill\eject\byebye 239 | -------------------------------------------------------------------------------- /texbookc.tex: -------------------------------------------------------------------------------- 1 | 2 | \input macros 3 | 4 | \input cover 5 | \input front 6 | \input preface 7 | \input content 8 | \input chapter01 9 | \input chapter02 10 | \input chapter03 11 | \input chapter04 12 | \input chapter05 13 | \input chapter06 14 | \input chapter07 15 | \input chapter08 16 | \input chapter09 17 | \input chapter10 18 | \input chapter11 19 | \input chapter12 20 | \input chapter13 21 | \input chapter14 22 | \input chapter15 23 | \input chapter16 24 | \input chapter17 25 | \input chapter18 26 | \input chapter19 27 | \input chapter20 28 | \input chapter21 29 | \input chapter22 30 | \input chapter23 31 | \input chapter24 32 | \input chapter25 33 | \input chapter26 34 | \input chapter27 35 | \input appendixA 36 | \input appendixB 37 | \input appendixC 38 | \input appendixD 39 | \input appendixE 40 | \input appendixF 41 | \input appendixG 42 | \input appendixH 43 | \input appendixI 44 | \input appendixJ 45 | 46 | \end 47 | -------------------------------------------------------------------------------- /xeCJK-base.tex: -------------------------------------------------------------------------------- 1 | \input miniltx 2 | \def\settowidth#1#2{% 3 | \setbox\@tempboxa\hbox{{#2}}#1\wd\@tempboxa 4 | \setbox\@tempboxa\box\voidb@x} 5 | 6 | \endlinechar \m@ne 7 | 8 | % XeTeX 0.99994 将字符类总数扩大到4096 9 | \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99993}>0 10 | \mathchardef\xecjk@boundry=4095 11 | \else 12 | \chardef\xecjk@boundry=255 13 | \fi 14 | 15 | \newif\ifxeCJK@checksingle 16 | \newif\ifxeCJK@space@ 17 | 18 | \def\xeCJK@patch#1#2#3{ 19 | \edef#1{\unexpanded{#2}\unexpanded\expandafter{#1}\unexpanded{#3}}} 20 | \def\makexeCJKactive{\XeTeXinterchartokenstate=1\relax} 21 | \def\makexeCJKinactive{\XeTeXinterchartokenstate=0\relax} 22 | \makexeCJKactive 23 | \def\xeCJKsetcharclass#1#2#3{ 24 | \@tempcnta=#1 25 | \loop 26 | \XeTeXcharclass \@tempcnta #3\relax 27 | \advance\@tempcnta 1\relax 28 | \unless\ifnum\the\@tempcnta>#2 \repeat 29 | \xeCJK@setpunctcharclass} 30 | \def\xeCJK@prePunct#1#2{\xeCJK@setPunct{2}{#1}{#2}} 31 | \def\xeCJK@postPunct#1#2{\xeCJK@setPunct{3}{#1}{#2}} 32 | \def\xeCJK@setPunct#1#2#3{ 33 | \def\xeCJK@class{#1} 34 | \@tempcnta "#2\relax 35 | \multiply\@tempcnta 256\relax 36 | \xeCJK@setPunct@#3,,} 37 | \def\xeCJK@setPunct@#1,{ 38 | \edef\xeCJK@temp{#1}% 39 | \unless\ifx\xeCJK@temp\@empty 40 | \@tempcntb "#1\relax 41 | \advance\@tempcntb\@tempcnta\relax 42 | \XeTeXcharclass \@tempcntb=\xeCJK@class\relax 43 | \def\xeCJK@temp{\xeCJK@setPunct@} 44 | \fi 45 | \xeCJK@temp} 46 | \def\xeCJK@setpunctcharclass{ 47 | \xeCJK@prePunct{20}{18,1C} 48 | \xeCJK@postPunct{20}{19,1D,14,26} 49 | \xeCJK@postPunct{25}{00} 50 | \xeCJK@prePunct{30}{08,0A,0C,0E,10,12,14,16,18,1A,1D,1F,36} 51 | \xeCJK@postPunct{30}{01,02,05,06,09,0B,0D,0F,11,15,17,19,1B,1E, 52 | 41,43,45,47,49,63,83,85,87,8E, 53 | 9B,9C,9D,9E,A1,A3,A5,A7,A9,C3,E3,E5,E7,EE,F5,F6,FB,FC,FD,FE} 54 | \xeCJK@prePunct {FE}{59,5B,5D,5F,60,69,6B} 55 | \xeCJK@postPunct{FE}{50,51,52,54,55,56,57,5A,5C,5E,6A} 56 | \xeCJK@prePunct {FF}{03,04,08,20,3B,5B,E0,E1,E5,E6} 57 | \xeCJK@postPunct{FF}{01,05,09,0C,0E,1A,1B,1F,3D,5D, 58 | 61,63,64,65,67,68,69,6A,6B,6C,6D,6E,6F,70,9E,9F} 59 | \xeCJK@setPunct{1}{0}{B7} 60 | \xeCJK@setPunct{4}{0}{28,2D,5B,60,7B} 61 | \xeCJK@setPunct{5}{0}{21,22,25,27,29,2C,2E,3A,3B,3F,5D,7D}} 62 | \xeCJKsetcharclass{"1100}{"11FF}{1} 63 | \xeCJKsetcharclass{"2E80}{"2EFF}{1} 64 | \xeCJKsetcharclass{"2F00}{"2FDF}{1} 65 | \xeCJKsetcharclass{"2FF0}{"2FFF}{1} 66 | \xeCJKsetcharclass{"3000}{"303F}{1} 67 | \xeCJKsetcharclass{"3040}{"309F}{1} 68 | \xeCJKsetcharclass{"30A0}{"30FF}{1} 69 | \xeCJKsetcharclass{"3100}{"312F}{1} 70 | \xeCJKsetcharclass{"3130}{"318F}{1} 71 | \xeCJKsetcharclass{"3190}{"319F}{1} 72 | \xeCJKsetcharclass{"31A0}{"31BF}{1} 73 | \xeCJKsetcharclass{"31C0}{"31EF}{1} 74 | \xeCJKsetcharclass{"31F0}{"31FF}{1} 75 | \xeCJKsetcharclass{"3200}{"32FF}{1} 76 | \xeCJKsetcharclass{"3300}{"33FF}{1} 77 | \xeCJKsetcharclass{"3400}{"4DBF}{1} 78 | \xeCJKsetcharclass{"4E00}{"9FFF}{1} 79 | \xeCJKsetcharclass{"A000}{"A4CF}{1} 80 | \xeCJKsetcharclass{"AC00}{"D7AF}{1} 81 | \xeCJKsetcharclass{"F900}{"FAFF}{1} 82 | \xeCJKsetcharclass{"FE30}{"FE4F}{1} 83 | \xeCJKsetcharclass{"FF00}{"FFEF}{1} 84 | \xeCJKsetcharclass{"20000}{"2A6DF}{1} 85 | \xeCJKsetcharclass{"2A700}{"2B73F}{1} 86 | \xeCJKsetcharclass{"2B740}{"2B81F}{1} 87 | \xeCJKsetcharclass{"2F800}{"2FA1F}{1} 88 | \def\CJK@stop{\CJK@stop} 89 | \def\normalspacedchars#1{ 90 | \xeCJK@setnormalspacedchar#1\CJK@stop} 91 | \def\xeCJK@setnormalspacedchar#1{ 92 | \unless\ifx#1\CJK@stop 93 | \XeTeXcharclass`#1=6 94 | \expandafter\xeCJK@setnormalspacedchar 95 | \fi} 96 | \normalspacedchars{/} 97 | \XeTeXinterchartoks 1 0{\egroup\CJKecglue} 98 | \XeTeXinterchartoks 1 1{\xeCJK@i@i} 99 | \XeTeXinterchartoks 1 2{\xeCJK@i@ii} 100 | \XeTeXinterchartoks 1 3{\xeCJK@i@iii} 101 | \XeTeXinterchartoks 1 4{\egroup\CJKecglue} 102 | \XeTeXinterchartoks 1 5{\egroup} 103 | \XeTeXinterchartoks 1 \xecjk@boundry{\xeCJK@i@cclv} 104 | \XeTeXinterchartoks 2 0{\xeCJK@ii@} 105 | \XeTeXinterchartoks 2 1{\xeCJK@ii@i} 106 | \XeTeXinterchartoks 2 2{\xeCJK@ii@ii} 107 | \XeTeXinterchartoks 2 3{\xeCJK@ii@iii} 108 | \XeTeXinterchartoks 2 4{\xeCJK@ii@iv} 109 | \XeTeXinterchartoks 2 5{\xeCJK@ii@v} 110 | \XeTeXinterchartoks 2 \xecjk@boundry{\xeCJK@ii@cclv} 111 | \XeTeXinterchartoks 3 0{\xeCJK@iii@} 112 | \XeTeXinterchartoks 3 1{\xeCJK@iii@i} 113 | \XeTeXinterchartoks 3 2{\xeCJK@iii@ii} 114 | \XeTeXinterchartoks 3 3{\xeCJK@iii@iii} 115 | \XeTeXinterchartoks 3 4{\xeCJK@iii@iv} 116 | \XeTeXinterchartoks 3 5{\xeCJK@iii@v} 117 | \XeTeXinterchartoks 3 \xecjk@boundry{\xeCJK@iii@cclv} 118 | \XeTeXinterchartoks 0 1{\xeCJK@@i} 119 | \XeTeXinterchartoks 0 2{\xeCJK@@ii} 120 | \XeTeXinterchartoks 0 3{\xeCJK@@iii} 121 | \XeTeXinterchartoks 0 \xecjk@boundry{\xeCJK@@cclv} 122 | \XeTeXinterchartoks 4 1{\xeCJK@iv@i} 123 | \XeTeXinterchartoks 4 2{\xeCJK@iv@ii} 124 | \XeTeXinterchartoks 4 3{\xeCJK@iv@iii} 125 | \XeTeXinterchartoks 5 1{\xeCJK@v@i} 126 | \XeTeXinterchartoks 5 2{\xeCJK@v@ii} 127 | \XeTeXinterchartoks 5 3{\xeCJK@v@iii} 128 | \XeTeXinterchartoks 5 \xecjk@boundry{\xeCJK@v@cclv} 129 | \XeTeXinterchartoks \xecjk@boundry 0{\xeCJK@cclv@} 130 | \XeTeXinterchartoks \xecjk@boundry 1{\xeCJK@cclv@i} 131 | \XeTeXinterchartoks \xecjk@boundry 2{\xeCJK@cclv@ii} 132 | \XeTeXinterchartoks \xecjk@boundry 3{\xeCJK@cclv@iii} 133 | \XeTeXinterchartoks \xecjk@boundry 4{\xeCJK@cclv@iv} 134 | \XeTeXinterchartoks \xecjk@boundry 6{\xeCJK@cclv@vi} 135 | \XeTeXinterchartoks 1 6{\xeCJK@i@vi} 136 | \XeTeXinterchartoks 2 6{\xeCJK@ii@vi} 137 | \XeTeXinterchartoks 3 6{\xeCJK@iii@vi} 138 | \XeTeXinterchartoks 6 1{\xeCJK@vi@i} 139 | \XeTeXinterchartoks 6 2{\xeCJK@vi@ii} 140 | \XeTeXinterchartoks 6 3{\xeCJK@vi@iii} 141 | \XeTeXinterchartoks 6 \xecjk@boundry{\xeCJK@vi@cclv} 142 | \def\xeCJK@vi@i{ 143 | \bgroup 144 | \xeCJK@emptyCJKtoks 145 | \xeCJK@setfont 146 | \CJKsymbol} 147 | \def\xeCJK@i@vi{ 148 | \egroup} 149 | \let\xeCJK@ii@vi \xeCJK@i@vi 150 | \let\xeCJK@iii@vi\xeCJK@i@vi 151 | \let\xeCJK@vi@ii \xeCJK@vi@i 152 | \let\xeCJK@vi@iii\xeCJK@vi@i 153 | \def\xeCJK@i@i{ 154 | \CJKglue 155 | \CJKsymbol} 156 | \let\xeCJK@i@i@save\xeCJK@i@i 157 | \def\xeCJK@i@ii#1{ 158 | \xeCJK@punctrule{#1}{l} 159 | \hskip \csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname @lglue@#1\endcsname 160 | plus 0.1em minus 0.1 em 161 | \xeCJK@setprepunct{#1}} 162 | \def\xeCJK@i@iii#1{ 163 | \xeCJK@punctrule{#1}{r} 164 | \ifcsname xeCJK@specialpunct#1\endcsname 165 | \CJKglue % breakable 166 | \else 167 | \nobreak 168 | \fi 169 | \xdef\xeCJK@lastpunct{#1} 170 | \CJKpunctsymbol{#1}} 171 | \def\xeCJK@setprepunct#1{ 172 | \edef\xeCJK@lastpunct{#1} 173 | \vrule width \csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname 174 | @lrule@#1\endcsname depth \z@ height \z@ 175 | \CJKpunctsymbol{#1}} 176 | \def\xeCJK@i@cclv{ 177 | \egroup 178 | {\xeCJK@CJKkern} 179 | \xeCJK@ignorespaces} 180 | \def\xeCJK@ii@i{ 181 | \nobreak 182 | \CJKsymbol} 183 | \def\xeCJK@ii@ii#1{ 184 | \nobreak 185 | \xeCJK@punctrule{#1}{l} 186 | \xeCJK@setkern{\xeCJK@lastpunct}{#1} 187 | \kern \csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname @kern\xeCJK@lastpunct#1\endcsname 188 | \xeCJK@setprepunct{#1}} 189 | \def\xeCJK@ii@iii#1{ 190 | \nobreak 191 | \xeCJK@punctrule{#1}{r} 192 | \xeCJK@setkern{\xeCJK@lastpunct}{#1} 193 | \kern \csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname @kern\xeCJK@lastpunct#1\endcsname 194 | \nobreak 195 | \edef\xeCJK@lastpunct{#1} 196 | \CJKpunctsymbol{#1}} 197 | \def\xeCJK@ii@{ 198 | \nobreak 199 | \egroup} 200 | \let\xeCJK@ii@iv\xeCJK@ii@ 201 | \let\xeCJK@ii@v\xeCJK@ii@ 202 | \def\xeCJK@ii@cclv{ 203 | \nobreak 204 | \egroup 205 | \ignorespaces} 206 | \def\xeCJK@iii@{ 207 | \xeCJK@afterpostpunct 208 | \egroup} 209 | \def\xeCJK@iii@i{ 210 | \xeCJK@afterpostpunct 211 | \CJKsymbol} 212 | \def\xeCJK@iii@ii#1{ 213 | \vrule width \csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname 214 | @rrule@\xeCJK@lastpunct\endcsname depth \z@ height \z@ 215 | \xeCJK@punctrule{#1}{l} 216 | \xeCJK@setkern{\xeCJK@lastpunct}{#1} 217 | \kern \csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname @kern\xeCJK@lastpunct#1\endcsname 218 | \xeCJKpunctnobreak 219 | \xeCJK@setprepunct{#1}} 220 | \def\xeCJK@iii@iii#1{ 221 | \vrule width \csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname 222 | @rrule@\xeCJK@lastpunct\endcsname depth \z@ height \z@ 223 | \xeCJK@punctrule{#1}{r} 224 | \xeCJK@setkern{\xeCJK@lastpunct}{#1} 225 | \kern \csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname @kern\xeCJK@lastpunct#1\endcsname 226 | \nobreak 227 | \edef\xeCJK@lastpunct{#1} 228 | \CJKpunctsymbol{#1}} 229 | \def\xeCJK@iii@iv{ 230 | \xeCJK@afterpostpunct 231 | \egroup} 232 | \def\xeCJK@afterpostpunct{ 233 | \vrule width \csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname 234 | @rrule@\xeCJK@lastpunct\endcsname depth \z@ height \z@ 235 | \hskip \csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname @rglue@\xeCJK@lastpunct\endcsname 236 | plus 0.1em minus 0.1 em} 237 | \let\xeCJK@iii@v\xeCJK@iii@iv 238 | \def\xeCJK@iii@cclv{ 239 | \xeCJK@afterpostpunct 240 | \egroup 241 | \ignorespaces} 242 | \def\xeCJK@@i{ 243 | \CJKecglue 244 | \bgroup 245 | \xeCJK@setfont 246 | \xeCJK@emptyCJKtoks 247 | \CJKsymbol} 248 | \def\xeCJK@@ii{ 249 | \bgroup 250 | \xeCJK@setfont 251 | \XeTeXinterchartoks 0 2{\relax} 252 | \xeCJK@emptyCJKtoks 253 | \xeCJK@i@ii} 254 | \def\xeCJK@@iii{ 255 | \bgroup 256 | \xeCJK@setfont 257 | \XeTeXinterchartoks 0 3{\relax} 258 | \xeCJK@emptyCJKtoks 259 | \xeCJK@i@iii} 260 | \def\xeCJK@iv@i{ 261 | \bgroup 262 | \xeCJK@setfont 263 | \XeTeXinterchartoks 4 1{\relax} 264 | \xeCJK@emptyCJKtoks 265 | \CJKsymbol} 266 | \def\xeCJK@iv@ii{ 267 | \bgroup 268 | \xeCJK@setfont 269 | \XeTeXinterchartoks 4 2{\relax} 270 | \xeCJK@emptyCJKtoks 271 | \xeCJK@i@ii} 272 | \def\xeCJK@iv@iii{ 273 | \bgroup 274 | \xeCJK@setfont 275 | \XeTeXinterchartoks 4 3{\relax} 276 | \xeCJK@emptyCJKtoks 277 | \xeCJK@i@iii} 278 | \def\xeCJK@v@i{ 279 | \CJKecglue 280 | \bgroup 281 | \xeCJK@setfont 282 | \xeCJK@emptyCJKtoks 283 | \CJKsymbol} 284 | \def\xeCJK@v@ii{ 285 | \bgroup 286 | \xeCJK@setfont 287 | \XeTeXinterchartoks 5 2{\relax} 288 | \xeCJK@emptyCJKtoks 289 | \xeCJK@i@ii} 290 | \def\xeCJK@v@iii{ 291 | \bgroup 292 | \xeCJK@setfont 293 | \XeTeXinterchartoks 5 3{\relax} 294 | \xeCJK@emptyCJKtoks 295 | \xeCJK@i@iii} 296 | \def\xeCJK@emptyCJKtoks{ 297 | \XeTeXinterchartoks \xecjk@boundry 1{\relax} 298 | \XeTeXinterchartoks \xecjk@boundry 2{\relax} 299 | \XeTeXinterchartoks \xecjk@boundry 3{\relax}} 300 | \def\xeCJK@@cclv{ 301 | \futurelet\xeCJK@nexttoken\xeCJK@zz@cclv} 302 | \def\xeCJK@zz@cclv{ 303 | \ifx\xeCJK@nexttoken\@sptoken 304 | {\xeCJK@spkern} 305 | \else 306 | {\xeCJK@zerokern} 307 | \fi} 308 | \let\xeCJK@v@cclv\xeCJK@@cclv 309 | \let\xeCJK@vi@cclv\xeCJK@@cclv 310 | \def\xeCJK@cclv@{ 311 | \ifnum\lastkern=\@ne 312 | \CJKecglue 313 | \fi} 314 | \let\xeCJK@cclv@iv\xeCJK@cclv@ 315 | \let\xeCJK@cclv@vi\xeCJK@cclv@ 316 | \def\xeCJK@cclv@i{{ 317 | \ifnum\lastkern=\@ne 318 | \CJKglue 319 | \else 320 | \ifnum\lastkern=\xeCJK@four 321 | \CJKecglue 322 | \else 323 | \ifnum\lastnodetype=\xeCJK@ten 324 | \CJKecglue 325 | \else 326 | \ifnum\lastnodetype=\xeCJK@eleven 327 | \settowidth\@tempdima\@sptoken 328 | \ifdim\lastskip=\@tempdima 329 | \@tempskipa=\lastskip 330 | \unskip 331 | \ifnum\lastkern=\tw@ 332 | \CJKecglue 333 | \else 334 | \ifnum\lastnodetype=\xeCJK@ten 335 | \CJKecglue 336 | \else 337 | \ifnum\lastkern=\xeCJK@four 338 | \CJKecglue 339 | \else 340 | \hskip\@tempskipa 341 | \fi\fi\fi\fi\fi\fi\fi\fi} 342 | \bgroup 343 | \xeCJK@emptyCJKtoks 344 | \xeCJK@setfont 345 | \CJKsymbol} 346 | \def\xeCJK@cclv@ii{ 347 | \bgroup 348 | \xeCJK@emptyCJKtoks 349 | \xeCJK@setfont 350 | \xeCJK@i@ii} 351 | \def\xeCJK@cclv@iii{ 352 | \bgroup 353 | \xeCJK@emptyCJKtoks 354 | \xeCJK@setfont 355 | \xeCJK@i@iii} 356 | \def\CJKglue{\hskip \z@ \@plus .08\baselineskip} 357 | \def\CJK@nobreakglue{\nobreak\CJKglue\nobreak} 358 | \edef\xeCJK@CJKkern{\kern -1sp\kern 1sp} 359 | \edef\xeCJK@spkern{\kern -2sp\kern 2sp} 360 | \edef\xeCJK@zerokern{\kern -4sp\kern 4sp} 361 | \chardef\xeCJK@four=4 362 | \chardef\xeCJK@ten=10 363 | \chardef\xeCJK@eleven=11 364 | \def\CJKspace{\let\xeCJK@ignorespaces\@empty} 365 | \def\CJKnospace{\def\xeCJK@ignorespaces{\xeCJK@@ignorespaces}} 366 | \ifxeCJK@space@ 367 | \CJKspace 368 | \else 369 | \CJKnospace 370 | \fi 371 | \def\xeCJK@@ignorespaces{ 372 | \futurelet\xeCJK@nexttoken\xeCJK@checknext} 373 | \def\xeCJK@checknext{ 374 | \ifx\xeCJK@nexttoken\@sptoken 375 | \expandafter\xeCJK@@checknext 376 | \else 377 | \ifx $\xeCJK@nexttoken 378 | \CJKecglue 379 | \fi 380 | \fi} 381 | { 382 | \def\:{\xeCJK@@checknext} 383 | \global\expandafter\def\: {\futurelet\@let@token\xeCJK@@@checknext} 384 | } 385 | \def\xeCJK@@@checknext{ 386 | \ifx $\@let@token 387 | \CJKecglue 388 | \else 389 | \if\relax\noexpand\@let@token 390 | \unless\ifx\@let@token\xeCJK@par 391 | \CJKecglue 392 | \fi 393 | \fi 394 | \fi 395 | \let\xeCJK@nexttoken\relax} 396 | \def\xeCJKenablechecksingle{\def\xeCJK@i@i{\xeCJK@checksingle}} 397 | \def\xeCJKdisablechecksingle{\let\xeCJK@i@i\xeCJK@i@i@save} 398 | \ifxeCJK@checksingle 399 | \AtEndOfPackage{\xeCJKenablechecksingle} 400 | \fi 401 | \def\xeCJK@checksingle#1{ 402 | \def\xeCJK@setcurrentchar@i{ 403 | \CJKglue 404 | \CJKsymbol{#1}} 405 | \def\xeCJK@setcurrentnobreakchar@i{ 406 | \CJKsymbol{#1}} 407 | \futurelet\@let@token\xeCJK@@checksingle} 408 | \def\xeCJK@@checksingle{ 409 | \ifcat 。\noexpand\@let@token 410 | \expandafter\xeCJK@@@checksingle 411 | \else 412 | \expandafter\xeCJK@setcurrentchar@i 413 | \fi} 414 | \def\xeCJK@@@checksingle#1{ 415 | \def\xeCJK@setcurrentchar@ii{ 416 | \xeCJK@setcurrentchar@i #1} 417 | \def\xeCJK@setcurrentchar@ii@s{ 418 | \xeCJK@setcurrentchar@i #1 } 419 | \def\xeCJK@setcurrentnobreakchar@ii{ 420 | \xeCJK@setcurrentnobreakchar@i #1} 421 | \futurelet\@let@token\xeCJK@@@@checksingle} 422 | \def\xeCJK@@@@checksingle{ 423 | \ifx\@let@token\@sptoken 424 | \expandafter\xeCJK@checkpar 425 | \else 426 | \expandafter\xeCJK@setcurrentchar@ii 427 | \fi} 428 | \let\xeCJK@par\par 429 | \def\xeCJK@checkpar{ 430 | \@ifnextchar\xeCJK@par{\xeCJK@setcurrentnobreakchar@ii}{\xeCJK@setcurrentchar@ii@s}} 431 | \def\xeCJKsetecglue#1{ 432 | \def\CJK@ecglue{#1} 433 | \let\CJKecglue\CJK@ecglue} 434 | \let\CJKsetecglue\xeCJKsetecglue 435 | \CJKsetecglue{ } 436 | \def\xeCJKallowbreakbetweenpuncts{ 437 | \def\xeCJKpunctnobreak{ 438 | \hskip \z@\relax}} 439 | \def\xeCJKnobreakbetweenpuncts{ 440 | \let\xeCJKpunctnobreak\nobreak} 441 | \xeCJKnobreakbetweenpuncts 442 | \let\xeCJK@itcorr\/ 443 | \def\/{% 444 | \relax 445 | \ifnum\lastkern=4 % 446 | \unkern\unkern 447 | \fi 448 | \xeCJK@itcorr} 449 | \let\@@italiccorr=\/ 450 | \newcount\xeCJK@cnta 451 | \newcount\xeCJK@cntb 452 | \newcount\xeCJK@cntc 453 | \newcount\xeCJK@cntd 454 | \newcount\xeCJK@cnte 455 | \newdimen\xeCJK@dima 456 | \newif\ifxeCJK@dokerning 457 | \def\xeCJK@punctrule#1#2{ 458 | \xdef\xeCJK@bboxname{\xeCJK@fontname} 459 | \unless\ifcsname xeCJK\xeCJK@punctstyle\xeCJK@bboxname @#2rule@#1\endcsname 460 | \unless\ifcsname xeCJK@\xeCJK@bboxname @lspace@#1\endcsname 461 | {\xeCJK@setfont\xeCJK@setpunctbounds{#1}} 462 | \fi 463 | \xeCJK@dokerningtrue 464 | \ifnum\xeCJK@punctstyle=\xeCJK@ps@plain\relax 465 | \xeCJK@dokerningfalse 466 | \else 467 | \ifcsname xeCJK@specialpunct#1\endcsname 468 | \xeCJK@dokerningfalse 469 | \fi 470 | \fi 471 | \ifxeCJK@dokerning 472 | \xeCJK@cnta=\csname xeCJK@\xeCJK@bboxname @#2space@#1\endcsname\relax 473 | \xeCJK@cntc=\xeCJK@cnta 474 | \ifcase\xeCJK@punctstyle 475 | % hangmobanjiao 476 | \or % quanjiao 477 | \or % banjiao 478 | \advance\xeCJK@cntc -50\relax 479 | \or % kaiming 480 | \ifcsname xeCJK@kaiming#1\endcsname 481 | \advance\xeCJK@cntc -20\relax 482 | \else 483 | \advance\xeCJK@cntc -50\relax 484 | \fi 485 | \or % CCT 486 | \ifcsname xeCJK@kaiming#1\endcsname 487 | \advance\xeCJK@cntc -20\relax 488 | \else 489 | \advance\xeCJK@cntc -30\relax 490 | \fi 491 | \fi 492 | \xeCJK@cntd=\xeCJK@cntc 493 | \ifnum\xeCJK@cntc<0\relax 494 | \xeCJK@cntc=0\relax 495 | \fi 496 | \else 497 | \xeCJK@cnta=0\relax 498 | \xeCJK@cntc=0\relax 499 | \xeCJK@cntd=0\relax 500 | \fi 501 | \xeCJK@numtodim{\xeCJK@cnta} 502 | \expandafter\xdef\csname 503 | xeCJK\xeCJK@punctstyle\xeCJK@bboxname @#2rule@#1\endcsname{ 504 | -\xeCJK@temp em} 505 | \xeCJK@numtodim{\xeCJK@cntc} 506 | \expandafter\xdef\csname 507 | xeCJK\xeCJK@punctstyle\xeCJK@bboxname @#2glue@#1\endcsname{ 508 | \xeCJK@temp em} 509 | \expandafter\xdef\csname 510 | xeCJK\xeCJK@punctstyle\xeCJK@bboxname @#2oglue@#1\endcsname{ 511 | \the\xeCJK@cntd} 512 | \fi} 513 | \def\xeCJK@numtodim#1{ 514 | \xeCJK@cnte=#1\relax 515 | \ifnum\the\xeCJK@cnte<100\relax 516 | \def\xeCJK@temp{0} 517 | \else 518 | \advance\xeCJK@cnte -100\relax 519 | \def\xeCJK@temp{1} 520 | \fi 521 | \ifnum\the\xeCJK@cnte<10 522 | \edef\xeCJK@temp{\xeCJK@temp.0\the\xeCJK@cnte} 523 | \else 524 | \edef\xeCJK@temp{\xeCJK@temp.\the\xeCJK@cnte} 525 | \fi} 526 | \expandafter\def\csname xeCJK@kaiming.\endcsname{} 527 | \expandafter\def\csname xeCJK@kaiming。\endcsname{} 528 | \expandafter\def\csname xeCJK@kaiming?\endcsname{} 529 | \expandafter\def\csname xeCJK@kaiming!\endcsname{} 530 | \expandafter\def\csname xeCJK@specialpunct—\endcsname{}% U+2014 531 | \expandafter\def\csname xeCJK@specialpunct─\endcsname{}% U+2500 532 | \expandafter\def\csname xeCJK@specialpunct…\endcsname{} 533 | \def\xeCJK@setkern#1#2{ 534 | \unless\ifcsname xeCJK\xeCJK@punctstyle\xeCJK@bboxname @kern#1#2\endcsname 535 | \xeCJK@cnta=0\relax 536 | \ifcsname xeCJK\xeCJK@punctstyle\xeCJK@bboxname @roglue@#1\endcsname 537 | \advance\xeCJK@cnta\csname 538 | xeCJK\xeCJK@punctstyle\xeCJK@bboxname @roglue@#1\endcsname 539 | \fi 540 | \ifcsname xeCJK\xeCJK@punctstyle\xeCJK@bboxname @loglue@#2\endcsname 541 | \advance\xeCJK@cnta\csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname 542 | @loglue@#2\endcsname 543 | \fi 544 | \relax 545 | \ifcase\xeCJK@punctstyle 546 | % hangmobanjiao 547 | \or % quanjiao 548 | \advance\xeCJK@cnta -50\relax 549 | \or % banjiao 550 | \advance\xeCJK@cnta -50\relax 551 | \or % kaiming 552 | \advance\xeCJK@cnta -50\relax 553 | \or % CCT 554 | \advance\xeCJK@cnta -50\relax 555 | \fi 556 | \ifnum\xeCJK@cnta<0\relax 557 | \xeCJK@cnta=0\relax 558 | \fi 559 | \xeCJK@numtodim{\xeCJK@cnta} 560 | \expandafter\xdef\csname 561 | xeCJK\xeCJK@punctstyle\xeCJK@bboxname @kern#1#2\endcsname{ 562 | \xeCJK@temp em} 563 | \fi} 564 | \def\xeCJKsetkern#1#2#3{ 565 | \xdef\xeCJK@bboxname{\xeCJK@fontname} 566 | \expandafter\xdef\csname 567 | xeCJK\xeCJK@punctstyle\xeCJK@bboxname @kern#1#2\endcsname{#3}} 568 | \def\punctstyle#1{ 569 | \ifcsname xeCJK@ps@#1\endcsname 570 | \edef\xeCJK@punctstyle{\csname xeCJK@ps@#1\endcsname} 571 | \ifnum\xeCJK@punctstyle=\xeCJK@ps@plain\relax 572 | \xeCJKallowbreakbetweenpuncts 573 | \fi 574 | \else 575 | \PackageWarning{xeCJK}{Punctstyle #1\space is not defined.} 576 | \fi} 577 | \def\xeCJK@ps@hangmobanjiao{0} 578 | \def\xeCJK@ps@marginkerning{0} 579 | \def\xeCJK@ps@quanjiao{1} 580 | \def\xeCJK@ps@fullwidth{1} 581 | \def\xeCJK@ps@banjiao{2} 582 | \def\xeCJK@ps@halfwidth{2} 583 | \def\xeCJK@ps@kaiming{3} 584 | \def\xeCJK@ps@mixedwidth{3} 585 | \def\xeCJK@ps@CCT{4} 586 | \def\xeCJK@ps@plain{5} 587 | \punctstyle{quanjiao} 588 | \def\xeCJKplainchr{\punctstyle{plain}} 589 | \def\xeCJK@sidespace{10} 590 | \def\xeCJK@getglyphbounds#1{ 591 | \xeCJK@cnta=\number\XeTeXglyphbounds #1 \xeCJK@gid 592 | \xeCJK@dima 1em\relax 593 | \xeCJK@cntb=\number\xeCJK@dima 594 | \multiply\xeCJK@cnta 100\relax 595 | \divide\xeCJK@cnta\xeCJK@cntb 596 | \advance\xeCJK@cnta -15\relax 597 | \edef\xeCJK@temp{\the\xeCJK@cnta} 598 | \ifnum\xeCJK@temp<0\relax 599 | \def\xeCJK@temp{0} 600 | \fi} 601 | \def\xeCJK@setpunctbounds#1{ 602 | \edef\xeCJK@gid{\the\XeTeXcharglyph`#1} 603 | \xeCJK@getglyphbounds{1} 604 | \expandafter\xdef\csname xeCJK@\xeCJK@bboxname @lspace@#1\endcsname{ 605 | \xeCJK@temp} 606 | \xeCJK@getglyphbounds{3} 607 | \expandafter\xdef\csname xeCJK@\xeCJK@bboxname @rspace@#1\endcsname{ 608 | \xeCJK@temp} 609 | \ifcsname xeCJK@specialpunct#1\endcsname 610 | \unless\ifx#1… 611 | \xeCJK@cnta=\number\XeTeXglyphbounds 1 \xeCJK@gid 612 | \advance\xeCJK@cnta\number\XeTeXglyphbounds 3 \xeCJK@gid 613 | \xeCJK@dima 1em\relax 614 | \xeCJK@cntb=\number\xeCJK@dima 615 | \multiply\xeCJK@cnta 100\relax 616 | \divide\xeCJK@cnta\xeCJK@cntb 617 | \advance\xeCJK@cnta 1\relax 618 | \ifnum\xeCJK@cnta>9 619 | \edef\xeCJK@temp{-0.\the\xeCJK@cnta em} 620 | \else 621 | \ifnum\xeCJK@cnta>1 622 | \edef\xeCJK@temp{-0.0\the\xeCJK@cnta em} 623 | \else 624 | \edef\xeCJK@temp{-0.01 em} 625 | \fi 626 | \fi 627 | \xeCJK@cnta=0 628 | \loop 629 | \global\expandafter\edef\csname xeCJK\the\xeCJK@cnta\xeCJK@bboxname 630 | @kern#1#1\endcsname{\xeCJK@temp} 631 | \advance \xeCJK@cnta 1\relax 632 | \ifnum\xeCJK@cnta<6\repeat 633 | \fi 634 | \fi} 635 | \unless\ifcsname XeTeXglyphbounds\endcsname 636 | \PackageError{xeCJK}{\string\XeTeXglyphbounds \space not defined.^^J 637 | You have to update XeTeX to the version 0.9995.0 or later}{} 638 | \fi 639 | 640 | \def\CJKsymbol#1{#1} 641 | \def\CJKpunctsymbol#1{#1} 642 | 643 | % For pure plain TeX 644 | \def\xeCJK@setfont{\CJKfont} 645 | \def\xeCJK@fontname{\fontname\CJKfont} 646 | 647 | \def\CJKfont{\errmessage{xeCJK Error: You must define \noexpand\CJKfont first}} 648 | 649 | \endlinechar=`\^^M 650 | \resetatcatcode 651 | \endinput 652 | % vim:ft=plaintex 653 | --------------------------------------------------------------------------------