ftilmann / latexdiff

Compares two latex files and marks up significant differences between them. Releases on www.ctan.org and mirrors
GNU General Public License v3.0
505 stars 72 forks source link

Latexrevise removes lines with %DIFAUXCMD #302

Open Ivo-Maffei opened 1 month ago

Ivo-Maffei commented 1 month ago

Using latexrevise 1.3.2 and latexdiff 1.3.3 gives some weird behaviours in the presence of \cite{} commands. I believe latexrevise simply removes all rows where %DIFAUXCMD appears.

Very minimal example: test-old.tex aaa ccc

test-new.tex aaa \cite{ddd} ccc

latexdiff test-old.tex test-new.tex > test-diff.tex produces test-diff.tex

aaa \DIFaddbegin \DIFadd{\mbox{%DIFAUXCMD
\cite{ddd} }\hskip0pt%DIFAUXCMD
}\DIFaddend ccc

latexrevise -a test-diff.tex outputs only ccc as if the rows with %DIFAUXCMD were simply deleted. Manually changing the diff file by adding a new line after aaa makes latexrevise output

aaa
ccc

P.S: adding a preamble to the tex files so that they compile doesn't change the behaviour.

ftilmann commented 1 month ago

Thank you for your comment. Deleting lines marked with %DIFAUXCMD is generally described behaviour but in this situation obviously doesn't do the right thing, as unlike the original design principles the %DIFAUXCMD is on the same line as a valid command to be retained. I had become a bit sloppy with regard to this as I had the impression that hardly anyone is using latexrevise (myself included). I will eventually have a look if there is a quick fix to your specific scenario, and will keep the issue open for that purpose. As I cannot give a time scale for this, as an (unsatisfactory) workaround, you can use the --disable-citation-markup option, which should solve this problem, but means that citation commands are simply not marked up. That may be acceptable when preparing a file for processing with latexrevise. Or choose another markup style without need for the ulem package (e.g CFONT if memory serves correctly) If others meet the same or related issues, please let me know so I know there is interest in latexrevise.

TaihuLight commented 1 month ago

@ftilmann As described in https://www.overleaf.com/learn/latex/Articles/How_to_use_latexdiff_on_Overleaf#Tom_Hejda, the deleted text is kept in the sections of title and authors when I use $pdflatex = "latexdiff --no-del --type=CFONT main.tex main2.tex > main-d.tex; pdflatex %O main-d", adding the option --no-del --type=CFONT into the method of David Carlisle’s solution. I want to use the option --no-del to remove all deleted text in a manuscript, including detected text in the sections of title and authors (the result should be similar to BOLD), rather than only removing deleted text in the manuscript body. How do we fix this issue? or is this a bug of the option --no-del --type=CFONT? @Ivo-Maffei