Skip to content

quantikz2 raw interpretation#2783

Open
dginev wants to merge 2 commits intobrucemiller:masterfrom
dginev:patch-current-color
Open

quantikz2 raw interpretation#2783
dginev wants to merge 2 commits intobrucemiller:masterfrom
dginev:patch-current-color

Conversation

@dginev
Copy link
Copy Markdown
Collaborator

@dginev dginev commented Apr 2, 2026

This PR rescues arXiv:2508.15260v1 from a Fatal regression when using raw interpretation.

It ought to be the last PR for this iteration of improving the arXiv conversion regression guards.

Summary

  • fix \hphantom display math leak in text/horizontal mode

  • tcolorbox: pre-define \tcb@use@autoparskip before raw TeX loading, since pgfkeys initialization may not complete and the \AtBeginDocument hook at tcolorbox.sty would call it undefined.

  • color: define \current@color, \default@color, and \reset@color with safe defaults. These DVI color macros were previously left undefined, causing errors in pgf/tikz color processing.

  • latex_constructs: support optional [label] argument in \AtBeginDocument and \AtEndDocument, matching the modern LaTeX hooks system (since 2020/10/01). Without this, the [label] leaked as literal text into the document output.

Minimal test

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{quantikz2}
\definecolor{tintedcolor}{gray}{.80}%

\begin{document}
\begin{quantikz}[background color=tintedcolor]
  \meter[1]{}
\end{quantikz}
Some text with $x=1$.
\end{document}

Disclosure

Diagnostic and patch via Claude Opus 4.6 "heavy effort".

I have manually verified this patch recovers arXiv:2508.15260v1 out of regression status.

PR carried forward from the forked draft at dginev#12

dginev and others added 2 commits April 2, 2026 09:49
- tcolorbox: pre-define \tcb@use@autoparskip before raw TeX loading,
  since pgfkeys initialization may not complete and the
  \AtBeginDocument hook at tcolorbox.sty:1142 would call it undefined.

- color: define \current@color, \default@color, and \reset@color
  with safe defaults. These DVI color macros were previously left
  undefined, causing errors in pgf/tikz color processing.

- latex_constructs: support optional [label] argument in
  \AtBeginDocument and \AtEndDocument, matching the modern LaTeX
  hooks system (since 2020/10/01). Without this, the [label] leaked
  as literal text into the document output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
In text/horizontal mode, wrap \hphantom argument digestion in
restricted_horizontal mode (matching TeX's \hbox behavior) to prevent
display math from leaking through the argument. This fixes cascading
errors with complex TikZ library expansions (e.g. quantikz2).

In math mode, preserve the current mode for correct font metrics.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dginev dginev requested a review from brucemiller as a code owner April 2, 2026 13:56
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.

1 participant