3

I'd like to include some latex code in my .Rmd file so that when I do:

knit('file.Rmd')

pandoc('file.md', format='latex')

then the .tex file is processed with \usepackage{mathpazo}

in the preamble of the latex file? Is this possible, by adding the preamble text somehow dierctly into the .Rmd file, similar to what can be done with embedded configs:

https://github.com/yihui/knitr-examples/blob/master/088-pandoc-embedded.Rmd

(lines 5--13).

Or do I have to create some extra templates in my homedir for pandoc to find?

Thanks, Stephen

Stephen Eglen
  • 591
  • 2
  • 15
  • I think (at worst) you will have to write your own template, unless there is a variable for the LaTeX packages to be included. I'm not sure, and you need to check the documentation of Pandoc (in particular, if the `-V` option helps). – Yihui Xie Jun 20 '13 at 00:11
  • 1
    Thanks; the -H option is perfect for my needs; see http://stackoverflow.com/questions/14883525/set-double-spacing-and-line-numbers-when-converting-from-markdown-to-pdf-with-pa/14972019#14972019 – Stephen Eglen Jul 09 '13 at 11:38
  • Nice. I did not know that. You can answer your own question now :) – Yihui Xie Jul 10 '13 at 18:16
  • Yihui, thanks so much for adding the 'cat' engine, which solves my problem elegantly: https://github.com/yihui/knitr-examples/blob/master/095-pandoc-header.Rmd – Stephen Eglen Jul 12 '13 at 12:10

0 Answers0