![如何在 LyX 中的 classicthesis 中删除方程式上方和下方不需要的空格](https://linux22.com/image/330696/%E5%A6%82%E4%BD%95%E5%9C%A8%20LyX%20%E4%B8%AD%E7%9A%84%20classicthesis%20%E4%B8%AD%E5%88%A0%E9%99%A4%E6%96%B9%E7%A8%8B%E5%BC%8F%E4%B8%8A%E6%96%B9%E5%92%8C%E4%B8%8B%E6%96%B9%E4%B8%8D%E9%9C%80%E8%A6%81%E7%9A%84%E7%A9%BA%E6%A0%BC.png)
我正在使用 classicthesis 模板的最新 LyX 版本。
当我将 word-to-latex 转换后的 latex 代码导入 LyX 时,生成的 PDF 中每个方程式的上方和下方都有不需要的空格(通常上方多出两行,下方多出一行),但 LyX 本身却没有(空格是不可见的,看起来很正常)。
如何避免或者删除这些空格?
更新:我在模板中发现了一条评论:“在章节或节标题中使用数学运算可能会得到意想不到的结果。请考虑 pdfspacing 选项。”
如何在 LyX 中使用“pdfspacing”选项?
更新:源代码和不需要的 PDF 布局是
\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}
答案1
您在 LyX 中看到的只是预览,可能会发生变化。如果您想减少 PDF 版本(即文档的最终版本)中公式上方和后面的空间
您必须将这些行放在环境之前,equation
如下所示。
\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}
你应该使用equation
方程而不是\[
和\]
编辑
在 LyX 中,按 Ctrl+L(或按“插入”然后按“Code TeX”)并在空白处粘贴
\setlength{\belowdisplayskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}
\setlength{\abovedisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
LyX 生成的 LaTeX 代码是
\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.