Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make an unbreakable block in TeX [closed]

I want to do something like the following in TeX:

\begin{nobreak}    Text here will not split over pages, it will remain as one continuous chunk. If there isn't enough room for it on the current page a pagebreak will happen before it and the whole chunk will start on the next page.    \end{nobreak} 

Is this possible?

like image 413
fredley Avatar asked Oct 23 '10 10:10

fredley


People also ask

How do you stop page breaks in LaTeX?

The \nolinebreak command prevents LaTeX from breaking the current line at the point of the command. With the optional argument, number, you can convert the \nolinebreak command from a demand to a request. The number must be a number from 0 to 4. The higher the number, the more insistent the request is.

How do I keep paragraphs together in LaTeX?

See the FAQ: Yet another trick by Knuth is useful if you have a sequence of small blocks of text that need, individually, to be kept on their own page. Insert the command \filbreak before each small block, and the effect is achieved.

How do you keep words together in LaTeX?

The correct answer may be to put the two word in an \mbox{keep together} . Then you avoid hyphenation, but not overfull lines. Then, you can write \MSA/ (notice the slash), and LaTeX will not eat a following space. Unfortunately, such commands may be awkward to type keyboards other than US-English.

How do you end a page in LaTeX?

10.2 \newpage LaTeX's page breaks are optimized so ordinarily you only use this command in a document body to polish the final version, or inside commands. While the commands \clearpage and \cleardoublepage also end the current page, in addition they clear pending floats (see \clearpage & \cleardoublepage ).


1 Answers

You could try:

\begin{samepage}  This is the first paragraph. This is the first paragraph.   This is the first paragraph. This is the first paragraph.    \nopagebreak  This the second. This the second. This the second.   This the second. This the second. This the second.   This the second. This the second.  \end{samepage} 

samepage prevents LaTeX from pagebreaking within one paragraph, i.e. within the samepage environment, pagebreaks are only between paragraphs. Thus, you need nopagebreak as well, to prevent LaTeX from pagebreaking between two paragraphs.

like image 89
phimuemue Avatar answered Oct 28 '22 23:10

phimuemue