0

**Update

This might be a repetitive question, but I do not know to prevent this additional white space from showing up.

Attached is my MWE to show additional white space that I have been unable to get rid of. Specifically, page 11 in between the paragraphs and subsections. I need to specify the strict spacing between all sections/subsections/paragraphs etc.

Here is my MastersDoctoralThesis.cls file:


\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{MastersDoctoralThesis}[12/7/20 MastersDoctoralThesis]

\DeclareOption{11pt}{
    \PassOptionsToClass{\CurrentOption}{article} % book report
}

\ExecuteOptions{11pt}

\ProcessOptions\relax

\LoadClass[11pt,letterpaper]{report}

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5} 

\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}

\RequirePackage{amssymb}
\let\bvec\mathbf 
\RequirePackage{empheq}
\RequirePackage{amsbsy}
\RequirePackage{mathtools}
\DeclarePairedDelimiterX{\norm}[1]{\lVert}{\rVert}{#1}

\RequirePackage{mathpazo}

\newlength{\UOneInChapterSpace}
\newlength{\UHeadSpace}
\newlength{\UDoubleSpace}
\makeatletter

\RequirePackage{calc}
\setlength{\UOneInChapterSpace}{-40pt + 1in} 
\setlength{\UHeadSpace}{3ex}
\setlength{\UDoubleSpace}{1ex}

\RequirePackage{setspace}
\RequirePackage{etoolbox}

\AtBeginEnvironment{figure}{\addvspace{\UHeadSpace}}
\AtEndEnvironment{figure}{\addvspace{\UHeadSpace}}
\AtBeginEnvironment{table}{\addvspace{\UHeadSpace}}
\AtEndEnvironment{table}{\addvspace{\UHeadSpace}}
\AtBeginEnvironment{equation}{\addvspace{\UHeadSpace}}
\AtEndEnvironment{equation}{\addvspace{\UHeadSpace}}
\AtBeginEnvironment{tabular}{\singlespacing}

\RequirePackage{subfiles}

\RequirePackage{lipsum}

\RequirePackage{longtable} 
\RequirePackage{booktabs}

\newbool{graphicDraft}
\DeclareOption{graphicFinal}{\boolfalse{graphicDraft}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\ProcessOptions\relax
\ifbool{graphicDraft}
    {\RequirePackage[draft]{graphicx}}
    {\RequirePackage[final]{graphicx}}

\RequirePackage{subcaption}
\RequirePackage{animate}
\RequirePackage{pdfpages}

\RequirePackage[font=singlespacing]{caption}

\RequirePackage{todonotes}

\RequirePackage{geometry}
\geometry{
    paper          = letterpaper,
    inner          = 1.25in,
    outer          = 1.25in,
    bindingoffset  = 0in,
    top            = 1in,
    bottom         = 1in,
    %head           = 2in,
    %showframe,
}

\RequirePackage{xcolor} % Required for specifying custom colors
\definecolor{BLACK}{HTML}{000000}
\definecolor{URED}{HTML}{CC0000}
\definecolor{midnightBlue}{HTML}{145680} % midnight blue
\definecolor{darkBrown}{HTML}{654321} % Dark brown
\definecolor{arsenic}{HTML}{3B444B}
\definecolor{darkGreen}{HTML}{00b300} % Dark green
\definecolor{tab:blue}{HTML}{1f77b4} % python

\RequirePackage{sectsty}

\chapternumberfont{\normalsize} 
\chaptertitlefont{\normalsize}

\RequirePackage[nostruts,compact]{titlesec}

\titlespacing{\chapter}{0in}{\UOneInChapterSpace}{\UHeadSpace}[0in] 
\titlespacing{\section}{0in}{0in}{\UDoubleSpace}[0in]
\titlespacing{\subsection}{0in}{0in}{\UDoubleSpace}[0in]
\titlespacing{\subsubsection}{0in}{0in}{\UDoubleSpace}[0in]
\titlespacing{\paragraph}{1em}{1ex}{1ex}[1em]

\titleformat{\chapter}
    [display]
    {\color{URED}\centering\normalfont\Large\bfseries\doublespacing}
    {\MakeUppercase{\chaptertitlename} \Large\thechapter}
    {0in}
    {\MakeUppercase}
    []

\titleformat{\section}
    [hang]
    {\centering\singlespacing\normalfont\Large\bfseries}
    {\thesection}
    {1ex}
    {}
    []

\titleformat{\subsection}
    [hang]
    {\centering\singlespacing\normalfont\large\bfseries}
    {\thesubsection}
    {1ex}
    {}
    []

\titleformat{\subsubsection}
    [hang]
    {\centering\singlespacing\normalfont\normalsize\bfseries}
    {\thesubsubsection}
    {1ex}
    {}
    []

\titleformat{\paragraph}
    [runin]
    {\centering\singlespacing\normalfont\normalsize\bfseries}
    {\theparagraph}
    {1ex}
    {}
    []

\titleformat{\subparagraph}
    [runin]
    {\centering\singlespacing\normalfont\normalsize\bfseries}
    {\thesubparagraph}
    {1ex}
    {}
    []

\parskip=0pt

\RequirePackage[final]{microtype}  


\RequirePackage[defernums=true,
                hyperref,
                backref,
                backend=biber,
                style=ieee,
                natbib=true,
                refsegment=chapter,
                block=space
                ]{biblatex}

\setlength\bibitemsep{1.5\itemsep}

\defbibheading{references}[References]{% 
    \section{#1}
    \markboth{#1}{#1}%
    \singlespacing
}

\def\finalBibliography{
    {\singlespacing
    \printbibliography[heading=bibintoc, title={\uppercase{Bibliography}}] % Whole
    }
}

\RequirePackage{hyperref}
\hypersetup{pdfpagemode={UseOutlines},
    bookmarksopen=true,
    bookmarksopenlevel=0,
    hypertexnames=true,
    colorlinks=true,
    citecolor=darkBrown,
    linktoc=all,
    linkcolor=URED,
    urlcolor=midnightBlue,
    pdfstartview={FitV},
    unicode,
    breaklinks=true,
}
\RequirePackage{doi}
\RequirePackage{url}

\RequirePackage[capitalise]{cleveref}
\crefname{paragraph}{Paragraph}{Paragraphs}
\crefname{subparagraph}{Sub Paragraph}{Sub Paragraphs}

\captionsetup[sub]{labelsep=none, subrefformat=parens}

\RequirePackage[titles]{tocloft}
\renewcommand{\cftchapdotsep}{\cftdotsep}
\renewcommand{\contentsname}{\color{URED}\hfill \Large CONTENTS \hfill}
\renewcommand{\listfigurename}{\color{URED}\hfill \Large LIST OF FIGURES \hfill}
\renewcommand{\listtablename}{\color{URED}\hfill \Large LIST OF TABLES \hfill}

\setlength{\cftsecindent}{1em}
\setlength{\cftsubsecindent}{2em}
\setlength{\cftsubsubsecindent}{3em}
\setlength{\cftparaindent}{4em}
\setlength{\cftsubparaindent}{5em}

\RequirePackage{xfp}
\RequirePackage{xparse}

\renewcommand\cftchapdotsep{2}
\renewcommand\cftsecdotsep{2}
\renewcommand\cftsubsecdotsep{2}
\renewcommand\cftsubsubsecdotsep{2}
\renewcommand\cftparadotsep{2}
\renewcommand\cftsubparadotsep{2}

\renewcommand\cftchapafterpnum{\vskip2pt}
\renewcommand\cftsecafterpnum{\vskip2pt}
\renewcommand\cftsubsecafterpnum{\vskip2pt}

\setlength{\cfttabindent}{0em}
\setlength{\cftfigindent}{0em}

\RequirePackage{algpseudocode}
\RequirePackage{algorithm}

\def\thesistype#1{\gdef\@thesistype{#1}}
\def\degreeAchieved#1{\gdef\@degreeAchieved{#1}}
\def\department#1{\gdef\@department{#1}}
\def\departmentLink#1{\gdef\@departmentLink{#1}}
\def\submitdate#1{\gdef\@submitdate{#1}}
\newcommand\skiplines[1]{\vspace{#1\baselineskip}}

\newcommand\thesisTitle{
    {
    \thispagestyle{empty}
    \begin{minipage}[c]{\textwidth}
        \vspace{1in}
        \centering
        \begin{spacing}{2}
            {\doublespacing\Large\bfseries\MakeUppercase{\@title}}\\
        \end{spacing}
        \large
        \skiplines{4}
        \begin{spacing}{2}
            by \\
            \@author \\
        \end{spacing}
        \skiplines{4}
        A \@thesistype ~submitted to the faculty of\\
        University\\
        in partial fulfillment of the requirements for the degree of \\
        \skiplines{4}
        {\@degreeAchieved}\\
        \skiplines{4}
        \begin{spacing}{2}
            \href{\@departmentLink}{\@department}\\
            \href{http://google.com}{University}\\
            \@submitdate
        \end{spacing}
    \end{minipage}
    \clearpage
    }
}


\def\copyrightyear#1{\gdef\@copyrightyear{#1}}

\newcommand\copyrightpage{
    {\newpage
    \thispagestyle{empty}
    \topskip0pt
    \vspace*{\fill}
    \noindent
    \begin{minipage}[c]{\textwidth}%
        \centering
        Copyright \copyright\ \@author\ \@copyrightyear \\
        \skiplines{1} % university requirement
        All Rights Reserved
    \end{minipage}%
    \vspace*{\fill}
    \newpage
    }
}

\def\committeeChair#1{\gdef\@committeeChair{#1}}
\def\advisorTitle#1{\gdef\@\advisorTitle{#1}}
\def\committeeMemberII#1{\gdef\@committeeMemberII{#1}}
\def\committeeMemberIII#1{\gdef\@committeeMemberIII{#1}}
\def\committeeMemberIIII#1{\gdef\@committeeMemberIIII{#1}}
\def\committeeMemberIIIII#1{\gdef\@committeeMemberIIIII{#1}}

\def\graduateDean#1{\gdef\@graduateDean{#1}}
\def\departmentChair#1{\gdef\@departmentChair{#1}}
\def\departmentChairTitle#1{\gdef\@departmentChairTitle{#1}}
\def\deptmentCollegeSchool#1{\gdef\@deptmentCollegeSchool{#1}}

\def\approvaldepartment#1{\gdef\@approvaldepartment{#1}}
\def\chairDateApproved#1{\gdef\@chairDateApproved{#1}}
\def\committeeMemberIIDateApproved#1{\gdef\@committeeMemberIIDateApproved{#1}}
\def\committeeMemberIIIDateApproved#1{\gdef\@committeeMemberIIIDateApproved{#1}}
\def\committeeMemberIIIIDateApproved#1{\gdef\@committeeMemberIIIIDateApproved{#1}}
\def\committeeMemberIIIIIDateApproved#1{\gdef\@committeeMemberIIIIIDateApproved{#1}}

\def\bfunderline#1{\underline{\kern 1in \textbf{#1}\kern 1in}}

\RequirePackage{tabularx} % pagewidth tables
\RequirePackage{array} % Specify width of tables
\RequirePackage{ragged2e} % Allows for justification of sections

\long \def \dissertationapproval{%
    \newpage
    \thispagestyle{empty}
    \vspace*{\fill}
    \noindent
    \begin{minipage}[c]{\textwidth}
        \centering
        \textbf{\Large University Graduate School} \\
        \skiplines{2}
        \textbf{\Large STATEMENT OF DISSERTATION APPROVAL}
        \skiplines{2}
        %
        \justify
        \begin{doublespace}
            The dissertation of\hspace{1in}\bfunderline{\@author} \\
            \skiplines{2}
            has been approved by the following supervisory committee members:

            \begin{table}[H] % [htbp]
                \centering    \begin{tabular}{>{\centering\arraybackslash}p{0.6\textwidth}p{0.1\textwidth}>{\centering\arraybackslash}p{0.2\textwidth}}
                    \bfseries{\@committeeChair} & \multicolumn{1}{l}{ , Chair} & \multicolumn{1}{c}{\bfseries{\@chairDateApproved}} \\
                    \cmidrule{1-1}\cmidrule{3-3}          &       & \tiny{Date Approved} \\
                        &    &    \\ % add extra row between the committee members
                    \bfseries{\@committeeMemberII} & \multicolumn{1}{l}{ , Member} & \multicolumn{1}{c}{\bfseries{\@committeeMemberIIDateApproved}} \\
                    \cmidrule{1-1}\cmidrule{3-3}          &       & \tiny{Date Approved} \\
                        &    &    \\ % add extra row between the committee members
                    \bfseries{\@committeeMemberIII} & \multicolumn{1}{l}{ , Member} & \multicolumn{1}{c}{\bfseries{\@committeeMemberIIIDateApproved}} \\
                    \cmidrule{1-1}\cmidrule{3-3}          &       & \tiny{Date Approved} \\
                        &    &    \\ % add extra row between the committee members
                    \bfseries{\@committeeMemberIIII} & \multicolumn{1}{l}{ , Member} & \multicolumn{1}{c}{\bfseries{\@committeeMemberIIIIDateApproved}} \\
                    \cmidrule{1-1}\cmidrule{3-3}          &       & \tiny{Date Approved} \\
                        &    &    \\ % add extra row between the committee members
                    \bfseries{\@committeeMemberIIIII} & \multicolumn{1}{l}{ , Member} & \multicolumn{1}{c}{\bfseries{\@committeeMemberIIIIIDateApproved}} \\
                    \cmidrule{1-1}\cmidrule{3-3}          &       & \tiny{Date Approved} \\
                \end{tabular}%
            \end{table}%
            
            \justify
            and by \hspace{1in}\bfunderline{\@departmentChair}, {\@departmentChairTitle} of \\
            the {\@deptmentCollegeSchool} of \hspace{1in}\bfunderline{\@approvaldepartment} \\
            and by \bfunderline{\@graduateDean}, Dean of The Graduate School.\\
        \end{doublespace}
    \end{minipage}
    \vspace*{\fill}
}

\def\abstractString#1{\gdef\@abstractString{#1}}

\newcommand\abstractPage{
    {\newpage
    \chapter*{Abstract}
        % manually set to page iii (University requirement)
        \setcounter{page}{3}
        \addcontentsline{toc}{chapter}{\uppercase{Abstract}}
        \hspace{\parindent}
        \begin{doublespace}
            \@abstractString
        \end{doublespace}
    }
}


\def\dedication#1{\gdef\@dedication{#1}}

\newcommand\dedicationPage{
    {\newpage
        \clearpage\thispagestyle{empty}\addtocounter{page}{-1} 
        \topskip0pt
        \vspace*{\fill}
        \noindent
        \begin{minipage}[c]{.95\textwidth}%
            \centering
            \@dedication
        \end{minipage}%
        \vspace*{\fill}
    }
}

\def\frontispiece#1{\gdef\@frontispiece{#1}}

\newcommand\frontispiecePage{
    {\newpage        
        \clearpage\thispagestyle{empty}
        \topskip0pt
        \vspace*{\fill}
        \noindent
        \begin{minipage}[c]{\textwidth}%
            \centering
            \includegraphics[width=\textwidth]{{\@frontispiece}}
        \end{minipage}%
        \vspace*{\fill}
    }
}


\RequirePackage{epigraph}
\def\epigraphQuote#1{\gdef\@epigraphQuote{#1}}
\def\epigraphAuthor#1{\gdef\@epigraphAuthor{#1}}

\newcommand\epigraphPage{
    {\newpage
        \clearpage\thispagestyle{empty}
        \topskip0pt
        \vspace*{\fill}
        \noindent
        \begin{minipage}[c]{\textwidth}%
            \centering
            \epigraph{\Large{\@epigraphQuote}}{---{\@epigraphAuthor}}
        \end{minipage}%
        \vspace*{\fill}
    }
}


\def\Acknowledgement#1{\gdef\@Acknowledgement{#1}}

\newcommand\AcknowledgementPage{
    {
    \chapter*{Acknowledge}
    \addcontentsline{toc}{chapter}{\uppercase{Acknowledge}}
    \hspace{\parindent}
    \begin{doublespace}
        \@Acknowledgement
    \end{doublespace}
    }
}


\def\NotationAndSymbols#1{\gdef\@NotationAndSymbols{#1}}

\newcommand\NotationSymbolsPage{
    {
    \chapter*{Notation and Symbols}
        \addcontentsline{toc}{chapter}{\uppercase{Notation and Symbols}}
        \begin{center}
            \@NotationAndSymbols
        \end{center}
    }
}

\RequirePackage{fancyhdr}

\newcommand\frontMatter{%
    \cleardoublepage
    \pagenumbering{roman}}

\newcommand\mainMatter{%
    \addtocontents{toc}{\vspace{1em}\noindent{\bf\uppercase{Chapters}}\hfill\par} 
    \cleardoublepage
    
    \pagestyle{fancy}
    \fancyhf{} 
    \lhead{} 
    \rhead{\thepage} 
    \renewcommand{\headrulewidth}{0pt} 
    
    \fancypagestyle{plain}{%
      \renewcommand{\headrulewidth}{0pt}%
      \fancyhf{} 
      %\fancyhead[R]{\thepage} 
    }
    
    \pagenumbering{arabic} 
    \doublespacing 
}

\newcommand\backMatter{%
    \if@openright
    \cleardoublepage
    \else
    \clearpage
    \fi
    % \@mainmatterfalse
}

\renewcommand\cftfigafterpnum{\vskip5pt\par}
\renewcommand\cfttabafterpnum{\vskip5pt\par}

\newcommand\tableOfContents{
    {
    \hypersetup{linkcolor=blue}
    \clearpage
    \pdfbookmark{Table of Contents}{toc}
    \tableofcontents
    
    \clearpage
    \phantomsection
    \addcontentsline{toc}{chapter}{\uppercase{List of Figures}}
    \listoffigures
    
    \clearpage
    \phantomsection
    \addcontentsline{toc}{chapter}{\uppercase{List of Tables}}
    \listoftables
    }
}

\pdfstringdefDisableCommands{\let\uppercase\relax} 

\RequirePackage{mwe}

\endinput

Here is my StudentInfo.tex file:

\author        {Full Name}
\title        {Thesis title}
\thesistype    {dissertation}
\degreeAchieved    {Doctor of Philosophy}
\department    {Department of xx}
\departmentLink    {}
\submitdate    {xx yyyy}
\copyrightyear  {\the\year{}}

\abstractString    {Abstract goes here.  \\\indent More info here.}

\dedication    {To Science!}

\frontispiece    {example-image-a} % 

\epigraphQuote    {``Quote"} 
\epigraphAuthor    {Famous Individual}

\Acknowledgement{Acknowledge \ldots \\\indent more recognition.}

\NotationAndSymbols{
\begin{tabular}{p{0.05\textwidth}p{0.9\textwidth}}
    \toprule
    x     & \emph{Var} - the variable x. \\
    \bottomrule
\end{tabular}%
}

\approvaldepartment     {Dept.}

\graduateDean           {xx}
\departmentChair        {yy}
\departmentChairTitle   {Chair}
\deptmentCollegeSchool  {Department}

\committeeChair         {Advisor}
\advisorTitle           {Associate Professor, Associate Chair}

\committeeMemberII      {xx}
\committeeMemberIII     {yy}
\committeeMemberIIII    {zz}
\committeeMemberIIIII   {aa}

\chairDateApproved                  {xx xx \the\year{}}
\committeeMemberIIDateApproved      {xx xx \the\year{}}
\committeeMemberIIIDateApproved     {xx xx \the\year{}}
\committeeMemberIIIIDateApproved    {xx xx \the\year{}}
\committeeMemberIIIIIDateApproved   {xx xx \the\year{}}

Here is my bibliography.bib file

@article{test,
author = {Last, First},
doi = {xxxx},
issn = {xxx},
journal = {ABC},
number = {1-2},
pages = {12--22},
title = {{Title}},
volume = {111},
year = {xxxx}
}

Last but not least, here is the MWE that calls the cls and student info file


% The class file specifying the document structure
\documentclass{MastersDoctoralThesis}

\input{StudentInfo.tex}

\addbibresource{bibliography.bib}

\begin{document}
    \frontMatter
    \begin{center}
        \thesisTitle
        \copyrightpage
        \dissertationapproval
    \end{center}
    \abstractPage
    \dedicationPage
    \frontispiecePage
    \epigraphPage
    \tableOfContents
    \NotationSymbolsPage
    \AcknowledgementPage
    
    \mainMatter
    \chapter{\uppercase{Introduction}}\label{Chapter1}
        \section{Overview}
            \lipsum[1] \cite{test}
        
        \section{Background and significance}
            \lipsum[1-3]
        
        \section{Hypothesis and Rationale}\label{Hyptohesis_Rationale}
        \subsection{Aim 1}\label{aim:1}
            \lipsum[1]
        
        \subsection{Aim 2}\label{aim:2}
            \lipsum[2]
        
        \subsection{Aim 3}\label{aim:3}
            \lipsum[3]
        
        \section{Impact and Intellectual Contributions}\label{sec:impact}
            \lipsum[1-2]
    
        % Bibliography
        \printbibliography[segment=\therefsegment, heading=references]
        
    \chapter[\uppercase{Multiline title}]{\uppercase{Multiline \protect\\ title}}\label{Chapter2}
        
        \lipsum[1]
    
        \section{Abstract}
            \lipsum[1]
        
        \section{Introduction}
            \lipsum[1-5]
        
        \section{Section1}\label{sec:Section1}

        \subsection{Subsection1}\label{subsec:Subsection1}
            \lipsum[1-2]

            \begin{figure}[tbp]
                \centering
                \begin{subfigure}[b]{0.3\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]
                    {example-image-a}
                    \subcaption{\label{fig:a}}
                \end{subfigure}%
                \begin{subfigure}[b]{0.3\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]
                    {example-image-b}
                    \subcaption{\label{fig:b}}
                \end{subfigure}%
                \begin{subfigure}[b]{0.3\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]
                    {example-image-c}
                    \subcaption{\label{fig:c}}
                \end{subfigure}%
                \caption{\subref{fig:a} \ldots \subref{fig:b} \ldots \subref{fig:c}
                \ldots}
                \label{fig:Figure_1}
            \end{figure}
            
            \lipsum[1-2]
        
        \subsection{Subsection2}\label{subsec:Subsection2}
            \lipsum[1-2]
            
            \begin{figure}[tbp]
                \centering
                \begin{subfigure}[b]{0.9\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]
                    {example-image-a}
                    \subcaption{\label{fig:d}}
                \end{subfigure} \\[1ex]
                \begin{subfigure}[b]{0.45\textwidth}
                    \centering
                    \includegraphics[height=5cm]
                    {example-image-b}
                    \subcaption{\label{fig:e}}
                \end{subfigure}%
                \begin{subfigure}[b]{0.45\textwidth}
                    \centering
                    \includegraphics[height=5cm]
                    {example-image-c}
                    \subcaption{\label{fig:f}}
                \end{subfigure}
                \caption{\ldots \subref{fig:d} \ldots \subref{fig:e} \ldots
                \subref{fig:f} \ldots}
                \label{fig:Figure_2}
            \end{figure}
        
        \subsection{SubSection3}\label{subsec:Subsection3}
            \lipsum[1-2]
        
        \paragraph{Paragraph1}\label{par:Paragraph1}
            \lipsum[6-7]
            
            \begin{figure}[tbp]
                \centering
                \begin{subfigure}[b]{0.5\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]
                    {example-image-a}
                    \subcaption{\label{fig:g}}
                \end{subfigure}%
                \begin{subfigure}[b]{0.5\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]
                    {example-image-b}
                    \subcaption{\label{fig:h}}
                \end{subfigure}%
                \caption{\ldots \subref{fig:g} \ldots
                \subref{fig:h} \ldots} 
                \label{fig:Figure_3}
            \end{figure}
            
        \paragraph{Paragraph2}\label{par:Paragraph2}
            \lipsum[8-10]
            
            \begin{figure}[tbp]
                \centering
                \includegraphics[width=0.5\textwidth]
                {example-image-a}
                \caption{\ldots} 
                \label{fig:Figure_4}
            \end{figure}
            
            \lipsum[66]
            
            \begin{figure}[tbp]
                \centering
                \includegraphics[width=0.5\textwidth]
                {example-image-16x10}
                \caption{\ldots} 
                \label{fig:Figure_5}
            \end{figure}
            
            \lipsum[75]
        
        \subsection{SubSection4}\label{subsec:Subsection4}
            \lipsum[10-12]
    \appendix
    \finalBibliography
\end{document}

On page #11 I was able to recreate the spacing issue. I'm just not sure how to make the spacing between sections/subsections/paragraphs/subparagraphs all the same. I did make spacing above and below figures/tables/algorithms the same.

Thank you!

enter image description here

10
  • 2
    you haven't shown the relevant code but presumably you are using \flushbottom and have a large unbreakable object on the next page. You could use \raggedbottom and/or allow whatever is preventing a good page break to float. – David Carlisle May 4 at 17:21
  • duplicate of tex.stackexchange.com/questions/10743/… most likely? – David Carlisle May 4 at 17:26
  • Let me know what keywords I should be looking for? If need be I can include my entire cls file, I can. Like you mentioned, I'm not sure how to keep page breaks specified and allow figures/tables to float to better locations. – Christopher Creveling May 4 at 18:43
  • I am not sure what you mean by keywords. You should be able to make a small document that shows the issue but failing that show why the page is short, I assume you have something large on the next page that will not fit, latex normally floats figures so that does not occur. perhaps you have used [H] to prevent that? You can use \raggedbottom that still leaves the page with not enough text to fill the page, but all the space goes at the bottom. (vertical analog of using \raggedright rather than justified text to keep even word spacing at the expense of uneven right margin) – David Carlisle May 4 at 19:43
  • I will work on creating a small document that shows this. – Christopher Creveling May 4 at 20:20
0

UPDATED

I used a simplified MWE from the one posted to illustrate the problem.

The additional space you are viewing is, in a sense, an artifact of this particular page because of the float.

The class sets all title spaces. Also inserts before and after the figure environment (also table and equation) a 3ex space using \addvspace. When a float is pushed to the top of the page, this space is not added.

3ex is slightly larger than a baselineskip and this extra space is inserted before Paragraph2, who shows four lines in the page.

A solution is to change in MastersDoctoralThesis.sty \AtBeginEnvironment{figure}{\addvspace{\UHeadSpace}} to \AtBeginEnvironment{figure}{}

Wrong spacing before \paragraph

w

Using \AtBeginEnvironment{figure}{} in MastersDoctoralThesis.sty.

Now Paragraph2 shows five lines in the page.

g

% !TeX TS-program = pdflatex
\documentclass{MastersDoctoralThesis}

\usepackage{showframe} % show the margin

\begin{document}

\section{Section1}  
\subsection{Subsection1}
\lipsum[1-2]

\subsection{Subsection2}
\lipsum[1-2]    

\subsection{SubSection3}\label{subsec:Subsection3}
\lipsum[1]

\paragraph{Paragraph1}
1.  \lipsum[1-2]        

\setlength{\UHeadSpace}{0pt}  % add before \begin{figure} <<<<<<<<<
\begin{figure}[tbp]
    \centering
    \begin{subfigure}[b]{0.5\textwidth}
        \centering
        \includegraphics[width=\linewidth]
        {example-image-a}
        \subcaption{\label{fig:g}}
    \end{subfigure}%
    \begin{subfigure}[b]{0.5\textwidth}
        \centering
        \includegraphics[width=\linewidth]
        {example-image-b}
        \subcaption{\label{fig:h}}
    \end{subfigure}%
    \caption{\ldots \subref{fig:g} \ldots
    \subref{fig:h} \ldots} 
    \label{fig:Figure_3}
    \setlength{\UHeadSpace}{3ex} % add before \end{figure}  <<<<<<<<<<
\end{figure}

\paragraph{Paragraph2}
1.  \lipsum[1]
2   \lipsum[2]

\end{document}

Going back to the posted MWE, using \AtBeginEnvironment{figure}{} the page #11 appears now with seven lines under Paragraphs2 and no space anomalies.

11

4
  • 1
    @Christopher Creveling Please see the updated answer. – Simon Dispa May 19 at 15:26
  • I was able to update the figure spacing as you indicated in the udpated answer. Would I still need to include the local change to each figure? \setlength{\UHeadSpace}{0pt} % add before \begin{figure} <<<<<<<<< as indicated in your answer? Same with the after figure \setlength{\UHeadSpace}{3ex} % add before \end{figure} <<<<<<<<<<? – Christopher Creveling May 21 at 6:39
  • This might be a different question, but would this change also make the spacing between sections, subsections, subsubsections, and paragraphs the same? – Christopher Creveling May 21 at 6:57
  • @Christopher Creveling The extra space is coming from the ``\addvspace` you inserted before a float (figures, tables) when the float goes to the top of the page. If you correct this it will no affect spaces before sections, subsection, etc. Or if you prevent the float from "floating" . – Simon Dispa May 21 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.