Code Monkey home page Code Monkey logo

latexdiff's Introduction

latexdiff

Compares two latex files and marks up significant differences between them. Releases on https://ctan.org/pkg/latexdiff and mirrors.

Link to full manual: http://mirrors.ctan.org/support/latexdiff/doc/latexdiff-man.pdf

INTRODUCTION

latexdiff is a Perl script, which compares two latex files and marks up significant differences between them (i.e. a diff for latex files). Various options are available for visual markup using standard latex packages such as "color.sty". Changes not directly affecting visible text, for example in formatting commands, are still marked in the latex source. Note that only files conforming to latex syntax will be processed correctly, not generic TeX files. Some further minor restrictions apply, see documentation.

A rudimentary revision facility is provided by another Perl script, latexrevise, which accepts or rejects all changes. Manual editing of the difference file can be used to override this default behaviour and accept or reject selected changes only.

The author is F Tilmann.

REQUIREMENTS

Perl 5.8 or higher must be installed. The latexdiff script makes use of the Perl package Algorithm::Diff (available from www.cpan.org, current version 1.19). You can either install this package, or use the standalone version of latexdiff, latexdiff-so, which has version 1.15 of this package inlined and does not require external installation of the package. Because latexdiff uses internal functions of Algorithm:Diff whose calling format or availability can change without notice, the preferred method is now to use the standalone version.

As an alternative, latexdiff-fast has a modified version of Algorithm::Diff inlined, which internally uses the UNIX diff command. This version is much faster but is dependent on an external "diff" command. Subtle differences in the algorithm of Algorithm::Diff and UNIX-diff mean that the resulting set of differences will generally not be the same as for the standard latexdiff. In most practical cases, these differences are minor, though.

INSTALLATION UNIX/LINUX

The basic installation procedure is almost trivial:

  1. Copy latexdiff, latexrevise and latexdiff-vc into a directory which is in the search path and make them executable. If the Algorithm::Diff package is not installed, use latexdiff-so instead of latexdiff.

  2. Copy latexdiff.1 and latexrevise.1 into the correct man directory

  3. Optionally create soft links latexdiff-cvs latexdiff-rcs, latexdiff-git latexdiff-svn and latexdiff-hg for latexdiff-vc.

The attached trivial Makefile contains example commands to carry out above steps as root for a typical UNIX installation. Type

make install (for the stand alone version)

or

make install-ext (for the version using the external Algorithm::Diff)

or

make install-fast (for the version using the UNIX 'diff' function for fast differencing)

to get it rolling. You can type

make test or

make test-ext or

make test-fast

to test the respective versions on a brief example before installation. It will often be as easy to carry out these steps manually instead of using the Makefile.

DOCUMENTATION

Usage instructions are in the manual latexdiff-man.pdf as well as the man pages.

CHANGELOGS

Check out the comment lines at the beginning of the perl scripts (latexdiff, latexdiff-vc, latexrevise)

CONTRIBUTIONS

The directory contrib contains code written by others relating to latexdiff.
Currently this directory contains:

latexdiff-wrap (Author: V. Kuhlmann) An alternative wrapper script which can be used instead of latexdiff-vc. Its main use is as a template for customised wrapper scripts.

latexdiff.spec (Author: T. Doerges) spec file for RPM generation

latexchanges (Author: Jan-Ake Larsson) Wrapper script for applying latexdiff with numbered document version (see contrib/README.latexchanges for a more detailed description)

Contributions by the following authors were incorporated into the latexdiff code, or inspired me to extend latexdiff in a similar way: J. Paisley, N. Becker, K. Huebner

EXTERNAL LATEXDIFF SUPPORT PROGRAMS

LATEXDIDFFR (Author: David Hugh-Jones) is a small library that uses the latexdiff command to create a diff of two Rmarkdown, .Rnw or TeX files. https://github.com/hughjonesd/latexdiffr

LATEXDIFFCITE (Author: Christer van der Meeren) is a wrapper around latexdiff to make citations diff properly. It works by expanding \cite type commands using the bbl or bib file, such that citations are treated just like normal text rather than as atomic in the plain latexdiff. https://github.com/twilsonco/latexdiffcite

