alignat: removing the gap between the aligned variable and its coefficient












0















For the second equation, how can I remove the space between the aligned dot{x}_1 and its coefficient without abusing extra ampersands?



documentclass[10pt,a4paper]{article}
usepackage{mathtools}
begin{document}
begin{alignat*}{3}
dot{v}_1 &= -frac{k}{M_1} x_1 - frac{d_1+d_2}{M_1} &&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
%
dot{v}_2 &= frac{d_2}{M_2} &&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
end{alignat*}
end{document}


enter image description here










share|improve this question























  • By its coefficient do you mean frac{d_2}{M_2}?

    – Sigur
    Jan 16 at 20:36













  • @Sigur Yes.....

    – Diaa
    Jan 16 at 20:37
















0















For the second equation, how can I remove the space between the aligned dot{x}_1 and its coefficient without abusing extra ampersands?



documentclass[10pt,a4paper]{article}
usepackage{mathtools}
begin{document}
begin{alignat*}{3}
dot{v}_1 &= -frac{k}{M_1} x_1 - frac{d_1+d_2}{M_1} &&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
%
dot{v}_2 &= frac{d_2}{M_2} &&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
end{alignat*}
end{document}


enter image description here










share|improve this question























  • By its coefficient do you mean frac{d_2}{M_2}?

    – Sigur
    Jan 16 at 20:36













  • @Sigur Yes.....

    – Diaa
    Jan 16 at 20:37














0












0








0








For the second equation, how can I remove the space between the aligned dot{x}_1 and its coefficient without abusing extra ampersands?



documentclass[10pt,a4paper]{article}
usepackage{mathtools}
begin{document}
begin{alignat*}{3}
dot{v}_1 &= -frac{k}{M_1} x_1 - frac{d_1+d_2}{M_1} &&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
%
dot{v}_2 &= frac{d_2}{M_2} &&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
end{alignat*}
end{document}


enter image description here










share|improve this question














For the second equation, how can I remove the space between the aligned dot{x}_1 and its coefficient without abusing extra ampersands?



documentclass[10pt,a4paper]{article}
usepackage{mathtools}
begin{document}
begin{alignat*}{3}
dot{v}_1 &= -frac{k}{M_1} x_1 - frac{d_1+d_2}{M_1} &&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
%
dot{v}_2 &= frac{d_2}{M_2} &&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
end{alignat*}
end{document}


enter image description here







align alignat






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 16 at 20:33









DiaaDiaa

2,69711750




2,69711750













  • By its coefficient do you mean frac{d_2}{M_2}?

    – Sigur
    Jan 16 at 20:36













  • @Sigur Yes.....

    – Diaa
    Jan 16 at 20:37



















  • By its coefficient do you mean frac{d_2}{M_2}?

    – Sigur
    Jan 16 at 20:36













  • @Sigur Yes.....

    – Diaa
    Jan 16 at 20:37

















By its coefficient do you mean frac{d_2}{M_2}?

– Sigur
Jan 16 at 20:36







By its coefficient do you mean frac{d_2}{M_2}?

– Sigur
Jan 16 at 20:36















@Sigur Yes.....

– Diaa
Jan 16 at 20:37





@Sigur Yes.....

– Diaa
Jan 16 at 20:37










2 Answers
2






active

oldest

votes


















2














enter image description here



documentclass[10pt,a4paper]{article}
usepackage{mathtools}
begin{document}
begin{alignat*}{3}
dot{v}_1 &= -frac{k}{M_1} x_1 - &frac{d_1+d_2}{M_1} &dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
%
dot{v}_2 &= &frac{d_2}{M_2} &dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
end{alignat*}
end{document}





