Skip to content

Commit b429197

Browse files
committed
[chapter02] translated chapter 02
2 parents 64ded1c + d8a06f8 commit b429197

File tree

5 files changed

+538
-845
lines changed

5 files changed

+538
-845
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ output
1111
*.out
1212
*.synctex.gz
1313
*.xdv
14-
14+
*.bbl
15+
*.blg
16+
*.toc
17+
*.brf

chapter01.tex

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
\begin{document}
1313

1414
%\chapter{The Structure of the \TeX\ Processor}
15-
\chapter{\TeX\ 处理器的结构}
15+
\chapter{\TeX 处理器的结构}
1616

1717
%This book treats the various aspects of \TeX\ in chapters
1818
%that are concerned with relatively small, well-delineated,
@@ -23,13 +23,13 @@ \chapter{\TeX\ 处理器的结构}
2323
%the few examples given in this chapter will be repeated
2424
%in the appropriate places later on; they are included here
2525
%to make this chapter self-contained.
26-
本书涵盖了 \TeX\ 诸多方面的内容;其中每一章都讲述一个相对较小且易于描述的主题。
27-
本章将简介 \TeX\ 处理文档的基本流程。
26+
本书涵盖了 \TeX 诸多方面的内容;其中每一章都讲述一个相对较小且易于描述的主题。
27+
本章将简介 \TeX 处理文档的基本流程。
2828
当然,本章会忽略很多细节,留待后续章节继续讨论。
2929
相应的,为了说明问题,本章会给出一些例子;这些例子在后续的这些章节中会继续讨论。
3030

3131
%\section{Four \TeX\protect\ processors}
32-
\section{\TeX\ 的 4 个处理器}
32+
\section{\TeX 的 4 个处理器}
3333

3434
%The way \TeX\ processes its input can be viewed as
3535
%happening on four levels. One might say that
@@ -38,50 +38,50 @@ \section{\TeX\ 的 4 个处理器}
3838
%delivering the input for the next stage. The input of
3939
%the first stage is then the \n{.tex} input file; the output
4040
%of the last stage is a \n{.dvi} file.
41-
\TeX\ 处理输入的过程可分为 4 个层次
42-
你可以认为 \TeX\ 处理器(也成 \TeX\ 引擎)有 4 个独立的单元,
41+
\TeX 处理输入的过程可分为 4 个阶段
42+
你可以认为 \TeX 处理器(也称 \TeX 引擎)有 4 个独立的单元,
4343
每个单元接收前序步骤的输出,并将输出作为后续单元的输入。
44-
第一阶段的输入是 \n{.tex} 文件,最后一个阶段的输出是 \n{.dvi} 文件\footnote{译注(Liam0205):此处讨论的 \TeX\ 是 Knuth \TeX。后续扩展的 pdf\TeX 等不一定输出 \n{.dvi} 文件。}。%
44+
第一阶段的输入是 \n{.tex} 文件,最后一个阶段的输出是 \n{.dvi} 文件\footnote{译注(Liam0205):此处讨论的 \TeX 是 Knuth \TeX。后续扩展的 pdf\TeX 等不一定输出 \n{.dvi} 文件。}。%
4545

4646
%For many purposes it is most convenient, and most insightful,
4747
%to consider these four levels of processing as happening
4848
%after one another, each one accepting the {\em completed\/}
4949
%output of the previous level. In reality this is not true:
5050
%all levels are simultaneously
5151
%active, and there is interaction between them.
52-
通常而言,这样理解上述 4 个层次方便且直观
53-
每个层次\emph{完整地}接收上一个层次的输出
52+
通常而言,这样理解上述 4 个阶段方便且直观
53+
每个阶段\emph{完整地}接收上一个阶段的输出
5454
然而,这样并不完全正确:
55-
4 个层次的处理是同时进行的,层次之间也有交互\footnote{译注(Liam0205):流式处理,上一层次处理完多少,下一个层次就接着继续处理这部分。}。
55+
4 个阶段的处理是同时进行的,阶段之间也有交互\footnote{译注(Liam0205):流式处理,上一阶段处理完多少,下一个阶段就接着继续处理这部分。}。
5656

