A simpler explanation of clearpage











up vote
3
down vote

favorite
1












I have read the manual, so no trolling here. I REALLY don't understand the use of clearpage. Especially, its difference with newpage. A common explanation is that it "flushes" all pending floats from the stack.



What does it even mean? Can anybody explain it in simpler terms?










share|improve this question




















  • 1




    Real quick: Did you read the postings Is it wrong to use clearpage instead of newpage? and -- on the subject of float placement -- How to influence the position of float environments like figure and table in LaTeX? Are you maybe uncertain what the terms "float", "pending float" and "flushing from the stack" mean in a LaTeX context? Please advise.
    – Mico
    1 hour ago












  • I just read the question you shared so I guess this question may fall of as a duplicate. I know the term "float" as a figure or a table. But I don't understand the other terms such as "pending float" and especially "flushing from the stack".
    – mandresybilly
    1 hour ago










  • Not to make it worse, but there is also pagebreak (with an optional argument ranging from 0-4 for the priority)! ;-) It does not add a page break directly but tells LaTeX that this would be a good place to add a natural page break. There is also the opposite nopagebreak.
    – Martin Scharrer
    24 mins ago

















up vote
3
down vote

favorite
1












I have read the manual, so no trolling here. I REALLY don't understand the use of clearpage. Especially, its difference with newpage. A common explanation is that it "flushes" all pending floats from the stack.



What does it even mean? Can anybody explain it in simpler terms?










share|improve this question




















  • 1




    Real quick: Did you read the postings Is it wrong to use clearpage instead of newpage? and -- on the subject of float placement -- How to influence the position of float environments like figure and table in LaTeX? Are you maybe uncertain what the terms "float", "pending float" and "flushing from the stack" mean in a LaTeX context? Please advise.
    – Mico
    1 hour ago












  • I just read the question you shared so I guess this question may fall of as a duplicate. I know the term "float" as a figure or a table. But I don't understand the other terms such as "pending float" and especially "flushing from the stack".
    – mandresybilly
    1 hour ago










  • Not to make it worse, but there is also pagebreak (with an optional argument ranging from 0-4 for the priority)! ;-) It does not add a page break directly but tells LaTeX that this would be a good place to add a natural page break. There is also the opposite nopagebreak.
    – Martin Scharrer
    24 mins ago















up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





I have read the manual, so no trolling here. I REALLY don't understand the use of clearpage. Especially, its difference with newpage. A common explanation is that it "flushes" all pending floats from the stack.



What does it even mean? Can anybody explain it in simpler terms?










share|improve this question















I have read the manual, so no trolling here. I REALLY don't understand the use of clearpage. Especially, its difference with newpage. A common explanation is that it "flushes" all pending floats from the stack.



What does it even mean? Can anybody explain it in simpler terms?







page-breaking






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 15 mins ago









Raaja

2,0452528




2,0452528










asked 3 hours ago









mandresybilly

10311




10311








  • 1




    Real quick: Did you read the postings Is it wrong to use clearpage instead of newpage? and -- on the subject of float placement -- How to influence the position of float environments like figure and table in LaTeX? Are you maybe uncertain what the terms "float", "pending float" and "flushing from the stack" mean in a LaTeX context? Please advise.
    – Mico
    1 hour ago












  • I just read the question you shared so I guess this question may fall of as a duplicate. I know the term "float" as a figure or a table. But I don't understand the other terms such as "pending float" and especially "flushing from the stack".
    – mandresybilly
    1 hour ago










  • Not to make it worse, but there is also pagebreak (with an optional argument ranging from 0-4 for the priority)! ;-) It does not add a page break directly but tells LaTeX that this would be a good place to add a natural page break. There is also the opposite nopagebreak.
    – Martin Scharrer
    24 mins ago
















  • 1




    Real quick: Did you read the postings Is it wrong to use clearpage instead of newpage? and -- on the subject of float placement -- How to influence the position of float environments like figure and table in LaTeX? Are you maybe uncertain what the terms "float", "pending float" and "flushing from the stack" mean in a LaTeX context? Please advise.
    – Mico
    1 hour ago












  • I just read the question you shared so I guess this question may fall of as a duplicate. I know the term "float" as a figure or a table. But I don't understand the other terms such as "pending float" and especially "flushing from the stack".
    – mandresybilly
    1 hour ago










  • Not to make it worse, but there is also pagebreak (with an optional argument ranging from 0-4 for the priority)! ;-) It does not add a page break directly but tells LaTeX that this would be a good place to add a natural page break. There is also the opposite nopagebreak.
    – Martin Scharrer
    24 mins ago










1




1




Real quick: Did you read the postings Is it wrong to use clearpage instead of newpage? and -- on the subject of float placement -- How to influence the position of float environments like figure and table in LaTeX? Are you maybe uncertain what the terms "float", "pending float" and "flushing from the stack" mean in a LaTeX context? Please advise.
– Mico
1 hour ago






