![每个定理前自动 \newpage](https://linux22.com/image/390372/%E6%AF%8F%E4%B8%AA%E5%AE%9A%E7%90%86%E5%89%8D%E8%87%AA%E5%8A%A8%20%5Cnewpage.png)
使用amsthm
包,是否有一个优雅的方法可以\newpage
在每个定理之前自动获得一个?
编辑:MWE 采用了 Christian Hupfer 的建议
\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}
答案1
thm
由于as done by的定义amsthm
有点棘手,我建议使用etoolbox
包并添加
\AtBeginEnvironment{thm}{\clearpage}
这是安全的,并且会在定理标题前添加清晰的页面(并且不会破坏显示)
\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}