share|improve this answer
























  • I know it is a very basic question, but could you please tell me what is the difference between adding && and a single one &?

    – Diaa
    Jan 16 at 20:44






  • 1





    @Diaa the alignments are like tabular (it is the same tex halign command underneath) so it is a sequence of columns and x&& puts x in one column followed by a blank entry and &&x has a blank entry in one cell followed by x. the alignment is like begin{tabular}{rlrlrlrlrlrlrlrlrlr} so entries are left or right aligned depending which column they are in.

    – David Carlisle
    Jan 16 at 20:47













  • I highly appreciate your patience and consideration.

    – Diaa
    Jan 16 at 20:50













  • @DavidCarlisle, and what is the meaning of {3} ?

    – Sigur
    Jan 16 at 20:51






  • 1





    @Sigur it is the number of rl pairs in the alignment

    – David Carlisle
    Jan 16 at 20:57



















1














I propose one of these three variants – the last one with an extra pair of &:



documentclass[10pt,a4paper]{article}
usepackage{mathtools}

begin{document}

begin{alignat*}{3}
dot{v}_1 &= -frac{k}{M_1} x_1 &{} - frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
%
dot{v}_2 &= &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
end{alignat*}

begin{alignat*}{3}
dot{v}_1 &= -frac{k}{M_1} x_1 - {}& frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
%
dot{v}_2 &=phantom{-} frac{f}{M_2} +{} &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2
end{alignat*}

