quarto-dev / quarto-dev/quarto-cli

Different math behavior in HTML and DOCX

Open
#10,305 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug lint math pandoc upstream
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

It seems like DOCX files need math to be surrounded by ``$$ ... $$` while HTML documents do not. It is counterintuitive to me that the way Quarto expects math to be written depends on the output.

Steps to reproduce
---
title: "Math Quarto test"
format:
  docx:
    toc: false
  html:
    toc: false

---


\begin{align*}
  \text{Equation 1}
\end{align*}

$$
\begin{align*}
  \text{Equation 2}
\end{align*}
$$
Expected behavior

I expect that both equations will display in the HTML and DOCX outputs.

Actual behavior

Only the HTML displays both equations. The DOCX only displays the equation when surrounded by $$ ... $$.

HTML

Screenshot 2024-07-16 at 16 54 25

DOCX

Screenshot 2024-07-16 at 16 54 39
Your environment
  • OS: MacOS 14.5 (23F79)
  • VSCode
Quarto check output
Quarto 1.5.54
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.54
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /Library/TeX/texbin
      Version: 2023

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.11.3
      Path: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3
      Jupyter: 5.3.0
      Kernels: ir, julia-1.6, julia-1.8, julia-1.9, juliapro_v1.5.0-1-1.5, julia-1.5, julia-12-threads-1.8, python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.0
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
      knitr: 1.47
      rmarkdown: 2.27

[✓] Checking Knitr engine render......OK

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 with the provided minimal Quarto reproduction and compare how Pandoc processes the two math forms for HTML and DOCX output. Done means both equations render in both formats without requiring different source syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
tooling
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.