From d50a41b6ab3d05fe5605a3a3b50ff68f61059296 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 16 Mar 2020 03:01:06 +0000 Subject: CTAN sync 202003160301 --- macros/luatex/latex/arabluatex/arabluatex.dtx | 95 +++++++++--- macros/luatex/latex/arabluatex/arabluatex.lua | 8 +- macros/luatex/latex/arabluatex/arabluatex.pdf | Bin 647013 -> 654486 bytes .../luatex/latex/arabluatex/samples/al-Jahiz.pdf | Bin 112526 -> 112383 bytes .../luatex/latex/arabluatex/samples/exporting.pdf | Bin 63557 -> 63544 bytes .../latex/arabluatex/samples/template-01.pdf | Bin 63935 -> 64015 bytes macros/luatex/latex/lua-ul/lua-ul.dtx | 164 +++++++++++++++++++-- macros/luatex/latex/lua-ul/lua-ul.pdf | Bin 74195 -> 85488 bytes 8 files changed, 226 insertions(+), 41 deletions(-) (limited to 'macros/luatex') diff --git a/macros/luatex/latex/arabluatex/arabluatex.dtx b/macros/luatex/latex/arabluatex/arabluatex.dtx index 534271e52c..4d3fb48e01 100644 --- a/macros/luatex/latex/arabluatex/arabluatex.dtx +++ b/macros/luatex/latex/arabluatex/arabluatex.dtx @@ -27,7 +27,7 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{arabluatex} %<*package> - [2020/02/29 v1.18 An ArabTeX-like interface for LuaLaTeX] + [2020/03/15 v1.19 ArabTeX for LuaLaTeX] % % %<*driver> @@ -88,6 +88,16 @@ location = {Toronto} } +@software{pkg:lua-ul, + title = {The Lua-ul package}, + subtitle = {Underlining for LuaLaTeX}, + author = {Krüger, Marcel}, + maintainer = {Krüger, Marcel}, + url = {http://www.ctan.org/pkg/lua-ul}, + date = {2020-03-12}, + version = {0.0.1} +} + @MVBook{Wright, author = {Wright, W. LL.D}, title = {A Grammar of the Arabic Language}, @@ -156,7 +166,7 @@ \babelfont{sf}{NewComputerModern Sans} \babelfont{tt}{NewComputerModern Mono} \usepackage{metalogox} -\usepackage{arabluatex}[2020/02/29] +\usepackage{arabluatex}[2020/03/15] \SetArbUp{\textsuperscript{\thinspace#1}} % Old Standard needs this \usepackage[nopar]{quran} \usepackage[noindex]{nameauth} @@ -259,7 +269,7 @@ % % \fi % -% \CheckSum{1006} +% \CheckSum{1014} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -2043,17 +2053,17 @@ % Arabic environments. In that case, \package{arabluatex} does not % print the stroke as a distinctive mark over the number for it is % not surrounded by other Arabic words. In case one nonetheless -% wishes to print the stroke, he can either use the \cs{aemph} -% command that is described below in \vref{sec:emphasis} or insert -% the \arb[trans]{'ab^gad} number in |\arb[novoc]{}|:--- +% wishes to print the stroke, he can either use the \cs{aoline*} +% command that is described below in \vref{sec:underlining} or +% insert the \arb[trans]{'ab^gad} number in |\arb[novoc]{}|:--- % \begin{quote} % |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is| % |\abjad{1874}| The \arb[trans]{'abjad} number for 1874 is % \abjad{1874}. % % |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is| -% |\aemph*{\abjad{1874}}| The \arb[trans]{'abjad} number for 1874 -% is \aemph*{\abjad{1874}}. +% |\aoline*{\abjad{1874}}| The \arb[trans]{'abjad} number for 1874 +% is \aoline*{\abjad{1874}}. % % |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is| % |\arb[novoc]{\abjad{1874}}| The \arb[trans]{'abjad} number for @@ -2153,7 +2163,23 @@ % \arb[voc]{\abjad{45}: kitAbu-hu \aemph*{fI 'l-`AdAt-i}} % \arb[trans]{\abjad{45}: kitAbu-hu \aemph*{fI 'l-\uc{`AdAt-i}}}. % \end{quoting} -% +% +% \subsubsection{Underlining words or numbers} +% \label{sec:underlining} +% \DescribeMacro{\aoline}% +% \DescribeMacro{\aoline*}% +% \DescribeMacro{\auline}% +% \NEWfeature{v1.19}Three additional, non context-sensitive commands +% are provided to distinguish words or numbers:--- +% \begin{enumerate} +% \item \cs{aoline}, which is equivalent to \cs{aemph*} described +% above. +% \item \cs{aoline*}, which is the same as \cs{aoline}, but better +% suited for \arb[trans]{'ab^gad} numbers.\footnote{See the example +% provided above \vref{sec:abjad}.} +% \item \cs{auline}, which can be used to underline Arabic words. +% \end{enumerate} +% % \section{Arabic poetry} % \label{sec:poetry} % \NEWfeature{v1.6} \package{arabluatex} provides a special @@ -2621,16 +2647,25 @@ % % It is encoded |&| in Arab\TeX\ scheme. % -% In the following example, the \cs{uline} command would have -% prevented adjacent Arabic letters from being connected if the -% \enquote*{Zero width joiner} had not been used:---% +% In elegantly printed books where many of the letters are interwoven +% with one another so as to form ligatures, it may be convenient to +% bring the letters into line in some instances. In the following +% example, the \enquote*{zero width joiner} is used to prevent two +% adjacent letters, viz.\ \arb[novoc]{s} and \arb[novoc]{.h}, from +% standing one above the other in the name of \prname{'is.h_aq} +% (\arb[fullvoc]{'is.h_aq"}):\footnote{\cs{underLine} and +% \cs{highLight} are taken from the \package{lua-ul} package which is +% loaded by \package{arabluatex}. See \textcite{pkg:lua-ul}.}--- % \iffalse %<*example> % \fi \begin{example} \begin{arab}[fullvoc] - huwa 'abU zaydiN .hunaynu bnu 'is.h_aqa 'l-`a&\uline{&bA}diyyu - bi-fat.hi 'l-`ayni wa-ta_hfIfi 'l-bA'i. + huwa 'abU zaydiN .hunaynu bnu 'is&\underLine{&.h_a}qa + 'l-`a\underLine{bA}diyyu bi-fat.hi 'l-`ayni wa-ta_hfIfi 'l-bA'i. + + huwa 'abU zaydiN .hunaynu bnu 'is&\highLight{&.h_a}qa + 'l-`a\highLight{bA}diyyu bi-fat.hi 'l-`ayni wa-ta_hfIfi 'l-bA'i. \end{arab} \end{example} % \iffalse @@ -4363,8 +4398,7 @@ \RequirePackage{xparse} \RequirePackage{adjustbox} \RequirePackage{xstring} -\PassOptionsToPackage{normalem}{ulem} -\RequirePackage{ulem} +\RequirePackage{lua-ul} % \end{macrocode} % The following boolean will be set to |true| in |RL| mode: % \begin{macrocode} @@ -4440,16 +4474,28 @@ % \begin{macro}{\aemph} Arabic emphasis. Needs to be redefined as % well. The function is actually coded in Lua. % \changes{v1.16}{2018/11/06}{Now uses \textsf{ulem}} +% \changes{v1.19}{2020/03/15}{Now uses \textsf{lua-ul}} % \begin{macro}{\aemph*} The \enquote*{starred} version of this % command alway puts the stroke over its argument. % \changes{v1.9.2}{2017/10/24}{Starred version which always puts the -% stroke over its argument}As of v1.16 \package{arabluatex} uses -% \package{ulem} to render the strokes, thus allowing line breaks +% stroke over its argument}As of v1.19, \package{arabluatex} uses +% \package{lua-ul} to render the strokes, thus allowing line breaks % and manual hyphenation for transliterated Arabic. +% \begin{macro}{\aoline} +% \begin{macro}{\aoline*} +% \begin{macro}{\auline} +% \changes{v1.19}{2020/03/15}{Non context-sensitive command to +% underline Arabic words is provided}\cs{aoline} and \cs{auline} +% derive from \cs{newunderlinetype} provided by the \package{lua-ul} +% package whereas \cs{aoline*}, which uses \cs{overline} in math-mode, +% is better suited for so-called \arb[trans]{'ab^gad} numbers. % \begin{macrocode} -\def\oline{\@ifstar\@oline\@@oline} -\def\@oline#1{\ensuremath{\overline{\mbox{#1}}}} -\def\@@oline{\bgroup \ULdepth=-3ex \ULset} +\newunderlinetype\@aoverLine{\leaders\vrule height 3ex depth -2.9ex} +\def\aoline{\@ifstar\@aoline\@@aoline} +\def\@aoline#1{\ensuremath{\overline{\mbox{#1}}}} +\def\@@aoline#1{{\@aoverLine#1}} +\newunderlinetype\@aunderLine{\leaders\vrule height -.65ex depth .75ex} +\def\auline#1{{\@aunderLine#1}} \AtBeginDocument{\ifdef{\aemph}% {\RenewDocumentCommand{\aemph}{s m}{% \IfBooleanTF{#1}{% @@ -4466,6 +4512,9 @@ % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % \begin{macro}{\arbcolor}\changes{v1.12}{2018/06/24}{Standard color % command for Arabic environments} % \cs{arbcolor}\oarg{color}\marg{Arabic text} takes the Arabic text to @@ -4942,13 +4991,13 @@ \ifdefined\abjad% \RenewDocumentCommand{\abjad}{m}% {\ifbool{al@rlmode}% - {\oline*{% + {\aoline*{% \luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}} {\luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}} \else% \NewDocumentCommand{\abjad}{m}% {\ifbool{al@rlmode}% - {\oline*{% + {\aoline*{% \luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}} {\luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}} \fi} diff --git a/macros/luatex/latex/arabluatex/arabluatex.lua b/macros/luatex/latex/arabluatex/arabluatex.lua index 868e11692d..cc3f713bfa 100644 --- a/macros/luatex/latex/arabluatex/arabluatex.lua +++ b/macros/luatex/latex/arabluatex/arabluatex.lua @@ -724,7 +724,7 @@ local function processarbtoutf(str) bbody = string.sub(bbody, 2, -2) if tonumber(bbody) ~= nil then bbody = arabluatex.abjadify(bbody) - return string.format("\\oline*{\\arb[novoc]{%s}}", bbody) + return string.format("\\aoline*{\\arb[novoc]{%s}}", bbody) else return string.format("%s{%s}", btag, bbody) end @@ -1183,12 +1183,12 @@ end function arabluatex.aemph(str, opt) if tex.textdir == "TRT" then - str = "\\oline{\\textdir TRT{}"..str.."}" + str = "\\aoline{\\textdir TRT{}"..str.."}" elseif tex.textdir == "TLT" then if opt == "over" then - str = "\\oline{"..str.."}" + str = "\\aoline{"..str.."}" else - str = "\\uline{"..str.."}" + str = "\\auline{"..str.."}" end end return str diff --git a/macros/luatex/latex/arabluatex/arabluatex.pdf b/macros/luatex/latex/arabluatex/arabluatex.pdf index 44e83c9d4a..dd09d3127e 100644 Binary files a/macros/luatex/latex/arabluatex/arabluatex.pdf and b/macros/luatex/latex/arabluatex/arabluatex.pdf differ diff --git a/macros/luatex/latex/arabluatex/samples/al-Jahiz.pdf b/macros/luatex/latex/arabluatex/samples/al-Jahiz.pdf index c56297fc96..10e5ab3ca8 100644 Binary files a/macros/luatex/latex/arabluatex/samples/al-Jahiz.pdf and b/macros/luatex/latex/arabluatex/samples/al-Jahiz.pdf differ diff --git a/macros/luatex/latex/arabluatex/samples/exporting.pdf b/macros/luatex/latex/arabluatex/samples/exporting.pdf index 5911562443..f1072cae6f 100644 Binary files a/macros/luatex/latex/arabluatex/samples/exporting.pdf and b/macros/luatex/latex/arabluatex/samples/exporting.pdf differ diff --git a/macros/luatex/latex/arabluatex/samples/template-01.pdf b/macros/luatex/latex/arabluatex/samples/template-01.pdf index db695d716b..e964923f32 100644 Binary files a/macros/luatex/latex/arabluatex/samples/template-01.pdf and b/macros/luatex/latex/arabluatex/samples/template-01.pdf differ diff --git a/macros/luatex/latex/lua-ul/lua-ul.dtx b/macros/luatex/latex/lua-ul/lua-ul.dtx index be033be0b5..9573212ba2 100644 --- a/macros/luatex/latex/lua-ul/lua-ul.dtx +++ b/macros/luatex/latex/lua-ul/lua-ul.dtx @@ -43,6 +43,7 @@ \documentclass{article} \usepackage{lua-ul} \usepackage{csquotes,doc,framed,metalogo,hyperref,luacolor,tikzducks,pict2e} +\RecordChanges \begin{document} \DocInput{lua-ul.dtx} \PrintIndex @@ -116,6 +117,32 @@ % \end{document} % \end{verbatim} % +% The \verb+\highLight+ command highlights the argument in yellow by default. This color can be changed +% either by providing a color as optional argument or by changing the default through \verb+\LuaULSetHighLightColor+: +% +% \begin{verbatim} +% \documentclass{article} +% \usepackage{xcolor,luacolor,lua-ul} +% \LuaULSetHighLightColor{green} +% \begin{document} +% Lots of stuff is \highLight{important enough to be highlighted}, +% but only few things are dangerous enough to deserve +% \highLight[red]{red highlighting.} +% +% \LuaULSetHighLightColor{yellow} +% Let's go back to traditional \highLight{highlighting}. +% \end{document} +% \end{verbatim} +% +% \begin{framed} +% \LuaULSetHighLightColor{green} +% Lots of stuff is \highLight{important enough to be highlighted}, but only few things +% are dangerous enough to deserve \highLight[red]{red highlighting.} +% +% \LuaULSetHighLightColor{yellow} +% Let's go back to traditional \highLight{highlighting}. +% \end{framed} +% % \section{Expert interface} % \DescribeMacro{\newunderlinetype}§ % Sometimes, you might try to solve more interesting problems than boring underlining, @@ -178,6 +205,7 @@ % % \StopEventually{} % \section{The implementation} +% \changes{0.0.1}{2020-03-12}{Initial release} % \subsection{Helper modules} % First we need a separate Lua module \verb+pre_append_to_vlist_filter+ which % provides a variant of the \verb+append_to_vlist_filter+ callback which can be @@ -313,15 +341,48 @@ local function set_underline() end tex.attribute[j] = token.scan_int() end +% \end{macrocode} +% \changes{0.0.2}{2020-03-15}{Add command to disable active underlining} +% \begin{macrocode} +local function reset_underline() + local reset_all = token.scan_keyword'*' + local j + for i=1,#underlineattrs do + local attr = underlineattrs[i] + if tex.attribute[attr] ~= -0x7FFFFFFF then + if reset_all then + tex.attribute[attr] = -0x7FFFFFFF + else + j = attr + end + end + end + if not j then + if not reset_all then + tex.error("No underline active", {"You tried to disable \z + underlining but underlining was not active", + "in the first place. Maybe you wanted to ensure that \z + no underling can be active anymore?", "Then you should \z + append a *."}) + end + return + end + tex.attribute[j] = -0x7FFFFFFF +end local functions = lua.get_functions_table() +local set_lua = token.set_lua local new_underline_type_func = luatexbase.new_luafunction"luaul.new_underline_type" local set_underline_func = luatexbase.new_luafunction"luaul.set_underline_func" -token.set_lua("LuaULNewUnderlineType", new_underline_type_func) -token.set_lua("LuaULSetUnderline", set_underline_func, "protected") +local reset_underline_func = + luatexbase.new_luafunction"luaul.reset_underline_func" +set_lua("LuaULNewUnderlineType", new_underline_type_func) +set_lua("LuaULSetUnderline", set_underline_func, "protected") +set_lua("LuaULResetUnderline", reset_underline_func, "protected") functions[new_underline_type_func] = new_underline_type functions[set_underline_func] = set_underline +functions[reset_underline_func] = reset_underline local add_underline_h local function add_underline_v(head, attr) @@ -379,9 +440,10 @@ function add_underline_h(head, attr) local width = node.rangedimensions(head, first) local kern = node.new(kern_t) kern.kern = -width - kern.next = node.copy(underline_types[last_value]) - kern.next.width = width - node.tail(head.head).next = kern + local lead = node.copy(underline_types[last_value]) + lead.width = width + head.head = node.insert_before(head.head, first, lead) + node.insert_after(head, lead, kern) end end local function filter(b, loc, prev, mirror) @@ -407,7 +469,7 @@ luatexbase.add_to_callback('pre_append_to_vlist_filter', \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] % \fi % Only \LuaLaTeX{} is supported. @@ -438,7 +500,19 @@ luatexbase.add_to_callback('pre_append_to_vlist_filter', \fi \csname#1\endcsname } - +% \end{macrocode} +% The default for the context argument. Give that most stuff should +% scale vertically with the font size, we expect most arguments +% to be given in \texttt{ex}. Additionally especially traditional +% underlines will use the currently active text color, so especially +% when luacolor is loaded we have to include the color attribute too. +% \begin{macrocode} + \newcommand\luaul@defaultcontext{% + \number\dimexpr1ex + @\unless\ifx\undefined\LuaCol@Attribute + \the\LuaCol@Attribute + \fi + } % \end{macrocode} % The main macro. % \begin{macrocode} @@ -452,21 +526,58 @@ luatexbase.add_to_callback('pre_append_to_vlist_filter', }}% } \ifluaul@predefined - \newcommand\luaul@defaultcontext{% - \number\dimexpr1ex - @\unless\ifx\undefined\LuaCol@Attribute - \the\LuaCol@Attribute +% \end{macrocode} +% \changes{0.0.2}{2020-03-15}{Allow \texttt{\protect\string\protect\highLight} color customization} +% For \verb+\highLight+, the color should be customizable. +% There are two cases: If \verb+xcolor+ is not loaded, we just accept +% a simple color name. Otherwise, we accept color as documented in +% xcolor for PSTricks: Either a color name, a color expression or a +% combination of colormodel and associated values. +% \begin{macrocode} + \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 } +% \end{macrocode} +% Now a user-level command to set the default color. +% \begin{macrocode} +\NewDocumentCommand\LuaULSetHighLightColor{om}{% + \edef\luaul@highlight@color{\IfValueTF{#1}{[#1]{#2}}{#2}}% +} +% \end{macrocode} +% The sizes for the predefined commands are stolen from the \enquote{soul} +% default values. +% \begin{macrocode} \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 @@ -474,6 +585,31 @@ luatexbase.add_to_callback('pre_append_to_vlist_filter', \fi \fi % \end{macrocode} +% \changes{0.0.2}{2020-03-15}{Patch \texttt{\protect\string\protect\reset@font}} +% Finally patch \verb+\reset@font+ to ensure that underlines do not propagate +% into unexpected places. +% \begin{macrocode} +\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{macrocode} % \iffalse % % \fi diff --git a/macros/luatex/latex/lua-ul/lua-ul.pdf b/macros/luatex/latex/lua-ul/lua-ul.pdf index e8472c65bb..257d7fee40 100644 Binary files a/macros/luatex/latex/lua-ul/lua-ul.pdf and b/macros/luatex/latex/lua-ul/lua-ul.pdf differ -- cgit v1.2.3