[Tex/LaTex] Alternative theorem styles with amsthm package

amsthm

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.

Best Answer

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

Related Question