Support multiple \tag inside of AMS environments
Opened this issue · 5 comments
Hi, would it be possible to update the underlying katex to something above 0.15.1
? That would allow to put multiple \tag
elements (one per line) withing AMS environments KaTeX/KaTeX#2379 (comment)
That is extremely useful and common in .tex files.
Thanks in advance!
Hi, I have just released 0.1.9 which updates KaTeX to 0.15.1. Please check.
@xu-cheng thanks for such quick response. Unfortunately it doesn't work, but that is not your fault, it is on the katex side: KaTeX/KaTeX#2379 (comment) I hope they can re-open and fix.
@xu-cheng are you sure it has 0.15.1
? Little test here:
This file is demo3.tex
\documentclass[a4paper,twoside]{scrbook}
\usepackage{amsmath}
\begin{document}
\begin{align*}
y = \sin(nx) \tag{eq1} \\
z = \cos(nx) \tag{eq2}
\end{align*}
\end{document}
check version of pandoc-katex
to make sure it is 0.1.9
and run it
$ pandoc-katex -V
pandoc-katex 0.1.9
$ pandoc demo3.tex -f latex -t html -s -o test3.html --filter pandoc-katex
Error: failed to execute js (detail: String("ParseError: KaTeX parse error: Multiple \\tag"))
Error running filter pandoc-katex:
Filter returned error status 1
fails. Now with just regular katex, file test.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css">
</head>
<body>
$$
\begin{align*}
y = \sin(nx) \tag{eq1} \\
z = \cos(nx) \tag{eq2}
\end{align*}
$$
</body>
<script src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js"
onload="renderMathInElement(document.body);"></script>
</html>
produces the following output without any errors
I can reproduce your issue. But I think this is a result of combination issue of pandoc and katex.
If you run pandoc -f latex -t json demo3.tex | jq .
, you will get
{
"pandoc-api-version": [
1,
22,
1
],
"meta": {},
"blocks": [
{
"t": "Para",
"c": [
{
"t": "Math",
"c": [
{
"t": "DisplayMath"
},
"\\begin{aligned}\n y = \\sin(nx) \\tag{eq1} \\\\\n z = \\cos(nx) \\tag{eq2}\\end{aligned}"
]
}
]
}
]
}
You can see pandoc replaces align*
to aligned
. At the same time, it does not seem that katex supports multiple \tag
for aligned
environment. Please consider to submit this issue to pandoc or katex.
Wow! Amazing find!