[texhax] latexdiff question

Schwartz, Steven J s.schwartz at imperial.ac.uk
Sun Apr 6 08:09:53 CEST 2014


Kathryn Gucer wrote on 2014-04-05:
> Dear TUG members,
> > Here's the problem that I'm encountering. I am working on a complex 
> .tex file (Draft1.tex)  that pulls the parts a book (e.g., table of 
> contents, chapters,
> bibliography) together and integrates them into a .pdf of the entire 
> book when I compile it in MikTeK 2.9.  These parts (e.g., chap1.tex, 
> chap2.tex, and so on)  are .tex files that are external to Draft1.tex 
> and they cannot be compiled individually.
> When I use latexdiff to generate a comparison between Draft1.tex 
> (author's original) and Draft2.tex (draft with my changes), the 
> resulting .pdf does not show or track any changes to the text in the 
> external file: it only shows the author's full original 307-page 
> document. Since the bulk of the author's work is in these external 
> files, I will need to find a way to show changes in them.
> Is it possible that latexdiff cannot work on complex master files? Can 
> anyone here offer some insight?

I think the --flatten option to latexdiff (described in the latexdiff documentation) should help you. It is supposed to replace \input and \include statements in your master by the external files (with some limitations) so that the markup is applied to the full text of the master + input'ed or included files.  I've not actually used this but it sounds like it should work.

Googling or searching CTAN also reveals a standalone program "flatten" which will generate a single source file from a master + inputs and includes. Running this on the old and new versions will then give you a single latex source for each version which latexdiff should then be able to markup.

Steven J Schwartz                  Phone:  +44 (0)207 594 7660
Professor of Space Physics         Fax:    +44 (0)207 594 7772
Director, Imperial Space Lab       www.imperial.ac.uk/spacelab
The Blackett Laboratory            Email:  s.schwartz at imperial.ac.uk
Imperial College London            Office: Huxley 6M67A
London SW7 2AZ, UK                 Web:    www.sp.ph.ic.ac.uk/~sjs

More information about the texhax mailing list