A simpler explanation of clearpage












14














I have read the manual, so am not 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
    Dec 14 at 5:04












  • 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
    Dec 14 at 5:38










  • 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
    Dec 14 at 6:38


















14














I have read the manual, so am not 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
    Dec 14 at 5:04












  • 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
    Dec 14 at 5:38










  • 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
    Dec 14 at 6:38
















14












14








14


2





I have read the manual, so am not 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 am not 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 Dec 14 at 16:16

























asked Dec 14 at 3:48









mandresybilly

16212




16212








  • 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
    Dec 14 at 5:04












  • 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
    Dec 14 at 5:38










  • 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
    Dec 14 at 6:38
















  • 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
    Dec 14 at 5:04












  • 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
    Dec 14 at 5:38










  • 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
    Dec 14 at 6:38










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
Dec 14 at 5:04






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
Dec 14 at 5:04














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
Dec 14 at 5:38




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
Dec 14 at 5:38












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
Dec 14 at 6:38






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
Dec 14 at 6:38












1 Answer
1






active

oldest

votes


















22














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



2) newpage only breaks the page (or column) at that point; but clearpage, as you said, also flushes out (i.e., print) all pending floats from the stack before the start of the new page. That means "do not wait anymore to print the damn figures and tables that I coded before this point". Mainly, this makes sense before the start of a new section, to prevent jumping of some images or tables of one section to the text of the next section (but makes no sense in 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 switch 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 image.



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 that line. Is the difference clearer now?



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























  • I tried the code and it is now easy to notice the difference. Thank you very much.
    – mandresybilly
    Dec 14 at 16:25











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%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









22














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



2) newpage only breaks the page (or column) at that point; but clearpage, as you said, also flushes out (i.e., print) all pending floats from the stack before the start of the new page. That means "do not wait anymore to print the damn figures and tables that I coded before this point". Mainly, this makes sense before the start of a new section, to prevent jumping of some images or tables of one section to the text of the next section (but makes no sense in 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 switch 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 image.



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 that line. Is the difference clearer now?



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























  • I tried the code and it is now easy to notice the difference. Thank you very much.
    – mandresybilly
    Dec 14 at 16:25
















22














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



2) newpage only breaks the page (or column) at that point; but clearpage, as you said, also flushes out (i.e., print) all pending floats from the stack before the start of the new page. That means "do not wait anymore to print the damn figures and tables that I coded before this point". Mainly, this makes sense before the start of a new section, to prevent jumping of some images or tables of one section to the text of the next section (but makes no sense in 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 switch 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 image.



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 that line. Is the difference clearer now?



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























  • I tried the code and it is now easy to notice the difference. Thank you very much.
    – mandresybilly
    Dec 14 at 16:25














22












22








22






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



2) newpage only breaks the page (or column) at that point; but clearpage, as you said, also flushes out (i.e., print) all pending floats from the stack before the start of the new page. That means "do not wait anymore to print the damn figures and tables that I coded before this point". Mainly, this makes sense before the start of a new section, to prevent jumping of some images or tables of one section to the text of the next section (but makes no sense in 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 switch 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 image.



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 that line. Is the difference clearer now?



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 starts a new page.



2) newpage only breaks the page (or column) at that point; but clearpage, as you said, also flushes out (i.e., print) all pending floats from the stack before the start of the new page. That means "do not wait anymore to print the damn figures and tables that I coded before this point". Mainly, this makes sense before the start of a new section, to prevent jumping of some images or tables of one section to the text of the next section (but makes no sense in 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 switch 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 image.



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 that line. Is the difference clearer now?



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 Dec 15 at 2:49









mandresybilly

16212




16212










answered Dec 14 at 5:41









Fran

51.2k6112175




51.2k6112175












  • I tried the code and it is now easy to notice the difference. Thank you very much.
    – mandresybilly
    Dec 14 at 16:25


















  • I tried the code and it is now easy to notice the difference. Thank you very much.
    – mandresybilly
    Dec 14 at 16:25
















I tried the code and it is now easy to notice the difference. Thank you very much.
– mandresybilly
Dec 14 at 16:25




I tried the code and it is now easy to notice the difference. Thank you very much.
– mandresybilly
Dec 14 at 16:25


















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

Morgemoulin

Scott Moir

Souastre