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.

1 Answer 1


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



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .