# Keep theorem heading up when followed by centered content

(I am sure this question has already been asked. I just couldn't find it.)

\documentclass{article}
\usepackage{amsmath, amsthm, tikz}
\newtheoremstyle{solutionstyle}
{12pt}{8ex}{\normalfont}{}{\bfseries}{\normalfont\bfseries\vspace{3ex}}{\newline}{}
\theoremstyle{solutionstyle}
\newtheorem{solution}{Solution}

\begin{document}
\begin{solution}

\begin{center}
\begin{tikzpicture}
\end{tikzpicture}
\end{center}
\end{solution}
\end{document}


What is the suggested way to keep my theorem heading up where it is supposed to be, when it is immediately followed by a centered image, etc.

• Nasty trick: add \item before \begin{center}. AFAIK both theorems and center are actually lists. And if the item is empty the next list does not go to a new line. – daleif Jan 17 at 14:56

You can't start an environment based on trivlist, such as center, immediately after \begin{solution}.

However, you don't really want center:

\documentclass{article}
\usepackage{amsmath, amsthm, tikz}

\newtheoremstyle{solutionstyle}
{12pt}
{8ex}
{\normalfont}
{}
{\bfseries}
{\normalfont\bfseries\vspace{3ex}}
{\newline}
{}
\theoremstyle{solutionstyle}
\newtheorem{solution}{Solution}

\begin{document}

\begin{solution}
$x=1$
\end{solution}

\begin{solution}\mbox{}
\begin{center}
Obvious\\
to\\
everybody
\end{center}
\end{solution}

\begin{solution}\mbox{}
\begin{center}
\begin{tikzpicture}
\end{tikzpicture}
\end{center}
\end{solution}

\end{document}


There's too much blank space left. You may want to use (or abuse) $...$.

\documentclass{article}
\usepackage{amsmath, amsthm, tikz}

\newtheoremstyle{solutionstyle}
{12pt}
{8ex}
{\normalfont}
{}
{\bfseries}
{\normalfont\bfseries\vspace{3ex}}
{\newline}
{}
\theoremstyle{solutionstyle}
\newtheorem{solution}{Solution}

\begin{document}

\begin{solution}
$x=1$
\end{solution}

\begin{solution}
$\fbox{\begin{tikzpicture} \draw (0,0) circle [radius=2]; \end{tikzpicture}}$
\end{solution}

\end{document}


(\fbox added for better showing the vertical space).