Expanding macro to define tikzset

The name of the pictureThe name of the pictureThe name of the pictureClash 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:



enter image description here



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









share|improve this question





















  • 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














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:



enter image description here



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









share|improve this question





















  • 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












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:



enter image description here



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









share|improve this question













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:



enter image description here



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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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
















  • 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










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%% ????






share|improve this answer




















  • +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


















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.






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "85"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    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






























    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%% ????






    share|improve this answer




















    • +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















    up vote
    4
    down vote



    accepted










    You can use expanded instead of expand once in your MWE:



    tikzsetNode Options/.style/.expanded=csuseMy Node Option%% ????






    share|improve this answer




















    • +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













    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%% ????






    share|improve this answer












    You can use expanded instead of expand once in your MWE:



    tikzsetNode Options/.style/.expanded=csuseMy Node Option%% ????







    share|improve this answer












    share|improve this answer



    share|improve this answer










    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

















    • +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











    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.






    share|improve this answer
























      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.






      share|improve this answer






















        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.






        share|improve this answer












        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 43 mins ago









        Werner

        427k589361609




        427k589361609



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            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













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?