0

I'm looking to have my rmd file run different code depending on whether I'm compiling to html or compiling to pdf.

More specifically, I want to load the latex package enclose. If I want to compile to html, I use the command $$\require{enclose}$$. If I want to load to pdf, I go into my yaml and use header-includes: \usepackage{actuarialangle}.

If I can run different code depending on the compilation method, not only could I load enclose if I am compiling to HTML, but I can also define my macro to use the correct function (from actuarialangle or enclose).

T.Holme
  • 473
  • 4
  • 17
  • Does this question help? http://stackoverflow.com/questions/30374492/evaluate-a-chunk-based-on-the-output-format-of-knitr – Phil Jan 11 '17 at 21:19
  • That's the idea - but I am thinking outside of chunks. i.e. I want to be able to define a latex / mathjax command differently depending on whether I am loading to pdf or html. This happens outside of a chunk, so this doesn't quite work ( I don't think ) – T.Holme Jan 11 '17 at 21:23

0 Answers0