嵌套文件的 Latexdiff

嵌套文件的 Latexdiff

latexdiff我在使用(版本 1.3.1.1)时遇到问题。

我有一个 Old.tex

%% Old.tex %%%%
\documentclass[a4paper,%                       
               11pt%                                                     
           %twoside,%                    
               ]{article}                  
\usepackage[T1]{fontenc}                    
\usepackage[utf8]{inputenc}                 
\usepackage[italian,english]{babel}         
\usepackage{amsmath,amssymb,amsthm}         
\usepackage[dvipsnames]{xcolor}             
\usepackage{hyperref}                       

% Page layout
\renewcommand{\baselinestretch}{1.2}\normalsize

%%%%%%%%%%%%%%%%%%%%%%%%
%number equations after the sections
\renewcommand{\theequation}{\thesection.\arabic{equation}}
\numberwithin{equation}{section}

%% counter footnote
\renewcommand{\thefootnote}{\alph{footnote}}

\input{InitialFinalMaterial/settings} 

\begin{document}
\begin{titlepage}
\thispagestyle{plain} %

\begin{center}
{ \textbf{%\vspace{-3cm}\\ 
\fontsize{13.2}{15}\selectfont\mbox{\hspace{-0cm}PROVA  DIFF}}}

          \vspace{.8cm}
          
         {\scshape{Mario Rossi}} 

\vspace{.15cm}

\textit{Dipartimento di Filosofia}\\

     \vspace{.9cm}

      \textbf{Abstract}
 \end{center}

 {\fontsize{10}{12.25}\selectfont\noindent Lorem ipsum}

\end{titlepage}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%******************************************************************
% Principal material
%******************************************************************

\input{Paragraph/Old1} 

\end{document}

和一个 New.tex

%% New.tex %%%%
\documentclass[a4paper,%                       
               11pt%                                                    
           %twoside,%                    
               ]{article}                  
       
\usepackage[T1]{fontenc}                    
\usepackage[utf8]{inputenc}                 
\usepackage[italian,english]{babel}         
\usepackage{amsmath,amssymb,amsthm}        
\usepackage[dvipsnames]{xcolor}             
\usepackage{hyperref}                    

% Page layout
\renewcommand{\baselinestretch}{1.2}\normalsize

%%%%%%%%%%%%%%%%%%%%%%%%

%number equations after the sections
\renewcommand{\theequation}{\thesection.\arabic{equation}}
\numberwithin{equation}{section}

%% counter footnote
\renewcommand{\thefootnote}{\alph{footnote}}

\input{InitialFinalMaterial/settings} 

\begin{document}

\begin{titlepage}
\thispagestyle{plain} %

\begin{center}
{ \textbf{%\vspace{-3cm}\\ 
\fontsize{13.2}{15}\selectfont\mbox{\hspace{-0cm}PROVA  DIFF Latex}}}


          \vspace{.8cm}
          
         {\scshape{Mario Bianchi}} 
\vspace{.15cm}

\textit{Dipartimento di Filosofia e Storia}\\

     \vspace{.9cm}

      \textbf{Abstract}
 \end{center}

 {\fontsize{10}{12.25}\selectfont\noindent Lorem dolor}

\end{titlepage}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%******************************************************************
% Principal material
%******************************************************************
\input{Paragraph/Old1} %% MODIFIED from the corresponding “Old.tex” file

\end{document}

现在,如果我首先使用命令进入新版本的文件夹 cd /Users/Andrea/Desktop/Latexdiff/EsempioR/New,然后发出latexdiff

latexdiff  /Users/Andrea/Desktop/Latexdiff/EsempioR/Old/Old.tex
New.tex > diffs.tex

最后编译 diffs.tex

%%%% diffs.tex %%%%%
\documentclass[a4paper,%                       
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL /Users/Andrea/Desktop/Latexdiff/EsempioR/Old/Old.tex   Tue Jan 12 15:16:54 2021
%DIF ADD New.tex                                                Tue Jan 12 15:22:59 2021
               11pt%                                   oneside%                    
           %twoside,%                    % fronte-retro
               ]{article}                  
       
\usepackage[T1]{fontenc}                    

\usepackage[utf8]{inputenc}                 

\usepackage[italian,english]{babel}         

\usepackage{amsmath,amssymb,amsthm}         % matematica



\usepackage[dvipsnames]{xcolor}             % colori

\usepackage{hyperref}                       % collegamenti ipertestuali
%\usepackage[colorlinks]{hyperref} % Per colorare parti di testo


% Page layout
\renewcommand{\baselinestretch}{1.2}\normalsize

%%%%%%%%%%%%%%%%%%%%%%%%


%number equations after the sections
\renewcommand{\theequation}{\thesection.\arabic{equation}}
\numberwithin{equation}{section}

