Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid page break in latex when a new section is created after the previous subsection? [closed]

I am working on latex document. My packages are

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{color}
\usepackage{ragged2e} 
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage}
\setcounter{tocdepth}{6}
\setcounter{secnumdepth}{6}

Everything is fine but when the first subsection is completed and I use the next section command \section{blah blah}, it starts on a new page. I have abundant space in the same page and hence I don't want the page break. I even used \nopagebreak command and it's still the same. Please help!

like image 793
Ana_Sam Avatar asked Sep 01 '15 22:09

Ana_Sam


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.

What is Clearpage LaTeX?

The \clearpage command ends the current page and causes all figures and tables that have so far appeared in the input to be printed.

How do I make text go to next page in LaTeX?

The \pagebreak command tells LaTeX to break the current page at the point of the command. With the optional argument, number , you can convert the \pagebreak command from a demand to a request.


1 Answers

Remove the

\newcommand{\sectionbreak}{\clearpage}

command and use \pagebreak where ever required. That satisfies your requirement. Hope it helps!

like image 138
Rudhra Avatar answered Oct 21 '22 13:10

Rudhra