Real quick: Did you read the postings Is it wrong to use clearpage instead of newpage? and -- on the subject of float placement -- How to influence the position of float environments like figure and table in LaTeX? Are you maybe uncertain what the terms "float", "pending float" and "flushing from the stack" mean in a LaTeX context? Please advise.
– Mico
1 hour ago














I just read the question you shared so I guess this question may fall of as a duplicate. I know the term "float" as a figure or a table. But I don't understand the other terms such as "pending float" and especially "flushing from the stack".
– mandresybilly
1 hour ago




I just read the question you shared so I guess this question may fall of as a duplicate. I know the term "float" as a figure or a table. But I don't understand the other terms such as "pending float" and especially "flushing from the stack".
– mandresybilly
1 hour ago












Not to make it worse, but there is also pagebreak (with an optional argument ranging from 0-4 for the priority)! ;-) It does not add a page break directly but tells LaTeX that this would be a good place to add a natural page break. There is also the opposite nopagebreak.
– Martin Scharrer
24 mins ago






Not to make it worse, but there is also pagebreak (with an optional argument ranging from 0-4 for the priority)! ;-) It does not add a page break directly but tells LaTeX that this would be a good place to add a natural page break. There is also the opposite nopagebreak.
– Martin Scharrer
24 mins ago












1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










1) newpage could mean "start a new page" or "start the second column" (only two column documents, of course) while clearpage always start a new page.



2) newpage only break the page (or column) at that point, but clearpage mean, as you said, also flush out (i.e., print) all pending floats from the stack before to start the newpage. That mean "do not wait anymore to print the damn figures and tables that I coded before this point". Mainly this have sense before to start a new section, to prevent jumping of some images or tables of one section to the text of the next section (but have not sense in a chapter, because the clearpage is already added automatically).



Therefore, in a simple long text at one column, you could see the same effect with both commands (just only a new page) but in a document with two columns and/or floats, probably you will see substantial changes.



In the next example, if you change to a document of two columns, the first newpage will produce a first page with two columns, two paragraphs and three images, but if it is changed by clearpage, you will have only one column with one paragraph and no images.



Undo all the changes. You will see that there are also four images after the last line of text, but after change the second newpage by clearpage all the images will be printed before of that line. More clear now the difference?



documentclass{article} 
%documentclass[twocolumn]{article}
usepackage{lipsum}
usepackage{graphicx}
begin{document}
defmyfloat{begin{figure}[htp]includegraphics[scale=.1]{example-image}end{figure}}
lipsum[1]
newpage % same as clearpage? compare it in twocolumn mode !!
%clearpage
lipsum[2]

myfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloat

newpage % last line in 2nd page, four floats go AFTER the last line.
%clearpage % last line in 3th page , all floats printed before.

This is the last line.

