chyx
chyx

Reputation: 501

How to add latex reference to code block of pandoc markdown file?

I've read the guide http://johnmacfarlane.net/pandoc/README.html#verbatim-code-blocks

In the example

~~~~ {#mycode .haskell .numberLines startFrom="100"}
qsort []     = []
qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
               qsort (filter (>= x) xs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

How can I add a latex label \label{code} to this block of code so I can reference it by \ref{code}?

Upvotes: 2

Views: 1786

Answers (1)

Chris
Chris

Reputation: 46346

According to the page you link to the #mycode bit is the identifier for the code block, this is equivalent to LaTeX's \label. You can reference this code block using an internal link and the identifier #mycode.

Upvotes: 1

Related Questions