Skip to content

code blocks in the margin for pdf output fail #12764

@aavilaherrera

Description

@aavilaherrera

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglatexLaTeX engines related libraries and technologieslayout

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions