Considering this input file:
~~~{.html caption="test caption"}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Store</title>
</head>
<body>
<div id="app"></div>
</body>
</html>
~~~
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
When I run command:
pandoc ./DOC.md -o ./doc.pdf
Listing has nice stylings:
I want to have also listing captions. So a
lot
of
people suggest to use --listings
package.
But after I run
pandoc ./DOC.md -o ./doc.pdf --listings
The output file is missing styles for code block!
How to configure pandoc to have nice styles of code block and caption at the same time?
Best Answer
One way of adding captions to code blocks is by using
pandoc-crossref
:Invoke
pandoc
withpandoc-crossref
as a filter:Another way would be to use an existing color scheme for
listings
. There is an implementation of the solarized theme from which you could start:Get the package from github: https://github.com/jez/latex-solarized
Tell
pandoc
to include the package in the LaTeX preamble by adding a YAML block:resulting in
pandoc
: