9

I am writing a document with many lemmas, theorems, and proofs. I don't like the default styling available, mainly because it places almost no visual separation between theorems and text (or proofs and text).

I would like the following:

A definiton environment with larger margins and a vertical line on the left side, so I can clearly see where the definition starts and ends, by noticing where the vertical line begins and ends.

Is there any theorem style that would achieve this? Any similar style which would at least make the theorems and proofs stand out from the text?

Thanks!

p.s. Currently, I end a definition block with a \( \qed \) so there is some indication that the definition ended.

1 Answer 1

18

You can use mdframed:

\documentclass{article}
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}

\theoremstyle{plain}
\newmdtheoremenv[
  linecolor=cyan,
  roundcorner=5pt,
  linewidth=1pt
]{theo}{Theorem}

\theoremstyle{definition}
\newmdtheoremenv[
  hidealllines=true,
  leftline=true,
  innerleftmargin=10pt,
  innerrightmargin=10pt,
  innertopmargin=0pt,
]{defi}{Definition}

\begin{document}

\lipsum[4]
\begin{defi}
\lipsum[4]
\end{defi}
\lipsum[4]
\begin{theo}
\lipsum[4]
\end{theo}

\end{document}

enter image description here

The package offers many additional customization options; please refer to the package documentation which also contains numerous examples.

If a same style is to be used for several structures, then it's better to define a style to be used multiple times; the package also offers a very useful \surroundwithmdframed command to apply mdframed settings to an already defined environment. In the following example I define a style, built an structure for definitions using this style, and surround the standard proof environment (from amsthm) with this style:

\documentclass{article}
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}

\mdfdefinestyle{mystyle}{
  hidealllines=true,
  leftline=true,
  innerleftmargin=10pt,
  innerrightmargin=10pt,
  innertopmargin=0pt,
}
\surroundwithmdframed[style=mystyle]{proof}
\theoremstyle{definition}
\newmdtheoremenv[style=mystyle]{defi}{Definition}

\begin{document}

\lipsum[4]
\begin{defi}
\lipsum[4]
\end{defi}
\lipsum[4]
\begin{proof}
\lipsum*[4]
\end{proof}

\end{document}

enter image description here

4
  • Thanks again! Now, if I wanted to place the proof in the same environment, would it be as simple as adding it inside the defi environment?
    – gdiazc
    Feb 9, 2014 at 19:14
  • @Gonzalo You're welcome! It would be even simpler once you define a style and use \surroundedwithmdframed. Please see my updated answer. Feb 9, 2014 at 19:26
  • @GonzaloMedina these are nice solutions. However, I'm interested in something simpler. Part of the original post was a query on how to increase the "visual separation between theorems and text" that is part of the default styles. I can't see how this is achieved amongst all of the other features. Could you point this out please? Jul 10, 2014 at 10:27
  • @JasonWhyte in that case, simply use \newtheoremstyle from the amsthm package and build a style with extra vertical separation with the surrounding text. Jul 10, 2014 at 13:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .