I installed latexdiff to track changes. The first question is where to give the command (latexdiff old.tex new.tex > diff.tex). I saw on the internet that it can be done in the Command/DOS environment. But then I get the error that the file new.tex cannot be found in the directory. I have checked where the other packages are located which is downloaded and which are working. And I have downloaded Perl. What am I doing wrong?
[Tex/LaTex] latexdiff is not working
latexdiff
Related Solutions
I had no issues with this on first attempt and this is what I did. I use MiKTeX on Windows 8.
I used MiKTeX Package Manager (admin) to install
latexdiff
.I downloaded and installed Strawberry Perl.
I searched for "cmd" on start menu/window search and saw
perl(command line)
I opened perl(command line)
and changed directory to the directory where my oldfile.tex
and newfile.tex
was (both in same folder).
Then I executed latexdiff oldfile.tex newfile.tex > diff.tex
on the shell prompt.
It generated a diff.tex
file in the same folder which I compiled using MiKTeX to get the diff.pdf
file.
As an alternative to running latexdiff locally and copying the file back to Overleaf you can run latexdiff at overleaf.
Here is a project with two versions of a tex file and a displayed diff
It is currently live on Overleaf but this link may not be good forever, but I show the files inline below.
https://www.overleaf.com/read/xhszmytdmqqg
main.tex
(the old version)
\documentclass{article}
\title{ld}
\author{me}
\date{July 2021}
\begin{document}
\maketitle
\section{Introduction}
zzz
\end{document}
main2.tex
(new version)
\documentclass{article}
\title{latexdiff}
\author{me\and you}
\date{July 2021}
\begin{document}
\maketitle
\section{Introduction}
zzz zzz
\section{Section}
zzz
\end{document}
latexmkrc
(to instruct overleaf to show the diff)
$pdflatex = "latexdiff main.tex main2.tex > main-d.tex; pdflatex %O main-d"
When you want to see the "normal" typeset version of main.tex
without the diff marking, just add a #
comment marker to the latexmkrc
setting so it looks like
# $pdflatex = "latexdiff main.tex main2.tex > main-d.tex; pdflatex %O main-d"
then recompiling main.tex
or main2.tex
will produce the normal typeset output.
Best Answer
You seem to miss the
new.tex
file in your current directory. You can easily check whether it's present by runningdir
at the command line, and see whether the file appears in the output. You can always specify the full path to it, if necessary.latexdiff
is installed correctly and on your path (Perl as well), otherwise it would complain either about unknown command, or missing Perl interpreter.A somewhat tangential note: Version control is almost mandatory if you're serious about using LaTeX for your writings.
Related questions: