LaTeXML icon indicating copy to clipboard operation
LaTeXML copied to clipboard

Model and styling for figures found in minipages

Open dginev opened this issue 3 years ago • 4 comments
trafficstars

I will start collecting examples in an issue, ideally I go to 5-10 different articles in arXiv, to see the broad flavor of markup we get with minipages. Currently my CSS is consistently wrong for them, but I would like to double-check the underlying HTML is also sensible. I'll recruit help, as I'm looking into details.

For starters, combinations with <span> elements with class ltx_inline-para ltx_minipage are curious.

Examples (starting with one):

dginev avatar Feb 09 '22 01:02 dginev

Table 1 in 1909.10893 starts raising some of the "impedance mismatch" questions rather directly. We have a figure with two panels (via minipage), each panel containing a table. When latexml decides that it needs to observe/respect the width specified via minipage, it may mismeasure -- especially when vendor styling is considered.

As I have made the article forcefully narrower (via setting a max-width of 52rem to the top-level .ltx_document), the absolute widths from minipage end up mismatching the reality of the viewport, and the two tables end up colliding with each other.

The most direct idea that comes to mind from reporting all of that is: "maybe we need relative widths?" Switching minipage to a flexbox model ought to correct this type of error.

dginev avatar Feb 18 '22 13:02 dginev

A strategically related, but maybe technically separate, note that I want to jot down relates to fixed absolute widths for individual table cells. The example that brought this up was Table 5, 2006.07159.

The computed width appeared too narrow as to contain the decorated citation elements in HTML in the first column.

The original markup was indeed preserved "faithfully", but the effect suffered the impedance mismatch. Here is the respective source:

\begin{tabularx}{\linewidth}{p{0.7cm}p{0.2cm}p{4cm}p{0.2cm}Cp{0.2cm}Cp{0.2cm}Cp{0.2cm}C}
    \cmidrule[1pt]{1-11}
    \bf{Ref.} && \bf{Model} && \bf{Arch. search} && \bf{Self-sup.} && \bf{Ext. data} && \bf{Final} \\

    \cmidrule[1pt]{1-11}
    \cite{simonyan2014very} && ...
    ...

The initial question would be "should we consider computing widths as percentages?", and what problems are we likely to run into then.

dginev avatar Mar 03 '22 15:03 dginev

Although PR #2286 didn't target this issue specifically in testing, I wonder if it improves the situation? (it kinda should)

brucemiller avatar Dec 21 '23 23:12 brucemiller

Although PR https://github.com/brucemiller/LaTeXML/pull/2286 didn't target this issue specifically in testing, I wonder if it improves the situation? (it kinda should)

It did! Allowing a {minipage} to transition through ltx:_CaptureBlock_ and into a ltx:figure ties really well with the flex subfigure setup.


Testing with PR #2302 today and am seeing (converting fresh):

  • 0708.0800 has healthy subfigure panels
  • 1909.10893 also has healthy subfigures, but has some remaining (unrelated?) questions about .ltx_transformed_outer and .ltx_transformed_outer as some minipages there are wrapped with further directives (Table 1).
  • 2008.05440 is also healthy, but needs some more work. Figure 8 may need some new CSS rules, while Figure 11 needs to recognize a flex context inside {minipage}, as it has 2 top-level subfigures, the right of which has a 4x5 grid. source scaffold is:
    \begin{figure}[!t]
    \centering
    \subfigure[Random Generation]{
    \begin{minipage}[b]{0.14\linewidth}
    \includegraphics[width=0.95\linewidth]{...}\\
    \includegraphics[width=0.95\linewidth]{...}\vspace{1mm}\\
    \includegraphics[width=0.95\linewidth]{...}\\
    \includegraphics[width=0.95\linewidth]{...}
    \end{minipage}\vline}
    \subfigure[Top-5 retrieved shapes in training sets]{
    \begin{minipage}[b]{0.73\linewidth}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}\\
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}\\
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}\\
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \includegraphics[width=0.19\linewidth]{...}
    \end{minipage}}
    \vspace{-3mm}
    \caption{...}
    \label{fig:generation_nn}
    \vspace{-3mm}
    \end{figure}
    

So there is some progress here, but we should probably keep the issue open for one more release.

dginev avatar Jan 24 '24 14:01 dginev