Skip to content

Commit

Permalink
feat(inputters): Support front/main/back matter divisions in master d…
Browse files Browse the repository at this point in the history
…ocuments
  • Loading branch information
Omikhleia authored and Didier Willis committed Jan 14, 2025
1 parent 01dcb79 commit 210cb28
Show file tree
Hide file tree
Showing 4 changed files with 250 additions and 83 deletions.
84 changes: 84 additions & 0 deletions examples/manual-masterdoc/bookdivisions.dj
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Book divisions

In §[](#masterdoc-content-basic), we explored how to declare a simple book consisting of chapters or parts.
For books with chapters only:


```yaml
content:
chapters:
⟨...⟩
```

Or for books with parts:

```yaml
content:
parts:
⟨...⟩
```

Actually, this is equivalent to the following full syntax:

```yaml
content:
mainmatter:
⟨parts or chapters⟩
```

That is, your content is assumed to be part of the main matter by default.
Some books, however, require a more complex structure, dividing content into front matter, main matter, and back matter.
This is particularly common in academic works, where the front matter might include a preface, dedication, and table of contents.

## Front, main and back divisions

Each division begins on an odd-numbered page.
Divisions influence both the format and numbering of pages:

- The front matter uses roman numerals for page numbers by default.
- The main and back matter use arabic numerals for page numbers by default.

These defaults can be overridden to suit specific requirements, with adequate styles.
Page numbering resets whenever the format changes between divisions (e.g., front matter from i--viii, main matter from 1--148).

Divisions also influence the numbering of parts and chapters:

- In the front matter and back matter, parts and chapters are unnumbered by definition.
- In the main matter, parts and chapters are numbered by default, though this behavior can be customized with styles.

All default styles can be overridden to suit specific requirements, but we will cover this in a later section.
All divisions can include parts.
However, it is up to you to maintain consistency with your structural expectations.

```yaml
content:
frontmatter:
⟨parts or chapters⟩
mainmatter:
⟨parts or chapters⟩
backmatter:
⟨parts or chapters⟩
```

Below is an example of how to declare a book that incorporates these divisions.

```yaml
content:
frontmatter:
chapters:
- preface.dj
- dedication.dj
mainmatter:
parts:
- caption: Part 1
content:
- chapt1-1.dj
- chapt1-2.dj
- caption: Part 2
content:
- chapt2-1.dj
- chapt2-2.dj
backmatter:
chapters:
- postface.dj
```
11 changes: 6 additions & 5 deletions examples/manual-masterdoc/masterdoc.dj
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ sile:
textsubsuper.fake: false
typesetter.italicCorrection: true
packages:
- dropcaps
- couyards
chapters:
- chap1.dj
- chap2.dj
- resilient.poetry
content:
chapters:
- chap1.dj
- chap2.dj
```

The `masterfile` entry is a number corresponding to a version, for compatibility purposes.[^masterdoc-compat]
Expand Down Expand Up @@ -104,6 +104,7 @@ The `sile` object provides intructions for processing the master document with S
- The `packages` object lists extra packages that SILE must use.
It can be used to load add-on packages needed by your content but not already provided by the document class and its supporting packages.

{#masterdoc-content-basic}
## Up to the content

Last but not least, the `chapters` array (or `parts`, see further below) lists the files to include in the work.
Expand Down
1 change: 1 addition & 0 deletions examples/sile-resilient-manual.silm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ parts:
content:
- manual-masterdoc/masterdoc.dj
- manual-masterdoc/bookmatters.dj
- manual-masterdoc/bookdivisions.dj
- manual-masterdoc/bibliographies.dj
- file: manual-parts/part-layouts.dj
content:
Expand Down
Loading

0 comments on commit 210cb28

Please sign in to comment.