I wrote something in LyX and then converted that into a tex file. But when I convert the tex file into a pdf, a huge gap is produced between the last sentence of a paragraph and the next section title like here:
In addition, a large gap is created between one image and another paragraph like the following:
I am pasting here the preamble set by LyX by default:
\documentclass[12pt,twoside,english,refpage,intoc,bibliography=totoc,index=totoc,BCOR7.5mm,captions=tableheading]{article}
\usepackage{lmodern}
\renewcommand{\sfdefault}{lmss}
\renewcommand{\ttdefault}{lmtt}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=1in,bmargin=1.25in,lmargin=1in,rmargin=1in,headheight=1in,headsep=1in,footskip=1in}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{color}
\usepackage{babel}
\usepackage{array}
\usepackage{booktabs}
\usepackage{float}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage[authoryear]{natbib}
\usepackage[unicode=true,bookmarks=true,bookmarksnumbered=true,bookmarksopen=false, breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=true]
{hyperref}
\hypersetup{pdftitle={The LyX User's Guide},
pdfauthor={LyX Team},
pdfsubject={LyX},
pdfkeywords={LyX},
linkcolor= black, citecolor=black, urlcolor=blue, filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\newlength{\lyxlabelwidth} % auxiliary length
Any suggestions on how to reduce those gaps shown above? Thanks in advance.


twoside, LaTeX activates\flushbottom, i.e. the content of each page will be stretched vertically to fill the whole page, so that you don't get asymmetrical pages. You can turn that off by adding\raggedbottom. – Torbjørn T. Oct 21 '17 at 08:40