Skip to content

Commit ff77c43

Browse files
authored
fix(pdf/latex): wrap Note content in Blocks list for reference-location margin (#13588) (#14464)
n.content on a Note element must be a Blocks list, but the handler introduced for #7534 was assigning a bare pandoc.Para (a single Block), causing scopedwalk.lua to crash with "attempt to get length of a Block value" whenever a footnote appeared alongside a fig-cap figure in a PDF document using reference-location: margin. Wrapping the Para in pandoc.Blocks({...}) restores the correct type and preserves the \endgraf behaviour needed for multi-paragraph sidenotes.
1 parent 8d8337a commit ff77c43

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

news/changelog-1.10.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ All changes included in 1.10:
99

1010
## Formats
1111

12+
### `pdf`
13+
14+
- ([#13588](https://github.com/quarto-dev/quarto-cli/issues/13588)): Fix Lua error when rendering PDF with `reference-location: margin` and a footnote alongside a figure with `fig-cap`. (author: @mcanouil)
15+
1216
### `typst`
1317

1418
- ([#14261](https://github.com/quarto-dev/quarto-cli/issues/14261)): Fix theorem/example block titles containing inline code producing invalid Typst markup when syntax highlighting is applied.

src/resources/filters/quarto-post/latex.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ function render_latex()
478478
Note = function(n)
479479
if marginReferences() then
480480
-- This is to support multiple paragraphs in footnotes in margin as sidenotes CTAN has some issue (quarto-dev/quarto-cli#7534)
481-
n.content = pandoc.Para(pandoc.utils.blocks_to_inlines(n.content, {pandoc.RawInline('latex', '\n\\endgraf\n')}))
481+
n.content = pandoc.Blocks({pandoc.Para(pandoc.utils.blocks_to_inlines(n.content, {pandoc.RawInline('latex', '\n\\endgraf\n')}))})
482482
return n
483483
end
484484
end
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: footnote and fig-cap with reference-location margin in PDF (#13588)
3+
format: pdf
4+
reference-location: margin
5+
_quarto:
6+
tests:
7+
pdf: null
8+
latex:
9+
ensureFileRegexMatches:
10+
- ['This is a footnote']
11+
- []
12+
---
13+
14+
A footnote[^1] and a figure.
15+
16+
[^1]: This is a footnote.
17+
18+
```{r}
19+
#| fig-cap: Some figure
20+
21+
plot(1:10, 1:10)
22+
```

0 commit comments

Comments
 (0)