Skip to content

Commit 490da4d

Browse files
authored
Merge pull request #13658 from MBe-iUS/main
Fix: Vertical alignment div has no effect for pdf output
2 parents 7b43fe2 + d84d5ce commit 490da4d

9 files changed

Lines changed: 99 additions & 288 deletions

File tree

news/changelog-1.9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ All changes included in 1.9:
9090
### `pdf`
9191

9292
- ([#4426](https://github.com/quarto-dev/quarto-cli/issues/4426)): Add `pdf-standard` option for PDF/A, PDF/UA, and PDF version control. Supports standards like `a-2b`, `ua-1`, and versions `1.7`, `2.0`. Works with both LaTeX and Typst formats.
93+
- ([#9091](https://github.com/quarto-dev/quarto-cli/issues/9091)): Fix vertical alignment div has no effect for pdf output
9394
- ([#10291](https://github.com/quarto-dev/quarto-cli/issues/10291)): Fix detection of babel hyphenation warnings with straight-quote format instead of backtick-quote format.
9495
- ([#13248](https://github.com/quarto-dev/quarto-cli/issues/13248)): Fix image alt text not being passed to LaTeX `\includegraphics[alt={...}]` for PDF accessibility. Markdown image captions and `fig-alt` attributes are now preserved for PDF/UA compliance.
9596
- ([#13661](https://github.com/quarto-dev/quarto-cli/issues/13661)): Fix LaTeX compilation errors when using `mermaid-format: svg` with PDF/LaTeX output. SVG diagrams are now written directly without HTML script tags. Note: `mermaid-format: png` is recommended for best compatibility. SVG format requires `rsvg-convert` (or Inkscape with `use-rsvg-convert: false`) in PATH for conversion to PDF, and may experience text clipping in diagrams with multi-line labels.

src/resources/filters/layout/latex.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,14 @@ function latexPanel(layout)
6767
end
6868
local caption = create_latex_caption(layout)
6969

70-
-- read vertical alignment and strip attribute
71-
local vAlign = validatedVAlign(layout.attributes[kLayoutVAlign])
72-
layout.attributes[kLayoutVAlign] = nil
70+
-- convert valign_class to latex notation, read vertical alignment and strip attribute
71+
local vAlign = "top"
72+
if layout.valign_class ~= nil then
73+
local vAlignClass = layout.valign_class
74+
vAlign = vAlignClass:gsub("quarto%-layout%-valign%-","")
75+
end
76+
77+
vAlign = validatedVAlign(vAlign)
7378

7479
for i, row in ipairs(layout.rows.content) do
7580

tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ We run several type of tests
66

77
- Unit tests, located in `unit/` folder
88
- Integration tests, located in `integration/` folder
9-
- smoke tests localed in `smoke` folder
9+
- smoke tests located in `smoke` folder
1010

1111
Tests are run in our CI workflow on GHA at each commit, and for each PR.
1212

tests/docs/smoke-all/2023/11/02/7262.qmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ _quarto:
1010
# Verify outer figure environment wraps the layout
1111
- '\\begin\{figure\}[\s\S]*\\begin\{minipage\}'
1212
# Verify two minipages with equal width
13-
- '\\begin\{minipage\}\{0\.50\\linewidth\}'
13+
- '\\begin\{minipage\}\[b\]\{0\.50\\linewidth\}'
1414
# Verify figure[H] inside first minipage with caption and label
15-
- '\\begin\{minipage\}[\s\S]*\\begin\{figure\}\[H\][\s\S]*\\caption\{\\label\{fig-example\}Figure caption\}'
15+
- '\\begin\{minipage\}\[b\][\s\S]*\\begin\{figure\}\[H\][\s\S]*\\caption\{\\label\{fig-example\}Figure caption\}'
1616
# Verify longtable (NOT wrapped in table environment) inside second minipage
17-
- '\\begin\{minipage\}\{0\.50\\linewidth\}[\s\S]*\\begin\{longtable\}'
17+
- '\\begin\{minipage\}\[b\]\{0\.50\\linewidth\}[\s\S]*\\begin\{longtable\}'
1818
# Verify table caption with label
1919
- '\\caption\{\\label\{tbl-example\}Table caption\}'
2020
# Verify minipage ends before outer figure ends

tests/docs/smoke-all/2024/01/19/8354.qmd

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
---
22
title: "Untitled"
3-
format: latex
3+
format:
4+
pdf:
5+
keep-tex: true
46
execute:
57
warning: false
68
_quarto:
79
tests:
8-
latex:
9-
ensureSnapshotMatches: true
10+
pdf:
11+
ensureLatexFileRegexMatches:
12+
- ['\\begin\{minipage\}\[t\]\{0\.50\\linewidth\}']
13+
- []
1014
---
1115

1216
```{r}

tests/docs/smoke-all/2024/01/19/8354.tex.snapshot

Lines changed: 0 additions & 278 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: "Untitled"
3+
format:
4+
pdf:
5+
keep-tex: true
6+
execute:
7+
warning: false
8+
_quarto:
9+
tests:
10+
pdf:
11+
ensureLatexFileRegexMatches:
12+
- ['\\begin\{minipage\}\[c\]\{0\.50\\linewidth\}']
13+
- []
14+
---
15+
16+
```{r}
17+
#| label: tbl-tables
18+
#| tbl-cap: "Tables"
19+
#| tbl-subcap:
20+
#| - cars
21+
#| - pressure
22+
#| layout-ncol: 2
23+
#| layout-valign: center
24+
25+
library(knitr)
26+
kable(head(cars))
27+
kable(head(pressure))
28+
```
29+
30+
See @tbl-tables for examples. In particular, @tbl-tables-2.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
format:
3+
pdf:
4+
keep-tex: true
5+
_quarto:
6+
tests:
7+
pdf:
8+
ensureLatexFileRegexMatches:
9+
- ['\\begin\{minipage\}\[t\]']
10+
- []
11+
---
12+
13+
::: {layout="[40, -2, 40]" layout-valign="top"}
14+
15+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
16+
17+
Lorem ipsum dolor sit amet, consectetur adipiscing elit
18+
19+
:::

0 commit comments

Comments
 (0)