Expanding macro to define tikzset
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I need to store tikz
option in a csdef
:
csdefMy Node Optiondraw=red, thick, fill=yellow
How do I use this definition to define a style via tikzset
?
I attempted to use .expand once
as per How do I define tikz styles with a xkeyval command?:
tikzsetNode Options/.style/.expand once=csuseMy Node Option
but that leads to a
Package pgfkeys Error: I do not know the key '/tikz/draw=red, thick, fill=yellow' and I am going to ignore it. Perhaps you misspelled it.
The desired result is to modify only the tikzset
in the MWE and obtain:
Code:
documentclassarticle
usepackagetikz
usepackageetoolbox
begindocument
csdefMy Node Optiondraw=red, thick, fill=yellow
noindent
begintikzpicture
tikzsetNode Options/.style/.expand once=csuseMy Node Option%% ????
node [Node Options] at (0,0) Node Text;
endtikzpicture%
enddocument
tikz-pgf tikz-styles expansion etoolbox
add a comment |Â
up vote
3
down vote
favorite
I need to store tikz
option in a csdef
:
csdefMy Node Optiondraw=red, thick, fill=yellow
How do I use this definition to define a style via tikzset
?
I attempted to use .expand once
as per How do I define tikz styles with a xkeyval command?:
tikzsetNode Options/.style/.expand once=csuseMy Node Option
but that leads to a
Package pgfkeys Error: I do not know the key '/tikz/draw=red, thick, fill=yellow' and I am going to ignore it. Perhaps you misspelled it.
The desired result is to modify only the tikzset
in the MWE and obtain:
Code:
documentclassarticle
usepackagetikz
usepackageetoolbox
begindocument
csdefMy Node Optiondraw=red, thick, fill=yellow
noindent
begintikzpicture
tikzsetNode Options/.style/.expand once=csuseMy Node Option%% ????
node [Node Options] at (0,0) Node Text;
endtikzpicture%
enddocument
tikz-pgf tikz-styles expansion etoolbox
You'd need/.expand thrice
, which doesn't exist. But/.expand twice=csname My Node Optionendcsname
works. I know that spaces in names of commands and options is bad.;-)
â egreg
5 mins ago
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I need to store tikz
option in a csdef
:
csdefMy Node Optiondraw=red, thick, fill=yellow
How do I use this definition to define a style via tikzset
?
I attempted to use .expand once
as per How do I define tikz styles with a xkeyval command?:
tikzsetNode Options/.style/.expand once=csuseMy Node Option
but that leads to a
Package pgfkeys Error: I do not know the key '/tikz/draw=red, thick, fill=yellow' and I am going to ignore it. Perhaps you misspelled it.
The desired result is to modify only the tikzset
in the MWE and obtain:
Code:
documentclassarticle
usepackagetikz
usepackageetoolbox
begindocument
csdefMy Node Optiondraw=red, thick, fill=yellow
noindent
begintikzpicture
tikzsetNode Options/.style/.expand once=csuseMy Node Option%% ????
node [Node Options] at (0,0) Node Text;
endtikzpicture%
enddocument
tikz-pgf tikz-styles expansion etoolbox
I need to store tikz
option in a csdef
:
csdefMy Node Optiondraw=red, thick, fill=yellow
How do I use this definition to define a style via tikzset
?
I attempted to use .expand once
as per How do I define tikz styles with a xkeyval command?:
tikzsetNode Options/.style/.expand once=csuseMy Node Option
but that leads to a
Package pgfkeys Error: I do not know the key '/tikz/draw=red, thick, fill=yellow' and I am going to ignore it. Perhaps you misspelled it.
The desired result is to modify only the tikzset
in the MWE and obtain:
Code:
documentclassarticle
usepackagetikz
usepackageetoolbox
begindocument
csdefMy Node Optiondraw=red, thick, fill=yellow
noindent
begintikzpicture
tikzsetNode Options/.style/.expand once=csuseMy Node Option%% ????
node [Node Options] at (0,0) Node Text;
endtikzpicture%
enddocument
tikz-pgf tikz-styles expansion etoolbox
tikz-pgf tikz-styles expansion etoolbox
asked 1 hour ago
Peter Grill
161k24430736
161k24430736
You'd need/.expand thrice
, which doesn't exist. But/.expand twice=csname My Node Optionendcsname
works. I know that spaces in names of commands and options is bad.;-)
â egreg
5 mins ago
add a comment |Â
You'd need/.expand thrice
, which doesn't exist. But/.expand twice=csname My Node Optionendcsname
works. I know that spaces in names of commands and options is bad.;-)
â egreg
5 mins ago
You'd need
/.expand thrice
, which doesn't exist. But /.expand twice=csname My Node Optionendcsname
works. I know that spaces in names of commands and options is bad. ;-)
â egreg
5 mins ago
You'd need
/.expand thrice
, which doesn't exist. But /.expand twice=csname My Node Optionendcsname
works. I know that spaces in names of commands and options is bad. ;-)
â egreg
5 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
You can use expanded
instead of expand once
in your MWE:
tikzsetNode Options/.style/.expanded=csuseMy Node Option%% ????
+1 It's better to give a complete minimal working example as an answer to show that your solution works, but I agree that this does work and hence that this is probably the preferred tikz solution.
â Andrew
34 mins ago
add a comment |Â
up vote
2
down vote
You can use the begingroupedefxendgroup <stuff to expand>x
expansion trick:
documentclassarticle
usepackagetikz
usepackageetoolbox
begindocument
csdefMy Node Optiondraw=red, thick, fill=yellow
noindent
begintikzpicture
begingroupedefxendgroup
noexpandtikzsetNode Options/.style=csuseMy Node Option%
x
node [Node Options] at (0,0) Node Text;
endtikzpicture%
enddocument
Note the additional braces around the csuse
.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
You can use expanded
instead of expand once
in your MWE:
tikzsetNode Options/.style/.expanded=csuseMy Node Option%% ????
+1 It's better to give a complete minimal working example as an answer to show that your solution works, but I agree that this does work and hence that this is probably the preferred tikz solution.
â Andrew
34 mins ago
add a comment |Â
up vote
4
down vote
accepted
You can use expanded
instead of expand once
in your MWE:
tikzsetNode Options/.style/.expanded=csuseMy Node Option%% ????
+1 It's better to give a complete minimal working example as an answer to show that your solution works, but I agree that this does work and hence that this is probably the preferred tikz solution.
â Andrew
34 mins ago
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
You can use expanded
instead of expand once
in your MWE:
tikzsetNode Options/.style/.expanded=csuseMy Node Option%% ????
You can use expanded
instead of expand once
in your MWE:
tikzsetNode Options/.style/.expanded=csuseMy Node Option%% ????
answered 41 mins ago
corporal
59125
59125
+1 It's better to give a complete minimal working example as an answer to show that your solution works, but I agree that this does work and hence that this is probably the preferred tikz solution.
â Andrew
34 mins ago
add a comment |Â
+1 It's better to give a complete minimal working example as an answer to show that your solution works, but I agree that this does work and hence that this is probably the preferred tikz solution.
â Andrew
34 mins ago
+1 It's better to give a complete minimal working example as an answer to show that your solution works, but I agree that this does work and hence that this is probably the preferred tikz solution.
â Andrew
34 mins ago
+1 It's better to give a complete minimal working example as an answer to show that your solution works, but I agree that this does work and hence that this is probably the preferred tikz solution.
â Andrew
34 mins ago
add a comment |Â
up vote
2
down vote
You can use the begingroupedefxendgroup <stuff to expand>x
expansion trick:
documentclassarticle
usepackagetikz
usepackageetoolbox
begindocument
csdefMy Node Optiondraw=red, thick, fill=yellow
noindent
begintikzpicture
begingroupedefxendgroup
noexpandtikzsetNode Options/.style=csuseMy Node Option%
x
node [Node Options] at (0,0) Node Text;
endtikzpicture%
enddocument
Note the additional braces around the csuse
.
add a comment |Â
up vote
2
down vote
You can use the begingroupedefxendgroup <stuff to expand>x
expansion trick:
documentclassarticle
usepackagetikz
usepackageetoolbox
begindocument
csdefMy Node Optiondraw=red, thick, fill=yellow
noindent
begintikzpicture
begingroupedefxendgroup
noexpandtikzsetNode Options/.style=csuseMy Node Option%
x
node [Node Options] at (0,0) Node Text;
endtikzpicture%
enddocument
Note the additional braces around the csuse
.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
You can use the begingroupedefxendgroup <stuff to expand>x
expansion trick:
documentclassarticle
usepackagetikz
usepackageetoolbox
begindocument
csdefMy Node Optiondraw=red, thick, fill=yellow
noindent
begintikzpicture
begingroupedefxendgroup
noexpandtikzsetNode Options/.style=csuseMy Node Option%
x
node [Node Options] at (0,0) Node Text;
endtikzpicture%
enddocument
Note the additional braces around the csuse
.
You can use the begingroupedefxendgroup <stuff to expand>x
expansion trick:
documentclassarticle
usepackagetikz
usepackageetoolbox
begindocument
csdefMy Node Optiondraw=red, thick, fill=yellow
noindent
begintikzpicture
begingroupedefxendgroup
noexpandtikzsetNode Options/.style=csuseMy Node Option%
x
node [Node Options] at (0,0) Node Text;
endtikzpicture%
enddocument
Note the additional braces around the csuse
.
answered 43 mins ago
Werner
427k589361609
427k589361609
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f457429%2fexpanding-macro-to-define-tikzset%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
You'd need
/.expand thrice
, which doesn't exist. But/.expand twice=csname My Node Optionendcsname
works. I know that spaces in names of commands and options is bad.;-)
â egreg
5 mins ago