答案1
这也许不是您期望的答案。我建议您不要使用包中的thmbox=M
选项(依赖于thmbox
包) ,而是使用thmtools
tcolorbox
包来设计一个定理风格,模仿选项提供的风格M
,但在分页符方面表现良好:
\documentclass{report}
\usepackage[a6paper]{geometry}% just for the example
\usepackage{amsthm,amsmath}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\usepackage{ulem}
\makeatletter
\def\tcb@theo@title#1#2#3{%
\ifdefempty{#2}{\setbox\z@=\hbox{#1}}{\setbox\z@=\hbox{#1~#2}}%
\def\temp@a{#3}%
\ifx\temp@a\@empty\relax%
\unhbox\z@%
\else%
\setbox\z@=\hbox{\unhbox\z@\ }%
\hangindent\wd\z@%
\hangafter=1%
\mbox{\unhbox\z@}(#3)%
\fi%
}
\renewcommand{\newtcbtheorem}[5][]{%
\newtcolorbox[auto counter,#1]{#2}[3][]{#4,%
title={\uline{\tcb@theo@title{#3}{\thetcbcounter}{##2}}},
list entry={\numberline{\thetcbcounter}##2},%
code={\tcb@theo@label{#5}{##3}},%
##1}%
}
\makeatother
\newtcbtheorem{theorem}{Theorem}{
breakable,
enhanced,
arc=0pt,
outer arc=0pt,
coltitle=black,
fonttitle=\bfseries,
fontupper=\itshape,
colback=white,
colframe=white,
left=30pt,
lefttitle=0pt,
boxsep=0pt,
right=0pt,
overlay unbroken={
\draw ([xshift=15pt,yshift=-11pt]frame.north west) -- ([xshift=15pt]frame.south west) |- +(30pt,0);},
overlay first={
\draw ([xshift=15pt,yshift=-11pt]frame.north west) -- ([xshift=15pt]frame.south west);},
overlay middle={
\draw ([xshift=15pt]frame.north west) -- ([xshift=15pt]frame.south west);},
overlay last={
\draw ([xshift=15pt]frame.north west) -- ([xshift=15pt]frame.south west) |- +(30pt,0);},
before=\vspace{2ex}\noindent,
}{the}
\begin{document}
Some cross referecens to theorems~\ref{the:testa} and~\ref{the:testb}
\lipsum[4]
\begin{theorem}{}{testa}
\lipsum[4]\lipsum[4]\lipsum[4]
\end{theorem}
\begin{theorem}{}{testb}
\lipsum[4]
\end{theorem}
\end{document}
答案2
如果您想继续thmbox
,您可以使用内部开关,允许或阻止在定理中间分页。
因为不太可能全部定理将落在不受分页符影响的地方,制作两个用户级开关可能会很有用——一个用于关闭分页符,一个用于打开分页符:
\makeatletter
\newcommand{\cutthmoff}{\thmbox@cutfalse}
\newcommand{\cutthmon}{\thmbox@cuttrue}
\makeatother
然后您可以“本地”使用这些开关 - 将所需的开关括在括号组中或\begingroup ... \endgroup
围绕定理的括号组中,仅对该定理进行操作 - 或者根据需要打开或关闭。
如果您的文档包含多个文件,则最好在每个文件末尾恢复“正常”设置,以避免以后出现意外。