Track changes in LaTeX

For my academic research, I usually prefer to write down a manuscript using LaTeX instead of MS Word, for obvious reasons; the latter is far away from being math friendly! Now, when you submit your work for peer-review, if you are lucky enough to get past the editor and get a second chance from the reviewers to revise your manuscript, you typically have to provide (along with the revised text) a document where changes from the previous version should be visible. For those of us who have done some collaborative work using MS Word, tracking changes in a .docx is a pretty straightforward and easy task which is only a few clicks away. However, tracking changes in a .tex document is… guess what? Not that easy! So, how can we produce a .pdf document written in LaTeX that can show the changes we have made with respect to the previous version, like the paragraph below?

In this post, I will quickly show how this can be achieved. First things first, here I assume that a LaTeX distribution is installed in our machine already. If not, I personally use MiKTeX which can be downloaded for free here: Once MiKTeX is installed, we need to install the latexdiff package; this is the core package that will allow us to produce the document with the changes tracked! So, once we open the MiKTeX Console, we need to navigate to the “Packages” tab and install latexdiff as shown below:

Here comes now the tricky part. What we need to do next is install Perl! I suggest installing Strawberry Perl: Once Perl is installed, we should navigate to the installation folder of MiKTeX. Then, we should be able to locate into /scripts/latexdiff. Inside this folder, we need to create a new folder called “perl”, and then whatever files are inside \latexdiff we should copy them inside \perl changing also their extension to .pl, i.e., making them Perl executables. The last thing we need to do is to add the “perl” folder we have created as a Windows PATH variable! Once we have done so, we are now ready to get the document we want. For example, if we have both our .tex documents (“old.tex” and “new.tex”) in the Desktop folder, we can open the Command Prompt and type the following to get the desired document called “track_document.tex”…