📄 typeset.tex
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Contents: Typesetting Part of LaTeX2e Introduction
% $Id: typeset.tex,v 1.3 2002/07/19 09:25:20 zuohuijun Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\chapter{Typesetting Text}
\chapter{文档排版}
\iffalse
\begin{intro}
After reading the previous chapter, you should know about the basic
stuff of which a \LaTeXe{} document is made. In this chapter I
will fill in the remaining structure you will need to know in order
to produce real world material.
\end{intro}
\fi
\begin{intro}
阅读前一章后,就可以了解~\LaTeXe{}文档的基本结构了。
在这一章我将补充其余的部分,以使你能够生成实用的文档。
\end{intro}
%\section{The Structure of Text and Language}
\section{文档和语言的结构}
\iffalse The main point of writing a text (some modern
DAAC\footnote{Different
At All Cost, a translation of the Swiss German UVA (Um's Verrecken
Anders).} literature excluded), is to convey ideas, information, or
knowledge to the reader. The reader will understand the text
better if these ideas are well-structured, and will see and feel
this structure much better if the typographical form reflects the
logical and semantical structure of the content.\fi
%%%%%%%%%%%%%%
写作文档(一些现代~DAAC\footnote{为标新立异不计代价, 译自~Swiss German
UVA (Um's Verrecken Anders)。}文学除外)的主旨在于向读者传递观点、信息或知识。
如果这些观点组织得很好,读者将能更好地理解。如果排版风格反映了内容的逻辑和
语义结构,读者就能看见和感觉到文章的这种脉络。
\iffalse\LaTeX{} is different from other typesetting systems in that you just
have to tell it the logical and semantical structure of a text. It
then derives the typographical form of the text according to the
``rules'' given in the document class file and in various style files.\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\LaTeX{}~与其他排版系统的不同在于你只要告诉它文档的逻辑和语义结构,
它就按照文档类型和各种格式文件指定的``规则''导出文档的排版风格。
\iffalse The most important text unit in \LaTeX{} (and in typography) is the
\wi{paragraph}. We call it ``text unit'' because a paragraph is the
typographical form which should reflect one coherent thought, or one
idea. You will learn in the following sections, how you can force
linebreaks with e.g.{} \texttt{\bs\bs} and paragraph breaks with e.g.{}
leaving an empty line in the source code. Therefore, if a new thought
begins, a new paragraph should begin, and if not, only linebreaks
should be used. If in doubt about paragraph breaks, think about your
text as a conveyor of ideas and thoughts. If you have a paragraph
break, but the old thought continues, it should be removed. If some
totally new line of thought occurs in the same paragraph, then it
should be broken. \fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
在~\LaTeX{}(在印刷术)中段落是最重要的文档单位。我们之所以称之为``文档单位'',
因为段落是反映一个连贯思想或观点的排版风格形式。在下面的章节中你将学习如何用
~\texttt{\bs\bs}~强行断行,通过在源文件中留一空行强行转段。所以,如果开始一个
新思想,就另起一段,否则,只应使用断行。如果还犹豫是否应转段,可以把文档想象为
观点和思想的传递者。如果旧的思路还在继续,就不应转段。如果同一段中出现了全新的
思路,就应该另起一段。
\iffalse
Most people completely underestimate the importance of well-placed
paragraph breaks. Many people do not even know what the meaning of
a paragraph break is, or, especially in \LaTeX, introduce paragraph
breaks without knowing it. The latter mistake is especially easy to
make if equations are used in the text. Look at the following
examples, and figure out why sometimes empty lines (paragraph breaks)
are used before and after the equation, and sometimes not. (If you
don't yet understand all commands well enough to understand these
examples, please read this and the following chapter, and then read
this section again.)
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
大多数人完全低估恰当设置转段点的重要性。许多人甚至不知道转段点的含义是什么,
或者在~\LaTeX{}~中引进了转段点却浑然不知。如果在文档中使用了公式,后一个错误
特别容易发生。看看下面的例子,想想为什么有时在方程前后使用多个空行(转段点),
有时却不用。(如果你还不完全理解这些例子中的命令,请阅读本章和下一章,然后重新
阅读本节内容。)
\begin{code}%%%%%%%%%%%
\begin{verbatim}
% Example 1
\ldots when Einstein introduced his formula
\begin{equation}
e = m \cdot c^2 \; ,
\end{equation}
which is at the same time the most widely known
and the least well understood physical formula.
% Example 2
\ldots from which follows Kirchoff's current law:
\begin{equation}
\sum_{k=1}^{n} I_k = 0 \; .
\end{equation}
Kirchhoff's voltage law can be derived \ldots
% Example 3
\ldots which has several advantages.
\begin{equation}
I_D = I_F - I_R
\end{equation}
is the core of a very different transistor model. \ldots
\end{verbatim}
\end{code}%%%%%%%%%%%%%%%%
\iffalse
The next smaller text unit is a sentence. In English texts, there is
a larger space after a period which ends a sentence than after one
which ends an abbreviation. \LaTeX{} tries to figure out which one
you wanted to have. If \LaTeX{} gets it wrong, you must tell it what
you want. This is explained later in this chapter.
\fi
%%%%%%%%%%%%%%%%%%%%%%%%
下一个较小的文档单位是句子。在英语文档中,在一个句子结尾处句号后的空间
大于缩写词句号后的空间。\LaTeX{}~试图分辨出你需要那一个。如果~\LaTeX{}~给
错了,你必须告诉~\LaTeX{}~你到底需要什么。在本章的后面将对此予以解释。
\iffalse
The structuring of text even extends to parts of sentences. Most
languages have very complicated punctuation rules, but in many
languages (including German and English), you will get almost every
comma right if you remember what it represents: a short stop in the
flow of language. If you are not sure about where to put a comma,
read the sentence aloud, and take a short breath at every comma. If
this feels awkward at some place, delete that comma, if you feel the
urge to breathe (or make a short stop) at some other place, insert a
comma.
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
句子也有结构。大多数语言具有非常复杂的标点符号系统,但是在很多语言中
(包括德语和英语)只要你记住它表示什么:语言流中的短暂停顿,你就能近
乎完美地使用逗号。如果你不肯定在哪里使用逗号,就大声地朗读这个句子,
在每个逗号处做一短呼吸。在什么地方如果你感到别扭,就删掉这个逗号;
如果在什么地方,你感到必须呼吸(或做了短暂停顿)就插入一个逗号。
\iffalse Finally, the paragraphs of a text should also be
structured logically at a higher level, by putting them into
chapters, sections, subsections, and so on. However, the
typographical effect of writing e.g.{} \verb|\section{The|
\texttt{Structure of Text and Language}\verb|}| is so obvious that
it is almost self-evident how these high-level structures should
be used.
\fi
%%%%%%%%%%%%%%%%%%%%%%%%
最后,通过分成章、节、子节等形式,文档中的段落应该按逻辑在更高的
层次进行组织。但是,使用~\verb|\section{The| \texttt{Structure of Text and
Language}\verb|}|~的排版效果是如此明显,以致如何使用这些高水平的
结构几乎是不证自明的。
%\section{Linebreaking and Pagebreaking}
\section{断行和分页}
%\subsection{Justified Paragraphs}
\subsection{段落整理}
\iffalse Often books are typeset with each line having the same
length. \LaTeX{} inserts the necessary \wi{linebreak}s and spaces
between words by optimizing the contents of a whole paragraph. If
necessary, it also hyphenates words that would not fit comfortably
on a line. How the paragraphs are typeset depends on the document
class. Normally the first line of a paragraph is indented, and
there is no additional space between two paragraphs. Refer to
section~\ref{parsp} for more information.
\fi %%%%%%%%%%%%%%%%%
通常书籍是用等长的行来排版的。为了优化整个段落的内容,\LaTeX{}~在
单词之间插入必要的\wi{断行点}(\wi{linebreak})和间隔。如果一行的
单词排不下,\LaTeX{}~也会进行必要的断字。段落如何排版依赖于文档类别。
通常,每一段的第一行有缩进,在两段之间没有额外的间隔。更多的信息请
参考第~\ref{parsp}~节。
\iffalse
In special cases it might be necessary to order \LaTeX{}
to break a line:
\begin{lscommand}
\ci{\bs} or \ci{newline}
\end{lscommand}
\noindent starts a new line without starting a new paragraph.
\fi%%%%%%%%%
在特殊情形下,有必要命令~\LaTeX{}~断行
\begin{lscommand}
\ci{\bs} or \ci{newline}
\end{lscommand}
\noindent 另起一行,而不另起一段。
\iffalse
\begin{lscommand} \ci{\bs*}
\end{lscommand}
\noindent additionally prohibits a pagebreak after the forced
linebreak.
\fi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{lscommand} \ci{\bs*}
\end{lscommand}
\noindent 在强行断行后,还禁止分页。
\begin{lscommand}
\ci{newpage}
\end{lscommand}
%\noindent starts a new page.
\noindent 另起一新页。
\begin{lscommand}
\ci{linebreak}\verb|[|\emph{n}\verb|]|,
\ci{nolinebreak}\verb|[|\emph{n}\verb|]|,
\ci{pagebreak}\verb|[|\emph{n}\verb|]| and
\ci{nopagebreak}\verb|[|\emph{n}\verb|]|
\end{lscommand}
\iffalse \noindent do what their names say. They enable the author
to influence their actions with the optional argument \emph{n}. It
can be set to a number between zero to four. By setting \emph{n}
to a value below 4 you leave \LaTeX{} the option of ignoring your
command if the result would look very bad. Do not confuse these
``break'' commands with the ``new'' commands. Even when you give a
``break'' command, \LaTeX{} still tries to even out the right
border of the page and the total length of the page as described
in the next section. If you really want to start a ``new line'',
then use the corresponding command. Guess its name!
\fi %%%%%%%%%%%%
\noindent
上述命令的效果可以从它们的名称看出来。通过可选参数~\emph{n},
作者可以影响这些命令的效果。\emph{n}~可以置为~0~和~4~之间的数。
如果命令的效果看起来非常差,把~\emph{n}~取为小于~4~的数,可以让
~\LaTeX{}~选择忽略这个命令。不要这些~``break''~命令与~``new''~
命令混淆。即使你给出了~``break''~命令,\LaTeX{}~仍然试图对齐
页面的右边界。%and the total length of the page as described in the next section.
如果你真想另起一行,就使用相应的命令。猜猜该是什么命令!
\iffalse
\LaTeX{} always tries to produce the best linebreaks
possible. If it cannot find a way to break the lines in a manner
which meets its high standards, it lets one line stick out on the
right of the paragraph. \LaTeX{} then complains (``\wi{overfull
hbox}'') while processing the input file. This happens most often
when \LaTeX{} cannot find a suitable place to hyphenate a
word.\footnote{Although \LaTeX{} gives
you a warning when that happens (Overfull hbox) and displays the
offending line, such lines are not always easy to find. If you use
the option \texttt{draft} in the \ci{documentclass} command, these
lines will be marked with a thick black line on the right margin.}
You can instruct \LaTeX{} to lower its standards a little by
giving the \ci{sloppy} command. It prevents such over-long lines
by increasing the inter-word spacing --- even if the final output
is not optimal. In this case a warning (``\wi{underfull hbox}'')
is given to the user. In most such cases the result doesn't look
very good. The command \ci{fussy} brings \LaTeX{} back to its
default behaviour.
\fi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\LaTeX{}~总是尽可能产生最好的断行效果。如果断行无法达到~\LaTeX{}~的高标准,
就让这一行在段落的右侧溢出。然后在处理输入文件的同时,报告溢出的消息
(``\wi{overfull hbox}'')。这最可能发生在~\LaTeX{}~找不到合适的地方断字时候。
\footnote{当发生(盒子溢出)时,虽然~\LaTeX{}~给出一个警告并显示溢出的那一行,
但是不太容易发现溢出的行。如果你在~\ci{documentclass}~命令中使用选项~\texttt{draft},
\LaTeX{}~就在溢出行的右边标以粗黑线。}你可以使用~\ci{sloppy}~命令,
告诉~\LaTeX{}~降低一点儿标准。虽然最终的输出结果不是最优的,
它通过增加单词之间的间隔,以防止出现过长的行。在这种情况下给出警告
(``\wi{underfull hbox}'')。在大多数情况下得到的结果看起来不会非常好。
\ci{fussy}~命令把~\LaTeX{}~恢复为缺省状态。
%\subsection{Hyphenation} \label{hyph}
\subsection{断字}
\iffalse
\LaTeX{} hyphenates words whenever necessary. If the
hyphenation algorithm does not find the correct hyphenation
points, you can remedy the situation by using the following
commands to tell \TeX{} about the exception.
\fi %%%%%%%%%%%%
必要时就会出现断字。如果断字算法不能确定正确的断字点,可以使用如下命令
告诉~\TeX{}~如何弥补这个缺憾。
%The command
命令
\begin{lscommand}
\ci{hyphenation}\verb|{|\emph{word list}\verb|}|
\end{lscommand}
\noindent \iffalse causes the words listed in the argument to be
hyphenated only at the points marked by ``\verb|-|''. The
argument of the command should only contain words built from
normal letters or rather signes which are regarded as normal
letters in the active context. The hyphenation hints are stored
for the language which is active when the hyphenation command
occurs. This means that if you place a hyphenation command into
the preamble of your document it will influence the english
language hyphenation. If you place the command after the
\verb|\begin{document}| and you are using some package for
national language support like \pai{babel}, then the hyphenation
hints will be active in the language activated through
\pai{babel}. \fi%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
使列于参量中的单词仅在注有~``\verb|-|''~的点断字。命令的参量仅由
正常字母构成的单词,或由激活文本中视为正常字母的符号组成。应用于
(特殊)语言的已存好,当断字命令出现时,就为激活的语言储存断字可选点。
这意味着如果你在文档导言中设置了断字命令,它将影响英文的断字。
如果断字命令置于~\verb|\begin{document}|~后面,而且你正使用
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -