0

I'm writing my master thesis according to this template:

https://fenix.tecnico.ulisboa.pt/downloadFile/1407993358863322/Thesis_template_LaTeX_v7.zip

I've tried using the fleqn option right at the beginning of the Thesis.tex file, but I get huge amounts of vertical space around equations. I looked up some of the possible problems, but in the end I really can't understand what's causing this.

Can someone help?

Thanks!

% ----------------------------------------------------------------------
%  Set the document class
% ----------------------------------------------------------------------
\documentclass[10pt,a4paper,twoside,fleqn]{report}

\usepackage[utf8]{inputenc}   % <<<<< Linux
\usepackage[english]{babel} % <<<<< English

\renewcommand{\rmdefault}{phv}
\renewcommand{\sfdefault}{phv}

\def\FontLn{% 16 pt normal
    \usefont{T1}{phv}{m}{n}\fontsize{16pt}{16pt}\selectfont}
\def\FontLb{% 16 pt bold
    \usefont{T1}{phv}{b}{n}\fontsize{16pt}{16pt}\selectfont}
\def\FontMn{% 14 pt normal
    \usefont{T1}{phv}{m}{n}\fontsize{14pt}{14pt}\selectfont}
\def\FontMb{% 14 pt bold
    \usefont{T1}{phv}{b}{n}\fontsize{14pt}{14pt}\selectfont}
\def\FontSn{% 12 pt normal
    \usefont{T1}{phv}{m}{n}\fontsize{12pt}{12pt}\selectfont}


\usepackage{geometry}   
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}

