Skip to content

Commit 511685e

Browse files
committed
only use \tag for html w/ mathjax or katex
1 parent 1d049e2 commit 511685e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/command/render/filters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
kFigPos,
2020
kFigResponsive,
2121
kHeaderIncludes,
22+
kHtmlMathMethod,
2223
kIncludeAfter,
2324
kIncludeAfterBody,
2425
kIncludeBefore,
@@ -428,6 +429,7 @@ function quartoFilterParams(
428429
params[kShortcodes] = params[kShortcodes] || [];
429430
(params[kShortcodes] as string[]).push(...extShortcodes);
430431
}
432+
params[kHtmlMathMethod] = options.format.pandoc[kHtmlMathMethod];
431433

432434
const figResponsive = format.metadata[kFigResponsive] === true;
433435
if (figResponsive) {

src/resources/filters/crossref/equations.lua

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ function processEquations(blockEl)
4848
targetInlines:insert(pandoc.Span(pandoc.RawInline("latex", eq.text), pandoc.Attr(label)))
4949
targetInlines:insert(pandoc.RawInline("latex", "\\label{" .. label .. "}\\end{equation}"))
5050
else
51-
eq.text = eq.text .. " \\tag{" .. inlinesToString(numberOption("eq", order)) .. "}"
51+
local eqNumber = eqQquad
52+
local mathMethod = param("html-math-method", nil)
53+
if isHtmlOutput() and (mathMethod == "mathjax" or mathMethod == "katex") then
54+
eqNumber = eqTag
55+
end
56+
eq.text = eq.text .. " " .. eqNumber(inlinesToString(numberOption("eq", order)))
5257
local span = pandoc.Span(eq, pandoc.Attr(label))
5358
targetInlines:insert(span)
5459
end
@@ -85,6 +90,13 @@ function processEquations(blockEl)
8590

8691
end
8792

93+
function eqTag(eq)
94+
return "\\tag{" .. eq .. "}"
95+
end
96+
97+
function eqQquad(eq)
98+
return "\\qquad(" .. eq .. ")"
99+
end
88100

89101
function isDisplayMath(el)
90102
return el.t == "Math" and el.mathtype == "DisplayMath"

0 commit comments

Comments
 (0)