Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set PDF Options in Julia Markdown

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?

like image 556
Georgery Avatar asked Oct 14 '25 16:10

Georgery


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"])
like image 114
Jacob Vaverka Avatar answered Oct 17 '25 08:10

Jacob Vaverka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!