[Tex/LaTex] How to remove unwanted spaces above and below equations in classicthesis in LyX

classicthesisequationslyxspacingword-to-latex

I am using latest LyX version of classicthesis template.

When I import the latex code converted by word-to-latex into LyX, there are unwanted space above and below each equation (usually two extra lines above and one extra line below) in the PDF generated, but not in LyX itself (spaces are invisible, looks normal).

How to avoid or remove those spaces?

Update: I found a comment in the template:"You might get unexpected results using math in chapter or section heads. Consider the pdfspacing option."

How do I use the "pdfspacing" option in LyX?

Update: the source code and the unwanted PDF layout are

enter image description here

\begin{document}
There are differences in the space above equation.
\[
    W = a + b+ c
\]
There are differences in the space below equation.

There are differences in the space above equation.
\begin{equation}
    W = a + b+ c
\end{equation}
There are differences in the space below equation.
\end{document}

enter image description here

Best Answer

What you see in LyX is just a preview that can change. If you want to reduce your space above and behind equation in the pdf version (that is the final version of your document)

Expected result for equation n°(1)

you have to put these lines before the environment equation as show here.

\documentclass[a4paper]{article}
\begin{document}
There are differences in the space above equation.
\[
    W = a + b+ c
\]
There are differences in the space below equation.

\setlength{\belowdisplayskip}{0pt} \setlength{\belowdisplayshortskip}{0pt}
\setlength{\abovedisplayskip}{0pt} \setlength{\abovedisplayshortskip}{0pt}
There are differences in the space above equation.
\begin{equation}
    W = a + b+ c
\end{equation}
There are differences in the space below equation.
\end{document}

You should use equation for equations instead of \[ and \]

Edit

In LyX, press Ctrl+L (or Insertion then Code TeX) and in the blank paste

\setlength{\belowdisplayskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}
\setlength{\abovedisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}

This is an example with LyX LyX example

The LaTeX Code generated by LyX is

\setlength{\belowdisplayskip}{0pt} \setlength{\belowdisplayshortskip}{0pt} \setlength{\abovedisplayskip}{0pt} \setlength{\abovedisplayshortskip}{0pt}

There are differences in the space above equation. 

\[
W=a+b+c
\]


There are differences in the space below equation. 

There are differences in the space above equation. 
\begin{equation}
W=a+b+c
\end{equation}
\begin{equation}
T=est
\end{equation}


There are differences in the space below equation. 
Related Question