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.

In my document, the page happens to break right after the line that introduces an example environment:

\documentclass{article}
\usepackage{gb4e}

\begin{document}
\noindent Here are my results:
    \begin{exe}
        \ex This is my first result.
        \ex This is my second result.
    \end{exe}
\end{document}

I tried to put Here are my results:\nobreak, as indicated in this answer, but that changed nothing for me. What should I do?

share|improve this question
    
Try \makeatletter\@afterheading\makeatother. –  Stephan Lehmke Dec 11 '12 at 20:24
    
I tried Here are my results:\makeatletter\@afterheading\makeatother, but that didn't work. –  Sverre Dec 11 '12 at 20:25
2  
if you insert \goodbreak before the line "Here are my results:" that would encourage latex to push that line to the next page if it's within a line or two of the bottom of the page, and wouldn't do anything if there's more space than that. not a great approach, but better than a page forced by \newpage. (i didn't go into gb4e, but it's likely that surgery there would be necessary to permit something like \nobreak to be effective.) –  barbara beeton Dec 11 '12 at 20:31
    
Oops, sorry. I think you need \par \nobreak\makeatletter\@afterheading\makeatother. Sorry for groping in the dark, but your MWE has no page break ;-) –  Stephan Lehmke Dec 11 '12 at 20:35
    
barbara's \goodbreak works fine. Stephan's latter approach works too, but it also removes the vertical space that's normally above the exe environment. –  Sverre Dec 11 '12 at 20:40

1 Answer 1

up vote 4 down vote accepted

if you insert \goodbreak before the line "Here are my results:" that would encourage latex to push that line to the next page if it's within a line or two of the bottom of the page, and wouldn't do anything if there's more space than that. not a great approach, but better than a page forced by \newpage.

i didn't go into gb4e, but it's likely that surgery there would be necessary to permit something like \nobreak to be effective.

share|improve this answer

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.