You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/books/book-structure.qmd
+67-33Lines changed: 67 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,10 @@ project-type: book
8
8
9
9
The structure of a Quarto book can be as simple as a list of chapters, or can alternatively incorporate multiple parts and/or appendices. Quarto book chapters and sections are automatically numbered (for cross-referencing), however you can also specify that some parts of the book should remain unnumbered.
10
10
11
-
The simple book configuration generated by `quarto create project book` illustrates the basics:
11
+
The simple book configuration generated by `quarto create project book` illustrates the basics.
12
+
Book properties like the title, author and chapter structure are listed under `book`:
12
13
13
-
```yaml
14
+
```{.yaml filename="_quarto.yml"}
14
15
book:
15
16
title: "mybook"
16
17
author: "Jane Doe"
@@ -26,17 +27,33 @@ book:
26
27
- The remainder of `chapters` includes one or more book chapters.
27
28
- The `references.qmd` file will include the generated bibliography (see [References] below for details).
28
29
30
+
Rendering options that should apply to all chapters and all formats are listed at the top-level of `_quarto.yml`(i.e. not nested under `book`):
31
+
32
+
```{.yaml filename="_quarto.yml"}
33
+
bibliography: references.bib
34
+
```
35
+
36
+
Rendering options that should apply to all chapters for specific formats are listed under `formats`:
37
+
38
+
```{.yaml filename="_quarto.yml"}
39
+
format:
40
+
html:
41
+
theme: cosmo
42
+
pdf:
43
+
documentclass: scrreprt
44
+
```
45
+
29
46
## Titles
30
47
31
48
Since rendering options are provided in `_quarto.yml`, you'll typically see a simple level-one header at the top of chapters. For example:
32
49
33
-
``` markdown
50
+
```{.markdown filename="intro.qmd"}
34
51
# Introduction
35
52
```
36
53
37
54
Note that the following is also still perfectly valid:
38
55
39
-
```yaml
56
+
```{.yaml filename="intro.qmd"}
40
57
---
41
58
title: "Introduction"
42
59
---
@@ -58,17 +75,26 @@ You can mix together numbered and unnumbered chapters. Note however that while y
58
75
59
76
You can set the numbering depth via the `number-depth` option. For example, to only number sections immediately below the chapter level, use this:
60
77
61
-
```yaml
78
+
```{.yaml filename="_quarto.yml"}
62
79
number-depth: 1
63
80
```
64
81
65
-
Note that `toc-depth` is independent of `number-depth` (i.e. you can have unnumbered entries in the TOC if they are masked out from numbering by `number-depth`).
82
+
Note that `number-depth` is a format option, not a `book` option so it is placed at the top-level of `_quarto.yml`, not nested under `book`.
83
+
If you want `number-depth` to only apply to a certain format, nest it under `format`:
84
+
85
+
```{.yaml filename="_quarto.yml"}
86
+
format:
87
+
pdf:
88
+
number-depth: 1
89
+
```
90
+
91
+
The `toc-depth` option is independent of `number-depth` (i.e. you can have unnumbered entries in the TOC if they are masked out from numbering by `number-depth`).
66
92
67
93
## References
68
94
69
95
You should include a `div` with the id `#refs` at the location in your book where you'd like the bibliography to be generated. For example the `references.qmd` file generated by `quarto create project book` includes this:
70
96
71
-
```markdown
97
+
```{.markdown filename="references.qmd"}
72
98
# References {.unnumbered}
73
99
74
100
::: {#refs}
@@ -83,7 +109,7 @@ For PDF output, you can create an index using the LaTeX [makeidx](https://ctan.o
83
109
84
110
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`:
85
111
86
-
```yaml
112
+
```{.yaml filename="_quarto.yml"}
87
113
format:
88
114
html:
89
115
theme: cosmo
@@ -100,15 +126,15 @@ format:
100
126
101
127
Then, add `\index{entry}` commands wherever you want an index entry. For example:
102
128
103
-
```latex
129
+
```{.latex filename="chapter.qmd"}
104
130
Markdown\index{Markdown} allows you to write using
105
131
an easy-to-read, easy-to-write plain text format.
106
132
```
107
133
108
134
Alternatively, you can also use the [imakeidx](https://ctan.org/pkg/imakeidx) package.
109
135
This packages offers additional features for formatting the index. For example:
110
136
111
-
```yaml
137
+
```{.yaml filename="_quarto.yml"}
112
138
format:
113
139
html:
114
140
theme: cosmo
@@ -142,34 +168,39 @@ Note that EPUB and Word (Docx) formats do not currently support organizing books
142
168
143
169
You can divide your book into parts using `part` within the book `chapters`. For example:
144
170
145
-
``` yaml
146
-
chapters:
147
-
- index.qmd
148
-
- preface.qmd
149
-
- part: dice.qmd
150
-
chapters:
151
-
- basics.qmd
152
-
- packages.qmd
153
-
- part: cards.qmd
154
-
chapters:
155
-
- objects.qmd
156
-
- notation.qmd
157
-
- modifying.qmd
158
-
- environments.qmd
171
+
```{.yaml filename="_quarto.yml"}
172
+
book:
173
+
chapters:
174
+
- index.qmd
175
+
- preface.qmd
176
+
- part: dice.qmd
177
+
chapters:
178
+
- basics.qmd
179
+
- packages.qmd
180
+
- part: cards.qmd
181
+
chapters:
182
+
- objects.qmd
183
+
- notation.qmd
184
+
- modifying.qmd
185
+
- environments.qmd
159
186
```
160
187
161
188
Note that the markdown files `dice.qmd` and `cards.qmd` contain the part title (as a level one header) as well as some introductory content for the part. If you just need a part title then you can alternatively use this syntax:
162
189
163
-
``` yaml
164
-
- part: "Dice"
165
-
chapters:
166
-
- basics.qmd
167
-
- packages.qmd
190
+
```{.yaml filename="_quarto.yml"}
191
+
book:
192
+
chapters:
193
+
- index.qmd
194
+
- preface.qmd
195
+
- part: "Dice"
196
+
chapters:
197
+
- basics.qmd
198
+
- packages.qmd
168
199
```
169
200
170
201
You can include appendices by adding an `appendices` key to your `book` config. For example:
171
202
172
-
```yaml
203
+
```{.yaml filename="_quarto.yml"}
173
204
book:
174
205
title: "mybook"
175
206
author: "Jane Doe"
@@ -193,12 +224,15 @@ In LaTeX output, the `\part` command is used for parts. In EPUB and MS Word outp
193
224
194
225
Appendices are numbered using uppercase alpha, and have a prefix inserted into their title to indicate they are an appendix (e.g. "Appendix A --- Additional Resources"). You can customize the prefix and delimiter using the following options:
195
226
196
-
```yaml
227
+
```{.yaml filename="_quarto.yml"}
197
228
crossref:
198
229
appendix-title: "App."
199
230
appendix-delim: ":"
200
231
```
201
232
202
-
Which would result in the above example being output as: "App. A: Additional Resources".
233
+
Which would result in the above example being output as: "App. A: Additional Resources".
234
+
Note that `crossref` is a format option and is not nested under `book`.
235
+
236
+
{{< include ../websites/_page-navigation.md >}}
203
237
204
-
{{< include ../websites/_page-navigation.md >}} {{< include ../websites/_footer.md >}}
0 commit comments