You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
\intertext is a very popular command in LaTeX. Suppose that I have the following LaTeX code:
We cancel out 2
\begin{align*}
2x + 2y -2 + 2 &= 2x + 2y
\intertext{and factor out 2}
&=2(x+y)
\end{align*}
Then pdflatex produces the following output:
make4ht, however, puts the text inside the equation (which is the worst possible outcome):
Obviously, the \intertext part must become a part of the usual HTML. Wouldn't it be possible to replace the opening \intertext{ with \end{align*} and the ending } with \begin{align*}? I once did something like this in JavaScript as a temporary solution (before I switched to make4ht):
latexml.parser.intertext = function(text) {
for (const align of ["align", "align*"]) {
var begin_align = text.indexOf("\\begin{"+align+"}");
while (begin_align != -1) {
var end_align = text.indexOf("\\end{"+align+"}", begin_align);
var start = text.indexOf("\\intertext", begin_align, end_align);
while (start != -1) {
var end = latexml.parser.bracketClosing(text, "{", start+9+1);
text = text.modify("}", "\\begin{"+align+"}", end, end+1);
text = text.replace("\\intertext{", "\\end{"+align+"}");
start = text.indexOf("\\intertext", begin_align, end_align);
}
begin_align = text.indexOf("\\begin{"+align+"}", end_align);
}
}
return text;
}
The main trick is, of course, preserving the alignment of &. But even if that is not possible, I think that this would be a better solution than what we have right now.
Thanks, Michal!
The text was updated successfully, but these errors were encountered:
\intertext
is a very popular command inLaTeX
. Suppose that I have the followingLaTeX
code:Then
pdflatex
produces the following output:make4ht
, however, puts the text inside the equation (which is the worst possible outcome):Obviously, the \intertext part must become a part of the usual HTML. Wouldn't it be possible to replace the opening
\intertext{
with\end{align*}
and the ending}
with\begin{align*}
? I once did something like this in JavaScript as a temporary solution (before I switched tomake4ht
):The main trick is, of course, preserving the alignment of
&
. But even if that is not possible, I think that this would be a better solution than what we have right now.Thanks, Michal!
The text was updated successfully, but these errors were encountered: