Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have defined

\theoremheaderfont{\normalfont\bfseries}
\theoremprework{\bigskip\hrule}
\theorempostwork{\hrule\bigskip}
\theorembodyfont{\slshape}
\newtheorem{definition}[satz]{Definition}

and now i am able to write something like

\begin{definition}fooBar\end{definition}

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
add comment

2 Answers

up vote 2 down vote accepted

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

\documentclass{article}
\usepackage[standard,framed]{ntheorem}
\usepackage{needspace}
\theoremheaderfont{\normalfont\bfseries}
\theoremprework{\bigskip\needspace{\baselineskip}\hrule} % note this line
\theorempostwork{\hrule\needspace{\baselineskip}\bigskip} % note this line
\theorembodyfont{\slshape}
\newtheorem{mydefinition}{Definition}

\usepackage{lipsum}

\begin{document}

\begin{mydefinition}
\lipsum[1]
\end{mydefinition}

\end{document}
share|improve this answer
    
Worked fantastically for me! Thanks ;) –  Christian Ivicevic Aug 5 '11 at 11:45
add comment

You can also consider using mdframed:

\usepackage{ntheorem}
\usepackage[ntheorem]{mdframed}
\theoremheaderfont{\normalfont\bfseries}
\theorembodyfont{\slshape}
\newmdtheoremenv[
  innerleftmargin=0pt,innerrightmargin=0pt,
  topline,bottomline,leftline=false,rightline=false,
  skipabove=\bigskipamount,skipbelow=\bigskipamount,
  %innertopmargin=\topsep,
  innerbottommargin=\topsep
  ]{definition}[satz]{Definition}
share|improve this answer
add comment

Your Answer

 
discard

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.