I have two TeX files that I need to compare, and I thought texdiff could do this for me. Unfortunately, in the manual page, it reads
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}}}
Now, I'm a bit lost as I have never actually used plain TeX and using LaTeX code inside a TeX file is obviously not going to work.
Example:
Let's consider a very simple plain TeX example. If you use a file with the following content:
Let $D$ be a subset of $\bf R$ and let $f \colon D \to
{\bf R}$ be a real-valued function on $D$. The function $f$ is said to be
{\it continuous} on $D$ if, for all $\epsilon > 0$ and for all $x \in D$,
there exists some $\delta > 0$ (which may depend on $x$) such that if $y
\in D$ satisfies $$|y - x| < \delta$$ then $$|f(y) - f(x)| < \epsilon.$$
\bye
With pdftex file.tex
this can easily be converted to
Now, if you make a change in the file and store it under a different name, you can run
texdiff file1.tex file2.tex diff.tex
you will have the following content inside diff.tex
Let $D$ be a subset of $\bf R$ and let $f \colon D \to
{\bf R}$ be a real-valued function on $D$. The function $f$ is said to be
{\it continuous} on $D$ if, for all $\epsilon > 0$ and for all $x \in D$,
there exists some $\delta > 0$ \protect\TLSins{(which may depend on $x$)} such that if $y
\in D$ satisfies $$|y - x| < \delta$$ then $$|f(y) - f(x)| < \protect\TLSdel{\epsilon$$ should hold.}
\protect\TLSins{\epsilon.$$}
\bye
The commands \TLSins
and TLSdel
don't exist in plain TeX,
and I cannot only put \usepackage
and \newcommand
inside this file. This would not work.
Question: How must the header look like to define the required commands correctly in plain TeX?
Best Answer
The changebar and ulem packages do not seem to have plain TeX equivalents but for colour you can just
\input color
. With some care (using\ifmmode...\fi
etc), you could get by using{\em ...}
and\underline{...}
in place of ulem (changebar would be harder).The simplest way to get texdiff to work is to add the following code to the top of your diff file:
This does not add emphasis or underlining for the differences, and there are no change-bars, but it does it does show where the changes are:
Of course, this will be subject to the usual vagaries of (la)texdiff.