Force placement of sum operands over index











up vote
7
down vote

favorite












I want to force the operands of a sum to be placed above an "extended" (longer than usual) index, instead of increasing the width of the sum (in the example, see the sums in (2), which are much wider than in (1), because of the different index). I need this for space reasons, the formula is bigger than in the MWE. Do you have any ideas how to achieve this?



enter image description here



documentclass[12pt]{article}
usepackage{amsmath}

begin{document}

begin{align}
text{textbf{Total Cost }}
&= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
&= sum_{i in {m | Z_m = 1}} 10,000 + sum_{j in {k | K_m = 1}}
7,000
end{align}

end{document}









share|improve this question






















  • Did you try mathclap from mathtools?
    – nidhin
    Nov 17 at 19:59















up vote
7
down vote

favorite












I want to force the operands of a sum to be placed above an "extended" (longer than usual) index, instead of increasing the width of the sum (in the example, see the sums in (2), which are much wider than in (1), because of the different index). I need this for space reasons, the formula is bigger than in the MWE. Do you have any ideas how to achieve this?



enter image description here



documentclass[12pt]{article}
usepackage{amsmath}

begin{document}

begin{align}
text{textbf{Total Cost }}
&= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
&= sum_{i in {m | Z_m = 1}} 10,000 + sum_{j in {k | K_m = 1}}
7,000
end{align}

end{document}









share|improve this question






















  • Did you try mathclap from mathtools?
    – nidhin
    Nov 17 at 19:59













up vote
7
down vote

favorite









up vote
7
down vote

favorite











I want to force the operands of a sum to be placed above an "extended" (longer than usual) index, instead of increasing the width of the sum (in the example, see the sums in (2), which are much wider than in (1), because of the different index). I need this for space reasons, the formula is bigger than in the MWE. Do you have any ideas how to achieve this?



enter image description here



documentclass[12pt]{article}
usepackage{amsmath}

begin{document}

begin{align}
text{textbf{Total Cost }}
&= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
&= sum_{i in {m | Z_m = 1}} 10,000 + sum_{j in {k | K_m = 1}}
7,000
end{align}

end{document}









share|improve this question













I want to force the operands of a sum to be placed above an "extended" (longer than usual) index, instead of increasing the width of the sum (in the example, see the sums in (2), which are much wider than in (1), because of the different index). I need this for space reasons, the formula is bigger than in the MWE. Do you have any ideas how to achieve this?



enter image description here



documentclass[12pt]{article}
usepackage{amsmath}

begin{document}

begin{align}
text{textbf{Total Cost }}
&= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
&= sum_{i in {m | Z_m = 1}} 10,000 + sum_{j in {k | K_m = 1}}
7,000
end{align}

end{document}






amsmath






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 17 at 19:54









ncw

1704




1704












  • Did you try mathclap from mathtools?
    – nidhin
    Nov 17 at 19:59


















  • Did you try mathclap from mathtools?
    – nidhin
    Nov 17 at 19:59
















Did you try mathclap from mathtools?
– nidhin
Nov 17 at 19:59




Did you try mathclap from mathtools?
– nidhin
Nov 17 at 19:59










3 Answers
3






active

oldest

votes

















up vote
8
down vote



accepted










Use mathclap from mathtools package.



documentclass[12pt]{article}
%usepackage{amsmath}
usepackage{mathtools}

begin{document}
begin{align}
text{textbf{Total Cost }}
&= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
&= sum_{mathclap{i in {m | Z_m = 1}}} 10,000 + sum_{mathclap{j in {k | K_m = 1}} }
7,000
end{align}
end{document}


enter image description here






