Skip to content

Commit

Permalink
Merge pull request #215 from thomaswucher/fix-listings-having-color-e…
Browse files Browse the repository at this point in the history
…ven-if-they-shouldnt

Add separate preamble for listings without the color package
  • Loading branch information
ftilmann authored Feb 9, 2021
2 parents ff4483a + e718935 commit 262ad9d
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion latexdiff
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,9 @@ $ulem = ($latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{ulem\}/ || def
# If listings is being used or can be found in the latexdiff search path, add to the preamble auxiliary code to enable line-by-line markup
if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) {
my @listingpreamble=extrapream("LISTINGS");
if ($latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/ ) {
@listingpreamble=extrapream("COLORLISTINGS");
}
my @listingDIFcode=();
my $replaced;
# note that in case user supplies preamblefile the type might not reflect well the
Expand Down Expand Up @@ -5492,7 +5495,6 @@ verbatim[*]?
%DIF LISTINGS PREAMBLE
\RequirePackage{listings}
\RequirePackage{color}
\lstdefinelanguage{DIFcode}{
% note that the definitions in the following two lines are overwritten dependent on the markup type selected %DIFCODE TEMPLATE
morecomment=[il]{\%DIF\ <\ }, %DIFCODE TEMPLATE
Expand All @@ -5508,6 +5510,24 @@ verbatim[*]?
\lstnewenvironment{DIFverbatim*}{\lstset{style=DIFverbatimstyle,showspaces=true}}{}
%DIF END LISTINGS PREAMBLE
%DIF COLORLISTINGS PREAMBLE
\RequirePackage{listings}
\RequirePackage{color}
\lstdefinelanguage{DIFcode}{
% note that the definitions in the following two lines are overwritten dependent on the markup type selected %DIFCODE TEMPLATE
morecomment=[il]{\%DIF\ <\ }, %DIFCODE TEMPLATE
moredelim=[il][\bfseries]{\%DIF\ >\ } %DIFCODE TEMPLATE
}
\lstdefinestyle{DIFverbatimstyle}{
language=DIFcode,
basicstyle=\ttfamily,
columns=fullflexible,
keepspaces=true
}
\lstnewenvironment{DIFverbatim}{\lstset{style=DIFverbatimstyle}}{}
\lstnewenvironment{DIFverbatim*}{\lstset{style=DIFverbatimstyle,showspaces=true}}{}
%DIF END COLORLISTINGS PREAMBLE
%DIF DIFCODE_UNDERLINE
moredelim=[il][\color{red}\sout]{\%DIF\ <\ },
moredelim=[il][\color{blue}\uwave]{\%DIF\ >\ }
Expand Down

0 comments on commit 262ad9d

Please sign in to comment.