Automatic newpage before every theorem












4















Using amsthm package, is there an elegant way to automatically get a newpage before every theorem?



Edit: MWE featuring Christian Hupfer's suggestion



documentclass{article}
usepackage{amsthm}
newtheorem{thm}{Theorem}
% makeatletter
% g@addto@macro{thm}{clearpage}
% makeatother
begin{document}
begin{thm}
There are infinitely many prime numbers.
end{thm}
% newpage

begin{thm}
$sqrt{2}$ is irrational.
end{thm}
end{document}









share|improve this question

























  • assuming your theorem environment is called theorem, makeatletterg@addto@macro{theorem}{clearpage}makeatother should work... however, this is untested -- as usual, provide a compilable document, please

    – user31729
    Feb 10 at 15:19













  • that doesn't work very well, I get "Theorem x.y" in one page and the body of the theorem (i.e. the stuff between begin{thm} and end{thm) in the next.

    – noibe
    Feb 10 at 15:24








  • 1





    It was a guess only. Again: Providing a document is the better way to help us to help you

    – user31729
    Feb 10 at 15:25
















4















Using amsthm package, is there an elegant way to automatically get a newpage before every theorem?



Edit: MWE featuring Christian Hupfer's suggestion



documentclass{article}
usepackage{amsthm}
newtheorem{thm}{Theorem}
% makeatletter
% g@addto@macro{thm}{clearpage}
% makeatother
begin{document}
begin{thm}
There are infinitely many prime numbers.
end{thm}
% newpage

begin{thm}
$sqrt{2}$ is irrational.
end{thm}
end{document}









share|improve this question

























  • assuming your theorem environment is called theorem, makeatletterg@addto@macro{theorem}{clearpage}makeatother should work... however, this is untested -- as usual, provide a compilable document, please

    – user31729
    Feb 10 at 15:19













  • that doesn't work very well, I get "Theorem x.y" in one page and the body of the theorem (i.e. the stuff between begin{thm} and end{thm) in the next.

    – noibe
    Feb 10 at 15:24








  • 1





    It was a guess only. Again: Providing a document is the better way to help us to help you

    – user31729
    Feb 10 at 15:25














4












4








4








Using amsthm package, is there an elegant way to automatically get a newpage before every theorem?



Edit: MWE featuring Christian Hupfer's suggestion



documentclass{article}
usepackage{amsthm}
newtheorem{thm}{Theorem}
% makeatletter
% g@addto@macro{thm}{clearpage}
% makeatother
begin{document}
begin{thm}
There are infinitely many prime numbers.
end{thm}
% newpage

begin{thm}
$sqrt{2}$ is irrational.
end{thm}
end{document}









share|improve this question
















Using amsthm package, is there an elegant way to automatically get a newpage before every theorem?



Edit: MWE featuring Christian Hupfer's suggestion



documentclass{article}
usepackage{amsthm}
newtheorem{thm}{Theorem}
% makeatletter
% g@addto@macro{thm}{clearpage}
% makeatother
begin{document}
begin{thm}
There are infinitely many prime numbers.
end{thm}
% newpage

begin{thm}
$sqrt{2}$ is irrational.
end{thm}
end{document}






theorems amsthm






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 10 at 15:32







noibe

















asked Feb 10 at 15:16









noibenoibe

512113




512113













  • assuming your theorem environment is called theorem, makeatletterg@addto@macro{theorem}{clearpage}makeatother should work... however, this is untested -- as usual, provide a compilable document, please

    – user31729
    Feb 10 at 15:19













  • that doesn't work very well, I get "Theorem x.y" in one page and the body of the theorem (i.e. the stuff between begin{thm} and end{thm) in the next.

    – noibe
    Feb 10 at 15:24








  • 1





    It was a guess only. Again: Providing a document is the better way to help us to help you

    – user31729
    Feb 10 at 15:25



















  • assuming your theorem environment is called theorem, makeatletterg@addto@macro{theorem}{clearpage}makeatother should work... however, this is untested -- as usual, provide a compilable document, please

    – user31729
    Feb 10 at 15:19













  • that doesn't work very well, I get "Theorem x.y" in one page and the body of the theorem (i.e. the stuff between begin{thm} and end{thm) in the next.

    – noibe
    Feb 10 at 15:24








  • 1





    It was a guess only. Again: Providing a document is the better way to help us to help you

    – user31729
    Feb 10 at 15:25

















assuming your theorem environment is called theorem, makeatletterg@addto@macro{theorem}{clearpage}makeatother should work... however, this is untested -- as usual, provide a compilable document, please

– user31729
Feb 10 at 15:19







assuming your theorem environment is called theorem, makeatletterg@addto@macro{theorem}{clearpage}makeatother should work... however, this is untested -- as usual, provide a compilable document, please

– user31729
Feb 10 at 15:19















that doesn't work very well, I get "Theorem x.y" in one page and the body of the theorem (i.e. the stuff between begin{thm} and end{thm) in the next.

– noibe
Feb 10 at 15:24







that doesn't work very well, I get "Theorem x.y" in one page and the body of the theorem (i.e. the stuff between begin{thm} and end{thm) in the next.

– noibe
Feb 10 at 15:24






1




1





It was a guess only. Again: Providing a document is the better way to help us to help you

– user31729
Feb 10 at 15:25





It was a guess only. Again: Providing a document is the better way to help us to help you

– user31729
Feb 10 at 15:25










1 Answer
1






active

oldest

votes


















4














Since the definition of thm as done by amsthm is a little bit tricky, I suggest to use



AtBeginEnvironment{thm}{clearpage}


This is safe and will add the clear page before the theorem headline (and not disrupting the display)



documentclass{article}
usepackage{blindtext}
usepackage{amsthm}
usepackage{etoolbox}
newtheorem{thm}{Theorem}

AtBeginEnvironment{thm}{%
clearpage%
}
begin{document}
blindtext
begin{thm}
There are infinitely many prime numbers.
end{thm}

begin{thm}
$sqrt{2}$ is irrational.
end{thm}
end{document}





share|improve this answer
























  • I know this isn't related to the original question, but what is the difference between clearpage and newpage?

    – noibe
    Feb 10 at 15:42






  • 2





    @noibe: A clearpage will always issue a new page and emitting all pending floats before, i.e. the will be flushed to the previous page, then the page break occurs. A newpage for example will not eject a new page in case of being specified in a column setup, it will end the local column only then. In most cases clearpage is the right approach... For instance, I can hardly remember setups where I needed newpage

    – user31729
    Feb 10 at 15:46













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%2f474191%2fautomatic-newpage-before-every-theorem%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









4














Since the definition of thm as done by amsthm is a little bit tricky, I suggest to use



AtBeginEnvironment{thm}{clearpage}


This is safe and will add the clear page before the theorem headline (and not disrupting the display)



documentclass{article}
usepackage{blindtext}
usepackage{amsthm}
usepackage{etoolbox}
newtheorem{thm}{Theorem}

AtBeginEnvironment{thm}{%
clearpage%
}
begin{document}
blindtext
begin{thm}
There are infinitely many prime numbers.
end{thm}

begin{thm}
$sqrt{2}$ is irrational.
end{thm}
end{document}





share|improve this answer
























  • I know this isn't related to the original question, but what is the difference between clearpage and newpage?

    – noibe
    Feb 10 at 15:42






  • 2





    @noibe: A clearpage will always issue a new page and emitting all pending floats before, i.e. the will be flushed to the previous page, then the page break occurs. A newpage for example will not eject a new page in case of being specified in a column setup, it will end the local column only then. In most cases clearpage is the right approach... For instance, I can hardly remember setups where I needed newpage

    – user31729
    Feb 10 at 15:46


















4














Since the definition of thm as done by amsthm is a little bit tricky, I suggest to use



AtBeginEnvironment{thm}{clearpage}


This is safe and will add the clear page before the theorem headline (and not disrupting the display)



documentclass{article}
usepackage{blindtext}
usepackage{amsthm}
usepackage{etoolbox}
newtheorem{thm}{Theorem}