share|improve this answer






























    up vote
    8
    down vote













    mathtools loads amsmath.



    enter image description here



    documentclass[12pt]{article}
    usepackage{mathtools}

    begin{document}

    begin{align}
    textbf{Total Cost} % no trailing space inside braces
    &= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
    &= sum_{mathclap{i in {m, | , Z_m = 1}}} 10,000 + sum_{mathclap{j in {k, | , K_m = 1}}} 7,000
    end{align}

    end{document}





    share|improve this answer



















    • 1




      few seconds .. :)
      – nidhin
      Nov 17 at 20:03










    • Hi Sigur, I accepted @nidhin's answer, since he commented 3 minutes before posting his own answer and thus was a little faster. Thanks very much though for the quick and helpful answer, I appreciate the effort!
      – ncw
      Nov 17 at 20:12








    • 1




      @ncw, no problem. Just pay attention in my comments on trailing spaces. Also, only textbf is enough.
      – Sigur
      Nov 17 at 20:15


















    up vote
    7
    down vote













    A variant, with the smashoperator command from mathtools – and some improvements with siunitx, so the comma separator in numbers doesn't add a space.



    smashoperator can take an optional argument, [l] or [r] which are equivalent to mathlap or mathrlap respectively. I demonstrate it in a $3$rd equation:



    documentclass[12pt]{article}
    usepackage{mathtools}
    usepackage{siunitx}

    begin{document}

    sisetup{group-digits = integer, group-separator={,}, group-minimum-digits = 4}
    begin{align}
    textbf{Total Cost} % no trailing space inside braces
    &= sum_{m=1}^{55} num{10000} cdot Z_m + num{7000} cdot K_m \
    &= smashoperator{sum_{i in {mmid Z_m = 1}}}num{10000} + smashoperator{sum_{j in {kmid K_m = 1}}} num{7000} \
    &= smashoperator[r]{sum_{i in {mmid Z_m = 1}}} num{10000} + smashoperator[l]{sum_{j in {kmid K_m = 1}}} num{7000}
    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',
      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%2f460496%2fforce-placement-of-sum-operands-over-index%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








      up vote
      8
      down vote



      accepted










      Use mathclap from mathtools package.



      documentclass[12pt]{article}
      %usepackage{amsmath}
      usepackage{mathtools}

      begin{document}
      begin{align}
      text{textbf{Total Cost }}
      &= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
      &= sum_{mathclap{i in {m | Z_m = 1}}} 10,000 + sum_{mathclap{j in {k | K_m = 1}} }
      7,000
      end{align}
      end{document}


      enter image description here






      share|improve this answer



























        up vote
        8
        down vote



        accepted










        Use mathclap from mathtools package.



        documentclass[12pt]{article}
        %usepackage{amsmath}
        usepackage{mathtools}

        begin{document}
        begin{align}
        text{textbf{Total Cost }}
        &= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
        &= sum_{mathclap{i in {m | Z_m = 1}}} 10,000 + sum_{mathclap{j in {k | K_m = 1}} }
        7,000
        end{align}
        end{document}


        enter image description here






        share|improve this answer

























          up vote
          8
          down vote



          accepted







          up vote
          8
          down vote



          accepted






          Use mathclap from mathtools package.



          documentclass[12pt]{article}
          %usepackage{amsmath}
          usepackage{mathtools}

          begin{document}
          begin{align}
          text{textbf{Total Cost }}
          &= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
          &= sum_{mathclap{i in {m | Z_m = 1}}} 10,000 + sum_{mathclap{j in {k | K_m = 1}} }
          7,000
          end{align}
          end{document}


          enter image description here






          share|improve this answer














          Use mathclap from mathtools package.



          documentclass[12pt]{article}
          %usepackage{amsmath}
          usepackage{mathtools}

          begin{document}
          begin{align}
          text{textbf{Total Cost }}
          &= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
          &= sum_{mathclap{i in {m | Z_m = 1}}} 10,000 + sum_{mathclap{j in {k | K_m = 1}} }
          7,000
          end{align}
          end{document}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 17 at 20:13

























          answered Nov 17 at 20:02









          nidhin

          1,530920




          1,530920






















              up vote
              8
              down vote













              mathtools loads amsmath.



              enter image description here



              documentclass[12pt]{article}
              usepackage{mathtools}

              begin{document}

              begin{align}
              textbf{Total Cost} % no trailing space inside braces
              &= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
              &= sum_{mathclap{i in {m, | , Z_m = 1}}} 10,000 + sum_{mathclap{j in {k, | , K_m = 1}}} 7,000
              end{align}

              end{document}





              share|improve this answer



















              • 1




                few seconds .. :)
                – nidhin
                Nov 17 at 20:03










              • Hi Sigur, I accepted @nidhin's answer, since he commented 3 minutes before posting his own answer and thus was a little faster. Thanks very much though for the quick and helpful answer, I appreciate the effort!
                – ncw
                Nov 17 at 20:12








              • 1




                @ncw, no problem. Just pay attention in my comments on trailing spaces. Also, only textbf is enough.
                – Sigur
                Nov 17 at 20:15















              up vote
              8
              down vote













              mathtools loads amsmath.



              enter image description here



              documentclass[12pt]{article}
              usepackage{mathtools}

              begin{document}

              begin{align}
              textbf{Total Cost} % no trailing space inside braces
              &= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
              &= sum_{mathclap{i in {m, | , Z_m = 1}}} 10,000 + sum_{mathclap{j in {k, | , K_m = 1}}} 7,000
              end{align}

              end{document}





              share|improve this answer



















              • 1




                few seconds .. :)
                – nidhin
                Nov 17 at 20:03










              • Hi Sigur, I accepted @nidhin's answer, since he commented 3 minutes before posting his own answer and thus was a little faster. Thanks very much though for the quick and helpful answer, I appreciate the effort!
                – ncw
                Nov 17 at 20:12








              • 1




                @ncw, no problem. Just pay attention in my comments on trailing spaces. Also, only textbf is enough.
                – Sigur
                Nov 17 at 20:15













              up vote
              8
              down vote










              up vote
              8
              down vote









              mathtools loads amsmath.



              enter image description here



              documentclass[12pt]{article}
              usepackage{mathtools}

              begin{document}

              begin{align}
              textbf{Total Cost} % no trailing space inside braces
              &= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
              &= sum_{mathclap{i in {m, | , Z_m = 1}}} 10,000 + sum_{mathclap{j in {k, | , K_m = 1}}} 7,000
              end{align}

              end{document}





              share|improve this answer














              mathtools loads amsmath.



              enter image description here



              documentclass[12pt]{article}
              usepackage{mathtools}

              begin{document}

              begin{align}
              textbf{Total Cost} % no trailing space inside braces
              &= sum_{m=1}^{55} 10,000 cdot Z_m + 7,000 cdot K_m \
              &= sum_{mathclap{i in {m, | , Z_m = 1}}} 10,000 + sum_{mathclap{j in {k, | , K_m = 1}}} 7,000
              end{align}

              end{document}






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Nov 17 at 20:11

























              answered Nov 17 at 20:02









              Sigur

              23.3k353135




              23.3k353135








              • 1




                few seconds .. :)
                – nidhin
                Nov 17 at 20:03










              • Hi Sigur, I accepted @nidhin's answer, since he commented 3 minutes before posting his own answer and thus was a little faster. Thanks very much though for the quick and helpful answer, I appreciate the effort!
                – ncw
                Nov 17 at 20:12








              • 1




                @ncw, no problem. Just pay attention in my comments on trailing spaces. Also, only textbf is enough.
                – Sigur
                Nov 17 at 20:15














              • 1




                few seconds .. :)
                – nidhin
                Nov 17 at 20:03










              • Hi Sigur, I accepted @nidhin's answer, since he commented 3 minutes before posting his own answer and thus was a little faster. Thanks very much though for the quick and helpful answer, I appreciate the effort!
                – ncw
                Nov 17 at 20:12








              • 1




                @ncw, no problem. Just pay attention in my comments on trailing spaces. Also, only textbf is enough.
                – Sigur
                Nov 17 at 20:15








              1




              1




              few seconds .. :)
              – nidhin
              Nov 17 at 20:03




              few seconds .. :)
              – nidhin
              Nov 17 at 20:03












              Hi Sigur, I accepted @nidhin's answer, since he commented 3 minutes before posting his own answer and thus was a little faster. Thanks very much though for the quick and helpful answer, I appreciate the effort!
              – ncw
              Nov 17 at 20:12






              Hi Sigur, I accepted @nidhin's answer, since he commented 3 minutes before posting his own answer and thus was a little faster. Thanks very much though for the quick and helpful answer, I appreciate the effort!
              – ncw
              Nov 17 at 20:12






              1




              1




              @ncw, no problem. Just pay attention in my comments on trailing spaces. Also, only textbf is enough.
              – Sigur
              Nov 17 at 20:15




              @ncw, no problem. Just pay attention in my comments on trailing spaces. Also, only textbf is enough.
              – Sigur
              Nov 17 at 20:15










              up vote
              7
              down vote













              A variant, with the smashoperator command from mathtools – and some improvements with siunitx, so the comma separator in numbers doesn't add a space.



              smashoperator can take an optional argument, [l] or [r] which are equivalent to mathlap or mathrlap respectively. I demonstrate it in a $3$rd equation:



              documentclass[12pt]{article}
              usepackage{mathtools}
              usepackage{siunitx}

              begin{document}

              sisetup{group-digits = integer, group-separator={,}, group-minimum-digits = 4}
              begin{align}
              textbf{Total Cost} % no trailing space inside braces
              &= sum_{m=1}^{55} num{10000} cdot Z_m + num{7000} cdot K_m \
              &= smashoperator{sum_{i in {mmid Z_m = 1}}}num{10000} + smashoperator{sum_{j in {kmid K_m = 1}}} num{7000} \
              &= smashoperator[r]{sum_{i in {mmid Z_m = 1}}} num{10000} + smashoperator[l]{sum_{j in {kmid K_m = 1}}} num{7000}
              end{align}

              end{document}


              enter image description here






              share|improve this answer



























                up vote
                7
                down vote













                A variant, with the smashoperator command from mathtools – and some improvements with siunitx, so the comma separator in numbers doesn't add a space.



                smashoperator can take an optional argument, [l] or [r] which are equivalent to mathlap or mathrlap respectively. I demonstrate it in a $3$rd equation:



                documentclass[12pt]{article}
                usepackage{mathtools}
                usepackage{siunitx}

                begin{document}

                sisetup{group-digits = integer, group-separator={,}, group-minimum-digits = 4}
                begin{align}
                textbf{Total Cost} % no trailing space inside braces
                &= sum_{m=1}^{55} num{10000} cdot Z_m + num{7000} cdot K_m \
                &= smashoperator{sum_{i in {mmid Z_m = 1}}}num{10000} + smashoperator{sum_{j in {kmid K_m = 1}}} num{7000} \
                &= smashoperator[r]{sum_{i in {mmid Z_m = 1}}} num{10000} + smashoperator[l]{sum_{j in {kmid K_m = 1}}} num{7000}
                end{align}

                end{document}


                enter image description here






                share|improve this answer

























                  up vote
                  7
                  down vote










                  up vote
                  7
                  down vote









                  A variant, with the smashoperator command from mathtools – and some improvements with siunitx, so the comma separator in numbers doesn't add a space.



                  smashoperator can take an optional argument, [l] or [r] which are equivalent to mathlap or mathrlap respectively. I demonstrate it in a $3$rd equation:



                  documentclass[12pt]{article}
                  usepackage{mathtools}
                  usepackage{siunitx}

                  begin{document}

                  sisetup{group-digits = integer, group-separator={,}, group-minimum-digits = 4}
                  begin{align}
                  textbf{Total Cost} % no trailing space inside braces
                  &= sum_{m=1}^{55} num{10000} cdot Z_m + num{7000} cdot K_m \
                  &= smashoperator{sum_{i in {mmid Z_m = 1}}}num{10000} + smashoperator{sum_{j in {kmid K_m = 1}}} num{7000} \
                  &= smashoperator[r]{sum_{i in {mmid Z_m = 1}}} num{10000} + smashoperator[l]{sum_{j in {kmid K_m = 1}}} num{7000}
                  end{align}

                  end{document}


                  enter image description here






                  share|improve this answer














                  A variant, with the smashoperator command from mathtools – and some improvements with siunitx, so the comma separator in numbers doesn't add a space.



                  smashoperator can take an optional argument, [l] or [r] which are equivalent to mathlap or mathrlap respectively. I demonstrate it in a $3$rd equation:



                  documentclass[12pt]{article}
                  usepackage{mathtools}
                  usepackage{siunitx}

                  begin{document}

                  sisetup{group-digits = integer, group-separator={,}, group-minimum-digits = 4}
                  begin{align}
                  textbf{Total Cost} % no trailing space inside braces
                  &= sum_{m=1}^{55} num{10000} cdot Z_m + num{7000} cdot K_m \
                  &= smashoperator{sum_{i in {mmid Z_m = 1}}}num{10000} + smashoperator{sum_{j in {kmid K_m = 1}}} num{7000} \
                  &= smashoperator[r]{sum_{i in {mmid Z_m = 1}}} num{10000} + smashoperator[l]{sum_{j in {kmid K_m = 1}}} num{7000}
                  end{align}

                  end{document}


                  enter image description here







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 17 at 22:20

























                  answered Nov 17 at 20:51









                  Bernard

                  162k767192




                  162k767192






























                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460496%2fforce-placement-of-sum-operands-over-index%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

                      AnyDesk - Fatal Program Failure

                      How to calibrate 16:9 built-in touch-screen to a 4:3 resolution?

                      QoS: MAC-Priority for clients behind a repeater