aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arabluatex.dtx95
-rw-r--r--arabluatex.lua8
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 @@
27%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] 27%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
28%<package>\ProvidesPackage{arabluatex} 28%<package>\ProvidesPackage{arabluatex}
29%<*package> 29%<*package>
30 [2020/02/29 v1.18 An ArabTeX-like interface for LuaLaTeX] 30 [2020/03/15 v1.19 ArabTeX for LuaLaTeX]
31%</package> 31%</package>
32% 32%
33%<*driver> 33%<*driver>
@@ -88,6 +88,16 @@
88 location = {Toronto} 88 location = {Toronto}
89} 89}
90 90
91@software{pkg:lua-ul,
92 title = {The Lua-ul package},
93 subtitle = {Underlining for LuaLaTeX},
94 author = {Krüger, Marcel},
95 maintainer = {Krüger, Marcel},
96 url = {http://www.ctan.org/pkg/lua-ul},
97 date = {2020-03-12},
98 version = {0.0.1}
99}
100
91@MVBook{Wright, 101@MVBook{Wright,
92 author = {Wright, W. LL.D}, 102 author = {Wright, W. LL.D},
93 title = {A Grammar of the Arabic Language}, 103 title = {A Grammar of the Arabic Language},
@@ -156,7 +166,7 @@
156\babelfont{sf}{NewComputerModern Sans} 166\babelfont{sf}{NewComputerModern Sans}
157\babelfont{tt}{NewComputerModern Mono} 167\babelfont{tt}{NewComputerModern Mono}
158\usepackage{metalogox} 168\usepackage{metalogox}
159\usepackage{arabluatex}[2020/02/29] 169\usepackage{arabluatex}[2020/03/15]
160\SetArbUp{\textsuperscript{\thinspace#1}} % Old Standard needs this 170\SetArbUp{\textsuperscript{\thinspace#1}} % Old Standard needs this
161\usepackage[nopar]{quran} 171\usepackage[nopar]{quran}
162\usepackage[noindex]{nameauth} 172\usepackage[noindex]{nameauth}
@@ -259,7 +269,7 @@
259%</driver> 269%</driver>
260% \fi 270% \fi
261% 271%
262% \CheckSum{1006} 272% \CheckSum{1014}
263% 273%
264% \CharacterTable 274% \CharacterTable
265% {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 275% {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 @@
2043% Arabic environments. In that case, \package{arabluatex} does not 2053% Arabic environments. In that case, \package{arabluatex} does not
2044% print the stroke as a distinctive mark over the number for it is 2054% print the stroke as a distinctive mark over the number for it is
2045% not surrounded by other Arabic words. In case one nonetheless 2055% not surrounded by other Arabic words. In case one nonetheless
2046% wishes to print the stroke, he can either use the \cs{aemph} 2056% wishes to print the stroke, he can either use the \cs{aoline*}
2047% command that is described below in \vref{sec:emphasis} or insert 2057% command that is described below in \vref{sec:underlining} or
2048% the \arb[trans]{'ab^gad} number in |\arb[novoc]{}|:--- 2058% insert the \arb[trans]{'ab^gad} number in |\arb[novoc]{}|:---
2049% \begin{quote} 2059% \begin{quote}
2050% |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is| 2060% |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is|
2051% |\abjad{1874}| The \arb[trans]{'abjad} number for 1874 is 2061% |\abjad{1874}| The \arb[trans]{'abjad} number for 1874 is
2052% \abjad{1874}. 2062% \abjad{1874}.
2053% 2063%
2054% |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is| 2064% |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is|
2055% |\aemph*{\abjad{1874}}| The \arb[trans]{'abjad} number for 1874 2065% |\aoline*{\abjad{1874}}| The \arb[trans]{'abjad} number for 1874
2056% is \aemph*{\abjad{1874}}. 2066% is \aoline*{\abjad{1874}}.
2057% 2067%
2058% |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is| 2068% |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is|
2059% |\arb[novoc]{\abjad{1874}}| The \arb[trans]{'abjad} number for 2069% |\arb[novoc]{\abjad{1874}}| The \arb[trans]{'abjad} number for
@@ -2153,7 +2163,23 @@
2153% \arb[voc]{\abjad{45}: kitAbu-hu \aemph*{fI 'l-`AdAt-i}} 2163% \arb[voc]{\abjad{45}: kitAbu-hu \aemph*{fI 'l-`AdAt-i}}
2154% \arb[trans]{\abjad{45}: kitAbu-hu \aemph*{fI 'l-\uc{`AdAt-i}}}. 2164% \arb[trans]{\abjad{45}: kitAbu-hu \aemph*{fI 'l-\uc{`AdAt-i}}}.
2155% \end{quoting} 2165% \end{quoting}
2156% 2166%
2167% \subsubsection{Underlining words or numbers}
2168% \label{sec:underlining}
2169% \DescribeMacro{\aoline}%
2170% \DescribeMacro{\aoline*}%
2171% \DescribeMacro{\auline}%
2172% \NEWfeature{v1.19}Three additional, non context-sensitive commands
2173% are provided to distinguish words or numbers:---
2174% \begin{enumerate}
2175% \item \cs{aoline}, which is equivalent to \cs{aemph*} described
2176% above.
2177% \item \cs{aoline*}, which is the same as \cs{aoline}, but better
2178% suited for \arb[trans]{'ab^gad} numbers.\footnote{See the example
2179% provided above \vref{sec:abjad}.}
2180% \item \cs{auline}, which can be used to underline Arabic words.
2181% \end{enumerate}
2182%
2157% \section{Arabic poetry} 2183% \section{Arabic poetry}
2158% \label{sec:poetry} 2184% \label{sec:poetry}
2159% \NEWfeature{v1.6} \package{arabluatex} provides a special 2185% \NEWfeature{v1.6} \package{arabluatex} provides a special
@@ -2621,16 +2647,25 @@
2621% 2647%
2622% It is encoded |&| in Arab\TeX\ scheme. 2648% It is encoded |&| in Arab\TeX\ scheme.
2623% 2649%
2624% In the following example, the \cs{uline} command would have 2650% In elegantly printed books where many of the letters are interwoven
2625% prevented adjacent Arabic letters from being connected if the 2651% with one another so as to form ligatures, it may be convenient to
2626% \enquote*{Zero width joiner} had not been used:---% 2652% bring the letters into line in some instances. In the following
2653% example, the \enquote*{zero width joiner} is used to prevent two
2654% adjacent letters, viz.\ \arb[novoc]{s} and \arb[novoc]{.h}, from
2655% standing one above the other in the name of \prname{'is.h_aq}
2656% (\arb[fullvoc]{'is.h_aq"}):\footnote{\cs{underLine} and
2657% \cs{highLight} are taken from the \package{lua-ul} package which is
2658% loaded by \package{arabluatex}. See \textcite{pkg:lua-ul}.}---
2627% \iffalse 2659% \iffalse
2628%<*example> 2660%<*example>
2629% \fi 2661% \fi
2630\begin{example} 2662\begin{example}
2631 \begin{arab}[fullvoc] 2663 \begin{arab}[fullvoc]
2632 huwa 'abU zaydiN .hunaynu bnu 'is.h_aqa 'l-`a&\uline{&bA}diyyu 2664 huwa 'abU zaydiN .hunaynu bnu 'is&\underLine{&.h_a}qa
2633 bi-fat.hi 'l-`ayni wa-ta_hfIfi 'l-bA'i. 2665 'l-`a\underLine{bA}diyyu bi-fat.hi 'l-`ayni wa-ta_hfIfi 'l-bA'i.
2666
2667 huwa 'abU zaydiN .hunaynu bnu 'is&\highLight{&.h_a}qa
2668 'l-`a\highLight{bA}diyyu bi-fat.hi 'l-`ayni wa-ta_hfIfi 'l-bA'i.
2634 \end{arab} 2669 \end{arab}
2635\end{example} 2670\end{example}
2636% \iffalse 2671% \iffalse
@@ -4363,8 +4398,7 @@
4363\RequirePackage{xparse} 4398\RequirePackage{xparse}
4364\RequirePackage{adjustbox} 4399\RequirePackage{adjustbox}
4365\RequirePackage{xstring} 4400\RequirePackage{xstring}
4366\PassOptionsToPackage{normalem}{ulem} 4401\RequirePackage{lua-ul}
4367\RequirePackage{ulem}
4368% \end{macrocode} 4402% \end{macrocode}
4369% The following boolean will be set to |true| in |RL| mode: 4403% The following boolean will be set to |true| in |RL| mode:
4370% \begin{macrocode} 4404% \begin{macrocode}
@@ -4440,16 +4474,28 @@
4440% \begin{macro}{\aemph} Arabic emphasis. Needs to be redefined as 4474% \begin{macro}{\aemph} Arabic emphasis. Needs to be redefined as
4441% well. The function is actually coded in Lua. 4475% well. The function is actually coded in Lua.
4442% \changes{v1.16}{2018/11/06}{Now uses \textsf{ulem}} 4476% \changes{v1.16}{2018/11/06}{Now uses \textsf{ulem}}
4477% \changes{v1.19}{2020/03/15}{Now uses \textsf{lua-ul}}
4443% \begin{macro}{\aemph*} The \enquote*{starred} version of this 4478% \begin{macro}{\aemph*} The \enquote*{starred} version of this
4444% command alway puts the stroke over its argument. 4479% command alway puts the stroke over its argument.
4445% \changes{v1.9.2}{2017/10/24}{Starred version which always puts the 4480% \changes{v1.9.2}{2017/10/24}{Starred version which always puts the
4446% stroke over its argument}As of v1.16 \package{arabluatex} uses 4481% stroke over its argument}As of v1.19, \package{arabluatex} uses
4447% \package{ulem} to render the strokes, thus allowing line breaks 4482% \package{lua-ul} to render the strokes, thus allowing line breaks
4448% and manual hyphenation for transliterated Arabic. 4483% and manual hyphenation for transliterated Arabic.
4484% \begin{macro}{\aoline}
4485% \begin{macro}{\aoline*}
4486% \begin{macro}{\auline}
4487% \changes{v1.19}{2020/03/15}{Non context-sensitive command to
4488% underline Arabic words is provided}\cs{aoline} and \cs{auline}
4489% derive from \cs{newunderlinetype} provided by the \package{lua-ul}
4490% package whereas \cs{aoline*}, which uses \cs{overline} in math-mode,
4491% is better suited for so-called \arb[trans]{'ab^gad} numbers.
4449% \begin{macrocode} 4492% \begin{macrocode}
4450\def\oline{\@ifstar\@oline\@@oline} 4493\newunderlinetype\@aoverLine{\leaders\vrule height 3ex depth -2.9ex}
4451\def\@oline#1{\ensuremath{\overline{\mbox{#1}}}} 4494\def\aoline{\@ifstar\@aoline\@@aoline}
4452\def\@@oline{\bgroup \ULdepth=-3ex \ULset} 4495\def\@aoline#1{\ensuremath{\overline{\mbox{#1}}}}
4496\def\@@aoline#1{{\@aoverLine#1}}
4497\newunderlinetype\@aunderLine{\leaders\vrule height -.65ex depth .75ex}
4498\def\auline#1{{\@aunderLine#1}}
4453\AtBeginDocument{\ifdef{\aemph}% 4499\AtBeginDocument{\ifdef{\aemph}%
4454 {\RenewDocumentCommand{\aemph}{s m}{% 4500 {\RenewDocumentCommand{\aemph}{s m}{%
4455 \IfBooleanTF{#1}{% 4501 \IfBooleanTF{#1}{%
@@ -4466,6 +4512,9 @@
4466% \end{macrocode} 4512% \end{macrocode}
4467% \end{macro} 4513% \end{macro}
4468% \end{macro} 4514% \end{macro}
4515% \end{macro}
4516% \end{macro}
4517% \end{macro}
4469% \begin{macro}{\arbcolor}\changes{v1.12}{2018/06/24}{Standard color 4518% \begin{macro}{\arbcolor}\changes{v1.12}{2018/06/24}{Standard color
4470% command for Arabic environments} 4519% command for Arabic environments}
4471% \cs{arbcolor}\oarg{color}\marg{Arabic text} takes the Arabic text to 4520% \cs{arbcolor}\oarg{color}\marg{Arabic text} takes the Arabic text to
@@ -4942,13 +4991,13 @@
4942 \ifdefined\abjad% 4991 \ifdefined\abjad%
4943 \RenewDocumentCommand{\abjad}{m}% 4992 \RenewDocumentCommand{\abjad}{m}%
4944 {\ifbool{al@rlmode}% 4993 {\ifbool{al@rlmode}%
4945 {\oline*{% 4994 {\aoline*{%
4946 \luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}} 4995 \luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}}
4947 {\luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}} 4996 {\luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}}
4948 \else% 4997 \else%
4949 \NewDocumentCommand{\abjad}{m}% 4998 \NewDocumentCommand{\abjad}{m}%
4950 {\ifbool{al@rlmode}% 4999 {\ifbool{al@rlmode}%
4951 {\oline*{% 5000 {\aoline*{%
4952 \luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}} 5001 \luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}}
4953 {\luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}} 5002 {\luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}}
4954 \fi} 5003 \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)
724 bbody = string.sub(bbody, 2, -2) 724 bbody = string.sub(bbody, 2, -2)
725 if tonumber(bbody) ~= nil then 725 if tonumber(bbody) ~= nil then
726 bbody = arabluatex.abjadify(bbody) 726 bbody = arabluatex.abjadify(bbody)
727 return string.format("\\oline*{\\arb[novoc]{%s}}", bbody) 727 return string.format("\\aoline*{\\arb[novoc]{%s}}", bbody)
728 else 728 else
729 return string.format("%s{%s}", btag, bbody) 729 return string.format("%s{%s}", btag, bbody)
730 end 730 end
@@ -1183,12 +1183,12 @@ end
1183 1183
1184function arabluatex.aemph(str, opt) 1184function arabluatex.aemph(str, opt)
1185 if tex.textdir == "TRT" then 1185 if tex.textdir == "TRT" then
1186 str = "\\oline{\\textdir TRT{}"..str.."}" 1186 str = "\\aoline{\\textdir TRT{}"..str.."}"
1187 elseif tex.textdir == "TLT" then 1187 elseif tex.textdir == "TLT" then
1188 if opt == "over" then 1188 if opt == "over" then
1189 str = "\\oline{"..str.."}" 1189 str = "\\aoline{"..str.."}"
1190 else 1190 else
1191 str = "\\uline{"..str.."}" 1191 str = "\\auline{"..str.."}"
1192 end 1192 end
1193 end 1193 end
1194 return str 1194 return str