dginev / ar5iv

A web service offering HTML5 articles from arXiv.org as converted with latexml
https://ar5iv.org
MIT License
782 stars 20 forks source link

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

Open sietse opened 2 years ago

sietse commented 2 years ago

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

(Optional) Expected behavior

Two tables, side by side.

Desktop

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 commented 2 years ago

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

dginev commented 2 years ago

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 commented 1 year ago

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 commented 6 months ago

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.