0

Problem

I am encountering a problem which has already been raised in this site:

Namely when I try to run latexdiff old.tex new.tex > diff.tex I am getting the following exception:

Can't locate Algorithm/Diff.pm in @INC (you may need to install the Algorithm::Diff module) (@INC entries checked: 
  C:/Users/<user_name>/AppData/Local/Programs/MiKTeX/scripts/latexdiff/ 
  /usr/lib/perl5/site_perl 
  /usr/share/perl5/site_perl 
  /usr/lib/perl5/vendor_perl 
  /usr/share/perl5/vendor_perl 
  /usr/lib/perl5/core_perl 
  /usr/share/perl5/core_perl
) at C:/Users/<user_name>/AppData/Local/Programs/MiKTeX/scripts/latexdiff/latexdiff line 256.
BEGIN failed--compilation aborted at C:/Users/<user_name>/AppData/Local/Programs/MiKTeX/scripts/latexdiff/latexdiff line 256.

How can I fix this issue? Should I retry some of the below actions, but by modifying paths, etc.?

Solutions tried

No answers have been provided to the 2nd question. Re the first one, unfortunately the most upvoted answer does not work for me: when I try to run perl -MCPAN -e "install Algorithm::Diff" in bash, I am getting the following error:

Can't locate CPAN/Author.pm in @INC (you may need to install the CPAN::Author module) (@INC entries checked: 
  /usr/lib/perl5/site_perl 
  /usr/share/perl5/site_perl 
  /usr/lib/perl5/vendor_perl 
  /usr/share/perl5/vendor_perl 
  /usr/lib/perl5/core_perl 
  /usr/share/perl5/core_perl
) at /usr/share/perl5/core_perl/CPAN.pm line 19.
BEGIN failed--compilation aborted at /usr/share/perl5/core_perl/CPAN.pm line 19.
Compilation failed in require.
BEGIN failed--compilation aborted.

The second answer also does not work either as pacman is not recognized.

I have tried this answer which suggests adding environment variables PERL5LIB and PERLLIB but with no success. I have also found this other question but the indications given in the answers do not seem applicable to my case, or have not worked.

Additional information

When I run where perl in bash, I see the used installation comes from Git:

$ where perl 
C:\Program Files\Git\usr\bin\perl.exe

I actually see the following structure in the Git installation:

Git\usr
|
|__bin\
|  |__core_perl\
|  |__vendor_perl\
|  |  ...
|  |__perl.exe
|
|__lib\
|  |__perl5\
|     |__core_perl\
|     |__vendor_perl\
|
|__share\
   |__perl5\
      |__core_perl\
      |__vendor_perl\
4
  • well pacman is the package manager for Arch, so I would not expect it to work on Windows. where is not a standard bash command. I don't know enough about Windows to infer from the output your setup. is this wsl or wsl2? or cygwin? have you tried installing the missing module? Commented Dec 6 at 19:11
  • @cfr how do I know about wsl, wsl2 or cygwin? Commented Dec 7 at 13:03
  • 1
    The latexdiff package also comes with two variants that bypass the need to install Algorithm::Diff. latexdiff-so simply has an older version of Algorithm::Diff inlined, and latexdiff-fast uses the command line diff utility. Now I don't know whether your installation has the included, and whether a "diff" command exists that could be called by latexdiff-fast and provides output in the same format as diff on linux). So I would first try if it works with latexdiff-so instead of latexdiff Commented Dec 7 at 13:11
  • @frederik much appreciated, latexdiff-so works so this is enough for my purpose. Commented Dec 7 at 14:16

1 Answer 1

1

As suggested by @frederik, I circumvented this issue by using latexdiff-so instead. This variant is described in latexdiff documentation and there does not seem to be any meaningful differences in functionality:

8 PORTABILITY

latexdiff does not make use of external commands and thus should run on any platform supporting Perl 5.6 or higher. If files with encodings other than ASCII or UTF-8 are processed, Perl 5.8 or higher is required.

The standard version of latexdiff requires installation of the Perl package Algorithm::Diff (available from www.cpan.org - http://search.cpan.org/~nedkonz/Algorithm-Diff1.15) but a stand-alone version, latexdiff-so, which has this package inlined, is available, too.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.