Skip to content

Commit 7065c8a

Browse files
committed
Merge branch 'dev-chapter05' into dev
2 parents db1bdb2 + e3540ba commit 7065c8a

File tree

1 file changed

+36
-119
lines changed

1 file changed

+36
-119
lines changed

chapter05.tex

Lines changed: 36 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% -*- coding: utf-8 -*-
22
% Translated by Liam0205@bbs.ctex.org
3-
% Date of translated: 2018-05-12
3+
% Date of translated: 2018-05-21
44
\documentclass{book}
55

66
\input{preamble}
@@ -1261,7 +1261,7 @@ \subsection{竖直盒子的更多细节}
12611261
%how vertical and horizontal boxes are treated in a
12621262
%vertical list. Consider the following examples.
12631263
%After \cs{offinterlineskip} the first example
1264-
摆放数值列表中的元素有时会比较棘手。例如,竖直列表中的水平盒子与竖直盒子的处理方式是不一样的。考虑以下例子,在 \cs{offinterlineskip} 之后,第一个例子
1264+
摆放数值列表中的元素有时会比较棘手。例如,竖直列表中的水平盒子与竖直盒子的处理方式是不一样的。考虑以下例子,在 \cs{offinterlineskip} 之后\liamfnote{\cs{offinterlineskip} 会禁止 \TeX 在行与行之间自动地插入行间伸缩胶;因此,在 \cs{offinterlineskip} 之后,每行的 \cs{hbox} 会没有缝隙地堆叠在一起。},第一个例子
12651265
\begin{verbatim}
12661266
\vbox{\hbox{a}
12671267
\setbox0=\vbox{\hbox{(}}
@@ -1301,22 +1301,24 @@ \subsection{竖直盒子的更多细节}
13011301
%%\spoint Hanging the \cs{lastbox} back in the list
13021302
%\subsection{Hanging the \cs{lastbox} back in the list}
13031303
%\spoint Hanging the \cs{lastbox} back in the list
1304-
\subsection{Hanging the \cs{lastbox} back in the list}
1304+
\subsection{\cs{lastbox} 还回列表} % Liam:Hanging 此处是 giving 的意思
13051305

13061306
%You can pick the last box off a vertical list that has been
13071307
%compiled in (internal) vertical mode.
13081308
%However, if you try to hang it back in the list the vertical
13091309
%spacing may go haywire. If you just hang it back,
1310-
%\begin{verbatim}
1311-
%\setbox\tmpbox=\lastbox
1312-
%\usethetmpbox \box\tmpbox
1313-
%\end{verbatim}
1310+
通过 \cs{lastbox} 你可以将(内部)竖直列表中最后一个盒子取出。但是,如果你想把取出的盒子换回去,则竖直间距可能会出问题。比如说,如果你这样将它换回去,则行间伸缩胶会有两份。
1311+
\begin{verbatim}
1312+
\setbox\tmpbox=\lastbox
1313+
\usethetmpbox \box\tmpbox
1314+
\end{verbatim}
13141315
%baselineskip glue is added a second time. If you `unskip' prior
13151316
%to hanging the box back,
1316-
%\begin{verbatim}
1317-
%\setbox\tmpbox=\lastbox \unskip
1318-
%\usethetmpbox \box\tmpbox
1319-
%\end{verbatim}
1317+
而如果你在换回去之前使用 \cs{unskip} 命令,看上去解决了问题,但实际上错得更加微妙:
1318+
\begin{verbatim}
1319+
\setbox\tmpbox=\lastbox
1320+
\unskip \usethetmpbox \box\tmpbox
1321+
\end{verbatim}
13201322
%things go wrong in a more subtle way.
13211323
%The \gram{internal dimen} \cs{prevdepth}
13221324
%(which controls interline glue; see Chapter~\ref{baseline})
@@ -1325,32 +1327,7 @@ \subsection{Hanging the \cs{lastbox} back in the list}
13251327
%interline glue is a depth based on one box earlier.
13261328
%The solution is not to unskip,
13271329
%but to specify \cs{nointerlineskip}:
1328-
%\begin{verbatim}
1329-
%\setbox\tmpbox=\lastbox
1330-
%\usethetmpbox \nointerlineskip \box\tmpbox
1331-
%\end{verbatim}
1332-
You can pick the last box off a vertical list that has been
1333-
compiled in (internal) vertical mode.
1334-
However, if you try to hang it back in the list the vertical
1335-
spacing may go haywire. If you just hang it back,
1336-
\begin{verbatim}
1337-
\setbox\tmpbox=\lastbox
1338-
\usethetmpbox \box\tmpbox
1339-
\end{verbatim}
1340-
baselineskip glue is added a second time. If you `unskip' prior
1341-
to hanging the box back,
1342-
\begin{verbatim}
1343-
\setbox\tmpbox=\lastbox \unskip
1344-
\usethetmpbox \box\tmpbox
1345-
\end{verbatim}
1346-
things go wrong in a more subtle way.
1347-
The \gram{internal dimen} \cs{prevdepth}
1348-
(which controls interline glue; see Chapter~\ref{baseline})
1349-
will have a
1350-
value based on the last box, but what you need for the proper
1351-
interline glue is a depth based on one box earlier.
1352-
The solution is not to unskip,
1353-
but to specify \cs{nointerlineskip}:
1330+
此时,内部距离(\gram{internal dimen})\cs{prevdepth}(控制行间伸缩胶;见第~\ref{baseline}~章)的值会因最后一个盒子而改变,但正确的行间伸缩胶应该由上一个盒子来决定。正确的方法不是使用 \cs{unskip},而是使用 \cs{nointerlineskip}:
13541331
\begin{verbatim}
13551332
\setbox\tmpbox=\lastbox
13561333
\usethetmpbox \nointerlineskip \box\tmpbox
@@ -1361,50 +1338,16 @@ \subsection{Hanging the \cs{lastbox} back in the list}
13611338
%\subsection{Dissecting paragraphs with \cs{lastbox}}
13621339
%\label{varioset}
13631340
%\spoint[varioset] Dissecting paragraphs with \cs{lastbox}
1364-
\subsection{Dissecting paragraphs with \cs{lastbox}}
1341+
\subsection{使用 \cs{lastbox} 切分自然段}
13651342
\label{varioset}
13661343

13671344
%Repeatedly applying \cs{last...} and \cs{un...} macros
13681345
%\howto Take a paragraph apart\par
13691346
%can be used to take a paragraph apart.
13701347
%Here is an example of that.
1371-
Repeatedly applying \cs{last...} and \cs{un...} macros
1348+
反复调用 \cs{last...} \cs{un...} 可以将自然段切分开。这里给出一个例子。
13721349
\howto Take a paragraph apart\par
1373-
can be used to take a paragraph apart.
1374-
Here is an example of that.
1375-
1376-
%\indent\vbox{\message{Check vario look!}
1377-
%\hyphenpenalty10000 \exhyphenpenalty10000 \parindent 10pt\relax
1378-
%\advance\hsize by -2\parindent \rightskip 0pt\relax
1379-
%\newif\ifsnap \spaceskip=\fontdimen2\font plus 2\fontdimen2\font
1380-
%\def\eatlines{
1381-
% \setbox2\lastbox % check the last line
1382-
% \ifvoid2\global\snaptrue
1383-
% \else % if it's not empty
1384-
% \unskip\unpenalty % take whatever is
1385-
% {\eatlines} % above it;
1386-
% \setbox4\hbox{\unhcopy2} % collapse this line
1387-
%\message{^^Jsnap \the\wd4 vs \the\wd2^^J}
1388-
%%\hbox{\copy4 .4} \hbox{\copy 2 .2}
1389-
% \ifdim\wd4<.97\wd2 % if the difference is too large, maybe snap
1390-
% \ifsnap \message{^^JNot snapping just now ^^J}
1391-
% \hbox to \hsize{\unhbox2} \global\snapfalse % we just snapped: not again
1392-
% \else \message{^^JSnapping!^^J}
1393-
% \box4 \global\snaptrue % safe to snap; remember snap
1394-
% \fi
1395-
% \else \message{^^Jfull length, no snap^^J}
1396-
% \box2 \global\snapfalse
1397-
% \fi
1398-
% \fi}
1399-
%\advance\hsize by -.8in \advance \leftskip by .5 in\relax
1400-
%\noindent In typesetting advertisement copy, a way of justifying
1401-
%paragraphs has become popular in recent years
1402-
%that is somewhere between flushright and raggedright
1403-
%setting.
1404-
%Lines that would stretch beyond certain limits
1405-
%are set with their glue at natural width. This single paragraph
1406-
%is but an example of this procedure; the macros are given
1407-
% next.\par\eatlines}\par
1350+
14081351
\indent\vbox{\message{Check vario look!}
14091352
\hyphenpenalty10000 \exhyphenpenalty10000 \parindent 10pt\relax
14101353
\advance\hsize by -2\parindent \rightskip 0pt\relax
@@ -1438,50 +1381,30 @@ \subsection{Dissecting paragraphs with \cs{lastbox}}
14381381
is but an example of this procedure; the macros are given
14391382
next.\par\eatlines}\par
14401383

1441-
%\begin{verbatim}
1442-
%\newbox\linebox \newbox\snapbox
1443-
%\def\eatlines{
1444-
% \setbox\linebox\lastbox % check the last line
1445-
% \ifvoid\linebox
1446-
% \else % if it's not empty
1447-
% \unskip\unpenalty % take whatever is
1448-
% {\eatlines} % above it;
1449-
% % collapse the line
1450-
% \setbox\snapbox\hbox{\unhcopy\linebox}
1451-
% % depending on the difference
1452-
% \ifdim\wd\snapbox<.98\wd\linebox
1453-
% \box\snapbox % take the one or the other,
1454-
% \else \box\linebox \fi
1455-
% \fi}
1456-
%\end{verbatim}
1457-
%This macro can be called as
1458-
%\begin{verbatim}
1459-
%\vbox{ ... some text ... \par\eatlines}
1460-
%\end{verbatim}
1461-
%or it can be inserted automatically
1462-
%with \cs{everypar}; see~\cite{E1}.
14631384
\begin{verbatim}
14641385
\newbox\linebox \newbox\snapbox
14651386
\def\eatlines{
1466-
\setbox\linebox\lastbox % check the last line
1467-
\ifvoid\linebox
1468-
\else % if it's not empty
1469-
\unskip\unpenalty % take whatever is
1470-
{\eatlines} % above it;
1471-
% collapse the line
1472-
\setbox\snapbox\hbox{\unhcopy\linebox}
1473-
% depending on the difference
1474-
\ifdim\wd\snapbox<.98\wd\linebox
1475-
\box\snapbox % take the one or the other,
1476-
\else \box\linebox \fi
1477-
\fi}
1387+
\setbox\linebox\lastbox % check the last line
1388+
\ifvoid\linebox
1389+
\else % if it's not empty
1390+
\unskip\unpenalty % take whatever is
1391+
{\eatlines} % above it;
1392+
% collapse the line
1393+
\setbox\snapbox\hbox{\unhcopy\linebox}
1394+
% depending on the difference
1395+
\ifdim\wd\snapbox<.98\wd\linebox
1396+
\box\snapbox % take the one or the other,
1397+
\else \box\linebox \fi
1398+
\fi}
14781399
\end{verbatim}
1479-
This macro can be called as
1400+
%This macro can be called as
1401+
它的使用方式是
14801402
\begin{verbatim}
14811403
\vbox{ ... some text ... \par\eatlines}
14821404
\end{verbatim}
1483-
or it can be inserted automatically
1484-
with \cs{everypar}; see~\cite{E1}.
1405+
%or it can be inserted automatically
1406+
%with \cs{everypar}; see~\cite{E1}.
1407+
或者也可以用 \cs{everypar} 自动插入;参见~\cite{E1}。
14851408

14861409
%In the macro \cs{eatlines}, the \cs{lastbox} is taken
14871410
%from a vertical list. If the list is empty
@@ -1490,18 +1413,12 @@ \subsection{Dissecting paragraphs with \cs{lastbox}}
14901413
%are actually horizontal boxes: the test
14911414
%\cs{ifhbox} applied to them would give a true
14921415
%result.
1493-
In the macro \cs{eatlines}, the \cs{lastbox} is taken
1494-
from a vertical list. If the list is empty
1495-
the last box will test true on \cs{ifvoid}.
1496-
These boxes containing lines from a paragraph
1497-
are actually horizontal boxes: the test
1498-
\cs{ifhbox} applied to them would give a true
1499-
result.
1416+
\cs{eatlines} 会从竖直列表取得 \cs{lastbox}。如果列表为空,则 \cs{ifvoid} 将返回真。这些盒子都是水平盒子,每个盒子包含了段落中的一行:如果使用 \cs{ifhbox} 来判断盒子分类的话,将返回真。
15001417

15011418
%\index{boxes|)}
15021419
%\endofchapter
15031420
%%%%% end of input file [boxes]
1504-
\index{boxes|)}
1421+
\index{盒子|)}
15051422
\endofchapter
15061423
%%%% end of input file [boxes]
15071424

0 commit comments

Comments
 (0)