Keeping Intermediate TeX
R Markdown documents are converted to PDF by first converting to a TeX file and then calling the LaTeX engine to convert to PDF. By default this TeX file is removed, however if you want to keep it (e.g. for an article submission) you can specify the keep_tex option. For example:
---title: "Habits"output: beamer_presentation: keep_tex: true---Includes
You can do more advanced customization of PDF output by including additional LaTeX directives and/or content or by replacing the core pandoc template entirely. To include content in the document header or before/after the document body you use the includes option as follows:
---title: "Habits"output: beamer_presentation: includes: in_header: header.tex before_body: doc_prefix.tex after_body: doc_suffix.tex---Custom Templates
You can also replace the underlying pandoc template using the template option:
---title: "Habits"output: beamer_presentation: template: quarterly_report.tex---Consult the documentation on pandoc templates for additional details on templates. You can also study the default Beamer template as an example.
Markdown Extensions
By default R Markdown is defined as all pandoc markdown extensions with the following tweaks for backward compatibility with the markdown package:
+autolink_bare_uris+ascii_identifier+tex_math_single_backslashYou can enable or disable markdown extensions using the md_extensions option (you preface an option with - to disable and + to enable it). For example:
---title: "Habits"output: html_document: md_extensions: -autolink_bare_uris+hard_line_breaks---The above would disable the autolink_bare_uris extension and enable the hard_line_breaks extension.
For more on available markdown extensions see the pandoc markdown specification.
Pandoc Arguments
If there are pandoc features you want to use that lack equivilants in the YAML options described above you can still use them by passing custom pandoc_args. For example:
---title: "Habits"output: beamer_presentation: pandoc_args: [ "--no-tex-ligatures" ]---