Tikz Diagram in align environment with picture nodes












6















I am trying to reproduce an image. I could probably do alone but it may not be the best way so I am asking what is the fastest and easiest way achieve the result:



documentclass{article}

usepackage{amsmath,tikz}
newcommand{der}[2]{dfrac{d#1}{d#2}}

begin{document}
begin{center}
$begin{aligned}[t]
&phantom{==}der{}{x} (x^{2} cdot x^{5}) \ \
&=x^{2} cdot textcolor{red}{5x^{4}}+x^{5} cdot
textcolor{red}{2x}\
&=5x^{6}+2x^{6}\
&=7x^{6}
end{aligned}$
end{center}
end{document}


This outputs:



enter image description here



I am trying to achieve:



enter image description here










share|improve this question



























    6















    I am trying to reproduce an image. I could probably do alone but it may not be the best way so I am asking what is the fastest and easiest way achieve the result:



    documentclass{article}

    usepackage{amsmath,tikz}
    newcommand{der}[2]{dfrac{d#1}{d#2}}

    begin{document}
    begin{center}
    $begin{aligned}[t]
    &phantom{==}der{}{x} (x^{2} cdot x^{5}) \ \
    &=x^{2} cdot textcolor{red}{5x^{4}}+x^{5} cdot
    textcolor{red}{2x}\
    &=5x^{6}+2x^{6}\
    &=7x^{6}
    end{aligned}$
    end{center}
    end{document}


    This outputs:



    enter image description here



    I am trying to achieve:



    enter image description here










    share|improve this question

























      6












      6








      6


      0






      I am trying to reproduce an image. I could probably do alone but it may not be the best way so I am asking what is the fastest and easiest way achieve the result:



      documentclass{article}

      usepackage{amsmath,tikz}
      newcommand{der}[2]{dfrac{d#1}{d#2}}

      begin{document}
      begin{center}
      $begin{aligned}[t]
      &phantom{==}der{}{x} (x^{2} cdot x^{5}) \ \
      &=x^{2} cdot textcolor{red}{5x^{4}}+x^{5} cdot
      textcolor{red}{2x}\
      &=5x^{6}+2x^{6}\
      &=7x^{6}
      end{aligned}$
      end{center}
      end{document}


      This outputs:



      enter image description here



      I am trying to achieve:



      enter image description here










      share|improve this question














      I am trying to reproduce an image. I could probably do alone but it may not be the best way so I am asking what is the fastest and easiest way achieve the result:



      documentclass{article}

      usepackage{amsmath,tikz}
      newcommand{der}[2]{dfrac{d#1}{d#2}}

      begin{document}
      begin{center}
      $begin{aligned}[t]
      &phantom{==}der{}{x} (x^{2} cdot x^{5}) \ \
      &=x^{2} cdot textcolor{red}{5x^{4}}+x^{5} cdot
      textcolor{red}{2x}\
      &=5x^{6}+2x^{6}\
      &=7x^{6}
      end{aligned}$
      end{center}
      end{document}


      This outputs:



      enter image description here



      I am trying to achieve:



      enter image description here







      tikz-pgf






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 5 '18 at 16:23









      MathScholarMathScholar

      70328




      70328






















          1 Answer
          1






          active

          oldest

          votes


















          6














          Here's a proposal. It requires the latest version of tikzmark, i.e. should work if you have updated your TeX installation in the past 2 months or so.



          documentclass{article}

          usepackage{amsmath,tikz}
          usetikzlibrary{tikzmark}
          newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}

          begin{document}
          begin{center}
          $begin{aligned}[t]
          &phantom{==}der{}{x} (x^{2} tikzmarknode{0}{cdot} x^{5}) \[0.8cm]
          &=tikzmarknode{1}{x^{2}} cdot
          tikzmarknode[red]{2}{5x^{4}}+
          tikzmarknode{3}{x^{5}} tikzmarknode{5}{cdot}
          tikzmarknode[red]{4}{2x}\
          &=5x^{6}+2x^{6}\
          &=7x^{6}
          end{aligned}$
          end{center}
          begin{tikzpicture}[overlay,remember picture,cyan!70]
          path ([yshift=0.1cm]1.north) coordinate (aux);
          foreach X in {1,...,4}
          {draw (X |-aux) node[above,circle,draw,font=small,inner sep=1pt]
          (LX){X};}
          draw[very thick] ([xshift=-2pt,yshift=2pt]L1.west) |-
          ([xshift=2pt,yshift=8pt]L4.east) coordinate (aux2) -- ([xshift=2pt]L4.east);
          draw[very thick,-latex] (0.south) -- (0|-aux2);
          path ([yshift=-4pt]5.south) node[below,circle,draw,font=small,inner
          sep=1pt]{5};
          end{tikzpicture}
          end{document}


          enter image description here



          or (it is hard for me to judge where the 5 node should be sitting)



          documentclass{article}

          usepackage{amsmath,tikz}
          usetikzlibrary{tikzmark,positioning}
          newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}

          begin{document}
          begin{center}
          $begin{aligned}[t]
          &phantom{==}der{}{x} (x^{2} tikzmarknode{0}{cdot} x^{5}) \[0.8cm]
          &=tikzmarknode{1}{x^{2}} cdot
          tikzmarknode[red]{2}{5x^{4}}+
          tikzmarknode{3}{x^{5}} cdot
          tikzmarknode[red]{4}{2x}\
          &=5x^{6}+tikzmarknode{5}{2x^{6}}\
          &=7x^{6}
          end{aligned}$
          end{center}
          begin{tikzpicture}[overlay,remember picture,cyan!70]
          path ([yshift=0.1cm]1.north) coordinate (aux);
          foreach X in {1,...,4}
          {draw (X |-aux) node[above,circle,draw,font=small,inner sep=1pt]
          (LX){X};}
          draw[very thick] ([xshift=-2pt,yshift=2pt]L1.west) |-
          ([xshift=2pt,yshift=8pt]L4.east) coordinate (aux2) -- ([xshift=2pt]L4.east);
          draw[very thick,-latex] (0.south) -- (0|-aux2);
          node[right=3pt of 5,circle,draw,font=small,inner sep=1pt]{5};
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer


























          • I was just going to post this small issue. Thanks Marmot. This is very helpful!

            – MathScholar
            Dec 5 '18 at 20:31











          • Every student knows (or should know) that is the same, but I'd swap 2x and x^5... lol

            – Sigur
            Dec 5 '18 at 20:31











          • @Sigur Yes, thanks for the heads up. I guess that's the OP's decision. ;-)

            – marmot
            Dec 5 '18 at 20:34











          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%2f463341%2ftikz-diagram-in-align-environment-with-picture-nodes%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









          6














          Here's a proposal. It requires the latest version of tikzmark, i.e. should work if you have updated your TeX installation in the past 2 months or so.



          documentclass{article}

          usepackage{amsmath,tikz}
          usetikzlibrary{tikzmark}
          newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}

          begin{document}
          begin{center}
          $begin{aligned}[t]
          &phantom{==}der{}{x} (x^{2} tikzmarknode{0}{cdot} x^{5}) \[0.8cm]
          &=tikzmarknode{1}{x^{2}} cdot
          tikzmarknode[red]{2}{5x^{4}}+
          tikzmarknode{3}{x^{5}} tikzmarknode{5}{cdot}
          tikzmarknode[red]{4}{2x}\
          &=5x^{6}+2x^{6}\
          &=7x^{6}
          end{aligned}$
          end{center}
          begin{tikzpicture}[overlay,remember picture,cyan!70]
          path ([yshift=0.1cm]1.north) coordinate (aux);
          foreach X in {1,...,4}
          {draw (X |-aux) node[above,circle,draw,font=small,inner sep=1pt]
          (LX){X};}
          draw[very thick] ([xshift=-2pt,yshift=2pt]L1.west) |-
          ([xshift=2pt,yshift=8pt]L4.east) coordinate (aux2) -- ([xshift=2pt]L4.east);
          draw[very thick,-latex] (0.south) -- (0|-aux2);
          path ([yshift=-4pt]5.south) node[below,circle,draw,font=small,inner
          sep=1pt]{5};
          end{tikzpicture}
          end{document}


          enter image description here



          or (it is hard for me to judge where the 5 node should be sitting)



          documentclass{article}

          usepackage{amsmath,tikz}
          usetikzlibrary{tikzmark,positioning}
          newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}

          begin{document}
          begin{center}
          $begin{aligned}[t]
          &phantom{==}der{}{x} (x^{2} tikzmarknode{0}{cdot} x^{5}) \[0.8cm]
          &=tikzmarknode{1}{x^{2}} cdot
          tikzmarknode[red]{2}{5x^{4}}+
          tikzmarknode{3}{x^{5}} cdot
          tikzmarknode[red]{4}{2x}\
          &=5x^{6}+tikzmarknode{5}{2x^{6}}\
          &=7x^{6}
          end{aligned}$
          end{center}
          begin{tikzpicture}[overlay,remember picture,cyan!70]
          path ([yshift=0.1cm]1.north) coordinate (aux);
          foreach X in {1,...,4}
          {draw (X |-aux) node[above,circle,draw,font=small,inner sep=1pt]
          (LX){X};}
          draw[very thick] ([xshift=-2pt,yshift=2pt]L1.west) |-
          ([xshift=2pt,yshift=8pt]L4.east) coordinate (aux2) -- ([xshift=2pt]L4.east);
          draw[very thick,-latex] (0.south) -- (0|-aux2);
          node[right=3pt of 5,circle,draw,font=small,inner sep=1pt]{5};
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer


























          • I was just going to post this small issue. Thanks Marmot. This is very helpful!

            – MathScholar
            Dec 5 '18 at 20:31











          • Every student knows (or should know) that is the same, but I'd swap 2x and x^5... lol

            – Sigur
            Dec 5 '18 at 20:31











          • @Sigur Yes, thanks for the heads up. I guess that's the OP's decision. ;-)

            – marmot
            Dec 5 '18 at 20:34
















          6














          Here's a proposal. It requires the latest version of tikzmark, i.e. should work if you have updated your TeX installation in the past 2 months or so.



          documentclass{article}

          usepackage{amsmath,tikz}
          usetikzlibrary{tikzmark}
          newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}

          begin{document}
          begin{center}
          $begin{aligned}[t]
          &phantom{==}der{}{x} (x^{2} tikzmarknode{0}{cdot} x^{5}) \[0.8cm]
          &=tikzmarknode{1}{x^{2}} cdot
          tikzmarknode[red]{2}{5x^{4}}+
          tikzmarknode{3}{x^{5}} tikzmarknode{5}{cdot}
          tikzmarknode[red]{4}{2x}\
          &=5x^{6}+2x^{6}\
          &=7x^{6}
          end{aligned}$
          end{center}
          begin{tikzpicture}[overlay,remember picture,cyan!70]
          path ([yshift=0.1cm]1.north) coordinate (aux);
          foreach X in {1,...,4}
          {draw (X |-aux) node[above,circle,draw,font=small,inner sep=1pt]
          (LX){X};}
          draw[very thick] ([xshift=-2pt,yshift=2pt]L1.west) |-
          ([xshift=2pt,yshift=8pt]L4.east) coordinate (aux2) -- ([xshift=2pt]L4.east);
          draw[very thick,-latex] (0.south) -- (0|-aux2);
          path ([yshift=-4pt]5.south) node[below,circle,draw,font=small,inner
          sep=1pt]{5};
          end{tikzpicture}
          end{document}


          enter image description here



          or (it is hard for me to judge where the 5 node should be sitting)



          documentclass{article}

          usepackage{amsmath,tikz}
          usetikzlibrary{tikzmark,positioning}
          newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}

          begin{document}
          begin{center}
          $begin{aligned}[t]
          &phantom{==}der{}{x} (x^{2} tikzmarknode{0}{cdot} x^{5}) \[0.8cm]
          &=tikzmarknode{1}{x^{2}} cdot
          tikzmarknode[red]{2}{5x^{4}}+
          tikzmarknode{3}{x^{5}} cdot
          tikzmarknode[red]{4}{2x}\
          &=5x^{6}+tikzmarknode{5}{2x^{6}}\
          &=7x^{6}
          end{aligned}$
          end{center}
          begin{tikzpicture}[overlay,remember picture,cyan!70]
          path ([yshift=0.1cm]1.north) coordinate (aux);
          foreach X in {1,...,4}
          {draw (X |-aux) node[above,circle,draw,font=small,inner sep=1pt]
          (LX){X};}
          draw[very thick] ([xshift=-2pt,yshift=2pt]L1.west) |-
          ([xshift=2pt,yshift=8pt]L4.east) coordinate (aux2) -- ([xshift=2pt]L4.east);
          draw[very thick,-latex] (0.south) -- (0|-aux2);
          node[right=3pt of 5,circle,draw,font=small,inner sep=1pt]{5};
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer


























          • I was just going to post this small issue. Thanks Marmot. This is very helpful!

            – MathScholar
            Dec 5 '18 at 20:31











          • Every student knows (or should know) that is the same, but I'd swap 2x and x^5... lol

            – Sigur
            Dec 5 '18 at 20:31











          • @Sigur Yes, thanks for the heads up. I guess that's the OP's decision. ;-)

            – marmot
            Dec 5 '18 at 20:34














          6












          6








          6







          Here's a proposal. It requires the latest version of tikzmark, i.e. should work if you have updated your TeX installation in the past 2 months or so.



          documentclass{article}

          usepackage{amsmath,tikz}
          usetikzlibrary{tikzmark}
          newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}

          begin{document}
          begin{center}
          $begin{aligned}[t]
          &phantom{==}der{}{x} (x^{2} tikzmarknode{0}{cdot} x^{5}) \[0.8cm]
          &=tikzmarknode{1}{x^{2}} cdot
          tikzmarknode[red]{2}{5x^{4}}+
          tikzmarknode{3}{x^{5}} tikzmarknode{5}{cdot}
          tikzmarknode[red]{4}{2x}\
          &=5x^{6}+2x^{6}\
          &=7x^{6}
          end{aligned}$
          end{center}
          begin{tikzpicture}[overlay,remember picture,cyan!70]
          path ([yshift=0.1cm]1.north) coordinate (aux);
          foreach X in {1,...,4}
          {draw (X |-aux) node[above,circle,draw,font=small,inner sep=1pt]
          (LX){X};}
          draw[very thick] ([xshift=-2pt,yshift=2pt]L1.west) |-
          ([xshift=2pt,yshift=8pt]L4.east) coordinate (aux2) -- ([xshift=2pt]L4.east);
          draw[very thick,-latex] (0.south) -- (0|-aux2);
          path ([yshift=-4pt]5.south) node[below,circle,draw,font=small,inner
          sep=1pt]{5};
          end{tikzpicture}
          end{document}


          enter image description here



          or (it is hard for me to judge where the 5 node should be sitting)



          documentclass{article}

          usepackage{amsmath,tikz}
          usetikzlibrary{tikzmark,positioning}
          newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}

          begin{document}
          begin{center}
          $begin{aligned}[t]
          &phantom{==}der{}{x} (x^{2} tikzmarknode{0}{cdot} x^{5}) \[0.8cm]
          &=tikzmarknode{1}{x^{2}} cdot
          tikzmarknode[red]{2}{5x^{4}}+
          tikzmarknode{3}{x^{5}} cdot
          tikzmarknode[red]{4}{2x}\
          &=5x^{6}+tikzmarknode{5}{2x^{6}}\
          &=7x^{6}
          end{aligned}$
          end{center}
          begin{tikzpicture}[overlay,remember picture,cyan!70]
          path ([yshift=0.1cm]1.north) coordinate (aux);
          foreach X in {1,...,4}
          {draw (X |-aux) node[above,circle,draw,font=small,inner sep=1pt]
          (LX){X};}
          draw[very thick] ([xshift=-2pt,yshift=2pt]L1.west) |-
          ([xshift=2pt,yshift=8pt]L4.east) coordinate (aux2) -- ([xshift=2pt]L4.east);
          draw[very thick,-latex] (0.south) -- (0|-aux2);
          node[right=3pt of 5,circle,draw,font=small,inner sep=1pt]{5};
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer















          Here's a proposal. It requires the latest version of tikzmark, i.e. should work if you have updated your TeX installation in the past 2 months or so.



          documentclass{article}

          usepackage{amsmath,tikz}
          usetikzlibrary{tikzmark}
          newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}

          begin{document}
          begin{center}
          $begin{aligned}[t]
          &phantom{==}der{}{x} (x^{2} tikzmarknode{0}{cdot} x^{5}) \[0.8cm]
          &=tikzmarknode{1}{x^{2}} cdot
          tikzmarknode[red]{2}{5x^{4}}+
          tikzmarknode{3}{x^{5}} tikzmarknode{5}{cdot}
          tikzmarknode[red]{4}{2x}\
          &=5x^{6}+2x^{6}\
          &=7x^{6}
          end{aligned}$
          end{center}
          begin{tikzpicture}[overlay,remember picture,cyan!70]
          path ([yshift=0.1cm]1.north) coordinate (aux);
          foreach X in {1,...,4}
          {draw (X |-aux) node[above,circle,draw,font=small,inner sep=1pt]
          (LX){X};}
          draw[very thick] ([xshift=-2pt,yshift=2pt]L1.west) |-
          ([xshift=2pt,yshift=8pt]L4.east) coordinate (aux2) -- ([xshift=2pt]L4.east);
          draw[very thick,-latex] (0.south) -- (0|-aux2);
          path ([yshift=-4pt]5.south) node[below,circle,draw,font=small,inner
          sep=1pt]{5};
          end{tikzpicture}
          end{document}


          enter image description here



          or (it is hard for me to judge where the 5 node should be sitting)



          documentclass{article}

          usepackage{amsmath,tikz}
          usetikzlibrary{tikzmark,positioning}
          newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}

          begin{document}
          begin{center}
          $begin{aligned}[t]
          &phantom{==}der{}{x} (x^{2} tikzmarknode{0}{cdot} x^{5}) \[0.8cm]
          &=tikzmarknode{1}{x^{2}} cdot
          tikzmarknode[red]{2}{5x^{4}}+
          tikzmarknode{3}{x^{5}} cdot
          tikzmarknode[red]{4}{2x}\
          &=5x^{6}+tikzmarknode{5}{2x^{6}}\
          &=7x^{6}
          end{aligned}$
          end{center}
          begin{tikzpicture}[overlay,remember picture,cyan!70]
          path ([yshift=0.1cm]1.north) coordinate (aux);
          foreach X in {1,...,4}
          {draw (X |-aux) node[above,circle,draw,font=small,inner sep=1pt]
          (LX){X};}
          draw[very thick] ([xshift=-2pt,yshift=2pt]L1.west) |-
          ([xshift=2pt,yshift=8pt]L4.east) coordinate (aux2) -- ([xshift=2pt]L4.east);
          draw[very thick,-latex] (0.south) -- (0|-aux2);
          node[right=3pt of 5,circle,draw,font=small,inner sep=1pt]{5};
          end{tikzpicture}
          end{document}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 5 '18 at 20:28

























          answered Dec 5 '18 at 18:45









          marmotmarmot

          94.1k4109209




          94.1k4109209













          • I was just going to post this small issue. Thanks Marmot. This is very helpful!

            – MathScholar
            Dec 5 '18 at 20:31











          • Every student knows (or should know) that is the same, but I'd swap 2x and x^5... lol

            – Sigur
            Dec 5 '18 at 20:31











          • @Sigur Yes, thanks for the heads up. I guess that's the OP's decision. ;-)

            – marmot
            Dec 5 '18 at 20:34



















          • I was just going to post this small issue. Thanks Marmot. This is very helpful!

            – MathScholar
            Dec 5 '18 at 20:31











          • Every student knows (or should know) that is the same, but I'd swap 2x and x^5... lol

            – Sigur
            Dec 5 '18 at 20:31











          • @Sigur Yes, thanks for the heads up. I guess that's the OP's decision. ;-)

            – marmot
            Dec 5 '18 at 20:34

















          I was just going to post this small issue. Thanks Marmot. This is very helpful!

          – MathScholar
          Dec 5 '18 at 20:31





          I was just going to post this small issue. Thanks Marmot. This is very helpful!

          – MathScholar
          Dec 5 '18 at 20:31













          Every student knows (or should know) that is the same, but I'd swap 2x and x^5... lol

          – Sigur
          Dec 5 '18 at 20:31





          Every student knows (or should know) that is the same, but I'd swap 2x and x^5... lol

          – Sigur
          Dec 5 '18 at 20:31













          @Sigur Yes, thanks for the heads up. I guess that's the OP's decision. ;-)

          – marmot
          Dec 5 '18 at 20:34





          @Sigur Yes, thanks for the heads up. I guess that's the OP's decision. ;-)

          – marmot
          Dec 5 '18 at 20:34


















          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%2f463341%2ftikz-diagram-in-align-environment-with-picture-nodes%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

          Probability when a professor distributes a quiz and homework assignment to a class of n students.

          Aardman Animations

          Are they similar matrix