Problem when applying foreach loop Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)How to properly smuggle (with or even without TikZ)?foreach limit computed through an operation between pgfmathsetlengthmacrosRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?Numerical conditional within tikz keys?Why do I get an extra white page before my TikZ picture?TikZ: Drawing an arc from an intersection to an intersectionDrawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themHow to draw a square and its diagonals with arrows?Compound Pathway Problem with holesInclude node at end point tikz decorations

Putting class ranking in CV, but against dept guidelines

As a beginner, should I get a Squier Strat with a SSS config or a HSS?

What initially awakened the Balrog?

Is a ledger board required if the side of my house is wood?

Is it possible for SQL statements to execute concurrently within a single session in SQL Server?

Time to Settle Down!

Can the Great Weapon Master feat's damage bonus and accuracy penalty apply to attacks from the Spiritual Weapon spell?

Why is the AVR GCC compiler using a full `CALL` even though I have set the `-mshort-calls` flag?

Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?

Crossing US/Canada Border for less than 24 hours

AppleTVs create a chatty alternate WiFi network

How often does castling occur in grandmaster games?

What is a fractional matching?

What do you call the main part of a joke?

How do living politicians protect their readily obtainable signatures from misuse?

ArcGIS Pro Python arcpy.CreatePersonalGDB_management

Project Euler #1 in C++

Amount of permutations on an NxNxN Rubik's Cube

Performance gap between vector<bool> and array

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

Most bit efficient text communication method?

What is this clumpy 20-30cm high yellow-flowered plant?

How can I reduce the gap between left and right of cdot with a macro?

Find 108 by using 3,4,6



Problem when applying foreach loop



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)How to properly smuggle (with or even without TikZ)?foreach limit computed through an operation between pgfmathsetlengthmacrosRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?Numerical conditional within tikz keys?Why do I get an extra white page before my TikZ picture?TikZ: Drawing an arc from an intersection to an intersectionDrawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themHow to draw a square and its diagonals with arrows?Compound Pathway Problem with holesInclude node at end point tikz decorations










5















I'm trying to find the minimum x coordinate in a set of TikZ coordinates.



Consider this code



documentclass[tikz]standalone
usetikzlibrarypositioning
newdimenx
newdimenxmin
xmin=10000pt
newdimeny
begindocument
begintikzpicture[every node/.style=draw]
node (1) 182;
node[below=of 1] (2) 183731468;
node[below=of 2] (3) 74632;
path (1.west); pgfgetlastxyxy
ifdimx<xmin xmin=x fi
fill[red] (xmin,y) circle (1pt);
path (2.west); pgfgetlastxyxy
ifdimx<xmin xmin=x fi
fill[red] (xmin,y) circle (1pt);
path (3.west); pgfgetlastxyxy
ifdimx<xmin xmin=x fi
fill[red] (xmin,y) circle (1pt);
endtikzpicture
enddocument


and this code



documentclass[tikz]standalone
usetikzlibrarypositioning
newdimenx
newdimenxmin
xmin=10000pt
newdimeny
begindocument
begintikzpicture[every node/.style=draw]
node (1) 182;
node[below=of 1] (2) 183731468;
node[below=of 2] (3) 74632;
foreach i in 1,2,3
path (i.west); pgfgetlastxyxy
ifdimx<xmin xmin=x fi
fill[red] (xmin,y) circle (1pt);

endtikzpicture
enddocument


These are the outputs of the first code (left) and the second code (right) side by side:



enter image description hereenter image description here



Look at the dot at the bottom. The first code gives the intended output, but the second doesn't.



Why? And how to modify the foreach loop in the second code so that it gives the same output as the first?










share|improve this question


























    5















    I'm trying to find the minimum x coordinate in a set of TikZ coordinates.



    Consider this code



    documentclass[tikz]standalone
    usetikzlibrarypositioning
    newdimenx
    newdimenxmin
    xmin=10000pt
    newdimeny
    begindocument
    begintikzpicture[every node/.style=draw]
    node (1) 182;
    node[below=of 1] (2) 183731468;
    node[below=of 2] (3) 74632;
    path (1.west); pgfgetlastxyxy
    ifdimx<xmin xmin=x fi
    fill[red] (xmin,y) circle (1pt);
    path (2.west); pgfgetlastxyxy
    ifdimx<xmin xmin=x fi
    fill[red] (xmin,y) circle (1pt);
    path (3.west); pgfgetlastxyxy
    ifdimx<xmin xmin=x fi
    fill[red] (xmin,y) circle (1pt);
    endtikzpicture
    enddocument


    and this code



    documentclass[tikz]standalone
    usetikzlibrarypositioning
    newdimenx
    newdimenxmin
    xmin=10000pt
    newdimeny
    begindocument
    begintikzpicture[every node/.style=draw]
    node (1) 182;
    node[below=of 1] (2) 183731468;
    node[below=of 2] (3) 74632;
    foreach i in 1,2,3
    path (i.west); pgfgetlastxyxy
    ifdimx<xmin xmin=x fi
    fill[red] (xmin,y) circle (1pt);

    endtikzpicture
    enddocument


    These are the outputs of the first code (left) and the second code (right) side by side:



    enter image description hereenter image description here



    Look at the dot at the bottom. The first code gives the intended output, but the second doesn't.



    Why? And how to modify the foreach loop in the second code so that it gives the same output as the first?










    share|improve this question
























      5












      5








      5








      I'm trying to find the minimum x coordinate in a set of TikZ coordinates.



      Consider this code



      documentclass[tikz]standalone
      usetikzlibrarypositioning
      newdimenx
      newdimenxmin
      xmin=10000pt
      newdimeny
      begindocument
      begintikzpicture[every node/.style=draw]
      node (1) 182;
      node[below=of 1] (2) 183731468;
      node[below=of 2] (3) 74632;
      path (1.west); pgfgetlastxyxy
      ifdimx<xmin xmin=x fi
      fill[red] (xmin,y) circle (1pt);
      path (2.west); pgfgetlastxyxy
      ifdimx<xmin xmin=x fi
      fill[red] (xmin,y) circle (1pt);
      path (3.west); pgfgetlastxyxy
      ifdimx<xmin xmin=x fi
      fill[red] (xmin,y) circle (1pt);
      endtikzpicture
      enddocument


      and this code



      documentclass[tikz]standalone
      usetikzlibrarypositioning
      newdimenx
      newdimenxmin
      xmin=10000pt
      newdimeny
      begindocument
      begintikzpicture[every node/.style=draw]
      node (1) 182;
      node[below=of 1] (2) 183731468;
      node[below=of 2] (3) 74632;
      foreach i in 1,2,3
      path (i.west); pgfgetlastxyxy
      ifdimx<xmin xmin=x fi
      fill[red] (xmin,y) circle (1pt);

      endtikzpicture
      enddocument


      These are the outputs of the first code (left) and the second code (right) side by side:



      enter image description hereenter image description here



      Look at the dot at the bottom. The first code gives the intended output, but the second doesn't.



      Why? And how to modify the foreach loop in the second code so that it gives the same output as the first?










      share|improve this question














      I'm trying to find the minimum x coordinate in a set of TikZ coordinates.



      Consider this code



      documentclass[tikz]standalone
      usetikzlibrarypositioning
      newdimenx
      newdimenxmin
      xmin=10000pt
      newdimeny
      begindocument
      begintikzpicture[every node/.style=draw]
      node (1) 182;
      node[below=of 1] (2) 183731468;
      node[below=of 2] (3) 74632;
      path (1.west); pgfgetlastxyxy
      ifdimx<xmin xmin=x fi
      fill[red] (xmin,y) circle (1pt);
      path (2.west); pgfgetlastxyxy
      ifdimx<xmin xmin=x fi
      fill[red] (xmin,y) circle (1pt);
      path (3.west); pgfgetlastxyxy
      ifdimx<xmin xmin=x fi
      fill[red] (xmin,y) circle (1pt);
      endtikzpicture
      enddocument


      and this code



      documentclass[tikz]standalone
      usetikzlibrarypositioning
      newdimenx
      newdimenxmin
      xmin=10000pt
      newdimeny
      begindocument
      begintikzpicture[every node/.style=draw]
      node (1) 182;
      node[below=of 1] (2) 183731468;
      node[below=of 2] (3) 74632;
      foreach i in 1,2,3
      path (i.west); pgfgetlastxyxy
      ifdimx<xmin xmin=x fi
      fill[red] (xmin,y) circle (1pt);

      endtikzpicture
      enddocument


      These are the outputs of the first code (left) and the second code (right) side by side:



      enter image description hereenter image description here



      Look at the dot at the bottom. The first code gives the intended output, but the second doesn't.



      Why? And how to modify the foreach loop in the second code so that it gives the same output as the first?







      tikz-pgf loops dimensions






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 14 at 14:46









      JouleVJouleV

      14k22664




      14k22664




















          2 Answers
          2






          active

          oldest

          votes


















          4














          In the foreach variant, you are in a group when setting the dimension, so the "outside" value won't change. So you need to make the dimension global (or smuggle it out of the group). Here I made it global by just adding global before xmin=x.



          documentclass[tikz]standalone
          usetikzlibrarypositioning
          newdimenx
          newdimenxmin
          xmin=10000pt
          newdimeny
          begindocument
          begintikzpicture[every node/.style=draw]
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          foreach i in 1,2,3
          path (i.west); pgfgetlastxyxy
          ifdimx<xmin globalxmin=x fi
          fill[red] (xmin,y) circle (1pt);

          endtikzpicture
          enddocument


          enter image description here



          ADDENDUM: Of course, there are loops which do not introduce groups. The arguably simplest of those is the built-in loop.



          documentclass[tikz]standalone
          usetikzlibrarypositioning
          newdimenx
          newdimenxmin
          xmin=10000pt
          newdimeny
          newcounterloopi
          begindocument
          begintikzpicture[every node/.style=draw]
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          setcounterloopi0
          loop
          stepcounterloopi
          path (numbervalueloopi.west); pgfgetlastxyxy
          ifdimx<xmin xmin=x fi
          fill[red] (xmin,y) circle (1pt);
          ifnumnumbervalueloopi<3repeat
          endtikzpicture
          enddocument





          share|improve this answer

























          • @JouleV You only change the local but not the outside value. (This is also the reason why draw[blue] ... renders only the ... but not every other path blue. Likewise, if you say tikz[blue].... everything in the tikzpicture will be blue, but not outside, and so on.) In TeX all macros are local unless you explicitly make them global.

            – marmot
            Apr 14 at 14:56






          • 1





            You are, as always, the best marmot in the marmot tikzita Very New World marmot type :)) Will accept once allowed.

            – JouleV
            Apr 14 at 14:57


















          3














          You can use a different loop that doesn't do grouping. Instead of i you use simply #1.



          documentclass[border=4]standalone
          usepackagexparse
          usepackagetikz

          usetikzlibrarypositioning

          ExplSyntaxOn
          NewDocumentCommandnforeachmmm

          cs_set:Nn joulev_nforeach:n #3
          int_step_function:nnN #1 #2 joulev_nforeach:n

          ExplSyntaxOff

          newdimenx
          newdimenxmin
          newdimeny

          begindocument
          begintikzpicture[every node/.style=draw]
          xmin=10000pt
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          nforeach13
          path (#1.west); pgfgetlastxyxy
          ifdimx<xmin xmin=x fi
          fill[red] (xmin,y) circle (1pt);

          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer























          • Maybe I will have to start learning expl3 syntax soon. What does those commands inside ExplSyntax mean?

            – JouleV
            Apr 14 at 15:27











          • @JouleV The first line sets a temporary function according to the code in the third argument; the second line does a loop from the starting point (first argument) to the final point (second argument). No fancy syntax like foreach, but for most cases it's sufficient. You find a more elaborate implementation at tex.stackexchange.com/a/329628/4427

            – egreg
            Apr 14 at 15:30












          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%2f484808%2fproblem-when-applying-foreach-loop%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          In the foreach variant, you are in a group when setting the dimension, so the "outside" value won't change. So you need to make the dimension global (or smuggle it out of the group). Here I made it global by just adding global before xmin=x.



          documentclass[tikz]standalone
          usetikzlibrarypositioning
          newdimenx
          newdimenxmin
          xmin=10000pt
          newdimeny
          begindocument
          begintikzpicture[every node/.style=draw]
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          foreach i in 1,2,3
          path (i.west); pgfgetlastxyxy
          ifdimx<xmin globalxmin=x fi
          fill[red] (xmin,y) circle (1pt);

          endtikzpicture
          enddocument


          enter image description here



          ADDENDUM: Of course, there are loops which do not introduce groups. The arguably simplest of those is the built-in loop.



          documentclass[tikz]standalone
          usetikzlibrarypositioning
          newdimenx
          newdimenxmin
          xmin=10000pt
          newdimeny
          newcounterloopi
          begindocument
          begintikzpicture[every node/.style=draw]
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          setcounterloopi0
          loop
          stepcounterloopi
          path (numbervalueloopi.west); pgfgetlastxyxy
          ifdimx<xmin xmin=x fi
          fill[red] (xmin,y) circle (1pt);
          ifnumnumbervalueloopi<3repeat
          endtikzpicture
          enddocument





          share|improve this answer

























          • @JouleV You only change the local but not the outside value. (This is also the reason why draw[blue] ... renders only the ... but not every other path blue. Likewise, if you say tikz[blue].... everything in the tikzpicture will be blue, but not outside, and so on.) In TeX all macros are local unless you explicitly make them global.

            – marmot
            Apr 14 at 14:56






          • 1





            You are, as always, the best marmot in the marmot tikzita Very New World marmot type :)) Will accept once allowed.

            – JouleV
            Apr 14 at 14:57















          4














          In the foreach variant, you are in a group when setting the dimension, so the "outside" value won't change. So you need to make the dimension global (or smuggle it out of the group). Here I made it global by just adding global before xmin=x.



          documentclass[tikz]standalone
          usetikzlibrarypositioning
          newdimenx
          newdimenxmin
          xmin=10000pt
          newdimeny
          begindocument
          begintikzpicture[every node/.style=draw]
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          foreach i in 1,2,3
          path (i.west); pgfgetlastxyxy
          ifdimx<xmin globalxmin=x fi
          fill[red] (xmin,y) circle (1pt);

          endtikzpicture
          enddocument


          enter image description here



          ADDENDUM: Of course, there are loops which do not introduce groups. The arguably simplest of those is the built-in loop.



          documentclass[tikz]standalone
          usetikzlibrarypositioning
          newdimenx
          newdimenxmin
          xmin=10000pt
          newdimeny
          newcounterloopi
          begindocument
          begintikzpicture[every node/.style=draw]
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          setcounterloopi0
          loop
          stepcounterloopi
          path (numbervalueloopi.west); pgfgetlastxyxy
          ifdimx<xmin xmin=x fi
          fill[red] (xmin,y) circle (1pt);
          ifnumnumbervalueloopi<3repeat
          endtikzpicture
          enddocument





          share|improve this answer

























          • @JouleV You only change the local but not the outside value. (This is also the reason why draw[blue] ... renders only the ... but not every other path blue. Likewise, if you say tikz[blue].... everything in the tikzpicture will be blue, but not outside, and so on.) In TeX all macros are local unless you explicitly make them global.

            – marmot
            Apr 14 at 14:56






          • 1





            You are, as always, the best marmot in the marmot tikzita Very New World marmot type :)) Will accept once allowed.

            – JouleV
            Apr 14 at 14:57













          4












          4








          4







          In the foreach variant, you are in a group when setting the dimension, so the "outside" value won't change. So you need to make the dimension global (or smuggle it out of the group). Here I made it global by just adding global before xmin=x.



          documentclass[tikz]standalone
          usetikzlibrarypositioning
          newdimenx
          newdimenxmin
          xmin=10000pt
          newdimeny
          begindocument
          begintikzpicture[every node/.style=draw]
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          foreach i in 1,2,3
          path (i.west); pgfgetlastxyxy
          ifdimx<xmin globalxmin=x fi
          fill[red] (xmin,y) circle (1pt);

          endtikzpicture
          enddocument


          enter image description here



          ADDENDUM: Of course, there are loops which do not introduce groups. The arguably simplest of those is the built-in loop.



          documentclass[tikz]standalone
          usetikzlibrarypositioning
          newdimenx
          newdimenxmin
          xmin=10000pt
          newdimeny
          newcounterloopi
          begindocument
          begintikzpicture[every node/.style=draw]
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          setcounterloopi0
          loop
          stepcounterloopi
          path (numbervalueloopi.west); pgfgetlastxyxy
          ifdimx<xmin xmin=x fi
          fill[red] (xmin,y) circle (1pt);
          ifnumnumbervalueloopi<3repeat
          endtikzpicture
          enddocument





          share|improve this answer















          In the foreach variant, you are in a group when setting the dimension, so the "outside" value won't change. So you need to make the dimension global (or smuggle it out of the group). Here I made it global by just adding global before xmin=x.



          documentclass[tikz]standalone
          usetikzlibrarypositioning
          newdimenx
          newdimenxmin
          xmin=10000pt
          newdimeny
          begindocument
          begintikzpicture[every node/.style=draw]
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          foreach i in 1,2,3
          path (i.west); pgfgetlastxyxy
          ifdimx<xmin globalxmin=x fi
          fill[red] (xmin,y) circle (1pt);

          endtikzpicture
          enddocument


          enter image description here



          ADDENDUM: Of course, there are loops which do not introduce groups. The arguably simplest of those is the built-in loop.



          documentclass[tikz]standalone
          usetikzlibrarypositioning
          newdimenx
          newdimenxmin
          xmin=10000pt
          newdimeny
          newcounterloopi
          begindocument
          begintikzpicture[every node/.style=draw]
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          setcounterloopi0
          loop
          stepcounterloopi
          path (numbervalueloopi.west); pgfgetlastxyxy
          ifdimx<xmin xmin=x fi
          fill[red] (xmin,y) circle (1pt);
          ifnumnumbervalueloopi<3repeat
          endtikzpicture
          enddocument






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 14 at 16:16

























          answered Apr 14 at 14:49









          marmotmarmot

          119k6154289




          119k6154289












          • @JouleV You only change the local but not the outside value. (This is also the reason why draw[blue] ... renders only the ... but not every other path blue. Likewise, if you say tikz[blue].... everything in the tikzpicture will be blue, but not outside, and so on.) In TeX all macros are local unless you explicitly make them global.

            – marmot
            Apr 14 at 14:56






          • 1





            You are, as always, the best marmot in the marmot tikzita Very New World marmot type :)) Will accept once allowed.

            – JouleV
            Apr 14 at 14:57

















          • @JouleV You only change the local but not the outside value. (This is also the reason why draw[blue] ... renders only the ... but not every other path blue. Likewise, if you say tikz[blue].... everything in the tikzpicture will be blue, but not outside, and so on.) In TeX all macros are local unless you explicitly make them global.

            – marmot
            Apr 14 at 14:56






          • 1





            You are, as always, the best marmot in the marmot tikzita Very New World marmot type :)) Will accept once allowed.

            – JouleV
            Apr 14 at 14:57
















          @JouleV You only change the local but not the outside value. (This is also the reason why draw[blue] ... renders only the ... but not every other path blue. Likewise, if you say tikz[blue].... everything in the tikzpicture will be blue, but not outside, and so on.) In TeX all macros are local unless you explicitly make them global.

          – marmot
          Apr 14 at 14:56





          @JouleV You only change the local but not the outside value. (This is also the reason why draw[blue] ... renders only the ... but not every other path blue. Likewise, if you say tikz[blue].... everything in the tikzpicture will be blue, but not outside, and so on.) In TeX all macros are local unless you explicitly make them global.

          – marmot
          Apr 14 at 14:56




          1




          1





          You are, as always, the best marmot in the marmot tikzita Very New World marmot type :)) Will accept once allowed.

          – JouleV
          Apr 14 at 14:57





          You are, as always, the best marmot in the marmot tikzita Very New World marmot type :)) Will accept once allowed.

          – JouleV
          Apr 14 at 14:57











          3














          You can use a different loop that doesn't do grouping. Instead of i you use simply #1.



          documentclass[border=4]standalone
          usepackagexparse
          usepackagetikz

          usetikzlibrarypositioning

          ExplSyntaxOn
          NewDocumentCommandnforeachmmm

          cs_set:Nn joulev_nforeach:n #3
          int_step_function:nnN #1 #2 joulev_nforeach:n

          ExplSyntaxOff

          newdimenx
          newdimenxmin
          newdimeny

          begindocument
          begintikzpicture[every node/.style=draw]
          xmin=10000pt
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          nforeach13
          path (#1.west); pgfgetlastxyxy
          ifdimx<xmin xmin=x fi
          fill[red] (xmin,y) circle (1pt);

          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer























          • Maybe I will have to start learning expl3 syntax soon. What does those commands inside ExplSyntax mean?

            – JouleV
            Apr 14 at 15:27











          • @JouleV The first line sets a temporary function according to the code in the third argument; the second line does a loop from the starting point (first argument) to the final point (second argument). No fancy syntax like foreach, but for most cases it's sufficient. You find a more elaborate implementation at tex.stackexchange.com/a/329628/4427

            – egreg
            Apr 14 at 15:30
















          3














          You can use a different loop that doesn't do grouping. Instead of i you use simply #1.



          documentclass[border=4]standalone
          usepackagexparse
          usepackagetikz

          usetikzlibrarypositioning

          ExplSyntaxOn
          NewDocumentCommandnforeachmmm

          cs_set:Nn joulev_nforeach:n #3
          int_step_function:nnN #1 #2 joulev_nforeach:n

          ExplSyntaxOff

          newdimenx
          newdimenxmin
          newdimeny

          begindocument
          begintikzpicture[every node/.style=draw]
          xmin=10000pt
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          nforeach13
          path (#1.west); pgfgetlastxyxy
          ifdimx<xmin xmin=x fi
          fill[red] (xmin,y) circle (1pt);

          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer























          • Maybe I will have to start learning expl3 syntax soon. What does those commands inside ExplSyntax mean?

            – JouleV
            Apr 14 at 15:27











          • @JouleV The first line sets a temporary function according to the code in the third argument; the second line does a loop from the starting point (first argument) to the final point (second argument). No fancy syntax like foreach, but for most cases it's sufficient. You find a more elaborate implementation at tex.stackexchange.com/a/329628/4427

            – egreg
            Apr 14 at 15:30














          3












          3








          3







          You can use a different loop that doesn't do grouping. Instead of i you use simply #1.



          documentclass[border=4]standalone
          usepackagexparse
          usepackagetikz

          usetikzlibrarypositioning

          ExplSyntaxOn
          NewDocumentCommandnforeachmmm

          cs_set:Nn joulev_nforeach:n #3
          int_step_function:nnN #1 #2 joulev_nforeach:n

          ExplSyntaxOff

          newdimenx
          newdimenxmin
          newdimeny

          begindocument
          begintikzpicture[every node/.style=draw]
          xmin=10000pt
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          nforeach13
          path (#1.west); pgfgetlastxyxy
          ifdimx<xmin xmin=x fi
          fill[red] (xmin,y) circle (1pt);

          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer













          You can use a different loop that doesn't do grouping. Instead of i you use simply #1.



          documentclass[border=4]standalone
          usepackagexparse
          usepackagetikz

          usetikzlibrarypositioning

          ExplSyntaxOn
          NewDocumentCommandnforeachmmm

          cs_set:Nn joulev_nforeach:n #3
          int_step_function:nnN #1 #2 joulev_nforeach:n

          ExplSyntaxOff

          newdimenx
          newdimenxmin
          newdimeny

          begindocument
          begintikzpicture[every node/.style=draw]
          xmin=10000pt
          node (1) 182;
          node[below=of 1] (2) 183731468;
          node[below=of 2] (3) 74632;
          nforeach13
          path (#1.west); pgfgetlastxyxy
          ifdimx<xmin xmin=x fi
          fill[red] (xmin,y) circle (1pt);

          endtikzpicture
          enddocument


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 14 at 15:14









          egregegreg

          735k8919343257




          735k8919343257












          • Maybe I will have to start learning expl3 syntax soon. What does those commands inside ExplSyntax mean?

            – JouleV
            Apr 14 at 15:27











          • @JouleV The first line sets a temporary function according to the code in the third argument; the second line does a loop from the starting point (first argument) to the final point (second argument). No fancy syntax like foreach, but for most cases it's sufficient. You find a more elaborate implementation at tex.stackexchange.com/a/329628/4427

            – egreg
            Apr 14 at 15:30


















          • Maybe I will have to start learning expl3 syntax soon. What does those commands inside ExplSyntax mean?

            – JouleV
            Apr 14 at 15:27











          • @JouleV The first line sets a temporary function according to the code in the third argument; the second line does a loop from the starting point (first argument) to the final point (second argument). No fancy syntax like foreach, but for most cases it's sufficient. You find a more elaborate implementation at tex.stackexchange.com/a/329628/4427

            – egreg
            Apr 14 at 15:30

















          Maybe I will have to start learning expl3 syntax soon. What does those commands inside ExplSyntax mean?

          – JouleV
          Apr 14 at 15:27





          Maybe I will have to start learning expl3 syntax soon. What does those commands inside ExplSyntax mean?

          – JouleV
          Apr 14 at 15:27













          @JouleV The first line sets a temporary function according to the code in the third argument; the second line does a loop from the starting point (first argument) to the final point (second argument). No fancy syntax like foreach, but for most cases it's sufficient. You find a more elaborate implementation at tex.stackexchange.com/a/329628/4427

          – egreg
          Apr 14 at 15:30






          @JouleV The first line sets a temporary function according to the code in the third argument; the second line does a loop from the starting point (first argument) to the final point (second argument). No fancy syntax like foreach, but for most cases it's sufficient. You find a more elaborate implementation at tex.stackexchange.com/a/329628/4427

          – egreg
          Apr 14 at 15:30


















          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%2f484808%2fproblem-when-applying-foreach-loop%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

          getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

          Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

          Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.