ekstroem / dataReporter

85 stars 4 forks source link

Suggested changes: Specify the latex_engine to use for PDF rendering #7

Open jmcastagnetto opened 2 years ago

jmcastagnetto commented 2 years ago

First off: Excellent package, I just discovered today and I am already using it to mass generate EDAs for a bunch of inherited datasets :-)

Now for the suggested changes.

In the line:

https://github.com/ekstroem/dataReporter/blob/d29e28f49a395a1eb5e7631f16e4a2f788e21587/R/makeDataReport.R#L635

The YAML generated just uses the default engine, which is usually pdflatex, but that engine cannot handle Unicode characters, so there might be at least three options:

1) Autoselect xelatex or luatex, over pdflatex if any of those is available, so the YAML will look something like:

pdf_document:
    latex_engine: xelatex

2) Allow for a parameter or an option() to specify the latex engine

3) Document that creating the file _output.yaml (or _output.yml) in the output dir, will override the engine definition (see: https://bookdown.org/yihui/rmarkdown/html-document.html#shared-options)

I run into this issue with data that contained unicode chars, and ended up using option (3), which might not be too well known.

From the API user point of view, options (1) and (2) (not mutually exclusive) would be smoother.