Set PDF Options in Julia Markdown

Viewed 112

I have a Julia Markdown file (jmd).

---
title: My Title
output: pdf_document
---

```julia echo=false
6+4
```

How can I transport information to LaTex? For example I would like to set the paper orientation to landscape or decrease the font size or similar. I thought be there must be something similar to Rmarkdown, something like

---
title: My title
output: 
  pdf_document:
    toc: true
    number_sections: true
documentclass: article
classoption: landscape, a3paper
---

But it does not work in jmd files. Anyone a clever idea?

1 Answers

Setting Configurations on Two Fronts

Weave Options

weave_options can be specified in a Julia Markdown Document's front matter. These are options that might otherwise be passed to the weave function as keyword arguments (configuration in front matter takes precedence over function call options). E.g., one can define the doctype and highlight options. Optionally, one may also define a custom latex template. The following front matter would set these options.

---
title: My Title
author: Me
date: March 21, 2022
weave_options:
    doctype: pandoc2pdf
    highlight: pygments
    template: relative/path/to/custom.tpl
---

Pandoc Options

Assuming that your working with doctype: pandoc2pdf or doctype: pandoc2html then you can also set Pandoc options by passing them as a vector of strings to the pandoc_options keyword argument of the weave function. E.g., for a table of contents and numbered sections one could run the following.

weave("test.jmd", pandoc_options=["--toc", "-N"])
Related