How to use ExplSyntaxOn and ExplSyntaxOff inside tikzset?What do ExplSyntaxOn and ExplSyntaxOff do?How to define the default vertical distance between nodes?Numerical conditional within tikz keys?TikZ: Drawing an arc from an intersection to an intersectionHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?Drawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themProblems with nested TikZpicturesCan ExplSyntaxOn and ExplSyntaxOff be nested?csvsimple's csvreader error inside ExplSyntaxOn ExplSyntaxOff

Does a windmilling propeller create more drag than a stopped propeller in an engine out scenario

Cycling to work - 30mile return

Can an airline pilot be prosecuted for killing an unruly passenger who could not be physically restrained?

Can more than one instance of Bend Luck be applied to the same roll by multiple Wild Magic sorcerers?

Why is the S-duct intake on the Tu-154 uniquely oblong?

Why use a retrograde orbit?

How do you cope with rejection?

How can sister protect herself from impulse purchases with a credit card?

Have the writers and actors of GOT responded to its poor reception?

How does this piece of code determine array size without using sizeof( )?

Is it standard to have the first week's pay indefinitely withheld?

What would be the game balance implications for using the Gygax method for applying falling damage?

FIFO data structure in pure C

Divisor Rich and Poor Numbers

Is it possible to determine from only a photo of a cityscape whether it was taken close with wide angle or from a distance with zoom?

Are there any crystals that are theoretically possible, but haven't yet been made?

Does the usage of mathematical symbols work differently in books than in theses?

Why didn't Daenerys' advisers suggest assassinating Cersei?

Prints each letter of a string in different colors

Why does the U.S military use mercenaries?

Failing students when it might cause them economic ruin

Managing heat dissipation in a magic wand

Gambler's Fallacy Dice

Is my homebrew Awakened Bear race balanced?



How to use ExplSyntaxOn and ExplSyntaxOff inside tikzset?


What do ExplSyntaxOn and ExplSyntaxOff do?How to define the default vertical distance between nodes?Numerical conditional within tikz keys?TikZ: Drawing an arc from an intersection to an intersectionHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?Drawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themProblems with nested TikZpicturesCan ExplSyntaxOn and ExplSyntaxOff be nested?csvsimple's csvreader error inside ExplSyntaxOn ExplSyntaxOff













2















If you place ExplSyntax on/off inside tikzset, code (that is expected to work) within ExplSyntax would generate errors. But if you bring ExplSyntax outside of tikzset (enclosing the tikzset), it makes tikzset behave unexpectedly. How can I use ExplSyntax inside tikzset? Or do I need to (disappointingly, yet again) search for work arounds?



Block within ExplSyntax generates an error inside tikzset:



documentclass[varwidth]standalone

usepackageexpl3
usepackagetikz

ExplSyntaxOn
int_new:NmyCounter
int_set:NnmyCounter0
ExplSyntaxOff

tikzset
every node/.style=
/utils/exec=
ExplSyntaxOn
% following line generate an error
% int_incr:NmyCounter
ExplSyntaxOff




begindocument

begintikzpicture
path nodesome text;
endtikzpicture

enddocument



Although block within ExplSyntax does not generate an error, it does not increment myCounter, causes labels and positioning commands (who knows what else) within tikzset to generate errors, and prevents a standard counter (myStandardCounter) from being incremented:



documentclass[varwidth]standalone

usepackageexpl3
usepackagetikz

newcountermyStandardCounter

% let's bring ExplSyntax outside of tikzset and try again
ExplSyntaxOn
int_new:NmyCounter
int_set:NnmyCounter0
tikzset
every node/.style=
/utils/exec=
% neither of the counters below are incremented
int_incr:NmyCounter
stepcountermyStandardCounter



ExplSyntaxOff

begindocument

begintikzpicture
path nodesome text;
endtikzpicture

% both counters are at their initial values (zero)

ExplSyntaxOn
expl3~counter:~int_use:NmyCounter
ExplSyntaxOff

standard counter: thevaluemyStandardCounter

enddocument









share|improve this question






















  • It won't work inside. You have to set the catcodes (i.e., ExplSyntaxOn) before the command (tikzset) reads its argument.

    – Phelype Oleinik
    6 hours ago
















2















If you place ExplSyntax on/off inside tikzset, code (that is expected to work) within ExplSyntax would generate errors. But if you bring ExplSyntax outside of tikzset (enclosing the tikzset), it makes tikzset behave unexpectedly. How can I use ExplSyntax inside tikzset? Or do I need to (disappointingly, yet again) search for work arounds?



Block within ExplSyntax generates an error inside tikzset:



documentclass[varwidth]standalone

usepackageexpl3
usepackagetikz

ExplSyntaxOn
int_new:NmyCounter
int_set:NnmyCounter0
ExplSyntaxOff

tikzset
every node/.style=
/utils/exec=
ExplSyntaxOn
% following line generate an error
% int_incr:NmyCounter
ExplSyntaxOff




begindocument

begintikzpicture
path nodesome text;
endtikzpicture

enddocument



Although block within ExplSyntax does not generate an error, it does not increment myCounter, causes labels and positioning commands (who knows what else) within tikzset to generate errors, and prevents a standard counter (myStandardCounter) from being incremented:



documentclass[varwidth]standalone

usepackageexpl3
usepackagetikz

newcountermyStandardCounter

% let's bring ExplSyntax outside of tikzset and try again
ExplSyntaxOn
int_new:NmyCounter
int_set:NnmyCounter0
tikzset
every node/.style=
/utils/exec=
% neither of the counters below are incremented
int_incr:NmyCounter
stepcountermyStandardCounter



ExplSyntaxOff

begindocument

begintikzpicture
path nodesome text;
endtikzpicture

% both counters are at their initial values (zero)

ExplSyntaxOn
expl3~counter:~int_use:NmyCounter
ExplSyntaxOff

standard counter: thevaluemyStandardCounter

enddocument









share|improve this question






















  • It won't work inside. You have to set the catcodes (i.e., ExplSyntaxOn) before the command (tikzset) reads its argument.

    – Phelype Oleinik
    6 hours ago














2












2








2








If you place ExplSyntax on/off inside tikzset, code (that is expected to work) within ExplSyntax would generate errors. But if you bring ExplSyntax outside of tikzset (enclosing the tikzset), it makes tikzset behave unexpectedly. How can I use ExplSyntax inside tikzset? Or do I need to (disappointingly, yet again) search for work arounds?



Block within ExplSyntax generates an error inside tikzset:



documentclass[varwidth]standalone

usepackageexpl3
usepackagetikz

ExplSyntaxOn
int_new:NmyCounter
int_set:NnmyCounter0
ExplSyntaxOff

tikzset
every node/.style=
/utils/exec=
ExplSyntaxOn
% following line generate an error
% int_incr:NmyCounter
ExplSyntaxOff




begindocument

begintikzpicture
path nodesome text;
endtikzpicture

enddocument



Although block within ExplSyntax does not generate an error, it does not increment myCounter, causes labels and positioning commands (who knows what else) within tikzset to generate errors, and prevents a standard counter (myStandardCounter) from being incremented:



documentclass[varwidth]standalone

usepackageexpl3
usepackagetikz

newcountermyStandardCounter

% let's bring ExplSyntax outside of tikzset and try again
ExplSyntaxOn
int_new:NmyCounter
int_set:NnmyCounter0
tikzset
every node/.style=
/utils/exec=
% neither of the counters below are incremented
int_incr:NmyCounter
stepcountermyStandardCounter



ExplSyntaxOff

begindocument

begintikzpicture
path nodesome text;
endtikzpicture

% both counters are at their initial values (zero)

ExplSyntaxOn
expl3~counter:~int_use:NmyCounter
ExplSyntaxOff

standard counter: thevaluemyStandardCounter

enddocument









share|improve this question














If you place ExplSyntax on/off inside tikzset, code (that is expected to work) within ExplSyntax would generate errors. But if you bring ExplSyntax outside of tikzset (enclosing the tikzset), it makes tikzset behave unexpectedly. How can I use ExplSyntax inside tikzset? Or do I need to (disappointingly, yet again) search for work arounds?



Block within ExplSyntax generates an error inside tikzset:



documentclass[varwidth]standalone

usepackageexpl3
usepackagetikz

ExplSyntaxOn
int_new:NmyCounter
int_set:NnmyCounter0
ExplSyntaxOff

tikzset
every node/.style=
/utils/exec=
ExplSyntaxOn
% following line generate an error
% int_incr:NmyCounter
ExplSyntaxOff




begindocument

begintikzpicture
path nodesome text;
endtikzpicture

enddocument



Although block within ExplSyntax does not generate an error, it does not increment myCounter, causes labels and positioning commands (who knows what else) within tikzset to generate errors, and prevents a standard counter (myStandardCounter) from being incremented:



documentclass[varwidth]standalone

usepackageexpl3
usepackagetikz

newcountermyStandardCounter

% let's bring ExplSyntax outside of tikzset and try again
ExplSyntaxOn
int_new:NmyCounter
int_set:NnmyCounter0
tikzset
every node/.style=
/utils/exec=
% neither of the counters below are incremented
int_incr:NmyCounter
stepcountermyStandardCounter



ExplSyntaxOff

begindocument

begintikzpicture
path nodesome text;
endtikzpicture

% both counters are at their initial values (zero)

ExplSyntaxOn
expl3~counter:~int_use:NmyCounter
ExplSyntaxOff

standard counter: thevaluemyStandardCounter

enddocument






tikz-pgf tikz-styles expl3 latex3






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 6 hours ago









bp2017bp2017

954116




954116












  • It won't work inside. You have to set the catcodes (i.e., ExplSyntaxOn) before the command (tikzset) reads its argument.

    – Phelype Oleinik
    6 hours ago


















  • It won't work inside. You have to set the catcodes (i.e., ExplSyntaxOn) before the command (tikzset) reads its argument.

    – Phelype Oleinik
    6 hours ago

















It won't work inside. You have to set the catcodes (i.e., ExplSyntaxOn) before the command (tikzset) reads its argument.

– Phelype Oleinik
6 hours ago






It won't work inside. You have to set the catcodes (i.e., ExplSyntaxOn) before the command (tikzset) reads its argument.

– Phelype Oleinik
6 hours ago











1 Answer
1






active

oldest

votes


















5














First, catcode changes (ExplSyntaxOn/makeatletter, ExplSyntaxOff/makeatother, and the like) will not work inside macro arguments. TeX turns a input character into a so-called token when it first sees that character. When you do:



tikzset

/utils/exec=

ExplSyntaxOn
int_incr:N myCounter
ExplSyntaxOff




The tikzset macro grabs everything between and as argument and, at this point, TeX “sees” those characters, which are turned into tokens using the current catcode regime (with ExplSyntaxOff), so int_incr:N myCounter is tokenized as int _ i n c r : N myCounter, and this tokenization is “frozen”, which means you can't change it.



After that the /utils/exec key does its thing and ExplSyntaxOn is executed, but at this point it's too late, so it won't work.




Second, using your last code with ExplSyntaxOn outside. Remember that in the expl3 syntax spaces are ignored, so the every node/.style key is actually everynode/.style. And in TikZ spaces do matter. You need every~node/.style.



And last, you execute the node code inside a tikzpicture environment, and this creates a bunch of grouping levels, so any local assignment is lost when the endtikzpicture is reached. You need to use int_gincr:N to make it work (LaTeX's stepcounter uses global assignments).



Output:




enter image description here




Working code:



documentclass[varwidth]standalone

usepackageexpl3
usepackagetikz

newcountermyStandardCounter

% let's bring ExplSyntax outside of tikzset and try again
ExplSyntaxOn
int_new:N myCounter
int_gset:Nn myCounter 0
tikzset
every~node/.style=
/utils/exec=
% neither of the counters below are incremented
int_gincr:N myCounter
stepcountermyStandardCounter



ExplSyntaxOff

begindocument

begintikzpicture
path nodesome text;
endtikzpicture

% both counters are at their initial values (zero)

ExplSyntaxOn
expl3~counter:~int_use:NmyCounter
ExplSyntaxOff

standard counter: thevaluemyStandardCounter

enddocument





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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    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%2f491233%2fhow-to-use-explsyntaxon-and-explsyntaxoff-inside-tikzset%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    First, catcode changes (ExplSyntaxOn/makeatletter, ExplSyntaxOff/makeatother, and the like) will not work inside macro arguments. TeX turns a input character into a so-called token when it first sees that character. When you do:



    tikzset

    /utils/exec=

    ExplSyntaxOn
    int_incr:N myCounter
    ExplSyntaxOff




    The tikzset macro grabs everything between and as argument and, at this point, TeX “sees” those characters, which are turned into tokens using the current catcode regime (with ExplSyntaxOff), so int_incr:N myCounter is tokenized as int _ i n c r : N myCounter, and this tokenization is “frozen”, which means you can't change it.



    After that the /utils/exec key does its thing and ExplSyntaxOn is executed, but at this point it's too late, so it won't work.




    Second, using your last code with ExplSyntaxOn outside. Remember that in the expl3 syntax spaces are ignored, so the every node/.style key is actually everynode/.style. And in TikZ spaces do matter. You need every~node/.style.



    And last, you execute the node code inside a tikzpicture environment, and this creates a bunch of grouping levels, so any local assignment is lost when the endtikzpicture is reached. You need to use int_gincr:N to make it work (LaTeX's stepcounter uses global assignments).



    Output:




    enter image description here




    Working code:



    documentclass[varwidth]standalone

    usepackageexpl3
    usepackagetikz

    newcountermyStandardCounter

    % let's bring ExplSyntax outside of tikzset and try again
    ExplSyntaxOn
    int_new:N myCounter
    int_gset:Nn myCounter 0
    tikzset
    every~node/.style=
    /utils/exec=
    % neither of the counters below are incremented
    int_gincr:N myCounter
    stepcountermyStandardCounter



    ExplSyntaxOff

    begindocument

    begintikzpicture
    path nodesome text;
    endtikzpicture

    % both counters are at their initial values (zero)

    ExplSyntaxOn
    expl3~counter:~int_use:NmyCounter
    ExplSyntaxOff

    standard counter: thevaluemyStandardCounter

    enddocument





    share|improve this answer



























      5














      First, catcode changes (ExplSyntaxOn/makeatletter, ExplSyntaxOff/makeatother, and the like) will not work inside macro arguments. TeX turns a input character into a so-called token when it first sees that character. When you do:



      tikzset

      /utils/exec=

      ExplSyntaxOn
      int_incr:N myCounter
      ExplSyntaxOff




      The tikzset macro grabs everything between and as argument and, at this point, TeX “sees” those characters, which are turned into tokens using the current catcode regime (with ExplSyntaxOff), so int_incr:N myCounter is tokenized as int _ i n c r : N myCounter, and this tokenization is “frozen”, which means you can't change it.



      After that the /utils/exec key does its thing and ExplSyntaxOn is executed, but at this point it's too late, so it won't work.




      Second, using your last code with ExplSyntaxOn outside. Remember that in the expl3 syntax spaces are ignored, so the every node/.style key is actually everynode/.style. And in TikZ spaces do matter. You need every~node/.style.



      And last, you execute the node code inside a tikzpicture environment, and this creates a bunch of grouping levels, so any local assignment is lost when the endtikzpicture is reached. You need to use int_gincr:N to make it work (LaTeX's stepcounter uses global assignments).



      Output:




      enter image description here




      Working code:



      documentclass[varwidth]standalone

      usepackageexpl3
      usepackagetikz

      newcountermyStandardCounter

      % let's bring ExplSyntax outside of tikzset and try again
      ExplSyntaxOn
      int_new:N myCounter
      int_gset:Nn myCounter 0
      tikzset
      every~node/.style=
      /utils/exec=
      % neither of the counters below are incremented
      int_gincr:N myCounter
      stepcountermyStandardCounter



      ExplSyntaxOff

      begindocument

      begintikzpicture
      path nodesome text;
      endtikzpicture

      % both counters are at their initial values (zero)

      ExplSyntaxOn
      expl3~counter:~int_use:NmyCounter
      ExplSyntaxOff

      standard counter: thevaluemyStandardCounter

      enddocument





      share|improve this answer

























        5












        5








        5







        First, catcode changes (ExplSyntaxOn/makeatletter, ExplSyntaxOff/makeatother, and the like) will not work inside macro arguments. TeX turns a input character into a so-called token when it first sees that character. When you do:



        tikzset

        /utils/exec=

        ExplSyntaxOn
        int_incr:N myCounter
        ExplSyntaxOff




        The tikzset macro grabs everything between and as argument and, at this point, TeX “sees” those characters, which are turned into tokens using the current catcode regime (with ExplSyntaxOff), so int_incr:N myCounter is tokenized as int _ i n c r : N myCounter, and this tokenization is “frozen”, which means you can't change it.



        After that the /utils/exec key does its thing and ExplSyntaxOn is executed, but at this point it's too late, so it won't work.




        Second, using your last code with ExplSyntaxOn outside. Remember that in the expl3 syntax spaces are ignored, so the every node/.style key is actually everynode/.style. And in TikZ spaces do matter. You need every~node/.style.



        And last, you execute the node code inside a tikzpicture environment, and this creates a bunch of grouping levels, so any local assignment is lost when the endtikzpicture is reached. You need to use int_gincr:N to make it work (LaTeX's stepcounter uses global assignments).



        Output:




        enter image description here




        Working code:



        documentclass[varwidth]standalone

        usepackageexpl3
        usepackagetikz

        newcountermyStandardCounter

        % let's bring ExplSyntax outside of tikzset and try again
        ExplSyntaxOn
        int_new:N myCounter
        int_gset:Nn myCounter 0
        tikzset
        every~node/.style=
        /utils/exec=
        % neither of the counters below are incremented
        int_gincr:N myCounter
        stepcountermyStandardCounter



        ExplSyntaxOff

        begindocument

        begintikzpicture
        path nodesome text;
        endtikzpicture

        % both counters are at their initial values (zero)

        ExplSyntaxOn
        expl3~counter:~int_use:NmyCounter
        ExplSyntaxOff

        standard counter: thevaluemyStandardCounter

        enddocument





        share|improve this answer













        First, catcode changes (ExplSyntaxOn/makeatletter, ExplSyntaxOff/makeatother, and the like) will not work inside macro arguments. TeX turns a input character into a so-called token when it first sees that character. When you do:



        tikzset

        /utils/exec=

        ExplSyntaxOn
        int_incr:N myCounter
        ExplSyntaxOff




        The tikzset macro grabs everything between and as argument and, at this point, TeX “sees” those characters, which are turned into tokens using the current catcode regime (with ExplSyntaxOff), so int_incr:N myCounter is tokenized as int _ i n c r : N myCounter, and this tokenization is “frozen”, which means you can't change it.



        After that the /utils/exec key does its thing and ExplSyntaxOn is executed, but at this point it's too late, so it won't work.




        Second, using your last code with ExplSyntaxOn outside. Remember that in the expl3 syntax spaces are ignored, so the every node/.style key is actually everynode/.style. And in TikZ spaces do matter. You need every~node/.style.



        And last, you execute the node code inside a tikzpicture environment, and this creates a bunch of grouping levels, so any local assignment is lost when the endtikzpicture is reached. You need to use int_gincr:N to make it work (LaTeX's stepcounter uses global assignments).



        Output:




        enter image description here




        Working code:



        documentclass[varwidth]standalone

        usepackageexpl3
        usepackagetikz

        newcountermyStandardCounter

        % let's bring ExplSyntax outside of tikzset and try again
        ExplSyntaxOn
        int_new:N myCounter
        int_gset:Nn myCounter 0
        tikzset
        every~node/.style=
        /utils/exec=
        % neither of the counters below are incremented
        int_gincr:N myCounter
        stepcountermyStandardCounter



        ExplSyntaxOff

        begindocument

        begintikzpicture
        path nodesome text;
        endtikzpicture

        % both counters are at their initial values (zero)

        ExplSyntaxOn
        expl3~counter:~int_use:NmyCounter
        ExplSyntaxOff

        standard counter: thevaluemyStandardCounter

        enddocument






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 6 hours ago









        Phelype OleinikPhelype Oleinik

        27.6k54793




        27.6k54793



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f491233%2fhow-to-use-explsyntaxon-and-explsyntaxoff-inside-tikzset%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

            199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單