编译 latexdiff PDF 文件时出错

编译 latexdiff PDF 文件时出错

\intertext我刚刚开始尝试使用 latexdiff 编辑一些论文,当我的代码包含在环境中时,我无法从 latexdiff 编译中获取 tex 输出\begin{align*}。这是我得到的错误

Underfull \hbox (badness 10000) in paragraph at lines 83--86

[1{/usr/local/texlive/2011/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
/Users/erikchan/Desktop/TSWLatexianTemp_000048.tex:131: Misplaced alignment tab character &.
\math@cr@@@ ->&
               \omit \global \advance \row@ \@ne \ifst@rred \nonumber \fi \if@eqnsw \global \tag@true \fi \ifnum \column@ >\maxfields@ \ifcheckat@ \begingroup \measuring@false \@amsmath@err {Extra & on this line}{\the \andhelp@ }\endgroup \else \global...
l.131      }\end{align*}

?

我正在运行的 latexdiff 版本是

This is LATEXDIFF 1.0.3  (Algorithm::Diff 1.1902, Perl v5.12.4).

先感谢您。

编辑:我应该补充一点,我尝试过多次寻找解决方案,但我无法在线找到现有的解决方案,这个错误让我完全困惑,因为我不明白为什么它会抱怨我的对齐选项卡。

编辑2:我尝试查找错误,但仍然找不到。如果是语法错误,latexDiff 输出带有语法错误的代码是否很常见?

 \documentclass[12pt,letterpaper]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL Lecture.tex     Tue Dec 10 18:18:33 2013
%DIF ADD Lecture 2.tex   Tue Dec 10 18:17:11 2013
\usepackage{anysize}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{cite}
\usepackage{graphicx}
\usepackage{mathrsfs}
\usepackage{upgreek}
\usepackage{enumerate}
\usepackage{pictexwd,dcpic}
\newcommand{\Int}{\operatorname{Int}}
\newcommand{\cl}{\operatorname{Cl}}
\newcommand{\se}{\subseteq}
\newcommand{\bs}{\\ $\left.\right.\hfill\blacksquare$}
\newcommand{\C}{\mathbb{C}}
\newcommand{\D}{\mathcal{D}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\T}{\mathcal{T}}
\newcommand{\es}{\varnothing}
\newcommand{\sm}[2]{#1\setminus#2}
\newcommand{\pf}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\pfn}[3]{\frac{\partial^{#3} #1}{\partial {#2}^{#3}}}
\newcommand{\op}[1]{\operatorname{#1}}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{conjecture}[theorem]{Conjecture}
\theoremstyle{definition}
\newtheorem{defn}{Definition}[section] 
\newtheorem{example}{Example}[section]

% unnumbered environments:

\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\newtheorem*{notation}{Notation}
\newtheorem*{note}{Note}
%DIF PREAMBLE EXTENSION ADDED BY LATEXDIFF
%DIF UNDERLINE PREAMBLE %DIF PREAMBLE
\RequirePackage[normalem]{ulem} %DIF PREAMBLE
\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} %DIF     PREAMBLE
\providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}} %DIF PREAMBLE
\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}}                      %DIF PREAMBLE
%DIF SAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFaddbegin}{} %DIF PREAMBLE
\providecommand{\DIFaddend}{} %DIF PREAMBLE
\providecommand{\DIFdelbegin}{} %DIF PREAMBLE
\providecommand{\DIFdelend}{} %DIF PREAMBLE
%DIF FLOATSAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFaddFL}[1]{\DIFadd{#1}} %DIF PREAMBLE
\providecommand{\DIFdelFL}[1]{\DIFdel{#1}} %DIF PREAMBLE
\providecommand{\DIFaddbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFaddendFL}{} %DIF PREAMBLE
\providecommand{\DIFdelbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFdelendFL}{} %DIF PREAMBLE
%DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF

\begin{document}

\author{}
\date{}
\title{Wavelets and Signal Processing}
\maketitle
A wavelet is just a small portion of a larger signal. We wish to express the signal as the     sum of waves, so given a signal \DIFdelbegin \DIFdel{$\vec f$}\DIFdelend \DIFaddbegin     \DIFadd{$ f$}\DIFaddend , we wish to write it as
$$\vec f = \sum_{k=1}^{n} c_{k}\vec{w}_{k}$$
where $c_{k}$ are the coefficients and $\vec{w}_{k}$ are the wavelets. The key here is that we must find a way to compute the coefficients \DIFdelbegin \DIFdel{$c_{k}$}\DIFdelend \DIFaddbegin \DIFadd{$c_{1k}$}\DIFaddend . Given a random vectors $w_{k}$, how difficult is it to calculate the $c_{k}s$.

If we have a random vector it is $\mathcal{O}(N^{3})$. If we have orthogonal vector's $\mathcal{O}(N^{2})$, if we use the FFT, we have $\mathcal{O}(N\log(N))$, but with wavelets, it is only $\mathcal{O}(N)$.

\subsubsection*{Example of wavelets}
The Haar Wavelet. Takes discrete values of $0,1,-1$.\\
The ``Mexican Hat Wavelet'' or Ricker wavelet,  which is the second derivative of a     guassian $e^{-x^{2}}$. Daubechies wavelet, which is continuous and nowhere differentiable.
\subsubsection*{Gram Schmidt Process}
To implement Gram Schmidt in MATLAB, we construct a matrix $C$ where
$$C = [ \langle u_{j},u_{k}\rangle]$$
the matrix of inner products, let $L$ be the lower triangular part of the Cholesky     decomposition, then the inverse transpose will give the coefficients of the basis in its columns.\\\\
Given vectors $\{u_{i}\}_{i=1}^{n}$, we find vectors $\{v_{i}\}_{i=1}^{n}$ that are orthonormal and span the same space as $\{u_{i}\}_{i=1}^{n}$. By Cholesky decomposition, define the matrix of vectors $u_{i}$ as its columns
$$U = \begin{bmatrix}
            u_{1}, u_{2},\dots, u_{n}
        \end{bmatrix}$$
Then $U^{*}U$ is symmetric positive definite, which implies a cholesky decomposition $LL^{*}$ exists, where $L$ is lower triangular with diagonal entries are all positive. Finally, we write
$$V = U(L^{-1})^{*} = \begin{bmatrix}
                    v_{1} v_{2} \dots v_{n}
                \end{bmatrix}$$
then the columns of $V$ ar ethe orthonormal vectors we want. Let us prove that these columns are orthonormal
$$V^{*}V = [U(L^{-1})^{*}]^{*} U(L^{-1})^{*} = L^{-1}U^{*} U(L^{*})^{-1} = L^{-1} L L^{*}(L^{*})^{-1} = I$$
Now let us show that $v's$ span the same space as the $u$'s. Since
$$\begin{bmatrix}
    v_{1}v_{2}..v_{n}
\end{bmatrix} = V = U(L^{*})^{-1} = \begin{bmatrix}
                                u_{1}&u_{2}&\dots &u_{n} 
                            \end{bmatrix}
                                \begin{bmatrix}
                                    \ell_{11} & \ell_{1,2} & \ell_{1,3} &\dots\\
                                    0 & \ell_{2,2} & \dots & \dots\\
                                    0 & 0 & \ell_{3,3} & \dots\\
                                \end{bmatrix}$$
\DIFaddbegin \DIFadd{So 
}\begin{align*}\DIFadd{
    \vec{v}_{1} }&\DIFadd{= \ell_{1,1}\vec{u}_{1}}\\
    \DIFadd{\vec{v}_{2} }&\DIFadd{= \ell_{1,3} \vec{u}_{1} + \ell_{2,2} \vec{u_{2}}}\\
    \DIFadd{\vec{v}_{3} }&\DIFadd{= \ell_{1,3} \vec{u}_{1} + \ell_{2,3}\vec{u_{2}} + \ell_{3,3}\vec{u}_{3}
}\end{align*}
\DIFadd{But what about functions? We instead take $u$  whose ``matrix'' columns are functions. Then calculate $U^{*}U$ as usual, and each element of the matrix becomes inner products.
}\begin{align*}\DIFadd{U }&\DIFadd{= \begin{bmatrix}
        1 & x & x^{2} & x^{3}
    \end{bmatrix}}\\
    \DIFadd{\intertext{Then}}\\
\DIFadd{UU^{*} }&\DIFadd{= \begin{bmatrix}
            \langle 1,1\rangle & \langle 1,x\rangle & \langle 1,x^{2}\rangle \\
            \dots & \dots & \dots 
        \end{bmatrix}.
    }\end{align*}
 \DIFaddend\end{document}

答案1

问题在于 用命令latexdiff包装,这标记了您在新版本中添加的内容。但由于不是 里面的合法命令 ,TeX 会抛出错误。要使代码编译,请替换\intertext{Then}\DIFadd{...}\DIFaddalign*

\DIFadd{\intertext{Then}}

\intertext{\DIFadd{Then}}

最后的输出看起来应该是这样的:

在此处输入图片描述


正如我在评论中提到的,ed 文档给出的大多数错误(我遇到的)latexdiff都是由于\DIFaddand/or\DIFdel命令的应用不正确造成的,尤其是在数组类型环境中。除了手动更正这些错误并向开发人员发送错误报告外,我们能做的不多。

答案2

我发现默认选项(使用下划线或删除线)会导致最多的问题,在数学模式下标记更改也是如此。更改这些选项通常可以让它对我有用(尽管它可能不那么美观),例如,尝试

latexdiff --math-markup="off" -t CFONT oldFile.tex newFile.tex > differences.tex

相关内容