AtBeginEnvironment{thm}{%
clearpage%
}
begin{document}
blindtext
begin{thm}
There are infinitely many prime numbers.
end{thm}

begin{thm}
$sqrt{2}$ is irrational.
end{thm}
end{document}





share|improve this answer
























  • I know this isn't related to the original question, but what is the difference between clearpage and newpage?

    – noibe
    Feb 10 at 15:42






  • 2





    @noibe: A clearpage will always issue a new page and emitting all pending floats before, i.e. the will be flushed to the previous page, then the page break occurs. A newpage for example will not eject a new page in case of being specified in a column setup, it will end the local column only then. In most cases clearpage is the right approach... For instance, I can hardly remember setups where I needed newpage

    – user31729
    Feb 10 at 15:46
















4












4








4







Since the definition of thm as done by amsthm is a little bit tricky, I suggest to use



AtBeginEnvironment{thm}{clearpage}


This is safe and will add the clear page before the theorem headline (and not disrupting the display)



documentclass{article}
usepackage{blindtext}
usepackage{amsthm}
usepackage{etoolbox}
newtheorem{thm}{Theorem}

AtBeginEnvironment{thm}{%
clearpage%
}
begin{document}
blindtext
begin{thm}
There are infinitely many prime numbers.
end{thm}

begin{thm}
$sqrt{2}$ is irrational.
end{thm}
end{document}





share|improve this answer













Since the definition of thm as done by amsthm is a little bit tricky, I suggest to use



AtBeginEnvironment{thm}{clearpage}


This is safe and will add the clear page before the theorem headline (and not disrupting the display)



documentclass{article}
usepackage{blindtext}
usepackage{amsthm}
usepackage{etoolbox}
newtheorem{thm}{Theorem}

AtBeginEnvironment{thm}{%
clearpage%
}
begin{document}
blindtext
begin{thm}
There are infinitely many prime numbers.
end{thm}

begin{thm}
$sqrt{2}$ is irrational.
end{thm}
end{document}






share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 10 at 15:36







user31729




















  • I know this isn't related to the original question, but what is the difference between clearpage and newpage?

    – noibe
    Feb 10 at 15:42






  • 2





    @noibe: A clearpage will always issue a new page and emitting all pending floats before, i.e. the will be flushed to the previous page, then the page break occurs. A newpage for example will not eject a new page in case of being specified in a column setup, it will end the local column only then. In most cases clearpage is the right approach... For instance, I can hardly remember setups where I needed newpage

    – user31729
    Feb 10 at 15:46





















  • I know this isn't related to the original question, but what is the difference between clearpage and newpage?

    – noibe
    Feb 10 at 15:42






  • 2





    @noibe: A clearpage will always issue a new page and emitting all pending floats before, i.e. the will be flushed to the previous page, then the page break occurs. A newpage for example will not eject a new page in case of being specified in a column setup, it will end the local column only then. In most cases clearpage is the right approach... For instance, I can hardly remember setups where I needed newpage

    – user31729
    Feb 10 at 15:46



















I know this isn't related to the original question, but what is the difference between clearpage and newpage?

– noibe
Feb 10 at 15:42





I know this isn't related to the original question, but what is the difference between clearpage and newpage?

– noibe
Feb 10 at 15:42




2




2





@noibe: A clearpage will always issue a new page and emitting all pending floats before, i.e. the will be flushed to the previous page, then the page break occurs. A newpage for example will not eject a new page in case of being specified in a column setup, it will end the local column only then. In most cases clearpage is the right approach... For instance, I can hardly remember setups where I needed newpage

– user31729
Feb 10 at 15:46







@noibe: A clearpage will always issue a new page and emitting all pending floats before, i.e. the will be flushed to the previous page, then the page break occurs. A newpage for example will not eject a new page in case of being specified in a column setup, it will end the local column only then. In most cases clearpage is the right approach... For instance, I can hardly remember setups where I needed newpage

– user31729
Feb 10 at 15:46




















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f474191%2fautomatic-newpage-before-every-theorem%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