[Tex/LaTex] Why can’t I prevent page break

page-breaking

I am newbie to Latex and I am just making some lists of some common commands and learning the syntax.

This is what I have at the end of my first page.

using left and right bracketing commands\\
$$3\left(\frac{2}{5}\right)$$
$$3\left[\frac{2}{5}\right]$$
$$3\left\{\frac{2}{5}\right\}$$

This produces three lines. On the first line is my comment. On the second and third line are the examples with parentheses and square brackets. But then the third example is output to the second page.

I have found the \nopagebreak and tried applying that. But I can't make it work.

using left and right bracketing commands\\
$$3\left(\frac{2}{5}\right)$$
$$3\left[\frac{2}{5}\right]$$
\nopagebreak $$3\left\{\frac{2}{5}\right\}$$

The last part still jumps to the second page. I'm not sure… should the \nopagebreak command sit on the same line in the code like that?

I tried placing it at the end, in front, and at the beginning of this paragraph (in the code). I also tried setting the argument to 4 to insist on preventing page break. Like \nopagebreak[4]. But that didn't help.

So how do I prevent page break at this point?

There is page number indicator (index) that sits in the foot of the page. This sits very high up on the page. So there is actually some real estate here, where the last example could sit, if Latex could only make the foot note margin smaller on all or for the current page, just somehow move the number in the foot note down a little.

So I'm curious why this is not working out for me. I can post a screenshot if that helps.

Edit 1: Here's a screenshot.

page break

You can see how high up that number one is. There is more than enough space there to place both the fraction example and the page index.

Edit 2: Here is the whole working example.

\documentclass[11pt]{article}

\begin{document}
bracketing symbols;

parenthesis;
$$(x+1)$$

square brackets;
$$3[2+(x+1)]$$

curly brackets;\\
these are reserved symbols for coding in Latex\\
they are therefore normally not displayed
$${a,b,c}$$
so to display curly brackets in math mode\\
there needs to be a back slash in front\\
of each bracket
$$\{a,b,c\}$$

dollar sign;\\
the same is true for dollar sign\\
dollar signs are reserved to indicate\\
math mode in Latex\\
so to display a dollar sign in math mode\\
there needs to be a back slash in front of it

$$\$12.55$$

adjusting bracketing symbols to the height\\
of tall objects like fractions;

typing in only the bracket signs\\
$$3(\frac{2}{5})$$
$$3[\frac{2}{5}]$$
$$3\{\frac{2}{5}\}$$%curly brackets require an additional back slash

using left and right bracketing commands\\
$$3\left(\frac{2}{5}\right)$$
$$3\left[\frac{2}{5}\right]$$
\nopagebreak $$3\left\{\frac{2}{5}\right\}$$

\end{document}

As you can see here I do have a document class and a begin and end command. In case you thought I forgot those.

Best Answer

As mentioned in comments you are printing a document formatted for US letter paper on an A4 page. If you use

\documentclass[11pt,a4paper]{article}

Then it all fits on one page.

Related Question