How to remove unwanted spaces above and below equations in classicthesis in LyX
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)
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}
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.
Wendy
Updated on August 01, 2022Comments
-
Wendy over 1 year
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
\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}
-
Torbjørn T. over 7 yearsAny answer would be a wild guess I fear, we need more information. Can you make the smallest document possible that shows this problem, and add the
.lyx
file to your question? It is a plain text file, so you can open it in any text editor (Notepad, Notepad++, Textedit, Gedit, Kate, etc.) and copy the entire content of the file. -
Wendy over 7 yearsI tried in normal LyX with the same imported codes, there is no such problem. So I presume it is caused by the latest LyX version of classicthesis template I am using. Then I finally 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?
-
PhilipPirrip over 7 yearsOpen your document, select View>Source Pane in LyX, change "Current Paragraph" to "Complete Source" in the drop-down menu on the right, move the cursor close to one of the equations so that its source shows in the source pane, copy a few lines before and after the equations here for us to see. pdfspacing deals with character spacing, it has nothing to do with this.
-
Wendy over 7 yearsAs requested, I have updated my question to show the source code and unwanted space in PDF.
-
-
Wendy over 7 yearsThank you for your help. I saw that in the template, it also uses
\[
and\]
for equations in display mode. Since I have so many equations imported from latex code, is it possible to adjust for all equations, instead of for each single equation? -
Martin Rosalie over 7 yearsIf you put these two lines after the
\begin{document}
it works for all equations -
Wendy over 7 years0pt may be too crowded, what is the usual setting for thesis?
-
Martin Rosalie over 7 years1pt maybe. Frankly, default parameters are good for thesis also. Do not forget to validate the answer if it works for you :)
-
Wendy over 7 yearsBut where to put the two lines in the Lyx version of Classicthesis template then?
-
Martin Rosalie over 7 yearsPress Ctrl+L (or
Insertion
thenCode TeX
) and in the blank paste\setlength{\belowdisplayskip}{0pt} \setlength{\belowdisplayshortskip}{0pt} \setlength{\abovedisplayskip}{0pt} \setlength{\abovedisplayshortskip}{0pt}
-
Wendy over 7 yearsI am familiar with this trick, so I inserted before the first displayed equation in the LyX text. It works for those modifed by copy the initial code->insert-> math-> display->paste the initial code, but does not work for those that I have not modified in this way.
-
Martin Rosalie over 7 yearsLet us continue this discussion in chat.