Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alignment.pm: regrouping rows #882

Closed
giovanni111 opened this issue Oct 25, 2017 · 1 comment
Closed

Alignment.pm: regrouping rows #882

giovanni111 opened this issue Oct 25, 2017 · 1 comment

Comments

@giovanni111
Copy link

When processing

\documentclass{article}
\usepackage{multirow,supertabular}
\begin{document}
\tablefirsthead{%
  \multirow{2}{*}{H} & H \\
                     & H \\}
\begin{supertabular}{ll}%
  B & \\
\end{supertabular}
\end{document}

the table head becomes lost, i.e. it is shifted to the body. The following change seems to help; please check that it does no damage:

diff --git a/lib/LaTeXML/Core/Alignment.pm b/lib/LaTeXML/Core/Alignment.pm
index eab3c1a..3055dc2 100644
--- a/lib/LaTeXML/Core/Alignment.pm
+++ b/lib/LaTeXML/Core/Alignment.pm
@@ -551,8 +551,8 @@ sub alignment_regroup_rows {
     my @cells = $document->findnodes('ltx:td', $rows[0]);
     # Non header cells, done.
     last if scalar(grep { (!$_->getAttribute('thead')) } @cells);
-    push(@heads, shift(@rows));
     my $line = scalar(@heads);
+    push(@heads, shift(@rows));
     $maxreach = max($maxreach, map { ($_->getAttribute('rowspan') || 0) + $line } @cells); }
   if ($maxreach > scalar(@heads)) {    # rowspan crossed over thead boundary!
     unshift(@rows, @heads); @heads = (); }
@brucemiller
Copy link
Owner

Seems like the right thing, but dayum, how'd you figure that out! I'm impressed!! Thanks and committed.

@dginev dginev added this to the LaTeXML-0.8.3 milestone Jan 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants