10: %A simple table. The center environment is first
set up, otherwise the
11: %table is left aligned. The tabular environment
is what tells Latex
12: %that the data within is data for the table. 13:
你应该能猜到,凡是跟在 % 后面的都是注释。 在这一小节,我们来尝试一下表格的输入。 先起一个新“环境”,叫 center :
C-c C-e center C-j
得到:
1: % 此处略去数十行 2:
3: \\subsection{Sectioning Commands} 4: \\label{sec:sectioning-commands}
5: The commands for inserting sections are fairly
intuitive. Of course,
6: certain commands are appropriate to different
document classes.
7: For example, a book has chapters but a article
doesn't.
8:
9: %A simple table. The center environment is first
set up, otherwise the
10: %table is left aligned. The tabular environment
is what tells Latex
11: %that the data within is data for the table. 12:
13: \\begin{center} 14:
15: \\end{center} 16:
center 当然是“居中”的意思了。在 center 环境里面,我们添加一个 tabular 环境:
C-c C-e tabular C-j
这时你会看到这样的提示:
(Optional) Position:
直接 C-j ,又看到提示了:
Format:
这是问你,表格的格式……有几列?每列之间要不要有竖线分割?……我的答案是这样:
|l|l|
也就是:竖线(|)小写L(l)竖线(|)小写L(l)竖线(|)。小写L代表 left ,也就是“左对齐”的意思。那么,你应该恍然大悟了,不就是……竖线-左对齐-竖线-左对齐-竖线嘛。那么,举一反三,除了小写L,我们还会见到r(右对齐)和c(居中)。现在,
C-j
得到如下结果:
1: % 此处略去数十行 2:
3: \\subsection{Sectioning Commands} 4: \\label{sec:sectioning-commands}
5: The commands for inserting sections are fairly
intuitive. Of course,
6: certain commands are appropriate to different
document classes.
7: For example, a book has chapters but a article
doesn't.
8:
9: %A simple table. The center environment is first
set up, otherwise the
10: %table is left aligned. The tabular environment
is what tells Latex
11: %that the data within is data for the table. 12:
13: \\begin{center}
14: \\begin{tabular}{|l|l|} 15:
16: \\end{tabular} 17: \\end{center} 18:
表格环境里也是可以有注释的:
1: % 此处略去数十行 2:
3: \\subsection{Sectioning Commands} 4: \\label{sec:sectioning-commands}
5: The commands for inserting sections are fairly
intuitive. Of course,
6: certain commands are appropriate to different
document classes.
7: For example, a book has chapters but a article
doesn't.
8:
9: %A simple table. The center environment is first
set up, otherwise the
10: %table is left aligned. The tabular environment
is what tells Latex
11: %that the data within is data for the table. 12:
13: \\begin{center}
14: \\begin{tabular}{|l|l|}
15: % The tabular environment is what tells Latex
that the data within is
16: % data for the table. The arguments say that
there will be two
17: % columns, both left justified (indicated by
the 'l', you could also
18: % have 'c' or 'r'. The bars '|' indicate
vertical lines throughout
19: % the table. 20: | (hline) 21: \\end{tabular} 22: \\end{center} 23:
现在我们开始画表格,边画边体会一下上面几行注释的意思吧。光标现在应该在第(hline)行,先画一条横线: