2

I am making my own environments for a mathematical document (environments such as Theorem, Definition, Lemma... which often consists of a title corresponding to the environment and possible things at the end of the environment (such as the proof environment which has a cute little square at the end)). However, I hate it when something such as

Lemma.

--------------------------Page break here----------------

Beginning of the text in the lemma

happens. Is there any way to require the environment to fit all its content in one page in the environment description? Something like a 'no-page-break-allowed-here' command.

EDIT : For example, I'd like this environment to be modified so that it doesn't break :

\newenvironment{definition}
{
    \textbf{\underline{Definition.}}
    \vspace{12 pt}
    \itshape
}
  • Yes there is. However, you need to provide some more detail regarding the environment. For example, boxing it (in a minipage) would work, but doesn't provide a solution as far as I'm concerned. – Werner Jun 29 '13 at 21:47
  • @Werner : I provided an example of an environment. Could you fix that one? My other environments are about just as complex (perhaps with a extra thing or two but nothing really different than this one). – Patrick Da Silva Jun 29 '13 at 22:03
  • Underlining is not a good thing to do from a typographical point of view. Do you really want to skip a line between "Definition" and the following text? – egreg Jun 29 '13 at 22:18
  • For that particular kind of environments, the most easy way to define them so that they work as one want is by using the package [thmtools](www.ctan.org/pkg/thmtools). It is easy to use as you can see by reading the manual. Regarding the underlining, I'm not sure how to solve that using that package. It provides some boxed theorems, which looks similar to what you seems to want to achieve. I encourage you to follows egreg's advise. – leo Jun 29 '13 at 23:21
1

For your theorem-like structures, it's better to use a dedicated package (amsthm or ntheorem are the favorite ones, and there's a fron-end for both of them: thmtools). Using either of those packages you can easily define theorem styles and numbered or unnumbered structures that use those styles.

In the following example I used the amsthm package to define an unnumbered structure having similar specifications as the definition environment of your code snippet. The \newline used in the sixth mandatory argument causes the head of the theorem to appear on a line of its own, but doesn't prevent an undesired page break between the head and the body. For this, I used \needspace from the needspace package:

\documentclass{article}
\usepackage{needspace}
\usepackage{amsthm}

\newtheoremstyle{definition}
  {\topsep}
  {\topsep}
  {\itshape}
  {0pt}
  {\bfseries}
  {\newline}
  {0pt\needspace{2\baselineskip}}%
  {\thmname{\underline{#1}}~\thmnote{(#3)}}
\theoremstyle{definition}
\newtheorem*{definition}{Definition}

\begin{document}

\vspace*{43\baselineskip}% just to test that no separation is produced
\begin{definition}
Test
\end{definition}

\end{document}

As a final remark, not related to the question, underlined text is usually not considered a good typographical practice; in your case, using bold-faced font and underlining seems superfluous.

  • I agree that underlining is usually not good... I was trying some stuff out when I wrote it the first time, now it is not underlined :) – Patrick Da Silva Jul 16 '13 at 22:27
  • @PatrickDaSilva good to hear that :-) – Gonzalo Medina Jul 16 '13 at 22:29
  • I am reading the amsthm doc to understand the package better ; it took me a while before I stopped being scared reading such things... – Patrick Da Silva Jul 16 '13 at 22:54

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.