Latex Commands in Julia Markdown

Solution 1:

You can use "pandoc2pdf" instead to let pandoc interpret the markdown in the file: weave("myfile.jmd", doctype="pandoc2pdf") with your given script works and produces the expected pdf.


Alternate answer:

Weave documentation mentions that "md2pdf" uses Julia Markdown, and the Julia Markdown page specifies that LaTeX syntax goes between double backticks.

---
title: Just a test
author: Me
date: 2022-01-03
output: pdf_document
---

# Some header
Some text.

``\pagebreak``

## Some other header
More text.

This works and produces the intended output. (``\newpage`` errors out for some reason, and I'm not comfortable enough with LaTeX to figure out why.)

Solution 2:

I tested and here's the workaround:

$\]\pagebreak\[$

source: https://github.com/JunoLab/Weave.jl/issues/249