summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty')
-rw-r--r--Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty65
1 files changed, 56 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty
index 08069171817..72754a6ab49 100644
--- a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty
+++ b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty
@@ -20,7 +20,7 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage
{lua-ul}
- [2020/03/12 v0.0.1 Underlining and related functionality for LuaTeX]
+ [2020/03/15 v0.0.2 Underlining and related functionality for LuaTeX]
\ifx\directlua\undefined
\PackageError{lua-ul}{LuaLaTeX required}%
@@ -41,7 +41,12 @@
\fi
\csname#1\endcsname
}
-
+ \newcommand\luaul@defaultcontext{%
+ \number\dimexpr1ex
+ @\unless\ifx\undefined\LuaCol@Attribute
+ \the\LuaCol@Attribute
+ \fi
+ }
\NewDocumentCommand\newunderlinetype{mO{\luaul@defaultcontext}m}{%
\newcommand#1{}% "Reserve" the name
\protected\def#1{%
@@ -52,27 +57,69 @@
}}%
}
\ifluaul@predefined
- \newcommand\luaul@defaultcontext{%
- \number\dimexpr1ex
- @\unless\ifx\undefined\LuaCol@Attribute
- \the\LuaCol@Attribute
+ \newcommand\luaul@highlight@color{yellow}
+ \def\luaul@@setcolor\xcolor@#1#2{}
+ \newcommand\luaul@setcolor[1]{%
+ \ifx\XC@getcolor\undefined
+ \def\luaul@highlight@currentcolor{#1}
+ \else
+ \begingroup
+ \XC@getcolor{#1}\luaul@tmpcolor
+ \expanded{\endgroup
+ \def\noexpand\luaul@highlight@currentcolor{%
+ \expandafter\luaul@@setcolor\luaul@tmpcolor}}%
\fi
}
+\NewDocumentCommand\LuaULSetHighLightColor{om}{%
+ \edef\luaul@highlight@color{\IfValueTF{#1}{[#1]{#2}}{#2}}%
+}
\newunderlinetype\@underLine%
{\leaders\vrule height -.65ex depth .75ex}
\newcommand\underLine[1]{{\@underLine#1}}
\newunderlinetype\@strikeThrough%
{\leaders\vrule height .55ex depth -.45ex}
\newcommand\strikeThrough[1]{{\@strikeThrough#1}}
- \newunderlinetype\@highLight[\number\dimexpr1ex]%
- {\color{yellow}\leaders\vrule height 1.75ex depth .75ex}
- \newcommand\highLight[1]{{\@highLight#1}}
+
+ \newunderlinetype\@highLight[\number\dimexpr1ex@%
+ \luaul@highlight@currentcolor]%
+ {%
+ \ifx\XC@getcolor\undefined
+ \color{\luaul@highlight@currentcolor}%
+ \else
+ \expandafter\XC@undeclaredcolor\luaul@highlight@currentcolor
+ \fi
+ \leaders\vrule height 1.75ex depth .75ex
+ }
+ \newcommand\highLight[2][\luaul@highlight@color]{{%
+ \luaul@setcolor{#1}%
+ \@highLight#2%
+ }}
\ifluaul@soulnames
\let\textul\underLine \let\ul\textul
\let\textst\strikeThrough \let\st\textst
\let\texthl\highLight \let\hl\texthl
\fi
\fi
+\ifx \reset@font \normalfont
+ \let \reset@font \relax
+ \DeclareRobustCommand \reset@font {%
+ \normalfont
+ \LuaULResetUnderline*%
+ }
+\else
+ \MakeRobust \reset@font
+ \begingroup
+ \expandafter \let
+ \expandafter \helper
+ \csname reset@font \endcsname
+ \expandafter \endgroup
+ \expandafter \gdef
+ \csname reset@font \expandafter \endcsname
+ \expandafter {%
+ \helper%
+ \LuaULResetUnderline*%
+ }
+\fi
%%
%%
%% End of file `lua-ul.sty'.