begin{alignat*}{4}
dot{v}_1 &= -frac{k}{M_1} x_1 & &{}- {}& frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
%
dot{v}_2 &=phantom{-} frac{f}{M_2} & & {} +{} &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2
end{alignat*}

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%2f470437%2falignat-removing-the-gap-between-the-aligned-variable-and-its-coefficient%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    enter image description here



    documentclass[10pt,a4paper]{article}
    usepackage{mathtools}
    begin{document}
    begin{alignat*}{3}
    dot{v}_1 &= -frac{k}{M_1} x_1 - &frac{d_1+d_2}{M_1} &dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
    %
    dot{v}_2 &= &frac{d_2}{M_2} &dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
    end{alignat*}
    end{document}





    share|improve this answer
























    • I know it is a very basic question, but could you please tell me what is the difference between adding && and a single one &?

      – Diaa
      Jan 16 at 20:44






    • 1





      @Diaa the alignments are like tabular (it is the same tex halign command underneath) so it is a sequence of columns and x&& puts x in one column followed by a blank entry and &&x has a blank entry in one cell followed by x. the alignment is like begin{tabular}{rlrlrlrlrlrlrlrlrlr} so entries are left or right aligned depending which column they are in.

      – David Carlisle
      Jan 16 at 20:47













    • I highly appreciate your patience and consideration.

      – Diaa
      Jan 16 at 20:50













    • @DavidCarlisle, and what is the meaning of {3} ?

      – Sigur
      Jan 16 at 20:51






    • 1





      @Sigur it is the number of rl pairs in the alignment

      – David Carlisle
      Jan 16 at 20:57
















    2














    enter image description here



    documentclass[10pt,a4paper]{article}
    usepackage{mathtools}
    begin{document}
    begin{alignat*}{3}
    dot{v}_1 &= -frac{k}{M_1} x_1 - &frac{d_1+d_2}{M_1} &dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
    %
    dot{v}_2 &= &frac{d_2}{M_2} &dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
    end{alignat*}
    end{document}





    share|improve this answer
























    • I know it is a very basic question, but could you please tell me what is the difference between adding && and a single one &?

      – Diaa
      Jan 16 at 20:44






    • 1





      @Diaa the alignments are like tabular (it is the same tex halign command underneath) so it is a sequence of columns and x&& puts x in one column followed by a blank entry and &&x has a blank entry in one cell followed by x. the alignment is like begin{tabular}{rlrlrlrlrlrlrlrlrlr} so entries are left or right aligned depending which column they are in.

      – David Carlisle
      Jan 16 at 20:47













    • I highly appreciate your patience and consideration.

      – Diaa
      Jan 16 at 20:50













    • @DavidCarlisle, and what is the meaning of {3} ?

      – Sigur
      Jan 16 at 20:51






    • 1





      @Sigur it is the number of rl pairs in the alignment

      – David Carlisle
      Jan 16 at 20:57














    2












    2








    2







    enter image description here



    documentclass[10pt,a4paper]{article}
    usepackage{mathtools}
    begin{document}
    begin{alignat*}{3}
    dot{v}_1 &= -frac{k}{M_1} x_1 - &frac{d_1+d_2}{M_1} &dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
    %
    dot{v}_2 &= &frac{d_2}{M_2} &dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
    end{alignat*}
    end{document}





    share|improve this answer













    enter image description here



    documentclass[10pt,a4paper]{article}
    usepackage{mathtools}
    begin{document}
    begin{alignat*}{3}
    dot{v}_1 &= -frac{k}{M_1} x_1 - &frac{d_1+d_2}{M_1} &dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
    %
    dot{v}_2 &= &frac{d_2}{M_2} &dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
    end{alignat*}
    end{document}






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 16 at 20:42









    David CarlisleDavid Carlisle

    487k4111231868




    487k4111231868













    • I know it is a very basic question, but could you please tell me what is the difference between adding && and a single one &?

      – Diaa
      Jan 16 at 20:44






    • 1





      @Diaa the alignments are like tabular (it is the same tex halign command underneath) so it is a sequence of columns and x&& puts x in one column followed by a blank entry and &&x has a blank entry in one cell followed by x. the alignment is like begin{tabular}{rlrlrlrlrlrlrlrlrlr} so entries are left or right aligned depending which column they are in.

      – David Carlisle
      Jan 16 at 20:47













    • I highly appreciate your patience and consideration.

      – Diaa
      Jan 16 at 20:50













    • @DavidCarlisle, and what is the meaning of {3} ?

      – Sigur
      Jan 16 at 20:51






    • 1





      @Sigur it is the number of rl pairs in the alignment

      – David Carlisle
      Jan 16 at 20:57



















    • I know it is a very basic question, but could you please tell me what is the difference between adding && and a single one &?

      – Diaa
      Jan 16 at 20:44






    • 1





      @Diaa the alignments are like tabular (it is the same tex halign command underneath) so it is a sequence of columns and x&& puts x in one column followed by a blank entry and &&x has a blank entry in one cell followed by x. the alignment is like begin{tabular}{rlrlrlrlrlrlrlrlrlr} so entries are left or right aligned depending which column they are in.

      – David Carlisle
      Jan 16 at 20:47













    • I highly appreciate your patience and consideration.

      – Diaa
      Jan 16 at 20:50













    • @DavidCarlisle, and what is the meaning of {3} ?

      – Sigur
      Jan 16 at 20:51






    • 1





      @Sigur it is the number of rl pairs in the alignment

      – David Carlisle
      Jan 16 at 20:57

















    I know it is a very basic question, but could you please tell me what is the difference between adding && and a single one &?

    – Diaa
    Jan 16 at 20:44





    I know it is a very basic question, but could you please tell me what is the difference between adding && and a single one &?

    – Diaa
    Jan 16 at 20:44




    1




    1





    @Diaa the alignments are like tabular (it is the same tex halign command underneath) so it is a sequence of columns and x&& puts x in one column followed by a blank entry and &&x has a blank entry in one cell followed by x. the alignment is like begin{tabular}{rlrlrlrlrlrlrlrlrlr} so entries are left or right aligned depending which column they are in.

    – David Carlisle
    Jan 16 at 20:47







    @Diaa the alignments are like tabular (it is the same tex halign command underneath) so it is a sequence of columns and x&& puts x in one column followed by a blank entry and &&x has a blank entry in one cell followed by x. the alignment is like begin{tabular}{rlrlrlrlrlrlrlrlrlr} so entries are left or right aligned depending which column they are in.

    – David Carlisle
    Jan 16 at 20:47















    I highly appreciate your patience and consideration.

    – Diaa
    Jan 16 at 20:50







    I highly appreciate your patience and consideration.

    – Diaa
    Jan 16 at 20:50















    @DavidCarlisle, and what is the meaning of {3} ?

    – Sigur
    Jan 16 at 20:51





    @DavidCarlisle, and what is the meaning of {3} ?

    – Sigur
    Jan 16 at 20:51




    1




    1





    @Sigur it is the number of rl pairs in the alignment

    – David Carlisle
    Jan 16 at 20:57





    @Sigur it is the number of rl pairs in the alignment

    – David Carlisle
    Jan 16 at 20:57











    1














    I propose one of these three variants – the last one with an extra pair of &:



    documentclass[10pt,a4paper]{article}
    usepackage{mathtools}

    begin{document}

    begin{alignat*}{3}
    dot{v}_1 &= -frac{k}{M_1} x_1 &{} - frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
    %
    dot{v}_2 &= &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
    end{alignat*}

    begin{alignat*}{3}
    dot{v}_1 &= -frac{k}{M_1} x_1 - {}& frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
    %
    dot{v}_2 &=phantom{-} frac{f}{M_2} +{} &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2
    end{alignat*}

    begin{alignat*}{4}
    dot{v}_1 &= -frac{k}{M_1} x_1 & &{}- {}& frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
    %
    dot{v}_2 &=phantom{-} frac{f}{M_2} & & {} +{} &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2
    end{alignat*}

    end{document}


    enter image description here






    share|improve this answer




























      1














      I propose one of these three variants – the last one with an extra pair of &:



      documentclass[10pt,a4paper]{article}
      usepackage{mathtools}

      begin{document}

      begin{alignat*}{3}
      dot{v}_1 &= -frac{k}{M_1} x_1 &{} - frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
      %
      dot{v}_2 &= &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
      end{alignat*}

      begin{alignat*}{3}
      dot{v}_1 &= -frac{k}{M_1} x_1 - {}& frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
      %
      dot{v}_2 &=phantom{-} frac{f}{M_2} +{} &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2
      end{alignat*}

      begin{alignat*}{4}
      dot{v}_1 &= -frac{k}{M_1} x_1 & &{}- {}& frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
      %
      dot{v}_2 &=phantom{-} frac{f}{M_2} & & {} +{} &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2
      end{alignat*}

      end{document}


      enter image description here






      share|improve this answer


























        1












        1








        1







        I propose one of these three variants – the last one with an extra pair of &:



        documentclass[10pt,a4paper]{article}
        usepackage{mathtools}

        begin{document}

        begin{alignat*}{3}
        dot{v}_1 &= -frac{k}{M_1} x_1 &{} - frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
        %
        dot{v}_2 &= &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
        end{alignat*}

        begin{alignat*}{3}
        dot{v}_1 &= -frac{k}{M_1} x_1 - {}& frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
        %
        dot{v}_2 &=phantom{-} frac{f}{M_2} +{} &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2
        end{alignat*}

        begin{alignat*}{4}
        dot{v}_1 &= -frac{k}{M_1} x_1 & &{}- {}& frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
        %
        dot{v}_2 &=phantom{-} frac{f}{M_2} & & {} +{} &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2
        end{alignat*}

        end{document}


        enter image description here






        share|improve this answer













        I propose one of these three variants – the last one with an extra pair of &:



        documentclass[10pt,a4paper]{article}
        usepackage{mathtools}

        begin{document}

        begin{alignat*}{3}
        dot{v}_1 &= -frac{k}{M_1} x_1 &{} - frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
        %
        dot{v}_2 &= &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2 + frac{f}{M_2}
        end{alignat*}

        begin{alignat*}{3}
        dot{v}_1 &= -frac{k}{M_1} x_1 - {}& frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
        %
        dot{v}_2 &=phantom{-} frac{f}{M_2} +{} &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2
        end{alignat*}

        begin{alignat*}{4}
        dot{v}_1 &= -frac{k}{M_1} x_1 & &{}- {}& frac{d_1+d_2}{M_1}&dot{x}_1 + frac{d_2}{M_1} &&dot{x}_2\
        %
        dot{v}_2 &=phantom{-} frac{f}{M_2} & & {} +{} &frac{d_2}{M_2}&dot{x}_1 - frac{d_2}{M_2} &&dot{x}_2
        end{alignat*}

        end{document}


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 16 at 20:52









        BernardBernard

        168k770195




        168k770195






























            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%2f470437%2falignat-removing-the-gap-between-the-aligned-variable-and-its-coefficient%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

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?