3

I use amsthm to define my own lemma, theorem, and other environments. Some are too long to display on one page, which means that they are broken onto multiple pages.

When such an environment is split up, I would like there to be some text e.g.

Theorem 0.1 (cont'd)

and

Lemma 0.2 (cont'd)

or something similar on the following pages of the environment. How could I achieve that?

MWE:

\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}

Compilation of the above code: Page 1 Page 2 Page 3

  • 1
    The tcolorbox package can easily achieve this – user31729 Apr 11 '16 at 10:31
4

The tcolorbox package can be used to provide configurable boxes around the theorems etc.,especially breakability is easy with tcolorbox. The title after break={....} option will display a special title then.

Please note, that tcolorbox can setup special theorem boxes of its own,but I kept the original definitions.

\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}

enter image description here

Shorter Version with \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}
  • Worked perfectly, thanks. I added the fonttitle=\bfseries, such that the continued titles looked like the original text. – brixenDK Apr 11 '16 at 12:59
  • @brixenDK: Well, that's a good idea of course. Happy TeXing! – user31729 Apr 11 '16 at 13:19
  • @brixenDK: There's even a shorter version with \tcolorboxenvironment, see the update, if you like ;-) – user31729 Apr 11 '16 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.