quarto-dev / quarto-dev/quarto-cli

Broken build to PDF with kableExtra:

Open
#10,584 13 comments 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Aug 22, 2024.

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

Description

Bug description

I have the following document:

# A book

```{r, tbl-my-table}
df <- as.data.frame(matrix(runif(n=10, min=1, max=20), nrow=5))
kableExtra::kable_styling(kableExtra::kable(df, caption = 'Text {text}'))
```

with _quarto.yml:

project:
  type: book

book:
  chapters:
    - index.Rmd

When I build with:

quarto render --no-cache --to pdf

I get the following error:

Rendering PDF
running xelatex - 1
  This is XeTeX, Version 3.141592653-2.6-0.999996 (TeX Live 2024) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  
updating tlmgr

updating existing packages
ERROR: 
compilation failed- error
Misplaced \cr.
\reserved@c ->\ifnum 0=`{}\fi \cr 
                                  
l.241 \toprule
               

see /Users/mb312/dev_trees/min-quarto-pdf/index.log for more information.
ERROR: Error
    at Object.onComplete (file:///Users/mb312/dev_trees/quarto-cli/src/project/types/book/book-render.ts:317:15)
    at eventLoopTick (ext:core/01_core.js:153:7)
    at async renderFiles (file:///Users/mb312/dev_trees/quarto-cli/src/command/render/render-files.ts:346:12)
    at async renderProject (file:///Users/mb312/dev_trees/quarto-cli/src/command/render/project.ts:441:23)
    at async Command.actionHandler (file:///Users/mb312/dev_trees/quarto-cli/src/command/render/cmd.ts:248:26)
    at async Command.execute (file:///Users/mb312/dev_trees/quarto-cli/src/vendor/deno.land/x/cliffy@v1.0.0-rc.3/command/command.ts:1948:7)
    at async Command.parseCommand (file:///Users/mb312/dev_trees/quarto-cli/src/vendor/deno.land/x/cliffy@v1.0.0-rc.3/command/command.ts:1780:14)
    at async quarto (file:///Users/mb312/dev_trees/quarto-cli/src/quarto.ts:163:5)
    at async file:///Users/mb312/dev_trees/quarto-cli/src/quarto.ts:185:5
    at async mainRunner (file:///Users/mb312/dev_trees/quarto-cli/src/core/main.ts:35:5)
make: *** [book] Error 1

I do not get the error:

  • Building with rmarkdown::render('index.Rmd', 'pdf_document')
  • Without the kableExtra::kable_styling() wrapper
  • Without text in curly braces in the caption.
Steps to reproduce
git clone https://github.com/matthew-brett/min-quarto-pdf
cd min-quarto-pdf
make
Expected behavior

The PDF should build without error.

Actual behavior

See error message above.

Your environment
  • Macos Sonoma 14.6.1, running on command line.
Quarto check output
Quarto 99.9.9
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      commit: 39dc173c4869ebaf4d6bb087a972acb87533b64e
      Path: /Users/mb312/dev_trees/quarto-cli/package/dist/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /Library/TeX/texbin
      Version: 2024

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.10.14
      Path: /Users/mb312/.virtualenvs/resampling-with/bin/python3
      Jupyter: 5.3.0
      Kernels: python3, ir, xibabel

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.1
      Path: /opt/homebrew/Cellar/r/4.4.1/lib/R
      LibPaths:
        - /Users/mb312/Library/R/arm64/4.4/library
        - /opt/homebrew/lib/R/4.4/site-library
        - /opt/homebrew/Cellar/r/4.4.1/lib/R/library
      knitr: 1.47
      rmarkdown: 2.28

[✓] Checking Knitr engine render......OK

Running on latest quarto-cli/quarto, commit 39dc173c4.

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.