Skip to content

Commit 319c1f4

Browse files
authored
Fix non-deterministic tcolorbox option ordering in LaTeX output (#14026)
* Fix non-deterministic tcolorbox option ordering in LaTeX output `tColorOptions()` used `pairs()` which iterates Lua table keys in non-deterministic order, causing `.tex` output to differ between renders of the same document. Switch to `spairs()` for sorted iteration so tcolorbox options are always emitted alphabetically. * Add to changelog
1 parent 1b9b5e4 commit 319c1f4

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

news/changelog-1.9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ All changes included in 1.9:
8282
- New `shorthands` variable for Babel language shortcuts control.
8383
- New `pdf-trailer-id` support for reproducible PDF builds.
8484
- New `cancel` package support for `\cancel` command in math.
85+
- ([#14017](https://github.com/quarto-dev/quarto-cli/issues/14017)]): `tColorOptions()` in .tex file will now always have options in alphabetical order. Previously, they were in random order leading to a different .tex intermediates for identical .qmd.
8586

8687
### `revealjs`
8788

src/resources/filters/common/latex.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function tColorOptions(options)
66

77
local optionStr = ""
88
local prepend = false
9-
for k, v in pairs(options) do
9+
for k, v in spairs(options) do
1010
if (prepend) then
1111
optionStr = optionStr .. ', '
1212
end
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: "Issue 14017"
3+
code-block-bg: true
4+
format:
5+
pdf:
6+
keep-tex: true
7+
_quarto:
8+
tests:
9+
pdf:
10+
noErrors: default
11+
ensureLatexFileRegexMatches:
12+
- ['boxrule=0pt, breakable, enhanced, frame hidden, interior hidden, sharp corners']
13+
- []
14+
---
15+
16+
```r
17+
1 + 1
18+
```

0 commit comments

Comments
 (0)