\usepackage{setspace}
\renewcommand{\baselinestretch}{1.5}
\usepackage{graphicx}
\usepackage{amsmath}  % AMS mathematical facilities for LaTeX.
\usepackage{amsthm}   % Typesetting theorems (AMS style).
\usepackage{amsfonts} % 
\usepackage{subfigure}
\usepackage{subfigmat}
\usepackage{dcolumn}
\newcolumntype{d}{D{.}{.}{-1}} % column aligned by the point separator '.'
\newcolumntype{e}{D{E}{E}{-1}} % column aligned by the exponent 'E'
\usepackage{nomencl}
\makenomenclature
%
% Group variables according to their symbol type
%
\RequirePackage{ifthen} 
\ifthenelse{\equal{\languagename}{english}}%
{ % English
    \renewcommand{\nomgroup}[1]{%
        \ifthenelse{\equal{#1}{R}}{%
            \item[\textbf{Roman symbols}]}{%
            \ifthenelse{\equal{#1}{G}}{%
                \item[\textbf{Greek symbols}]}{%
                \ifthenelse{\equal{#1}{S}}{%
                    \item[\textbf{Subscripts}]}{%
                    \ifthenelse{\equal{#1}{T}}{%
                        \item[\textbf{Superscripts}]}{}}}}}%
}{% Portuguese
    \renewcommand{\nomgroup}[1]{%
        \ifthenelse{\equal{#1}{R}}{%
            \item[\textbf{Simbolos romanos}]}{%
            \ifthenelse{\equal{#1}{G}}{%
                \item[\textbf{Simbolos gregos}]}{%
                \ifthenelse{\equal{#1}{S}}{%
                    \item[\textbf{Subscritos}]}{%
                    \ifthenelse{\equal{#1}{T}}{%
                        \item[\textbf{Sobrescritos}]}{}}}}}%
}%

\usepackage[number=none]{glossary}
\setglossary{gloskip={}}
\makeglossary
\usepackage{rotating}
\usepackage[pdftex]{hyperref} % enhance documents that are to be
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     Begin Document                                                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

% Set plain page style (no headers, footer with centered page number)
\pagestyle{plain}

% Set roman numbering (i,ii,...) before the start of chapters
\pagenumbering{roman}

% -----------------------------------------------------------------------------
\subsection{Equations}
\label{subsection:equations}

Equations can be inserted in different ways.

The simplest way is in a separate line like this

\begin{equation}
\frac{{\rm d} q_{ijk}}{{\rm d} t} + {\cal R}_{ijk}({\bf q}) = 0 \,.
\label{eq:ode}
\end{equation}

If the equation is to be embedded in the text. One can do it like this ${\partial {\cal R}}/{\partial {\bf q}}=0$.

It may also be split in different lines like this

\begin{eqnarray}
{\rm Minimize}   && Y({\bf \alpha},{\bf q}({\bf \alpha}))            \nonumber           \\
{\rm w.r.t.}     && {\bf \alpha} \,,                                 \label{eq:minimize} \\
{\rm subject~to} && {\cal R}({\bf \alpha},{\bf q}({\bf \alpha})) = 0 \nonumber           \\
&&       C ({\bf \alpha},{\bf q}({\bf \alpha})) = 0 \,. \nonumber
\end{eqnarray}

It is also possible to use subequations. Equations~\ref{eq:continuity}, \ref{eq:momentum} and \ref{eq:energy} form the Naver--Stokes equations~\ref{eq:NavierStokes}.

\begin{subequations}
    \begin{equation}
    \frac{\partial \rho}{\partial t} + \frac{\partial}{\partial x_j}\left( \rho u_j \right) = 0 \,,
    \label{eq:continuity}
    \end{equation}
    \begin{equation}
    \frac{\partial}{\partial t}\left( \rho u_i \right) + \frac{\partial}{\partial x_j} \left( \rho u_i u_j + p \delta_{ij} - \tau_{ji} \right) = 0, \quad i=1,2,3 \,,
    \label{eq:momentum}
    \end{equation}
    \begin{equation}
    \frac{\partial}{\partial t}\left( \rho E \right) + \frac{\partial}{\partial x_j} \left( \rho E u_j + p u_j - u_i \tau_{ij} + q_j \right) = 0 \,.
    \label{eq:energy}
    \end{equation}
    \label{eq:NavierStokes}%
\end{subequations}

% ----------------------------------------------------------------------
\end{document}
% ----------------------------------------------------------------------
7
  • Please include a minimal working example (MWE) that allows others to reproduce the output you get directly into your question.
    – leandriis
    Aug 16, 2020 at 16:57
  • And if you try the \raggedbottom or \allowdisplaybreaks directives in your preamble?
    – Bernard
    Aug 16, 2020 at 16:58
  • @leandriis There are too many nested files, it's best to just download the zip file and run Thesis.tex with the added fleqn in the document class options.
    – ASPVL
    Aug 16, 2020 at 16:59
  • @DavidCarlisle I've added a mashup of the files in the zip archive, the vertical spacing remains.
    – ASPVL
    Aug 16, 2020 at 18:28
  • thanks......... Aug 16, 2020 at 18:53

1 Answer 1

0

You have

> 10.0pt plus 2.0pt minus 5.0pt.
l.82 \showthe\abovedisplayskip
                              
? 
> 0.0pt plus 3.0pt.
l.83 \showthe\abovedisplayshortskip

so as it's never possible to use the short skips with fleqn there will be 10pt extra above equation, however the spacing is wrong anyway as there should never be a blank line before a display math, as it always generates a spurious white empty line of a paragraph before the equation. Similarly don't use one equation after another, use a multi-line display such as gather

output with and without fleqn

enter image description here

enter image description here

\documentclass[10pt,a4paper,twoside,
%fleqn
]{report}

% not required in recent latex \usepackage[utf8]{inputenc}   % <<<<< Linux
\usepackage[english]{babel} % <<<<< English

\renewcommand{\rmdefault}{phv}
\renewcommand{\sfdefault}{phv}

\def\FontLn{% 16 pt normal
    \usefont{T1}{phv}{m}{n}\fontsize{16pt}{16pt}\selectfont}
\def\FontLb{% 16 pt bold
    \usefont{T1}{phv}{b}{n}\fontsize{16pt}{16pt}\selectfont}
\def\FontMn{% 14 pt normal
    \usefont{T1}{phv}{m}{n}\fontsize{14pt}{14pt}\selectfont}
\def\FontMb{% 14 pt bold
    \usefont{T1}{phv}{b}{n}\fontsize{14pt}{14pt}\selectfont}
\def\FontSn{% 12 pt normal
    \usefont{T1}{phv}{m}{n}\fontsize{12pt}{12pt}\selectfont}


\usepackage{geometry}   
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}

\usepackage{setspace}
\renewcommand{\baselinestretch}{1.5}
\usepackage{graphicx}
\usepackage{amsmath}  % AMS mathematical facilities for LaTeX.
\usepackage{amsthm}   % Typesetting theorems (AMS style).
\usepackage{amsfonts} % 
\usepackage{subfigure}
\usepackage{subfigmat}
\usepackage{dcolumn}
\newcolumntype{d}{D{.}{.}{-1}} % column aligned by the point separator '.'
\newcolumntype{e}{D{E}{E}{-1}} % column aligned by the exponent 'E'
\usepackage{nomencl}
\makenomenclature
%
% Group variables according to their symbol type
%
\RequirePackage{ifthen} 
\ifthenelse{\equal{\languagename}{english}}%
{ % English
    \renewcommand{\nomgroup}[1]{%
        \ifthenelse{\equal{#1}{R}}{%
            \item[\textbf{Roman symbols}]}{%
            \ifthenelse{\equal{#1}{G}}{%
                \item[\textbf{Greek symbols}]}{%
                \ifthenelse{\equal{#1}{S}}{%
                    \item[\textbf{Subscripts}]}{%
                    \ifthenelse{\equal{#1}{T}}{%
                        \item[\textbf{Superscripts}]}{}}}}}%
}{% Portuguese
    \renewcommand{\nomgroup}[1]{%
        \ifthenelse{\equal{#1}{R}}{%
            \item[\textbf{Simbolos romanos}]}{%
            \ifthenelse{\equal{#1}{G}}{%
                \item[\textbf{Simbolos gregos}]}{%
                \ifthenelse{\equal{#1}{S}}{%
                    \item[\textbf{Subscritos}]}{%
                    \ifthenelse{\equal{#1}{T}}{%
                        \item[\textbf{Sobrescritos}]}{}}}}}%
}%

% not in texlive\usepackage[number=none]{glossary}
%\setglossary{gloskip={}}
%\makeglossary
\usepackage{rotating}
\usepackage[pdftex]{hyperref} % enhance documents that are to be
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     Begin Document                                                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

% Set plain page style (no headers, footer with centered page number)
\pagestyle{plain}

% Set roman numbering (i,ii,...) before the start of chapters
\pagenumbering{roman}

%\showthe\abovedisplayskip
%\showthe\abovedisplayshortskip

% -----------------------------------------------------------------------------
\subsection{Equations}
\label{subsection:equations}

Equations can be inserted in different ways.

The simplest way is in a separate line like this
\begin{equation}
\frac{\mathrm{d} q_{ijk}}{\mathrm{d} t} + {\cal R}_{ijk}(\mathbf{q}) = 0 \,.
\label{eq:ode}
\end{equation}

If the equation is to be embedded in the text. One can do it like this ${\partial {\cal R}}/{\partial \mathbf{q}}=0$.

It may also be split in different lines like this
\begin{eqnarray}
\mathrm{Minimize}   && Y(\mathbf{\alpha},\mathbf{q}(\mathbf{\alpha}))            \nonumber           \\
\mathrm{w.r.t.}     && \mathbf{\alpha} \,,                                 \label{eq:minimize} \\
\mathrm{subject~to} && {\cal R}(\mathbf{\alpha},\mathbf{q}(\mathbf{\alpha})) = 0 \nonumber           \\
&&       C (\mathbf{\alpha},\mathbf{q}(\mathbf{\alpha})) = 0 \,. \nonumber
\end{eqnarray}

It is also possible to use subequations. Equations~\ref{eq:continuity}, \ref{eq:momentum} and \ref{eq:energy} form the Naver--Stokes equations~\ref{eq:NavierStokes}.

\begin{subequations}
    \begin{gather}
    \frac{\partial \rho}{\partial t} + \frac{\partial}{\partial x_j}\left( \rho u_j \right) = 0 \,,
    \label{eq:continuity}
\\
    \frac{\partial}{\partial t}\left( \rho u_i \right) + \frac{\partial}{\partial x_j} \left( \rho u_i u_j + p \delta_{ij} - \tau_{ji} \right) = 0, \quad i=1,2,3 \,,
    \label{eq:momentum}
\\
    \frac{\partial}{\partial t}\left( \rho E \right) + \frac{\partial}{\partial x_j} \left( \rho E u_j + p u_j - u_i \tau_{ij} + q_j \right) = 0 \,.
    \label{eq:energy}
    \end{gather}
    \label{eq:NavierStokes}%
\end{subequations}

% ----------------------------------------------------------------------
\end{document}
1
  • Thanks for the input, David! I didn't know about the white lines before display math, I appreciate that. Looks like I was using subequations inappropriately as well. I don't have any problems now :) Regarding the \abovedisplayskip parameter, should I keep it?
    – ASPVL
    Aug 16, 2020 at 20:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .