Skip to content

Commit

Permalink
Pandoc 3.1.7 outputs label, so omit this
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonstyle committed Sep 5, 2023
1 parent 16d1541 commit 174e9ac
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/resources/filters/crossref/equations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,17 @@ function process_equations(blockEl)
if _quarto.format.isLatexOutput() then
targetInlines:insert(pandoc.RawInline("latex", "\\begin{equation}"))
targetInlines:insert(pandoc.Span(pandoc.RawInline("latex", eq.text), pandoc.Attr(label)))
targetInlines:insert(pandoc.RawInline("latex", "\\label{" .. label .. "}\\end{equation}"))

-- Pandoc 3.1.7 started outputting a shadow section with a label as a link target
-- which would result in two identical labels being emitted.
-- https://github.com/jgm/pandoc/issues/9045
-- https://github.com/lierdakil/pandoc-crossref/issues/402
if PANDOC_VERSION >= pandoc.types.Version("3.1.7") then
targetInlines:insert(pandoc.RawInline("latex", "\\end{equation}"))
else
targetInlines:insert(pandoc.RawInline("latex", "\\label{" .. label .. "}\\end{equation}"))
end

elseif _quarto.format.isTypstOutput() then
targetInlines:insert(pandoc.RawInline("typst",
"#set math.equation(numbering: \"(" .. inlinesToString(numberOption("eq", order)) .. ")\"); " ..
Expand Down

0 comments on commit 174e9ac

Please sign in to comment.