I'm trying to optimize my math article. I wrote enviroments for definitions, theorems, and so on...
I like to shade the backround of a theorem or definiton. But I'm not able to set the headline in the shaded box. I uploaded a picture with an example.
\documentclass{article}
\usepackage{mathtools}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{mdframed}
\usepackage{amsthm}
\newtheoremstyle{toubob}%
{3pt}{3pt}{}{}{\bfseries}{:}{\newline}{}
\theoremstyle{toubob}
\newtheorem{defi}{Definition}
\surroundwithmdframed[backgroundcolor=green!20!white]{defi}
\begin{document}
\blindtext
\begin{defi}
This is a simple test without any maths.\par
Das ist ein simpler Test ohne Mathe.
\end{defi}
\end{document}
To the question why the shaded box does not include the header. Take a look at the code and read it out loud.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Thank you Johannes! Is it possible to use one counter for different theorems (corollary, theorem, definition) but with one counter and roman numbers in the headline?
To be honest, i wouldn't use roman numbers here. If your document gets long, this will be a mess. There is a reason why the roman numbering system didn't catch on ;-)
\documentclass{article}
\usepackage{mathtools}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{mdframed}
\usepackage{amsthm}
\newtheoremstyle{toubob}%
{3pt}{3pt}{}{}{\bfseries}{:}{\newline}{}
\theoremstyle{toubob}
\newtheorem{defi}{Definition}
\newtheorem{touthm}[defi]{Theorem}%use the same counter as defi
\renewcommand{\thedefi}{\roman{defi}}
\surroundwithmdframed[backgroundcolor=green!20!white]{defi}
\begin{document}
\blindtext
\begin{touthm}
This is a simple definition test without any maths.\par
Das ist ein simpler Test ohne Mathe.
\end{touthm}
\begin{defi}
This is a simple theoremtest without any maths.\par
Das ist ein simpler Test ohne Mathe.
\end{defi}
Now we have quite a lot of text, many definitions, theorems and
other stuff.
\setcounter{defi}{84}
\begin{touthm}
This is a simple theorem test without any maths.\par
Das ist ein simpler Test ohne Mathe.
\label{thm:large}
\end{touthm}
As we can see in theorem~\ref{thm:large}, the number is ugly,
even more if uppercased.
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Thanks to you Johannes, again. I know what you mean with the roman letters but for that one work, I need it. Know I'm happy with the result. My last question is, how to set a bit more space between the black border of the theorem and the headline? Just a bit, so that it's the same as it is between the last text line and the bottom borderline.
I am not quite sure which spaces you explicitely mean.
Within the theorem environment, you can control vertical spacing with the first two arguments.
If you surround something with package mdframed, the packages provides a whole bunch of its own commands to tweak the appearance.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.