From ceaa579e7862cc70fbe5329527413588b9bca0d7 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sun, 15 Mar 2020 16:54:42 +0100 Subject: use lua-ul instead of ulem --- arabluatex.dtx | 95 ++++++++++++++++++++++++++++++++++++++++++++-------------- arabluatex.lua | 8 ++--- 2 files changed, 76 insertions(+), 27 deletions(-) diff --git a/arabluatex.dtx b/arabluatex.dtx index 534271e..4d3fb48 100644 --- a/arabluatex.dtx +++ b/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/arabluatex.lua b/arabluatex.lua index 868e116..cc3f713 100644 --- a/arabluatex.lua +++ b/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 -- cgit v1.2.3