quarto-dev / quarto-dev/quarto-cli

code blocks in the margin for pdf output fail

Open
#12,764 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug description

A quarto document that puts a code block in the margin fails to render to pdf (via latex). Possibly related to #5554. Bug encountered with quarto version 1.7.31 and in latest pre-release: 1.87

Steps to reproduce

Render the following mre like so quarto render mre.qmd --to pdf

---
---

[`backticks work`]{.aside}

```{r}
#| column: margin
#this doesn't work:
matrix(1:25, 5, 5)
```

::: {.column-margin}
this doesn't work either:

```r
matrix(1:25, 5, 5)
```
:::
Actual behavior

The latex to pdf step fails.

ERROR: 
compilation failed- error
Paragraph ended before \FV@BeginScanning was complete.
<to be read again> 
                   \par 
l.237 
      
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

 

see mre.log for more information.

mre.log contains:

Runaway argument?
 \CommentTok {\#doesn\textquotesingle {}t work} \FunctionTok {matrix}\ETC.
! Paragraph ended before \FV@BeginScanning was complete.
<to be read again> 
                   \par 
l.237 
      
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
Expected behavior

A pdf with a code block in the margin should be rendered. Rendering to html works just fine (--to html). An attempt to use the wkhtmltopdf engine succeeded (--to pdf --pdf-engine wkhtmltopdf --metadata title="mre"), but rendered the margin note as part of the main text.

Your environment
  • OS: Debian 12
  • IDE: vim 9
Quarto check output
Quarto 1.8.7
[✓] Checking environment information...
      Quarto cache location: /home/aram/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.6.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.3.1: OK
      Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.8.7
      Path: /home/aram/.local/opt/quarto-1.8.7/bin

[✓] Checking tools....................OK
      TinyTeX: v2025.05
      Chromium: 869685

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /home/aram/.TinyTeX/bin/x86_64-linux
      Version: 2025

[✓] Checking Chrome Headless....................OK
      Chrome:  (not detected)

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

[✓] Checking Python 3 installation....OK
      Version: 3.11.2
      Path: /usr/bin/python3
      Jupyter: 4.12.0
      Kernels: python3

(-) Checking Jupyter engine render....[IPKernelApp] ERROR | No such comm target registered: quarto_kernel_setup
[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.2.2
      Path: /usr/lib/R
      LibPaths:
        - /home/aram/R/x86_64-pc-linux-gnu-library/4.2
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.50
      rmarkdown: 2.29

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

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.

Research direction

Start by running the provided mre.qmd with quarto render mre.qmd --to pdf and inspect the generated LaTeX around the margin code block. Compare the PDF path with the working HTML render and identify where margin code is emitted; done means the MRE renders to PDF with the code block in the margin.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, latex, r
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.