TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have defined


and now i am able to write something like


but i am getting a weird behavior with the prework of the theorem! LaTeX sets the top \hrule on one page and the rest of the definition on another page! See here what i mean. Althoug it is german you can see that the top hrule of definition 1.2.7 is on page 6 while the rest can be found on top of page 7 (pages have a header line in my layout!). Any idea how to move this hrule to the same page as the definition without using \newpage to have still a dynamic document?

share|improve this question
This looks like a duplicate of this question – Seamus Aug 4 '11 at 13:15
But i do not understand how to fix this with my template. I have way too many theorem environments to fix them easily. – Christian Ivicevic Aug 4 '11 at 13:29
Philippe's answer to the linked question involved redefining the theorem environment. Does this not work for you? If not could you explain why not? – Seamus Aug 4 '11 at 13:34
My environment is called definition and with renewenvironment the layout is screwed. Furthermore i have problems with the counter which in fact does not exist! Seems like i have to use \clearpage or \newpage... – Christian Ivicevic Aug 4 '11 at 13:55
As Phileppe's answer says, theorems are defined as lists and so there are break points in them. I'm not sure there's much more help we can offer without more of a complete example and more explanation about why the solution in that other question isn't satisfactory. – Seamus Aug 4 '11 at 14:01
up vote 2 down vote accepted

I think the needspace pacakge might help here. Have a look at the code below

\theoremprework{\bigskip\needspace{\baselineskip}\hrule} % note this line
\theorempostwork{\hrule\needspace{\baselineskip}\bigskip} % note this line




share|improve this answer
Worked fantastically for me! Thanks ;) – Christian Ivicevic Aug 5 '11 at 11:45

You can also consider using mdframed:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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