Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 421
yaleeconjournal Avatar asked Nov 19 '18 16:11

yaleeconjournal


1 Answers

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 -}
like image 99
Ralf Stubner Avatar answered Sep 21 '22 23:09

Ralf Stubner