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
506 stars 72 forks source link

Add option for LUAUNDERLINE #299

Closed briochemc closed 3 days ago

briochemc commented 3 months ago

I tried my best giving a shot at a PR that adds a LUAUNDERLINE option for latexdiff to use the lua-ul package (essentially what was suggested in #255 by @michaelmhoffman), which avoids the need for mboxes required by the ulem package. LuaLaTeX is then required to compile the differences.

Checking for ulem was already baked in latexdiff so I didn't add anything for that.

I ran the tests mostly successfully, my use case being mostly for allowing line breaks in citations. See comparison below (taken from the apacite test):

UNDERLINE (citations leak in the margin) LUAUNDERLINE (nice line breaks!)
Screenshot 2024-03-20 at 2 07 13 pm Screenshot 2024-03-20 at 2 07 08 pm

Potentially fixes #17, #60, #188, #255, #270, #277, and more?

I hope this helps! Let me know what else is needed!

PS: For tests I had to make some changes to some usepackage and my editor automatically removes trailing white spaces so sorry about that noise...

briochemc commented 3 months ago

@ftilmann could you let me know if I need to change anything?

ftilmann commented 3 months ago

Thanks a lot for your PR. I am sorry; I usually cannot be very quick in responding due to other demands on my time. I had a quick look in github. For "verify" I would like to keep pdflatex as the default for --run option. Would it be possible to adapt that so that processing with luatex becomes another option, e.g. --luarun [don't worry, I could also take care of that]. For latexdiff it was difficult to understand what the changes were with all the final space changes. Not a problem but I need to go through command line to choose diff options that ignore that change. I hope to be able to manage tomorrow, but might be next weekend, or in worst case in two weeks. Sorry for that.

briochemc commented 3 months ago

Thanks for your feedback and no worries! I'm sorry BTW, I didn't mean to push you, I completely understand that this amazing work of yours is done on your free time. I merely wanted to know how I could help more.

I will try to give a go at implementing these when I get the time myself :)

ftilmann commented 3 months ago

OK, I had quick look. Great to see that it works out of the box by providing simply a new style option. This make is easy to accept in principle though I could not actually verify that the compilations because my texlive installation on Ubuntu 20 is too old to include lua-ul (I know I could have installed by hand but as you made these tests already I did not really see the need).

Some minor issues:

briochemc commented 2 months ago

For latexdiff it was difficult to understand what the changes were with all the final space changes.

I agree, and sorry about that. But there is a quick workaround if you are looking at it here on GitHub, just add ?w-1 at the end of the URL of the PR, like so: https://github.com/ftilmann/latexdiff/pull/299/files?w=1 (and the trailing spaces are not displayed in the diff).


EDIT: Alternatively, you can click there:

Screenshot 2024-05-02 at 9 39 31 PM
briochemc commented 2 months ago

Sorry for the delay, I was on holiday! Anyway, in the latest commit I have addressed your 3 points:

I hope this helps! (Again, best to view the changes without trailing space noise with https://github.com/ftilmann/latexdiff/pull/299/files?w=1)

briochemc commented 2 months ago

What version of aguplus do you have exactly?

Sorry I forgot this one... And truth is, I'm not exactly sure... I used TexLive and downloaded all the packages, and then updated some of the latexdiff test examples to use whatever AGU package worked. But having worked with AGU myself, I know that the latest AGU class file is called agujournal2019.cls (despite being last updated in 2021 as far as I can tell) and can be downloaded on the AGU website. I believe you could safely just use this latest version and no user should complain given that the AGU journals should require the latest version when submitting.

briochemc commented 3 weeks ago

Gentle ping @ftilmann in case you can spare some time to look into merging this :)

ftilmann commented 3 days ago

Very sorry about the delay - I merged without any further modifications. Thanks a lot for contributing this PR

briochemc commented 3 days ago

No worries! Glad I could contribute something useful!