Nested alignments












3















I want to make alignments that look like this:



enter image description here



which I have done by using



begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& ; ; ; ; ; ; , = frac{dy}{dt} \
& ; ; ; ; ; ; , = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}


Of course, it's kinda silly to do ; ; ; ; ... and align them manually. However, when I try putting a begin{align} within another begin{align} like this



begin{align}
begin{align}

end{align}
end{align}


it gives me an error.



What is the correct way of doing this?





EDIT:



begin{alignat} still doesn't quite get me there:



begin{alignat}{2}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} && = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& && = frac{dy}{dt} \
& && = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{alignat}


gives



enter image description here










share|improve this question




















  • 1





    You should use alignat rather than align -- alignat allows for multiple & 'columns'

    – user31729
    Feb 2 at 18:52











  • How should I use alignat? There is this massive spacing between the columns

    – glowstonetrees
    Feb 2 at 19:10











  • Usually, the & is used before =

    – user31729
    Feb 2 at 19:12











  • but I also want to align the implies

    – glowstonetrees
    Feb 2 at 19:13











  • Well, that's not forbidden, of course

    – user31729
    Feb 2 at 19:14
















3















I want to make alignments that look like this:



enter image description here



which I have done by using



begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& ; ; ; ; ; ; , = frac{dy}{dt} \
& ; ; ; ; ; ; , = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}


Of course, it's kinda silly to do ; ; ; ; ... and align them manually. However, when I try putting a begin{align} within another begin{align} like this



begin{align}
begin{align}

end{align}
end{align}


it gives me an error.



What is the correct way of doing this?





EDIT:



begin{alignat} still doesn't quite get me there:



begin{alignat}{2}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} && = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& && = frac{dy}{dt} \
& && = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{alignat}


gives



enter image description here










share|improve this question




















  • 1





    You should use alignat rather than align -- alignat allows for multiple & 'columns'

    – user31729
    Feb 2 at 18:52











  • How should I use alignat? There is this massive spacing between the columns

    – glowstonetrees
    Feb 2 at 19:10











  • Usually, the & is used before =

    – user31729
    Feb 2 at 19:12











  • but I also want to align the implies

    – glowstonetrees
    Feb 2 at 19:13











  • Well, that's not forbidden, of course

    – user31729
    Feb 2 at 19:14














3












3








3


0






I want to make alignments that look like this:



enter image description here



which I have done by using



begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& ; ; ; ; ; ; , = frac{dy}{dt} \
& ; ; ; ; ; ; , = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}


Of course, it's kinda silly to do ; ; ; ; ... and align them manually. However, when I try putting a begin{align} within another begin{align} like this



begin{align}
begin{align}

end{align}
end{align}


it gives me an error.



What is the correct way of doing this?





EDIT:



begin{alignat} still doesn't quite get me there:



begin{alignat}{2}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} && = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& && = frac{dy}{dt} \
& && = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{alignat}


gives



enter image description here










share|improve this question
















I want to make alignments that look like this:



enter image description here



which I have done by using



begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& ; ; ; ; ; ; , = frac{dy}{dt} \
& ; ; ; ; ; ; , = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}


Of course, it's kinda silly to do ; ; ; ; ... and align them manually. However, when I try putting a begin{align} within another begin{align} like this



begin{align}
begin{align}

end{align}
end{align}


it gives me an error.



What is the correct way of doing this?





EDIT:



begin{alignat} still doesn't quite get me there:



begin{alignat}{2}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} && = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& && = frac{dy}{dt} \
& && = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{alignat}


gives



enter image description here







align nesting alignment






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 2 at 19:07







glowstonetrees

















asked Feb 2 at 18:50









glowstonetreesglowstonetrees

1184




1184








  • 1





    You should use alignat rather than align -- alignat allows for multiple & 'columns'

    – user31729
    Feb 2 at 18:52











  • How should I use alignat? There is this massive spacing between the columns

    – glowstonetrees
    Feb 2 at 19:10











  • Usually, the & is used before =

    – user31729
    Feb 2 at 19:12











  • but I also want to align the implies

    – glowstonetrees
    Feb 2 at 19:13











  • Well, that's not forbidden, of course

    – user31729
    Feb 2 at 19:14














  • 1





    You should use alignat rather than align -- alignat allows for multiple & 'columns'

    – user31729
    Feb 2 at 18:52











  • How should I use alignat? There is this massive spacing between the columns

    – glowstonetrees
    Feb 2 at 19:10











  • Usually, the & is used before =

    – user31729
    Feb 2 at 19:12











  • but I also want to align the implies

    – glowstonetrees
    Feb 2 at 19:13











  • Well, that's not forbidden, of course

    – user31729
    Feb 2 at 19:14








1




1





You should use alignat rather than align -- alignat allows for multiple & 'columns'

– user31729
Feb 2 at 18:52





You should use alignat rather than align -- alignat allows for multiple & 'columns'

– user31729
Feb 2 at 18:52













How should I use alignat? There is this massive spacing between the columns

– glowstonetrees
Feb 2 at 19:10





How should I use alignat? There is this massive spacing between the columns

– glowstonetrees
Feb 2 at 19:10













Usually, the & is used before =

– user31729
Feb 2 at 19:12





Usually, the & is used before =

– user31729
Feb 2 at 19:12













but I also want to align the implies

– glowstonetrees
Feb 2 at 19:13





but I also want to align the implies

– glowstonetrees
Feb 2 at 19:13













Well, that's not forbidden, of course

– user31729
Feb 2 at 19:14





Well, that's not forbidden, of course

– user31729
Feb 2 at 19:14










3 Answers
3






active

oldest

votes


















2














You can use alignat for this:



enter image description here



documentclass{article}

usepackage{amsmath}

begin{document}

begin{alignat*}{2}
&quad& frac{mathrm{d}x}{mathrm{d}t} &= y qquad frac{mathrm{d}y}{mathrm{d}t} = x \
implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= frac{mathrm{d}}{mathrm{d}t} biggl( frac{mathrm{d}x}{mathrm{d}t} biggr) \
&& &= frac{mathrm{d}y}{mathrm{d}t} \
&& &= x \
implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= x \
implies && x(t) &= Ae^t + Be^{-t}
end{alignat*}

end{document}





share|improve this answer
























  • I'm not sure why you used upright d's when the OP uses italic ones. Even I conform to ln when the OP does on Math.SE, go figure! ;-)

    – egreg
    Feb 2 at 23:19



















2














I wouldn't perform any alignment on the implies symbols. To provide (visual) clarity of exposition, it suffices to perform alignment on the first instance of = in each line.



enter image description here



I can't help but remark that the 5th line seems to be redundant.



documentclass{article} 
usepackage{amsmath}
begin{document}
begin{align}
frac{dx}{dt} &= y qquad frac{dy}{dt} = x \
implies frac{d^2x}{dt^2} &= frac{d}{dt}biggl(frac{dx}{dt}biggr) \
&= frac{dy}{dt} \
&= x \
implies frac{d^2x}{dt^2} &= x \
implies x(t) &= Ae^t + Be^{-t}
end{align}
end{document}





share|improve this answer































    1














    Nesting align environments directly doesn't work, because align environments start display math, so they can not be used inside math mode. Lucky for you, amsmath includes aligned as an alternative for cases like this (The t tells LaTeX to align the top line with the content outside of the environment):



    documentclass{article}
    usepackage{amsmath}
    begin{document}
    begin{align}
    & frac{dx}{dt} = y qquad frac{dy}{dt} = x \
    implies & begin{aligned}[t]
    frac{d^2x}{dt^2} &= frac{d}{dt}bigg(frac{dx}{dt} bigg) \
    &= frac{dy}{dt} \
    &= x
    end{aligned}\
    implies & frac{d^2x}{dt^2} = x \
    implies & x(t) = Ae^t + Be^{-t}
    end{align}
    end{document}


    enter image description here






    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%2f473083%2fnested-alignments%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      You can use alignat for this:



      enter image description here



      documentclass{article}

      usepackage{amsmath}

      begin{document}

      begin{alignat*}{2}
      &quad& frac{mathrm{d}x}{mathrm{d}t} &= y qquad frac{mathrm{d}y}{mathrm{d}t} = x \
      implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= frac{mathrm{d}}{mathrm{d}t} biggl( frac{mathrm{d}x}{mathrm{d}t} biggr) \
      && &= frac{mathrm{d}y}{mathrm{d}t} \
      && &= x \
      implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= x \
      implies && x(t) &= Ae^t + Be^{-t}
      end{alignat*}

      end{document}





      share|improve this answer
























      • I'm not sure why you used upright d's when the OP uses italic ones. Even I conform to ln when the OP does on Math.SE, go figure! ;-)

        – egreg
        Feb 2 at 23:19
















      2














      You can use alignat for this:



      enter image description here



      documentclass{article}

      usepackage{amsmath}

      begin{document}

      begin{alignat*}{2}
      &quad& frac{mathrm{d}x}{mathrm{d}t} &= y qquad frac{mathrm{d}y}{mathrm{d}t} = x \
      implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= frac{mathrm{d}}{mathrm{d}t} biggl( frac{mathrm{d}x}{mathrm{d}t} biggr) \
      && &= frac{mathrm{d}y}{mathrm{d}t} \
      && &= x \
      implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= x \
      implies && x(t) &= Ae^t + Be^{-t}
      end{alignat*}

      end{document}





      share|improve this answer
























      • I'm not sure why you used upright d's when the OP uses italic ones. Even I conform to ln when the OP does on Math.SE, go figure! ;-)

        – egreg
        Feb 2 at 23:19














      2












      2








      2







      You can use alignat for this:



      enter image description here



      documentclass{article}

      usepackage{amsmath}

      begin{document}

      begin{alignat*}{2}
      &quad& frac{mathrm{d}x}{mathrm{d}t} &= y qquad frac{mathrm{d}y}{mathrm{d}t} = x \
      implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= frac{mathrm{d}}{mathrm{d}t} biggl( frac{mathrm{d}x}{mathrm{d}t} biggr) \
      && &= frac{mathrm{d}y}{mathrm{d}t} \
      && &= x \
      implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= x \
      implies && x(t) &= Ae^t + Be^{-t}
      end{alignat*}

      end{document}





      share|improve this answer













      You can use alignat for this:



      enter image description here



      documentclass{article}

      usepackage{amsmath}

      begin{document}

      begin{alignat*}{2}
      &quad& frac{mathrm{d}x}{mathrm{d}t} &= y qquad frac{mathrm{d}y}{mathrm{d}t} = x \
      implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= frac{mathrm{d}}{mathrm{d}t} biggl( frac{mathrm{d}x}{mathrm{d}t} biggr) \
      && &= frac{mathrm{d}y}{mathrm{d}t} \
      && &= x \
      implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= x \
      implies && x(t) &= Ae^t + Be^{-t}
      end{alignat*}

      end{document}






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Feb 2 at 19:32









      WernerWerner

      450k7210001709




      450k7210001709













      • I'm not sure why you used upright d's when the OP uses italic ones. Even I conform to ln when the OP does on Math.SE, go figure! ;-)

        – egreg
        Feb 2 at 23:19



















      • I'm not sure why you used upright d's when the OP uses italic ones. Even I conform to ln when the OP does on Math.SE, go figure! ;-)

        – egreg
        Feb 2 at 23:19

















      I'm not sure why you used upright d's when the OP uses italic ones. Even I conform to ln when the OP does on Math.SE, go figure! ;-)

      – egreg
      Feb 2 at 23:19





      I'm not sure why you used upright d's when the OP uses italic ones. Even I conform to ln when the OP does on Math.SE, go figure! ;-)

      – egreg
      Feb 2 at 23:19











      2














      I wouldn't perform any alignment on the implies symbols. To provide (visual) clarity of exposition, it suffices to perform alignment on the first instance of = in each line.



      enter image description here



      I can't help but remark that the 5th line seems to be redundant.



      documentclass{article} 
      usepackage{amsmath}
      begin{document}
      begin{align}
      frac{dx}{dt} &= y qquad frac{dy}{dt} = x \
      implies frac{d^2x}{dt^2} &= frac{d}{dt}biggl(frac{dx}{dt}biggr) \
      &= frac{dy}{dt} \
      &= x \
      implies frac{d^2x}{dt^2} &= x \
      implies x(t) &= Ae^t + Be^{-t}
      end{align}
      end{document}





      share|improve this answer




























        2














        I wouldn't perform any alignment on the implies symbols. To provide (visual) clarity of exposition, it suffices to perform alignment on the first instance of = in each line.



        enter image description here



        I can't help but remark that the 5th line seems to be redundant.



        documentclass{article} 
        usepackage{amsmath}
        begin{document}
        begin{align}
        frac{dx}{dt} &= y qquad frac{dy}{dt} = x \
        implies frac{d^2x}{dt^2} &= frac{d}{dt}biggl(frac{dx}{dt}biggr) \
        &= frac{dy}{dt} \
        &= x \
        implies frac{d^2x}{dt^2} &= x \
        implies x(t) &= Ae^t + Be^{-t}
        end{align}
        end{document}





        share|improve this answer


























          2












          2








          2







          I wouldn't perform any alignment on the implies symbols. To provide (visual) clarity of exposition, it suffices to perform alignment on the first instance of = in each line.



          enter image description here



          I can't help but remark that the 5th line seems to be redundant.



          documentclass{article} 
          usepackage{amsmath}
          begin{document}
          begin{align}
          frac{dx}{dt} &= y qquad frac{dy}{dt} = x \
          implies frac{d^2x}{dt^2} &= frac{d}{dt}biggl(frac{dx}{dt}biggr) \
          &= frac{dy}{dt} \
          &= x \
          implies frac{d^2x}{dt^2} &= x \
          implies x(t) &= Ae^t + Be^{-t}
          end{align}
          end{document}





          share|improve this answer













          I wouldn't perform any alignment on the implies symbols. To provide (visual) clarity of exposition, it suffices to perform alignment on the first instance of = in each line.



          enter image description here



          I can't help but remark that the 5th line seems to be redundant.



          documentclass{article} 
          usepackage{amsmath}
          begin{document}
          begin{align}
          frac{dx}{dt} &= y qquad frac{dy}{dt} = x \
          implies frac{d^2x}{dt^2} &= frac{d}{dt}biggl(frac{dx}{dt}biggr) \
          &= frac{dy}{dt} \
          &= x \
          implies frac{d^2x}{dt^2} &= x \
          implies x(t) &= Ae^t + Be^{-t}
          end{align}
          end{document}






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 2 at 19:37









          MicoMico

          287k32391779




          287k32391779























              1














              Nesting align environments directly doesn't work, because align environments start display math, so they can not be used inside math mode. Lucky for you, amsmath includes aligned as an alternative for cases like this (The t tells LaTeX to align the top line with the content outside of the environment):



              documentclass{article}
              usepackage{amsmath}
              begin{document}
              begin{align}
              & frac{dx}{dt} = y qquad frac{dy}{dt} = x \
              implies & begin{aligned}[t]
              frac{d^2x}{dt^2} &= frac{d}{dt}bigg(frac{dx}{dt} bigg) \
              &= frac{dy}{dt} \
              &= x
              end{aligned}\
              implies & frac{d^2x}{dt^2} = x \
              implies & x(t) = Ae^t + Be^{-t}
              end{align}
              end{document}


              enter image description here






              share|improve this answer




























                1














                Nesting align environments directly doesn't work, because align environments start display math, so they can not be used inside math mode. Lucky for you, amsmath includes aligned as an alternative for cases like this (The t tells LaTeX to align the top line with the content outside of the environment):



                documentclass{article}
                usepackage{amsmath}
                begin{document}
                begin{align}
                & frac{dx}{dt} = y qquad frac{dy}{dt} = x \
                implies & begin{aligned}[t]
                frac{d^2x}{dt^2} &= frac{d}{dt}bigg(frac{dx}{dt} bigg) \
                &= frac{dy}{dt} \
                &= x
                end{aligned}\
                implies & frac{d^2x}{dt^2} = x \
                implies & x(t) = Ae^t + Be^{-t}
                end{align}
                end{document}


                enter image description here






                share|improve this answer


























                  1












                  1








                  1







                  Nesting align environments directly doesn't work, because align environments start display math, so they can not be used inside math mode. Lucky for you, amsmath includes aligned as an alternative for cases like this (The t tells LaTeX to align the top line with the content outside of the environment):



                  documentclass{article}
                  usepackage{amsmath}
                  begin{document}
                  begin{align}
                  & frac{dx}{dt} = y qquad frac{dy}{dt} = x \
                  implies & begin{aligned}[t]
                  frac{d^2x}{dt^2} &= frac{d}{dt}bigg(frac{dx}{dt} bigg) \
                  &= frac{dy}{dt} \
                  &= x
                  end{aligned}\
                  implies & frac{d^2x}{dt^2} = x \
                  implies & x(t) = Ae^t + Be^{-t}
                  end{align}
                  end{document}


                  enter image description here






                  share|improve this answer













                  Nesting align environments directly doesn't work, because align environments start display math, so they can not be used inside math mode. Lucky for you, amsmath includes aligned as an alternative for cases like this (The t tells LaTeX to align the top line with the content outside of the environment):



                  documentclass{article}
                  usepackage{amsmath}
                  begin{document}
                  begin{align}
                  & frac{dx}{dt} = y qquad frac{dy}{dt} = x \
                  implies & begin{aligned}[t]
                  frac{d^2x}{dt^2} &= frac{d}{dt}bigg(frac{dx}{dt} bigg) \
                  &= frac{dy}{dt} \
                  &= x
                  end{aligned}\
                  implies & frac{d^2x}{dt^2} = x \
                  implies & x(t) = Ae^t + Be^{-t}
                  end{align}
                  end{document}


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 2 at 19:18









                  Marcel KrügerMarcel Krüger

                  13k11636




                  13k11636






























                      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%2f473083%2fnested-alignments%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

                      MongoDB - Not Authorized To Execute Command

                      How to fix TextFormField cause rebuild widget in Flutter

                      in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith