Can I make a flexible page length?











up vote
4
down vote

favorite












In my document, I have many large unbreakable boxes. Sometimes, the text will take up most of the page before a box that is a little too big to still fit. Consequently, I am often manually using enlargethispage{baselineskip} and clearpage to adjust the page height for good page breaks. I know that I can use flexible lengths between boxes, and that would help if my boxes almost fill a page. But what if my boxes are a bit too long? Is there a way that I can tell TeX that the available page height can be stretched if it needs to?



The following illustrates what I'm having. The box is a bit too big to fit on the page. But if I shrink the bottom margin by only .1in, then the page is large enough to fit everything. I'd like to be able to specify a flexible length for the bottom margin, but the geometry package doesn't allow that to happen, and I'm not proficient enough with the page dimension lengths to be able to manually specify the appropriate spots.



documentclass[letterpaper]{article}

usepackage[margin=2in]{geometry} % document default causes two mostly empty pages

%geometry{bottom=1.9in} % enlarging allows me to get one full page this time

%geometry{bottom=2in plus 0in minus .1in}
% I'd like to keep the default, but allow it to stretch if necessary
% this command isn't valid - it acts like
%geometry{bottom=2in}plus 0in minus .1in

usepackage{lipsum}

begin{document}

lipsum[1-3]

noindent
fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

end{document}


There are a few other questions that deal with adjusting page dimensions and big unbreakable boxes, but the usual response ends up being that the user should manually adjust the layout. I'm wanting to find a way for TeX to automatically make the adjustments, so that I don't have to fiddle with every page. This question is close to what I'm asking about, but it's focusing on adjusting the box, not the height of the page. (And I don't understand the accepted answer.)










share|improve this question


























    up vote
    4
    down vote

    favorite












    In my document, I have many large unbreakable boxes. Sometimes, the text will take up most of the page before a box that is a little too big to still fit. Consequently, I am often manually using enlargethispage{baselineskip} and clearpage to adjust the page height for good page breaks. I know that I can use flexible lengths between boxes, and that would help if my boxes almost fill a page. But what if my boxes are a bit too long? Is there a way that I can tell TeX that the available page height can be stretched if it needs to?



    The following illustrates what I'm having. The box is a bit too big to fit on the page. But if I shrink the bottom margin by only .1in, then the page is large enough to fit everything. I'd like to be able to specify a flexible length for the bottom margin, but the geometry package doesn't allow that to happen, and I'm not proficient enough with the page dimension lengths to be able to manually specify the appropriate spots.



    documentclass[letterpaper]{article}

    usepackage[margin=2in]{geometry} % document default causes two mostly empty pages

    %geometry{bottom=1.9in} % enlarging allows me to get one full page this time

    %geometry{bottom=2in plus 0in minus .1in}
    % I'd like to keep the default, but allow it to stretch if necessary
    % this command isn't valid - it acts like
    %geometry{bottom=2in}plus 0in minus .1in

    usepackage{lipsum}

    begin{document}

    lipsum[1-3]

    noindent
    fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

    end{document}


    There are a few other questions that deal with adjusting page dimensions and big unbreakable boxes, but the usual response ends up being that the user should manually adjust the layout. I'm wanting to find a way for TeX to automatically make the adjustments, so that I don't have to fiddle with every page. This question is close to what I'm asking about, but it's focusing on adjusting the box, not the height of the page. (And I don't understand the accepted answer.)










    share|improve this question
























      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      In my document, I have many large unbreakable boxes. Sometimes, the text will take up most of the page before a box that is a little too big to still fit. Consequently, I am often manually using enlargethispage{baselineskip} and clearpage to adjust the page height for good page breaks. I know that I can use flexible lengths between boxes, and that would help if my boxes almost fill a page. But what if my boxes are a bit too long? Is there a way that I can tell TeX that the available page height can be stretched if it needs to?



      The following illustrates what I'm having. The box is a bit too big to fit on the page. But if I shrink the bottom margin by only .1in, then the page is large enough to fit everything. I'd like to be able to specify a flexible length for the bottom margin, but the geometry package doesn't allow that to happen, and I'm not proficient enough with the page dimension lengths to be able to manually specify the appropriate spots.



      documentclass[letterpaper]{article}

      usepackage[margin=2in]{geometry} % document default causes two mostly empty pages

      %geometry{bottom=1.9in} % enlarging allows me to get one full page this time

      %geometry{bottom=2in plus 0in minus .1in}
      % I'd like to keep the default, but allow it to stretch if necessary
      % this command isn't valid - it acts like
      %geometry{bottom=2in}plus 0in minus .1in

      usepackage{lipsum}

      begin{document}

      lipsum[1-3]

      noindent
      fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

      end{document}


      There are a few other questions that deal with adjusting page dimensions and big unbreakable boxes, but the usual response ends up being that the user should manually adjust the layout. I'm wanting to find a way for TeX to automatically make the adjustments, so that I don't have to fiddle with every page. This question is close to what I'm asking about, but it's focusing on adjusting the box, not the height of the page. (And I don't understand the accepted answer.)










      share|improve this question













      In my document, I have many large unbreakable boxes. Sometimes, the text will take up most of the page before a box that is a little too big to still fit. Consequently, I am often manually using enlargethispage{baselineskip} and clearpage to adjust the page height for good page breaks. I know that I can use flexible lengths between boxes, and that would help if my boxes almost fill a page. But what if my boxes are a bit too long? Is there a way that I can tell TeX that the available page height can be stretched if it needs to?



      The following illustrates what I'm having. The box is a bit too big to fit on the page. But if I shrink the bottom margin by only .1in, then the page is large enough to fit everything. I'd like to be able to specify a flexible length for the bottom margin, but the geometry package doesn't allow that to happen, and I'm not proficient enough with the page dimension lengths to be able to manually specify the appropriate spots.



      documentclass[letterpaper]{article}

      usepackage[margin=2in]{geometry} % document default causes two mostly empty pages

      %geometry{bottom=1.9in} % enlarging allows me to get one full page this time

      %geometry{bottom=2in plus 0in minus .1in}
      % I'd like to keep the default, but allow it to stretch if necessary
      % this command isn't valid - it acts like
      %geometry{bottom=2in}plus 0in minus .1in

      usepackage{lipsum}

      begin{document}

      lipsum[1-3]

      noindent
      fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

      end{document}


      There are a few other questions that deal with adjusting page dimensions and big unbreakable boxes, but the usual response ends up being that the user should manually adjust the layout. I'm wanting to find a way for TeX to automatically make the adjustments, so that I don't have to fiddle with every page. This question is close to what I'm asking about, but it's focusing on adjusting the box, not the height of the page. (And I don't understand the accepted answer.)







      page-breaking lengths






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 at 18:47









      Teepeemm

      1,640616




      1,640616






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          this allows an overrun of 15pt, enough in this case



          enter image description here



          documentclass[letterpaper]{article}

          usepackage[margin=2in]{geometry} % document default causes two mostly empty pages

          %geometry{bottom=1.9in} % enlarging allows me to get one full page this time

          %geometry{bottom=2in plus 0in minus .1in}
          % I'd like to keep the default, but allow it to stretch if necessary
          % this command isn't valid - it acts like
          %geometry{bottom=2in}plus 0in minus .1in

          usepackage{lipsum}
          maxdepth=15pt
          begin{document}

          lipsum[1-3]

          noindent
          fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

          end{document}





          share|improve this answer





















          • With the tcolorbox mentioned in the comments of the other answer, one probably will have to set the [baseline=15pt] to that it actually has a large depth.
            – Ulrike Fischer
            Nov 14 at 21:14










          • @UlrikeFischer I was misremembering - I'm using a tikzpicture to mimic a tcolorbox. But I should look into switching to tcolorbox anyway. By the way, it appears that in addition to [baseline=15pt], I'll also need vspace{4pt} after the box to undo the baseline change.
            – Teepeemm
            Nov 15 at 18:52


















          up vote
          1
          down vote













          You can use occasionally enlargethispage{some skip}:



          documentclass[letterpaper]{article}

          usepackage[margin=2in, showframe]{geometry} % document default causes two mostly empty pages

          usepackage{lipsum}

          begin{document}

          lipsum[1-3]

          enlargethispage{1baselineskip}
          noindent
          fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

          end{document}


          enter image description here






          share|improve this answer





















          • Yes, that's my current approach. But that means I have to go through the document looking for bad breaks and manually adjusting them. And potentially remove manual adjustments that are no longer necessary. I'm hoping to offload some of that work onto the TeX page breaking algorithm.
            – Teepeemm
            Nov 14 at 19:13










          • Do you boxes really have to be unbreakable?
            – Bernard
            Nov 14 at 19:15










          • Each is a tcolorbox of a theorem or definition. So the tcolorbox prevents breaking, and from a semantic point of view the content shouldn't be broken.
            – Teepeemm
            Nov 14 at 19:32











          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%2f459998%2fcan-i-make-a-flexible-page-length%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








          up vote
          3
          down vote



          accepted










          this allows an overrun of 15pt, enough in this case



          enter image description here



          documentclass[letterpaper]{article}

          usepackage[margin=2in]{geometry} % document default causes two mostly empty pages

          %geometry{bottom=1.9in} % enlarging allows me to get one full page this time

          %geometry{bottom=2in plus 0in minus .1in}
          % I'd like to keep the default, but allow it to stretch if necessary
          % this command isn't valid - it acts like
          %geometry{bottom=2in}plus 0in minus .1in

          usepackage{lipsum}
          maxdepth=15pt
          begin{document}

          lipsum[1-3]

          noindent
          fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

          end{document}





          share|improve this answer





















          • With the tcolorbox mentioned in the comments of the other answer, one probably will have to set the [baseline=15pt] to that it actually has a large depth.
            – Ulrike Fischer
            Nov 14 at 21:14










          • @UlrikeFischer I was misremembering - I'm using a tikzpicture to mimic a tcolorbox. But I should look into switching to tcolorbox anyway. By the way, it appears that in addition to [baseline=15pt], I'll also need vspace{4pt} after the box to undo the baseline change.
            – Teepeemm
            Nov 15 at 18:52















          up vote
          3
          down vote



          accepted










          this allows an overrun of 15pt, enough in this case



          enter image description here



          documentclass[letterpaper]{article}

          usepackage[margin=2in]{geometry} % document default causes two mostly empty pages

          %geometry{bottom=1.9in} % enlarging allows me to get one full page this time

          %geometry{bottom=2in plus 0in minus .1in}
          % I'd like to keep the default, but allow it to stretch if necessary
          % this command isn't valid - it acts like
          %geometry{bottom=2in}plus 0in minus .1in

          usepackage{lipsum}
          maxdepth=15pt
          begin{document}

          lipsum[1-3]

          noindent
          fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

          end{document}





          share|improve this answer





















          • With the tcolorbox mentioned in the comments of the other answer, one probably will have to set the [baseline=15pt] to that it actually has a large depth.
            – Ulrike Fischer
            Nov 14 at 21:14










          • @UlrikeFischer I was misremembering - I'm using a tikzpicture to mimic a tcolorbox. But I should look into switching to tcolorbox anyway. By the way, it appears that in addition to [baseline=15pt], I'll also need vspace{4pt} after the box to undo the baseline change.
            – Teepeemm
            Nov 15 at 18:52













          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          this allows an overrun of 15pt, enough in this case



          enter image description here



          documentclass[letterpaper]{article}

          usepackage[margin=2in]{geometry} % document default causes two mostly empty pages

          %geometry{bottom=1.9in} % enlarging allows me to get one full page this time

          %geometry{bottom=2in plus 0in minus .1in}
          % I'd like to keep the default, but allow it to stretch if necessary
          % this command isn't valid - it acts like
          %geometry{bottom=2in}plus 0in minus .1in

          usepackage{lipsum}
          maxdepth=15pt
          begin{document}

          lipsum[1-3]

          noindent
          fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

          end{document}





          share|improve this answer












          this allows an overrun of 15pt, enough in this case



          enter image description here



          documentclass[letterpaper]{article}

          usepackage[margin=2in]{geometry} % document default causes two mostly empty pages

          %geometry{bottom=1.9in} % enlarging allows me to get one full page this time

          %geometry{bottom=2in plus 0in minus .1in}
          % I'd like to keep the default, but allow it to stretch if necessary
          % this command isn't valid - it acts like
          %geometry{bottom=2in}plus 0in minus .1in

          usepackage{lipsum}
          maxdepth=15pt
          begin{document}

          lipsum[1-3]

          noindent
          fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

          end{document}






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 at 20:22









          David Carlisle

          477k3811061840




          477k3811061840












          • With the tcolorbox mentioned in the comments of the other answer, one probably will have to set the [baseline=15pt] to that it actually has a large depth.
            – Ulrike Fischer
            Nov 14 at 21:14










          • @UlrikeFischer I was misremembering - I'm using a tikzpicture to mimic a tcolorbox. But I should look into switching to tcolorbox anyway. By the way, it appears that in addition to [baseline=15pt], I'll also need vspace{4pt} after the box to undo the baseline change.
            – Teepeemm
            Nov 15 at 18:52


















          • With the tcolorbox mentioned in the comments of the other answer, one probably will have to set the [baseline=15pt] to that it actually has a large depth.
            – Ulrike Fischer
            Nov 14 at 21:14










          • @UlrikeFischer I was misremembering - I'm using a tikzpicture to mimic a tcolorbox. But I should look into switching to tcolorbox anyway. By the way, it appears that in addition to [baseline=15pt], I'll also need vspace{4pt} after the box to undo the baseline change.
            – Teepeemm
            Nov 15 at 18:52
















          With the tcolorbox mentioned in the comments of the other answer, one probably will have to set the [baseline=15pt] to that it actually has a large depth.
          – Ulrike Fischer
          Nov 14 at 21:14




          With the tcolorbox mentioned in the comments of the other answer, one probably will have to set the [baseline=15pt] to that it actually has a large depth.
          – Ulrike Fischer
          Nov 14 at 21:14












          @UlrikeFischer I was misremembering - I'm using a tikzpicture to mimic a tcolorbox. But I should look into switching to tcolorbox anyway. By the way, it appears that in addition to [baseline=15pt], I'll also need vspace{4pt} after the box to undo the baseline change.
          – Teepeemm
          Nov 15 at 18:52




          @UlrikeFischer I was misremembering - I'm using a tikzpicture to mimic a tcolorbox. But I should look into switching to tcolorbox anyway. By the way, it appears that in addition to [baseline=15pt], I'll also need vspace{4pt} after the box to undo the baseline change.
          – Teepeemm
          Nov 15 at 18:52










          up vote
          1
          down vote













          You can use occasionally enlargethispage{some skip}:



          documentclass[letterpaper]{article}

          usepackage[margin=2in, showframe]{geometry} % document default causes two mostly empty pages

          usepackage{lipsum}

          begin{document}

          lipsum[1-3]

          enlargethispage{1baselineskip}
          noindent
          fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

          end{document}


          enter image description here






          share|improve this answer





















          • Yes, that's my current approach. But that means I have to go through the document looking for bad breaks and manually adjusting them. And potentially remove manual adjustments that are no longer necessary. I'm hoping to offload some of that work onto the TeX page breaking algorithm.
            – Teepeemm
            Nov 14 at 19:13










          • Do you boxes really have to be unbreakable?
            – Bernard
            Nov 14 at 19:15










          • Each is a tcolorbox of a theorem or definition. So the tcolorbox prevents breaking, and from a semantic point of view the content shouldn't be broken.
            – Teepeemm
            Nov 14 at 19:32















          up vote
          1
          down vote













          You can use occasionally enlargethispage{some skip}:



          documentclass[letterpaper]{article}

          usepackage[margin=2in, showframe]{geometry} % document default causes two mostly empty pages

          usepackage{lipsum}

          begin{document}

          lipsum[1-3]

          enlargethispage{1baselineskip}
          noindent
          fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

          end{document}


          enter image description here






          share|improve this answer





















          • Yes, that's my current approach. But that means I have to go through the document looking for bad breaks and manually adjusting them. And potentially remove manual adjustments that are no longer necessary. I'm hoping to offload some of that work onto the TeX page breaking algorithm.
            – Teepeemm
            Nov 14 at 19:13










          • Do you boxes really have to be unbreakable?
            – Bernard
            Nov 14 at 19:15










          • Each is a tcolorbox of a theorem or definition. So the tcolorbox prevents breaking, and from a semantic point of view the content shouldn't be broken.
            – Teepeemm
            Nov 14 at 19:32













          up vote
          1
          down vote










          up vote
          1
          down vote









          You can use occasionally enlargethispage{some skip}:



          documentclass[letterpaper]{article}

          usepackage[margin=2in, showframe]{geometry} % document default causes two mostly empty pages

          usepackage{lipsum}

          begin{document}

          lipsum[1-3]

          enlargethispage{1baselineskip}
          noindent
          fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

          end{document}


          enter image description here






          share|improve this answer












          You can use occasionally enlargethispage{some skip}:



          documentclass[letterpaper]{article}

          usepackage[margin=2in, showframe]{geometry} % document default causes two mostly empty pages

          usepackage{lipsum}

          begin{document}

          lipsum[1-3]

          enlargethispage{1baselineskip}
          noindent
          fbox{parbox[t][2in]{.97textwidth}{large unbreakable box}}

          end{document}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 at 19:07









          Bernard

          162k767192




          162k767192












          • Yes, that's my current approach. But that means I have to go through the document looking for bad breaks and manually adjusting them. And potentially remove manual adjustments that are no longer necessary. I'm hoping to offload some of that work onto the TeX page breaking algorithm.
            – Teepeemm
            Nov 14 at 19:13










          • Do you boxes really have to be unbreakable?
            – Bernard
            Nov 14 at 19:15










          • Each is a tcolorbox of a theorem or definition. So the tcolorbox prevents breaking, and from a semantic point of view the content shouldn't be broken.
            – Teepeemm
            Nov 14 at 19:32


















          • Yes, that's my current approach. But that means I have to go through the document looking for bad breaks and manually adjusting them. And potentially remove manual adjustments that are no longer necessary. I'm hoping to offload some of that work onto the TeX page breaking algorithm.
            – Teepeemm
            Nov 14 at 19:13










          • Do you boxes really have to be unbreakable?
            – Bernard
            Nov 14 at 19:15










          • Each is a tcolorbox of a theorem or definition. So the tcolorbox prevents breaking, and from a semantic point of view the content shouldn't be broken.
            – Teepeemm
            Nov 14 at 19:32
















          Yes, that's my current approach. But that means I have to go through the document looking for bad breaks and manually adjusting them. And potentially remove manual adjustments that are no longer necessary. I'm hoping to offload some of that work onto the TeX page breaking algorithm.
          – Teepeemm
          Nov 14 at 19:13




          Yes, that's my current approach. But that means I have to go through the document looking for bad breaks and manually adjusting them. And potentially remove manual adjustments that are no longer necessary. I'm hoping to offload some of that work onto the TeX page breaking algorithm.
          – Teepeemm
          Nov 14 at 19:13












          Do you boxes really have to be unbreakable?
          – Bernard
          Nov 14 at 19:15




          Do you boxes really have to be unbreakable?
          – Bernard
          Nov 14 at 19:15












          Each is a tcolorbox of a theorem or definition. So the tcolorbox prevents breaking, and from a semantic point of view the content shouldn't be broken.
          – Teepeemm
          Nov 14 at 19:32




          Each is a tcolorbox of a theorem or definition. So the tcolorbox prevents breaking, and from a semantic point of view the content shouldn't be broken.
          – Teepeemm
          Nov 14 at 19:32


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459998%2fcan-i-make-a-flexible-page-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

          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?