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

时间:2015-09-01 22:37:14

标签: latex page-break

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!

1 个答案:

答案 0 :(得分:4)

Remove the

\newcommand{\sectionbreak}{\clearpage}

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