5757
%The four levels are (corresponding roughly
5858
%to the `eyes', `mouth', `stomach', and `bowels' respectively
5959
%in Knuth's original terminology) as follows.
60-
%\begin{enumerate}\item
60+
4 个阶段列举如下(按 Knuth 最初的叫法,分别是「眼睛」、「嘴巴」、「胃」和「肠道」):
61+
\begin{enumerate}
62+
%\item
6163
%The input processor. This is the piece of \TeX\ that
6264
%accepts input lines from the file system of whatever computer
6365
%\TeX\ runs on, and turns them into tokens.
6466
%Tokens are the internal objects of \TeX:
6567
%there are character tokens that constitute the typeset
6668
%text, and control sequence tokens that are commands
6769
%to be processed by the next two levels.
70+
\item 输入处理器(input processor):负责从运行 \TeX 的计算机的文件系统中读入输入,并处理为记号。
71+
记号是两种 \TeX 内部对象的统称:构成排版文本的字符记号、待后续两个阶段作为命令处理的控制序列记号。
6872
%\item The expansion processor.
6973
%Some but not all of the tokens generated in the first level
7074
%\ldash macros, conditionals, and a number
7175
%of primitive \TeX\ commands \rdash are subject to expansion.
7276
%Expansion is the process that replaces some (sequences of)
7377
%tokens by other (or no) tokens.
78+
\item 展开处理器(expansion processor):
79+
负责展开输入处理器输出的部分记号:宏、条件式、以及部分 \TeX 原语。
80+
记号展开的过程会将一些(连续的)记号删除或替换为其它记号。
7481
%\item The execution processor.
7582
%Control sequences that are not expandable are executable,
7683
%and this execution takes place on the third level of the
7784
%\TeX\ processor.
78-
4 个层次列举如下(按 Knuth 最初的叫法,分别是「眼睛」、「嘴巴」、「胃」和「肠道」):
79-
\begin{enumerate}
80-
\item 输入处理器(input processor):负责为 \TeX\ 从文件系统中读入输入,并处理为记号。
81-
记号是两种 \TeX\ 内部对象的统称:构成排版文本的字符记号、待后续两个层次作为命令处理的控制序列记号。
82-
\item 展开处理器(expansion processor):
83-
负责展开输入处理器输出的部分记号:宏、条件式、以及部分 \TeX\ 原语。
84-
记号展开的过程会将一些(连续的)记号删除或替换为其它记号。
8585
\item 执行处理器(execution processor):
8686
不可展开的控制序列即是可执行的;执行处理器负责执行这些可执行的控制序列。
8787

@@ -91,6 +91,9 @@ \section{\TeX\ 的 4 个处理器}
9191
%category. The other major thing happening on this level
9292
%is the construction of horizontal, vertical, and
9393
%mathematical lists.
94+
执行处理器的部分活动涉及到 \TeX 的内部状态之变化:
95+
赋值(包括宏定义)是其中典型。
96+
除此之外,执行处理器负责构造水平列表、垂直列表和数学列表。
9497
%\item The visual processor.
9598
%In the final level of processing
9699
%the visual part of \TeX\ processing is performed. Here
@@ -100,15 +103,11 @@ \section{\TeX\ 的 4 个处理器}
100103
%Also the output to the \n{dvi} file takes place on this level.
101104
%The algorithms working here are not accessible to the user,
102105
%but they can be influenced by a number of parameters.
103-
%\end{enumerate}
104-
执行处理器的部分活动涉及到 \TeX\ 的内部状态之变化:
105-
赋值(包括宏定义)是其中典型。
106-
除此之外,执行处理器负责构造水平列表、垂直列表和数学列表。
107106
\item 可视化处理器(visual processor):
108-
\TeX\ 的最后一个层次负责排版内容的可视化
107+
\TeX 的最后一个阶段负责排版内容的可视化
109108
可视化处理器将水平列表分行成段,将垂直列表分割成页,将数学列表构建成数学公式;
110109
最终输出 \n{.dvi} 文件%
111-
\footnote{译注(zoho):对于现代 \TeX\ 处理器而言,还可以是 \n{pdf} 和 \n{xml} 等文件。}。
110+
\footnote{译注(zoho):对于现代 \TeX 处理器而言,还可以是 \n{pdf} 和 \n{xml} 等文件。}。
112111
可视化处理器的内部算法对于用户是不可见的;不过用户可以通过一系列参数来控制。
113112
\end{enumerate}
114113

@@ -122,7 +121,7 @@ \section{输入处理器}
122121
%character tokens and control sequence tokens.
123122
%The remaining category is that of the parameter tokens;
124123
%these will not be treated in this chapter.
125-
输入处理器是 \TeX\ 的一部分,负责将 \TeX\ 从输入文件中读入的内容翻译成记号。
124+
输入处理器是 \TeX 的一部分,负责将 \TeX 从输入文件中读入的内容翻译成记号。
126125
它的输出是记号流(stream of tokens):记号组成的列表。
127126
大部分记号属于以下两类:
128127
字符记号和控制序列记号。
@@ -138,8 +137,8 @@ \subsection{字符的输入}
138137
%to any character in the input, for instance the space token
139138
%at the end of the line, or the \cs{par} token after an empty line.
140139
对于简单的输入文本,其中的字符被输入处理器翻译为字符记号。
141-
在某些情况下,\TeX\ 会忽略一些输入字符;例如,连续空格通常等价于单个空格。
142-
此外,\TeX\ 也会向记号流中插入一些与输入字符无关的记号。
140+
在某些情况下,\TeX 会忽略一些输入字符;例如,连续空格通常等价于单个空格。
141+
此外,\TeX 也会向记号流中插入一些与输入字符无关的记号。
143142
例如在每一行的末尾插入一个空格,以及在每一个空行末尾插入一个 \cs{par} 记号。
144143

145144
%Not all character tokens signify characters to be typeset.
@@ -157,13 +156,12 @@ \subsection{字符的输入}
157156
%character code.
158157
并非所有的字符记号都会被最终排版出来。
159158
事实上,在 \TeX 中,字符被分类为 16 类
160-
\ldash 每一类都有特定的功能\rdash
159+
\ldash 每一类都有特定的功能\rdash%
161160
而只有两类最终会被排版出来。
162161
其它字符类,像 \n{\char`\{}、\n{\char`\}}、\n\&
163162
\n\#,都不会被排版出来。
164-
因此,\TeX 的字符记号的含义由一对数字决定:
165-
字符编码\ldash 通常是 \ascii 编码\rdash 和分类码。
166-
具体某一编码的字符对应的分类码是可修改的\footnote{译注(Liam0205):也就是说,字符在 \TeX 看来是何种含义不光取决于这个字符是什么(字符编码),还取决于它是什么类型(分类码)。对于某个具体的字符来说(字符编码确定),它的类型是可以改变的(分类码可以改变)。}。
163+
也就是说,在 \TeX 中,字符记号的含义由字符编码(通常是 \ascii 编码)和分类码这一对数字共同决定。
164+
而具体某一编码的字符对应的分类码是可以修改的。
167165

168166
%When the escape character (by default~\cs{}$\,$) appears in the input,
169167
%\TeX's behaviour in forming tokens is more complicated.
@@ -178,9 +176,8 @@ \subsection{字符的输入}
178176
%$N$,~new line; $M$,~middle of line; $S$,~skipping spaces.
179177
%These states and the transitions between them are treated
180178
%in Chapter~\ref{mouth}.
181-
% FIXME (Liam0205): 这一段的翻译感觉有问题,但是等到后续再说吧。
182-
对于分类码的处理,\TeX\ 输入处理器的行为可想像为在三种内部状态($N$,新行;$M$
183-
行内;$S$,忽略空格)中切换的机器。在第~\ref{mouth}~章中我们会讨论这些状态及其切换。
179+
在分类码的影响下,\TeX 输入处理器的行为可视作是一个在三种内部状态($N$,新行;$M$
180+
行内;$S$,忽略空格)中切换的机器。第~\ref{mouth}~章将讨论这些状态及其切换。
184181

185182
%\subsection{Two-level input processing}
186183
\subsection{输入处理器的两个阶段}
@@ -621,7 +618,7 @@ \subsection{被忽略的空格}
621618
%the sequence \begin{verbatim}
622619
%\a0
623620
%\end{verbatim}
624-
被忽略的空格可以反映数据在 \TeX\ 各层处理器之间的流动情况。例如:
621+
被忽略的空格可以反映数据在 \TeX 各处理器之间的流动情况。例如:
625622
\begin{verbatim}
626623
\def\a{\penalty200}
627624
\a 0
@@ -647,7 +644,7 @@ \subsection{内部量值及其表示}
647644
%quantities have an external representation,
648645
%which is a string of characters, such as
649646
%\n{4711} or~\n{91.44cm}.
650-
\TeX 使用了多重内部量,比如说整数和尺寸。
647+
\TeX 使用了多种内部量,比如说整数和尺寸。
651648
这些内部量的外部表示是同一的:字符组成的字符串。
652649
例如 \n{4711} 和 \n{91.44cm}。
653650

0 commit comments

Comments
 (0)