% Simple example % Stephen Eglen % 2013-07-10

This first chunk creates the extra lines for the latex header. We use the cat engine to save the content of the chunk to a file specified in the engine.opts option. This file will be passed to pandoc via the --include-in-header (or -H) option.

% Extra header text for latex
\usepackage{mathpazo}
\usepackage[a4paper,margin=2cm]{geometry}
% use append=TRUE for cat() to append to an existing file

We can then do some simple R math.

2+2

About this document

To compile this document in R:

library(knitr)
knit('095-pandoc-header.Rmd')
pandoc('095-pandoc-header', format='latex')
# or two commands in one
pandoc(knit('095-pandoc-header.Rmd'), format='latex')


Try the parsermd package in your browser

Any scripts or data that you put into this service are public.

parsermd documentation built on May 20, 2021, 5:08 p.m.