Skip to content

[Docusaurus] html-math-method: webtex config ignored - math rendered as tex_math_dollars #13853

@cderv

Description

@cderv

The html-math-method: webtex configuration in _extension.yml is not being applied. Math equations are output as $$..$$ (tex_math_dollars) instead of webtex image URLs.

Expected behavior

Per documentation:

"By default, Quarto renders LaTeX math within Docusaurus projects using WebTeX"

Expected output:

![](https://latex.codecogs.com/svg.latex?e%20%3D%20mc%5E2)

Actual behavior

Output:

$$e = mc^2$$

Root cause

PR #7996 changed the docusaurus architecture:

Before:

writer: docusaurus_writer.lua  # Custom writer honored all options

After:

quarto-custom-format: docusaurus
filters:
  - at: post-finalize
    path: docusaurus_citeproc.lua

The docusaurus_citeproc.lua filter calls pandoc.write() with a hardcoded format string and only passes columns in options (added in PR #8365):

local cli_opts = { columns = PANDOC_WRITER_OPTIONS.columns }
local result_str = pandoc.write(result, 'markdown_strict+...+tex_math_dollars+...', cli_opts)

The html-math-method and other writer options from _extension.yml are not forwarded.

Evidence

The test snapshot at tests/docs/smoke-all/2024/01/18/docusaurus/equations.mdx.snapshot (created Jan 2024) contains $$ syntax, not webtex URLs - indicating this was already broken when the test was created.

Related

Files

  • src/resources/extensions/quarto/docusaurus/_extension.yml (line 31: html-math-method: webtex)
  • src/resources/extensions/quarto/docusaurus/docusaurus_citeproc.lua (line 13-14: pandoc.write call)

This was uncovered while trying to understand snapshot change at #13249

And probably math is not the only problem we missed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions