So Chigusa
So Chigusa
So Chigusa

latexdiff for your convenience

Latest update: 2024-02-24

Tips on how to use latexdiff

logo

Latest update: 2024-02-24

Tips on how to use latexdiff

Logo by The LaTeX Project

Template

latexdiff-vc -e utf8 --exclude-textcmd="section,subsection,subsubsection" --git --flatten --force -d diff -r (commit / HEAD) (filename)

Furthermore, since the LaTeX source file generated by this command is placed in a different location from the original source file, it is necessary to specify the paths for figures and style files. For figures, you can specify the path with the following command, with you desired path, as:

\graphicspath{{../}}

The style file should be installed beforehand. The installation procedure for a .sty file involves:

kpsewhich -var-value TEXMF

to determine the designated location (in this case, I chose /usr/local/texlive/2023/texmf-dist). After determining the location, create a folder for placing the style file, copy the style file into it, and update the list. For example, the procedure for placing jhephub.sty would be:

cd /usr/local/texlive/2023/texmf-dist/tex/latex
sudo mkdir jhephub
sudo cp **/jhephub.sty jhephub/
sudo mktexlsr

The installation procedure for a .bst file goes similarly as

kpsewhich -var-value BSTINPUTS
cd /usr/local/texlive/2023/texmf-dist/bibtex/bst
sudo mkdir jhep
sudo cp **/jhep.bst jhep/
sudo mktexlsr

How to work with git

latexdiff-vc -e utf8 --git --flatten --force -d diff -r (commit / HEAD) (filename)

How to avoid typeset errors associated with changes in the section titles

With the option --exclude-textcmd="section,subsection,subsubsection", latexdiff ignores changes or additions to sections.

How to avoid errors when modifying complicated equations

The option --math-markup=whole highlights the entire equation with changes. However, if errors still cannot be avoided and it's acceptable to forego highlighting changes in equations, you can use --math-markup=off.

A case study of typesetting errors

Argument of \trigbraces has an extra }

Many errors have occurred in lines containing \DIFdel{} and \DIFadd{} sections. The exact reason is unclear, but the errors may originate from a description like below:

\sin(m_a t + \varphi)

Instead, by removing unnecessary spaces, with a description like

\sin(m_at+\varphi)

typesetting started to succeed.

Option clash for package ulem

If the original manuscript uses the ulem package, the error may occur due to a conflict between the options added by latexdiff to ulem. A quick solution is to comment out the \usepackage{ulem} line originating from the original manuscript.

Share this post: