yaleeconjournal
yaleeconjournal

Reputation: 329

Markdown unnumbered section but needs anchor

I am working with a Markdown document where I would like to have some sections not be numbered. But I also want to create anchors for these sections. Here is an example:

# Appendix A: Methodology {-} {#methodology}

I want to have Appendix A not be numbered but I still want to link to it using the anchor.

Ideally, the solution would work for both LaTeX PDF and HTML. I have figured out how to turn off the numbered section thing for LaTeX but it's not working for HTML.

Upvotes: 6

Views: 1216

Answers (1)

Ralf Stubner
Ralf Stubner

Reputation: 26823

If you want to specify both a target name (#...) and a class (like .unnumbered) for a heading you have to use a single set of braces and the correct order. The following works for me for both HTML and PDF output:

---
output:
  html_document:
    number_sections: yes
  pdf_document: default
---


# R Markdown

See the appendix on [methodology](#methodology).


# Appendix A: Methodology {#methodology -}

Upvotes: 5

Related Questions