[Tex/LaTex] Use \newtheoremstyle to define a custom example environment

amsthmenvironmentsexamplestheorems

I am trying to define a custom example environment for my thesis, but with my limited knowledge of LaTeX I am not able to figure this out from the amsthm documentation. Here is a minimum working example, or more correctly a working example of how I wished it looked like.

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{blindtext}

\usepackage{amsthm}
\newtheoremstyle{example} ... % something to add that makes sense

\begin{document}

\chapter{First Chapter}
\blindtext

\begin{example}
Here is an example with with some random text that covers multiple lines such that we have a good visual understanding of the lay-out. The example must cover about three lines.
\end{example}

\blindtext

\begin{example}
Here is another example with with some random text that covers multiple lines such that we have a good visual understanding of the lay-out. The example must cover about three lines.
\end{example}

And some text at the end of the chapter.

\end{document}

And then the output I would like to have, should look like:

enter image description here

I tried to use \newtheoremstyle{break} as it is described in the amsthm documentation on page 9, but I didn't succeed. Preferably I would also like to be able to set the space above and below the example such that it is clear where the example stops from the spacing in the lay-out. I hope this isn't a dumb question, but I simply couldn't figure it out myself from the documentation.

Best,
Koen

Best Answer

It's quite easy to do with ntheorem. I loaded the package with options thref (extended references for theorem-like environments) and thmmarks (automatic placement of end-of-proof symbols, including when the proof ends up in equations):

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath} %
\usepackage{blindtext}

\usepackage[thref, thmmarks, amsmath]{ntheorem}
\theoremstyle{break}
\theoremheaderfont{\bfseries}
\theorembodyfont{\normalfont}
\theoremseparator{\medskip}
\theorempreskip{\bigskipamount}
\newtheorem{example}{Example}[chapter]

\begin{document}

\chapter{First Chapter}

\blindtext

\begin{example}
  Here is an example with with some random text that covers multiple lines such that we have a good visual understanding of the lay-out. The example must cover about three lines.
\end{example}

\blindtext

\begin{example}
  Here is another example with with some random text that covers multiple lines such that we have a good visual understanding of the lay-out. The example must cover about three lines.
\end{example}

And some text at the end of the chapter.

\end{document}

enter image description here