diff --git a/latexdiff b/latexdiff index 73f032b..a397d30 100755 --- a/latexdiff +++ b/latexdiff @@ -45,6 +45,8 @@ # - add more mboxsafecmd and safecmd commands for SIunitx to stay compatible with newer versionsof SIunitx (PR #283, fixing issue #282, contributed by github user joe6302413) # - File added via --preamble option is no longer assumed to be ASCII, but read either with encoding as defined by --encoding option or using the encoding of the LOCALE (fixes issue #285 ) # - multicolumn argument is now treated as text +# - when tikz-dependency package is used, \& is no longer a safe command as it has special meaning inside dependency environment. The fix is a little of a hack as really it should only be considered unsafe within dependency environment (fixes (mostly) issue #303 ) +# - listings package had trouble with non-ASCII chars. The encoding is now set (thanks to github user anka-213 for finding this). Fixes #304 # # Version 1.3.3: # New features: @@ -923,7 +925,7 @@ if (defined($labels[1])) { $encoding=guess_encoding($newfile) unless defined($encoding); $encoding = "utf8" if $encoding =~ m/^utf8/i ; -###print STDERR "Encoding $encoding\n" if $verbose; +print STDERR "Encoding $encoding\n" if $verbose; if (lc($encoding) eq "utf8" ) { binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); @@ -1172,7 +1174,7 @@ if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { } my @listingDIFcode=(); my $replaced; - # note that in case user supplies preamblefile the type might not reflect well the + # note that in case user supplies preamblefile the type might not reflect well the actual markup style @listingDIFcode=extrapream("-nofail","DIFCODE_" . $type) unless defined($preamblefile); if (!(@listingDIFcode)) { # if listingDIFcode is empty try to guess a suitable one from the preamble @@ -1186,6 +1188,10 @@ if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { @listingDIFcode=extrapream("DIFCODE_BOLD"); } } + # add configuration so that listings work with utf-8 + push @listingpreamble, '\lstset{extendedchars=\true,inputencoding='.$encoding."}\n"; + + # now splice it in $replaced=0; ###print STDERR "DEBUG: listingDIFcode: ",join("\n",@listingDIFcode),"|||\n" if $debug; @@ -1334,6 +1340,10 @@ if (defined $packages{"mhchem"} ) { # push(@MATHTEXTCMDLIST,'cee'); } +if ( defined $packages{"tikz-dependency"} ) { + init_regex_arr_ext(\@SAFECMDEXCL, 'AMPERSAND'); +} + my ( $citpat); diff --git a/testsuite/tikz-dependency-test-new.tex b/testsuite/tikz-dependency-test-new.tex new file mode 100644 index 0000000..674ea84 --- /dev/null +++ b/testsuite/tikz-dependency-test-new.tex @@ -0,0 +1,15 @@ +\documentclass{article} +\usepackage[utf8]{inputenc} +\usepackage{tikz-dependency} +\begin{document} + \begin{dependency} + \begin{deptext}[column sep=0.4cm] + the\_Det : Det \& black\_A : A \& cat\_N : N \\ + \& PositA black\_A : AP \& \\ + \end{deptext} + \depedge{3}{1}{det} + \depedge{3}{2}{amod} + \deproot{3}{root} + \end{dependency} +\end{document} + diff --git a/testsuite/tikz-dependency-test-old.tex b/testsuite/tikz-dependency-test-old.tex new file mode 100644 index 0000000..2ae1dc4 --- /dev/null +++ b/testsuite/tikz-dependency-test-old.tex @@ -0,0 +1,7 @@ +\documentclass{article} +\usepackage[utf8]{inputenc} +\usepackage{tikz-dependency} +\begin{document} +No content +\end{document} + diff --git a/testsuite/verify b/testsuite/verify index 6a611c5..99f4391 100755 --- a/testsuite/verify +++ b/testsuite/verify @@ -31,7 +31,7 @@ set testroots=( test rapine_et_al island_obs2004 texdiffsample gershwin12 "gersh delequ latin9 pollack move-equation nomarkup subscript doubledollar intertext \ DIFDELCMDBUG eqnarray eqnarray2 subscriptm delequ2 schneider gennady umesh underwood endfloat endfloat2 outerrise \ delequ3 delequ4 "simplefrac --allow-spaces" "master --flatten" "subfile --flatten" "import --flatten" titlediffTest2 exampleDiff bornd2 split \ -"rolla --math-markup=2" mini "complex-maths --math-markup=1" margalit oubmath circonflex mwe-comment "apacite-test --flatten" quoteddollarunderscore units complicated-math move-equation2 lists "figures --graphics-markup=both" alignat "safecmd --append-safecmd=remark" verbatim verbatim2-is143 embedded-math-array "verbatim-input --flatten" anchordemo 'customdiffcmdtest --add-to-config "CUSTOMDIFCMD=blindtext;mypar;donothing;cmd"' description frac_w_space_comments multicolumn \ +"rolla --math-markup=2" mini "complex-maths --math-markup=1" margalit oubmath circonflex mwe-comment "apacite-test --flatten" quoteddollarunderscore units complicated-math move-equation2 lists "figures --graphics-markup=both" alignat "safecmd --append-safecmd=remark" verbatim verbatim2-is143 embedded-math-array "verbatim-input --flatten" anchordemo 'customdiffcmdtest --add-to-config "CUSTOMDIFCMD=blindtext;mypar;donothing;cmd"' description frac_w_space_comments multicolumn tikz-dependency-test.tex "href-in-bibliography --append-safecmd=path" revtex-bibliography biblatex 'txtcmd-with-multiple-arguments --append-textcmd=cmd' \ "no-del --no-del" \ ) # siunitx