tests/testthat/examples/knitr-examples/095-pandoc-header.md

% 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.

We can then do some simple R math.

2 + 2
## [1] 4

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 Aug. 21, 2025, 5:27 p.m.