Aligning Systems of Equations












4















I'm trying to line up the variables of systems of equations. The following code:



$$left\{
begin{aligned}
&alpha + 2&beta + &gamma & = 0 \\
3&alpha + 7&beta + 5&gamma & = 1
end{aligned}
right.$$


produces the following image:



enter image description here



I want the Greek letters and the math symbols to be aligned, with appropriate spacing in between coefficients. I've tried using begin{aligned} end{aligned} and begin{array}{ll} end{array}{ll} as well, but they also don't provide the desired outcome.



Would anyone be kind enough to help me out? Thank you.










share|improve this question




















  • 1





    You can try the package systeme: ctan.org/pkg/systeme .

    – projetmbc
    Feb 21 at 15:20











  • See also tex.stackexchange.com/questions/35174/…

    – Steven B. Segletes
    Feb 21 at 16:25











  • See Why is [] preferable to $$?

    – Werner
    Feb 21 at 16:33
















4















I'm trying to line up the variables of systems of equations. The following code:



$$left\{
begin{aligned}
&alpha + 2&beta + &gamma & = 0 \\
3&alpha + 7&beta + 5&gamma & = 1
end{aligned}
right.$$


produces the following image:



enter image description here



I want the Greek letters and the math symbols to be aligned, with appropriate spacing in between coefficients. I've tried using begin{aligned} end{aligned} and begin{array}{ll} end{array}{ll} as well, but they also don't provide the desired outcome.



Would anyone be kind enough to help me out? Thank you.










share|improve this question




















  • 1





    You can try the package systeme: ctan.org/pkg/systeme .

    – projetmbc
    Feb 21 at 15:20











  • See also tex.stackexchange.com/questions/35174/…

    – Steven B. Segletes
    Feb 21 at 16:25











  • See Why is [] preferable to $$?

    – Werner
    Feb 21 at 16:33














4












4








4








I'm trying to line up the variables of systems of equations. The following code:



$$left\{
begin{aligned}
&alpha + 2&beta + &gamma & = 0 \\
3&alpha + 7&beta + 5&gamma & = 1
end{aligned}
right.$$


produces the following image:



enter image description here



I want the Greek letters and the math symbols to be aligned, with appropriate spacing in between coefficients. I've tried using begin{aligned} end{aligned} and begin{array}{ll} end{array}{ll} as well, but they also don't provide the desired outcome.



Would anyone be kind enough to help me out? Thank you.










share|improve this question
















I'm trying to line up the variables of systems of equations. The following code:



$$left\{
begin{aligned}
&alpha + 2&beta + &gamma & = 0 \\
3&alpha + 7&beta + 5&gamma & = 1
end{aligned}
right.$$


produces the following image:



enter image description here



I want the Greek letters and the math symbols to be aligned, with appropriate spacing in between coefficients. I've tried using begin{aligned} end{aligned} and begin{array}{ll} end{array}{ll} as well, but they also don't provide the desired outcome.



Would anyone be kind enough to help me out? Thank you.







math-mode align






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 21 at 15:14









JouleV

7,89222053




7,89222053










asked Feb 21 at 15:12









SeankalaSeankala

1234




1234








  • 1





    You can try the package systeme: ctan.org/pkg/systeme .

    – projetmbc
    Feb 21 at 15:20











  • See also tex.stackexchange.com/questions/35174/…

    – Steven B. Segletes
    Feb 21 at 16:25











  • See Why is [] preferable to $$?

    – Werner
    Feb 21 at 16:33














  • 1





    You can try the package systeme: ctan.org/pkg/systeme .

    – projetmbc
    Feb 21 at 15:20











  • See also tex.stackexchange.com/questions/35174/…

    – Steven B. Segletes
    Feb 21 at 16:25











  • See Why is [] preferable to $$?

    – Werner
    Feb 21 at 16:33








1




1





You can try the package systeme: ctan.org/pkg/systeme .

– projetmbc
Feb 21 at 15:20





You can try the package systeme: ctan.org/pkg/systeme .

– projetmbc
Feb 21 at 15:20













See also tex.stackexchange.com/questions/35174/…

– Steven B. Segletes
Feb 21 at 16:25





See also tex.stackexchange.com/questions/35174/…

– Steven B. Segletes
Feb 21 at 16:25













See Why is [] preferable to $$?

– Werner
Feb 21 at 16:33





See Why is [] preferable to $$?

– Werner
Feb 21 at 16:33










3 Answers
3






active

oldest

votes


















5














First of all, do not use $$ ... $$, which is plain TeX, use the LaTeX construct [ ... ].



Second, 4 alignment points require 7 ampersands, not 4: each new column of alignment has to be introduced by an ampersand. So n alignment points require 2n–1 ampersands.



Last: use alignat (or alignedat) to have full control on the spacing between columns of alignment.



Here is a possible code:



[ left{
begin{alignedat}{4}
&alpha &{} + 2&beta + {} & &gamma & & = 0 \\
3&alpha &{} + 7&beta + 5 & &gamma & & = 1
end{alignedat}


However, using the systeme package makes it simpler to type:



[ systeme[alphabetagamma]{alpha + 2beta +gamma = 0, 3alpha + 7beta + 5gamma = 1} ]


enter image description here






share|improve this answer


























  • I had no idea that $ was plain TeX, thanks! Unfortunately it seems that for the Github Markdown I'm trying to edit, [ doesn't seem to work... But begin{alignedat}{4} end{alignedat} works perfectly!

    – Seankala
    Feb 21 at 15:36











  • I've updated with a simpler way to type (the systeme command from the homonymous package).

    – Bernard
    Feb 21 at 15:38






  • 1





    In your first method, the spacing around the = is not correct.

    – Steven B. Segletes
    Feb 21 at 15:42






  • 1





    amsldoc (amsmath documentation) and systeme. Feel free to ask any questions.

    – Bernard
    Feb 21 at 16:08






  • 1





    The empty curly braces are there because $+$ (or $-$) are binary operators with a special spacing w.r.t. the elements on the right and on the left. This can be destroyed by an ampersand, and to compensate, one has to add an empty argument, namely {}. For the number of &, maybe I was not clear enough: each column of alignment, but the first, has to be introduced by an &. Inside this column, the alignment point is specified with another &. Check on my code, you should see this rule is respected. Is this clear?

    – Bernard
    Feb 21 at 16:26



















6














Something like this?



documentclass{article}
usepackage{tabstackengine}
begin{document}
[
left{
setstackgap{L}{18pt}
Matrixstack[r]{
alpha +& 2beta +& gamma =& 0 \
3alpha +& 7beta +& 5gamma =& 1
}
right.
]
end{document}


enter image description here






share|improve this answer































    4














    Here's a solution that requires only the basic array package. The following code also sets up a custom array-like environment.



    enter image description here



    documentclass{article}
    usepackage{array} % for "newcolumntype" macro
    newcolumntype{C}{>{{}}c<{{}}}
    %% set up a little custom enrironment:
    newenvironment{myarray}[1]{%
    setlengtharraycolsep{0pt}
    left{ begin{array}{#1}}{%
    end{array} right.}

    begin{document}
    [
    begin{myarray}{rCrCrCl}
    alpha &+& 2beta &+& gamma &=& 0 \
    3alpha &+& 7beta &+& 5gamma &=& 1
    end{myarray}
    ]
    end{document}





    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%2f476010%2faligning-systems-of-equations%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









      5














      First of all, do not use $$ ... $$, which is plain TeX, use the LaTeX construct [ ... ].



      Second, 4 alignment points require 7 ampersands, not 4: each new column of alignment has to be introduced by an ampersand. So n alignment points require 2n–1 ampersands.



      Last: use alignat (or alignedat) to have full control on the spacing between columns of alignment.



      Here is a possible code:



      [ left{
      begin{alignedat}{4}
      &alpha &{} + 2&beta + {} & &gamma & & = 0 \\
      3&alpha &{} + 7&beta + 5 & &gamma & & = 1
      end{alignedat}


      However, using the systeme package makes it simpler to type:



      [ systeme[alphabetagamma]{alpha + 2beta +gamma = 0, 3alpha + 7beta + 5gamma = 1} ]


      enter image description here






      share|improve this answer


























      • I had no idea that $ was plain TeX, thanks! Unfortunately it seems that for the Github Markdown I'm trying to edit, [ doesn't seem to work... But begin{alignedat}{4} end{alignedat} works perfectly!

        – Seankala
        Feb 21 at 15:36











      • I've updated with a simpler way to type (the systeme command from the homonymous package).

        – Bernard
        Feb 21 at 15:38






      • 1





        In your first method, the spacing around the = is not correct.

        – Steven B. Segletes
        Feb 21 at 15:42






      • 1





        amsldoc (amsmath documentation) and systeme. Feel free to ask any questions.

        – Bernard
        Feb 21 at 16:08






      • 1





        The empty curly braces are there because $+$ (or $-$) are binary operators with a special spacing w.r.t. the elements on the right and on the left. This can be destroyed by an ampersand, and to compensate, one has to add an empty argument, namely {}. For the number of &, maybe I was not clear enough: each column of alignment, but the first, has to be introduced by an &. Inside this column, the alignment point is specified with another &. Check on my code, you should see this rule is respected. Is this clear?

        – Bernard
        Feb 21 at 16:26
















      5














      First of all, do not use $$ ... $$, which is plain TeX, use the LaTeX construct [ ... ].



      Second, 4 alignment points require 7 ampersands, not 4: each new column of alignment has to be introduced by an ampersand. So n alignment points require 2n–1 ampersands.



      Last: use alignat (or alignedat) to have full control on the spacing between columns of alignment.



      Here is a possible code:



      [ left{
      begin{alignedat}{4}
      &alpha &{} + 2&beta + {} & &gamma & & = 0 \\
      3&alpha &{} + 7&beta + 5 & &gamma & & = 1
      end{alignedat}


      However, using the systeme package makes it simpler to type:



      [ systeme[alphabetagamma]{alpha + 2beta +gamma = 0, 3alpha + 7beta + 5gamma = 1} ]


      enter image description here






      share|improve this answer


























      • I had no idea that $ was plain TeX, thanks! Unfortunately it seems that for the Github Markdown I'm trying to edit, [ doesn't seem to work... But begin{alignedat}{4} end{alignedat} works perfectly!

        – Seankala
        Feb 21 at 15:36











      • I've updated with a simpler way to type (the systeme command from the homonymous package).

        – Bernard
        Feb 21 at 15:38






      • 1





        In your first method, the spacing around the = is not correct.

        – Steven B. Segletes
        Feb 21 at 15:42






      • 1





        amsldoc (amsmath documentation) and systeme. Feel free to ask any questions.

        – Bernard
        Feb 21 at 16:08






      • 1





        The empty curly braces are there because $+$ (or $-$) are binary operators with a special spacing w.r.t. the elements on the right and on the left. This can be destroyed by an ampersand, and to compensate, one has to add an empty argument, namely {}. For the number of &, maybe I was not clear enough: each column of alignment, but the first, has to be introduced by an &. Inside this column, the alignment point is specified with another &. Check on my code, you should see this rule is respected. Is this clear?

        – Bernard
        Feb 21 at 16:26














      5












      5








      5







      First of all, do not use $$ ... $$, which is plain TeX, use the LaTeX construct [ ... ].



      Second, 4 alignment points require 7 ampersands, not 4: each new column of alignment has to be introduced by an ampersand. So n alignment points require 2n–1 ampersands.



      Last: use alignat (or alignedat) to have full control on the spacing between columns of alignment.



      Here is a possible code:



      [ left{
      begin{alignedat}{4}
      &alpha &{} + 2&beta + {} & &gamma & & = 0 \\
      3&alpha &{} + 7&beta + 5 & &gamma & & = 1
      end{alignedat}


      However, using the systeme package makes it simpler to type:



      [ systeme[alphabetagamma]{alpha + 2beta +gamma = 0, 3alpha + 7beta + 5gamma = 1} ]


      enter image description here






      share|improve this answer















      First of all, do not use $$ ... $$, which is plain TeX, use the LaTeX construct [ ... ].



      Second, 4 alignment points require 7 ampersands, not 4: each new column of alignment has to be introduced by an ampersand. So n alignment points require 2n–1 ampersands.



      Last: use alignat (or alignedat) to have full control on the spacing between columns of alignment.



      Here is a possible code:



      [ left{
      begin{alignedat}{4}
      &alpha &{} + 2&beta + {} & &gamma & & = 0 \\
      3&alpha &{} + 7&beta + 5 & &gamma & & = 1
      end{alignedat}


      However, using the systeme package makes it simpler to type:



      [ systeme[alphabetagamma]{alpha + 2beta +gamma = 0, 3alpha + 7beta + 5gamma = 1} ]


      enter image description here







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Feb 21 at 17:18

























      answered Feb 21 at 15:23









      BernardBernard

      174k776206




      174k776206













      • I had no idea that $ was plain TeX, thanks! Unfortunately it seems that for the Github Markdown I'm trying to edit, [ doesn't seem to work... But begin{alignedat}{4} end{alignedat} works perfectly!

        – Seankala
        Feb 21 at 15:36











      • I've updated with a simpler way to type (the systeme command from the homonymous package).

        – Bernard
        Feb 21 at 15:38






      • 1





        In your first method, the spacing around the = is not correct.

        – Steven B. Segletes
        Feb 21 at 15:42






      • 1





        amsldoc (amsmath documentation) and systeme. Feel free to ask any questions.

        – Bernard
        Feb 21 at 16:08






      • 1





        The empty curly braces are there because $+$ (or $-$) are binary operators with a special spacing w.r.t. the elements on the right and on the left. This can be destroyed by an ampersand, and to compensate, one has to add an empty argument, namely {}. For the number of &, maybe I was not clear enough: each column of alignment, but the first, has to be introduced by an &. Inside this column, the alignment point is specified with another &. Check on my code, you should see this rule is respected. Is this clear?

        – Bernard
        Feb 21 at 16:26



















      • I had no idea that $ was plain TeX, thanks! Unfortunately it seems that for the Github Markdown I'm trying to edit, [ doesn't seem to work... But begin{alignedat}{4} end{alignedat} works perfectly!

        – Seankala
        Feb 21 at 15:36











      • I've updated with a simpler way to type (the systeme command from the homonymous package).

        – Bernard
        Feb 21 at 15:38






      • 1





        In your first method, the spacing around the = is not correct.

        – Steven B. Segletes
        Feb 21 at 15:42






      • 1





        amsldoc (amsmath documentation) and systeme. Feel free to ask any questions.

        – Bernard
        Feb 21 at 16:08






      • 1





        The empty curly braces are there because $+$ (or $-$) are binary operators with a special spacing w.r.t. the elements on the right and on the left. This can be destroyed by an ampersand, and to compensate, one has to add an empty argument, namely {}. For the number of &, maybe I was not clear enough: each column of alignment, but the first, has to be introduced by an &. Inside this column, the alignment point is specified with another &. Check on my code, you should see this rule is respected. Is this clear?

        – Bernard
        Feb 21 at 16:26

















      I had no idea that $ was plain TeX, thanks! Unfortunately it seems that for the Github Markdown I'm trying to edit, [ doesn't seem to work... But begin{alignedat}{4} end{alignedat} works perfectly!

      – Seankala
      Feb 21 at 15:36





      I had no idea that $ was plain TeX, thanks! Unfortunately it seems that for the Github Markdown I'm trying to edit, [ doesn't seem to work... But begin{alignedat}{4} end{alignedat} works perfectly!

      – Seankala
      Feb 21 at 15:36













      I've updated with a simpler way to type (the systeme command from the homonymous package).

      – Bernard
      Feb 21 at 15:38





      I've updated with a simpler way to type (the systeme command from the homonymous package).

      – Bernard
      Feb 21 at 15:38




      1




      1





      In your first method, the spacing around the = is not correct.

      – Steven B. Segletes
      Feb 21 at 15:42





      In your first method, the spacing around the = is not correct.

      – Steven B. Segletes
      Feb 21 at 15:42




      1




      1





      amsldoc (amsmath documentation) and systeme. Feel free to ask any questions.

      – Bernard
      Feb 21 at 16:08





      amsldoc (amsmath documentation) and systeme. Feel free to ask any questions.

      – Bernard
      Feb 21 at 16:08




      1




      1





      The empty curly braces are there because $+$ (or $-$) are binary operators with a special spacing w.r.t. the elements on the right and on the left. This can be destroyed by an ampersand, and to compensate, one has to add an empty argument, namely {}. For the number of &, maybe I was not clear enough: each column of alignment, but the first, has to be introduced by an &. Inside this column, the alignment point is specified with another &. Check on my code, you should see this rule is respected. Is this clear?

      – Bernard
      Feb 21 at 16:26





      The empty curly braces are there because $+$ (or $-$) are binary operators with a special spacing w.r.t. the elements on the right and on the left. This can be destroyed by an ampersand, and to compensate, one has to add an empty argument, namely {}. For the number of &, maybe I was not clear enough: each column of alignment, but the first, has to be introduced by an &. Inside this column, the alignment point is specified with another &. Check on my code, you should see this rule is respected. Is this clear?

      – Bernard
      Feb 21 at 16:26











      6














      Something like this?



      documentclass{article}
      usepackage{tabstackengine}
      begin{document}
      [
      left{
      setstackgap{L}{18pt}
      Matrixstack[r]{
      alpha +& 2beta +& gamma =& 0 \
      3alpha +& 7beta +& 5gamma =& 1
      }
      right.
      ]
      end{document}


      enter image description here






      share|improve this answer




























        6














        Something like this?



        documentclass{article}
        usepackage{tabstackengine}
        begin{document}
        [
        left{
        setstackgap{L}{18pt}
        Matrixstack[r]{
        alpha +& 2beta +& gamma =& 0 \
        3alpha +& 7beta +& 5gamma =& 1
        }
        right.
        ]
        end{document}


        enter image description here






        share|improve this answer


























          6












          6








          6







          Something like this?



          documentclass{article}
          usepackage{tabstackengine}
          begin{document}
          [
          left{
          setstackgap{L}{18pt}
          Matrixstack[r]{
          alpha +& 2beta +& gamma =& 0 \
          3alpha +& 7beta +& 5gamma =& 1
          }
          right.
          ]
          end{document}


          enter image description here






          share|improve this answer













          Something like this?



          documentclass{article}
          usepackage{tabstackengine}
          begin{document}
          [
          left{
          setstackgap{L}{18pt}
          Matrixstack[r]{
          alpha +& 2beta +& gamma =& 0 \
          3alpha +& 7beta +& 5gamma =& 1
          }
          right.
          ]
          end{document}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 21 at 15:23









          Steven B. SegletesSteven B. Segletes

          159k9204412




          159k9204412























              4














              Here's a solution that requires only the basic array package. The following code also sets up a custom array-like environment.



              enter image description here



              documentclass{article}
              usepackage{array} % for "newcolumntype" macro
              newcolumntype{C}{>{{}}c<{{}}}
              %% set up a little custom enrironment:
              newenvironment{myarray}[1]{%
              setlengtharraycolsep{0pt}
              left{ begin{array}{#1}}{%
              end{array} right.}

              begin{document}
              [
              begin{myarray}{rCrCrCl}
              alpha &+& 2beta &+& gamma &=& 0 \
              3alpha &+& 7beta &+& 5gamma &=& 1
              end{myarray}
              ]
              end{document}





              share|improve this answer






























                4














                Here's a solution that requires only the basic array package. The following code also sets up a custom array-like environment.



                enter image description here



                documentclass{article}
                usepackage{array} % for "newcolumntype" macro
                newcolumntype{C}{>{{}}c<{{}}}
                %% set up a little custom enrironment:
                newenvironment{myarray}[1]{%
                setlengtharraycolsep{0pt}
                left{ begin{array}{#1}}{%
                end{array} right.}

                begin{document}
                [
                begin{myarray}{rCrCrCl}
                alpha &+& 2beta &+& gamma &=& 0 \
                3alpha &+& 7beta &+& 5gamma &=& 1
                end{myarray}
                ]
                end{document}





                share|improve this answer




























                  4












                  4








                  4







                  Here's a solution that requires only the basic array package. The following code also sets up a custom array-like environment.



                  enter image description here



                  documentclass{article}
                  usepackage{array} % for "newcolumntype" macro
                  newcolumntype{C}{>{{}}c<{{}}}
                  %% set up a little custom enrironment:
                  newenvironment{myarray}[1]{%
                  setlengtharraycolsep{0pt}
                  left{ begin{array}{#1}}{%
                  end{array} right.}

                  begin{document}
                  [
                  begin{myarray}{rCrCrCl}
                  alpha &+& 2beta &+& gamma &=& 0 \
                  3alpha &+& 7beta &+& 5gamma &=& 1
                  end{myarray}
                  ]
                  end{document}





                  share|improve this answer















                  Here's a solution that requires only the basic array package. The following code also sets up a custom array-like environment.



                  enter image description here



                  documentclass{article}
                  usepackage{array} % for "newcolumntype" macro
                  newcolumntype{C}{>{{}}c<{{}}}
                  %% set up a little custom enrironment:
                  newenvironment{myarray}[1]{%
                  setlengtharraycolsep{0pt}
                  left{ begin{array}{#1}}{%
                  end{array} right.}

                  begin{document}
                  [
                  begin{myarray}{rCrCrCl}
                  alpha &+& 2beta &+& gamma &=& 0 \
                  3alpha &+& 7beta &+& 5gamma &=& 1
                  end{myarray}
                  ]
                  end{document}






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Feb 21 at 16:13

























                  answered Feb 21 at 15:44









                  MicoMico

                  284k31388778




                  284k31388778






























                      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%2f476010%2faligning-systems-of-equations%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 do I know what Microsoft account the skydrive app is syncing to?

                      When does type information flow backwards in C++?

                      Grease: Live!