Skip to content

Filters not applied on labelled math formulas when rendering to PDF #383

@knuesel

Description

@knuesel

Lua filters can change the content of math fomulas, except for formulas with labels when rendering to PDF.

This can be worked around by running the Lua filter before the quarto filters, so maybe it's not a bug? But it's a bit confusing that the behavior changes depending on the format and label vs no label...

Here's an MWE, tested with quarto 0.9.58: create a.qmd with

---
filters:
  - filter.lua
---

$$x=1$$ {#eq-x}

and filter.lua with

function Math(el)
    el.text = 'y'
    return el
end

The filter simply replaces all math formulas with y.

Running quarto render a.qmd gives the expected HTML output: the formula is "y".

However quarto render a.qmd --to pdf makes a PDF with the original equation "x=1".

It does work if the label is removed, i.e. if the document contains $$x=1$$ instead of $$x=1$$ {#eq-x} then the PDF shows "y".

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestluaIssues related to the lua codebase, filter chain, etcmathany issue related to math support in specific formats

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions