4

I'm just writing my bachelor thesis and i got into some problems with vspace. To seperate definitions, theorems and so on, from the rest of the text i defined the following environment:

\newenvironment{myblock}{%
\vspace{.5\baselineskip}
\hrule\nopagebreak\vspace*{.5\baselineskip}\nopagebreak}
{\nopagebreak\vspace*{.5\baselineskip}\nopagebreak\hrule\vspace*{.5\baselineskip}}

and this environment for definitions:

\newcounter{definition}[section]
\renewcommand*\thedefinition{\thesection.\arabic{definition}}
\newenvironment{definition}{%
\refstepcounter{definition}
\begin{myblock}
\textbf{Definition \thedefinition}
}
{\end{myblock}}

In some cases the vspace bevore and after the hrules become extremly large. Since I don't know the reason for this behaviour I'm not able to create an MWE. However, I tried to remove the \nopagebreak commands and replaced the \baselineskip by a precise number of pt. None of this solved the problem.

Does anyone here know the reason, or even better a possibility to resolve this problem?

EDIT: Here is an example picture, the space between the hrule and the line should be .5\baselineskip:

exmaplepicture

3
  • 2
    Did you try \raggedbottom in your preamble, instead of the default \flushbottom? On another hand, to separate theorem-like structures from ordinary text, you'd better use a dedicated package such as ntheorem.
    – Bernard
    Oct 19, 2014 at 12:29
  • 2
    I think that you should use the features of mdframed or tcolorbox for defining “ruled theorems”.
    – egreg
    Oct 19, 2014 at 12:30
  • I just tried \raggedbottom and it solved my problem. Either anyway I will try the packaged you suggested, because I think, that that would be a cleaner solution. Thanks for the quick help :-)
    – Dave
    Oct 19, 2014 at 12:43

1 Answer 1

4

I believe you should use mdframed instead of that handmade version.

\documentclass{article}
\usepackage{amsthm,mdframed}
\usepackage{lipsum}

\mdfdefinestyle{ruledtheorem}{
  topline=true,
  bottomline=true,
  leftline=false,
  rightline=false,
  innertopmargin=0pt,
  innerbottommargin=.5\baselineskip,
  innerleftmargin=0pt,
  innerrightmargin=0pt,
}

\newmdtheoremenv[
  style=ruledtheorem,
]{lemma}{Lemma}

\theoremstyle{definition}
\newmdtheoremenv[
  style=ruledtheorem,
]{definition}[lemma]{Definition}

\begin{document}

\lipsum[2]

\begin{definition}
A pig is called a \emph{flypig} if it can fly.
\end{definition}

\lipsum[3]

\begin{lemma}
Flypigs exist.
\end{lemma}

\lipsum[4]

\end{document}

enter image description here

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.