Skip to content

Conversation

@cderv
Copy link
Collaborator

@cderv cderv commented Nov 12, 2025

When rendering Python code cells with syntax errors to PDF, LaTeX compilation would fail with:

Undefined control sequence.
<argument>                       \textasciicaret
                                      {}
l.231 ...2}{                      \textasciicaret{}}

Root Cause

The ANSI escape code handling in src/resources/filters/quarto-post/latex.lua used an incorrect LaTeX command \textasciicaret{} when escaping caret characters (^). This command does not exist in LaTeX.

The correct command from the textcomp package is \textasciicircum{} (already loaded in Quarto templates).

Fix

Changed line 605 of src/resources/filters/quarto-post/latex.lua to use \textasciicircum{} instead of \textasciicaret{}. Single-character typo fix.

Added comprehensive smoke-all test with Python syntax error output containing caret characters to prevent regression.

Fixes #13667

@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Nov 12, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Licenses 0 0 0 0 0 issues
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv cderv merged commit e445b3c into main Nov 12, 2025
51 checks passed
@cderv cderv deleted the fix/latex-replacement branch November 12, 2025 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python syntax error indicator caret character leads to LaTeX compilation error

3 participants