Aligning equations
LaTeX Lesson 7 1:54 English narration · English + 中文 subtitles burned in
Chapters
Transcript
When you show working, a reader follows it by the equals signs.
当你展示解题过程时,读者是靠等号来跟着走的。
Set each line as its own equation and they scatter.
如果每一行各自作为一个独立公式,它们就散开了。
Line them up instead and the eye runs straight down the page, seeing at a glance what changed on each step.
改成对齐,眼睛就能顺着页面直直往下走, 一眼看出每一步变了什么。
That is what the align environment is for.
align 环境就是为这个而存在的。
Inside align, an ampersand marks where to line up — put it just before each equals sign and every equals sign in the block lands in the same column.
在 align 里面,一个 & 标出对齐的位置—— 把它放在每个等号的正前面,这一块里所有的等号就会落在同一列上。
Two backslashes end a line and start the next.
两个反斜杠结束一行、开始下一行。
And the last line needs no backslashes, because there is nothing after it.
而最后一行不需要反斜杠,因为它后面已经没有东西了。
Align comes in two forms.
align 有两种形式。
With a star, you get no equation numbers, which suits ordinary working.
带星号的,不给公式编号,适合普通的解题过程。
Drop the star and LaTeX numbers each line, one, two, three, down the right-hand margin.
去掉星号,LaTeX 就会给每一行编号,1、2、3,排在右边页边。
Number them when you want to refer to one later — and lesson ten shows how to point at it by name rather than by number.
当你以后要引用其中某一个时才给它们编号—— 而第 10 课会讲怎么用名字、而不是用数字去指向它。
Amsmath also gives you matrices, and they reuse the two characters you have just learned.
amsmath 还给了你矩阵,而它们复用了你刚学的那两个字符。
B matrix draws square brackets around the numbers; inside, an ampersand separates columns and two backslashes separate rows.
bmatrix 在数字外面画上方括号; 里面,& 分隔列,两个反斜杠分隔行。
Notice this is the third job for those characters — and it is exactly the pattern tables use in the next lesson.
注意这是那两个字符的第三种用途—— 而这也正是下一课里表格所用的同一套写法。
Four things to take with you.
带走四点。
One: align lines equations up at each ampersand.
第一:align 在每个 & 处把公式对齐。
Two: two backslashes end each line.
第二:两个反斜杠结束每一行。
Three: align with a star gives no numbers, and align without one numbers every line.
第三:带星号的 align 不编号,不带星号的给每一行编号。
Four: in a matrix the ampersand separates columns instead.
第四:在矩阵里,& 改为分隔列。
Now line up your working and press Run.
现在把你的解题过程对齐,然后按 Run。