From ab79a725fb737aab99fdf48ea40e7c0de9d276f7 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Thu, 27 Apr 2023 14:28:16 +0800 Subject: [PATCH] fix(decorations): wrong key name in unknown decoration option error Introduced by previous fix #1083. Signed-off-by: Yukai Chou --- doc/generic/pgf/CHANGELOG.md | 1 + testfiles/gh-1082.lvt | 15 +++++++++++++++ testfiles/gh-1082.tlg | 15 +++++++++++++++ .../libraries/tikzlibrarydecorations.code.tex | 16 +++++++++------- 4 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 testfiles/gh-1082.lvt create mode 100644 testfiles/gh-1082.tlg diff --git a/doc/generic/pgf/CHANGELOG.md b/doc/generic/pgf/CHANGELOG.md index 345ecc3c1..5dfdb3341 100644 --- a/doc/generic/pgf/CHANGELOG.md +++ b/doc/generic/pgf/CHANGELOG.md @@ -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 diff --git a/testfiles/gh-1082.lvt b/testfiles/gh-1082.lvt new file mode 100644 index 000000000..6c5944753 --- /dev/null +++ b/testfiles/gh-1082.lvt @@ -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 diff --git a/testfiles/gh-1082.tlg b/testfiles/gh-1082.tlg new file mode 100644 index 000000000..3b40cd851 --- /dev/null +++ b/testfiles/gh-1082.tlg @@ -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 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. +============================================================ diff --git a/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.code.tex b/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.code.tex index bfe8863ef..6714b75d6 100644 --- a/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.code.tex +++ b/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.code.tex @@ -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