使用 amsthm 延续多页定理

使用 amsthm 延续多页定理

我使用amsthm来定义我自己的lemmatheorem和其他环境。有些太长,无法在一页上显示,这意味着它们被分成多页。

当这样的环境被分割时,我希望有一些文本,例如

定理 0.1(续)

引理 0.2(续)

或者环境的以下页面上有类似内容。我该如何实现呢?

梅威瑟:

\documentclass[%
    a4paper,
    11pt
]{memoir}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc} % Use 8-bit encoding that has 256 glyph
\usepackage[T1]{fontenc}
\usepackage{xcolor}

\usepackage{blindtext} 

\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{etoolbox}

\usepackage{framed}
\colorlet{shadecolor}{yellow!15}


\theoremstyle{definition} %Also: plain, definition, remark
\newtheorem{lemma}{Lemma}[chapter] 
\AtBeginEnvironment{lemma}{\begin{shaded}}%
\AtEndEnvironment{lemma}{\end{shaded}}%

\theoremstyle{definition} %Also: plain, definition, remark
\newtheorem{theorem}[lemma]{Theorem} 
\AtBeginEnvironment{theorem}{\begin{shaded}}%
\AtEndEnvironment{theorem}{\end{shaded}}%



\begin{document}

\begin{theorem}
\Blindtext
\blindtext
\end{theorem}
\begin{lemma}
\Blindtext
\end{lemma}

\end{document}

上述代码的编译: 第 1 页 第2页 第 3 页

答案1

tcolorbox包可用于提供围绕定理等的可配置框,尤其是可轻松破坏tcolorboxtitle after break={....}选项将显示一个特殊标题。

请注意,tcolorbox可以设置theorem自己的特殊盒子,但我保留了原始定义。

\documentclass[%
    a4paper,
    11pt
]{memoir}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc} % Use 8-bit encoding that has 256 glyph
\usepackage[T1]{fontenc}
\usepackage{xcolor}

\usepackage{blindtext} 

\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{etoolbox}


\usepackage{framed}
\colorlet{shadecolor}{yellow!15}

\usepackage[most]{tcolorbox}

\tcbset{lemmastyle/.style={title={},breakable,colback=shadecolor,enhanced jigsaw,boxrule=0pt,sharp corners,colframe=shadecolor,boxsep=0pt,colbacktitle={shadecolor},coltitle={black},attach title to upper={},
    title after break={Lemma \thelemma\ (continued)}}}

\tcbset{theostyle/.style={title={},breakable,colback=shadecolor,enhanced jigsaw,boxrule=0pt,sharp corners,colframe=shadecolor,boxsep=0pt,colbacktitle={shadecolor},coltitle={black},attach title to upper={},
    title after break={Theorem \thetheorem\ (continued)}}}


\theoremstyle{definition} %Also: plain, definition, remark
\newtheorem{lemma}{Lemma}[chapter] 
\AtBeginEnvironment{lemma}{\begin{tcolorbox}[lemmastyle]}%
\AtEndEnvironment{lemma}{\end{tcolorbox}}%

\theoremstyle{definition} %Also: plain, definition, remark
\newtheorem{theorem}[lemma]{Theorem} 
\AtBeginEnvironment{theorem}{\begin{tcolorbox}[theostyle]}%
\AtEndEnvironment{theorem}{\end{tcolorbox}}%




\begin{document}

\begin{theorem}
\Blindtext
\blindtext
\end{theorem}
\begin{lemma}
\Blindtext
\end{lemma}

\end{document}

在此处输入图片描述

简短版本\tcolorboxenvironment

  \documentclass[%
        a4paper,
        11pt
    ]{memoir}

    \usepackage[english]{babel}
    \usepackage[utf8]{inputenc} % Use 8-bit encoding that has 256 glyph
    \usepackage[T1]{fontenc}
    \usepackage{xcolor}

    \usepackage{blindtext} 

    \usepackage{amsthm}
    \usepackage{thmtools}



    \colorlet{shadecolor}{yellow!15}

    \usepackage[most]{tcolorbox}

    \tcbset{lemmastyle/.style={title={},breakable,colback=shadecolor,enhanced jigsaw,boxrule=0pt,sharp corners,colframe=shadecolor,boxsep=0pt,colbacktitle={shadecolor},coltitle={black},attach title to upper={},fonttitle={\bfseries},
        title after break={Lemma \thelemma\ (continued)}}}

    \tcbset{theostyle/.style={title={},breakable,colback=shadecolor,enhanced jigsaw,boxrule=0pt,sharp corners,colframe=shadecolor,boxsep=0pt,colbacktitle={shadecolor},coltitle={black},attach title to upper={}, fonttitle={\bfseries},
        title after break={Theorem \thetheorem\ (continued)}}}

    \theoremstyle{definition} %Also: plain, definition, remark
    \newtheorem{lemma}{Lemma}[chapter] 
    \theoremstyle{definition} %Also: plain, definition, remark
    \newtheorem{theorem}[lemma]{Theorem} 

    \tcolorboxenvironment{lemma}{lemmastyle}
    \tcolorboxenvironment{theorem}{theostyle}





    \begin{document}

    \begin{theorem}
    \Blindtext
    \blindtext
    \end{theorem}
    \begin{lemma}
    \Blindtext
    \end{lemma}

    \end{document}

相关内容