1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393
|
% -*- coding: utf-8 -*-
% This is part of the book TeX for the Impatient.
% Copyright (C) 2003 Paul W. Abrahams, Kathryn A. Hargreaves, Karl Berry.
% See file fdl.tex for copying conditions.
\input macros
\chapter{使用 \TeX}
\chapterdef{usingtex}
% Avoid underfull box complaint about the empty paragraph
% that precedes the first section heading.
%
\def\par{{\parfillskip = 0pt plus 1fil\endgraf}\let\par=\endgraf}
\vglue-\abovesectionskip % we've skipped enough already
\vskip0pt % Make \combineskips work.
%\section Turning input into ink
\section 从键盘输入变到油墨
%\subsection Programs and files you need
\subsection 所需的程序和文件
%In order to produce a \TeX\ document, you'll need to run the \TeX\
%program and several related programs as well. You'll also need
%supporting files for \TeX\ and possibly for these other programs. In
%this book we can tell you about \TeX, but we can't tell you about the
%other programs and the supporting files except in very general terms
%because they depend on your local \TeX\ environment. The people who
%provide you with \TeX\ should be able to supply you with what we call
%\emph{local information}.
%\pix^^{local information}
%The local information tells you how to
%start up \TeX, how to use the related programs, and how to gain access
%to the supporting files.
为了制作一个 \TeX\ 文档, 你必需运行 \TeX\ 及其相关软件.
你同时也需要一些 \TeX\ 及其相关软件所用到的辅助文件.
在这本书中, 我们仅仅谈论 \TeX\ 和一些通用的软件及辅助文件,
不过我们不会介绍其它的, 因为它们仅仅和你自己的 \TeX\ 环境相关.
为你提供 \TeX\ 的人可以为你提供我们所说的\emph{本地信息}.
\pix^^{本地信息}
这些本地信息可以告诉你如何去启动 \TeX, 如何去使用相关的程序,
以及如何去访问这些所用到的辅助文件.
%Input to \TeX\ consists of a file of ordinary text that you can prepare
%with a ^{text editor}. A \TeX\ input file, unlike an input file for a
%typical word processor, doesn't ordinarily contain any invisible
%^{control characters}.
%Everything that \TeX\ sees is visible to you too if you
%look at a listing of the file.
你可以使用一个 ^{文本编辑器} 来编写一个可以输入到 \TeX\ 的普通文本文件.
一个 \TeX\ 输入文件和一个文字处理软件的输入文件不同, 它通常并不存在任何不可见的^{控制字符}.
任何 \TeX\ 读到的字符对你来说, 都是你可以看到的.
%Your input file may turn out to be little more than a skeleton that
%calls for other input files. \TeX\ users often organize large documents
%such as books this way. You can use the ^|\input| command (\xref\input)
%to embed one input file within another. In particular, you can use
%|\input| to incorporate files containing \emph{macro definitions}---%
%^^{macros//in auxiliary files}
%auxiliary definitions that enhance \TeX's capabilities.
%If any macro files are available at your \TeX\ installation, the local
%information about \TeX\ should tell you how to get at the macro files
%and what they can do for you. The standard form of \TeX,
%the one described in this book, incorporates a
%collection of macros and other definitions known as ^{\plainTeX}
%(\xref{\plainTeX}).
你的输入文件, 可以仅仅是一个引用其它输入文件的框架.
\TeX\ 用户往往把大的文档, 比如说这本书, 组织成这种形式.
你可以使用 ^|\input| 命令 (\xref\input) 来把一个输入文件篏入到另一个中.
特别地, 你可以使用 |\input|来调入包含\emph{宏定义}的文件,
^^{宏//在辅助文件中}
宏定义是一些辅助的定义, 它可以来增强 \TeX\ 的功能.
如果你的 \TeX\ 系统中包含任何的宏文件,
和 \TeX\ 相关的本地信息会告诉你如何得到这些宏文件,
以及它们的功能.
\TeX\ 的标准安装形式, 也就是在这本书中所描述的,
包括了一个被称为 ^{\plainTeX} (\xref{\plainTeX}) 的宏集.
%When \TeX\ processes your document, it produces a file called the
%^{\dvifile}. The abbreviation ``|dvi|'' stands for ``device
%independent''. The abbreviation was chosen because the information in
%the \dvifile\ is independent of the device that you use to print or
%display your document.
当 \TeX\ 处理你的文档时, 它会产生一种叫做 ^{\dvifile} 的文件.
其中, ``|dvi|'' 的全称为 ``device independent (设备无关)''.
之所以选用这个缩写, 是因为 \dvifile\ 中所包含的信息和你的打印或显示设备无关.
%To print your document or view it with a \emph{previewer},
%^^{previewer}
%you need to process the ^{\dvifile} with
%a \emph{device driver\/} program.
%^^{device drivers}
%(A previewer is a program that
%enables you to see on a screen some approximation of what the typeset
%output will look like.)
%Different output devices usually
%require different device drivers.
%After running the device driver,
%you may also need to transfer the output of the device driver to the
%printer or other output device.
%^^{printers} ^^{output devices}
%The local information about \TeX\ should tell
%you how to get the correct device driver and use it.
当你需要打印或使用\emph{阅览器}查看你的文档时, ^^{阅览器}
你需要使用相应的\emph{设备驱动}来处理之. ^^{设备驱动}
(阅览器是一个程序, 它能把和打印出来的结果差不多的排版内容显示在屏幕上.)
不同的输出设备往往需要不同的设备驱动. 在运行设备驱动以后,
你还需要把设备驱动输出的内容传输到打印机或者其它输出设备上.
^^{打印机} ^^{输出设备}
和 \TeX\ 相关的本地信息会告诉你如何得到正确的设备驱动和如何使用它.
%Since \TeX\ has no built-in knowledge of particular fonts, it uses
%\emph{font files}
%^^{font files}
%to obtain information about the fonts used in your
%document. The font files should also be part of your local \TeX\
%environment. Each font normally requires two files: one containing the
%dimensions of the characters in the font (the \emph{metrics file})
%^^{metrics file}
%and one containing the shapes of the characters (the \emph{shape file}).
%^^{shape file}
%Magnified versions of a font share the metrics file but have
%different shape files. ^^{magnification} Metrics files are sometimes
%referred to as ^{\tfmfile}s, and the different varieties of shape files
%are sometimes referred to as ^{\pkfile}s, ^{\pxlfile}s, and ^{\gffile}s.
%These names correspond to the names of the files that \TeX\ and its
%companion programs use. For example, |cmr10.tfm| is the metrics file
%for the |cmr10| font (10-point Computer Modern Roman).
因为 \TeX\ 内部并没有任何关于一个特定字体的任何信息,
它使用\emph{字体文件}
^^{字体文件}
来得到你文档中所使用的字体的信息.
字体文件也是你本地 \TeX\ 环境的一个组成部分.
一个字体一般对应两个文件:
一个文件 (\emph{字体度量文件}) ^^{度量文件} 包括了字体中每个字符的大小信息,
另一个文件 (\emph{字体轮廓文件}) ^^{轮廓文件} 则描述了字体中字符的形状.
一个字体的缩放版本使用同样的字体度量文件, 不过并不使用相同的字体轮廓文件.
^^{放大率}
字体度量文件往往用来指称 ^{\tfmfile},
而字体轮廓文件则往往用来指称 ^{\pkfile}, ^{\pxlfile} 和 ^{\gffile} 等不同的种类.
这些名称和 \TeX\ 以及相关软件所使用的文件的文件名所对应.
比如, |cmr10.tfm| 为 |cmr10| 字体的字体度量文件 (10-点的计算机现代字体).
%\TeX\ itself uses only the metrics file, since it doesn't care what the
%characters look like but only how much space they occupy. The device
%driver ordinarily uses the shape file, since it's responsible for
%creating the printed image of each typeset character. Some device
%drivers need to use the metrics file as well. Some device drivers can
%utilize fonts that are resident in a printer and don't need shape files
%for those fonts.
%\secondprinting{\vfill\eject}
\TeX\ 本身仅使用字体度量文件, 因为它只关心这个字体的字符占用了多大的空间,
而并不关心这个字体的外形是什么样子的.
设备驱动则往往需要使用字体轮廓文件,
因为它需要负责把每个排出的字符变成印出的图形.
某些设备驱动也需要使用字体度量文件.
一些设备驱动可以使用打印机中包含的字体,
所以可以不需要这些字体的字体轮廓文件.
%\secondprinting{\vfill\eject}
%\subsection Running {\TeX}
\subsection{运行 \TeX}
%\bix^^{running \TeX}
%You can run \TeX\ on an input file |screed.tex| by typing
%^^{input files}
%something like `|run tex|' or just `|tex|' (check your local information).
%\TeX\ will respond with something like:
%% 4/23/90 is Shakespeare's 426th birthday, and Karl's 26th.
%\csdisplay
%This is TeX, Version 3.0 (preloaded format=plain 90.4.23)
%**
%|
%The ``preloaded format'' here refers to a predigested form of the
%^{\plainTeX} macros that come with \TeX.
%You can now type `|screed|' to get \TeX\ to process your file.
%When it's done, you'll see something like:
%\csdisplay
%(screed.tex [1] [2] [3] )
%Output written on screed.dvi (3 pages, 400 bytes).
%Transcript written on screed.log.
%|
%displayed on your terminal, or printed in the record of your
%run if you're not working at a terminal. Most of this output is
%self-explanatory.
%The numbers in brackets are page numbers that \TeX\ displays when it
%ships out each page of your document to the \dvifile.
%\TeX\ will usually assume an
%extension `|.tex|' to an input file name
%if the input file name you gave doesn't
%have an extension. For some forms of \TeX\ you may be able to
%invoke \TeX\ directly for an input file by typing:
%\csdisplay
%tex screed
%|
%or something like this.
\bix^^{运行 \TeX}
你可以通过输入类似 `|run tex|' 或 `|tex|' (查看你的本地信息) 来运行 \TeX\ 来处理一个输入文件 |screed.tex|.
^^{输入文件}
\TeX\ 会作出如下显示
% 4/23/90 is Shakespeare's 426th birthday, and Karl's 26th.
\csdisplay
This is TeX, Version 3.0 (preloaded format=plain 90.4.23)
**
|
在这里, ``preloaded format'' (已预先载入的格式) 指的是 \TeX\ 提供的 ^{\plainTeX} 宏集的一个己预先产生的形式.
现在你可以输入 `|screed|' 来让 \TeX\ 来处理你的文件.
当处理结束时, 你可以在终端或者打印机印出的记录上 (如果你不使用终端) 得到类似下面的输出:
\csdisplay
(screed.tex [1] [2] [3] )
Output written on screed.dvi (3 pages, 400 bytes).
Transcript written on screed.log.
|
这个输出大部分是不言自明的.
在括号中的数字是 \TeX\ 在把每页内容输入 \dvifile\ 时所显示的当前页码.
当你提供的名件名不含扩展名时, \TeX\ 往往会把你的文件扩展名当作 `|.tex|'.
在某些 \TeX\ 环境中, 你可能可以直接执行类似下面的语句:
\csdisplay
tex screed
|
来直接处理文档.
%Instead of providing your \TeX\ input from a file, you can type it directly at
%your terminal. To do so, type `^|\relax|' instead of `|screed|' at the
%`|**|' prompt.
%\TeX\ will now prompt you with a `|*|' for each line of input and interpret
%each line of input as it sees it.
%To terminate the input, type a command such as `|\bye|' that tells \TeX\
%you're done.
%Direct input is sometimes a handy way of experimenting with \TeX.
\TeX\ 不仅可以读取文件输入,也可以直接读取你在终端中的输入:
只需将 `|**|' 提示后的输入从 `|screed|' 改为 `^|\relax|'。
\TeX\ 将在你输入的各行前面给出 `|*|' 提示,
并且逐行解释你的输入。
输入类似 `|\bye|' 这样的命令可以结束输入。
在试验 \TeX\ 时直接输入有时更方便。
%When your input file contains other embedded input files, the displayed
%information indicates when \TeX\ begins and ends processing each
%embedded file.
%^^{input files//embedded}
%\xrdef{infiles}
%\TeX\ displays a left parenthesis and the file name
%when it starts working on a file and displays the corresponding right
%parenthesis when it's done with the file.
%If you get any ^{error messages} in the displayed output, you can match
%them with a file by looking for the most recent unclosed left parenthesis.
当你的输入文件包含其他嵌入的输入文件时,
显示的信息中表明了 \TeX\ 何时开始和结束处理每个嵌入文件。
^^{输入文件//嵌入输入文件}
\xrdef{infiles}
当 \TeX\ 开始处理一个文件时它显示一个左圆括号和该文件名,
而结束时显示一个对应的右圆括号。
如果在所显示的输出中有任何^{错误信息},
你就能从最接近的未配对左圆括号中确定是哪个文件引起的。
%For a more complete explanation of how to run \TeX,
%see \knuth{Chapter~6} and your ^{local information}.
%\eix^^{running \TeX}
要得到如何运行\TeX\ 的更完整解释,
可以见\knuth{第~6~章}以及你的^{本地信息}.
\eix^^{运行 \TeX}
%\section Preparing an input file
\section 准备输入文件
%In this section we explain some of the conventions that you must follow in
%preparing input for \TeX\null. Some of the information given here also
%appears in the examples in \chapterref{examples} of this book.
%^^{input, preparing}
在这一节中,我们解释准备 \TeX\ 输入文件时必须遵循的一些约定。
其中的有些信息同样出现在本书\chapterref{examples}的例子中。
^^{输入文件//准备输入文件}
%\subsection Commands and control sequences
\subsection 命令和控制序列
%\bix^^{commands}
%\bix^^{control sequences}
%Input to \TeX\ consists of a sequence of commands that tell \TeX\ how to
%typeset your document. Most characters act as commands of a particularly
%simple kind: ``typeset me''. The letter `|a|', for instance, is a
%command to typeset an `a'. But there's another kind of command---a
%\emph{control sequence}---that gives \TeX\ a more elaborate
%instruction. A control sequence ordinarily starts with a backslash
%(|\|), though you can change that convention if you need to.
%\xrdef{@backslash}
%For instance, the input:
\bix^^{命令}
\bix^^{控制序列}
\TeX\ 的输入由一系列指引 \TeX\ 如何排版文档的命令组成。
大部分字符如同一种特别简单的命令:``排版我''。
比如,字母 `|a|' 是作为命令将排版出 `a'。
但有另一种命令——\emph{控制序列}(control sequence)——将给 \TeX\ 提供更细致的指令。
控制序列通常以反斜杠(|\|)开头,但必要时你也可以更改此约定。
\xrdef{@backslash}
例如,下列输入:
%\csdisplay
%She plunged a dagger (\dag) into the villain's heart.
%|
%contains the control sequence |\dag|; it produces the typeset output:
%\display{%
%She plunged a dagger (\dag) into the villain's heart.
%}
%\noindent Everything in this example except for the |\dag| and the spaces
%acts like a ``typeset me'' command. We'll explain more about spaces
%on \xrefpg{spaces}.
\csdisplay
She plunged a dagger (\dag) into the villain's heart.
|
包含一个控制序列|\dag|;它排版出下列的输出:
\display{%
She plunged a dagger (\dag) into the villain's heart.
}
\noindent 在这个例子中,
除 |\dag| 和空格之外的每个字符都如同一个``排版我''命令。
在\xrefpg{spaces}中我们将更详细地解释空格的作用。
%There are two kinds of control sequences: \emph{control words}
%^^{control words}
%and \emph{control symbols}:
%^^{control symbols}
%\ulist\compact
%\li A control word consists of a
%backslash followed by one or more letters, e.g., `|\dag|'.
%The first character that isn't a letter marks the end
%of the control word.
%\li A control symbol consists of a backslash followed by a single character
%that isn't a letter, e.g., `|\$|'.
%The character can be a space or even the end of a line (which is a perfectly
%legitimate character).
%\endulist
控制序列可分为\emph{控制词}(control word)^^{控制词}%
和\emph{控制符}(control symbol)^^{控制符}这两种类型:
\ulist\compact
\li 控制词由反斜杠后跟一个或多个字母组成,例如`|\dag|'。
其后用一个非字母字符结束该控制词。
\li 控制符由反斜杠后跟一个单个的非字母字符组成,例如`|\$|'。
该非字母字符可以是空格符,甚或是行结束符(这也是合乎规则的字符)。
\endulist
%\noindent
%A control word (but not a control symbol)
%absorbs any spaces or ends of line that follow it.
%^^{control sequences//absorbing spaces}
%If you don't want to lose a space after a control word,
%follow the control sequence with a ^{control space}
%(|\!visiblespace|) or with `|{}|'. Thus either:
%\csdisplay
%The wonders of \TeX\!visiblespace!.shall never cease!!
%|
%or:\hfil\
%\csdisplay
%The wonders of \TeX{} shall never cease!!
%|
%produces:
%\display{%
%The wonders of \TeX{} shall never cease!
%}
%\noindent rather than:
%\display{%
%The wonders of \TeX shall never cease!
%}
%\noindent
%which is what you'd get if you left out the `|\|\visiblespace'
%or the `|{}|'.
\noindent
控制词后的任何空格或行结束符将被忽略(但控制符后不会这样)。
^^{控制序列//忽略空格}
如果你真要在控制词后得到一个空格,
可以在该控制词后键入一个^{控制空格}(|\!visiblespace|)或者`|{}|'。
因而这样输入:
\csdisplay
The wonders of \TeX\!visiblespace!.shall never cease!!
|
或者这样输入:\hfil\
\csdisplay
The wonders of \TeX{} shall never cease!!
|
将得到同样的结果:
\display{%
The wonders of \TeX{} shall never cease!
}
\noindent 作为对比,下面的结果:
\display{%
The wonders of \TeX shall never cease!
}
\noindent
是你去掉上面输入中的`|\|\visiblespace'或者`|{}|'后得到的。
%Don't run a control word together with the text that follows it---\TeX\
%won't know where the control word ends. For instance, the |\c| control
%sequence places a cedilla accent on the character that follows it. The
%French word {\it gar\c con\/} must be typed as
%`|gar\c!visiblespace!.con|', not `|gar\ccon|'; if you write the latter,
%\TeX\ will complain about an undefined control sequence |\ccon|.
不要将控制词和其后的文本连在一起---这样\TeX\ 无法知道控制词在哪里结束。
比如,控制词|\c|给其后的字符加上软音符。
要得到法文单词{\it gar\c con\/},你必须输入`|gar\c!visiblespace!.con|',
而不是`|gar\ccon|';若你输入后者,\TeX\ 将抱怨有未定义的控制序列|\ccon|。
%A control symbol, on the other hand, doesn't absorb anything that
%follows it. Thus you must type `\$13.56' as `|\$13.56|', not
%`|\$!vs13.56|'; the latter form would produce `\hbox{\$ 13.56}'.
%However, those accenting commands that are named by control symbols are
%defined in such a way that they produce the effect of absorbing a
%following space. Thus, for example, you can type the French word {\it
%d\'eshabiller\/} either as `|d\'eshabiller|' or as
%`|d\'!visiblespace!.eshabiller|'.
另一方面,控制符后面的任何字符都不会被忽略。
因此,要得到`\$13.56'你必须键入`|\$13.56|',
而不是`|\$!vs13.56|';后者将生成`\hbox{\$ 13.56}'。
然而,那些作为控制符的重音命令,是以忽略其后空格的方式定义的。
例如,要得到法文单词{\it d\'eshabiller\/},键入`|d\'eshabiller|',
或者`|d\'!visiblespace!.eshabiller|'都可以。
%Every control sequence is also a command,
%but not the other way around.
%^^{commands//versus control sequences}
%^^{control sequences//versus commands}
%For instance, the letter `|N|'
%is a command, but it isn't a control sequence.
%In this book we ordinarily use ``command'' rather than
%``control sequence'' when either term would do.
%We use ``control sequence'' when we want to emphasize aspects of \TeX\
%syntax that don't apply to commands in general.
每个控制序列同时也是一个命令,但反之未必。
^^{命令//与控制序列对比}
^^{控制序列//与命令对比}
例如字母`|N|'是一个命令,但它不是一个控制序列。
在本书里面,当两者都适用时我们用``命令''而不用``控制序列''。
在强调 \TeX\ 的语法层面时,我们用``控制序列'',
因为此时用``命令''一般并不合适。
%\eix^^{control sequences}
%\eix^^{commands}
\eix^^{控制序列}
\eix^^{命令}
%\subsection Arguments
\subsection 参量
%\xrdef{arg1}
%Some commands need to be followed by one or more
%\emph{arguments} ^^{arguments}
%that help to determine what the command does.
%For instance, the |\vskip| command, which
%tells \TeX\ to skip down (or up) the page,
%expects an argument specifying how much space to skip. To skip
%down two inches, you would type `|\vskip 2in|', where |2in|
%is the argument of |\vskip|.
\xrdef{arg1}
有些命令的运行依赖于其后的一个或多个\emph{参量}(argument)^^{参量}。
例如,|\vskip|命令告诉 \TeX\ 在页面中往上(或往下)跳过一定间距,
它需要一个参量来指定所跳过间距的大小。
要往下跳过两英寸,你需要键入`|\vskip 2in|',
其中的|2in|就是|\vskip|的参量。
%Different commands expect different kinds of arguments. Many commands
%expect dimensions, such as the |2in| in the example above.
%Some commands, particularly those defined by macros,
%expect arguments that are either a single character or some
%text enclosed in braces.
%Yet others require that their arguments be enclosed in braces, i.e.,
%they don't accept single-character arguments.
%The description of each command in this book tells you what kinds of arguments,
%if any, the command expects.
%In some cases, required braces define a group (see \xref{bracegroup}).
不同的命令要求不同类型的参量。
很多命令的参量要求是长度值,比如上面例子中的|2in|。
有些命令,特别是用宏定义的命令,
其参量可以是单个字符或者放在花括号中的文本。
而对其他有些命令,其参量只能放在花括号中,而不能是单个字符。
在本书对各个命令的描述中,若一个命令需要参量,
我们都说明了该命令所需参量的类型。
在有些情形中,命令的参量所需的花括号定义了一个编组(见\xref{bracegroup})。
%\secondprinting{\vfill\eject}
%\subsection Parameters
\subsection 参数
%\xrdef{introparms}
%Some commands are parameters (\xref{parameter}).
%^^{parameters//as commands}
%You can use a parameter in either of two ways:
%\olist
%\li You can use the value of a parameter
%as an argument to another command. For example, the command
%\hbox{|\vskip\parskip|}
%causes a vertical skip by the value of the |\parskip| (paragraph skip)
%glue parameter.
%\li You can change the value of the parameter by assigning
%something to it. For example, the assignment \hbox{|\hbadness=200|}
%causes the value of the |\hbadness| number parameter to be $200$.
%\endolist
%\noindent
%We also use the term ``parameter'' to refer to entities such as |\pageno|
%that are actually registers but behave just like parameters.
%^^{registers//parameters as}
\xrdef{introparms}
有些命令实际上是参数(parameter,见\xref{参数})。
^^{参数//作为命令}
你可以按下面两种方式使用这种参数:
\olist
\li 将该参数的值用作其他命令的参量。
例如 \hbox{|\vskip\parskip|} 这个命令生成大小%
等于粘连参数|\parskip|(段落间距)的竖直间距。
\li 通过赋值修改该参数的值。
例如 \hbox{|\hbadness=200|} 这个赋值使得|\hbadness|参数的值变为$200$.
\endolist
\noindent
有些命令,例如|\pageno|,虽然是寄存器但和参数的用法一样。
因此我们同样使用``参数''这个术语来指代这些命令。
^^{寄存器//作为参数}
%Some commands are names of tables. These commands are used like
%parameters, except that they require an additional argument that
%specifies a particular entry in the table. For example, |\catcode| names
%a table of category codes (\xref{category code}). Thus
%the command
%\hbox{|\catcode`~=13|} sets the category code of the `|~|'
%character to $13$.
有些命令是表名。这些命令的用法和参数类似,
只是它们需要额外的参量指定表格项。
例如,|\catcode| 是类别码表格的名称(\xref{类别码})。
因此,\hbox{|\catcode`~=13|} 这个命令设置字符`|~|'的类别码为$13$。
%\subsection Spaces
\subsection 空格
%\xrdef{spaces}
%\bix^^{spaces}
%You can freely use extra spaces in your input. Under nearly all circumstances
%\TeX\ treats several spaces in a row as being equivalent to a
%single space. For instance, it doesn't matter whether you put one space
%or two spaces after a ^{period} in your input. Whichever you do, \TeX\
%performs its end-of-sentence maneuvers and leaves the appropriate
%(in most cases) amount of space after the period.
%\TeX\ also treats the end of an input line as equivalent to a space.
%Thus you can end your input lines wherever it's convenient---%
%\TeX\ makes input
%lines into
%paragraphs in the same way no matter where the line breaks are in your
%input.
\xrdef{spaces}
\bix^^{空格}
在输入文件中你可以任意加上额外的空格。
在几乎所有情形中 \TeX\ 都将同一行的连续多个空格看成一个空格。
例如,在^{句号}后加上一个或两个空格是没有差别的。
不论按照哪种写法,\TeX\ 都会执行其句子结束操作,
并在句号后加上适当(在多数情形下)大小的间隔。
\TeX\ 同样将输入中的行结束符视为一个空格。
因此在输入时你可以在方便的地方换行——%
\TeX\ 按照此方式将各输入行转换为段落,而不在乎输入中的换行位置。
%A blank line in your input marks the end of a paragraph.
%^^{paragraphs//ending}
%Several blank lines are equivalent to a single one.
输入中的一个空行结束当前段落。
^^{段落//结束段落}
多个空行也等同于一个空行。
%\TeX\ ignores input spaces within math formulas (see below). Thus you can
%include or omit spaces anywhere within a math formula---\TeX\ doesn't care.
%Even within a math formula, however,
%you must not run a control word together with a following letter.
\TeX\ 忽略数学公式中的空格(见后面)。
因此,你可以加上或者省去公式中的空格——\TeX\ 不在乎这个。
但即使在数学公式中,你也不要将控制词和其后的字母连在一起。
%If you are defining your own macros, you need to be particularly careful about
%where you put ends of line in their definitions.
%It's all too easy to define a macro that produces an
%^{unwanted space} in addition to whatever else it's supposed to produce.
%We discuss this problem elsewhere since it's somewhat
%technical; see \xrefpg{unwantedspace}.
在定义自己的宏时,你必须小心定义中的行结束符位置。
因为一不小心该宏就在你希望的空格之外生成了^{不需要的空格}。
因为这是个有些技术性的问题,我们在其他地方也讨论到此问题;见\xrefpg{unwantedspace}。
%A space or its equivalent between two words in your input doesn't simply turn
%into a space character in your output.
%A few of these input spaces turn into ends of lines
%in the output,
%since input lines generally don't correspond to output lines.
%The others turn into spaces of variable width called ``glue'' (\xref{glue}),
%which has a natural size (the size it ``wants to be'')
%but can stretch or shrink.
%When \TeX\ is typesetting a paragraph
%that is supposed to have an even right margin (the usual
%case), it adjusts the widths of the glue in each line
%to get the lines to end at the margin.
%(The last line of a paragraph is an exception, since it isn't ordinarily
%required to end at the right margin.)
输入文件中两单词间的一个空格或其等价字符,
并不简单地变成输出中的一个空格。
由于输入行和输出行通常不会正好对应,
输入中的这些空格有的变成输出中的行结束符,
另外有些空格则变成宽度可变的间隔即``粘连'' (\xref{粘连});
粘连有其自然宽度(它希望的宽度),但也可以伸展或者收缩。
\TeX\ 排版要求右页边对齐(通常如此)的段落时,
将调整各行的粘连的宽度以让各行正好在页边结束。%
(段落的最后一行是个例外,因为一般不要求它在右页边结束。)
%You can prevent an input space from turning into an end of line by using a
%^{tie} (^|~|).
%For example, you wouldn't want \TeX\ to put a line break between the
%`Fig.' and `8' of `Fig.~8'.
%By typing `|Fig.~8|' you can prevent such a line break.
%\eix^^{spaces}
%\needspace{2in}
要阻止输入中的空格在输出中变成行结束符,你可以用^{带子} (^|~|)。
比如,你不会希望 \TeX\ 在`Fig.~8'的 `Fig.' 和 `8' 之间断行。
输入 `|Fig.~8|' 就可以禁止这样断行。
\eix^^{空格}
%\needspace{2in}
%\subsection Comments
\subsection 注释
%\xrdef{comments}
%\pix\bix^^{comments}
%You can include comments in your \TeX\ input.
%When \TeX\ sees a comment it just passes over it, so
%what's in a comment doesn't affect your typeset document in any way.
%Comments are useful for
%providing extra information about what's in your input file.
%For example:
%\csdisplay
%% ========= Start of Section `Hedgehog' =========
%|
\xrdef{comments}
\pix\bix^^{注释}
在\TeX\ 输入中可以包含注释。\TeX\ 跳过它所碰到的注释,
因此注释中的内容不会以任何方式影响到排版的文档。
注释用于在输入文件中提供更多的信息。
例如:
\csdisplay
% ========= Start of Section `Hedgehog' =========
|
%{\indexchar % }%
%A comment starts with a percent sign (|%|) and extends to the end of the
%input line.
%\TeX\ ignores not just the comment but the end of the line as well, so
%comments have another very
%important use: connecting two lines so that the end of line
%^^{line breaks//deleting}
%between them is invisible to \TeX\ and doesn't generate
%an output space or an end of line.
%For instance, if you type:
%\csdisplay
%A fool with a spread%
%sheet is still a fool.
%|
%you'll get:
%\display{
%A fool with a spread%
%sheet is still a fool.
%}
%\eix^^{comments}
{\indexchar % }%
注释以百分号(|%|)开始,一直延续到该输入行结束。
\TeX\ 既忽略注释也忽略该行的结束符,
因此注释有另外的重要用法:将两个输入行连接起来,
^^{断行//删除断行}
使得 \TeX\ 看不到两行间的行结束符,
从而不会在输出中生成空格或换行。
例如,对如下的输入:
\csdisplay
A fool with a spread%
sheet is still a fool.
|
你得到的输出为:
\display{
A fool with a spread%
sheet is still a fool.
}
\eix^^{注释}
%\subsection Punctuation
\subsection 标点
%\null
%\xrdef{periodspacing}
%\TeX\ normally adds some extra space after what it thinks is a
%^{punctuation} mark at the end of a sentence,
%namely, `^|.|', `^|?|', or `|!!|' \indexchar !
%^^{period} ^^{question mark} ^^{exclamation point}
%followed by an input space.
%\TeX\ doesn't add
%the extra space if the punctuation mark follows
%a capital letter, though, because it assumes the capital
%letter to be an initial in someone's name.
%You can force the extra space where it wouldn't otherwise occur by
%typing something like:
%\csdisplay
%A computer from IBM\null?
%|
\null
\xrdef{periodspacing}
若 `^|.|',`^|?|' 或 `|!!|' 之后有个输入空格,\indexchar !
^^{句号} ^^{问号} ^^{感叹号}
\TeX\ 认为它是句末^{标点}符号,并在其后添加额外间隔。
但若该标点符号之前为大写字母,\TeX\ 就不会添加额外间隔,
因为它认为大写字母是人名的首字母。
如若不然你可以强制生成额外间隔,例如:
\csdisplay
A computer from IBM\null?
|
%The |\null| doesn't produce any output, but it does prevent \TeX\
%from associating the capital `M' with the question mark.
%On the other hand, you can cancel the
%extra space where it doesn't belong by typing a control space
%after the punctuation mark, e.g.:
%\csdisplay
%Proc.\!visiblespace!.Royal Acad.\!visiblespace!.of Twits
%|
%so that you'll get:
%\display{Proc.\ Royal Acad.\ of Twits}
%\noindent rather than:
%\display{Proc. Royal Acad. of Twits}
命令 |\null| 不生成任何输出,
但它阻止 \TeX\ 将大写字母`M'和问号结合在一起。
反过来,如果某标点符号不为句末标点,
你也能够取消该标点之后的额外间隔;
这可以通过在其后键入控制空格达到,例如:
\csdisplay
Proc.\!visiblespace!.Royal Acad.\!visiblespace!.of Twits
|
得到的正确结果为:
\display{Proc.\ Royal Acad.\ of Twits}
\noindent 而去掉控制空格后的结果是:
\display{Proc. Royal Acad. of Twits}
%Some people prefer not to leave more space after punctuation at the
%end of a sentence. You can get this effect with the
%^|\frenchspacing| command (\xref\frenchspacing).
%|\frenchspacing| is often recommended for ^{bibliographies}.
有些人更喜欢不在句末标点后留下更多间隔。
利用 ^|\frenchspacing| 命令(\xref\frenchspacing )你就可达成此效果。
在^{参考文献}中通常建议使用这个 |\frenchspacing| 命令。
%For single ^{quotation marks}, you should use the left and right
%single quotes
%(|`| and |'|) on your keyboard. For left and right
%double quotation marks, use two left single
%quotes or two right single quotes (|``| or |''|) rather
%than the double quote (|"|) on your keyboard.
%The keyboard double quote
%will in fact give you a right double quotation mark in
%many fonts, but the two right single quotes
%are the preferred \TeX\ style.
%For example:
对于单^{引号}, 用键盘上的左右单引号(|`| 和 |'|)就可以得到。
对于左双引号或右双引号,
需要用两个左单引号(|``|)或右单引号(|''|)得到,
不能直接用键盘上的双引号(|"|)。
键盘上的双引号在多数字体中将得到一个右双引号,
但两个右单引号是 \TeX\ 中首选的写法。例如:
%\vbox{%
%\csdisplay
%There is no `q' in this sentence.
%``Talk, child,'' said the Unicorn.
%She said, ``\thinspace`Enough!!', he said.''
%|
%}%
%These three lines yield:
%\display{\par\restoreplainTeX
%There is no `q' in this sentence.
%\par ``Talk, child,'' said the Unicorn.
%\par She said, ``\thinspace`Enough!', he said.''
%}
%\noindent
%The |\thinspace| in the third input line prevents
%the single quotation mark from coming
%too close to the double quotation marks.
%Without it, you'd just see three
%nearly equally spaced quotation marks in a row.
\vbox{%
\csdisplay
There is no `q' in this sentence.
``Talk, child,'' said the Unicorn.
She said, ``\thinspace`Enough!!', he said.''
|
}%
这三行输入得到的结果为:
\display{\par\restoreplainTeX
There is no `q' in this sentence.
\par ``Talk, child,'' said the Unicorn.
\par She said, ``\thinspace`Enough!', he said.''
}
\noindent
第三个输入行中的 |\thinspace| 避免单引号和双引号太过靠近。
否则,你将看到三个并排的间隔相近的引号。
%\TeX\ has three kinds of ^{dashes}:
%\ulist\compact
%\li Short ones (hyphens) like this ( - ). You get them by typing~`^|-|'.
%\li Medium ones (en-dashes) like this ( -- ). You get them by typing~`^|--|'.
%\li Long ones (em-dashes) like this ( --- ). You get them by typing~`^|---|'.
%\endulist
%\noindent
%Typically you'd use hyphens to indicate compound words like
%``will-o'-the-wisp'',
%en-dashes to indicate
%page ranges such as ``pages~81--87'', and em-dashes to indicate
%a break in continuity---like this.
在 \TeX\ 中有三种^{横线号}(dash):
\ulist\compact
\li 短横线即连字号(hyphen)如这样( - )。键入~`^|-|'~可以得到。
\li 中横线即连接号(en-dash)如这样( -- )。键入~`^|--|'~可以得到。
\li 长横线即破折号(em-dash)如这样( --- )。键入~`^|---|'~可以得到。
\endulist
\noindent
一般地,你将用连字号表示像“will-o'-the-wisp”(鬼火)这样的复合词,
用连接号表示像“第~81--87~页”这样的页码起止,
而用破折号表示语气转折\null{---}像这样。
% 用 \null 和 {} 绕开 xecjk 的问题
%\subsection Special characters
\subsection 特殊字符
%Certain characters have special meaning to \TeX, so you shouldn't use them
%in ordinary text. They are:
在 \TeX\ 中某些字符有特殊的含义,
因而不能在普通文本中使用。这些特殊字符为:
%\csdisplay
% $ # & % _ ^ ~ { } \
%|
%^^|$//in ordinary text|
%^^|#//in ordinary text|
%^^|&//in ordinary text|
%^^|_//in ordinary text|
%^^|^//in ordinary text|
%^^|~//in ordinary text|
%^^|%//in ordinary text|
%^^|{//in ordinary text|
%^^|}//in ordinary text|
%{\recat!ttidxref[\//in ordinary text]]
%\noindent
%In order to produce them in your typeset document,
%you need to use circumlocutions. For the first five,
%you should instead type:
%^^|\$|
%^^|\#|
%^^|\&|
%^^|\%|
%^^|\_|
%\csdisplay
% \$ \# \& \% \_
%|
\csdisplay
$ # & % _ ^ ~ { } \
|
\ifoldeplain
^^|$//在普通文本中|
^^|#//在普通文本中|
^^|&//在普通文本中|
^^|_//在普通文本中|
^^|^//在普通文本中|
^^|~//在普通文本中|
^^|%//在普通文本中|
^^|{//在普通文本中|
^^|}//在普通文本中|
{\recat!ttidxref[\//在普通文本中]]
\fi
\noindent
要在排版的文档中生成它们,你需要使用间接的方法。
对前面五个字符,你需要键入:
\ifoldeplain
^^|\$|
^^|\#|
^^|\&|
^^|\%|
^^|\_|
\fi
\csdisplay
\$ \# \& \% \_
|
%\noindent
%For the others, you need something more elaborate:
\noindent
而对另外五个字符,你需要键入更多:
\csdisplay
\^{!visiblespace} \~{!visiblespace} $\{$ $\}$ $\backslash$
|
%\subsection Groups
\subsection 编组
%\bix^^{groups}
%A \emph{group}
%consists of material enclosed in matching left and right braces (|{| and
%|}|).
%^^|{//starting a group|
%^^|}//ending a group|
%By placing a command within a group, you can limit its effects to
%the material within the group.
%For instance, the |\bf| command tells \TeX\ to set
%something in {\bf boldface} type. If you were to put |\bf| into your input
%and do nothing else to counteract it, everything in your document following the
%|\bf| would be set in boldface.
%By enclosing |\bf| in a group,
%you limit its effect to the group. For example, if you type:
%\csdisplay
%We have {\bf a few boldface words} in this sentence.
%|
%\noindent you'll get:
%\display{We have {\bf a few boldface words} in this sentence.}
\bix^^{编组}
包含在配对的左右花括号(|{| 和 |}|)中的内容组成一个\emph{编组}。
^^|{//开始编组|
^^|}//结束编组|
编组内部的命令,其作用范围被限制在该编组内部。
例如,|\bf| 命令让 \TeX\ 将某些内容用粗体显示。
如果你将 |\bf| 放在你的输入中,而没有用任何方式取消它,
|\bf| 之后的所有内容都将以粗体显示。
如果将 |\bf| 包含在一个编组中,
就可以将它的作用限制在此编组中。
比如,如果你键入:
\csdisplay
We have {\bf a few boldface words} in this sentence.
|
\noindent 你将会得到如下的结果:
\display{We have {\bf a few boldface words} in this sentence.}
%\noindent You can also use a group to limit the effect of
%an assignment to one of \TeX's parameters.
%These parameters contain values that affect how \TeX\ typesets your document.
%For example, the value of the |\parindent|
%parameter specifies the indentation at the beginning of a paragraph.
%The assignment |\parindent = 15pt|
%sets the indentation to $15$ printer's points.
%By placing this assignment at the beginning
%of a group containing a few paragraphs, you can change
%the indentation of just those paragraphs. If you don't enclose
%the assignment in a group,
%the changed indentation will apply to the rest of the document (or up to the
%next assignment to |\parindent|, if there's a later one).
\noindent 利用编组,你可以限制 \TeX\ 某个参数的取值的作用范围。
这些参数的取值影响 \TeX\ 对文档的排版。
例如,|\parindent| 参数的值指定了段首缩进量,
赋值 |\parindent = 15pt| 将设定该缩进量为 $15$ 点。
若将该赋值放在包含几个段落的编组开始处,
你就可以仅仅改变这几个段落的段首缩进。
若不将该赋值包含在编组中,
对缩进量的修改将作用到文档的剩余部分%
(或者作用到下个对|\parindent|的赋值为止,若还有下个赋值的话)。
%\xrdef{bracegroup}
%Not all pairs of braces indicate a group.
%In particular, the braces associated with an argument for which the
%braces are \emph{not} required don't indicate a group---they just
%serve to delimit the argument.
%Of those commands that do require braces for their arguments,
%some treat the braces as defining a group
%and the others interpret the argument in some special way that depends on
%the command.\footnote
%{More precisely, for primitive commands either
%the braces define a group or they enclose tokens that aren't processed in
%\TeX's stomach.
%For |\halign| and |\valign| the group has a trivial
%effect because everything within the braces either doesn't reach the stomach
%(because it's in the template) or is enclosed in a further inner group.
%^^|\halign//grouping for|
%^^|\valign//grouping for|
%}
%\eix^^{groups}
\xrdef{bracegroup}
并非所有配对花括号都表示一个编组。
特别地,若参量\emph{不要求}有花括号,
则与该参量一起的花括号并不表示一个编组%
——它们仅用于确定该参量的界限。
对于那些参量中确实需要花括号的命令,
有些命令将花括号作为编组的定义,
而其他命令用各自的特殊方式解释该参量。\footnote
{更准确地说,对于原始命令,
花括号要么定义了一个编组,要么不会在 \TeX\ 的胃中被处理。
对于 |\halign| 和 |\valign| 命令,编组只有平凡的效果;
这是由于编组中的一切东西要么不会到达胃里(因为它在模板中),
要么包含在更深一层的编组中。
^^|\halign//阵列中的编组|
^^|\valign//阵列中的编组|
}
\eix^^{编组}
%\subsection Math formulas
\subsection 数学公式
%\bix^^{math}
%\xrdef{mathform}
%A math formula can appear in text (\emph{text math})
%^^{text math}
%or set off on a line by itself
%with extra vertical space around it (\emph{display math}).
%^^{display math}
%You enclose a text formula in single dollar signs (|$|)
%and a displayed formula in double dollar signs (|$$|).
%\ttidxref{$}\ttidxref{$$}
%For example:
\bix^^{数学}
\xrdef{mathform}
数学公式可以出现在正文中(\emph{文内公式}),
^^{文内公式}
或者出现在留出额外上下间距的单独一行中(\emph{陈列公式})。
^^{陈列公式}
文内公式两边用单个美元符(|$|)括起来,
而陈列公式两边用双个美元符(|$$|)括起来。
\ifoldeplain\ttidxref{$}\ttidxref{$$}\fi
例如:
%\csdisplay
%If $a<b$, then the relation $$e^a < e^b$$ holds.
%|
%\noindent This input produces:
%\display{\centereddisplays
%If $a<b$, then the relation $$e^a < e^b$$ holds.}
%\smallskip
%\noindent \chapterref{math} describes the commands that are useful
%in math formulas.
%\eix^^{math}
\csdisplay
If $a<b$, then the relation $$e^a < e^b$$ holds.
|
\noindent 此输入得到的结果是:
\display{\centereddisplays
If $a<b$, then the relation $$e^a < e^b$$ holds.}
\smallskip
\noindent \chapterref{math}描述了数学公式中常用的命令。
\eix^^{数学}
%\section How \TeX\ works
\section \TeX\ 如何工作
%In order to use \TeX\ effectively, it helps to
%have some idea of how \TeX\ goes about
%its activity of transmuting input into output.
%You can imagine \TeX\ as a kind of organism with ``eyes'',
%``mouth'', ``gullet'',
%``stomach'', and ``intestines''.
%Each part of the organism transforms its input in some way and passes
%the transformed input to the next stage.
为了更有效地使用 \TeX ,
对 \TeX\ 着手将输入转换为输出的活动有所了解是有益的。
你可以将 \TeX\ 想象为一种有“眼睛”、“嘴巴”、“食道”、“胃”以及“肠道”的生物体。
该生物体的每个器官都以某种方式转换它的输入,并将转换的结果送到下个器官中。
%The ^{eyes} transform an input file into a sequence of characters.
%The ^{mouth} transforms the sequence of characters into a sequence of
%\emph{tokens},
%^^{tokens}
%where each token is either a single character or a control sequence.
%^^{control sequences//as tokens}
%The gullet expands the tokens into a sequence of
%\emph{primitive commands}, which are also tokens.
%^^{expanding tokens}
%The ^{stomach} carries out the operations specified by the primitive commands,
%producing a sequence of pages.
%Finally, the ^{intestines} transform each page into the form required
%for the \dvifile\ and send it there.
%^^{\dvifile//created by \TeX's intestines}
%These actions are described in more detail
%in \chapterref{concepts} under \conceptcit{\anatomy}.
%^^{\anatomy}
^{眼睛}将输入文件转换为一系列字符。
^{嘴巴}将这串字符转换为一系列\emph{记号},
^^{记号}
其中每个记号是单个字符或者一个控制序列。
^^{控制序列//作为记号}
食道将该串记号展开为一系列\emph{原始命令}记号。
^^{展开记号}
^{胃}执行原始命令指定的操作,生成一些页面。
最后,^{肠道}将每个页面转换为 \dvifile 所需的形式并发送给它。
^^{\dvifile//由 \TeX\ 的肠道生成}
这些活动在\chapterref{concepts}的\conceptcit{\anatomy}中有更详细的描述。
^^{\anatomy}
%The real typesetting goes on in the stomach.
%The commands instruct \TeX\ to typeset such-and-such a character in
%such-and-such a font, to insert an interword space, to end a paragraph, and
%so on.
%Starting with individual typeset characters and other simple typographic
%elements, \TeX\ builds up a page ^^{pages} as a nest of
%^{boxes} within boxes within boxes \seeconcept{box}.
%Each typeset character occupies a box, and so does an entire page.
%A box can contain not just smaller boxes but also \emph{glue} ^^{glue}
%(\xref{glue}) and a few other things.
%The glue produces
%space between the smaller boxes.
%An important property of glue is that it can stretch and shrink;
%thus \TeX\ can make a box
%larger or smaller by stretching or shrinking
%the glue within~it.
实际的排版活动出现在胃中。
这些命令指导 \TeX\ 用这样或那样的字体排版这个或那个字符,
插入单词间空隔,结束一个段落,等等。
从单个排版字符及其他简单排印元素开始,
\TeX\ 将^{盒子}一层层放入其他盒子中\seeconcept{盒子},
这一整套盒子构造了一个页面^^{页面}。
每个排版字符占用一个盒子,整个页面也一样。
盒子中不仅包含更小的盒子,也包含\emph{粘连}^^{粘连}
(\xref{粘连})和一些其他东西。
粘连生成小盒子之间的间距。
粘连的一个重要属性在于它可以伸展和收缩;
因此通过伸缩盒子中的粘连,\TeX\ 可以让盒子变大或变小。
%Roughly speaking, a line is a box containing a sequence of character boxes,
%and a page is a box containing a sequence of line boxes.
%There's glue between the words of a line and between the lines of a page.
%\TeX\ stretches or shrinks
%the glue on each line so as to make the right margin
%of the page come out even and the glue on each page
%so as to make the bottom margins of different pages be equal.
%Other kinds of typographical elements can also appear in a line or in a page,
%but we won't go into them here.
粗略说来,文本行是一个包含一系列字符盒子的盒子,
而页面是一个包含一系列行盒子的盒子。
一行的各单词之间以及页面的各行之间都有粘连。
\TeX\ 伸缩各行中的粘连以让右页边对齐,
伸缩各页中的粘连以让各页的下边距相等。
其他类型的排印元素也可以出现在行内或页内,但我们不在这里讨论。
%As part of the process of assembling pages, \TeX\ needs to break paragraphs
%into lines and lines into pages. The stomach first sees a paragraph as one
%long line, in effect. It inserts \emph{line breaks}
%^^{line breaking}
%in order to transform
%the paragraph into a sequence of lines of the right length, performing a
%rather elaborate analysis in order to choose the set of breaks
%that makes the paragraph look best
%\seeconcept{line break}.
%The stomach carries out a similar
%but simpler process in order to transform a sequence of lines into a page.
%Essentially the stomach accumulates lines until no more lines can fit on the
%page. It then chooses a single place to break the page, putting the lines
%before the break on the current page
%and saving the lines after the break for the
%next page \seeconcept{page break}. ^^{page breaks//inserted by \TeX's stomach}
作为组装页面过程的一部分,
\TeX\ 需要将段落分为多行,将多行组成页面。
事实上,\TeX\ 的胃刚开始将段落看成一个很长的行。
它插入\emph{断行点}以将段落分为长度合适的一些行,
^^{断行}
通过复杂的分析以找到最佳的断行点的集合\seeconcept{断行点}。
\TeX\ 的胃也执行类似但简单些的分析以将一些行组成页面。
基本上,胃累加各行直到页面上放不下更多的行。
然后它选择一个分页位置,将该分页位置之前的各行放在当前页面,
将之后的各行留给下个页面\seeconcept{分页点}。%
^^{分页//由 \TeX\ 的胃插入}
%When \TeX\ is assembling an entity from a list of items (boxes, glue, etc.),
%it is in one of six
%\emph{modes} ^^{modes} (\xref{mode}).
%The kind of entity it is assembling defines the mode that it is in.
%There are two ordinary modes: ordinary horizontal mode for assembling
%paragraphs (before they are broken into lines)
%and ordinary vertical mode for assembling pages.
%There are two restricted modes:
%restricted horizontal mode for appending items horizontally to form
%a horizontal box
%and internal vertical mode for appending items vertically to form
%a vertical box (other than a page).
%Finally, there are two math modes: text math mode for assembling math formulas
%within a paragraph and display math mode for assembling math formulas that are
%displayed on lines by themselves (see ``Math formulas'', \xref{mathform}).
在 \TeX\ 组装一个列表项(盒子,粘连等)中的某个东西时,
它总处于六种\emph{模式}^^{模式}(\xref{模式})的其中一种模式中。
它所组装的东西的类型定义了它所在的模式。
首先有两种普通模式:普通水平模式用于组装段落(在它们分为多行之前),
普通竖直模式用于组装页面。
其次有两种限制模式:受限水平模式用于水平地添加元素形成水平盒子,
内部竖直模式用于竖直地添加元素以形成竖直盒子(非页面盒子)。
最后还有两种数学模式:文内数学模式用于组装段落内部的数学公式,
陈列数学模式用于组装单独一行显示的数学公式(见“数学公式”,\xref{mathform})。
%\section New \TeX\ versus old {\TeX}
\section{新 \TeX\ 和老 \TeX}
%\xrdef{newtex}
%In 1989 Knuth made a major revision to \TeX\ in order to
%adapt it to the
%character sets needed to support typesetting for languages other than
%English.\space ^^{foreign languages}
%The revision included a few minor extra features that could be added
%without disturbing anything else.
%This book describes ``^{\newTeX}''.
%If you're still using an older version
%of \TeX\ (version $2.991$ or earlier),
%you'll want to know what features of {\newTeX} you can't use.
%The following features aren't available in the older versions:
%\ulist\compact
%\li ^|\badness| (\xref\badness)
%\li ^|\emergencystretch| (\xref\emergencystretch)
%\li ^|\errorcontextlines| (\xref\errorcontextlines)
%\li ^|\holdinginserts| (\xref\holdinginserts)
%\li ^|\language|, ^|\setlanguage|, and |\new!-lan!-guage|
%(\pp\xrefn\language, \xrefn{\@newlanguage}) ^^|\newlanguage|
%\li ^|\lefthyphenmin| and ^|\righthyphenmin| (\xref\lefthyphenmin)
%\li ^|\noboundary| (\xref\noboundary)
%\li ^|\topglue| (\xref\topglue)
%\li The |^^|$xy$ notation for hexadecimal digits (\xref{hexchars})
%\endulist
%\noindent
%We recommend that you obtain new \TeX\ if you can.
\xrdef{newtex}
在 1989 年,Knuth 对 \TeX\ 做了一次大幅修改,
使得它能够处理非英语排版所需的字符集。^^{外语}
这次修改还包括了一些额外的不干扰其它东西的小功能,
这本书介绍 ``^{\newTeX}''。
如果你仍使用旧版本的 \TeX ($2.991$ 版或以前的版本),
你可能会想知道哪些 {\newTeX} 的功能你是没法使用的。
以下这些功能无法在旧版中使用:
\ulist\compact
\li ^|\badness|(\xref\badness )
\li ^|\emergencystretch|(\xref\emergencystretch )
\li ^|\errorcontextlines|(\xref\errorcontextlines )
\li ^|\holdinginserts|(\xref\holdinginserts )
\li ^|\language|、^|\setlanguage| 和 |\new!-lan!-guage|%
(第 \xrefn\language 和 \xrefn{\@newlanguage}页)^^|\newlanguage|
\li ^|\lefthyphenmin| 和 ^|\righthyphenmin|(\xref\lefthyphenmin )
\li ^|\noboundary|(\xref\noboundary )
\li ^|\topglue|( \xref\topglue )
\li 十六进制的数字表达方式 |^^|$xy$(\xref{hexchars})
\endulist
\noindent
我们建议你尽可能地使用新版本的 \TeX 。
%\section Resources
\section 资源
%\xrdef{resources}
%A number of resources are available to help you in using \TeX.
%\texbook\ is the definitive source of information on \TeX:
\xrdef{resources}
有很多资源可以帮助你使用 \TeX ,其中 \texbook\ 是最可靠的 \TeX\ 信息来源。
%\smallskip
%{\narrower\noindent
%^{Knuth, Donald E.}, \texbook. Reading, Mass.: Addison-Wesley, 1984.\par}
%\smallskip
%\noindent
%Be sure to get the seventeenth printing (January 1990) or later;
%the earlier printings don't cover the features of new \TeX.
\smallskip
{\narrower\noindent
^{Knuth, Donald E.}, \texbook. Reading, Mass.: Addison-Wesley, 1984.\par}
\smallskip
\noindent
请务必使用第十七次(1990 年 1 月)及以后的印刷版本。
早先的印刷版本不包括新 \TeX\ 的许多功能。
%^{\LaTeX} is a very popular collection of commands designed to simplify the use
%of \TeX. It is described in:
%\smallskip
%{\narrower\noindent\frenchspacing\spaceskip = 3.33pt plus 2pt minus 1.2pt
%^{Lamport, Leslie}, {\sl The \LaTeX\ Document Preparation System}.
%Reading, Mass.: Addison-Wesley, 1986.\par}
%\smallskip
%\noindent
%^{\AMSTeX} is the collection of commands adopted by the American Mathematical
%Society as a standard for submitting mathematical man\-u\-scripts
%electronically.
%It is described in:
%\smallskip
%{\narrower\noindent
%^{Spivak, Michael~D.}, {\sl The Joy of \TeX}. Providence, R.I.:
%American Mathematical Society, 1986.
%\par}
%\smallskip
%\noindent
%You can join the ^{\TUG} (TUG), which publishes a newsletter
%called {\it ^{TUGBoat}}.
%TUG is an excellent source not only for information about \TeX\ but also
%for collections of macros, including \AMSTeX.
%Its address is:
%\smallskip
%{\obeylines
%^{\TUG}
%c/o American Mathematical Society
%P.O. Box 9506
%Providence, RI 02940
%U.S.A.
%}
%\smallskip
%\noindent
%Finally, you can obtain copies of the ^|eplain.tex| macros
%described in \chapterref{eplain} as well as the macros used in typesetting
%this book.
%They are available through the Internet network by anonymous \ftp\ from the
%following hosts:
%{\obeylines\display{\tt
%labrea.stanford.edu [36.8.0.47]
%ics.uci.edu [128.195.1.1]
%june.cs.washington.edu [128.95.1.4]}}
^{\LaTeX} 是一套为了简化 \TeX\ 的使用而设计的命令集,
它在这本书里面有介绍\footnote{译注: 这本书中介绍的 \LaTeX\ 己经过时。}:
\smallskip
{\narrower\noindent\frenchspacing\spaceskip = 3.33pt plus 2pt minus 1.2pt
^{Lamport, Leslie}, {\sl The \LaTeX\ Document Preparation System}.
Reading, Mass.: Addison-Wesley, 1986.\par}
\smallskip
\noindent
^{\AMSTeX} 是一套美国数学学会定义的提交电子数学手稿的命令标准,
它在这里有介绍:
\smallskip
{\narrower\noindent
^{Spivak, Michael D.}, {\sl The Joy of \TeX}. Providence, R.I.:
American Mathematical Society, 1986.
\par}
\smallskip
\noindent
你可以加入 ^{\TUG}(TUG),这个组织出版一本名为 {\it ^{TUGBoad}} 的通讯。
TUG 是一个很好的信息来源渠道,它同时也提供包括 \AMSTeX\ 在内的很多 \TeX\ 宏包资源。
它的地址是:
\smallskip
{\obeylines
^{\TUG}
c/o American Mathematical Society
P.O. Box 9506
Providence, RI 02940
U.S.A.
}
\smallskip
\noindent
最后,你可以获取在\chapterref{eplain}介绍的用来排版本书的宏包 ^|eplain.tex|。
它可以通过使用 \ftp 匿名登录获取:
{\obeylines\display{\tt
labrea.stanford.edu [36.8.0.47]
ics.uci.edu [128.195.1.1]
june.cs.washington.edu [128.95.1.4]}}
%The electronic version includes additional macros
%that format input for the
%^{\BibTeX}\ computer program, written by Oren Patashnik at Stanford
%University, ^^{Patashnik, Oren}
%and print the output from that program.
%If you find bugs in the macros, or think of improvements, you can send
%electronic mail to Karl at {\tt karl@cs.umb.edu}.
电子版本还包括了为 ^{\BibTeX} 程序处理输入并排印其输出的宏——
\thinspace\BibTeX 程序是斯坦弗大学的 Oren Patashnik ^^{Patashnik, Oren} 编写的。
如果你在这个宏包中发现了错误,或者想改进它,
你可以给 Karl 发电子邮件。Karl 的电子邮箱地址是 {\tt karl@cs.umb.edu}。
%The macros are also available for US \$10.00 on $5\frac1/4$\inches\
%or $3\frac1/2$\inches\ PC-format diskettes from:
%\smallskip
%{\obeylines
%Paul Abrahams
%214 River Road
%Deerfield, MA 01342
%\vskip\tinyskipamount
%Email: {\tt Abrahams\%Wayne-MTS@um.cc.umich.edu}
%}
%\smallskip
%\noindent
%These addresses are correct as of June 1990; please be aware that they may
%change after that, particularly the electronic addresses.
这个宏包还提供了 $5\frac1/4$\inches\ 或 $3\frac1/2$\inches\ 软盘,
你可以向以下地址邮寄 10.00 美元购买:
\smallskip
{\obeylines
Paul Abrahams
214 River Road
Deerfield, MA 01342
\vskip\tinyskipamount
Email: {\tt Abrahams\%Wayne-MTS@um.cc.umich.edu}
}
\smallskip
\noindent
这个地址在 1990 年 6 月是正确的;请注意在这之后它可能发生改变,尤其是电子邮件地址。
\ifoldeplain\else\ifcompletebook\else
\vskip4em{\sectionfonts\leftline{本章索引}}
\readindexfile{i}
\fi\fi
\endchapter\byebye
|