目前我的序言如下
\documentclass{article}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{enumitem}
\theoremstyle{definition}
\newtheorem*{theo}{Theorem}
\newtheorem*{defi}{Definition}
\newtheorem*{lem}{Lemma}
\newtheorem*{rem}{Remark}
\newtheorem*{col}{Corollary}
\title{Linear Algebra \\ Lecture Summary}
\date{}
\author{}
\begin{document}
\maketitle
\end{document}
我希望这样,当我写定理/引理/注释/推论时,它就不会分散到各个页面上。
我曾多次搜索答案,但我对 TeX 没有太多经验,仅复制和粘贴我看到的内容并不能解决问题。
答案1
通过将宏包装在:中,它将\blocktheorem{<theorem>}
成为<theorem>
牢不可破的块。minipage
\documentclass{article}
\usepackage{amsthm}
\usepackage{xparse,etoolbox}
\usepackage[nopar]{lipsum}% Just for this example
\usepackage[margin=1in,paper=a5paper]{geometry}% Just for this example
\theoremstyle{definition}
\newtheorem*{theo}{Theorem}
\newtheorem*{defi}{Definition}
\newtheorem*{lem}{Lemma}
\newtheorem*{rem}{Remark}
\newtheorem*{col}{Corollary}
\newcommand{\blocktheorem}[1]{%
\csletcs{old#1}{#1}% Store \begin
\csletcs{endold#1}{end#1}% Store \end
\RenewDocumentEnvironment{#1}{o}
{\par\addvspace{1.5ex}
\noindent\begin{minipage}{\textwidth}
\IfNoValueTF{##1}
{\csuse{old#1}}
{\csuse{old#1}[##1]}}
{\csuse{endold#1}
\end{minipage}
\par\addvspace{1.5ex}}
}
\raggedbottom
\blocktheorem{theo}% Make theo into a block
\blocktheorem{defi}% Make defi into a block
\blocktheorem{lem}% Make lem into a block
\blocktheorem{rem}% Make rem into a block
\blocktheorem{col}% Make col into a block
\begin{document}
\begin{theo}
\lipsum[1]
\end{theo}
\lipsum[1]
\begin{defi}[abc]
\lipsum[1]
\end{defi}
\lipsum[1]
\begin{lem}
\lipsum[1]
\end{lem}
\lipsum[1]
\begin{rem}[abc]
\lipsum[1]
\end{rem}
\lipsum[1]
\begin{col}
\lipsum[1]
\end{col}
\end{document}
\raggedbottom
有助于避免\vbox
由于框被刷新到连续页面而导致的页面不足。