quarto-dev / quarto-dev/quarto-cli

HTML Table in PDF - `\multirow` is used but somehow, `\usepackage{multirow}` is missing when table is crossreferenced

Open
#13,093 6 comments 0 reactions 2 assignees View on GitHub

@cscheid is already working on this.

Since Jul 17, 2025.

bug crossref latex tables
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

So the issue is that \multirow is used, but somehow, \usepackage{multirow} is missing when

::: {#tbl-test}

```{=html}
<table>
  <thead>
    <tr>
      <th>species_spanner</th>
      <th rowspan="2">island</th>
    </tr>
    <tr>
      <th rowspan="1">species</th>
    </tr>
  </thead>
</table>
```

:::

but not if the table is not crossreferenced


```{=html}
<table>
  <thead>
    <tr>
      <th>species_spanner</th>
      <th rowspan="2">island</th>
    </tr>
    <tr>
      <th rowspan="1">species</th>
    </tr>
  </thead>
</table>
```

So probably related to multirow variable not set in one of the scenario
https://github.com/quarto-dev/quarto-cli/blob/2f247767e6aa2eb62a4871c4e7ccff3ac1ac3641/src/resources/formats/pdf/pandoc/tables.tex#L6-L8

Originally posted by @cderv in https://github.com/quarto-dev/quarto-cli/discussions/13084#discussioncomment-13789627

Full reprex

---
format: pdf
keep-tex: true
keep-md: true
---

::: {#tbl-test}

```{=html}
<table>
  <thead>
    <tr>
      <th>species_spanner</th>
      <th rowspan="2">island</th>
    </tr>
    <tr>
      <th rowspan="1">species</th>
    </tr>
  </thead>
</table>
```

:::

Git diff between two tex files

diff --git "a/.\\index-ori.tex" "b/.\\index.tex"
index d3add64..b1718c8 100644
--- "a/.\\index-ori.tex"
+++ "b/.\\index.tex"
@@ -67,7 +67,6 @@
 
 
 \usepackage{longtable,booktabs,array}
-\usepackage{multirow}
 \usepackage{calc} % for calculating minipage widths
 % Correct order of tables after \paragraph or \subparagraph
 \usepackage{etoolbox}
@@ -167,6 +166,11 @@
 
 
 \begin{longtable}[]{@{}ll@{}}
+
+\caption{\label{tbl-test}}
+
+\tabularnewline
+
 \toprule\noalign{}
 species\_spanner & \multirow{2}{=}{island} \\
 species \\
@@ -174,6 +178,7 @@ species \\
 \endhead
 \bottomrule\noalign{}
 \endlastfoot
+
 \end{longtable}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.