In PStricks, what is the difference between psforeach and multido in the following?












2














My code:



documentclass[12pt,a4paper]{article}
usepackage{amsmath,amssymb,newcent}
usepackage{pstricks}
usepackage{multido}
usepackage{auto-pst-pdf}
begin{document}

begin{pspicture}(-.5,-1.5)(6.5,1.5)
psforeach{m}{.5,1.5,2.5,3.5,4.5,5.5}{psline(0,m)(m,0)}
end{pspicture}

begin{pspicture}(-.5,-1.5)(6.5,1.5)
multido{n=0.5+1}{6}{psline(0,n)(n,0)}
end{pspicture}
end{document}


The result compiling:



enter image description here



Question:



These commands are equivalent !?. Why are there differences?










share|improve this question



























    2














    My code:



    documentclass[12pt,a4paper]{article}
    usepackage{amsmath,amssymb,newcent}
    usepackage{pstricks}
    usepackage{multido}
    usepackage{auto-pst-pdf}
    begin{document}

    begin{pspicture}(-.5,-1.5)(6.5,1.5)
    psforeach{m}{.5,1.5,2.5,3.5,4.5,5.5}{psline(0,m)(m,0)}
    end{pspicture}

    begin{pspicture}(-.5,-1.5)(6.5,1.5)
    multido{n=0.5+1}{6}{psline(0,n)(n,0)}
    end{pspicture}
    end{document}


    The result compiling:



    enter image description here



    Question:



    These commands are equivalent !?. Why are there differences?










    share|improve this question

























      2












      2








      2







      My code:



      documentclass[12pt,a4paper]{article}
      usepackage{amsmath,amssymb,newcent}
      usepackage{pstricks}
      usepackage{multido}
      usepackage{auto-pst-pdf}
      begin{document}

      begin{pspicture}(-.5,-1.5)(6.5,1.5)
      psforeach{m}{.5,1.5,2.5,3.5,4.5,5.5}{psline(0,m)(m,0)}
      end{pspicture}

      begin{pspicture}(-.5,-1.5)(6.5,1.5)
      multido{n=0.5+1}{6}{psline(0,n)(n,0)}
      end{pspicture}
      end{document}


      The result compiling:



      enter image description here



      Question:



      These commands are equivalent !?. Why are there differences?










      share|improve this question













      My code:



      documentclass[12pt,a4paper]{article}
      usepackage{amsmath,amssymb,newcent}
      usepackage{pstricks}
      usepackage{multido}
      usepackage{auto-pst-pdf}
      begin{document}

      begin{pspicture}(-.5,-1.5)(6.5,1.5)
      psforeach{m}{.5,1.5,2.5,3.5,4.5,5.5}{psline(0,m)(m,0)}
      end{pspicture}

      begin{pspicture}(-.5,-1.5)(6.5,1.5)
      multido{n=0.5+1}{6}{psline(0,n)(n,0)}
      end{pspicture}
      end{document}


      The result compiling:



      enter image description here



      Question:



      These commands are equivalent !?. Why are there differences?







      pstricks multido






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 8 at 9:39









      chishimotoji

      739215




      739215






















          1 Answer
          1






          active

          oldest

          votes


















          1














          for equidistant values it makes no difference. But multido cannot work with something like 1, 1, 2, 3, 5, 8, ... and, of course, multido uses some predefined macros:



          i   for integers
          n for natural numbers
          r for real


          In your example it should be



          multido{r=0.5+1}{6}{psline[linecolor=red](0,r)(r,0)}





          share|improve this answer























          • In above question, multido{n=0.5+1}{6}, it has also equidistant values. So, can you explain more clearly?
            – chishimotoji
            Dec 8 at 10:55










          • see edited answer
            – Herbert
            Dec 8 at 11:05










          • for multido everything is declared in the documentation. For psforeach you can use any macro you like and which is not already defined.
            – Herbert
            Dec 8 at 11:27










          • please answer the above question!
            – chishimotoji
            Dec 8 at 11:29










          • @chishimotoji you can use for example multido{ri=0.5+1}{6}{psline(0,ri)(ri,0)} or multido{ra=0.5+1}{6}{psline(0,ra)(ra,0)}
            – Thomas
            Dec 8 at 12:09













          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%2f463782%2fin-pstricks-what-is-the-difference-between-psforeach-and-multido-in-the-follo%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









          1














          for equidistant values it makes no difference. But multido cannot work with something like 1, 1, 2, 3, 5, 8, ... and, of course, multido uses some predefined macros:



          i   for integers
          n for natural numbers
          r for real


          In your example it should be



          multido{r=0.5+1}{6}{psline[linecolor=red](0,r)(r,0)}





          share|improve this answer























          • In above question, multido{n=0.5+1}{6}, it has also equidistant values. So, can you explain more clearly?
            – chishimotoji
            Dec 8 at 10:55










          • see edited answer
            – Herbert
            Dec 8 at 11:05










          • for multido everything is declared in the documentation. For psforeach you can use any macro you like and which is not already defined.
            – Herbert
            Dec 8 at 11:27










          • please answer the above question!
            – chishimotoji
            Dec 8 at 11:29










          • @chishimotoji you can use for example multido{ri=0.5+1}{6}{psline(0,ri)(ri,0)} or multido{ra=0.5+1}{6}{psline(0,ra)(ra,0)}
            – Thomas
            Dec 8 at 12:09


















          1














          for equidistant values it makes no difference. But multido cannot work with something like 1, 1, 2, 3, 5, 8, ... and, of course, multido uses some predefined macros:



          i   for integers
          n for natural numbers
          r for real


          In your example it should be



          multido{r=0.5+1}{6}{psline[linecolor=red](0,r)(r,0)}





          share|improve this answer























          • In above question, multido{n=0.5+1}{6}, it has also equidistant values. So, can you explain more clearly?
            – chishimotoji
            Dec 8 at 10:55










          • see edited answer
            – Herbert
            Dec 8 at 11:05










          • for multido everything is declared in the documentation. For psforeach you can use any macro you like and which is not already defined.
            – Herbert
            Dec 8 at 11:27










          • please answer the above question!
            – chishimotoji
            Dec 8 at 11:29










          • @chishimotoji you can use for example multido{ri=0.5+1}{6}{psline(0,ri)(ri,0)} or multido{ra=0.5+1}{6}{psline(0,ra)(ra,0)}
            – Thomas
            Dec 8 at 12:09
















          1












          1








          1






          for equidistant values it makes no difference. But multido cannot work with something like 1, 1, 2, 3, 5, 8, ... and, of course, multido uses some predefined macros:



          i   for integers
          n for natural numbers
          r for real


          In your example it should be



          multido{r=0.5+1}{6}{psline[linecolor=red](0,r)(r,0)}





          share|improve this answer














          for equidistant values it makes no difference. But multido cannot work with something like 1, 1, 2, 3, 5, 8, ... and, of course, multido uses some predefined macros:



          i   for integers
          n for natural numbers
          r for real


          In your example it should be



          multido{r=0.5+1}{6}{psline[linecolor=red](0,r)(r,0)}






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 8 at 11:05

























          answered Dec 8 at 10:40









          Herbert

          269k24408717




          269k24408717












          • In above question, multido{n=0.5+1}{6}, it has also equidistant values. So, can you explain more clearly?
            – chishimotoji
            Dec 8 at 10:55










          • see edited answer
            – Herbert
            Dec 8 at 11:05










          • for multido everything is declared in the documentation. For psforeach you can use any macro you like and which is not already defined.
            – Herbert
            Dec 8 at 11:27










          • please answer the above question!
            – chishimotoji
            Dec 8 at 11:29










          • @chishimotoji you can use for example multido{ri=0.5+1}{6}{psline(0,ri)(ri,0)} or multido{ra=0.5+1}{6}{psline(0,ra)(ra,0)}
            – Thomas
            Dec 8 at 12:09




















          • In above question, multido{n=0.5+1}{6}, it has also equidistant values. So, can you explain more clearly?
            – chishimotoji
            Dec 8 at 10:55










          • see edited answer
            – Herbert
            Dec 8 at 11:05










          • for multido everything is declared in the documentation. For psforeach you can use any macro you like and which is not already defined.
            – Herbert
            Dec 8 at 11:27










          • please answer the above question!
            – chishimotoji
            Dec 8 at 11:29










          • @chishimotoji you can use for example multido{ri=0.5+1}{6}{psline(0,ri)(ri,0)} or multido{ra=0.5+1}{6}{psline(0,ra)(ra,0)}
            – Thomas
            Dec 8 at 12:09


















          In above question, multido{n=0.5+1}{6}, it has also equidistant values. So, can you explain more clearly?
          – chishimotoji
          Dec 8 at 10:55




          In above question, multido{n=0.5+1}{6}, it has also equidistant values. So, can you explain more clearly?
          – chishimotoji
          Dec 8 at 10:55












          see edited answer
          – Herbert
          Dec 8 at 11:05




          see edited answer
          – Herbert
          Dec 8 at 11:05












          for multido everything is declared in the documentation. For psforeach you can use any macro you like and which is not already defined.
          – Herbert
          Dec 8 at 11:27




          for multido everything is declared in the documentation. For psforeach you can use any macro you like and which is not already defined.
          – Herbert
          Dec 8 at 11:27












          please answer the above question!
          – chishimotoji
          Dec 8 at 11:29




          please answer the above question!
          – chishimotoji
          Dec 8 at 11:29












          @chishimotoji you can use for example multido{ri=0.5+1}{6}{psline(0,ri)(ri,0)} or multido{ra=0.5+1}{6}{psline(0,ra)(ra,0)}
          – Thomas
          Dec 8 at 12:09






          @chishimotoji you can use for example multido{ri=0.5+1}{6}{psline(0,ri)(ri,0)} or multido{ra=0.5+1}{6}{psline(0,ra)(ra,0)}
          – Thomas
          Dec 8 at 12:09




















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f463782%2fin-pstricks-what-is-the-difference-between-psforeach-and-multido-in-the-follo%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

          How to change which sound is reproduced for terminal bell?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Can I use Tabulator js library in my java Spring + Thymeleaf project?