GIT-LATEXDIFF (lead author: Matthieu Moy) is a wrapper (bash script) around latexdiff that allows using it to diff two revisions of a LaTeX file under git revision control (similar functionality is provided by latexdiff-vc --git with --flatten option included with this distribution but git-latexdiff allows more fine-grained control on (not to be confused with latexdiff-git, which is normally installed as a soft link to latexdiff-vc) https://gitorious.org/git-latexdiff/

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details (file LICENSE in the distribution).

latexdiff's People

Contributors

andbm avatar apydr6uxv avatar arcctgx avatar dschwoerer avatar ftilmann avatar gaulinmp avatar gitfortat avatar glaweh avatar gpelouze avatar janniklasrose avatar jasonmccsmith avatar joe6302413 avatar jprotze avatar julianuu avatar junghans avatar lorenzleutgeb avatar saladpanda avatar ssaavedra avatar tdegeus avatar trws avatar wleoncio avatar xlucn avatar yardenp avatar zalgo3 avatar zblz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

latexdiff's Issues

latexdiffcite: wrapper around latexdiff to make citations diff properly

I am a heavy user of latexdiff. Great tool, thanks! I have always been annoyed that citations do not diff properly. So I set out to fix that, and that resulted in latexdiffcite, which is a wrapper around latexdiff to make citations diff properly.

This is not a replacement for latexdiff, it's just a wrapper. I think it could be very useful for all who use latexdiff for scientific papers and similar (and those are probably quite a few!). I would be ever so grateful if you could consider spreading the word, maybe mention it in your readme/docs. ๐Ÿ˜ƒ

strange minimal example not working

These are the initial versions of the files I commited to my initialized git repository.
test.tex

\documentclass[10pt,journal,twocolumn]{IEEEtran}
\usepackage{cite,amsmath,amssymb,amsfonts,amsthm,url}
\usepackage{graphicx,epstopdf}
\usepackage{hhline}

\graphicspath{ {figures/} }

\title{My Title}
\author{Author}

\begin{document}

\maketitle

\input{introduction}

\bibliographystyle{IEEEtran}
\bibliography{test}

\end{document}

introduction.tex

% -*- root: test.tex -*-
this is some sample text and a citation \cite{art1}, \cite{art2}

test.bib

@article{art1
  title={art title},
  author={artauth},
  journal={artjourn},
  volume={3},
  pages={261--278},
  year={1988}
}

@article{art2
  title={art title 2},
  author={artauth2},
  journal={artjourn2},
  volume={3},
  pages={261--278},
  year={2000}
}

I compile these without any problems. I then changed introduction.tex by simply adding the character d:
introduction.tex - modified

% -*- root: test.tex -*-
this is some sadmple text and a citation \cite{art1}, \cite{art2}

I run:

โžœ  test git:(master) git s
 M introduction.tex
โžœ  test git:(master) โœ— latexdiff-vc --flatten --allow-spaces -V -r HEAD test.tex

Guess you are using GIT ...
Working on  test.tex
Checking out old dir into: /var/folders/mh/f311201s7p1dvk5sp293lmh40000gn/T/cFFAuUAn8h/latexdiff-vc-HEAD (rev: HEAD)
Running latexdiff
This is LATEXDIFF 1.1.0  (Algorithm::Diff 1.15 so, Perl v5.18.2)
  (c) 2004-2015 F J Tilmann
Preamble Internal Type UNDERLINE
Preamble Internal Type SAFE
Preamble Internal Type FLOATSAFE
Include file introduction.tex
Bibliography file /var/folders/mh/f311201s7p1dvk5sp293lmh40000gn/T/cFFAuUAn8h/latexdiff-vc-HEAD/test.bbl cannot be found. No flattening of \bibliography done. Run bibtex on old and new files first at /usr/texbin/latexdiff line 1467.
Include file introduction.tex
(0.01 s)
Splitting into latex tokens
Parsing /var/folders/mh/f311201s7p1dvk5sp293lmh40000gn/T/cFFAuUAn8h/latexdiff-vc-HEAD/test.tex
Parsing test.tex
(0 s)
Pass 1: Expanding text commands and merging isolated identities with changed blocks
  1 matching  tokens in 0 blocks.
  0 discarded tokens in 0 blocks.
  0 appended  tokens in 0 blocks.
(0 s)
Pass 2: inserting DIF tokens and mark up.
  1 matching  tokens.
  0 discarded tokens in 0 blocks.
  0 appended  tokens in 0 blocks.
(0 s)
Splitting into latex tokens
Parsing /var/folders/mh/f311201s7p1dvk5sp293lmh40000gn/T/cFFAuUAn8h/latexdiff-vc-HEAD/test.tex
Parsing test.tex
(0 s)
Pass 1: Expanding text commands and merging isolated identities with changed blocks
  2 matching  tokens in 0 blocks.
  0 discarded tokens in 0 blocks.
  0 appended  tokens in 0 blocks.
(0 s)
Pass 2: inserting DIF tokens and mark up.
  2 matching  tokens.
  0 discarded tokens in 0 blocks.
  0 appended  tokens in 0 blocks.
Differencing preamble.
Preprocessing body.  (0 s)
Splitting into latex tokens
Parsing /var/folders/mh/f311201s7p1dvk5sp293lmh40000gn/T/cFFAuUAn8h/latexdiff-vc-HEAD/test.tex
Parsing test.tex

WARNING: Inconsistency in length of input string and parsed string:
     This often indicates faulty or non-standard latex code.
     In many cases you can ignore this and the following warning messages.
 Note that character numbers in the following are counted beginning after \begin{document} and are only approximate.
mmand{\url}[1]{#1} \csname url@samestyle\endcsname \providecommand{\ne
                              ^^^^^^^^^^
Missing characters near word 22 character index: 269-279 Length: 9 Match: |samestyle| (expected match marked above).
(0 s)
Pass 1: Expanding text commands and merging isolated identities with changed blocks
  19 matching  tokens in 2 blocks.
  2 discarded tokens in 2 blocks.
  23 appended  tokens in 2 blocks.
(0.02 s)
Pass 2: inserting DIF tokens and mark up.
WARNING: Inconsistency in length of input string and parsed string:
     This often indicates faulty or non-standard latex code.
     In many cases you can ignore this and the following warning messages.
 Note that character numbers in the following are counted beginning after \begin{document} and are only approximate.
mmand{\url}[1]{#1} \csname url@samestyle\endcsname \providecommand{\ne
                              ^^^^^^^^^^
Missing characters near word 5 character index: 123-133 Length: 9 Match: |samestyle| (expected match marked above).

  19 matching  tokens.
  2 discarded tokens in 2 blocks.
  23 appended  tokens in 2 blocks.
(0.02 s)
Postprocessing body.
 (0 s)
Done.
Generated difference file test-diffHEAD.tex

which gives me the following test-diffHEAD.tex file:

\documentclass[10pt,journal,twocolumn]{IEEEtran}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL /var/folders/mh/f311201s7p1dvk5sp293lmh40000gn/T/cFFAuUAn8h/latexdiff-vc-HEAD/test.tex   Wed Sep 23 10:45:02 2015
%DIF ADD test.tex                                                                                 Wed Sep 23 10:44:22 2015
\usepackage{cite,amsmath,amssymb,amsfonts,amsthm,url}
\usepackage{graphicx,epstopdf}
\usepackage{hhline}

\graphicspath{ {figures/} }



\title{My Title}
\author{Author}
%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

\begin{document}

\maketitle

% -*- root: test.tex -*-
this is some \DIFdelbegin \DIFdel{sample }\DIFdelend \DIFaddbegin \DIFadd{sadmple }\DIFaddend text and a citation \cite{art1}, \cite{art2}

\bibliographystyle{IEEEtran}
\DIFdelbegin %DIFDELCMD < \bibliography{test}
%DIFDELCMD < %%%
\DIFdelend %DIF >  Generated by IEEEtran.bst, version: 1.13 (2008/09/30)
\DIFaddbegin \begin{thebibliography}{1}
\providecommand{\url}[1]{#1}
\csname \DIFadd{url@samestyle}\endcsname
\providecommand{\newblock}{\relax}
\providecommand{\bibinfo}[2]{#2}
\providecommand{\BIBentrySTDinterwordspacing}{\spaceskip=0pt\relax}
\providecommand{\BIBentryALTinterwordstretchfactor}{4}
\providecommand{\BIBentryALTinterwordspacing}{\spaceskip=\fontdimen2\font plus
\BIBentryALTinterwordstretchfactor\fontdimen3\font minus
  \fontdimen4\font\relax}
\providecommand{\BIBforeignlanguage}[2]{{%
\expandafter\ifx\csname l@#1\endcsname\relax
\typeout{** WARNING: IEEEtran.bst: No hyphenation pattern has been}%
\typeout{** loaded for the language `#1'. Using the pattern for}%
\typeout{** the default language instead.}%
\else
\language=\csname l@#1\endcsname
\fi
#2}}
\providecommand{\BIBdecl}{\relax}
\BIBdecl

\bibitem{art1}


\bibitem{art2}


\end{thebibliography}
\DIFaddend 


\end{document}

When I try to compile that file, I get:

E: /Users/diego/Desktop/test/test-diffHEAD.tex:48 Missing \endcsname inserted \csname \DIFadd{url@samestyle}
E: /Users/diego/Desktop/test/test-diffHEAD.tex:48 Extra }, or forgotten \endgroup \csname \DIFadd{url@samestyle}
E: /Users/diego/Desktop/test/test-diffHEAD.tex:48 Extra \endcsname \csname \DIFadd{url@samestyle}\endcsname
E: /Users/diego/Desktop/test/test-diffHEAD.tex:68 Something's wrong--perhaps a missing \item. \bibitem{art1}
E: /Users/diego/Desktop/test/test-diffHEAD.tex:68 Something's wrong--perhaps a missing \item. \bibitem{art1}
E: /Users/diego/Desktop/test/test-diffHEAD.tex:68 Something's wrong--perhaps a missing \item. \bibitem{art1}
E: /Users/diego/Desktop/test/test-diffHEAD.tex:71 Something's wrong--perhaps a missing \item. \bibitem{art2}
E: /Users/diego/Desktop/test/test-diffHEAD.tex:71 Something's wrong--perhaps a missing \item. \bibitem{art2}
E: /Users/diego/Desktop/test/test-diffHEAD.tex:71 Something's wrong--perhaps a missing \item. \bibitem{art2}
E: /Users/diego/Desktop/test/test-diffHEAD.tex:74 Something's wrong--perhaps a missing \item. \end{thebibliography}

10 errors, 0 warnings, 0 badboxes

Parsing preamble for included packages fails for multiline commands

Running latexdiff (LATEXDIFF 1.0.4 (Algorithm::Diff 1.1902, Perl v5.18.2)) with changes inside section or subsection I got:

Argument of \UL@word has an extra } ...begin\DIFadd{Some Text}\DIFaddend}

I found that applying what advised in http://tex.stackexchange.com/questions/87536/problem-using-latexdiff-and-pdflatex-with-custom-command
solves the problem.

In particular:

I would assume that the difficulty is with hyperref, which tries to include underlined/crossed out text as hyperlink given that it is part of a chapter.

The solution is to use texorpdfstring, which tells hyperref to use plain text for the hyperlinks. I can't remember the exact commands that latexdiff definds, but try something like that:

% Redefine these commands for chapter/sections and change below
\DeclareRobustCommand{\hsout}[1]{\texorpdfstring{\sout{#1}}{#1}}
\DeclareRobustCommand{\hwave}[1]{\texorpdfstring{\uwave{#1}}{#1}}

%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\textcolor{blue}{\hwave{#1}}}}% DIF PREAMBLE
\providecommand{\DIFdel}[1]{{\protect\textcolor{red}{\hsout{#1}}}}% DIF PREAMBLE

Even --exclude-textcmd="section,subsection" works, but I lose the edits into the subsection.

Thanks, Alex

labels defined twice when equation is moved

When I move a labled equation (using the align environement) I end up with an error as the equation lable is used twice: once inside DIFdel and once inside DIFadd. Easily fixed manually by removing the label in the DIFdel section, but an automatic solution would be nice.

Table with math gives `missing \cr inserted`.

In a table

\begin{tabular}{c}
  $\left\{
    \begin{tabular}{c}
      a $\beta$ c
    \end{tabular}
  \right\}$
\end{tabular}

that changed latexdiff throws

! Missing \cr inserted.
<inserted text> 
                \cr 

Trouble with underscored names

I'm having trouble properly getting latexdiff v1.0.4 (with the tableenv patch) to behave correctly with how I name variables. I'm writing documentation for an api and as such I have latex code as follows:

    Variables can be named like the following: ``first\_name'', ``last\_name'', ``project_status''

This prints out the following:

Variables can be named like the following: "first_name", "last_name", "project_status"

I have to escape the underscores for latex to print them in the text environment. I also have cases where I'm escaping dollar signs: "this is a $variable_name"

When latexdiff runs it's splitting these names into 2 parts as so:

    \DIFdelbegin \DIFdel{\hspace{1em} }\texttt{\DIFdel{<last}%DIFDELCMD < \_name%%%
    \DIFdel{>Jones</last}%DIFDELCMD < \_name%%%

Is there a way around this? I'm comfortable with perl so I can make edits or apply patches if need be. Thanks in advance!

! Argument of \@citex has an extra }.

I'm getting the error shown below, which prevents pdflatex from compiling.

pdflatex test.tex
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 78 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/natbib/natbib.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))

Package hyperref Message: Driver (autodetected): hpdftex.

(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/color.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def))
No file test.aux.
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)
! Argument of \@citex has an extra }.
<inserted text> 
                \par 
l.39 }
      %DIFDELCMD < {%%%
? 

I've isolated the issue in a small article, to reproduce the above error. This small article is created from the .tex generated by latexdiff, keeping only the part that causes the error (actual text is changed to gibberish).

\documentclass{article}

\usepackage{natbib}
\usepackage{hyperref}

%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
%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
%DIF PREAMBLE EXTENSION ADDED BY LATEXDIFF
%DIF HYPERREF PREAMBLE %DIF PREAMBLE
\providecommand{\DIFadd}[1]{\texorpdfstring{\DIFaddtex{#1}}{#1}} %DIF PREAMBLE
\providecommand{\DIFdel}[1]{\texorpdfstring{\DIFdeltex{#1}}{}} %DIF PREAMBLE
%DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF

\begin{document}

aaa \DIFdelbegin \DIFdel{x axis }\DIFdelend \DIFaddbegin \DIFadd{x-axis }\DIFaddend sdfsdfsdf df
sdfsdfsd~\DIFdelbegin \DIFdel{\mbox{%DIFAUXCMD
\citep
}%DIFAUXCMD
}%DIFDELCMD < {%%%
\DIFdel{Smith_1986,Smith_2008}%DIFDELCMD < }%%%
\DIFdel{.}\DIFdelend \DIFaddbegin \DIFadd{\mbox{%DIFAUXCMD
\citep{Smith_1986,Smith_2008}}%DIFAUXCMD
.}\DIFaddend \footnote{The aaa
fdg df gdfg df gdf gd fg dfg dfg dfg dfg dfg
eee \DIFdelbegin \DIFdel{x axis }\DIFdelend \DIFaddbegin \DIFadd{x-axis }\DIFaddend sdfd fgdfg dfgdfg
wef dsff gdf ghdf ger ter te rt ert ert ert e rt
\DIFdelbegin \DIFdel{x
axis}\DIFdelend \DIFaddbegin \DIFadd{x-axis}\DIFaddend .}

\end{document}

Does not work when a bibliography is present?

When I check in the following file to my git repo:
text.tex:

\documentclass[journal]{IEEEtran}
\usepackage{cite}
\begin{document}

\title{TEST TITLE}

\maketitle

\begin{abstract}
test abstract 
\end{abstract}

\begin{IEEEkeywords}
test keyword
\end{IEEEkeywords}


\section{Introduction}
etc

\end{document}

and then trivially modify the file an use latexdiff as: latexdiff-vc --flatten -r HEAD test.tex I get a diff file that compiles and is fine.

If I start over adding the following bibliography to test.tex:

\section{Introduction}
etc \cite{sdf}

\bibliographystyle{IEEEtran}
\bibliography{testbib}

where testbib.bib is:

@ARTICLE{sdf,
  author = {sad},
  title = {sd},
  journal = {asd},
  year = {sdf}
}

then I check both in to my git repo and trivially modify test.tex I get the following error:

tes git:(master) โœ— latexdiff-vc --flatten -r HEAD test.tex
Guess you are using GIT ...
Working on  test.tex
Checking out old dir into: /var/folders/mh/f311201s7p1dvk5sp293lmh40000gn/T/F_BlbH_zU3/latexdiff-vc-HEAD (rev: HEAD)
OK to overwrite existing file test-diffHEAD.tex (y/n)? y
Running latexdiff

WARNING: Inconsistency in length of input string and parsed string:
     This often indicates faulty or non-standard latex code.
     In many cases you can ignore this and the following warning messages.
 Note that character numbers in the following are counted beginning after \begin{document} and are only approximate.
mmand{\url}[1]{#1} \csname url@samestyle\endcsname \providecommand{\ne
                              ^^^^^^^^^^
Missing characters near word 26 character index: 357-367 Length: 9 Match: |samestyle| (expected match marked above).

WARNING: Inconsistency in length of input string and parsed string:
     This often indicates faulty or non-standard latex code.
     In many cases you can ignore this and the following warning messages.
 Note that character numbers in the following are counted beginning after \begin{document} and are only approximate.
mmand{\url}[1]{#1} \csname url@samestyle\endcsname \providecommand{\ne
                              ^^^^^^^^^^
Missing characters near word 6 character index: 152-162 Length: 9 Match: |samestyle| (expected match marked above).
Generated difference file test-diffHEAD.tex

The generated test-diffHEAD.tex file does not compile and puts out a bunch of errors

Something went wrong in latexdiff. Deleting diff.tex and abort

example:

this may be test2.tex

%\documentclass[aps,pre,amsmath,amssymb,longbibliography,lengthcheck,showpacs,superscriptaddress,nofootinbib,floatfix]{article}

\documentclass[aps,pre,amsmath,amssymb,longbibliography,lengthcheck,showpacs,superscriptaddress,nofootinbib,floatfix]{revtex4-1}

%\documentclass[aps,pre,amsmath,amssymb,lengthcheck,showpacs,floatfix]{revtex4-1}
%\documentclass[superscriptaddress,twocolumn,pre,amsmath,showpacs,bibliography]{revtex4-1}
\usepackage{siunitx}
\usepackage[]{inputenc}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{colordvi}
\usepackage{epsfig}
%\usepackage{bm}
\usepackage{subcaption}
\usepackage{commath}
\usepackage[usenames]{color}
%\usepackage{natbib}
\usepackage{url}
 \usepackage[english]{babel}





\begin{document}

\title{Draft 2016}

\author{xxxxxx}
%\affiliation{dadasdad}


\begin{abstract}
\noindent  Abstract: Draft-version Paper.Test
\end{abstract}

\date{\today}
%\pacs{???}






\maketitle

\maketitle
%\onecolumngrid
\section{Introduction}




asdad aLorem ipsum dolor sit amet, conseteted diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{Theory (WIP)}
%\bibliographystyle{unsrt}

%\bibliographystyle{abbrv}

\bibliographystyle{unsrtnat}

\bibliography{ExportedItems}


\end{document}

This is test1.tex

%\documentclass[aps,pre,amsmath,amssymb,longbibliography,lengthcheck,showpacs,superscriptaddress,nofootinbib,floatfix]{article}

\documentclass[aps,pre,amsmath,amssymb,longbibliography,lengthcheck,showpacs,superscriptaddress,nofootinbib,floatfix]{revtex4-1}

%\documentclass[aps,pre,amsmath,amssymb,lengthcheck,showpacs,floatfix]{revtex4-1}
%\documentclass[superscriptaddress,twocolumn,pre,amsmath,showpacs,bibliography]{revtex4-1}
\usepackage{siunitx}
\usepackage[]{inputenc}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{colordvi}
\usepackage{epsfig}
%\usepackage{bm}
\usepackage{subcaption}
\usepackage{commath}
\usepackage[usenames]{color}
%\usepackage{natbib}
\usepackage{url}
 \usepackage[english]{babel}





\begin{document}

\title{Draft 2016}

\author{xxxxxx}
%\affiliation{dadasdad}


\begin{abstract}
\noindent  Abstract: Draft-version Paper.Test
\end{abstract}

\date{\today}
%\pacs{???}






\maketitle

\maketitle
%\onecolumngrid
\section{Introduction}




Lorem ipsum dolor sit amet, conseteted diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{Theory (WIP)}
%\bibliographystyle{unsrt}

%\bibliographystyle{abbrv}

\bibliographystyle{unsrtnat}

\bibliography{ExportedItems}


\end{document}

Now using latexdiff-vc test1.tex test2.tex > diff.tex

results in

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\zref\@newlabel{ <-- HERE DIFchgb(\d*)}{.*\\abspage{(\d*)}}/ at /usr/bin/latexdiff-vc line 451.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\zref\@newlabel{DIFchgb(\d*)}{ <-- HERE .*\\abspage{(\d*)}}/ at /usr/bin/latexdiff-vc line 451.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\zref\@newlabel{DIFchgb(\d*)}{.*\\abspage{ <-- HERE (\d*)}}/ at /usr/bin/latexdiff-vc line 451.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\zref\@newlabel{ <-- HERE DIFchge(\d*)}{.*\\abspage{(\d*)}}/ at /usr/bin/latexdiff-vc line 454.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\zref\@newlabel{DIFchge(\d*)}{ <-- HERE .*\\abspage{(\d*)}}/ at /usr/bin/latexdiff-vc line 454.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\zref\@newlabel{DIFchge(\d*)}{.*\\abspage{ <-- HERE (\d*)}}/ at /usr/bin/latexdiff-vc line 454.
Working on  test2.tex 
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\includeonly{ <-- HERE (.*?)}/ at /usr/bin/latexdiff line 1468.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(^(?:[^%\n]|\\%)*)\\bibliography{ <-- HERE (.*?)}/ at /usr/bin/latexdiff line 1503.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(^(?:[^%\n]|\\%)*)\\subfile{ <-- HERE (.*?)}/ at /usr/bin/latexdiff line 1518.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\\{ <-- HERE / at /usr/bin/latexdiff line 2247.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin{ <-- HERE MATHMODE}((?:(.(?!(?<!\\)\&|\\\\))*)?)\\end{MATHMODE}/ at /usr/bin/latexdiff line 2572.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin{MATHMODE}((?:(.(?!(?<!\\)\&|\\\\))*)?)\\end{ <-- HERE MATHMODE}/ at /usr/bin/latexdiff line 2572.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin{ <-- HERE MATHMODE}(.*?)\\end{MATHMODE}/ at /usr/bin/latexdiff line 2574.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin{MATHMODE}(.*?)\\end{ <-- HERE MATHMODE}/ at /usr/bin/latexdiff line 2574.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\end{ <-- HERE SQUAREBRACKET}/ at /usr/bin/latexdiff line 2655.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin{ <-- HERE SQUAREBRACKET}/ at /usr/bin/latexdiff line 2656.
Unknown encoding '' at /usr/bin/latexdiff line 1341.
Something went wrong in latexdiff. Deleting test2-diff.tex and abort

Multicolumn table breaks when number of columns changes

I have a large document that contains tables with footers. I am using the multicolumn command to do footers.

If the number of columns changes, the diff adds tags around the column command as shown in the attached documents.

I stripped the document down to a dummy table that shows the issues.

This was found on Version 1.1.0

latexDiffBugs.zip

commented out \include is included anyway

I found a bug in version 1.0.2 and don't know if its fixed in newer versions (changelog does not mention it), so i will report it anyway:
When you comment out an \include command with % latexdiff will still flatten the included file into the output. (Leaving the first line of the included file commented out)

\include{this will be included}
%\include{this too}

using the --flatten option.

This is LATEXDIFF 1.0.2  (Algorithm::Diff 1.15 fast, Perl v5.18.2)
  (c) 2004-2012 F J Tilmann

Versioned release archives

Can you please release archives that contain the version number? For example, latexdiff-1.1.0.zip?

I know you consider CTAN to be the canonical distribution site. If CTAN cannot accommodate versioned files, could you release your files on github's releases service instead, since I know they do accommodate that?

Not having the version number in the release filename causes problems every time you release a new version, e.g. https://trac.macports.org/ticket/47519.

Unescaped left brace in regex is deprecated, passed through in regex;

As far as I know the deprecation warnings should be fixed in the most recent version. May be I did something wrong?


./latexdiff --version                                                                                                                                             
This is LATEXDIFF 1.2.1a  (Algorithm::Diff 1.1903, Perl v5.24.0)
  (c) 2004-2016 F J Tilmann

After performing ./latexdiff test2.tex test1.tex > diff.tex the following error occurs:

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/command{ <-- HERE \\DIFaddbeginFL}{((?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}])*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*)}/ at ./latexdiff line 836.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/command{\\DIFaddbeginFL}{ <-- HERE ((?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}])*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*\})*)}/ at ./latexdiff line 836.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin\{((?:picture|tikzpicture|DIFnomarkup)[\w\d*@]*)}(.*?)\\end{ <-- HERE \1}/ at ./latexdiff line 2161, <DATA> line 30487.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin\{((?:aligned|array|[pbvBV]?matrix|smallmatrix|cases|split))}(.*?)\\end{ <-- HERE \1}/ at ./latexdiff line 2166, <DATA> line 30487.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin\{((?:equation[*]?|displaymath|DOLLARDOLLAR)[*]?|(?:eqnarray|align|alignat|gather|multline|flalign)[*]?|SQUAREBRACKET)}(.*?)\\frac(([\s]*%[^\n]*?)*[\r\n|\r|\n])+\{(.*?)\\end{ <-- HERE \1}/ at ./latexdiff line 2051, <DATA> line 30487.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin\{((?:equation[*]?|displaymath|DOLLARDOLLAR)[*]?|(?:eqnarray|align|alignat|gather|multline|flalign)[*]?|SQUAREBRACKET)}(.*?)\\end{ <-- HERE \1}/ at ./latexdiff line 2170, <DATA> line 30487.

Working example:

text1.tex

%\documentclass[aps,pre,amsmath,amssymb,longbibliography,lengthcheck,showpacs,superscriptaddress,nofootinbib,floatfix]{article}

\documentclass[aps,pre,amsmath,amssymb,longbibliography,lengthcheck,showpacs,superscriptaddress,nofootinbib,floatfix]{revtex4-1}

%\documentclass[aps,pre,amsmath,amssymb,lengthcheck,showpacs,floatfix]{revtex4-1}
%\documentclass[superscriptaddress,twocolumn,pre,amsmath,showpacs,bibliography]{revtex4-1}
\usepackage{siunitx}
%\usepackage[]{inputenc}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{colordvi}
\usepackage{epsfig}
%\usepackage{bm}
\usepackage{subcaption}
\usepackage{commath}
\usepackage[usenames]{color}
%\usepackage{natbib}
\usepackage{url}
 \usepackage[english]{babel}





\begin{document}

\title{Test 2016}

\author{xxxxxx}
%\affiliation{dadasdad}


\begin{abstract}
\noindent  Abstract:Test
\end{abstract}

\date{\today}
%\pacs{???}






\maketitle

\maketitle
%\onecolumngrid
\section{Introduction}




changed text

\section{Theory (WIP)}
%\bibliographystyle{unsrt}

%\bibliographystyle{abbrv}

\bibliographystyle{unsrtnat}

%\bibliography{ExportedItems}


\end{document}

test2.tex


%\documentclass[aps,pre,amsmath,amssymb,longbibliography,lengthcheck,showpacs,superscriptaddress,nofootinbib,floatfix]{article}

\documentclass[aps,pre,amsmath,amssymb,longbibliography,lengthcheck,showpacs,superscriptaddress,nofootinbib,floatfix]{revtex4-1}

%\documentclass[aps,pre,amsmath,amssymb,lengthcheck,showpacs,floatfix]{revtex4-1}
%\documentclass[superscriptaddress,twocolumn,pre,amsmath,showpacs,bibliography]{revtex4-1}
\usepackage{siunitx}
%\usepackage[]{inputenc}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{colordvi}
\usepackage{epsfig}
%\usepackage{bm}
\usepackage{subcaption}
\usepackage{commath}
\usepackage[usenames]{color}
%\usepackage{natbib}
\usepackage{url}
 \usepackage[english]{babel}





\begin{document}

\title{Draft 2016}

\author{xxxxxx}
%\affiliation{dadasdad}


\begin{abstract}
\noindent  Abstract: Test
\end{abstract}

\date{\today}
%\pacs{???}






\maketitle

\maketitle
%\onecolumngrid
\section{Introduction}




asdad aLorem ipsum dolor sit amet, conseteted diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{Theory (WIP)}
%\bibliographystyle{unsrt}

%\bibliographystyle{abbrv}

\bibliographystyle{unsrtnat}

\bibliography{ExportedItems}


\end{document}

Tikz subfigures

(Subfigure appears to be obsolete, but I don't know if that matters in this case.)

Given the example usage, after a latexdiff --flatten an extra } would be added after every \end{tikzpicture}. There's no pair bracket to it, as deleting the } would solve the issue.

\begin{figure}
\subfigure[Caption1]{\input{figures/figure1/tikz1}
\subfigure[Caption2]{\input{figures/figure2/tikz2}
\subfigure[Caption3]{\input{figures/figure3/tikz3}
\end{figure}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] at (0,0) {
    \includegraphics[width=.5\linewidth]{figures/figure1/figure1.jpeg}
};

... 

\end{tikzpicture}

Table layout breaks when removing a row

When removing a complete row of a table with more than one column, the layout breaks because latexdifout-comments the "&" command

Since it is not a proper command ( as in starting with backslash), it cannot be added to the same-cmd list.

Easiest way to fix this would be a way, to add "&" to the safe-cmd list using run-time arguments

More descriptive installation steps

First of all: I just found out about this app and it is awesome, it makes it really simple to show changes in PDF files to pass around collaborators. So thank you for this.

Now, I'm running elementary OS 0.2 (based on Ubuntu 12.04) and if I install using

sudo apt-get install latexdiff

I get the 0.5 (Algorithm::Diff 1.15 fast) version of the app. I'd like to install the latest version but I don't know how. I've read the installing instructions but they are written in a way that you really must know your way around linux to understand them.

Let me expand on this:

The basic installation procedure is almost trivial:

  1. Copy latexdiff, latexrevise and latexdiff-vc into a directory which is in the search path (search path?) and make them executable. If the Algorithm::Diff package is not installed (what is this package and how do I know if it's installed?), use latexdiff-so instead of latexdiff.
  2. Copy latexdiff.1 and latexrevise.1 into the correct man directory (which one is that?)
  3. Optionally create soft links latexdiff-cvs latexdiff-rcs, and latexdiff-svn for latexdiff-vc. (how?)

So you'll see, for a linux regular user these instructions are quite hard to follow. Is there an easier way of getting the latest version, like adding a PPA or running a script/deb file?

Cheers and thanks again!

By email: Suggestion for verbatim/lstlisting support

Email from J. Protze (28/07/2015 14:30)

Dear Frederik,

we use latexdiff quite a lot and I like the tool. But in computer science we have source code snippets in our latex documents - in either verbatim or lstlisting environment. In the attached "ignore" diff, I added the handling of lstlisting as you do it with verbatim - probably you might integrate this to your code?

But we would also like to highlight diffs in the source code blocks.

With the lstlistings environment it's possible to define the style for a line based on a "comment" symbol. For diffs that might be used by prefixing added lines with '+' and deleted lines with '-' and provide different styles for '+' comments and '-' comments.

I hacked something for the lstlistings environment in the attached "support" diff (I'm not too confident with all the perl magic used in your script).
In the postprocessing, I try to find the occurances where the hash for a code block changed. Then I apply a line-by-line diff on the contents of these code blocks and add "+"/"-" to the changed lines.

Verbatim blocks could be handled similarly, after replacing the verbatim environment by lstlisting.

I'm not sure how to integrate this smoothly into the whole tool workflow, without breaking too much. (Especially how to add only the parts of the preamble as listed below that are not already defined in the document)

By adding the following to the preamble, lstlisting blocks will look like the default verbatim block; the morecomment line sets the style for added/removed lines:

\usepackage{listings}
\lstdefinelanguage{codediff}{
  morecomment=[f][\color{red!80!black}]-,         % deleted lines
  morecomment=[f][\color{green!60!black}]+,       % added lines
}
\lstdefinestyle{codediff}{
  belowcaptionskip=.25\baselineskip,
  language=codediff,
  showstringspaces=false,
  basicstyle=\ttfamily,
  columns=fullflexible,
  keepspaces=true,
  float,
  floatplacement=H,
  belowskip=\smallskipamount,
  aboveskip=\smallskipamount,
}
\lstset{style=codediff}

Do you think, it would be possible, to integrate this to your tool?

Best
Joachim

latexdiff-add-lstlisting-support.diff

diff --git a/latexdiff-1.1.0/latexdiff b/latexdiff-1.1.0/latexdiff
index bb75ce4..e368f3c 100755
--- a/latexdiff-1.1.0/latexdiff
+++ b/latexdiff-1.1.0/latexdiff
@@ -658,6 +658,10 @@ if ( length $oldpreamble && length $newpreamble ) {
     # insert latexdiff commands at the end of preamble (default behaviour)
     push @diffpreamble,$latexdiffpreamble;
   }
+  if ( !defined $packages{"listings"} ) {
+  push @diffpreamble,'\usepackage{listings}','\lstdefinelanguage{diff}{','morecomment=[f][\color{red!80!black}]-,         % deleted lines',
+          'morecomment=[f][\color{green!60!black}]+,','}','\lstdefinestyle{cstyle}{language=diff}','\lstset{style=cstyle}';
+  }
   push @diffpreamble,'\begin{document}';
 }
 elsif ( !length $oldpreamble && !length $newpreamble ) {
@@ -1720,7 +1724,9 @@ sub preprocess {
     s/(?<!\\)\\%/\\PERCENTAGE /g ;  # (?<! is negative lookbehind assertion to prevent \\% from being converted
     s/(?<!\\)\\\$/\\DOLLAR /g ;  # (?<! is negative lookbehind assertion to prevent \\$ from being converted
     s/(\\verb\*?)(\S)(.*?)\2/"${1}{". tohash(\%verbhash,"${2}${3}${2}") ."}"/esg;
+    s/(\\lstinline\*?)(\S)(.*?)\2/"${1}{". tohash(\%verbhash,"${2}${3}${2}") ."}"/esg;
     s/\\begin\{(verbatim\*?)\}(.*?)\\end\{\1\}/"\\${1}{". tohash(\%verbhash,"${2}") . "}"/esg;
+    s/\\begin\{(lstlisting\*?)\}(.*?)\\end\{\1\}/"\\${1}{". tohash(\%verbhash,"${2}") . "}"/esg;
     # Convert _n or _\cmd into \SUBSCRIPTNB{n} or \SUBSCRIPTNB{\cmd} and _{nnn} into \SUBSCRIPT{nn}
     1 while s/(?<!\\)_([^{\\]|\\\w+)/\\SUBSCRIPTNB{$1}/g ;
     1 while s/(?<!\\)_{($pat6)}/\\SUBSCRIPT{$1}/g ;
@@ -2038,8 +2044,12 @@ sub postprocess {

     # Expand hashes of verb and verbatim environments (note negative look behind assertion to not leak out of DIFDELCMD comments
     s/(\\verb\*?)\{([-\d]*?)\}/"${1}". fromhash(\%verbhash,$2)/esg;
+    s/(\\lstinline\*?)\{([-\d]*?)\}/"${1}". fromhash(\%verbhash,$2)/esg;
     s/${DELCMDOPEN}\\(verbatim\*?)\{([-\d]*?)\}/"${DELCMDOPEN}\\begin{${1}}".fromhash(\%verbhash,$2,$DELCMDOPEN)."${DELCMDOPEN}\\end{${1}}"/esg;
+    s/\\DIFdelbegin ${DELCMDOPEN}\\(lstlisting\*?)\{([-\d]*?)\}\s*${DELCMDOPEN}\s*${DELCMDCLOSE}\s*\\DIFdelend\s*\\DIFaddbegin\s*\\\1\{([-\d]*?)\}\s*\\DIFaddend/"\\begin{${1}}".join("\n",codediff(fromhash(\%verbhash,$2),fromhash(\%verbhash,$3)))."\\end{${1}}"/esg;
+    s/${DELCMDOPEN}\\(lstlisting\*?)\{([-\d]*?)\}/"${DELCMDOPEN}\\begin{${1}}".fromhash(\%verbhash,$2,$DELCMDOPEN)."${DELCMDOPEN}\\end{${1}}"/esg;
     s/\\(verbatim\*?)\{([-\d]*?)\}/"\\begin{${1}}".fromhash(\%verbhash,$2)."\\end{${1}}"/esg;
+    s/\\(lstlisting\*?)\{([-\d]*?)\}/"\\begin{${1}}".fromhash(\%verbhash,$2)."\\end{${1}}"/esg;
     # Convert '\PERCENTAGE ' back into '\%' (the final question mark catches a special situation where due to a latter pre-processing step the ' ' becomes separated          
     s/\\PERCENTAGE ?/\\%/g;
     # Convert '\DOLLAR ' back into '\$'                   
@@ -2262,6 +2272,29 @@ sub linediff {
   return wantarray ? @$retseq : $retseq ;
 }

+# @diffs=codediff(\@seq1, \@seq2)
+# mark up lines like this
+# - old deleted line(s)
+# + new inserted line(s)
+#   common line(s)
+# Future extension: mark change explicitly
+sub codediff {
+  my $seq1 = shift ;
+  my @seq1 = split /\n/, $seq1;
+  my $seq2 = shift ;
+  my @seq2 = split /\n/, $seq2;
+
+  my $diff = Algorithm::Diff->new( \@seq1, \@seq2 );
+  my $retseq = [];
+
+  while(  $diff->Next()  ) {
+      push @$retseq, $diff->Same();
+      next   if  $diff->Same();
+      push @$retseq, "- $_"   for  $diff->Items(1);
+      push @$retseq, "+ $_"   for  $diff->Items(2);
+  }
+  return wantarray ? @$retseq : $retseq ;
+}


 # init_regex_arr_data(\@array,"TOKEN INIT")


latexdiff-add-lstlisting-ignore.diff

diff --git a/latexdiff-1.1.0/latexdiff b/latexdiff-1.1.0/latexdiff
index bb75ce4..6b9df75 100755
--- a/latexdiff-1.1.0/latexdiff
+++ b/latexdiff-1.1.0/latexdiff
@@ -1720,7 +1720,9 @@ sub preprocess {
     s/(?<!\\)\\%/\\PERCENTAGE /g ;  # (?<! is negative lookbehind assertion to prevent \\% from being converted
     s/(?<!\\)\\\$/\\DOLLAR /g ;  # (?<! is negative lookbehind assertion to prevent \\$ from being converted
     s/(\\verb\*?)(\S)(.*?)\2/"${1}{". tohash(\%verbhash,"${2}${3}${2}") ."}"/esg;
+    s/(\\lstinline\*?)(\S)(.*?)\2/"${1}{". tohash(\%verbhash,"${2}${3}${2}") ."}"/esg;
     s/\\begin\{(verbatim\*?)\}(.*?)\\end\{\1\}/"\\${1}{". tohash(\%verbhash,"${2}") . "}"/esg;
+    s/\\begin\{(lstlisting\*?)\}(.*?)\\end\{\1\}/"\\${1}{". tohash(\%verbhash,"${2}") . "}"/esg;
     # Convert _n or _\cmd into \SUBSCRIPTNB{n} or \SUBSCRIPTNB{\cmd} and _{nnn} into \SUBSCRIPT{nn}
     1 while s/(?<!\\)_([^{\\]|\\\w+)/\\SUBSCRIPTNB{$1}/g ;
     1 while s/(?<!\\)_{($pat6)}/\\SUBSCRIPT{$1}/g ;
@@ -2038,8 +2040,11 @@ sub postprocess {

     # Expand hashes of verb and verbatim environments (note negative look behind assertion to not leak out of DIFDELCMD comments
     s/(\\verb\*?)\{([-\d]*?)\}/"${1}". fromhash(\%verbhash,$2)/esg;
+    s/(\\lstinline\*?)\{([-\d]*?)\}/"${1}". fromhash(\%verbhash,$2)/esg;
     s/${DELCMDOPEN}\\(verbatim\*?)\{([-\d]*?)\}/"${DELCMDOPEN}\\begin{${1}}".fromhash(\%verbhash,$2,$DELCMDOPEN)."${DELCMDOPEN}\\end{${1}}"/esg;
+    s/${DELCMDOPEN}\\(lstlisting\*?)\{([-\d]*?)\}/"${DELCMDOPEN}\\begin{${1}}".fromhash(\%verbhash,$2,$DELCMDOPEN)."${DELCMDOPEN}\\end{${1}}"/esg;
     s/\\(verbatim\*?)\{([-\d]*?)\}/"\\begin{${1}}".fromhash(\%verbhash,$2)."\\end{${1}}"/esg;
+    s/\\(lstlisting\*?)\{([-\d]*?)\}/"\\begin{${1}}".fromhash(\%verbhash,$2)."\\end{${1}}"/esg;
     # Convert '\PERCENTAGE ' back into '\%' (the final question mark catches a special situation where due to a latter pre-processing step the ' ' becomes separated          
     s/\\PERCENTAGE ?/\\%/g;
     # Convert '\DOLLAR ' back into '\$'                   

Flatten and latexdiff-vc

Hello,

I am trying to use latexdiff-vc to compare changes across multiple files which are included in one main project file. I currently have all of this in a git repository. When I run:

โžœ  MyProjectFolder git:(master) โœ— latexdiff-vc --flatten -r mymailfile.tex
Guess you are using GIT ...
Working on  mymailfile.tex
Checking out old dir into: /var/folders/mh/f311201s7p1dvk5sp293lmh40000gn/T/c3hfjP6NQt/latexdiff-vc- (rev: )
usage: git archive [options] <tree-ish> [<path>...]
   or: git archive --list
   or: git archive --remote <repo> [--exec <cmd>] [options] <tree-ish> [<path>...]
   or: git archive --remote <repo> [--exec <cmd>] --list

    --format <fmt>        archive format
    --prefix <prefix>     prepend prefix to each pathname in the archive
    -o, --output <file>   write the archive to this file
    --worktree-attributes
                          read .gitattributes in working directory
    -v, --verbose         report archived files on stderr
    -0                    store only
    -1                    compress faster
    -9                    compress better

    -l, --list            list supported archive formats

    --remote <repo>       retrieve the archive from remote repository <repo>
    --exec <command>      path to the remote git-upload-archive command

Running latexdiff
Input file /var/folders/mh/f311201s7p1dvk5sp293lmh40000gn/T/c3hfjP6NQt/latexdiff-vc-/mymailfile.tex does not exist. at /usr/texbin/latexdiff line 1008, <DATA> line 24764.
Something went wrong in latexdiff. Deleting mymailfile.tex-diff.tex and abort

I dont understand that strange error message about the file not existing? Notice the strange . between exist and at?

As it says on the docs on CTAN:

The generic usage of this function is : latexdiff-vc --flatten -r rev1
[-r rev2] master.tex where master.tex is the project file containing the
highest level of includes etc.

Support for tabu

Any chance to develop support for the tabu package?
The environments I had problems with were:

  • tabu
  • longtabu

The kind of problems were:

  • diff ran on the to \linewidth portion of the environment declaration, catching the to and trying to show it off
  • diff ran on the column specification portion of the environment declaration, catching the Xes or
    anything else added to them e.g. X[.3], X[l]
  • I ran into a lack of \\ in the headers but I couldn't make it clear to me, so I only include it here if it's easy to spot/makes sense when considering the code

My tabu example:

\begin{tabu} to \linewidth { X X[c] | X | l l r r}

\toprule
H1 & H2 & H3 & H4 & H5 & H6 & H7 \\
\midrule
\endfirsthead

\midrule
H1 & H2 & H3 & H4 & H5 & H6 & H7 \\
\midrule
\endhead

c1 & c2 & c3 & c4 & c5 & c6 & c7 \\
\bottomrule

\end{tabu}

perl-5.22.1 compatibility

When running latexdiff --version (or any other command) I get lots of warnings with perl-5.22.

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\includeonly{ <-- HERE (.*?)}/ at /usr/pkg/bin/latexdiff line 1468.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(^(?:[^%\n]|\\%)*)\\bibliography{ <-- HERE (.*?)}/ at /usr/pkg/bin/latexdiff line 1503.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(^(?:[^%\n]|\\%)*)\\subfile{ <-- HERE (.*?)}/ at /usr/pkg/bin/latexdiff line 1518.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\\{ <-- HERE / at /usr/pkg/bin/latexdiff line 2247.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin{ <-- HERE MATHMODE}((?:(.(?!(?<!\\)\&|\\\\))*)?)\\end{MATHMODE}/ at /usr/pkg/bin/latexdiff line 2572.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin{MATHMODE}((?:(.(?!(?<!\\)\&|\\\\))*)?)\\end{ <-- HERE MATHMODE}/ at /usr/pkg/bin/latexdiff line 2572.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin{ <-- HERE MATHMODE}(.*?)\\end{MATHMODE}/ at /usr/pkg/bin/latexdiff line 2574.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin{MATHMODE}(.*?)\\end{ <-- HERE MATHMODE}/ at /usr/pkg/bin/latexdiff line 2574.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\end{ <-- HERE SQUAREBRACKET}/ at /usr/pkg/bin/latexdiff line 2655.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\begin{ <-- HERE SQUAREBRACKET}/ at /usr/pkg/bin/latexdiff line 2656.

For latexdiff-vc:

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\zref\@newlabel{ <-- HERE DIFchgb(\d*)}{.*\\abspage{(\d*)}}/ at /usr/pkg/bin/latexdiff-vc line 451.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\zref\@newlabel{DIFchgb(\d*)}{ <-- HERE .*\\abspage{(\d*)}}/ at /usr/pkg/bin/latexdiff-vc line 451.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\zref\@newlabel{DIFchgb(\d*)}{.*\\abspage{ <-- HERE (\d*)}}/ at /usr/pkg/bin/latexdiff-vc line 451.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\zref\@newlabel{ <-- HERE DIFchge(\d*)}{.*\\abspage{(\d*)}}/ at /usr/pkg/bin/latexdiff-vc line 454.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\zref\@newlabel{DIFchge(\d*)}{ <-- HERE .*\\abspage{(\d*)}}/ at /usr/pkg/bin/latexdiff-vc line 454.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\\zref\@newlabel{DIFchge(\d*)}{.*\\abspage{ <-- HERE (\d*)}}/ at /usr/pkg/bin/latexdiff-vc line 454.

invisible non-ASCII character error in Windows

Using Windows 7, latexdiff 1.0.4, and MikTex 2.9, I get an error every time I try to compile a latexdiff-created tex file. Everything looks like it should work, but it doesn't compile. Unless I copy and paste the exact same text, or even delete and then ctrl+Z undo the deletion. Then it works.

For example, if I start with old.tex:

\documentclass{article}
\begin{document}
This is the old text.
\end{document}

and new.tex:

    \documentclass{article}
    \begin{document}
    This is the NEW text.
    \end{document}

and then use the command line to run:
latexdiff old.tex new.tex > diff.tex

then diff.tex appears as follows:

\documentclass{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL old.tex   Wed Feb  3 18:08:06 2016
%DIF ADD new.tex   Wed Feb  3 18:08:27 2016
%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

\begin{document}
This is the \DIFdelbegin \DIFdel{old }\DIFdelend \DIFaddbegin \DIFadd{NEW }\DIFaddend text.
\end{document}

Which totally looks like it's fine. But it's not. I get the following when I try and compile via the command line, pdflatex diff.tex, I get:

This is pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9)
entering extended mode (diff.tex 
LaTeX2e <2015/10/01> patch level 1
Babel <3.9m> and hyphenation patterns for 69 languages loaded.

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.1 ย 
     โ– \ d o c u m e n t c l a s s { a r t i c l e }

Or if I compile with TexWorks GUI I get:

This is pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9)
entering extended mode
(C:/Users/garret/Desktop/TexExample/diff.tex
LaTeX2e <2015/10/01> patch level 1
Babel <3.9m> and hyphenation patterns for 69 languages loaded.

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.1 ๏ฟฝ
     ๏ฟฝ\

But then if I copy and re-paste, or delete and CTRL+Z undo, and then compile, everything works as expected. So the black box or question-mark-inside-a-square character disappears. Some sort of ASCII/Unicode error?

alignat* environment issues

latexdiff interacts badly with the alignat* environment. Here is a minimal example:

myfile.tex:

\documentclass[10pt]{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat*}{1}
A &= B
\end{alignat*}

\end{document}

myfile2.tex

\documentclass[10pt]{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat*}{3}
A &= B, && ~\forall x,y
\end{alignat*}

\end{document}

We generate a difference using latexdiff: diff.tex

\documentclass[10pt]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL myfile.tex    Wed May 25 13:46:19 2016
%DIF ADD myfile2.tex   Wed May 25 13:46:58 2016
\usepackage{amsmath}
%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

\begin{document}

\begin{alignat*}{\DIFdelbegin \DIFdel{1}\DIFdelend \DIFaddbegin \DIFadd{3}\DIFaddend }
A &= B\DIFaddbegin \DIFadd{, }&& \DIFadd{~\forall x,y
}\DIFaddend \end{alignat*}

\end{document}

This will not compile. The issue appears to be fixed when you replace the:

\begin{alignat*}{\DIFdelbegin \DIFdel{1}\DIFdelend \DIFaddbegin \DIFadd{3}\DIFaddend }

with simply:

\begin{alignat*}{3 }

I.e. the issue seems to be the modification of the second bracket, which is an argument that represents the number of alignment characters in the environment.

Misplaced alignment tab character &.

The generated differences are:

\DIFdel{The volume $V_i$ of parcel $i$ is defined by the first species:
}\begin{eqnarray*}\DIFdel{
 &
      V_i = \frac{m_i^0}{\rho_i^0},
}\end{eqnarray*}

BTW, the version of latexdiff is:

This is LATEXDIFF 1.0.4  (Algorithm::Diff 1.15 so, Perl v5.20.1)
  (c) 2004-2014 F J Tilmann

Tags/releases

Following up on https://bugs.debian.org/714966 ...

Updating the hompage URL is the easy part, but I'm not sure where we can (automatically) find tarballs of new releases now. An easy solution what be to have releases/tags on github.

What do you think?

Cheers,
gregor, Debian Perl Group

support of git tags

What do you think in adding the possibility to access tags in addition to commit revisions?
I tag a commit when I send a document to revision. After several commits a create a new pdf for revision. Currently, I have to lookup the correct commit with respect to the last tag.

Thanks!

Support for siunitx and cleveref packages / configurable command list for \mbox protection

The commands in some packages (e.g. \si in siunitx package) break when they are underlined with the ulem package commands. Enclosing the offending commands in \mbox'es solves the problem, though (similar to the way \cite commands are treated by latexdiff)
(see http://tex.stackexchange.com/questions/218973/how-to-protect-or-mbox-commands-in-latexdiff)

The ideal solution would:

  • provide a configuration variable (or command list) to define the commands which should be protect with \mbox'es when marked up)
  • set up this configuration variable appropriately for cleveref and siunitx packages when these are detected

(modified from request sent in by S. Pinnow via email)

Add SCfigure to PICTUREENV

When I use latexdiff on documents with SCfigures that have changed slightly, for example in size, they appear twice such that the caption has no space and messes up the formatting.
For figures this does not happen.

To process SCfigures in the same correct way as figures they have to be added to the PICTUREENV.
Therefore I would like to request to make this default.

I also describe this problem and its solution at

https://tex.stackexchange.com/questions/328448/latexdiff-problems-with-scfigure/328449#328449

bibtex: deleted items are listed in bibliography but key is not set up

When items disappear from the bibliography, they are shown crossed out, as they should be. However, no key is set up because \bibitem is commented out, meaning that in-text references to these publications (which should only occur in deleted parts) no longer work.
Probably can be fixed by reinstating corresponding bibitems (if the key does not conflict with a good key from other bibitems)

$ round minipage that includes $ causes confusion

I have a minipage which I must wrap with $..$, to allow a brace. Inside is some math text which I must wrap with $. Latexdiff thinks the first $ matches with the first $ of the internal math, and the second $ of the internal text with the final $. I can't see in the documentation any way to solve the problem.

original.txt is the original; modification.txt has some changes; diff.txt is what latexdiff makes of it.

diff.txt

modification.txt
original.txt

Error on Windows - exit code 255

Hi,
I just started using latexdiff and I tried to run latexdiff -h and latexdiff --version on a normal Windows 10 console and in both cases the output looks fine but then ended

  • for -h with
C:\texlive\2015\bin\win32\runscript.tlu:665: command failed with exit code 255:
perl.exe c:\texlive\2015\texmf-dist\scripts\latexdiff\latexdiff.pl -h
  • for --version with
C:\texlive\2015\bin\win32\runscript.tlu:665: command failed with exit code 255:
perl.exe c:\texlive\2015\texmf-dist\scripts\latexdiff\latexdiff.pl --version

It looks likes its the same output, it just differ for the call to latexdiff.pl, is this output a normal behavior?
As you can tell from the directories I've TeXLive 2015 and --version says I've latexdiff version 1.1.1.

pdf output with Lua(La)TeX

I would suggest to extent the option --pdf to an option in which one can set the latex version to use, lualatex in my case.

To be consequent, we should add an option to set the bibliography, index, and glossary tool. Probably, these are options to set in the preamble file, than in the command line.

description,list,enumerate environment: deleted \item

If the first item is deleted from a list environment then the description environment begins with normal text (as deleted \item commented out), which is not allowed.

Related feature request: it would be nice if the deleted items could be actually shown as such, in particular for description environments

\DIFadd & \DIFdel seem to work within \citep

Hello,

Trying to troubleshoot overly-long \mboxes introduced by latexdiff when handling changes within optional arguments to natbib's \citep[], I've realised that the mboxes seem not to be needed:

\citep[\DIFadd{a}\DIFdel{b}][]{KK07}

works fine.

How to force latexdiff to behave like that? (i.e., I guess there's no such option, but perhaps it's doable with a short patch?).

Thanks for help,
Sylwester

strange effect of commented command

I have some texts which aren't different, but which contain a commented command. With the commented command present, I get strange results (which don't compile). Without it, no problem.

One text in original2.txt, the other in modification2.txt (they are identical) and the result in diff2.txt.

diff2.txt
modification2.txt
original2.txt

Verbatim string hashes are not always unique

Currently the Verbatim strings are hashed based on the length of the string. This does not always resolve to unique hashes. When the hashes are mapped back to strings at the end of the process, sometimes the strings are improperly decoded.

I have a quick fix for this based off the 1.10 version which I attached here.
latexdiff.zip

Line width of latexdiff -h help page too long

The line width of the latexdiff help page exceeds the standard characters length a linux terminal and adds a lot of line space because of line breaks.
It would be nice if it would conform with the standard, since many people like to put consoles next to each other and therefore cannot handle oversized lines well.
For the standard see here:
https://stackoverflow.com/questions/6862968/is-there-a-norm-or-standard-width-for-gnu-linux-unix-terminals
http://rdingwall.com/2008/05/31/is-the-80-character-line-limit-still-relevant/

latexdiff-vc -h looks ok already.

Bug if a new align envoirement starts with &

We added a new align environment to our paper. The output of diff.tex produce an error when latex is running. I figured out that the problem was that in the output:
\begin{align}\DIFadd{
&-(\beta_1-\beta_2) V \approx
-\frac{(V-V_1)^2}{2 \sigma_1^2} + \frac{(V-V_2)^2}{2 \sigma_2^2}
\nonumber}
&\DIFadd{>>-\beta_1 V_1 + S(V_1,N) + \beta_2 V_2 - S(V_2,N)>.
}\end{align}
the first tabulator character & must be outside of the \DIFFadd environment. If one replace:
\begin{align}&\DIFadd{
-(\beta_1-\beta_2) V \approx
-\frac{(V-V_1)^2}{2 \sigma_1^2} + \frac{(V-V_2)^2}{2 \sigma_2^2}
\nonumber}
&\DIFadd{>>-\beta_1 V_1 + S(V_1,N) + \beta_2 V_2 - S(V_2,N)>.
}\end{align}
all is fine.

latex error with spaces and single character argument after \frac in math mode

Spaces seem to be not properly ignored in math mode.

While

\documentclass[]{article}
\begin{document}
$x=\frac {1+2} b $
\end{document}

and

\documentclass[]{article}
\begin{document}
$x=\frac 1 {def}$
\end{document}

are processed by latex properly, their latexdiff shows both wrong. This is probably connected to the
ulem package.

Wrapping the same term into an equation environment:

\documentclass[]{article}
\begin{document}
\begin{equation}
x=\frac {1+2} b
\end{equation}

and

\documentclass[]{article}
\begin{document}
\begin{equation}
x=\frac 1 {def}
\end{equation}
\end{document}

produces with latexdiff:

 ! Undefined control sequence.
l.28 \DIFaddend \MATHBLOCKequation
                                  {
? 

diff results in a lot of overfull boxes

Hai @Developers of latexdiff.

I am currently revising a scientific manuscript for submission to a journal (git-repo).
However, latexdiff result in a lot (and ugly) overfull boxes, see diff.pdf.

Any ideas how to make this better looking? I think allowing more linebreaks would solve many issues...

The original manuscript can be found here: tex, pdf
The revised one here: tex, pdf
The svjour class, .bst and .bib files are in the topfolder as the .tex files (perhabs just clone / download the whole repo for testing).

I am using the follwing command to create the diff:

$latexdiff --version
This is LATEXDIFF 1.0.4  (Algorithm::Diff 1.15 so, Perl v5.18.2)
  (c) 2004-2014 F J Tilmann

$latexdiff --disable-citation-markup --math-markup=3 submission/report/report.tex revision/report/report.tex > revision/diff/diff.tex

The linebreaks are also one of the reasons why I disabled markup for citations. Moreover, how can I mark changes to the title/subtitle?

Thanks for your work on this very helpful piece of software!

! Paragraph ended before \UL@word was complete.

When you create a diff (I'm using Cygwin on Windows 10) I frequently get this error:

Paragraph ended before \UL@word was complete.

This error is produced by such lines as:


\DIFdelbegin \DIFdel{A thorough reading of this section is essential.
(NEW LINE)
}\DIFdelend 

Apologies: How do you do a new line in GitHub?

Removing the newlines between the end of the bracketted text and the "}" resolved the problem

\DIFdelbegin \DIFdel{A thorough reading of this section is essential.}\DIFdelend

But this error can occurs dozens of times in the same document!

A new markup option: pdflatex + pdfcomment

I managed to get a version of the diff that marks the changes utilizing the pdfcomment package. It is actually quite useful, since the compiled diff should be rendered exactly the same as the current version of the document.

Here's what's needed (I'm no LaTeX hacker, so maybe there are some protects or other stuff to be added):

\usepackage[author={anonymous}]{pdfcomment}
\providecommand{\DIFaddtex}[1]{\pdfmarkupcomment[markup=Underline]{#1}\space{}}
\providecommand{\DIFdeltex}[1]{ \pdfcomment[icon=Insert]{#1}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.