I am having a report in Overleaf and after every section, there is white space left, so the next section starts always on a new page. How can I remove that so every section starts immediately after the previous section?
This behavior is ok for chapters but not for sections, subsection, etc.
The project is big and it looks like that currently:
\documentclass[a4paper, 12pt]{report}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{wrapfig}
\usepackage{fancyhdr}
\usepackage{subcaption}
\usepackage[margin=2cm,includehead,includefoot]{geometry}
\usepackage{float}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
\usepackage{appendix}
\usepackage{titlesec}
\usepackage{import}
\usepackage{amssymb}
\usepackage{listings}
\usepackage{csquotes}
\usepackage{endnotes}
\usepackage{ragged2e}
\usepackage{dirtree}
\usepackage{makecell}
\usepackage{todonotes}
\usepackage{longtable}
\usepackage{tabularx}
\justifying
\let\stdsection\section
\setlength{\marginparwidth}{2cm}
\titleformat{\chapter}[display]{\normalfont\bfseries}{}{0pt}{\Large}
\begin{document}
\chapter{Chapter}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur gravida ligula at ante ornare suscipit.
\section{Section}
Mauris vulputate facilisis gravida. Suspendisse pharetra cursus orci, eu mattis nisi faucibus non.
\section{Section}
Mauris vulputate facilisis gravida. Suspendisse pharetra cursus orci, eu mattis nisi faucibus non.
\end{document}
Edit: I have added a working example that you can copy and try for yourself, however even when i try this example it working for me the way i want it(you can see in the screenshots) The only difference is that in the original report is divided into files which are then imported in the main.


MWEof your code? – MadyYuvi Apr 02 '20 at 14:32biblatexetc – daleif Apr 02 '20 at 14:55\begin{document} \section{section} text \section{second section} more text \end{document}, I end up with both sectione appearing on one page. How do you add your sections? – leandriis Apr 02 '20 at 15:11\importor\include? My guess: you used\includeon every single section.\includeautomatically adds a new page. See also: When should I use \input vs. \include? – leandriis Apr 02 '20 at 15:12\include– Demi Dimitrova Apr 02 '20 at 15:13