使用 Latexdiff 时出现大量错误

使用 Latexdiff 时出现大量错误

有两个.tex 文件,一个名为的原始 tex 文件Old.tex,另一个名为的修改后的 tex 文件New.tex

我需要 Latexdiff 来制定一个 PDF,突出显示我所做的修改。

如果 diff.tex 是派生出来的latexdiff New.tex Old.tex > diff.tex ,那么一切都正常,只是派生出的 PDF 与我需要的完全相反。

如果 diff.tex 是由 派生出来的latexdiff Old.tex New.tex > diff.tex,这是合法的并且也是我需要的,那么派生的文件将会报告许多错误,如下所示。

下面的内容是 New.tex 中新添加的,也是大多数错误发生的地方:

\begin{equation}\label{rotatingspeed}
    n_{11} = \frac{\pi\omega_r D}{30 \sqrt H}.
\end {equation}

By Eq. \ref{rotatingspeed}, when the hydraulic head alters, the unit rotating speed of the turbine would alter if the rotating speed of generator remains still. It would lead the turbine to the decreasing of efficiency, wearing and vibrating. If the DFIG is adopted, the turbine would operate at the optimal rotating speed since the system has gained more degrees of freedom.

As suggested by the characteristic of the turbine, the output of the generating system $P_1$ could be derived through the following transforming:

\begin{equation}\label{outputofgenerating}
    P_1 = HQ\gamma\eta_{total} = 9.81 H Q \eta_{total}.
\end{equation}

latexdiff.tex:

\begin{equation}\DIFadd{\label{rotatingspeed}
    n_{11} = \frac{\pi\omega_r D}{30 \sqrt H}.
\end }{\DIFadd{equation}}
\DIFadd{

By Eq. \ref{rotatingspeed}, when the hydraulic head alters, the unit rotating speed of the turbine would alter if the rotating speed of generator remains still. It would lead the turbine to the decreasing of efficiency, wearing and vibrating. If the DFIG is adopted, the turbine would operate at the optimal rotating speed since the system has gained more degrees of freedom.

As suggested by the characteristic of the turbine, the output of the generating system $P_1$ could be derived through the following transforming:

\begin{equation}\label{outputofgenerating}
    P_1 = HQ\gamma\eta_{total} = 9.81 H Q \eta_{total}.
}\end{equation}
line 555: Argument of \end has an extra }. \end }
line 555: Paragraph ended before \end was complete. \end }
line 555: Missing $ inserted. \end }
line 555: Missing } inserted. \end }
line 555: Missing } inserted. \end }
line 555: Missing } inserted. \end }
line 555: Missing } inserted. \end }
line 555: Display math should end with $$. \end }
line 555: Extra }, or forgotten \endgroup. \end }
line 555: Missing $ inserted. \end }
line 555: Limit controls must follow a math operator. \end }
line 555: Undefined control sequence. \end }
line 555: Extra }, or forgotten $. \end }
line 555: Extra }, or forgotten $. \end }
line 555: Extra }, or forgotten $. \end }
line 564: Paragraph ended before \UL@onmath was complete. }

答案1

注意 latexdiff 生成

\DIFadd{\label{rotatingspeed}
    n_{11} = \frac{\pi\omega_r D}{30 \sqrt H}.
\end }

where\end没有参数,会产生错误。这可能是因为

\begin{equation}\label{rotatingspeed}
    n_{11} = \frac{\pi\omega_r D}{30 \sqrt H}.
\end {equation}

其中后面有一个空格,因此 latexdiff直到以下等式的末尾\end才找到。\end{equation}

相关内容