%% counter footnote
\renewcommand{\thefootnote}{\alph{footnote}}


  
\input{InitialFinalMaterial/settings} 


 
%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{\DIFaddtex}[1]{{\protect\color{blue}\uwave{#1}}} %DIF PREAMBLE
\providecommand{\DIFdeltex}[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
\providecommand{\DIFmodbegin}{} %DIF PREAMBLE
\providecommand{\DIFmodend}{} %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 HYPERREF PREAMBLE %DIF PREAMBLE
\providecommand{\DIFadd}[1]{\texorpdfstring{\DIFaddtex{#1}}{#1}} %DIF PREAMBLE
\providecommand{\DIFdel}[1]{\texorpdfstring{\DIFdeltex{#1}}{}} %DIF PREAMBLE
%DIF LISTINGS PREAMBLE %DIF PREAMBLE
\RequirePackage{listings} %DIF PREAMBLE
\RequirePackage{color} %DIF PREAMBLE
\lstdefinelanguage{DIFcode}{ %DIF PREAMBLE
%DIF DIFCODE_UNDERLINE %DIF PREAMBLE
  moredelim=[il][\color{red}\sout]{\%DIF\ <\ }, %DIF PREAMBLE
  moredelim=[il][\color{blue}\uwave]{\%DIF\ >\ } %DIF PREAMBLE
} %DIF PREAMBLE
\lstdefinestyle{DIFverbatimstyle}{ %DIF PREAMBLE
    language=DIFcode, %DIF PREAMBLE
    basicstyle=\ttfamily, %DIF PREAMBLE
    columns=fullflexible, %DIF PREAMBLE
    keepspaces=true %DIF PREAMBLE
} %DIF PREAMBLE
\lstnewenvironment{DIFverbatim}{\lstset{style=DIFverbatimstyle}}{} %DIF PREAMBLE
\lstnewenvironment{DIFverbatim*}{\lstset{style=DIFverbatimstyle,showspaces=true}}{} %DIF PREAMBLE
%DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF

\begin{document}

\begin{titlepage}
\thispagestyle{plain} %



\begin{center}
{ \textbf{%\vspace{-3cm}\\ 
\fontsize{13.2}{15}\selectfont\DIFdelbegin \DIFdel{\mbox{\hspace{-0cm}PROVA  DIFF}}\DIFdelend \DIFaddbegin \DIFadd{\mbox{\hspace{-0cm}PROVA  DIFF Latex}}\DIFaddend }}


          \vspace{.8cm}

         {\DIFdelbegin %DIFDELCMD < \scshape{Mario Rossi}%%%
\DIFdelend \DIFaddbegin \scshape{Mario Bianchi}\DIFaddend } 
\vspace{.15cm}

\textit{Dipartimento di Filosofia \DIFaddbegin \DIFadd{e Storia}\DIFaddend }\\

     \vspace{.9cm}

      \textbf{Abstract}
 \end{center}

 {\fontsize{10}{12.25}\selectfont\noindent Lorem \DIFdelbegin \DIFdel{ipsum}\DIFdelend \DIFaddbegin \DIFadd{dolor}\DIFaddend }

\end{titlepage}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%DIF < %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%DIF < %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%******************************************************************
%DIF <  Initial Material 
%DIF < ******************************************************************
\DIFdelbegin %DIFDELCMD < 

%DIFDELCMD < %%%
%DIF < ******************************************************************
\DIFdelend % Principal material
%******************************************************************
\input{Paragraph/Old1} %DIF > % MODIFICATO rispetto al corrispettivo Old.tex




\end{document}

差异被很好地突出显示,但嵌套文件 Old1.tex 中包含的差异没有突出显示。我还尝试了以下flatten选项,即

latexdiff ‐‐flatten /Users/Andrea/Desktop/Latexdiff/EsempioR/Old/Old.tex
New.tex > diffs.tex

但它返回以下错误:

2 and only 2 non-option arguments required.  Write latexdiff -h to get help 

您有没有什么解决方案可以在突出显示 Old.tex 和 New.tex 之间的差异时包含嵌套文件 Old1.tex?

根据 frederik 的提示进行编辑(参见下面的评论)

我将\input{Paragraph/Old1}New.tex 重命名为\input{Paragraph/New1}。然后我发出以下命令:

cd /Users/Andrea/Desktop/Latexdiff/EsempioR/Old latexdiff --preamble=/dev/null --flatten Old.tex Old.tex > Old-flattened.tex

cd /Users/Andrea/Desktop/Latexdiff/EsempioR/New latexdiff --preamble=/dev/null --flatten New.tex New.tex > New-flattened.tex

latexdiff -t UNDERLINE /Users/Andrea/Desktop/Latexdiff/EsempioR/Old/Old-flattened.tex New-flattened.tex > diffs-flattened.tex

diffs-flattened.pdf 文件是正确的,但是在编译 diffs-flattened.tex 时我遇到了以下两个错误 Package Listings Error: Environment DIFverbatim already definedPackage Listings Error: Environment DIFverbatim* already defined

我该如何解决它们?

相关内容