2

In the following example

\documentclass{scrartcl}
\usepackage{blindtext}
%
\usepackage{amsthm}
\usepackage{thmtools}
%   
\declaretheoremstyle[%
    spaceabove=60pt, spacebelow=60pt, % just for testing
    shaded={rulecolor=black,rulewidth=.5pt,bgcolor={rgb}{1,1,1}}
]{framed}

\declaretheorem[style=framed]{theorem} % \begin{document}
\blindtext % \begin{theorem} $ \int $ and some text \end{theorem} % \blindtext \end{document}

there will be no space added below and above. Without the shaded-declaration everything is fine. How can I achieve to add some space above and below?

Ulrich
  • 917
  • 1
    You won't have these problems with ntheorem and the framed package. Further, shaded theorems will be able to break across pages, if necessary. – Bernard May 19 '21 at 18:41
  • The problem with ntheorem is, that it's last release is from 2012 and sometimes it is not working as described, e.g. to use \ensuremath{_\blacksquare} in the proof-environment as described on page 9 of the manual is not working. One has to add the package wasysym (at least I had to do this). – Ulrich May 20 '21 at 09:32
  • Personally, I never had any problem – which doesn't mean, of course, it can't have. But why don't you use, as an end-of-proof marker, \textsc{q.e.d.}, or even E.O.Δ. ? ;ο) – Bernard May 20 '21 at 09:39
  • Because I like the Halmos-tombstone I am using the square. – Ulrich May 20 '21 at 15:16

2 Answers2

1

This seems to be an oversight in thmtools. The package defines shaded as adding \begin{shadebox} and \end{shadebox} around the theorem, but then the space settings are not taken into account.

You can redefine the shaded style by adding the settings explicitly. This also requires to load a few involved packages in your own preamble to make the necessary settings available during the definition.

MWE:

\documentclass{scrartcl}
\usepackage{blindtext}
%
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{shadethm}
\usepackage{thmdef-shaded}
%
\makeatletter
\define@key{thmdef}{shaded}[{}]{%
  \addtotheorempreheadhook[\thmt@envname]{%
      \setlength\shadedtextwidth{\linewidth}%
      \kvsetkeys{thmt@shade}{#1}\vspace{\thmt@style@spaceabove}\begin{shadebox}}%
    \addtotheorempostfoothook[\thmt@envname]{\end{shadebox}\vspace{\thmt@style@spacebelow}}%
  }
\makeatother

\declaretheoremstyle[% spaceabove=60pt, spacebelow=30pt, % just for testing shaded={rulecolor=black,rulewidth=.5pt,bgcolor={gray}{0.5}} ]{framed}

\declaretheorem[style=framed]{theorem} % \begin{document}
\blindtext % \begin{theorem} $ \int $ and some text \end{theorem} % \blindtext \end{document}

Result:

enter image description here

Marijn
  • 37,699
0

Comment: I found a solution using mdframed :

\declaretheoremstyle[mdframed={outerlinewidth=6pt,
                               innertopmargin=6pt, 
                               innerbottommargin=6pt} 
                    ]{mystyle} 
\declaretheorem[style=mystyle]{theorem}

But ntheorem should be the better solution because it "respects" page breaks.

Ulrich
  • 917