# Line spacing between equation and text

To reduce space between displayed equations and between text and equation, I have added the following command in LaTeX preamble in my standard article document in LyX:

\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.5}


But I get the following error message,

"LaTeX Error: Option clash for package setspace.
\setstretch
{1.5}
The package setspace has already been loaded with options:
[]
Description: There has now been an attempt to load it with options
[nodisplayskipstretch]
Adding the global options:
,nodisplayskipstretch
to your \documentclass declaration may fix this.
Try typing  <return>  to proceed."


what does it mean, or how can I fix it? How need to reduced space between displayed Eqns and text.

@ Bernard. thanks Bernard. Here is the dummy file for you to replicate the problem. The PDF snap also shows the issue. I am producing some text as well, in case the line spacing has any issue.

%% LyX 2.1.1 created this file.  For more info, see http://www.lyx.org/.

\documentclass[english,fleqn]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
\usepackage{color}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{esint}
\usepackage[authoryear]{natbib}
\setstretch{2}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
{hyperref}
\hypersetup{
\usepackage{breakurl}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.

\usepackage{titlesec}
\titlespacing\section{0pt}{2pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{2pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{2pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

\PassOptionsToPackage{nodisplayskipstretch}{setspace}
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.5}

\makeatother

\begin{document}

\title{Model Model Model }

\author{X Y }
\maketitle
\begin{abstract}
\begin{spacing}{2}
\noindent The role of Text TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText.
Text TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText.
Text TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText.
Text TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText.
Text TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText

\noindent {\bf Keywords:} Text, Text, Text

\noindent {\bf JEL Classification:} A123, E123 \end{spacing}

\end{abstract}

\section{\noindent \label{sec:Introduction}Introduction }

\begin{spacing}{2}
The Government is confident changes to Senate voting laws will get
support, and stop crossbenchers with miniscule votes getting into
Parliament. Follow our live blog for rolling updates.

The Government is confident changes to Senate voting laws will get
support, and stop crossbenchers with miniscule votes getting into
Parliament. Follow our live blog for rolling updates.

The Government is confident changes to Senate voting laws will get
support, and stop crossbenchers with miniscule votes getting into
Parliament. Follow our live blog for rolling updates.
\end{spacing}

\begin{spacing}{2}

\section{\noindent \label{sec:Model}Model}
\end{spacing}

\begin{spacing}{2}
The Government is confident changes to Senate voting laws will get
support, and stop crossbenchers with miniscule votes getting into
Parliament. Follow our live blog for rolling updates.
\end{spacing}

\begin{spacing}{2}

\subsection{\noindent hfjhfjkd}
\end{spacing}

\begin{spacing}{2}
The Government is confident changes to Senate voting laws will get
support, and stop crossbenchers with miniscule votes getting into
Parliament. Follow our live blog for rolling updates%
\footnote{\begin{spacing}{2}
The Government is confident changes to Senate voting laws will get
support, and stop crossbenchers with miniscule votes getting into
Parliament. Follow our live blog for rolling updates\end{spacing}
%
}.
\end{spacing}

\begin{spacing}{2}
\noindent \setlength{\mathindent}{0pt}
$MaxE_{t}\sum_{s=0}^{\infty}z^{s}\varrho_{t+s}\left[ln(Q_{t+s}-bQ_{t+s-1})-\psi\frac{X_{t+s}(l)^{1+\eta}}{1+\eta}\right]$
subject to the budget constraint
$\frac{Y_{t}(l)}{P_{t}}X_{t}(l)+R_{t+1}E_{t}-E_{t+1}-Q_{t}-T_{t}=0,$
and Text TextTextTextTextTextTextTextText.
\end{spacing}

\noindent Text TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText

\noindent
$$\frac{\delta A}{\delta B_{t}}=0\text{ \ensuremath{\Rightarrow}}L_{t}=\frac{\varrho_{t}}{C_{t}-bC_{t-1}}-\beta b\frac{\varrho_{t+1}}{C_{t+1}-bC_{t}},\label{eq:(1)}$$

\noindent
$$\frac{\delta D}{\delta\mathbf{E}_{t+1}}=0\text{ \ensuremath{\Rightarrow}}L_{t}=\beta L_{t+1}R_{t+1}.\label{eq:2}$$
Defining the d factor as
$$L_{t+1}=\frac{L_{t+1}}{L_{t}},\label{eq:3 discount factor}$$
Equation (\ref{eq:2}) becomes
$$1=\beta L_{t+1}S_{t+1}.\label{eq:4}$$
Text TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText.

\begin{spacing}{2}

\subsubsection*{\noindent The jfhdjhfjh}
\end{spacing}

\begin{spacing}{2}
\noindent Text TextTextTextTextTextTextTextTextTex:

\noindent
$$X_{t}=\left(\intop_{0}^{1}X_{t}(l)^{\frac{\epsilon_{w}-1}{\epsilon_{w}}}dl\right)^{\frac{\epsilon_{w}}{\epsilon_{w}-1}},\label{eq:LS}$$
where $\epsilon_{w}$ is Text Text $\left(\epsilon_{w}>1\right)$.
Text TextTextTextTextTextTextTextTextTexText Tex,

\noindent
$\underset{X_{t}\left(l\right)}{Max}P_{t}^{P}\left(\intop_{0}^{1}X_{t}(l)^{\frac{\epsilon_{w}-1}{\epsilon_{w}}}dl\right)^{\frac{\epsilon_{w}}{\epsilon_{w}-1}}-\intop_{0}^{1}P_{t}(l)X_{t}(l)dl,$
where extTextTextTe The first order extTextTextTe is,

\noindent
$P_{t}^{P}\frac{\epsilon_{w}}{\epsilon_{w}-1}\left(\intop_{0}^{1}X_{t}(l)^{\frac{\epsilon_{w}-1}{\epsilon_{w}}}dl\right)^{\frac{\epsilon_{w}}{\epsilon_{w}-1}-1}\frac{\epsilon_{w}-1}{\epsilon_{w}}X_{t}(l)^{\frac{\epsilon_{w}-1}{\epsilon_{w}}-1}=P_{t}(l)$
$$\Rightarrow X_{t}(l)\left(\intop_{0}^{1}X_{t}(l)^{\frac{\epsilon_{w}-1}{\epsilon_{w}}}dl\right)^{-\frac{\epsilon_{w}}{\epsilon_{w}-1}}=\left(\frac{P_{t}(l)}{P_{t}^{P}}\right)^{-\epsilon_{w}}$$

\noindent
$$\Rightarrow X_{t}(l)=\left(\frac{P_{t}(l)}{P_{t}^{P}}\right)^{-\epsilon_{w}}X_{t}.\label{eq:demand for X}$$

\noindent Equation (\ref{eq:demand for X})TextTextText TextTextTextTextTextTextTextTextTexText
as,
$P_{t}^{P}Xt=\intop_{0}^{1}P_{t}(l)X_{t}(l)dl=\intop_{0}^{1}P_{t}(l)^{1-\epsilon_{w}}P_{t}^{\epsilon_{w}}X_{t}dl$
$\Rightarrow\left(P_{t}^{P}\right)^{1-\epsilon_{w}}=\intop_{0}^{1}P_{t}(l)^{1-\epsilon_{w}}dl$
$$\Rightarrow P_{t}^{P}=\left(\intop_{0}^{1}P_{t}(l)^{1-\epsilon_{w}}dl\right)^{\frac{1}{1-\epsilon_{w}}}.\label{eq:aggregate xyz index}$$

\end{spacing}

\begin{spacing}{2}

\subsubsection*{\noindent fhgdfjkhjh hdfsjfhdjh }
\end{spacing}

\begin{spacing}{2}
\noindent Text TextTextTextTextTextTextTextTextTexText Tex

\noindent
$P_{t}^{P}=\left(\intop_{0}^{1}P_{t}(l)^{1-\epsilon_{w}}dl\right)^{\frac{1}{1-\epsilon_{w}}}.$

\noindent TextTextTextTextTextTextTextTextTexText\textcolor{black}{
$$g_{1,t}=\varrho_{t}\psi q_{t}^{\epsilon_{w}(1+\eta)}X_{t}^{1+\eta}+\beta\phi_{w}g_{1,t+1},\label{eq:f1}$$
$$g_{2,t}=\varrho_{t}\psi q_{t}^{\epsilon_{w}(1+\eta)}X_{t}^{1+\eta}+\beta\phi_{w}g_{1,t+1},\label{eq:f2}$$
}TextTextTextTextTextTextTextTextTexText

\appendix
\noindent {\Large{}Appendix}\renewcommand{\thetable}{A\arabic{table}}
\setcounter{table}{0}

\noindent \renewcommand{\thefigure}{A\arabic{figure}}
\setcounter{figure}{0}

\noindent \renewcommand{\theequation}{A\arabic{equation}}
\setcounter{equation}{0}
\end{spacing}

\begin{spacing}{2}

\section{\noindent \label{sec:Linearized-equations}Linearized equations }
\end{spacing}

\begin{spacing}{2}

\subsubsection*{\noindent gsdgdfg and fkjdskfjkdjs }
\end{spacing}

$$L_{t}=\frac{\varrho_{t}}{C_{t}-bC_{t-1}}-\beta b\frac{\varrho_{t+1}}{C_{t+1}-bC_{t}},\label{eq:A1}$$

$$L_{t+1}+S_{t+1}=0\label{eq:A2}$$

$$L_{t+1}=\lambda_{t+1}-\lambda_{t}\label{eq:A3}$$

\subsubsection*{fghfghfg sector}

\begin{align}
\nu\hat{\nu_{t}} & =(1-\theta)\beta\left[\left(R_{k}-R\right)\Lambda_{t+1}+R_{k}R_{k,t+1}-RR_{t+1}\right]\label{eq:A4}
\end{align}

\end{document}


It means the setspace package has been loaded twice, once without any options, and with your option. LaTeX doesn't like that.

You may do as it is said: add the option nodisplayskipstretch to \documentclass in the code.

Alternatively, you may add this line to the preamble:

\PassOptionsToPackage{nodisplayskipstretch}{setspace}

• Thanks Bernard. I have added the alternative command in preamble. Now the issue is, space between text and displayed (not numbered) equation is reasonable. But space between equations that are both displayed and numbered is still very large. The doc looks ugly and takes many pages. What to do? – Sadia Feb 20 '16 at 8:51
• Could post a minimal (non-)working example of the code? One possibility would be to add the \raggedbottom directive in the preamble, instead of the default \flushbottom. The latter ensures all physical pages will have exactly the same height, but the price may be overly stretching of stretchable vertical spacing. – Bernard Feb 20 '16 at 10:10
• In Lyx, I have the following Latex preamble: \PassOptionsToPackage{nodisplayskipstretch}{setspace} \usepackage[nodisplayskipstretch]{setspace} \setstretch{1.5} Also, in document class option, I added: fleqn and before the first math line in text, I added \setlength{\mathindent}{0pt} to make all equations left aligned. Some more info: I am using article standard document class, in text Layout, I set Indentation with Line spacing 2. I wanted to post screen shot, but cannot. Thanks. – Sadia Feb 21 '16 at 0:47
• My observation is, if I mix my numbered and labelled formula, then this problem happens. If I number and also label, then spaces between equations are consistent. – Sadia Feb 21 '16 at 3:36
• If you post a fully compilable (minimal) code that shows the problem, some of us could play with it. – Bernard Feb 21 '16 at 10:49