title: How to apply a stylesheet or theme to orgmode pdf export
body: <p><code>Asciidoctor</code> mades it very easy to apply a theme or stylesheet to a pdf for export. There is an entire <a href="https://github.com/asciidoctor/asciidoctor-stylesheet-factory" rel="nofollow noreferrer">github repo</a> of high quality stylesheets that you can apply to PDF exports.</p>
  
  <p>Now I use <code>Emacs orgmode</code> for so much of my work, I wanted to be able to similarly apply a stylesheet to the pdf output. <strong>My question is, how can someone apply a stylesheet when publishing an <code>org</code> file to PDF?</strong> I know that beamer has themes that you can apply to slides, and that generates PDF output. However I was looking for the same functionality to write notes and documents. </p>
  
  <p>I looked at the following tutorial on <a href="http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html" rel="nofollow noreferrer">org-publish</a>. The tutorial is actually about exporting to html. But the key insight is that you can apply a setting like:</p>
  
  <pre><code># Local Variables:
  # org-export-html-style: "&lt;link rel=\"stylesheet\" type=\"text/css\" href=\"css/stylesheet.css\" /&gt;"
  # End:
  </code></pre>
  
  <p>to the <code>org</code> file header, and it should apply this info to the output. HOWEVER, this solution makes sense in the context of HTML but not necessarily PDF. With HTML you just have to make the stylesheet accessible to the HTML file through the reference and don't need to actually change the HTML, etc. The browser takes care of the rest. But with a PDF it is not so simple--especially since org seems to export to PDF through Latex.</p>
  
  <p>So I went back and checked on <code>Asciidoctor</code> to see how it was about to apply stylesheets to <code>Asciidoc</code> output. Turns out that <code>Asciidoctor</code> does not generate Latex code, but instead exports to PDF using the Ruby <code>Prawn</code> generator. So that explains a key difference between the <code>orgmode</code> pipeline and the <code>Asciidoctor</code> pipeline.</p>
  
  <p>So again, my question was how to apply a stylesheet to an <code>org</code> file when exporting to pdf.</p>
  
  <p>Thanks for any help.</p>