How can I create labels for headings with Pandoc? I thought I was able to use latex macros directly in pandoc, however, for creating labels it doesn't seem to work. This is the pandoc command:

pandoc myfile.md -f markdown-auto_identifiers -t latex --biblatex --top-level-division=chapter -o myfile.tex

This line in my pandoc file

# A fancy first chapter # \label{Afancyfirstchapter}


\chapter{\texorpdfstring{A fancy first chapter \#\label{Afancyfirstchapter}}{A fancy first chapter \#}}

in the output.


Labels are created automatically using the header in lowercase and without spaces, but you can specify another with {#mylabel}, for instance this test.md:

# AAAA {#bbb} 

### CCCC

with pandoc borra.md -t latex produces



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.