使用latexdiff添加LaTex文件修改痕迹

1、前期条件

在使用之前,我已经安装了TeX_Live和TeXstudio两个软件(我看网上好多用的是miktex,然后还要自己安装latexdiff包和perl。在这里,我安装了eX_Live和TeXstudio后,就自带了latexdiff,可以直接使用)

2、使用

确保原文档和编辑后的文档在同一文件夹中。

原文档("1.tex")、编辑后文档("2.tex")以及一些支持文件位于同一文件夹中。

在cmd中,进入该文件夹。输入以下命令

latexdiff 1.tex 2.tex > compare.tex
# latexdiff original.tex modify.tex > compare.tex

这个命令将比较"1.tex "和 "2.tex "文件,生成可显示编辑后文档改动之处的新文件。该文件将被命名为 "compare.tex"。请注意, compare.tex文件中有大量不便于阅读和修改的代码。因此,如果需要修改,我们强烈建议您在2.tex(即修订文档)中进行修改,然后运行latexdiff来生成compare.tex,而不是直接修改compare.tex。

使用latexdiff添加LaTex文件修改痕迹_第1张图片

编辑compare.tex生成的PDF文件。红色删除线文本表示删除的内容,蓝色下划线文本表示增加的内容。

3、样式设置

latexdiff工具自动生成的tex文件中会加入一系列预设样式命令,通过修改可进行个性化设置

使用latexdiff添加LaTex文件修改痕迹_第2张图片

不显示删除内容:

\providecommand{\DIFdeltex}[1]{{\protect\color{red}\sout{#1}}} 
# 改为
\providecommand{\DIFdel}[1]{}

取消新加内容的下划线显示:

\providecommand{\DIFaddtex}[1]{{\protect\color{blue}\uwave{#1}}}
# 改为
\providecommand{\DIFaddtex}[1]{{\protect\color{blue}{#1}}}

修改的改为红色:

\providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}}
# 改为
\providecommand{\DIFadd}[1]{{\protect\color{red}\uwave{#1}}}

附录

为防止以后用的上,在此提供latexdiff安装方法(使用本文的上述两个是不用自己安装的,使用miktex的可能需要):

1、安装 Perl
下载:Perl Download - www.perl.org
选择Strawberry Perl,选择Recommended version。
下载后双击安装。

2、安装 latexdiff
下载:CTAN: Package latexdiff
或者:CTAN: /tex-archive/support/latexdiff
解压 latexdiff,并将路径下所有文件复制到 Perl > bin 目录下

你可能感兴趣的:(Latex,latex)