title: Pandoc Syntax Highlighting in PDF not working
body: <p><code>pandoc --version</code> yields:</p>
  
  <pre><code>pandoc 1.12.2.1
  Compiled with texmath 0.6.5.2, highlighting-kate 0.5.5.1.
  Syntax highlighting is supported for the following languages:
      actionscript, ada, apache, asn1, asp, awk, bash, bibtex, boo, c, changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css, curry, d, diff, djangotemplate, doxygen, doxygenlua, dtd, eiffel, email, erlang, fortran, fsharp, gnuassembler, go, haskell, haxe, html, ini, java, javadoc, javascript, json, jsp, julia, latex, lex, literatecurry, literatehaskell, lua, makefile, mandoc, markdown, matlab, maxima, metafont, mips, modelines, modula2, modula3, monobasic, nasm, noweb, objectivec, objectivecpp, ocaml, octave, pascal, perl, php, pike, postscript, prolog, python, r, relaxngcompact, rhtml, roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql, sqlpostgresql, tcl, texinfo, verilog, vhdl, xml, xorg, xslt, xul, yacc, yaml
  Default user data directory: /home/xiaolong/.pandoc
  Copyright (C) 2006-2013 John MacFarlane
  Web:  http://johnmacfarlane.net/pandoc
  This is free software; see the source for copying conditions.  There is no
  warranty, not even for merchantability or fitness for a particular purpose.
  </code></pre>
  
  <p>I am trying the following:</p>
  
  <pre><code>```python
  Python 3.4.3 |Anaconda 2.3.0 (64-bit)| (default, Oct 19 2015, 21:52:17)
  [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import random  # seed is determined here, if not set by the developer themself
  &gt;&gt;&gt; random.randint(0, 100)
  50
  &gt;&gt;&gt; random.randint(0, 100)
  62
  &gt;&gt;&gt; random.randint(0, 100)
  53
  &gt;&gt;&gt; random.randint(0, 100)
  17
  &gt;&gt;&gt; random.seed("I am a hashable object.")
  &gt;&gt;&gt; random.randint(0, 100)
  41
  &gt;&gt;&gt; random.seed("I am a hashable object.")
  &gt;&gt;&gt; random.randint(0, 100)
  41
  &gt;&gt;&gt; random.randint(0, 100)
  88
  &gt;&gt;&gt; random.seed("I am a hashable object.")
  &gt;&gt;&gt; random.randint(0, 100)
  41
  &gt;&gt;&gt; random.randint(0, 100)
  88
  ````````````````````````````````````````````````````````````````````````````````
  </code></pre>
  
  <p>The command to compile my PDF I use is:</p>
  
  <pre><code>pandoc --read=markdown --table-of-contents --toc-depth=2 --preserve-tabs --standalone --template=template.latex --latex-engine=xelatex Hausarbeit.md --highlight-style=pygments -o Hausarbeit.pdf
  </code></pre>
  
  <p>This is code I have in my <code>template.latex</code>:</p>
  
  <pre><code>$if(highlighting-macros)$
  $highlighting-macros$
  $endif$
  $if(verbatim-in-note)$
  \usepackage{fancyvrb}
  $endif$
  </code></pre>
  
  <p>According to the Pandoc documentation <a href="http://pandoc.org/README.html#fenced-code-blocks" rel="nofollow">Pandoc documentation</a> this should result in highlighted text for the Python language. However, everything in that code block only becomes monospace and no colors are applied.</p>
  
  <p>What's more is, that there is an error when compiling:</p>
  
  <pre><code>pandoc: Error producing PDF from TeX source.
  ! LaTeX Error: Environment Shaded undefined.
  
  See the LaTeX manual or LaTeX Companion for explanation.
  Type  H &lt;return&gt;  for immediate help.
   ...                                              
  
  \GenericError  ...                                
                                                    \endgroup 
  l.200 \begin{Shaded}
  </code></pre>
  
  <p>My guess is, that there is something missing in the template to define <code>Shaded</code>. I even installed some package of <code>highlighting-kate</code> named <code>libghc-highlighting-kate-dev</code>, because I read somewhere, that this is what pandoc uses, but to no avail, the text stays black.</p>
  
  <p>How do I get the syntax highlighting working?</p>
  
  <p><strong>EDIT#1</strong></p>
  
  <p>That error did not appear, when I simply indented the code to use standard markdown syntax for code. But in that case I'll not have any syntax highlighting per se.</p>
  
  <p><strong>EDIT#2</strong></p>
  
  <p>The tags "PDF", "Python" and "syntax-highlighting" are indeed related, since this is specifically about creating a PDF file and specifically about syntax highlighting. Also it could be that there is only a problem with highlighting python code in the created PDF files, so the python tag is also related. Please read the question before concluding too quickly.</p>