Skip to content

Commit

Permalink
Change ulem to lua-ul; refs ftilmann#277
Browse files Browse the repository at this point in the history
This hack just changes in the DATA section:

ulem -> lua-ul
[normalem] ->
\sout -> \strikeThrough
\uwave -> \underLine

When this is used, output must be compiled with lualatex.

Some thoughts on implementing this in upstream latexdiff:

1. To make this an actual option, instead of hardcoding this change,
one would probably want to make general commands that call the right
ulem or lua-ul commnad, with separate preamble sections for either
ulem:

\RequirePackage[normalem]{ulem}
\newcommand[1]{\DIFstrikethrough}{\sout{ftilmann#1}}
\newcommand[1]{\DIFunderline}{\uwave{ftilmann#1}}

or lua-ul

\RequirePackage{lua-ul}
\newcommand[1]{\DIFstrikethrough}{\strikeThrough{ftilmann#1}}
\newcommand[1]{\DIFunderline}{\underLine{ftilmann#1}}

and then could make these changes instead

\RequirePackage[normalem]{ulem} ->
\sout -> \DIFstrikethrough
\uwave -> \underLine

This, however, would require adding in the logic to have either lua-ul or ulem into
the code.

I also hope the indirection like this won't break some LaTeX macro
somewhere but can't be sure of that.

Other options I considered would be:
- duplicating all these sections to have a ulem and a lua-ul
version (yuck)
- searching for these words and replacing them when reading in
preamble sections (D:)
- simply eliminating ulem support (working around it certainly seems to have caused a
lot of headaches for the creators of latexdiff)

2. lua-ul doesn't have the capacity out of the box to produce wavy
underlines like ulem, but is very configurable and it could be added.
Instructions are even in the lua-ul manual.
  • Loading branch information
michaelmhoffman committed Feb 23, 2023
1 parent 9fa5db6 commit cb6c513
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions latexdiff
Original file line number Diff line number Diff line change
Expand Up @@ -5338,10 +5338,10 @@ verbatim[*]?
%%% TYPES (Commands for highlighting changed blocks)
%DIF UNDERLINE PREAMBLE
\RequirePackage[normalem]{ulem}
\RequirePackage{lua-ul}
\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1}
\providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}}
\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}}
\providecommand{\DIFadd}[1]{{\protect\color{blue}\underLine{#1}}}
\providecommand{\DIFdel}[1]{{\protect\color{red}\strikeThrough{#1}}}
%DIF END UNDERLINE PREAMBLE
%DIF CTRADITIONAL PREAMBLE
Expand All @@ -5367,10 +5367,10 @@ verbatim[*]?
%DIF END CFONT PREAMBLE
%DIF FONTSTRIKE PREAMBLE
\RequirePackage[normalem]{ulem}
\RequirePackage{lua-ul}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\providecommand{\DIFadd}[1]{{\sf #1}}
\providecommand{\DIFdel}[1]{{\footnotesize \sout{#1}}}
\providecommand{\DIFdel}[1]{{\footnotesize \strikeThrough{#1}}}
%DIF END FONTSTRIKE PREAMBLE
%DIF CCHANGEBAR PREAMBLE
Expand All @@ -5388,11 +5388,11 @@ verbatim[*]?
%DIF END CFONTCHBAR PREAMBLE
%DIF CULINECHBAR PREAMBLE
\RequirePackage[normalem]{ulem}
\RequirePackage{lua-ul}
\RequirePackage[pdftex]{changebar}
\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1}
\providecommand{\DIFadd}[1]{\protect\cbstart{\protect\color{blue}\uwave{#1}}\protect\cbend}
\providecommand{\DIFdel}[1]{\protect\cbdelete{\protect\color{red}\sout{#1}}\protect\cbdelete}
\providecommand{\DIFadd}[1]{\protect\cbstart{\protect\color{blue}\underLine{#1}}\protect\cbend}
\providecommand{\DIFdel}[1]{\protect\cbdelete{\protect\color{red}\strikeThrough{#1}}\protect\cbdelete}
%DIF END CULINECHBAR PREAMBLE
%DIF CHANGEBAR PREAMBLE
Expand Down Expand Up @@ -5677,8 +5677,8 @@ verbatim[*]?
%DIF END COLORLISTINGS PREAMBLE
%DIF DIFCODE_UNDERLINE
moredelim=[il][\color{red}\sout]{\%DIF\ <\ },
moredelim=[il][\color{blue}\uwave]{\%DIF\ >\ }
moredelim=[il][\color{red}\strikeThrough]{\%DIF\ <\ },
moredelim=[il][\color{blue}\underLine]{\%DIF\ >\ }
%DIF END DIFCODE_UNDERLINE
%DIF DIFCODE_CTRADITIONAL
Expand All @@ -5697,7 +5697,7 @@ verbatim[*]?
%DIF END DIFCODE_CFONT
%DIF DIFCODE_FONTSTRIKE
moredelim=[il][\scriptsize \sout]{\%DIF\ <\ },
moredelim=[il][\scriptsize \strikeThrough]{\%DIF\ <\ },
moredelim=[il][\sffamily]{\%DIF\ >\ }
%DIF END DIFCODE_FONTSTRIKE
Expand All @@ -5717,8 +5717,8 @@ verbatim[*]?
%DIF END DIFCODE_CCHANGEBAR
%DIF DIFCODE_CULINECHBAR
moredelim=[il][\color{red}\sout]{\%DIF\ <\ },
moredelim=[il][\color{blue}\uwave]{\%DIF\ >\ }
moredelim=[il][\color{red}\strikeThrough]{\%DIF\ <\ },
moredelim=[il][\color{blue}\underLine]{\%DIF\ >\ }
%DIF END DIFCODE_CULINECHBAR
%DIF DIFCODE_CFONTCHBAR
Expand Down

1 comment on commit cb6c513

@michaelmhoffman
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub changing TeX #1 to a link to issue ftilmann#1 is unfortunate.

Please sign in to comment.