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
529 stars 75 forks source link

latexdiff opens the second argument twice #110

Open Debilski opened 7 years ago

Debilski commented 7 years ago

It would be cool to be able to use latexdiff in a script with process substitution (for example, coming from pandoc).

Given I have already a file olddoc.latex (which was generated from some markdown which I don’t have anymore), I would like to be able to use process substition like so:

latexdiff olddoc.latex <( pandoc -t latex newdoc.markdown )

Unfortunately, latexdiff reads the file in the second argument twice (to check its encoding), so that the second time it is read it will be empty. As a workaround, I could be using --encoding to avoid the first read, but since we just spent several hours trying to find a bug in our script (even more confusing since substituting in the first argument worked very well) we think it may be a helpful addition to latexdiff for other people as well. :)

ftilmann commented 7 years ago

I am sorry that you wasted so much time on finding the bug. Fixing this would essentially entail copying both input files old.tex and new.tex into a temporary file, which would also be a way to address #11 . I might eventually implement this, but it adds more dependencies, and there are certainly higher priority issues out there, in my opinion, because you could just make the temporary files in the calling script, something like pandoc -t latex newdoc.markdown > /tmp/newdoc$$.tex

However, I mention the need to provide real files in the documentation now to hopefully prevent others from repeating your bug hunt. (commit 61ee64f ). (I leave the issue open, though)