1

(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}
\draw (0,0) circle [radius=4];
\end{tikzpicture}    
\end{center}
\end{solution}
\end{document}

enter image description here

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
1

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}
\draw (0,0) circle [radius=2];
\end{tikzpicture}    
\end{center}
\end{solution}

\end{document}

enter image description here

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).

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.