Skip to content

Alignment.pm: regrouping rows #882

@giovanni111

Description

@giovanni111

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 = (); }

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions