2

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?

  • 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
2

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}
1

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}

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.