ar5iv icon indicating copy to clipboard operation
ar5iv copied to clipboard

Improve article 1909.10893 : overlap between 2 side-by-side tabular-in-minipage-in-resizebox

Open sietse opened this issue 3 years ago • 4 comments

Exact location of issue

The problem occurs in Table 1: Copying task ..., of Section 4.1.1 "Copying Task", of article /html/1909.10893, "Recurring Independent Mechanisms"

Problem details

  • The authors are laying out two results tables, side by side, in one table-with-caption float.
  • In the source, they do this with a \begin{table*} environment, which contains two \resizebox; each resizebox contains a \minipage, which contains a \tabular environment.
  • In the rendered HTML, the two results tables are both about one-sixth of their width over the centerline, and as a result have 30% overlap. They leave empty space on either side, compared to the normal-width caption.
  • NB: it may look like there are 3 tables being smooshed together; but it's just 2 tables. The right table has some header cells that stick out and break up its silhouette.

(Optional) Expected behavior

Two tables, side by side.

Desktop

  • OS: Linux Mint (based on Ubuntu, based in Debian)
  • Browser: both Firefox and Vivaldi (based on Chromium) display this problem

Screenshots

This is what the Ar5iv rendering looks like: image

And this is what the PDF rendering looks like: image

Additional context: source code This is the source code of the table* environment:

