-
Notifications
You must be signed in to change notification settings - Fork 26
/
pgfkeys-handler-store-in.tex
47 lines (43 loc) · 1.41 KB
/
pgfkeys-handler-store-in.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% make pgfkeys handler ".store in" compatible with handlers
% .get, .add, .prefix, .append
\RequirePackage{pgfkeys}
\makeatletter
\pgfkeys{
/handlers/.store in/.code={%
\pgfkeysalso{\pgfkeyscurrentpath/.code=\def#1{##1}}%
\pgfkeyssetvalue{\pgfkeyscurrentpath/.@store}{#1}%
},
/handlers/.estore in/.code={%
\pgfkeysalso{\pgfkeyscurrentpath/.code=\edef#1{##1}}%
\pgfkeyssetvalue{\pgfkeyscurrentpath/.@store}{#1}%
}
}
\pgfkeys{
% compatibility with handler ".get"
/handlers/.get/.code={%
\pgfkeysifdefined{\pgfkeyscurrentpath/.@store}
{%
\pgfkeysgetvalue{\pgfkeyscurrentpath/.@store}\pgfkeys@code
\expandafter\let\expandafter#1\pgfkeys@code
}
{\pgfkeysgetvalue{\pgfkeyscurrentpath}{#1}}%
},
% compatibility with handler ".add", ".prefix", and ".append" are affected
/handlers/.add/.code 2 args={%
\pgfkeysifdefined{\pgfkeyscurrentpath/.@store}
{%
\pgfkeysgetvalue{\pgfkeyscurrentpath/.@store}\pgfkeys@code
\expandafter\edef\pgfkeys@code{%
\unexpanded{#1}%
\unexpanded\expandafter\expandafter\expandafter{\pgfkeys@code#2}}%
}
{\pgfkeysaddvalue{\pgfkeyscurrentpath}{#1}{#2}}%
}
}
\pgfkeys{/handlers/.initial/.code=%
\pgfkeyslet{\pgfkeyscurrentpath/.@cmd}\undefined
\pgfkeyslet{\pgfkeyscurrentpath/.@args}\undefined
\pgfkeyslet{\pgfkeyscurrentpath/.@store}\undefined
\pgfkeyssetvalue{\pgfkeyscurrentpath}{#1}%
}
\makeatother