尝试从 latexdiff 文档生成 PDF 时出错

尝试从 latexdiff 文档生成 PDF 时出错

我曾经latexdiff生成一个包含两个其他 tex 文档之间的差异的 tex 文档。这很有效,但是当我尝试从 diff 文档生成 PDf 时,我总是收到此错误:

''! Undefined control sequence. 
l.20 \DIFdelbegin 
\DIFdel{In this chapter all the necessary information to f... 

? '' 

我认为问题在于我应该在 diff 文档中包含一个包或类似的东西,但我不知道是哪一个。有什么提示吗?

这是我的差异文档的开头:

\documentclass[12pt,a4paper]{article}

\RequirePackage{changebar}
\RequirePackage{ulem}
\RequirePackage{color}

\newcommand\TLSins[1]{
\cbstart{}%
\textcolor{blue}{\uline{#1}}%
\cbend{}%
}

\newcommand\TLSdel[1]{
\cbdelete{}%
\textcolor{red}{\sout{#1}}%
}

\begin{document}

\DIFdelbegin \DIFdel{In this chapter all the necessary information to fully understand the actual application is presented. First, a short overview about the history of multi-touch interfaces is provided. Particular attention is paid to the Microsoft Surface that was used to develop this application. Since the application is used to automatically detect code smells in a software project, the chapter \textit{\nameref{chp:metrics}} explains how code metrics can be used to detect code smells. Finally this chapter addresses how the necessary structural information and code metrics of a software project were retrieved from a web service in order to perform a code smell analysis. }%DIFDELCMD < 

%DIFDELCMD < \FloatBarrier
%DIFDELCMD < %%%
\section{\DIFdel{The history of multi-touch user interfaces}}
%DIFAUXCMD
\addtocounter{section}{-1}%DIFAUXCMD
\DIFdel{The user interface is the place where the }\DIFdelend \DIFaddbegin \section{\DIFadd{Motivation}}
\DIFadd{User interfaces are one of the fastest changing areas in software engineering. Not long ago \textit{Command Line Interfaces (CLI)} were the only available input method. \textit{Graphical User Interfaces (GUI)} changed the }\DIFaddend interaction between humans and \DIFdelbegin \DIFdel{machines takes place. Most user interfaces allow bidirectional interactions. This means the user has the possibility to enter input in order to manipulate and control the system and the machine has the possibility to create output to inform the user about the effects of its inputs. The basic goal of all user interfaces is to require minimal input in order to produce the desired output while minimizing the undesired output at the same time.}%DIFDELCMD < \\
%DIFDELCMD < 

答案1

您要么需要告诉latexdiff在输出文件的前言中插入其命令定义(参见man latexdiff),要么手动将这些定义插入到适当的文件中。

如果您使用包含其他文件的主文件,则后者更安全。

尝试将其插入到主 .tex 文件的序言中:

%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

相关内容