我正在使用 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.