问题
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.
回答1:
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 -}
来源:https://stackoverflow.com/questions/53378848/markdown-unnumbered-section-but-needs-anchor