# [texhax] best way to revise a large existing text

Frederik Tilmann fjt21 at cam.ac.uk
Tue Oct 27 18:42:08 CET 2009

Dear Wes,

I can't reproduce the error:  see the following transcript.

> ~/tmp 56> latexdiff pap7.tex pap7.tex > pap7-diff.tex
>
> WARNING: Inconsistency in length of input string and parsed string:
>      This often indicates faulty or non-standard latex code.
>      In many cases you can ignore this and the following warning messages.
>  Note that character numbers in the following are counted beginning after \begin{document} and are only approximate.DEBUG Original length 109535  Parsed length 109533
>
>  in terms of $Q$ the \taumodel\ provides a good description, much bette
>                               ^^^^^^^^^^^
> Missing characters near word 7149 character index: 101911-101922 Length: 9 Match: |provides | (expected match marked above).
>
> WARNING: Inconsistency in length of input string and parsed string:
>      This often indicates faulty or non-standard latex code.
>      In many cases you can ignore this and the following warning messages.
>  Note that character numbers in the following are counted beginning after \begin{document} and are only approximate.DEBUG Original length 109535  Parsed length 109533
>
>  in terms of $Q$ the \taumodel\ provides a good description, much bette
>                               ^^^^^^^^^^^
> Missing characters near word 7149 character index: 101911-101922 Length: 9 Match: |provides | (expected match marked above).
> ~/tmp 57> latexdiff --version
> This is LATEXDIFF 0.5  (Algorithm::Diff 1.15 so)
>   (c) 2004-2007 F J Tilmann
> ~/tmp 58> perl --version
>
> This is perl, v5.10.0 built for i386-linux-thread-multi
>
>
> Perl may be copied only under the terms of either the Artistic License or the
> GNU General Public License, which may be found in the Perl 5 source kit.
>
> Complete documentation for Perl, including FAQ lists, should be found on
> this system using "man perl" or "perldoc perl".  If you have access to the
>

pap7-diff.tex seems to contain reasonable output.  Only change to
pap7.tex is that some newlines get removed. (particularly before
comments, or where there are multiple newlines)

It is not the perl version either; I ran the same sequence on another
machine, which has perlv5.8.0, and get the same output as above.  Also
get the same result with latexdiff-so 0.5, and latexdiff-fast 0.42.

Your other reported bug (ignores "\ " is a real shortcoming leading to
the warnings and  I will try to address this in the next version).

Frederik

On 27/10/09 16:20, W.J. Metzger wrote:
> On Mon, 26 Oct 2009, Frederik Tilmann wrote:
>
>> Dear Wes
>>
>> I have never had any reports of segfaults, and I know some people have
>> used
>> it on their PhD thesis, so length should not really be an issue. It
>> should
>> really bail with a Perl error if there was anything wrong with the
>> latexdiff
>> code.
>> What's your system and perl version? Did you try latexdiff-fast, which
>> might
>> be more robust if there is a memory problem with perl?
>>
>> Frederik
>
> Dear Frederik,
>
> I run on Scientific Linux 5.3, which is a clone of Red Hat Enterprise 5.
> The perl version is v5.8.8 built for i386-linux-thread-multi
> latexdiff latexdiff-fast and latexdiff-so all gave the segmentation fault.
>
> I tried doing it also on another machine with a slightly older version of
> perl v5.8.5, but with twice the memory. It also gave the segmentation
> fault.
>
> I've played around with the tex file and found that the segmentation fault
> could be avoided by adding a comment line -- line 635 of the attached file.
> If that line is removed, I get the segmentation fault.
>
> The segmentation fault occurs very quickly, almost immediately. So I think
> that latexdiff has not started looking for the differences yet.
>
> I thought that the problem might be misinterpreting a { that was in a
> comment, since adding a comment with a } got rid of the segmentation fault.
> I attempted to isolate the problem in a small test file, containing only
> the \begin{figure} - \end{figure} in which line 635 occurs. But I did not
> get a segmentation fault with or without line 635.
> So the problem is more complicated than just the { in a comment.
>
>
> Another problem, but only a slightly annoying one, is an apparent
> misparsing of a line ending in a \
> e.g.
> use \ell\
> rather than l to avoid confusion with 1
> Apparently the blank after \ell\ is not seen and results in warning
> messages.
>
> Further, differences in equations sometimes lead to incorrect mathmode in
> the difference file resulting in latex needing to insert a \$.
>
> All in all, latexdiff seems to work well for text, but has some problems
> when things get complicated.
>
>
>> W.J. Metzger wrote:
>>> On Fri, 23 Oct 2009, martin f. krafft wrote:
>>>
>>>> also sprach Boris Veytsman <borisv at lk.net> [2009.09.22.1700 +0200]:
>>>>> Try latexdiff, http://www.ctan.org/tex-archive/support/latexdiff/
>>>>
>>>> That was a marvelous suggestion. Thanks.
>>>
>>> It sounded good to me too. So I downloaded it and tried it -- works fine
>>> on small tex files, but when I tried it on 'real' files it results in a
>>> segmentation fault. Do others also have this experience?
>
> Cheers, Wes
> --
>
> Dr. W. J. Metzger Experimental High Energy Physics Group
> tel. +31-24-3653127 Faculty of Science
> +31-24-3652099 (secr.) Radboud University Nijmegen
> fax. +31-24-3652191 Heyendaalseweg 135
> 6525 AJ Nijmegen, The Netherlands
> e-mail: wes at hef.ru.nl or Wesley.Metzger at cern.ch
> http://home.cern.ch/metzger/ or http://www.hef.ru.nl/~wes

--
Frederik Tilmann
Bullard Laboratories           Tel. +44 1223 765545
Department of Earth Sciences   Fax. +44 1223 360779
University of Cambridge        email: tilmann at esc.cam.ac.uk