diff --git a/latexdiff b/latexdiff index 7070a77..3eab614 100755 --- a/latexdiff +++ b/latexdiff @@ -464,6 +464,8 @@ foreach $assign ( @config ) { $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; if ( $1 eq "MINWORDSBLOCK" ) { $MINWORDSBLOCK = $2; } elsif ( $1 eq "FLOATENV" ) { $FLOATENV = $2 ; } + elsif ( $1 eq "ITEMCMD" ) { $ITEMCMD = $2 ; } + elsif ( $1 eq "LISTENV" ) { $LISTENV = $2 ; } elsif ( $1 eq "PICTUREENV" ) { $PICTUREENV = $2 ; } elsif ( $1 eq "MATHENV" ) { $MATHENV = $2 ; } elsif ( $1 eq "MATHREPL" ) { $MATHREPL = $2 ; } @@ -517,6 +519,8 @@ if ($showconfig) { print "Configuration variables:\n"; print "MINWORDSBLOCK=$MINWORDSBLOCK\n"; print "FLOATENV=$FLOATENV\n"; + print "ITEMCMD=$ITEMCMD\n"; + print "LISTENV=$LISTENV\n"; print "PICTUREENV=$PICTUREENV\n"; print "MATHENV=$MATHENV\n"; print "MATHREPL=$MATHREPL\n"; @@ -2035,7 +2039,7 @@ sub preprocess { for (@_) { ### s/^(\s*)//s; ### push(@leadin,$1); - # Change \{ to \QLEFTBRACE and \} to \QRIGHTBRACE + # Change \{ to \QLEFTBRACE, \} to \QRIGHTBRACE, and \& to \AMPERSAND s/(? 0) { + $listlast=pop(@liststack); + ($listtype eq $listlast) or warn "Invalid nesting of list environments: $listlast environment closed by \\end{$listtype}."; + } else { + warn "Invalid nesting of list environments: \\end{$listtype} encountered without matching \\begin{$listtype}."; + } + } else { + print STDERR "DEBUG: postprocess \@liststack=(",join(",",@liststack),")\n" if $debug; + if (scalar @liststack > 0 ) { + # we are within a list environment and should replace all item commands + $_=restore_item_commands($_); + } + # else: we are outside a list environment and do not need to do anything + } + $_ } @textparts; # end of map command + # replace the main text with the modified version + $_= "@newtextparts"; + + ### pre-1.0.4: ### ### old place for BEGINDIF, ENDDIF replacement ### # change begin and end commands within comments such that they @@ -2908,6 +2940,8 @@ format as new.tex but has all changes relative to old.tex marked up or commented -c configfile Available variables: MINWORDSBLOCK (integer) FLOATENV (RegEx) + ITEMCMD (RegEx) + LISTENV (RegEx) PICTUREENV (RegEx) MATHENV (RegEx) MATHREPL (String) @@ -3369,6 +3403,10 @@ C (integer) C (RegEx) +C (RegEx) + +C (RegEx) + C (RegEx) C (RegEx) @@ -3670,18 +3708,29 @@ are replaced by their FL variaties. [ Default: S >] +=item C + +Commands representing new item line with list environments. + +[ Default: \C ] + +=item C + +Environments whose name matches the regular expression in C are list environments. + +[ Default: S >] + =item C Within environments whose name matches the regular expression in C all latexdiff markup is removed (in pathologic cases this might lead to - inconsistent markup but this situation should be rare). +inconsistent markup but this situation should be rare). [ Default: S >] =item C,C -If both \begin and \end for a math environment (environment name matching C -or \[ and \]) +If both \begin and \end for a math environment (environment name matching C or \[ and \]) are within the same deleted block, they are replaced by a \begin and \end commands for C rather than being commented out. @@ -3735,19 +3784,23 @@ For custom packages you can define the commands which need to be protected by C< Try options C<--math-markup=whole>. If even that fails, you can turn off mark up for equations with C<--math-markup=off>. -=item How can I just show the pages +=item How can I just show the pages where changes had been made Use options -C<-s ZLABEL> (some postprocessing required) or C<-s ONLYCHANGEDPAGE>. C with C<--only-changes> option takes care of -the post-processing for you (requires zref packages). +the post-processing for you (requires zref package to be installed). =back =head1 BUGS -Option allow-spaces not implemented entirely consistently. It breaks +=over 10 + +=item Option allow-spaces not implemented entirely consistently. It breaks the rules that number and type of white space does not matter, as different numbers of inter-argument spaces are treated as significant. +=back + Please submit bug reports using the issue tracker of the github repository page I, or send them to I. Include the serial number of I (from comments at the top of the source or use B<--version>). If you come across latex @@ -3800,7 +3853,7 @@ dashbox emph fbox framebox -hspace +hspace\*? math.* makebox mbox diff --git a/latexdiff-vc b/latexdiff-vc index 6700426..baacb55 100755 --- a/latexdiff-vc +++ b/latexdiff-vc @@ -28,8 +28,8 @@ # TODO/IDEAS: - option to call external pre-processing codes # # version 1.1.1alpha: -# - better detection of RCS system -# +# - better detection of RCS system +# - undocumented option --debug/--nodebug to override default setting for debug mode (Default: 0)# # version 1.1.0: # # - with option --flatten and version control option, checkout the whole tree into a temporary directory @@ -63,7 +63,7 @@ This is LATEXDIFF-VC 1.1.1alpha EOF # output debug and intermediate files, set to 0 in final distribution -my $debug=1; +my $debug=0; # Option names @@ -94,11 +94,11 @@ GetOptions('revision|r:s' => \@revs, 'only-changes' => \$onlychanges, 'flatten:s' => \$flatten, 'version' => \$version, - 'help|h' => \$help); - -### print STDERR "DEBUG 1:revs($#revs): " . join(":",@revs) . "\n"; -### print STDERR "DEBUG 1:ARGV($#ARGV): " . join(":",@ARGV) . "\n"; + 'help|h' => \$help, + 'debug!' => \$debug); +##print STDERR "DEBUG 1:revs($#revs): " . join(":",@revs) . "\n"; +##print STDERR "DEBUG 1:ARGV($#ARGV): " . join(":",@ARGV) . "\n"; $extracomp = join(" ",grep(/BAR/,@ARGV)); # special latexdiff options requiring additional compilation @@ -147,12 +147,12 @@ if ( defined($dir) && ( -f $dir || $dir =~ /^-/ ) ) { } # check whether the first file name or first passed-through option for latexdiff got misinterpreted as an option to an empty --flatten option if ( defined($flatten) && ( -f $flatten || $flatten =~ /^-/ ) ) { - push @ARGV,$flatten; + unshift @ARGV,$flatten; $flatten=""; } - -print "DEBUG: latexdiff-vc command line: ", join(" ",@ARGV), "\n" if $debug; +print "DEBUG: PDF $pdf latexdiff-vc command line: ", join(" ",@ARGV), "\n" if $debug; +###exit; $file2=pop @ARGV; ( defined($file2) && $file2 =~ /\.(tex|bbl|flt)$/ ) or pod2usage("Must specify at least one tex, bbl or flt file"); @@ -243,7 +243,7 @@ if ( defined($flatten) ) { # impose ZLABEL subtype if --only-changes option if ( $onlychanges ) { - push @ldoptions, "-s", "ZLABEL" ; + push @ldoptions, "-s", "ZLABEL","-f","IDENTICAL" ; } if ( scalar(@revs) == 0 ) { @@ -408,44 +408,44 @@ foreach $diff ( @difffiles ) { } if ( $pdf | $postscript ) { - print STDERR "PDF: $pdf Postscript: $postscript cwd $cwd\n"; - - if ( system("grep -q \'^[^%]*\\\\bibliography\' \"$diff\"") == 0 ) { - system("$latexcmd --interaction=batchmode \"$diff\"; bibtex \"$diffbase\";"); - push @ptmpfiles, "$diffbase.bbl","$diffbase.bbl" ; - } - - # if special needs, as CHANGEBAR - if ( $extracomp ) { - # print "Extracomp\n"; - system("$latexcmd --interaction=batchmode \"$diff\";"); - } + print STDERR "PDF: $pdf Postscript: $postscript cwd $cwd\n" if $debug; - # final compilation - system("$latexcmd --interaction=batchmode \"$diff\";"); # needed if cross-refs - system("$latexcmd \"$diff\";"); # final, with possible error messages - - if ( $postscript ) { - my $dvi="$diffbase.dvi"; - my $ps="$diffbase.ps"; - my $ppoption=""; + if ( system("grep -q \'^[^%]*\\\\bibliography{\' \"$diff\"") == 0 ) { + system("$latexcmd --interaction=batchmode \"$diff\"; bibtex \"$diffbase\";"); + push @ptmpfiles, "$diffbase.bbl","$diffbase.bbl" ; + } - if ( $onlychanges ) { - $ppoption="-pp ".join(",",findchangedpages("$diffbase.aux")); + # if special needs, as CHANGEBAR + if ( $extracomp ) { + # print "Extracomp\n"; + system("$latexcmd --interaction=batchmode \"$diff\";"); } - system("dvips $ppoption -o $ps $dvi"); - push @ptmpfiles, "$diffbase.aux","$diffbase.log",$dvi ; - print "Generated postscript file $ps\n"; - } - elsif ( $pdf ) { - if ( $onlychanges ) { - my @pages=findchangedpages("$diffbase.aux"); - system ("pdftk \"$diffbase.pdf\" cat " . join(" ",@pages) . " output \"$diffbase-changedpage.pdf\"")==0 or - die ("Could not execute . Return code: $?"); - move("$diffbase-changedpage.pdf","$diffbase.pdf"); + + # final compilation + system("$latexcmd --interaction=batchmode \"$diff\";"); # needed if cross-refs + system("$latexcmd \"$diff\";"); # final, with possible error messages + + if ( $postscript ) { + my $dvi="$diffbase.dvi"; + my $ps="$diffbase.ps"; + my $ppoption=""; + + if ( $onlychanges ) { + $ppoption="-pp ".join(",",findchangedpages("$diffbase.aux")); + } + system("dvips $ppoption -o $ps $dvi"); + push @ptmpfiles, "$diffbase.aux","$diffbase.log",$dvi ; + print "Generated postscript file $ps\n"; + } elsif ( $pdf ) { + if ( $onlychanges ) { + my @pages=findchangedpages("$diffbase.aux"); + ### print ("Running pdftk \"$diffbase.pdf\" cat " . join(" ",@pages) . " output \"$diffbase-changedpage.pdf\"\n") or + system ("pdftk \"$diffbase.pdf\" cat " . join(" ",@pages) . " output \"$diffbase-changedpage.pdf\"")==0 or + die ("Could not execute . Return code: $?"); + move("$diffbase-changedpage.pdf","$diffbase.pdf"); + } + push @ptmpfiles, "$diffbase.aux","$diffbase.log"; } - push @ptmpfiles, "$diffbase.aux","$diffbase.log"; - } } unlink @ptmpfiles; chdir $cwd; diff --git a/testsuite/lists-new.tex b/testsuite/lists-new.tex index cdc7815..fb484ff 100644 --- a/testsuite/lists-new.tex +++ b/testsuite/lists-new.tex @@ -8,7 +8,7 @@ Some text here common to both documents Every year in the United States, natural hazard events threaten lives and livelihoods, resulting in deaths and billions of dollars in damage. The Firm works with many partners to monitor, assess, and conduct targeted research on a wide range of natural hazards so that policymakers and the public have the understanding they need to enhance preparedness, response and resilience. -\end{document} + \textbf{GUE Tech} \begin{description} diff --git a/testsuite/lists-old.tex b/testsuite/lists-old.tex index 3ac4371..d5bbbb8 100644 --- a/testsuite/lists-old.tex +++ b/testsuite/lists-old.tex @@ -29,7 +29,6 @@ Every year in the United States, natural hazard events threaten lives and livelihoods, resulting in deaths and billions of dollars in damage. The Firm works with many partners to monitor, assess, and conduct targeted research on a wide range of natural hazards so that policymakers and the public have the understanding they need to enhance preparedness, response and resilience. -\end{document} \begin{description} \item[GUE Tech] \hspace*{1cm}\\ \underline{1 PhD student position (NN) TV-L E13/14 (75\%) for 36 months}: diff --git a/testsuite/verify b/testsuite/verify index eb35421..253474a 100755 --- a/testsuite/verify +++ b/testsuite/verify @@ -17,7 +17,7 @@ set testroots=( test rapine_et_al island_obs2004 texdiffsample gershwin12 gershw delequ latin9 pollack move-equation nomarkup subscript doubledollar \ DIFDELCMDBUG eqnarray subscriptm delequ2 schneider gennady umesh underwood endfloat outerrise \ delequ3 delequ4 "simplefrac --allow-spaces" "master --flatten" titlediffTest2 exampleDiff bornd2 \ -"rolla --math-markup=2" mini "complex-maths --math-markup=1" margalit circonflex mwe-comment "apacite-test --flatten" quoteddollarunderscore units complicated-math move-equation2 \ +"rolla --math-markup=2" mini "complex-maths --math-markup=1" margalit circonflex mwe-comment "apacite-test --flatten" quoteddollarunderscore units complicated-math move-equation2 lists \ ) #set testroots= ( test subscript )