How to negate a rubber length?












7














Mathematically, if you negate the points from the interval [2,5] pointwise, you'd get the interval [-5,-2]. Having said that, I'd expect that if you negate 3pt plus2pt minus1pt, you'd get -3pt minus2pt plus1pt. How to actually compute these rubber lengths? As a start, running pdflatex on



documentclass{article}
newlength{myLength}
begin{document}
setlength{myLength}{3pt plus2pt minus1pt}
setlength{myLength}{-myLength}
themyLength
end{document}


spits out



-3.0pt plus -2.0pt minus -1.0pt


which is similar for a human reader but overly complicated and might be not what we want.










share|improve this question



























    7














    Mathematically, if you negate the points from the interval [2,5] pointwise, you'd get the interval [-5,-2]. Having said that, I'd expect that if you negate 3pt plus2pt minus1pt, you'd get -3pt minus2pt plus1pt. How to actually compute these rubber lengths? As a start, running pdflatex on



    documentclass{article}
    newlength{myLength}
    begin{document}
    setlength{myLength}{3pt plus2pt minus1pt}
    setlength{myLength}{-myLength}
    themyLength
    end{document}


    spits out



    -3.0pt plus -2.0pt minus -1.0pt


    which is similar for a human reader but overly complicated and might be not what we want.










    share|improve this question

























      7












      7








      7







      Mathematically, if you negate the points from the interval [2,5] pointwise, you'd get the interval [-5,-2]. Having said that, I'd expect that if you negate 3pt plus2pt minus1pt, you'd get -3pt minus2pt plus1pt. How to actually compute these rubber lengths? As a start, running pdflatex on



      documentclass{article}
      newlength{myLength}
      begin{document}
      setlength{myLength}{3pt plus2pt minus1pt}
      setlength{myLength}{-myLength}
      themyLength
      end{document}


      spits out



      -3.0pt plus -2.0pt minus -1.0pt


      which is similar for a human reader but overly complicated and might be not what we want.










      share|improve this question













      Mathematically, if you negate the points from the interval [2,5] pointwise, you'd get the interval [-5,-2]. Having said that, I'd expect that if you negate 3pt plus2pt minus1pt, you'd get -3pt minus2pt plus1pt. How to actually compute these rubber lengths? As a start, running pdflatex on



      documentclass{article}
      newlength{myLength}
      begin{document}
      setlength{myLength}{3pt plus2pt minus1pt}
      setlength{myLength}{-myLength}
      themyLength
      end{document}


      spits out



      -3.0pt plus -2.0pt minus -1.0pt


      which is similar for a human reader but overly complicated and might be not what we want.







      lengths






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 13 at 23:01









      user49915

      48816




      48816






















          1 Answer
          1






          active

          oldest

          votes


















          6














          If you want to cancel out glue having natural width 3pt, stretch component 2pt and shrink component 1pt, you have to emit glue in the amount of



          -3pt plus -2pt minus -1pt


          Stretch and shrink components are unrelated and TeX will use only one of them at a time (or neither). If a line or page has to be stretched, only the stretch components are taken into account and similarly if the line or page has to be shrinked.



          If Knuth had chosen to express rubber lengths as



          <natural width> stretchable <stretch component> shrinkable <shrink component>


          your doubt would probably not have arisen.



          Another view on the point you make. Specifying 3pt plus 2pt minus 1pt does not mean that any space from 2pt to 5pt can be used.



          It means instead that, when shrinking is necessary, the final space will be between 2pt and 3pt; when stretching, the optimal space will be between 3pt and 5pt, but it can become larger at the expense of line/page badness.



          If you say



          documentclass{article}

          begin{document}

          rule{100pt}{0.4pt}

          makebox[100pt][s]{ahspace{3pt plus 2pt minus 1pt}z}

          end{document}


          the output would be



          enter image description here



          so the glue has been stretched much more than 2pt; however the warning



          Underfull hbox (badness 10000) detected at line 9
          OT1/cmr/m/n/10 a z


          will be issued. To the contrary,



          documentclass[draft]{article}
          usepackage{calc}

          begin{document}

          rule{widthof{az}+1pt}{0.4pt}

          makebox[widthof{az}+1pt][s]{ahspace{3pt plus 2pt minus 1pt}z}

          end{document}


          would output



          enter image description here



          with an overfull box that cannot shrink to the required size, because the glue will never go below 2pt.



          Again, only the stretch component or the shrink component will be used.






          share|improve this answer























          • In other terms, you are saying that the interpretation of the notation "x plus y minus z" is not a single interval. Merely, it's closer to two intervals used for different purposes.
            – user49915
            Dec 14 at 0:43












          • @user49915 Yes, that's another way to say it.
            – egreg
            Dec 14 at 7:41











          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%2f464777%2fhow-to-negate-a-rubber-length%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          6














          If you want to cancel out glue having natural width 3pt, stretch component 2pt and shrink component 1pt, you have to emit glue in the amount of



          -3pt plus -2pt minus -1pt


          Stretch and shrink components are unrelated and TeX will use only one of them at a time (or neither). If a line or page has to be stretched, only the stretch components are taken into account and similarly if the line or page has to be shrinked.



          If Knuth had chosen to express rubber lengths as



          <natural width> stretchable <stretch component> shrinkable <shrink component>


          your doubt would probably not have arisen.



          Another view on the point you make. Specifying 3pt plus 2pt minus 1pt does not mean that any space from 2pt to 5pt can be used.



          It means instead that, when shrinking is necessary, the final space will be between 2pt and 3pt; when stretching, the optimal space will be between 3pt and 5pt, but it can become larger at the expense of line/page badness.



          If you say



          documentclass{article}

          begin{document}

          rule{100pt}{0.4pt}

          makebox[100pt][s]{ahspace{3pt plus 2pt minus 1pt}z}

          end{document}


          the output would be



          enter image description here



          so the glue has been stretched much more than 2pt; however the warning



          Underfull hbox (badness 10000) detected at line 9
          OT1/cmr/m/n/10 a z


          will be issued. To the contrary,



          documentclass[draft]{article}
          usepackage{calc}

          begin{document}

          rule{widthof{az}+1pt}{0.4pt}

          makebox[widthof{az}+1pt][s]{ahspace{3pt plus 2pt minus 1pt}z}

          end{document}


          would output



          enter image description here



          with an overfull box that cannot shrink to the required size, because the glue will never go below 2pt.



          Again, only the stretch component or the shrink component will be used.






          share|improve this answer























          • In other terms, you are saying that the interpretation of the notation "x plus y minus z" is not a single interval. Merely, it's closer to two intervals used for different purposes.
            – user49915
            Dec 14 at 0:43












          • @user49915 Yes, that's another way to say it.
            – egreg
            Dec 14 at 7:41
















          6














          If you want to cancel out glue having natural width 3pt, stretch component 2pt and shrink component 1pt, you have to emit glue in the amount of



          -3pt plus -2pt minus -1pt


          Stretch and shrink components are unrelated and TeX will use only one of them at a time (or neither). If a line or page has to be stretched, only the stretch components are taken into account and similarly if the line or page has to be shrinked.



          If Knuth had chosen to express rubber lengths as



          <natural width> stretchable <stretch component> shrinkable <shrink component>


          your doubt would probably not have arisen.



          Another view on the point you make. Specifying 3pt plus 2pt minus 1pt does not mean that any space from 2pt to 5pt can be used.



          It means instead that, when shrinking is necessary, the final space will be between 2pt and 3pt; when stretching, the optimal space will be between 3pt and 5pt, but it can become larger at the expense of line/page badness.



          If you say



          documentclass{article}

          begin{document}

          rule{100pt}{0.4pt}

          makebox[100pt][s]{ahspace{3pt plus 2pt minus 1pt}z}

          end{document}


          the output would be



          enter image description here



          so the glue has been stretched much more than 2pt; however the warning



          Underfull hbox (badness 10000) detected at line 9
          OT1/cmr/m/n/10 a z


          will be issued. To the contrary,



          documentclass[draft]{article}
          usepackage{calc}

          begin{document}

          rule{widthof{az}+1pt}{0.4pt}

          makebox[widthof{az}+1pt][s]{ahspace{3pt plus 2pt minus 1pt}z}

          end{document}


          would output



          enter image description here



          with an overfull box that cannot shrink to the required size, because the glue will never go below 2pt.



          Again, only the stretch component or the shrink component will be used.






          share|improve this answer























          • In other terms, you are saying that the interpretation of the notation "x plus y minus z" is not a single interval. Merely, it's closer to two intervals used for different purposes.
            – user49915
            Dec 14 at 0:43












          • @user49915 Yes, that's another way to say it.
            – egreg
            Dec 14 at 7:41














          6












          6








          6






          If you want to cancel out glue having natural width 3pt, stretch component 2pt and shrink component 1pt, you have to emit glue in the amount of



          -3pt plus -2pt minus -1pt


          Stretch and shrink components are unrelated and TeX will use only one of them at a time (or neither). If a line or page has to be stretched, only the stretch components are taken into account and similarly if the line or page has to be shrinked.



          If Knuth had chosen to express rubber lengths as



          <natural width> stretchable <stretch component> shrinkable <shrink component>


          your doubt would probably not have arisen.



          Another view on the point you make. Specifying 3pt plus 2pt minus 1pt does not mean that any space from 2pt to 5pt can be used.



          It means instead that, when shrinking is necessary, the final space will be between 2pt and 3pt; when stretching, the optimal space will be between 3pt and 5pt, but it can become larger at the expense of line/page badness.



          If you say



          documentclass{article}

          begin{document}

          rule{100pt}{0.4pt}

          makebox[100pt][s]{ahspace{3pt plus 2pt minus 1pt}z}

          end{document}


          the output would be



          enter image description here



          so the glue has been stretched much more than 2pt; however the warning



          Underfull hbox (badness 10000) detected at line 9
          OT1/cmr/m/n/10 a z


          will be issued. To the contrary,



          documentclass[draft]{article}
          usepackage{calc}

          begin{document}

          rule{widthof{az}+1pt}{0.4pt}

          makebox[widthof{az}+1pt][s]{ahspace{3pt plus 2pt minus 1pt}z}

          end{document}


          would output



          enter image description here



          with an overfull box that cannot shrink to the required size, because the glue will never go below 2pt.



          Again, only the stretch component or the shrink component will be used.






          share|improve this answer














          If you want to cancel out glue having natural width 3pt, stretch component 2pt and shrink component 1pt, you have to emit glue in the amount of



          -3pt plus -2pt minus -1pt


          Stretch and shrink components are unrelated and TeX will use only one of them at a time (or neither). If a line or page has to be stretched, only the stretch components are taken into account and similarly if the line or page has to be shrinked.



          If Knuth had chosen to express rubber lengths as



          <natural width> stretchable <stretch component> shrinkable <shrink component>


          your doubt would probably not have arisen.



          Another view on the point you make. Specifying 3pt plus 2pt minus 1pt does not mean that any space from 2pt to 5pt can be used.



          It means instead that, when shrinking is necessary, the final space will be between 2pt and 3pt; when stretching, the optimal space will be between 3pt and 5pt, but it can become larger at the expense of line/page badness.



          If you say



          documentclass{article}

          begin{document}

          rule{100pt}{0.4pt}

          makebox[100pt][s]{ahspace{3pt plus 2pt minus 1pt}z}

          end{document}


          the output would be



          enter image description here



          so the glue has been stretched much more than 2pt; however the warning



          Underfull hbox (badness 10000) detected at line 9
          OT1/cmr/m/n/10 a z


          will be issued. To the contrary,



          documentclass[draft]{article}
          usepackage{calc}

          begin{document}

          rule{widthof{az}+1pt}{0.4pt}

          makebox[widthof{az}+1pt][s]{ahspace{3pt plus 2pt minus 1pt}z}

          end{document}


          would output



          enter image description here



          with an overfull box that cannot shrink to the required size, because the glue will never go below 2pt.



          Again, only the stretch component or the shrink component will be used.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 13 at 23:39

























          answered Dec 13 at 23:22









          egreg

          707k8618793161




          707k8618793161












          • In other terms, you are saying that the interpretation of the notation "x plus y minus z" is not a single interval. Merely, it's closer to two intervals used for different purposes.
            – user49915
            Dec 14 at 0:43












          • @user49915 Yes, that's another way to say it.
            – egreg
            Dec 14 at 7:41


















          • In other terms, you are saying that the interpretation of the notation "x plus y minus z" is not a single interval. Merely, it's closer to two intervals used for different purposes.
            – user49915
            Dec 14 at 0:43












          • @user49915 Yes, that's another way to say it.
            – egreg
            Dec 14 at 7:41
















          In other terms, you are saying that the interpretation of the notation "x plus y minus z" is not a single interval. Merely, it's closer to two intervals used for different purposes.
          – user49915
          Dec 14 at 0:43






          In other terms, you are saying that the interpretation of the notation "x plus y minus z" is not a single interval. Merely, it's closer to two intervals used for different purposes.
          – user49915
          Dec 14 at 0:43














          @user49915 Yes, that's another way to say it.
          – egreg
          Dec 14 at 7:41




          @user49915 Yes, that's another way to say it.
          – egreg
          Dec 14 at 7:41


















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f464777%2fhow-to-negate-a-rubber-length%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

          Probability when a professor distributes a quiz and homework assignment to a class of n students.

          Aardman Animations

          Are they similar matrix