9

Is there a way to change the vertical space before/after theorem environments, without defining a new theorem style? I'm using amsthm package to define my new theorem environments.

8

Without defining new theorem styles, you can modify the macro that's used by default, which is \thm@space@setup

\documentclass{article}
\usepackage{amsthm,lipsum}
\makeatletter
\def\thm@space@setup{%
  \thm@preskip=5cm plus 1cm minus 2cm
  \thm@postskip=\thm@preskip % or whatever, if you don't want them to be equal
}
\makeatother

\newtheorem{thm}{Theorem}

\begin{document}
\lipsum[2]

\begin{thm}
$1+1=2$
\end{thm}

\lipsum[2]

\end{document}

The default value is \topsep. You don't need to have the same space above and below the theorem.

  • Ha! Perfect!! Thanks so much. Just one question: is \topsep used only by this macro? May I change only its value? – Sigur Dec 3 '12 at 22:24
  • 1
    @Sigur \topsep is the parameter normally used by list environments (enumerate, itemize and description); I would change neither the spacing around theorems nor \topsep, for what it's worth. :) – egreg Dec 3 '12 at 22:25
  • 1
    @Sigur \topsep is a rubber length. It's default value in the standard classes is 8pt plus 2pt minus 4pt (at 10pt size) or 10pt plus 4pt minus 6pt (at 12pt size). I believe it's a good compromise: not larger than the baseline skip (at least in its natural length), but flexible enough. Theorems already have a header that, together with the spacing, makes them prominent enough. – egreg Dec 3 '12 at 22:32
  • 1
    Is there a way to adjust the two parameters locally? – Argyll May 30 '16 at 9:55
  • 1
    Is there a way to modify the before/after environment spacing for a single instance? – Argyll May 30 '16 at 9:56

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.