[Tex/LaTex] Install and use latexdiff without MikTex

latexdiffmiktexoverleaf

I use overleaf on Windows for my research papers and thesis and it works fine. However, I received reviews from a journal, and they require me to track changes in my old and final manuscript. Inspire by this answer, I decided to use latexdiff but it isn't working.
I installed Perl v5.28.1 (I think it installed correctly because Perl -v returns the version), and downloaded latexdiff from here. I extracted and copied the files to C:\Perl64\bin as described here.
Now, if I attempt to run the command in CMD, I get the following error:

'latexdiff' is not recognized as an internal or external command,
operable program or batch file.

I have two questions.

  1. Why am I getting this error?

  2. The tutorials I found on YouTube all work with MikTex, but I want to stick to overleaf. How do you
    use latexdiff without having to install latex in your system?

Best Answer

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

enter image description here

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.