I'm writing a thesis paper using r-markdown (specifically, bookdown). The main-matter of the paper is all numbered using arabic numerals, including pages, chapters, sections, and subsections.
However, I need to have the appendix numbered using alpha numerals for the chapter, followed by arabic numerals for sections and subsections. Page numbers also need to be alpha numerals.
I am trying to get this:
A. Appendix
A.1. Section
A.1.1. Subsection
Instead of this:
5. Appendix
5.1. Section
5.1.1. Subsection
The Appendix begins on page 54
, however, I need page numbers to restart at A
.
I've gotten the Chapter/Page numbering to the way I need it to be, but it's breaking my table of contents and some of the cross references in the documents.
My main .rmd file is given here:
---
title: "My Title"
author: My Name
date: Aug 2019
output:
bookdown::pdf_book:
base_format: rmarkdown::pdf_document
latex_engine: xelatex
number_sections: yes
toc: yes
toc_depth: 5
includes:
in_header: ./tex/preamble.tex
before_body: ./tex/cover.tex
bookdown::word_document2:
toc: yes
toc_depth: 5
lof: true
lot: true
fontsize: 11pt
geometry:
- top=1in
- bottom=1in
- left=1.5in
- right=1.5in
documentclass: scrbook
papersize: letter
pagestyle: plain
bibliography: references.bib
csl: american-chemical-society.csl
classoption:
- oneside
spacing: onehalfspacing
always_allow_html: yes
knit: (function(inputFile, encoding) {
rmarkdown::render(inputFile, encoding = encoding,
output_dir = "output", output_format = "all") })
---
'''{r child = '/chapters/00-abstract.rmd'}
'''
'''{r child = '/chapters/01-intro.rmd'}
'''
...
# References
<div id="refs"></div>
\setcounter{chapter}{0}
\renewcommand{\thechapter}{\Alph{chapter}}
'''{r child = '/chapters/05-appendix.rmd'}
'''
Also, the file 05-appendix.rmd
begins as such:
# Appendix
\setcounter{page}{0}
\pagenumbering{Alph}
This creates the desired results as described above, but the problem is that it also breaks cross references pointing to the Appendix chapter or any of the sections within the appendix. When I click "Appendix" in the table of contents, it links to the Chapter 1, located in 01-intro.rmd
. When I click one of the sections under Appendix in the toc, it goes instead to the corresponding section in Chapter 1.
However, the links to the subsections work as expected, linking to their proper place in the appendix.
I thought that maybe restarting the numbering for the Appendix was causing latex/pandoc to get confused and link to chapter 1, but I don't know why that would leave subsections working properly.
\backmatter
instead of changing chapter numbering by hand? – Ralf Stubner