Open DominikPeters opened 1 month ago
Seems reasonable on the surface. @dginev how does this interact with your work?
Well, it is hard to say for certain without adding a few more tests. The one test I had checked in (t/complex/figure_mixed_content.tex
) has a {wrapfigure}
that contains an {algorithm}
in a minipage, which is already a nice counter-example:
Using the mainline latexml, and ar5iv.css, that figure renders as:
with the PR, because the figure contains textual content, the min-content
directive compresses down to what is essentially the length of the longest word:
So we may want to make such CSS enhancement a little more precise, applying only to the image and table cases. And check in tests for those respectively.
So, it seems that the wrapfigures request of width is probably a relevant constraint.
The current bindings for the
wrapfig
package ignore the author-specified width. Together with the standard css, this leads to a bad presentation of wrapfigures with long captions. This pull request adds CSS (settingwidth: min-content
on the<figure>
element) to limit the length of the caption of a wrapfigure to the length of the image. (Probably the more elegant solution is to take into account the width parameter of thewrapfigure
environment, but this is a simple fix for the moment.)Example:
PDF:
LaTeXML (note that if the caption gets longer, the figure can take up up to 100% of the width of the page):
LaTeXML with this pull request: