11

I have a spacing problem. Whenever I include a theorem environment, \begin{theorem}\end{theorem}, the theorem appears very close to the previous line. The spacing is much less than the normal spacing between lines. Do any one have any idea to change this? I don't just ad hoc add \vskip at each theorem environment.

Minimal not working example:

\documentclass[12pt,letterpaper]{article}

\usepackage{lmodern}
\usepackage[T1]{fontenc}

\usepackage{amsmath} % AMS mathmode stuff
\usepackage{amsthm}
\usepackage{parskip} % remove auto-indentation of paragraphs with \setlength{\parindent}{0pt}

\newtheorem{thm}{Theorem}
\newenvironment{theorem}[1][]{\begin{thm}[#1]\upshape}{\end{thm}}

\begin{document}

 \section{Test}

 Let there be nice spacing.

 \begin{theorem}
  No space for you!
 \end{theorem}

\end{document}

It produces the following as output:

enter image description here

Commenting out \usepackage{parskip} causes the following output to be produced:

enter image description here

  • 2
    Since this doesn't happen with the standard classes and settings, you should show a minimal working example (MWE) that illustrates your problem. – egreg Jul 2 '11 at 10:54
  • Thanks egreg. I have a quite complicated setting. I include many style files. Please see what I add above – Anand Jul 2 '11 at 10:57
  • 1
    @Anand: please use backticks to mark your inline code for more readabity, I just did that for you. Btw. greeting is not necessary, and the name is already right below the question. Omitting it helps to concentrate on the problem. ;-) – Stefan Kottwitz Jul 2 '11 at 10:59
  • 1
    @Anand: another tip following your edit: if you indent lines by 4 spaces, then they are marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). Seamus has been so kind to do that. – Stefan Kottwitz Jul 2 '11 at 11:06
  • @Stefan Kottwitz, thank you very much for these comments and your editing of my questions. :-) – Anand Jul 2 '11 at 11:24
17

Put the following code in the preamble:

\makeatletter
\def\thm@space@setup{%
  \thm@preskip=\parskip \thm@postskip=0pt
}
\makeatother

The problem is that amsthm sets \thm@preskip to \topsep, which is zeroed by parskip.

  • Dear egreg, how to space before definitions? What you proposed works well with theorem but it seems not working for definitions. Thanks a lot! – Anand May 3 '12 at 21:11
  • 1
    @Anand Sorry, but you should provide a minimal example. – egreg May 3 '12 at 21:13
  • Thanks egreg for your prompt answer. I have fixed the problem. I changed the theoremstyle and fixed the problem. :-) – Anand May 3 '12 at 21:16

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.