end{document}





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%2f464793%2fa-simpler-explanation-of-clearpage%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








    up vote
    4
    down vote



    accepted










    1) newpage could mean "start a new page" or "start the second column" (only two column documents, of course) while clearpage always start a new page.



    2) newpage only break the page (or column) at that point, but clearpage mean, as you said, also flush out (i.e., print) all pending floats from the stack before to start the newpage. That mean "do not wait anymore to print the damn figures and tables that I coded before this point". Mainly this have sense before to start a new section, to prevent jumping of some images or tables of one section to the text of the next section (but have not sense in a chapter, because the clearpage is already added automatically).



    Therefore, in a simple long text at one column, you could see the same effect with both commands (just only a new page) but in a document with two columns and/or floats, probably you will see substantial changes.



    In the next example, if you change to a document of two columns, the first newpage will produce a first page with two columns, two paragraphs and three images, but if it is changed by clearpage, you will have only one column with one paragraph and no images.



    Undo all the changes. You will see that there are also four images after the last line of text, but after change the second newpage by clearpage all the images will be printed before of that line. More clear now the difference?



    documentclass{article} 
    %documentclass[twocolumn]{article}
    usepackage{lipsum}
    usepackage{graphicx}
    begin{document}
    defmyfloat{begin{figure}[htp]includegraphics[scale=.1]{example-image}end{figure}}
    lipsum[1]
    newpage % same as clearpage? compare it in twocolumn mode !!
    %clearpage
    lipsum[2]

    myfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloat

    newpage % last line in 2nd page, four floats go AFTER the last line.
    %clearpage % last line in 3th page , all floats printed before.

    This is the last line.

    end{document}





    share|improve this answer



























      up vote
      4
      down vote



      accepted










      1) newpage could mean "start a new page" or "start the second column" (only two column documents, of course) while clearpage always start a new page.



      2) newpage only break the page (or column) at that point, but clearpage mean, as you said, also flush out (i.e., print) all pending floats from the stack before to start the newpage. That mean "do not wait anymore to print the damn figures and tables that I coded before this point". Mainly this have sense before to start a new section, to prevent jumping of some images or tables of one section to the text of the next section (but have not sense in a chapter, because the clearpage is already added automatically).



      Therefore, in a simple long text at one column, you could see the same effect with both commands (just only a new page) but in a document with two columns and/or floats, probably you will see substantial changes.



      In the next example, if you change to a document of two columns, the first newpage will produce a first page with two columns, two paragraphs and three images, but if it is changed by clearpage, you will have only one column with one paragraph and no images.



      Undo all the changes. You will see that there are also four images after the last line of text, but after change the second newpage by clearpage all the images will be printed before of that line. More clear now the difference?



      documentclass{article} 
      %documentclass[twocolumn]{article}
      usepackage{lipsum}
      usepackage{graphicx}
      begin{document}
      defmyfloat{begin{figure}[htp]includegraphics[scale=.1]{example-image}end{figure}}
      lipsum[1]
      newpage % same as clearpage? compare it in twocolumn mode !!
      %clearpage
      lipsum[2]

      myfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloat

      newpage % last line in 2nd page, four floats go AFTER the last line.
      %clearpage % last line in 3th page , all floats printed before.

      This is the last line.

      end{document}





      share|improve this answer

























        up vote
        4
        down vote



        accepted







        up vote
        4
        down vote



        accepted






        1) newpage could mean "start a new page" or "start the second column" (only two column documents, of course) while clearpage always start a new page.



        2) newpage only break the page (or column) at that point, but clearpage mean, as you said, also flush out (i.e., print) all pending floats from the stack before to start the newpage. That mean "do not wait anymore to print the damn figures and tables that I coded before this point". Mainly this have sense before to start a new section, to prevent jumping of some images or tables of one section to the text of the next section (but have not sense in a chapter, because the clearpage is already added automatically).



        Therefore, in a simple long text at one column, you could see the same effect with both commands (just only a new page) but in a document with two columns and/or floats, probably you will see substantial changes.



        In the next example, if you change to a document of two columns, the first newpage will produce a first page with two columns, two paragraphs and three images, but if it is changed by clearpage, you will have only one column with one paragraph and no images.



        Undo all the changes. You will see that there are also four images after the last line of text, but after change the second newpage by clearpage all the images will be printed before of that line. More clear now the difference?



        documentclass{article} 
        %documentclass[twocolumn]{article}
        usepackage{lipsum}
        usepackage{graphicx}
        begin{document}
        defmyfloat{begin{figure}[htp]includegraphics[scale=.1]{example-image}end{figure}}
        lipsum[1]
        newpage % same as clearpage? compare it in twocolumn mode !!
        %clearpage
        lipsum[2]

        myfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloat

        newpage % last line in 2nd page, four floats go AFTER the last line.
        %clearpage % last line in 3th page , all floats printed before.

        This is the last line.

        end{document}





        share|improve this answer














        1) newpage could mean "start a new page" or "start the second column" (only two column documents, of course) while clearpage always start a new page.



        2) newpage only break the page (or column) at that point, but clearpage mean, as you said, also flush out (i.e., print) all pending floats from the stack before to start the newpage. That mean "do not wait anymore to print the damn figures and tables that I coded before this point". Mainly this have sense before to start a new section, to prevent jumping of some images or tables of one section to the text of the next section (but have not sense in a chapter, because the clearpage is already added automatically).



        Therefore, in a simple long text at one column, you could see the same effect with both commands (just only a new page) but in a document with two columns and/or floats, probably you will see substantial changes.



        In the next example, if you change to a document of two columns, the first newpage will produce a first page with two columns, two paragraphs and three images, but if it is changed by clearpage, you will have only one column with one paragraph and no images.



        Undo all the changes. You will see that there are also four images after the last line of text, but after change the second newpage by clearpage all the images will be printed before of that line. More clear now the difference?



        documentclass{article} 
        %documentclass[twocolumn]{article}
        usepackage{lipsum}
        usepackage{graphicx}
        begin{document}
        defmyfloat{begin{figure}[htp]includegraphics[scale=.1]{example-image}end{figure}}
        lipsum[1]
        newpage % same as clearpage? compare it in twocolumn mode !!
        %clearpage
        lipsum[2]

        myfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloatmyfloat

        newpage % last line in 2nd page, four floats go AFTER the last line.
        %clearpage % last line in 3th page , all floats printed before.

        This is the last line.

        end{document}






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 1 hour ago

























        answered 1 hour ago









        Fran

        50.5k6111174




        50.5k6111174






























            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%2f464793%2fa-simpler-explanation-of-clearpage%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

            數位音樂下載

            When can things happen in Etherscan, such as the picture below?

            格利澤436b