Skip to content

Commit

Permalink
Merge pull request pgf-tikz#1375 from muzimuzhi/gh1082-unknown-decora…
Browse files Browse the repository at this point in the history
…tion

Fix wrong key name in unknown decoration option error

Add \pgfutil@expanded
  • Loading branch information
muzimuzhi authored Dec 5, 2024
2 parents 054f118 + 46af807 commit 1193b3d
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 10 deletions.
1 change: 1 addition & 0 deletions doc/generic/pgf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Resolve missing `gnuplot` plots in manual #1238
- Treat varargs for `min()` and `max()` in `luamath` pgf library pgf-tikz/pgfplots#492 #1359
- Fixed support for the `\tikz` command in the `dvisvgm4ht` driver for TeX4ht
- Wrong key name in unknown decoration option error #1082

### Changed

Expand Down
15 changes: 15 additions & 0 deletions testfiles/gh-1082.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
\documentclass{minimal}
\input{pgf-regression-test}

\usepackage{tikz}
\usetikzlibrary{decorations}

\START

\BEGINTEST{Unknown decoration option}
\tikzset{
decoration={segment length=5pt, red}
}
\ENDTEST

\END
15 changes: 15 additions & 0 deletions testfiles/gh-1082.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
============================================================
TEST 1: Unknown decoration option
============================================================
! Package pgfkeys Error: I do not know the key '/pgf/decoration/red' and I am going to ignore it. Perhaps you misspelled it.
See the pgfkeys package documentation for explanation.
Type H <return> for immediate help.
...
l. ...}
This error message was generated by an \errmessage
command, so I can't give any explicit help.
Pretend that you're Hercule Poirot: Examine all clues,
and deduce the truth by order and method.
============================================================
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@

\tikzset{decorate/.is if=tikz@decoratepath,
/pgf/decoration/name/.store in=\tikz@decoration@name,
/pgf/decoration/.unknown/.code=%
\pgfifdecoration{\pgfkeyscurrentname}{\edef\tikz@decoration@name{\pgfkeyscurrentname}}
{\pgfifmetadecoration{\pgfkeyscurrentname}{\edef\tikz@decoration@name{\pgfkeyscurrentname}}
% Fully expand `\pgfkeyscurrentname' before being used in first-arg of
% `/errors/unknown key'.
{\pgfkeys{/errors/unknown
key/.expanded={/pgf/decoration/\pgfkeyscurrentname}{\pgfutil@unexpanded{#1}}}}},%
/pgf/decoration/.unknown/.code={%
\pgfifdecoration{\pgfkeyscurrentname}
{\edef\tikz@decoration@name{\pgfkeyscurrentname}}
{\pgfifmetadecoration{\pgfkeyscurrentname}
{\edef\tikz@decoration@name{\pgfkeyscurrentname}}
% expand \pgfkeyscurrentname _before_ it's updated by nested \pgfkeys
{\pgfutil@expanded{\noexpand\pgfkeys{/errors/unknown key=
{/pgf/decoration/\pgfkeyscurrentname}{\pgfutil@unexpanded{#1}}}}}}%
},
/pgf/decoration/raise/.code={\def\tikz@dec@shift{\pgftransformyshift{#1}}\tikz@dec@trans},
/pgf/decoration/mirror/.code={%
\csname if#1\endcsname
Expand Down
4 changes: 3 additions & 1 deletion tex/generic/pgf/utilities/pgfutil-context.def
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,11 @@

\def\pgfutil@translate#1{#1} % \translate works very different in ConTeXt

% e-TeX primitives
% e-TeX primitives and beyond

\let\pgfutil@protected\normalprotected
\let\pgfutil@unexpanded\normalunexpanded
% the check for the availability of \expanded primitive is done in pgfkeys
\let\pgfutil@expanded\normalexpanded

\endinput
4 changes: 3 additions & 1 deletion tex/generic/pgf/utilities/pgfutil-latex.def
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,11 @@
\def\pgfutil@translate#1{\translate{#1}}
\fi

% e-TeX primitives
% e-TeX primitives and beyond

\let\pgfutil@protected\protected
\let\pgfutil@unexpanded\unexpanded
% the check for the availability of \expanded primitive is done in pgfkeys
\let\pgfutil@expanded\expanded

\endinput
4 changes: 3 additions & 1 deletion tex/generic/pgf/utilities/pgfutil-plain.def
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,11 @@

\def\pgfutil@translate#1{#1} % is there a translator package for plain?

% e-TeX primitives
% e-TeX primitives and beyond

\let\pgfutil@protected\protected
\let\pgfutil@unexpanded\unexpanded
% the check for the availability of \expanded primitive is done in pgfkeys
\let\pgfutil@expanded\expanded

\endinput

0 comments on commit 1193b3d

Please sign in to comment.