Aligning height-differing equation lines in tabularx

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I have the following array of equations produced by tabularx, in which I want the rows in the left and right panels to be aligned such that they look like they're written on the same line of binder paper, for example. But since the equations are apparently aligned at the very top, the tall summand symbols in the right panel lead to the following aesthetic horror:



enter image description here



How can I fix the alignment? A MWE appears below.



documentclassarticle
usepackage[utf8]inputenc
usepackageamsmath
usepackagetabularx

begindocument

begintabularx0.5textwidthXX
beginalign*
X_n1^(j) &:= X_n1\
&vdots \
X_nC^(j) &:= X_nC
endalign*
&
beginalign*
Y_n1 &:= widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\
&vdots \
Y_nW &:= widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
endalign*
endtabularx

enddocument






share|improve this question
















  • 1




    Why do you need tabularx here?
    – Werner
    Aug 29 at 21:02














up vote
3
down vote

favorite












I have the following array of equations produced by tabularx, in which I want the rows in the left and right panels to be aligned such that they look like they're written on the same line of binder paper, for example. But since the equations are apparently aligned at the very top, the tall summand symbols in the right panel lead to the following aesthetic horror:



enter image description here



How can I fix the alignment? A MWE appears below.



documentclassarticle
usepackage[utf8]inputenc
usepackageamsmath
usepackagetabularx

begindocument

begintabularx0.5textwidthXX
beginalign*
X_n1^(j) &:= X_n1\
&vdots \
X_nC^(j) &:= X_nC
endalign*
&
beginalign*
Y_n1 &:= widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\
&vdots \
Y_nW &:= widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
endalign*
endtabularx

enddocument






share|improve this question
















  • 1




    Why do you need tabularx here?
    – Werner
    Aug 29 at 21:02












up vote
3
down vote

favorite









up vote
3
down vote

favorite











I have the following array of equations produced by tabularx, in which I want the rows in the left and right panels to be aligned such that they look like they're written on the same line of binder paper, for example. But since the equations are apparently aligned at the very top, the tall summand symbols in the right panel lead to the following aesthetic horror:



enter image description here



How can I fix the alignment? A MWE appears below.



documentclassarticle
usepackage[utf8]inputenc
usepackageamsmath
usepackagetabularx

begindocument

begintabularx0.5textwidthXX
beginalign*
X_n1^(j) &:= X_n1\
&vdots \
X_nC^(j) &:= X_nC
endalign*
&
beginalign*
Y_n1 &:= widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\
&vdots \
Y_nW &:= widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
endalign*
endtabularx

enddocument






share|improve this question












I have the following array of equations produced by tabularx, in which I want the rows in the left and right panels to be aligned such that they look like they're written on the same line of binder paper, for example. But since the equations are apparently aligned at the very top, the tall summand symbols in the right panel lead to the following aesthetic horror:



enter image description here



How can I fix the alignment? A MWE appears below.



documentclassarticle
usepackage[utf8]inputenc
usepackageamsmath
usepackagetabularx

begindocument

begintabularx0.5textwidthXX
beginalign*
X_n1^(j) &:= X_n1\
&vdots \
X_nC^(j) &:= X_nC
endalign*
&
beginalign*
Y_n1 &:= widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\
&vdots \
Y_nW &:= widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
endalign*
endtabularx

enddocument








share|improve this question











share|improve this question




share|improve this question










asked Aug 29 at 20:42









half-pass

1183




1183







  • 1




    Why do you need tabularx here?
    – Werner
    Aug 29 at 21:02












  • 1




    Why do you need tabularx here?
    – Werner
    Aug 29 at 21:02







1




1




Why do you need tabularx here?
– Werner
Aug 29 at 21:02




Why do you need tabularx here?
– Werner
Aug 29 at 21:02










3 Answers
3






active

oldest

votes

















up vote
4
down vote



accepted










As I don't understand why you use a tabularx environment for your equations, except perhaps to have the whole alignment near the left margin, I propose this very simple solution with alignat2, which displays two columns of alignment, with a controllable space between them. To have them near the leftmargin, I used the fleqn environment from nccmath (remove it if you want the equations be centred), and added some improvements from mathtools. In particular, coloneqq which provides a :=, with the colon centred on the maths axis, and vertical dots centred w.r.t. :=:



documentclassarticle
usepackage[utf8]inputenc
usepackagemathtools, nccmath

