3

This question is related to this one.

I want to have theorem headers alone on a line like this:

Theorem 1.
some text...

In the amsthm documentation, they suggest doing this:

\newtheoremstyle{mystyle}{3pt}{3pt}{}{0pt}{\bfseries}{.}{\newline}{}
\theoremstyle{mystyle}

And it works... as long as the text of the theorem doesn't start with an itemize or an enumeration.

How can I make it work with amsthm in this case?

And... why does this work this (strange) way?

Here is a minimal example to show the problem:

\documentclass{article}
\usepackage{amsthm}

\newtheoremstyle{mystyle} % Name
  {3pt}                   % Space above
  {3pt}                   % Space below
  {}                      % Body font
  {0pt}                   % Indent amount
  {\bfseries}             % Theorem head font
  {.}                     % Punctuation after theorem head
  {\newline}              % Space after theorem head
  {}                      % Theorem head spec (can be left empty, meaning 'normal')

\theoremstyle{mystyle}
\newtheorem{Example}{Example}


\begin{document}

\begin{Example}
  This is on the next line.
\end{Example}

\begin{Example}
  \begin{itemize}
    \item But this isn't!
    \item \ldots
  \end{itemize}
\end{Example}

\begin{Example}~
  \begin{itemize}
    \item And now, there is too much vertical space above
    \item \ldots
  \end{itemize}
\end{Example}

\end{document}
1

3 Answers 3

5

Theorem assumes you start the body with a sentence, not with a list. The following workaround is available: you may start a bogus paragraph and then backtrack a line up:

\begin{Example}\leavevmode\vspace{-\baselineskip}
  \begin{itemize}
    \item This works
    \item \ldots
  \end{itemize}
\end{Example}
1
  • do you know how to remove the horizontal space inserted before the 1st item in a default theorem environment?
    – Sigur
    Commented Apr 7, 2015 at 12:02
2

The answer by Boris didn't actually solve my problem, when I had the same. The spacing between the Example X text and the list number wasn't right.

But I realized that I could simply write something like this:

\begin{Example} $ $
  \begin{itemize}
    \item This works
    \item \ldots
  \end{itemize}
\end{Example}

Remark the empty math environment which forces LaTeX the think that there is a text block right after the Example X text.

I just wanted to share my solution, since I wasn't satisfied with the answer provided - I hope it helps somebody.

0

Here is another solution:

\documentclass{article}
\usepackage{amsthm}

\newtheoremstyle{mystyle} % Name
  {3pt}                   % Space above
  {3pt}                   % Space below
  {}                      % Body font
  {0pt}                   % Indent amount
  {\bfseries}             % Theorem head font
  {.}                     % Punctuation after theorem head
  { }              % Space after theorem head
  {}                      % Theorem head spec (can be left empty, meaning 'normal')

\theoremstyle{mystyle}
\newtheorem{ExampleAux}{Example}
\newenvironment{Example}{\begin{ExampleAux}\leavevmode\par}{\end{ExampleAux}}


\begin{document}

\begin{Example}
  This is on the next line.
\end{Example}

\begin{Example}
  \begin{itemize}
    \item But this isn't!
    \item \ldots
  \end{itemize}
\end{Example}

\begin{Example}~
  \begin{itemize}
    \item And now, there is too much vertical space above
    \item \ldots
  \end{itemize}
\end{Example}

\end{document}

1

Here are some links to related questions:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .