Skip to content

Commit e445b3c

Browse files
authored
Merge pull request #13675 from quarto-dev/fix/latex-replacement
2 parents c493c07 + ff38b00 commit e445b3c

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

news/changelog-1.9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ All changes included in 1.9:
4242

4343
- ([#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.
4444
- ([rstudio/tinytex-releases#49](https://github.com/rstudio/tinytex-releases/issues/49)): Fix detection of LuaTeX-ja missing file errors by matching both "File" and "file" in error messages.
45+
- ([#13667](https://github.com/quarto-dev/quarto-cli/issues/13667)): Fix LaTeX compilation error with Python error output containing caret characters.
4546

4647
## Projects
4748

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ function render_latex_fixups()
602602

603603
-- obtained by a local call to uuid and removing dashes
604604
local uuid = "edbdf4a3bc424f5b8ac0e95c92ef5015"
605-
return line:gsub("[\\]", uuid):gsub("([{}$%&%_])", "\\%1"):gsub("[%^]", "\\textasciicaret{}"):gsub("[~]", "\\textasciitilde{}"):gsub(uuid, "\\textbackslash{}")
605+
return line:gsub("[\\]", uuid):gsub("([{}$%&%_])", "\\%1"):gsub("[%^]", "\\textasciicircum{}"):gsub("[~]", "\\textasciitilde{}"):gsub(uuid, "\\textbackslash{}")
606606
end
607607
if code.text:match("\027%[[0-9;]+m") and #code.classes == 0 then
608608
local lines = split(code.text, "\n")
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: "Python syntax error with caret (#13667)"
3+
format: pdf
4+
keep-tex: true
5+
_quarto:
6+
tests:
7+
pdf:
8+
ensureLatexFileRegexMatches:
9+
- ['\\textasciicircum\{\}']
10+
- ['\\textasciicaret\{\}']
11+
---
12+
13+
::: {.cell execution_count=1}
14+
``` {.python .cell-code}
15+
def my_func(a=10, b):
16+
print(a)
17+
print(b)
18+
19+
my_func(5)
20+
```
21+
22+
::: {.cell-output .cell-output-error}
23+
```
24+
SyntaxError: parameter without a default follows parameter with a default (1331601683.py, line 1)
25+
Cell In[2], line 1
26+
 def my_func(a=10, b):
27+
^
28+
SyntaxError: parameter without a default follows parameter with a default
29+
```
30+
:::
31+
:::
32+
33+

0 commit comments

Comments
 (0)