begindocument

Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
beginfleqn[2em]
beginalignat*2
X_n1^(j) &coloneqq X_n1
&qquad Y_n1 &coloneqq widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\[-1ex]
&vdotswithincoloneqq & & vdotswithincoloneqq \[-1ex]
X_nC^(j) &coloneqq X_nC
& Y_nW &coloneqq widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
endalignat*
endfleqn

enddocument


enter image description here






share|improve this answer





























    up vote
    5
    down vote













    I'm not sure what's the need of tabularx in this case:



    documentclassarticle
    usepackageamsmath,mathtools

    begindocument

    beginalign*
    X_n1^(j) &coloneqq X_n1
    &
    Y_n1 &coloneqq widehatalpha_11 +
    sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1
    \[-3ex]
    &vdotswithincoloneqq & &vdotswithincoloneqq
    \[-2ex]
    X_nC^(j) &coloneqq X_nC
    &
    Y_nW &:= widehatalpha_1W +
    sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
    endalign*

    enddocument


    enter image description here






    share|improve this answer




















    • You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
      – half-pass
      Aug 29 at 21:45

















    up vote
    4
    down vote













    A quick fix using vphantom.



    This creates a 'phantom' zero width box with a vertical height equal to the size of sum_j=3^C.



    enter image description here



    documentclassarticle
    usepackage[utf8]inputenc
    usepackageamsmath
    usepackagetabularx

    begindocument

    begintabularx0.5textwidthXX
    beginalign*
    X_n1^(j) &:= X_n1 vphantomsum_j=3^C\
    &vdots \
    X_nC^(j) &:= X_nC vphantomsum_j=3^C
    endalign*
    &
    beginalign*
    Y_n1 &:= widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\
    &vdots \
    Y_nW &:= widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
    endalign*
    endtabularx

    enddocument





    share|improve this answer






















    • You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
      – half-pass
      Aug 29 at 21:46










    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',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    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%2f448400%2faligning-height-differing-equation-lines-in-tabularx%23new-answer', 'question_page');

    );

    Post as a guest






























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    4
    down vote



    accepted










    As I don't understand why you use a tabularx environment for your equations, except perhaps to have the whole alignment near the left margin, I propose this very simple solution with alignat2, which displays two columns of alignment, with a controllable space between them. To have them near the leftmargin, I used the fleqn environment from nccmath (remove it if you want the equations be centred), and added some improvements from mathtools. In particular, coloneqq which provides a :=, with the colon centred on the maths axis, and vertical dots centred w.r.t. :=:



    documentclassarticle
    usepackage[utf8]inputenc
    usepackagemathtools, nccmath

    begindocument

    Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
    beginfleqn[2em]
    beginalignat*2
    X_n1^(j) &coloneqq X_n1
    &qquad Y_n1 &coloneqq widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\[-1ex]
    &vdotswithincoloneqq & & vdotswithincoloneqq \[-1ex]
    X_nC^(j) &coloneqq X_nC
    & Y_nW &coloneqq widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
    endalignat*
    endfleqn

    enddocument


    enter image description here






    share|improve this answer


























      up vote
      4
      down vote



      accepted










      As I don't understand why you use a tabularx environment for your equations, except perhaps to have the whole alignment near the left margin, I propose this very simple solution with alignat2, which displays two columns of alignment, with a controllable space between them. To have them near the leftmargin, I used the fleqn environment from nccmath (remove it if you want the equations be centred), and added some improvements from mathtools. In particular, coloneqq which provides a :=, with the colon centred on the maths axis, and vertical dots centred w.r.t. :=:



      documentclassarticle
      usepackage[utf8]inputenc
      usepackagemathtools, nccmath

      begindocument

      Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
      beginfleqn[2em]
      beginalignat*2
      X_n1^(j) &coloneqq X_n1
      &qquad Y_n1 &coloneqq widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\[-1ex]
      &vdotswithincoloneqq & & vdotswithincoloneqq \[-1ex]
      X_nC^(j) &coloneqq X_nC
      & Y_nW &coloneqq widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
      endalignat*
      endfleqn

      enddocument


      enter image description here






      share|improve this answer
























        up vote
        4
        down vote



        accepted







        up vote
        4
        down vote



        accepted






        As I don't understand why you use a tabularx environment for your equations, except perhaps to have the whole alignment near the left margin, I propose this very simple solution with alignat2, which displays two columns of alignment, with a controllable space between them. To have them near the leftmargin, I used the fleqn environment from nccmath (remove it if you want the equations be centred), and added some improvements from mathtools. In particular, coloneqq which provides a :=, with the colon centred on the maths axis, and vertical dots centred w.r.t. :=:



        documentclassarticle
        usepackage[utf8]inputenc
        usepackagemathtools, nccmath

        begindocument

        Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
        beginfleqn[2em]
        beginalignat*2
        X_n1^(j) &coloneqq X_n1
        &qquad Y_n1 &coloneqq widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\[-1ex]
        &vdotswithincoloneqq & & vdotswithincoloneqq \[-1ex]
        X_nC^(j) &coloneqq X_nC
        & Y_nW &coloneqq widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
        endalignat*
        endfleqn

        enddocument


        enter image description here






        share|improve this answer














        As I don't understand why you use a tabularx environment for your equations, except perhaps to have the whole alignment near the left margin, I propose this very simple solution with alignat2, which displays two columns of alignment, with a controllable space between them. To have them near the leftmargin, I used the fleqn environment from nccmath (remove it if you want the equations be centred), and added some improvements from mathtools. In particular, coloneqq which provides a :=, with the colon centred on the maths axis, and vertical dots centred w.r.t. :=:



        documentclassarticle
        usepackage[utf8]inputenc
        usepackagemathtools, nccmath

        begindocument

        Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
        beginfleqn[2em]
        beginalignat*2
        X_n1^(j) &coloneqq X_n1
        &qquad Y_n1 &coloneqq widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\[-1ex]
        &vdotswithincoloneqq & & vdotswithincoloneqq \[-1ex]
        X_nC^(j) &coloneqq X_nC
        & Y_nW &coloneqq widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
        endalignat*
        endfleqn

        enddocument


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Aug 29 at 23:25









        Al-Motasem Aldaoudeyeh

        1,155211




        1,155211










        answered Aug 29 at 21:21









        Bernard

        156k763189




        156k763189




















            up vote
            5
            down vote













            I'm not sure what's the need of tabularx in this case:



            documentclassarticle
            usepackageamsmath,mathtools

            begindocument

            beginalign*
            X_n1^(j) &coloneqq X_n1
            &
            Y_n1 &coloneqq widehatalpha_11 +
            sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1
            \[-3ex]
            &vdotswithincoloneqq & &vdotswithincoloneqq
            \[-2ex]
            X_nC^(j) &coloneqq X_nC
            &
            Y_nW &:= widehatalpha_1W +
            sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
            endalign*

            enddocument


            enter image description here






            share|improve this answer




















            • You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
              – half-pass
              Aug 29 at 21:45














            up vote
            5
            down vote













            I'm not sure what's the need of tabularx in this case:



            documentclassarticle
            usepackageamsmath,mathtools

            begindocument

            beginalign*
            X_n1^(j) &coloneqq X_n1
            &
            Y_n1 &coloneqq widehatalpha_11 +
            sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1
            \[-3ex]
            &vdotswithincoloneqq & &vdotswithincoloneqq
            \[-2ex]
            X_nC^(j) &coloneqq X_nC
            &
            Y_nW &:= widehatalpha_1W +
            sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
            endalign*

            enddocument


            enter image description here






            share|improve this answer




















            • You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
              – half-pass
              Aug 29 at 21:45












            up vote
            5
            down vote










            up vote
            5
            down vote









            I'm not sure what's the need of tabularx in this case:



            documentclassarticle
            usepackageamsmath,mathtools

            begindocument

            beginalign*
            X_n1^(j) &coloneqq X_n1
            &
            Y_n1 &coloneqq widehatalpha_11 +
            sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1
            \[-3ex]
            &vdotswithincoloneqq & &vdotswithincoloneqq
            \[-2ex]
            X_nC^(j) &coloneqq X_nC
            &
            Y_nW &:= widehatalpha_1W +
            sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
            endalign*

            enddocument


            enter image description here






            share|improve this answer












            I'm not sure what's the need of tabularx in this case:



            documentclassarticle
            usepackageamsmath,mathtools

            begindocument

            beginalign*
            X_n1^(j) &coloneqq X_n1
            &
            Y_n1 &coloneqq widehatalpha_11 +
            sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1
            \[-3ex]
            &vdotswithincoloneqq & &vdotswithincoloneqq
            \[-2ex]
            X_nC^(j) &coloneqq X_nC
            &
            Y_nW &:= widehatalpha_1W +
            sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
            endalign*

            enddocument


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 29 at 21:41









            egreg

            680k8318083056




            680k8318083056











            • You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
              – half-pass
              Aug 29 at 21:45
















            • You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
              – half-pass
              Aug 29 at 21:45















            You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
            – half-pass
            Aug 29 at 21:45




            You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
            – half-pass
            Aug 29 at 21:45










            up vote
            4
            down vote













            A quick fix using vphantom.



            This creates a 'phantom' zero width box with a vertical height equal to the size of sum_j=3^C.



            enter image description here



            documentclassarticle
            usepackage[utf8]inputenc
            usepackageamsmath
            usepackagetabularx

            begindocument

            begintabularx0.5textwidthXX
            beginalign*
            X_n1^(j) &:= X_n1 vphantomsum_j=3^C\
            &vdots \
            X_nC^(j) &:= X_nC vphantomsum_j=3^C
            endalign*
            &
            beginalign*
            Y_n1 &:= widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\
            &vdots \
            Y_nW &:= widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
            endalign*
            endtabularx

            enddocument





            share|improve this answer






















            • You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
              – half-pass
              Aug 29 at 21:46














            up vote
            4
            down vote













            A quick fix using vphantom.



            This creates a 'phantom' zero width box with a vertical height equal to the size of sum_j=3^C.



            enter image description here



            documentclassarticle
            usepackage[utf8]inputenc
            usepackageamsmath
            usepackagetabularx

            begindocument

            begintabularx0.5textwidthXX
            beginalign*
            X_n1^(j) &:= X_n1 vphantomsum_j=3^C\
            &vdots \
            X_nC^(j) &:= X_nC vphantomsum_j=3^C
            endalign*
            &
            beginalign*
            Y_n1 &:= widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\
            &vdots \
            Y_nW &:= widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
            endalign*
            endtabularx

            enddocument





            share|improve this answer






















            • You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
              – half-pass
              Aug 29 at 21:46












            up vote
            4
            down vote










            up vote
            4
            down vote









            A quick fix using vphantom.



            This creates a 'phantom' zero width box with a vertical height equal to the size of sum_j=3^C.



            enter image description here



            documentclassarticle
            usepackage[utf8]inputenc
            usepackageamsmath
            usepackagetabularx

            begindocument

            begintabularx0.5textwidthXX
            beginalign*
            X_n1^(j) &:= X_n1 vphantomsum_j=3^C\
            &vdots \
            X_nC^(j) &:= X_nC vphantomsum_j=3^C
            endalign*
            &
            beginalign*
            Y_n1 &:= widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\
            &vdots \
            Y_nW &:= widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
            endalign*
            endtabularx

            enddocument





            share|improve this answer














            A quick fix using vphantom.



            This creates a 'phantom' zero width box with a vertical height equal to the size of sum_j=3^C.



            enter image description here



            documentclassarticle
            usepackage[utf8]inputenc
            usepackageamsmath
            usepackagetabularx

            begindocument

            begintabularx0.5textwidthXX
            beginalign*
            X_n1^(j) &:= X_n1 vphantomsum_j=3^C\
            &vdots \
            X_nC^(j) &:= X_nC vphantomsum_j=3^C
            endalign*
            &
            beginalign*
            Y_n1 &:= widehatalpha_11 + sum_j=3^C widehatalpha_j1 X_nj + epsilon_n1\
            &vdots \
            Y_nW &:= widehatalpha_1W + sum_j=3^C widehatalpha_jW X_nj + epsilon_nW
            endalign*
            endtabularx

            enddocument






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 29 at 20:56

























            answered Aug 29 at 20:49









            Milo

            5,51321345




            5,51321345











            • You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
              – half-pass
              Aug 29 at 21:46
















            • You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
              – half-pass
              Aug 29 at 21:46















            You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
            – half-pass
            Aug 29 at 21:46




            You are absolutely right. In the presence of multiple correct answers, I'm accepting Bernard's since it was the first chronologically. Thanks.
            – half-pass
            Aug 29 at 21:46

















             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f448400%2faligning-height-differing-equation-lines-in-tabularx%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            Long meetings (6-7 hours a day): Being “babysat” by supervisor

            Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

            Confectionery