quarto-dev / quarto-dev/quarto-cli

Option to render display math blocks as images?

Open
#818 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

I use Quarto (and previously just pandoc) at work to write docs that often include LaTeX math blocks. Unfortunately for me, to get anyone to read them, I have to convert them to Google Docs.

That often works fine by rendering as .docx, uploading the doc, and converting it to a Google Doc. However, I usually have issues with display math blocks not rendering correctly when converting from docx to Google Docs.

I'm thinking about a potential workaround where I could tell Quarto to render those display math blocks as images, so they'd display correctly in Google Docs. Is that already possible? I'd also think a feature like this might be useful in other scenarios outside of just my use case.

My current workflow is to render the doc in a different format, screenshot the correctly-rendered math blocks, and paste them into the Google Doc manually. But it would be really nice to be able to automate that step. :)

Example of the rendering issue

---
title: "Quarto to Google Docs math example"
self-contained: true
format:
  html:
    toc: true
  pdf:
    toc: true
  docx:
    toc: false
---


Inline math often renders OK: $1 = \sum_{i=1}^n \pi_i$.

Math blocks are also sometimes OK:

$$
1 = \sum_{i=1}^n \pi_i.
$$


But more complicated ones usually have issues like:

$$
\begin{array}{ll}
\mbox{minimize}    & f(x)     \\
\mbox{subject to}  & x \in C
\end{array}
$$

or like this:

$$
\begin{aligned}
x \in A \\
y \in B
\end{aligned}
$$

Google Docs

Screen Shot 2022-05-06 at 11 24 47 AM

MS Word on Mac

Screen Shot 2022-05-06 at 11 24 18 AM

PDF

Screen Shot 2022-05-06 at 11 24 06 AM

HTML

Screen Shot 2022-05-06 at 11 23 58 AM

Contributor guide

Open the contributing guide

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 supplied Quarto example with the HTML, PDF, and DOCX formats, focusing on the display-math blocks that fail after conversion to Google Docs. Define the option and verify that eligible display equations are rendered as images in the DOCX output while inline math and other formats remain appropriately handled.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.