\begin{table*}[t]
%\vspace{-5mm}
\footnotesize
%\centering
\resizebox{0.36\columnwidth}{!}{
\begin{minipage}[t]{0.4\textwidth}
  % --- language table
  \begin{tabular}{p{1.3ex}rrr|r|r}
  \toprule
  \multicolumn{4}{l|}{\textbf{Copying}} &
  \multicolumn{1}{c|}{\textbf{Train(50)}} &
  \multicolumn{1}{c}{\textbf{Test(200)}} \\
  & \parbox{2em}{$k_\textrm{T}$} & $k_\textrm{A}$ & $h_\textrm{size}$ & 
  CE &
  CE \\ 
  \midrule
  \multirow{4}{*}{\rotatebox{0}{\parbox{2.5em}{\textbf{RIMs}}}}
  %& 6 & 5 & 600 & 0.01 & 0.35 \\
  & 6 & 4 & 600 & \textbf{0.00} & \textbf{0.00} \\
  & 6 & 3 & 600 & \textbf{0.00} & \textbf{0.00} \\
  & 6 & 2 & 600 & \textbf{0.00} & \textbf{0.00} \\
  & 5 & 2 & 500 & \textbf{0.00} & \textbf{0.00} \\
%  & 5 & 2 & 500 & \textbf{0.00} & \textbf{0.00} \\
%  & 5 & 2 & 500 & \textbf{0.00} & \textbf{0.00} \\
%  & 4 & 2 & 400 & \textbf{0.00} & \textbf{0.00} \\
%  & 4 & 2 & 400 & \textbf{0.00} & \textbf{0.27} \\
  \midrule
  \multirow{2}{*}{\rotatebox{0}{\parbox{2.5em}{\textbf{LSTM}}}}
  & - & - & 300 &  0.00 & 4.32 \\
  & - & - & 600 &  0.00 & 3.56 \\
  \midrule
  \multirow{1}{*}{\rotatebox{0}{\parbox{2.5em}{\textbf{NTM}}}}
  & - & - & - &  0.00 & 2.54 \\
  \midrule
  \multirow{1}{*}{\rotatebox{0}{\parbox{2.5em}{\textbf{RMC}}}}
  & - & - & - & 0.00 & 0.13 \\
  \midrule
  \multirow{1}{*}{\rotatebox{0}{\parbox{2.5em}{\textbf{Transformers}}}}
  & - & - & - & 0.00 & 0.54 \\
  \bottomrule
  \end{tabular}
\end{minipage}}
\hspace{3.3em}
\resizebox{0.36\columnwidth}{!}{
\begin{minipage}[t]{0.4\textwidth}
  % --- language table
  \begin{tabular}{p{1.3ex}rrr|r|r|r}
  \toprule
  \multicolumn{4}{l|}{\textbf{Sequential MNIST}} &
  \multicolumn{1}{c|}{\textbf{16 x 16}} &
  \multicolumn{1}{c}{\textbf{19 x 19}} &
  \multicolumn{1}{c}{\textbf{24 x 24}} \\
  & \parbox{2em}{$k_\textrm{T}$} & $k_\textrm{A}$ & $h_\textrm{size}$ & 
  Accuracy &
  Accuracy &
  Accuracy \\ 
  \midrule
  \multirow{4}{*}{\rotatebox{0}{\parbox{2.5em}{\textbf{RIMs}}}}
  & 6 & 6 & 600 & 85.5 & 56.2 & 30.9\\
  & 6 & 5 & 600 & 88.3 & 43.1 & 22.1 \\
  & 6 & 4 & 600 & \textbf{90.0} & \textbf{73.4} & \textbf{38.1}  \\
  \midrule
  \multirow{2}{*}{\rotatebox{0}{\parbox{2.5em}{\textbf{LSTM}}}}
  & - & - & 300 &  86.8 & 42.3 & 25.2 \\
  & - & - & 600 &  84.5 & 52.2 & 21.9\\
  \midrule
  \multirow{1}{*}{\rotatebox{0}{\parbox{2.5em}{\textbf{EntNet}}}}
  & - & - & - &  89.2 & 52.4 & 23.5 \\
  \midrule
  \multirow{1}{*}{\rotatebox{0}{\parbox{2.5em}{\textbf{RMC}}}}
  & - & - & - &  89.58 & 54.23 & 27.75 \\
  \midrule
  \multirow{1}{*}{\rotatebox{0}{\parbox{2.5em}{\textbf{DNC}}}}
  & - & - & - &  87.2 & 44.1 & 19.8 \\
  \multirow{1}{*}{\rotatebox{0}{\parbox{2.5em}{\textbf{Transformers}}}}
  & - & - & - &  \textbf{91.2} & 51.6 & 22.9 \\
  \bottomrule
  \end{tabular}
\end{minipage}}
\caption{Performance on the copying task (left) and Sequential MNIST resolution generalization (right).  While all of the methods are able to learn to copy for the length seen during training, the RIMs model generalizes to sequences longer than those seen during training whereas the LSTM, RMC, and NTM degrade much more.  On sequential MNIST, both the proposed and the Baseline models were trained on 14x14 resolution but evaluated at different resolutions (averaged over 3 trials). 
}
\label{tb:copy_mnist}
\vspace{-4mm}
\end{table*}

sietse avatar Feb 18 '22 13:02 sietse

This issue is possibly related to #37 , which also involves \resizebox and colliding/overlapping elements.

sietse avatar Feb 18 '22 13:02 sietse

Thank you for the detailed report!

Cross-referencing latexml #1797.

I am indeed aware (and saddened by) minipages currently almost always looking broken on the ar5iv site. They need a bit of focused attention on the latexml side, possibly deciding on a flexbox approach, and then a little bit of CSS styling.

Certainly to be fixed in the mid-term future.

dginev avatar Feb 18 '22 13:02 dginev

I made some progress here (as part of a wider CSS styling run), and the tables will no longer clash.

Sadly, in some browsers there is now an over-correction. In Firefox in particular, the two subtables end up even vertically spaced out. So I'll keep this issue open a little while longer.

dginev avatar Jan 18 '23 00:01 dginev

Sadly, in some browsers there is now an over-correction. In Firefox in particular, the two subtables end up even vertically spaced out. So I'll keep this issue open a little while longer.

This has flipped back to a clash, as we just had an update with latexml v0.8.8 where the subfigure markup was adapted, and the CSS hasn't caught up. Making a note to revise table 1.

dginev avatar Mar 23 '24 23:03 dginev