Fun times, I'm making a (manual) index of the lecture slides for class (which are nowhere near latex, ppt files yay) and of course Latex insists on placing pagebreaks willie nillie through my items. Why isn't there a "keep (paragraph) with next (paragraph)" option like there is in Word 2007 (and all others I think). Is Word really more powerful than Latex [when it comes to this specific attribute of paragraph flow]?

*full page before here*
Knowledge in the \nopagebreak\\
\nopagebreak - Head

Results in

*full page*
Knowledge in the 
---8<--- Next page
- Head ... 

Yes, I know I can place a \newpage before the line to push it to the next page, but there has to [HAS TO] be a way to make Latex understand that this isn't what I want, these two lines are supposed to stick together!

Edit: Full context:

*empty line*
Knowledge in the \\
- Head \slid{44, 69}
- World \slid{5, \textbf{44}, 66, 69, 84}
*empty line*

With slid being:

\newcommand{\slid}[1]{\dotfill #1 \nopagebreak\\}

It seems to be to be that the -World line is pulling down the -Head line, if I add an empty line between them, both Knowledge.. and -Head stay on the same page, with -World on the next one. But when I combine the two, only -Head gets pulled to a new page, and Knowledge... stays on the previous page.

  • 17
    Yes, \nopagebreak can be extremely tricky, and this is unfortunate. While this site is the right place to ask such a question, I think it's not a place to rant about LaTeX. Dec 16, 2010 at 15:53
  • 7
    @gakera: Try to go into a bikers bar and rant about bikes. ;-)
    – Stefan Kottwitz
    Dec 16, 2010 at 16:00
  • 9
    @Stefan It's the Word comment, isn't it :) I knew that would get under some skins, people have to have a sense of humor also, this is harmless teasing. And, if this is truly something that Word can do but Latex can not do, I stand by my "rant", hah! :D
    – gakera
    Dec 16, 2010 at 16:04
  • 5
    I have a tendency to rant when it comes to Latex, mainly because of weird things like these. And I try to keep it just, as I said, if this is truly something that is easier to do in Word than in Latex, I don't feel I overstepped anything. I'm sorry if you find my critique of Latex unpleasant, but it wouldn't be what it is today if nobody critiqued it.
    – gakera
    Dec 16, 2010 at 16:22
  • 7
    @gakera: Now you have added some context, that's good. However, I can't reproduce the behaviour you're describing: For me, \nopagebreak does work. Maybe you can replace the context bit with a full compilable (but minimal) example? (Incidentally, I'm a professional when it comes to ranting; I even rant about LaTeX from time to time. I just don't do it here as I like the site to be a friendly place.) Dec 16, 2010 at 16:49

5 Answers 5


If "- Head -" is a normal text line \\* should work. If not we need to know what it is. In a lot of case solutions with \@afterheading can be used, e.g.:

  • OOOHH, I had such high hopes for \\\* I'm sad to say that doesn't change anything, but I did update the OP with full context, to me the -Head line is just a normal text line, unless I'm just way too stupid to be using Latex.
    – gakera
    Dec 16, 2010 at 16:33
  • 5
    Ah, I see. Your \\* is after the first line of a paragraph. In this case \clubpenalty gets in the way. You will have to set it to 10000 temporarly for this paragraph. (\clubpenalty=10000). Dec 16, 2010 at 17:27
  • 1
    AHA! \clubpenalty=10000 added after the \\\* in the Knowledge ... line works great! Thanks.
    – gakera
    Dec 16, 2010 at 17:56

You could use a minipage environment or a \parbox. They won't be broken accross pages.

Further, LaTeX provides the \samepage command, which may be used as environment: \begin{samepage}...\end{samepage}. But I would not use samepage because it relies on setting penalties.

Also, the needspace packages comes often handy in such cases.

  • 3
    hmm needspace sounds interesting. I decided to use \begin{minipage}{\textwidth} ... \end{minipage} even though that feels like I'm shooting a canon at the canary.
    – gakera
    Dec 16, 2010 at 16:16
  • out of curiosity, what's wrong with setting penalties? Isn't that the proper TeX way of influencing breaks? Dec 16, 2010 at 16:58
  • 1
    @Jan: It might not work at all places. And \samepage support is questionable in LaTeX2e, which can be read in source2e.pdf p344, p358.
    – Stefan Kottwitz
    Dec 16, 2010 at 17:11
  • A downside of \samepageis that \marginpar text seems to become unusable inside that block.
    – WhyNotHugo
    Aug 16, 2012 at 3:11
  • 1
    An example of minipage might be nice to add to your answer: \begin{minipage}[t]{\textwidth}...\end{minipage}
    – Jonathan
    May 6, 2013 at 17:54

You could also do this with samepage:

*full page before here*
Knowledge in the \\

- Head

Alternately, use the needspace package. Before entering a bit where you absolutely need to have 48 points of vertical space (for example) put in \needspace{48pt}


Did you try \nopagebreak[4] ? As to the second part of your question

Is Word really more powerful than Latex?

There is absolutely no comparison to LaTeX. Word produces ugly, unstructured documents, crashes frequently, can eat your files and you have to recover, knows of no typographical rules and you have to pay a licence. As opposed to LaTeX it processes words rather than typesetting books, articles or other structured documents.

  • 4
    I'm pretty sure that \nopagebreak[4] is equivalent to \nopagebreak. Dec 16, 2010 at 16:00
  • Yes, same results with all those nopagebreaks turned up to 4 :( I know Word sucks, but at least this is no problem to do in Word. Just one click and all is well.
    – gakera
    Dec 16, 2010 at 16:01
  • @Hendrik possibly it can still fail in a bad spot, 0 : penalty = 0, 1 : penalty = \@lowpenalty, 2 : penalty = \@medpenalty, 3 : penalty = \@highpenalty, 4 : penalty = 10000, but without a minimal is difficult to check.
    – yannisl
    Dec 16, 2010 at 18:42
  • I'm not sure what you're aiming at. Of course \nopagebreak can fail, but adding [4] doesn't help as indeed those two are equivalent. Dec 17, 2010 at 10:06
  • 5
    :-( I have to disagree with nearly everything you said about Word (or any comparable open source alternative). I think LaTeX is uglier (less consistent), harder to use, crashes more (or worse, fails to compile/create the document at all)... Yes LaTeX is more powerful, but it's also far more crude. I don't need to build a combustion engine every time I want to drive to the store, I shouldn't have to build an entire typesetting structure every time I want to write a paper. It's just horrific. Jun 22, 2016 at 0:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .