LaTeXML
LaTeXML copied to clipboard
Block-level content in footnotes (align in marginpar)
\documentclass{article}
\usepackage{amsmath}
\begin{document}
This post is about the align environment.
I'm going to identify columns by $nR$ or $nL$ to indicate the $n\textsuperscript{th}$
column that should be Right or Left justified.
If I skip an entry in an align environment, LaTeXML fills it out with a colspan:
\begin{align*}1R&1L\\1R\end{align*} % missing &2L
If this is in a marginpar, however, LaTeXML uses span in place of td.
In addition to slightly different alignments, the colspan fails the html validation:
\marginpar{\begin{align*}1R&1L\\1R\end{align*}} % missing &2L
The colspan (but not the alignment) can be fixed by adding the missing ampersand:
\marginpar{\begin{align*}1R&1L\\1R&\end{align*}} % missing 2L
\begin{align*}1R&1L\\1R&\end{align*} % missing 2L
But if I'm using (abusing?) the ampersands to get a different alignment,
then adding the missing ampersand doesn't avoid the colspan,
and the marginpar version can't validate:
\marginpar{\begin{align*}1R&&2R&2L\\1R&&2R&\end{align*}}
\begin{align*}1R&&2R&2L\\1R&&2R&\end{align*}
Things I've tried to avoid the colspan:\\
inserting space:
\marginpar{\begin{align*}1R&\,&2R&2L\\1R&\,&2R&\end{align*}}
\begin{align*}1R&\,&2R&2L\\1R&\,&2R&\end{align*}
adding a makebox:
\marginpar{\begin{align*}1R&\makebox[1pt]{}&2R&2L\\1R&\makebox[1pt]{}&2R&\end{align*}}
\begin{align*}1R&\makebox[1pt]{}&2R&2L\\1R&\makebox[1pt]{}&2R&\end{align*}
The best I can do is remove the extra ampersands altogether and get the spacing some other way:
\marginpar{\begin{align*}1R\qquad2R&2L\\1R\qquad2R&\end{align*}}
\begin{align*}1R\qquad2R&2L\\1R\qquad2R&\end{align*}
(This also wouldn't work if $2R$ were changing its width,
but that's not something I'm having to worry about at the moment,
and if it were, I could put it into a makebox.)
Ideally, instead of span[colspan] we would just use a few more spans
(and possibly a few more td instead of colspan to maintain consistency).
But until then, is there a better hack I can use to get the alignments I want in an align environment?
\end{document}
To complete the issue description, here is the exact output of the w3c validator:

The basic tension is that LaTeXML's footnotes are treated as inline material (spans), but of course TeX has no issue adding any block-level material anywhere it likes. So an advanced table can be added to a margin, but would be invalid HTML, with our inline-level footnotes.
I think the capital P "Purist" refactor here would be to detach the pieces of our footnotes. In the sense that the marks of the notes are deposited inline, separately from the block-level content of the notes. The content can be trailing at the next block-level insertion point, e.g. the end of a paragraph. Pandoc does something of this nature from what I remember. And naturally, the cite-bibliography split in latexml already works that way.
If we wanted such bits to be meaningfully "valid", I think we should evolve our data model, rather than recreate advanced tables with ever stranger span soup. But of course, creating the perfect span-based table is a "meaningful" HTML way to stay valid as well.
As a side-note (ha!) this may also be a good place to remark that a lot of my unresolved styling breakage for arXiv resides on subfigures realized via the ltx_inline-para and ltx_minipage classes. The footnote table here is using ltx_inline-para.
Their flexibility makes them extremely convenient, but also highly unpredictable to tame. Or, possibly, I still don't understand the full implications of what TeX can do with the possible arrangements of material.
There could be different choices for notes & marginpars in the XSLT, but may need support from CSS and javascript. For example, splitting the footnote mark and content would allow the latter (if properly placed in the html) to be a div rather than span and allow the content to be better preserved. That could work if they were positioned into the margin, but the get the popup effect, you'd need js support.
To the extent that we are working with the span-soup content, I'm not clear what is missing in all the CSS that's piled on top that keeps the "columns" from aligning as in a legit table. Seems like it should have aligned.
And we probably could do a bunch of extra alignment searching to eliminate the colspans in some of your cases, but doesn't seem worth the effort (and new bugs).