Skip to content

Commit a96c1b9

Browse files
authored
Mention using imakeidx to build an index (#1283)
1 parent 00adbb3 commit a96c1b9

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

docs/books/book-structure.qmd

+24-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Note that you can change the chapter title to whatever you like, remove `.unnumb
8181

8282
For PDF output, you can create an index using the LaTeX [makeidx](https://ctan.org/pkg/makeidx?lang=en) package along with the `\index` command.
8383

84-
To add an index to the PDF output for a book, add these `include-in-header` and `include-after-body` entries to your `pdf` format configuration in `_quarto.yml`: quart
84+
To add an index to the PDF output for a book, add these `include-in-header` and `include-after-body` entries to your `pdf` format configuration in `_quarto.yml`:
8585

8686
``` yaml
8787
format:
@@ -105,6 +105,29 @@ Markdown\index{Markdown} allows you to write using
105105
an easy-to-read, easy-to-write plain text format.
106106
```
107107

108+
Alternatively, you can also use the [imakeidx](https://ctan.org/pkg/imakeidx) package.
109+
This packages offers additional features for formatting the index. For example:
110+
111+
``` yaml
112+
format:
113+
html:
114+
theme: cosmo
115+
pdf:
116+
documentclass: scrreprt
117+
include-in-header:
118+
text: |
119+
\usepackage{imakeidx}
120+
\makeindex[intoc=true, columns=3, columnseprule=true, options=-s latex/indexstyles.ist]
121+
include-after-body:
122+
text: |
123+
\printindex
124+
```
125+
126+
In the above example, `intoc=true` will include an entry for the index into the table of contents,
127+
`columns=3` will format the index into three columns, and `columnseprule=true` will display a line between index columns.
128+
Finally, `options=-s latex/indexstyles.ist` will use additional formatting options from an index-style file located at `latex/indexstyles.ist`.
129+
Many other features are available in the [imakeidx](https://ctan.org/pkg/imakeidx) package. Please refer to its documentation for further details.
130+
108131
Note that `\index` commands are automatically ignored for non-PDF output.
109132

110133
## Parts & Appendices

0 commit comments

Comments
 (0)