bambrose
bambrose

Reputation: 23

How do I control (PART) numbering in gitbook TOC?

For a bookdown gitbook, without resorting to manual numbering how do I:

  1. Disable (PART) numbering partially or entirely; or
  2. For regular headings, enable 1st-level style numbering for 2nd-level headers while disabling it for 1st-level headers; or
  3. Have independent numbering for 1st and 2nd level headers.

Any of these would work for me, but #3 would be ideal, and #1 is what I'm currently trying to get to work, using the special heading (PART) in bookdown as a workaround.

The structure I'd like to achieve is:

Where at least scenes are automatically numbered. It seems intuitive to try this...

# (PART) Prologue {-}
# Scene 1
# (PART) Act I
# Scene 2
# (PART) Act II
# Scene 3
# (PART) Act III
# Scene 4
# (PART) Epilogue {-}
# Scene 5

...but clearly that violates the current (PART) {-} syntax.

Counterintuitively {-} is necessary for the syntax but does not disable numbering like one might expect. So it seems my only option is this:

# (PART) Prologue {-}
# Scene 1
# (PART) Act I {-}
# Scene 2
# (PART) Act II {-}
# Scene 3
# (PART) Act III {-}
# Scene 4
# (PART) Epilogue {-}
# Scene 5

Which renders like this, with the Prologue and Epilogue numbered and messing up the numbering of the Acts.

So is it possible to control (PART) numbering?

>devtools::session_info('bookdown')

Session info ------------------------------------
 setting  value                       
 version  R version 3.3.2 (2016-10-31)
 system   x86_64, linux-gnu           

Packages (selected) ----------------------------------------
 bookdown    0.3     2016-11-28 CRAN (R 3.3.2)
 knitr       1.15.1  2016-11-22 CRAN (R 3.3.2)
 rmarkdown   1.3     2016-12-21 CRAN (R 3.3.2)

> rmarkdown::pandoc_version()
[1] ‘1.17.2’

Upvotes: 2

Views: 817

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30124

I just added support for unnumbered parts in bookdown (>= v0.3.19). The syntax is # (PART\*).

Upvotes: 3

Related Questions