|
1 | 1 | --- |
2 | 2 | layout: "lesson" |
3 | | -lang: "en" |
4 | | -title: "More on: Structuring longer documents" |
5 | | -description: "This lesson shows how to make an index, and how to use the imakeidx package to automate the process." |
6 | | -toc-anchor-text: "More on: Structuring longer documents" |
| 3 | +lang: "zh" |
| 4 | +title: "更多内容:结构化长文档" |
| 5 | +description: "本课提供了更多关于如何创建目录、使用PDF书签以及在文档中包含其他文件的信息。" |
| 6 | +toc-anchor-text: "更多内容:结构化长文档" |
7 | 7 | --- |
8 | 8 |
|
9 | | -## Making an index |
| 9 | +## 创建索引 |
10 | 10 |
|
11 | | -Depending on the type of document you are writing, you might want to include |
12 | | -an index. This is a bit like making a bibliography, as it uses auxiliary files. |
13 | | -Luckily, this is all automated by the `imakeidx` package. We need three |
14 | | -instructions to LaTeX: |
| 11 | +基于您所创建的文档长度,您可能需要创建索引。这类似于制作参考文献,因为它使用辅助文件。幸运的是,这都可以通过`imakeidx`包自动完成。我们需要以下三条指令来指导LaTeX: |
| 12 | + |
| 13 | +- `\makeindex`指令,用于启用索引的创建 |
| 14 | +- `\index`指令,用于标记索引条目 |
| 15 | +- `\printindex`指令,用于打印索引 |
15 | 16 |
|
16 | | -- The `\makeindex` command, which enables creation of an index |
17 | | -- The `\index` command, which marks up index entries |
18 | | -- The `\printindex` command, which prints the index |
19 | 17 |
|
20 | 18 | ```latex |
21 | | -\documentclass{article} |
22 | | -\usepackage[T1]{fontenc} |
| 19 | +% !TEX program=xelatex |
| 20 | +
|
| 21 | +% 临时patch,否则使用中文标点,TexLive.net会编译错误 |
| 22 | +\ExplSyntaxOn |
| 23 | +\clist_map_inline:nn { fp, int, dim, skip, muskip } |
| 24 | + { |
| 25 | + \cs_generate_variant:cn { #1_set:Nn } { NV } |
| 26 | + \cs_generate_variant:cn { #1_gset:Nn } { NV } |
| 27 | + } |
| 28 | +\ExplSyntaxOff |
| 29 | +
|
| 30 | +\documentclass[UTF8]{ctexart} |
| 31 | +\usepackage{xeCJK} |
23 | 32 | \usepackage{imakeidx} |
24 | 33 | \makeindex |
25 | 34 | \begin{document} |
26 | | -Some text about Foo\index{foo}. |
27 | | -More text\index{baz!bar}. |
28 | | -Even more text\index{alpha@$\alpha$}. |
29 | | -More text about a different part of baz\index{baz!wibble}. |
| 35 | +一些文字标记索引foo\index{foo}. |
| 36 | +另一些文字标记索引baz\index{baz!bar}. |
| 37 | +更多文字标记索引alpha\index{alpha@$\alpha$}. |
| 38 | +标记索引baz的另一部分的其他文字\index{baz!wibble}. |
30 | 39 |
|
31 | 40 | \clearpage |
32 | | -Some text about Foo\index{foo} again, on a different page. |
33 | | -Even more text\index{beta@$\beta$}. |
34 | | -Even more text\index{gamma@$\gamma$}. |
| 41 | +另一页的文字标记索引foo\index{foo} |
| 42 | +标记索引beta的其他文字\index{beta@$\beta$}. |
| 43 | +标记索引gamma的其他文字\index{gamma@$\gamma$}. |
35 | 44 | \printindex |
36 | 45 | \end{document} |
37 | 46 | ``` |
38 | 47 |
|
39 | | -We've shown two features of indexing here: subdivision using `!`, and printing |
40 | | -something different from the 'sort text' of an index entry using `@`. There |
41 | | -is a lot of customisation possible with an index; try out the example and see |
42 | | -how it works. |
| 48 | +我们在这里展示了索引的两个特性:使用`!`进行分类细分,以及使用`@`打印与索引条目的"排序文本"不同的内容。索引有很多可以自定义的地方;试试这个示例,看看它是如何工作的。 |
0 commit comments