![latexdiff 生成 latex 并出现错误:!\showCODEN 定义中的参数编号非法](https://linux22.com/image/479306/latexdiff%20%E7%94%9F%E6%88%90%20latex%20%E5%B9%B6%E5%87%BA%E7%8E%B0%E9%94%99%E8%AF%AF%EF%BC%9A%EF%BC%81%5CshowCODEN%20%E5%AE%9A%E4%B9%89%E4%B8%AD%E7%9A%84%E5%8F%82%E6%95%B0%E7%BC%96%E5%8F%B7%E9%9D%9E%E6%B3%95.png)
我正在使用 latexdiff 来生成差异latexdiff-vc --git --flatten -r TAG paper.tex
。
不幸的是,当我尝试编译 PDF 时,出现以下错误
! Illegal parameter number in definition of \showCODEN.
<to be read again>
1
l.1003 ...undefined \def \showCODEN \DIFadd{#1
}{\unskip} \fi
?
生成的乳胶看起来像
%DIF > %% ====================================================================
%DIF > %% NOTE TO THE USER: you can override these defaults by providing
%DIF > %% customized versions of any of these macros before the \bibliography
%DIF > %% command. Each of them MUST provide its own final punctuation,
%DIF > %% except for \shownote{}, \showDOI{}, and \showURL{}. The latter two
%DIF > %% do not use final punctuation, in order to avoid confusing it with
%DIF > %% the Web address.
%DIF > %%
%DIF > %% To suppress output of a particular field, define its macro to expand
%DIF > %% to an empty string, or better, \unskip, like this:
%DIF > %%
%DIF > %% \newcommand{\showDOI}[1]{\unskip} % LaTeX syntax
%DIF > %%
%DIF > %% \def \showDOI #1{\unskip} % plain TeX syntax
%DIF > %%
%DIF > %% ====================================================================
\ifx \showCODEN \undefined \def \showCODEN \DIFadd{#1}{\unskip} \fi
\ifx \showDOI \undefined \def \showDOI \DIFadd{#1}{{\tt \DIFadd{DOI:}}\penalty0{#1}\DIFadd{\ }}
\fi
\ifx \showISBNx \undefined \def \showISBNx \DIFadd{#1}{\unskip} \fi
\ifx \showISBNxiii \undefined \def \showISBNxiii \DIFadd{#1}{\unskip} \fi
\ifx \showISSN \undefined \def \showISSN \DIFadd{#1}{\unskip} \fi
\ifx \showLCCN \undefined \def \showLCCN \DIFadd{#1}{\unskip} \fi
\ifx \shownote \undefined \def \shownote \DIFadd{#1}{\DIFadd{#1}} \fi
\ifx \showarticletitle \undefined \def \showarticletitle \DIFadd{#1}{\DIFadd{#1}} \fi
\ifx \showURL \undefined \def \showURL \DIFadd{#1}{\DIFadd{#1}} \fi
\bibitem{Baldonado-2000}
{\DIFadd{Michelle Q.~Wang Baldonado}}\DIFadd{, }{\DIFadd{Allison Woodruff}}\DIFadd{, }{\DIFadd{and}} {\DIFadd{Allan Kuchinsky}}\DIFadd{.
2000.
}\newblock \showarticletitle{Guidelines for Using Multiple Views in Information
Visualization}\DIFadd{. In }{\em \DIFadd{Proceedings of the working conference on Advanced
visual interfaces, }{\DIFadd{AVI}} \DIFadd{2000, Palermo, Italy, May 23-26, 2000}}\DIFadd{. 110--119.
}\newblock
\showDOI{%
\url{http://dx.doi.org/10.1145/345513.345271}}
我如何手动修复代码来解决错误?
答案1
我找到了一个部分解决方案,所以我至少可以建立一个差异。
我手动替换
\ifx \showCODEN \undefined \def \showCODEN \DIFadd{#1}{\unskip} \fi
\ifx \showDOI \undefined \def \showDOI \DIFadd{#1}{{\tt \DIFadd{DOI:}}\penalty0{#1}\DIFadd{\ }}
\fi
\ifx \showISBNx \undefined \def \showISBNx \DIFadd{#1}{\unskip} \fi
\ifx \showISBNxiii \undefined \def \showISBNxiii \DIFadd{#1}{\unskip} \fi
\ifx \showISSN \undefined \def \showISSN \DIFadd{#1}{\unskip} \fi
\ifx \showLCCN \undefined \def \showLCCN \DIFadd{#1}{\unskip} \fi
\ifx \shownote \undefined \def \shownote \DIFadd{#1}{\DIFadd{#1}} \fi
\ifx \showarticletitle \undefined \def \showarticletitle \DIFadd{#1}{\DIFadd{#1}} \fi
\ifx \showURL \undefined \def \showURL \DIFadd{#1}{\DIFadd{#1}} \fi
和
\newcommand{\showDOI}[1]{#1}
\newcommand{\showURL}[1]{#1}
\newcommand{\showISSN}[1]{#1}
\newcommand{\showISBNx}[1]{#1}
\newcommand{\shownote}[1]{#1}
我的参考文献的差异现在毫无用处,但至少我可以为论文构建 PDF。