Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: raise an error if \path is used in \pgfextra without \pgfinterruptpath #1328

Closed
user202729 opened this issue May 1, 2024 · 4 comments

Comments

@user202729
Copy link
Contributor

user202729 commented May 1, 2024

As in the title.

Disadvantage is that it will incur an additional check i.e. runtime penalty. Advantage is that it will prevent inadvertent errors in the code which can save user/developer's time.

@muzimuzhi
Copy link
Member

muzimuzhi commented May 2, 2024

Or, in a more general way, execute \tikz@uninstallcommands and \tikz@installcommands at the beginning and ending of \pgfextra code, respectively? In this way, \path and other tikz commands used in \pgfextra code would take their definitions outside of tikzpicture.

% Syntax for pgfextra:
% \pgfextra {normal tex text}
% \pgfextra normal tex text \endpgfextra
\def\tikz@extra{\pgfutil@ifnextchar\bgroup\tikz@@extra\relax}%
\long\def\tikz@@extra#1{#1\tikz@scan@next@command}%
\let\endpgfextra=\tikz@scan@next@command
\def\pgfextra{pgfextra}%

Related to

@muzimuzhi
Copy link
Member

Or, in a more general way, execute \tikz@uninstallcommands and \tikz@installcommands at the beginning and ending of \pgfextra code, respectively?

Hmm, No. The suggested way would disable (at least make it harder) use of

\pgfextra{\pgfinterruptpath \path ...; \endpgfinterruptpath}

@hmenke
Copy link
Member

hmenke commented May 3, 2024

This would break existing documents, therefore unfortunately rejected.

@hmenke hmenke closed this as completed May 3, 2024
@hmenke hmenke closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2024
@user202729
Copy link
Contributor Author

I think a document that issues \path without \pgfinterruptpath is buggy and should be fixed anyway.

Adding Tikz node in pgfextra triggers double drawing of containing path - TeX - LaTeX Stack Exchange (not exactly the same issue but related)

That said, we can just make it a warning. I see no harm (cf. pgfplots run in stable mode by default, but upgrading pgfplots may make the document issue an extra warning)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants