Closed MilesCranmer closed 2 years ago
Also, it might be better to render both the PDF, as well as the diff'd PDF. Sometimes the diff may have weird behavior, so it would be good to have the normal render just in case.
Also, it might be better to render both the PDF, as well as the diff'd PDF. Sometimes the diff may have weird behavior, so it would be good to have the normal render just in case.
Yes, good idea. In that case, make a temporary copy of the main PDF before running showyourwork build
. Then rename the new one to diff.pdf
and restore the original PDF. Note that the PDF is usually called ms.pdf
but can be changed by the user. You can get the actual file name from the config file by doing this.
Actually the tex file name is also configurable. You'll want to change src/tex/ms.tex
to src/tex/${config['ms_name']}.tex
.
Thanks, added! I also use latexpand
now, which will deal with multi-file latex documents. Let me know what you think.
It would also be nice to edit the comment posted by the bot to include a link to the diff: https://github.com/showyourwork/showyourwork-action/blob/main/process-pull-request/action.yml#L111
Edited the comment to include the diff.pdf URL!
Any idea how to actually test this? I guess one could create an example repo, and specify my branch in an action?
Any idea how to actually test this? I guess one could create an example repo, and specify my branch in an action?
Yes! That's what I would do.
Also, can you add some lines to the README listing the new action variables?
Thanks. I did a test here: https://github.com/MilesCranmer/showyourwork-test/runs/7310346935?check_suite_focus=true but it doesn't seem to correctly run the code to compile diff.pdf
. The bot correctly comments the link here: https://github.com/MilesCranmer/showyourwork-test/pull/1#issuecomment-1182507688, but it's not actually generated. Any idea from glancing at the logs why that piece of code doesn't run?
You had to change the action here as well. I'll run it again and see if it works.
Making several little tweaks still. I think I'm close to getting it to work.
OK, this is now in your hands @MilesCranmer as perl has only ever caused me pain: https://github.com/MilesCranmer/showyourwork-test/runs/7322402202?check_suite_focus=true#step:3:169
Thanks! Seems like I got perl to work. Except, now, it is still not generating the diff. I wonder if it is something to do with caching? https://github.com/MilesCranmer/showyourwork-test/pull/7
Ah, wait, it's still a perl problem... I'll keep trying.
Working: https://github.com/MilesCranmer/showyourwork-test/pull/9
I hope the last few days of Perl-induced pain has resulted in a useful feature for people 😅
By the way: latexdiff
seems to have required some LaTeX packages despite being a standalone script, so I installed texlive-base
which is the core latex packages. This package is only ~60 MB so it seems okay to have. What do you think?
Awesome, thanks for the great contribution! The diff generation seems to have added about 2 min of overhead, which isn't terrible. But it might be worth caching the texlive-base install like we currently do with conda. But I think you've done enough already! Happy to merge this and punt on the caching. But one last thing: can you add a couple sections to the Inputs section of the README with the new config settings (build-diff-on-pull-request
, latexdiff-url
, and latexpand-url
)?
Described them on the README!
I don't know how to set up the caching of texlive, but that definitely sounds like a good idea for the future.
Awesome, thank you! I'll update the v1
tag momentarily to this commit.
Awesome, sounds good! Thanks!
Ok, latexdiff
now active on showyourwork-action@v1
.
This adds
latexdiff
functionality topublish.js
. It introduces two new parameters:build-diff-on-pull-request
andlatexdiff-url
that configure whether or not to build the diff, and whatlatexdiff
URL to download, respectively. This addresses https://github.com/showyourwork/showyourwork/issues/123.Right now there are a couple potential issues: the diff will only be generated with respect to the contents of
ms.tex
. If there are additional files, those will not be diffed. This could be fixed by usinglatexpand
to flatten the files before diffing. However, I think this will work as a start.I'm not sure how to actually test this @rodluger - could you have a look?