Problem using variables with feynmp fmffor Announcing the arrival of Valued Associate #679:...

What to do with post with dry rot?

Strange behaviour of Check

How to colour the US map with Yellow, Green, Red and Blue to minimize the number of states with the colour of Green

Stop battery usage [Ubuntu 18]

Replacing HDD with SSD; what about non-APFS/APFS?

Array/tabular for long multiplication

Can smartphones with the same camera sensor have different image quality?

Would an alien lifeform be able to achieve space travel if lacking in vision?

Mortgage adviser recommends a longer term than necessary combined with overpayments

What computer would be fastest for Mathematica Home Edition?

Does the STL have a way to apply a function before calling less than?

Interesting examples of non-locally compact topological groups

When is phishing education going too far?

Why is there no army of Iron-Mans in the MCU?

Statistical model of ligand substitution

Communication vs. Technical skills ,which is more relevant for today's QA engineer positions?

Why use gamma over alpha radiation?

Complexity of many constant time steps with occasional logarithmic steps

I'm thinking of a number

3 doors, three guards, one stone

Windows 10: How to Lock (not sleep) laptop on lid close?

Active filter with series inductor and resistor - do these exist?

What kind of display is this?

Classification of bundles, Postnikov towers, obstruction theory, local coefficients



Problem using variables with feynmp fmffor



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Problem using variables with feynmpAutomatic spacing with feynmf/feynmp?Feynmp together with beamerFeynmp: Circle with five verticesDrawing tadpole diagram using feynmpHow can a label be positioned in feynmp?Balance length of lines in Feynman diagram (feynmp)How to use feynmf (feynmp)?Self-energy diagram using feynmphow do I put a dot in a fmf line using feynmp?Problem using variables with feynmp












0















This is a follow-up to this question. The solution provided by egreg worked, but the same solution doesn't work when trying to update a variable within an fmffor loop. A complete example is shown below. The expected behavior is to produce two photons each bending in the opposite direction (right=+0.5, and right=-0.5), but instead temp is always set to +0.5 in the simple.mp file.



documentclass[border=2cm]{standalone}
usepackage{feynmp}
usepackage[pdftex]{graphicx}
usepackage{pgf}

DeclareGraphicsRule{*}{mps}{*}{}

begin{document}
begin{fmffile}{fgraphs}

newcommand{efmf}[1]{
begingroupedefx{endgroupnoexpandfmf{#1}}x
}

begin{fmffile}{simple}
begin{fmfgraph*}(450,320)
fmftopn{t}{3} fmfn{plain}{t}{3}
fmfbottomn{b}{3} fmfn{plain}{b}{3}
pgfmathsetmacro{temp}{-0.5}
begin{fmffor}{n}{1}{1}{2}
pgfmathsetmacro{temp}{temp+1}
efmf{photon, foreground=blue, tension=0.1, right=temp}{t2,b2}
end{fmffor}
end{fmfgraph*}
end{fmffile}


end{fmffile}
end{document}








share







New contributor




user1247 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    This is a follow-up to this question. The solution provided by egreg worked, but the same solution doesn't work when trying to update a variable within an fmffor loop. A complete example is shown below. The expected behavior is to produce two photons each bending in the opposite direction (right=+0.5, and right=-0.5), but instead temp is always set to +0.5 in the simple.mp file.



    documentclass[border=2cm]{standalone}
    usepackage{feynmp}
    usepackage[pdftex]{graphicx}
    usepackage{pgf}

    DeclareGraphicsRule{*}{mps}{*}{}

    begin{document}
    begin{fmffile}{fgraphs}

    newcommand{efmf}[1]{
    begingroupedefx{endgroupnoexpandfmf{#1}}x
    }

    begin{fmffile}{simple}
    begin{fmfgraph*}(450,320)
    fmftopn{t}{3} fmfn{plain}{t}{3}
    fmfbottomn{b}{3} fmfn{plain}{b}{3}
    pgfmathsetmacro{temp}{-0.5}
    begin{fmffor}{n}{1}{1}{2}
    pgfmathsetmacro{temp}{temp+1}
    efmf{photon, foreground=blue, tension=0.1, right=temp}{t2,b2}
    end{fmffor}
    end{fmfgraph*}
    end{fmffile}


    end{fmffile}
    end{document}








    share







    New contributor




    user1247 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      This is a follow-up to this question. The solution provided by egreg worked, but the same solution doesn't work when trying to update a variable within an fmffor loop. A complete example is shown below. The expected behavior is to produce two photons each bending in the opposite direction (right=+0.5, and right=-0.5), but instead temp is always set to +0.5 in the simple.mp file.



      documentclass[border=2cm]{standalone}
      usepackage{feynmp}
      usepackage[pdftex]{graphicx}
      usepackage{pgf}

      DeclareGraphicsRule{*}{mps}{*}{}

      begin{document}
      begin{fmffile}{fgraphs}

      newcommand{efmf}[1]{
      begingroupedefx{endgroupnoexpandfmf{#1}}x
      }

      begin{fmffile}{simple}
      begin{fmfgraph*}(450,320)
      fmftopn{t}{3} fmfn{plain}{t}{3}
      fmfbottomn{b}{3} fmfn{plain}{b}{3}
      pgfmathsetmacro{temp}{-0.5}
      begin{fmffor}{n}{1}{1}{2}
      pgfmathsetmacro{temp}{temp+1}
      efmf{photon, foreground=blue, tension=0.1, right=temp}{t2,b2}
      end{fmffor}
      end{fmfgraph*}
      end{fmffile}


      end{fmffile}
      end{document}








      share







      New contributor




      user1247 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      This is a follow-up to this question. The solution provided by egreg worked, but the same solution doesn't work when trying to update a variable within an fmffor loop. A complete example is shown below. The expected behavior is to produce two photons each bending in the opposite direction (right=+0.5, and right=-0.5), but instead temp is always set to +0.5 in the simple.mp file.



      documentclass[border=2cm]{standalone}
      usepackage{feynmp}
      usepackage[pdftex]{graphicx}
      usepackage{pgf}

      DeclareGraphicsRule{*}{mps}{*}{}

      begin{document}
      begin{fmffile}{fgraphs}

      newcommand{efmf}[1]{
      begingroupedefx{endgroupnoexpandfmf{#1}}x
      }

      begin{fmffile}{simple}
      begin{fmfgraph*}(450,320)
      fmftopn{t}{3} fmfn{plain}{t}{3}
      fmfbottomn{b}{3} fmfn{plain}{b}{3}
      pgfmathsetmacro{temp}{-0.5}
      begin{fmffor}{n}{1}{1}{2}
      pgfmathsetmacro{temp}{temp+1}
      efmf{photon, foreground=blue, tension=0.1, right=temp}{t2,b2}
      end{fmffor}
      end{fmfgraph*}
      end{fmffile}


      end{fmffile}
      end{document}






      feynman feynmf feynmp





      share







      New contributor




      user1247 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      user1247 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      user1247 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 5 mins ago









      user1247user1247

      1133




      1133




      New contributor




      user1247 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user1247 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user1247 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes












          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
          });


          }
          });






          user1247 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f484863%2fproblem-using-variables-with-feynmp-fmffor%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          user1247 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          user1247 is a new contributor. Be nice, and check out our Code of Conduct.













          user1247 is a new contributor. Be nice, and check out our Code of Conduct.












          user1247 is a new contributor. Be nice, and check out our Code of Conduct.
















          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%2f484863%2fproblem-using-variables-with-feynmp-fmffor%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

          Installing LyX: “No textclass is found.”LyX installation error- text class not found- 'Reconfigure' or...

          (1602) Indiana Índice Designación y nombre Características orbitales Véase...

          Universidad Autónoma de Occidente Índice Historia Campus Facultades Programas Académicos Medios de...