Home > OS >  R-Markdown, restart and edit the numbering of sections
R-Markdown, restart and edit the numbering of sections

Time:12-10

I have a PDF markdown file. At the end of the paper, I have an appendix. I would like to restart the counting of the section in the appendix, and possibly to introduce a "A" in front of the section of the appendix. Something like "A1","A2", "A3" etc..

Does anyone knows how to do this?

thanks a lot for your help

Here is an example.

---
title: "My paper with an appendix"
output:
  pdf_document:
    number_sections: yes
---


# my normally numbered section 

text

## another normally numbered section 

text

\newpage

# Appendix {-}
this section should not be numbered

## This is a new section that I would like to be numbered "A1"

text

## Every other section should be numbered "A..." 

starting from A1 to AN

CodePudding user response:

Quick hack:

---
title: "My paper with an appendix"
output:
  pdf_document:
    number_sections: yes
---


# my normally numbered section 

text

## another normally numbered section 

text

\newpage

\appendix
\renewcommand{\thesection}{A}
# Appendix {-}
this section should not be numbered

## This is a new section that I would like to be numbered "A1"

text

## Every other section should be numbered "A..." 

starting from A1 to AN

  • Related