TEXDIFF(1)

πŸ¦‹ TEXDIFF β€” the perl script that diffs your (La)TeX docs like a track-changes glow-up πŸ’…

okay bestie, so this is texdiff, one of those User Contributed Perl Documentation gems. It compares two (La)TeX documents and spits out a merged version that shows the changes, kinda like 'Change Tracking' in some word processors. iconic behavior, honestly.


✨ SYNOPSIS ✨

texdiff [--nofloatsβŽͺ-n] old.tex new.tex [diff.tex]

🌸 DESCRIPTION 🌸

So here's the tea: the first two files get compared and a brand new TeX file comes out the other side. When you then process that output file with (La)TeX, it marks the new changes in blue and the old text in red with a strike-through line. And that's not even all β€” passages with changes get marked at the margin with grey bars, courtesy of the LaTeX changebar package. BUT (and this is the catch, bestie) that only works after running dvips β€” in xdvi the bars sit one inch too far left, because they're compensating for the one inch offset inserted by TeX printer drivers. it's giving "quirky", lowkey.

texdiff uses β€” and therefore requires β€” the wdiff command to insert those marks. And listen: if LaTeX macros are included in those striked out or underlined passages, the latex run will most likely fail. πŸ’€ The source of most problems lies in wdiff tearing apart pairs of braces. So texdiff is a perl script that calls wdiff internally and fixes wdiff's output by re-pairing braces again and handling some commonly used LaTeX macros. not all heroes wear capes fr fr.

For texdiff to work, the following LaTeX code must be inserted in the preamble of the LaTeX document:

\usepackage{xcolor} \usepackage{ulem} \usepackage{changebar}
\newcommand\TLSins[1]{\cbstart{}\textcolor{ins}{\uline{#1}}\cbend{}}
\newcommand\TLSdel[1]{\cbdelete{}\textcolor{del}{\sout{#1}}}

Define editing colors ins and del with existing xcolor color names:

\colorlet{ins}{blue} \colorlet{del}{red}

Or from scratch:

\definecolor{ins}{rgb}{0, 0.5, 0}
These macros are NOT automatically interted at \begin{document} like the original scripts did (peep the ACKNOWLEDGMENTS section below), because this will not work on files of a multi-file document (those included by \include or \input). Furthermore, if you insert the macros manually, you can tune them as you like β€” i. e. change text color or position of changebars. Have a look at the documentation of the ulem and changebar packages on how to do this!

πŸŽ€ OPTIONS πŸŽ€

  • --nofloats, -n β€” If given, skips contents of figure environments, but does show insertions and deletions in the caption commands. This is done to avoid complex messups in subfloat or complex figure environments. protective queen behavior tbh.
  • --debug, -d β€” Turns on debugging. Temporary files that contain numbered braces are kept and a raw difference file is written as output file name appended with -wdiff.tex. In addition, several regular expression diagnostics are printed. Warning: produces a lot of output. like, a LOT. buckle up. 😭

πŸ‘‘ AUTHOR πŸ‘‘

Mark Doll <markdoll<AT>gmx.net>, Cengiz Gunay <cengique<AT>users.sf.net>.


🫢 ACKNOWLEDGMENTS 🫢

  • Version 0.4, by CG, 2009/09/15. Added use of GetOpt to take an optional parameter to skip float (e.g., figure or table) contents. Added an optional debug mode. Embedded POD documentation. Fixed problem with insertion and deletions appearing in the middle of sectioning commands by throwing off LaTeX.
  • Version 0.3, modified by Cengiz Gunay <cengique@users.sf.net>, 2009/06/30. Added some Latex commands that should be excluded and fixed handling of '%' characters.
  • Version 0.2, is a perl implementation of TeXdiff by Mark Doll <markdoll@gmx.net>, 2006/08/09. It was derived from the original bash and perl scripts created by Robert Maron <robmar@mimuw.edu.pl>, available at http://www.robmar.net/TexDiff/. This version of texdiff is available at http://mark.doll.name/texdiff/.

Copyleft 2006-2009, Mark Doll and Cengiz Gunay

This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole vibe, bestie ✨ this lil page was brought to you by perl v5.8.8 and it's dated 2009-09-24 β€” shoutout to the TEXDIFF(1) era, we love a vintage queen πŸ’–πŸ‘‘