Skip to content

Instantly share code, notes, and snippets.

@munepi
Created January 8, 2021 06:42
Show Gist options
  • Save munepi/2c766755e8d28896c2e7d2e795e2f018 to your computer and use it in GitHub Desktop.
Save munepi/2c766755e8d28896c2e7d2e795e2f018 to your computer and use it in GitHub Desktop.
On another example of latexdiff Producing Error with Simple Tabular https://tex.stackexchange.com/questions/309144/latexdiff-producing-error-with-simple-tabular
%DIF 1a1-3
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL old.tex Tue Jan 5 16:46:48 2021
%DIF ADD new.tex Tue Jan 5 17:40:47 2021
%#!latexdiff old.tex new.tex | perl -0pe "s/%DIFDELCMD < \\\\\\\\\n%DIFDELCMD < %%%/\\\\\\\\/mg" > diff.tex && lualatex diff %DIF >
% #!latexdiff --filter-script=./post-tex.pl old.tex new.tex > diff.tex && lualatex diff %DIF >
% #!latexdiff old.tex new.tex > diff.tex && lualatex diff %DIF >
%DIF -------
\documentclass{article}
%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
\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 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}
\thispagestyle{empty}
\begin{tabular}{ll}
A & B \\
C & D \\
\DIFdelbegin \DIFdel{E }%DIFDELCMD < & %%%
\DIFdel{F }\\
\DIFdelend \hline
\end{tabular}
\begin{tabular}{ll}
A & B \\
C & D \DIFdelbegin \\
\DIFdel{E }%DIFDELCMD < & %%%
\DIFdel{F }\DIFdelend \\
\hline
\end{tabular}
\end{document}
%#!latexdiff old.tex new.tex | perl -0pe "s/%DIFDELCMD < \\\\\\\\\n%DIFDELCMD < %%%/\\\\\\\\/mg" > diff.tex && lualatex diff
% #!latexdiff --filter-script=./post-tex.pl old.tex new.tex > diff.tex && lualatex diff
% #!latexdiff old.tex new.tex > diff.tex && lualatex diff
%#LPR open -a skim diff.pdf
\documentclass{article}
\begin{document}
\thispagestyle{empty}
\begin{tabular}{ll}
A & B \\
C & D \\
\hline
\end{tabular}
\begin{tabular}{ll}
A & B \\
C & D \\
\hline
\end{tabular}
\end{document}
\documentclass{article}
\begin{document}
\thispagestyle{empty}
\begin{tabular}{ll}
A & B \\
C & D \\
E & F \\
\hline
\end{tabular}
\begin{tabular}{ll}
A & B \\
C & D \\
E & F \\
\hline
\end{tabular}
\end{document}
@munepi
Copy link
Author

munepi commented Jan 8, 2021

For testing this example, run the following script

$ latexdiff   old.tex new.tex | perl -0pe "s/%DIFDELCMD < \\\\\\\\\n%DIFDELCMD < %%%/\\\\\\\\/mg" > diff.tex
$ lualatex diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment