3
 \documentclass[12pt,twoside,notitlepage,reqno]{amsbook}%
 \usepackage{amsmath}
 \usepackage{amsfonts}
 \usepackage{amssymb}
 \usepackage{xcolor}
 \usepackage{thmtools}
 \usepackage[framemethod=tikz]{mdframed}
 \usepackage{lipsum}% just to generate text for the example

 \definecolor{greyframe}{gray}{0.85}
 \definecolor{greytitleframe}{gray}{0.80}

 \theoremstyle{definition}
 \newmdtheoremenv[
   backgroundcolor=greyframe,
   linecolor=black,
   roundcorner=5pt,
   linewidth=1pt,
   innerleftmargin=1cm,
   innerrightmargin=1cm,
   skipabove=1cm,
   skipbelow=1cm,
   frametitleaboveskip=12pt,
   frametitlebelowskip=6pt,
   frametitlerule=true,
   frametitlebackgroundcolor=greytitleframe
 ]{defn}{Definition}[chapter]

 \begin{document}

 \lipsum[4] 

 \begin{defn}[frametitle={Something Something Test}]
 \lipsum[4]
 \end{defn}

 \lipsum[4] 

 \end{document}

The above will produce the below output:

enter image description here

There are a few issues that I cannot seem to solve despite searching here and the mdframed documentation. The first issue that I cannot solve is that I get no separator between title and subject matter. It's my understanding that frametitlerule=true should produce such a separator.

The second issue is in regards to skip spaces. There is a space above, but no space below. If I set to skipabove=\topsep then I actually lose my space, and setting skipbelow to that does noting either. I know one problem at a time and all, but I've been trying to get these little things done since last night. Anyone have some insight?

  • I would use tcolorbox instead of mdframed. – Ulrike Fischer Nov 26 '15 at 16:50
2

Could you accept changing to tcolorbox?

 \documentclass[12pt,twoside,notitlepage,reqno]{amsbook}%
 \usepackage{amsmath}
 \usepackage{amsfonts}
 \usepackage{amssymb}
 \usepackage{xcolor}
 \usepackage{thmtools}
 \usepackage[most]{tcolorbox}
 \usepackage{lipsum}% just to generate text for the example

 \definecolor{greyframe}{gray}{0.85}
 \definecolor{greytitleframe}{gray}{0.80}

 \theoremstyle{definition}
 \newtcbtheorem[number within=chapter]
 {defn}% <- environment name   
 {Definition}% <- printed name
 {
   colback=greytitleframe,
   colframe=black,
   colbacktitle=greytitleframe,
   coltitle=black
  }%<- box parameters
  {def}%<- label prefix

 \begin{document}

 \lipsum[4] 

 \begin{defn}{Something Something Test}{abc}
 \lipsum[4]
 \end{defn}

 As can be seen in Definition~\ref{def:abc} \dots

 \lipsum[4] 

 \end{document}

enter image description here

  • Yes, I can probably do this. I already have 2 other environments set up in mdframed (theorem and example). Hopefully the two packages will play nicely. If not, using tcolorbox will just shift problems. Thanks for the suggestion though, I'll experiment with tcolorbox. – DrkVenom Nov 27 '15 at 13:58
  • @DrkVenom As you can see it's really easy to define theorem environments with tcolorbox so I'd suggest to change your theorem and example to tcolorbox. If you need help, just ask again. – Ignasi Nov 27 '15 at 15:02

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.