I use declaretheoremstyle
to declare a theorem environment. I like the format of shaded
, it gives a special background color without shorten the width of a text. But one problem is that a theorem block does not span in 2 pages. So if a block is too long, it intersects with the bottom margin of the page:
\documentclass{article}
\usepackage[english]{babel}
\usepackage[margin=2cm]{geometry}% just for the example
\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{mdframed}
\declaretheoremstyle[
spaceabove=6pt, spacebelow=6pt,
headfont=\normalfont\bfseries,
postheadspace=1em,
notefont=\bfseries,
notebraces={(}{)},
bodyfont=\itshape,
shaded={bgcolor=yellow!20}
]{thmstyle}
\declaretheorem[style=thmstyle,name=Theorem]{theorem}
\begin{document}
\begin{theorem}[name]
...
\end{theorem}
\renewcommand{\listtheoremname}{List of Theorems}
\addcontentsline{toc}{section}{\listtheoremname}
\listoftheorems[ignoreall,show=theorem]
\end{document}
I tried to follow this proposition by using preheadhook
and postfoothook
. It does solve the problem of spanning, but it shortens the width of a text, as I showed here.
I think i will go with the authentic width (as shaded
gives), does anyone know how to make it span in 2 pages?