jhelvy / jhelvy/renderthis

renderthis::to_pdf() throw error for HTML slides using mathjax

Open
#75 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
178
Forks
13
PR merge metrics
No merged PRs in 30d

Description

Hello.

Thanks a lot for this package which I've been using happily for several years.

For some months now, I've been having an issue with some (but not all) symbols in LaTeX equations.

Initially, it seemed to be a quarto issue.

For instance, the following:

## The normal distribution

### Notation

$${\mathcal{N}}(\mu ,\sigma^{2})$$

was producing

image

Which led me to the fix here

format: 
  revealjs:
    html-math-method: mathjax
image

But now, that the LaTeX equation displays correctly in the HTML presentation, renderthis::to_pdf() throw the following error and fails to produce the PDF.

> renderthis::to_pdf("index.cluster.html")
Warning: A runtime exception has occured while executing JavaScript
  Runtime exception message:
    TypeError: Cannot read properties of undefined (reading 'Config')
    at http://127.0.0.1:5310/index.cluster_files/libs/revealjs/plugin/math/math.js:1:28635
    at HTMLScriptElement.i (http://127.0.0.1:5310/index.cluster_files/libs/revealjs/plugin/math/math.js:1:28502)

Note that weirdly enough, if I click the 'Print' button in the RStudio 'Presentation' tab, and manually (not programmatically) print it from there, the PDF contains the equation formatted properly.

image

Any suggestion?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with renderthis::to_pdf("index.cluster.html") using the MathJax setting shown in the issue, then inspect the generated revealjs/plugin/math/math.js runtime error. Compare this path with the RStudio Presentation tab's manual PDF output. Done means to_pdf produces a PDF with the LaTeX equation rendered correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, r
Domain
tooling, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.