LaTeXML icon indicating copy to clipboard operation
LaTeXML copied to clipboard

Inconsistency: One `aligned` -> `equationgroup`, 2+ `aligned` -> `equation`

Open nschloe opened this issue 2 years ago • 5 comments
trafficstars

One aligned:

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{equation}
	\begin{aligned}
		a
	\end{aligned}
\end{equation} 

\end{document}

LaTeXML output:

<equationgroup xml:id="S0.E1">
  ...
</equationgroup>

Two aligned:

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{equation}
	\begin{aligned}
		a
	\end{aligned}\\
	\begin{aligned}
		b
	\end{aligned}
\end{equation} 

\end{document}

LaTeXML output:

<equation xml:id="S0.E1">
  ...
</equation>

nschloe avatar Jun 22 '23 12:06 nschloe

I can reproduce the description.

To clarify, both variants have a ltx:equation element holding the latex {equation} content, but the first (smaller) variant also has an outer ltx:equationgroup wrapper holding the tags. In the second example the tags end up inside the ltx:equation.

So indeed, a little inconsistent...

dginev avatar Jun 22 '23 12:06 dginev

Forgive my asking, but are there any negative consequences to this inconsistency?

The example is somewhat of a misuse of aligned, in that (as I understand it), aligned is meant to collect up pairs of lhs,rhs to present a collection of "equations" in a single display (with the parts aligned). In anticipation of this, we turn \begin{equation}\begin{aligned} into an equationgroup containing several equations. The second example doesn't fit the pattern so easily, so ...

brucemiller avatar Aug 15 '23 16:08 brucemiller

To clarify, the odd thing is that one aligned gets tranlated to an equationgroup, two aligned get translated to a single equation.

(The regex you mention is present in both cases.)

nschloe avatar Aug 15 '23 18:08 nschloe

I recognize the inconsistency, but does it matter?

brucemiller avatar Aug 15 '23 19:08 brucemiller

I noticed it when trying to convert things in Markdown where I don't have a proper strategy dealing with <equationgroup>s yet (see https://github.com/brucemiller/LaTeXML/issues/2092). That's why I was keen on getting simple <equation>s if possible.

When #2092 is resolved one way or another, it won't bother me much either.

nschloe avatar Aug 15 '23 19:08 nschloe