Nopagebreak nopagebreak nopagebreak - why won't LaTeX listen to me?

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


Results in

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


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 \\
- 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.

-
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. –  Hendrik Vogt Dec 16 '10 at 15:53
what would you suggest I change to reduce the "rant" to a "colorful commentary"? –  gakera Dec 16 '10 at 15:54
@gakera: Try to go into a bikers bar and rant about bikes. ;-) –  Stefan Kottwitz Dec 16 '10 at 16:00
@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 '10 at 16:04
@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.) –  Hendrik Vogt Dec 16 '10 at 16:49

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.:

\makeatletter
\makeatother

-
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 '10 at 16:33
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). –  Ulrike Fischer Dec 16 '10 at 17:27
AHA! \clubpenalty=10000 added after the \\\* in the Knowledge ... line works great! Thanks. –  gakera Dec 16 '10 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.

-
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 '10 at 16:16
out of curiosity, what's wrong with setting penalties? Isn't that the proper TeX way of influencing breaks? –  Jan Hlavacek Dec 16 '10 at 16:58
@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 '10 at 17:11
A downside of \samepageis that \marginpar text seems to become unusable inside that block. –  Hugo Aug 16 '12 at 3:11
An example of minipage might be nice to add to your answer: \begin{minipage}[t]{\textwidth}...\end{minipage} –  Jonathan May 6 '13 at 17:54

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.

-
I'm pretty sure that \nopagebreak[4] is equivalent to \nopagebreak. –  Hendrik Vogt Dec 16 '10 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 '10 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. –  Yiannis Lazarides Dec 16 '10 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. –  Hendrik Vogt Dec 17 '10 at 10:06

You could also do this with samepage:

*full page before here*
\begin{samepage}
Knowledge in the \\


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}
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7606626152992249, "perplexity": 3132.4129149670766}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-32/segments/1438042988860.4/warc/CC-MAIN-20150728002308-00071-ip-10-236-191-2.ec2.internal.warc.gz"}