aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2018-11-06 10:56:20 +0100
committerRobert Alessi <alessi@robertalessi.net>2018-11-06 10:56:20 +0100
commit17be6d449481e7580f18825b342fbef97d13b067 (patch)
tree8f387cfb968938da77bc71047925ecf4545ad64f
parent4a37f31851d48d04c9d9ddebdd124146fd7760df (diff)
downloadarabluatex-17be6d449481e7580f18825b342fbef97d13b067.tar.gz
make \aemph use ulem instead of \overline and \underline
-rw-r--r--arabluatex.dtx22
-rw-r--r--arabluatex.lua8
2 files changed, 21 insertions, 9 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx
index 5ccf530..89ab60a 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -2053,8 +2053,9 @@ word that \cs{arbnull} is applied to.
2053% Arabic environments. In that case, \package{arabluatex} does not 2053% Arabic environments. In that case, \package{arabluatex} does not
2054% 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
2055% not surrounded by other Arabic words. In case one nonetheless 2055% not surrounded by other Arabic words. In case one nonetheless
2056% wishes to print the stroke, he can use the \cs{aemph} command that 2056% wishes to print the stroke, he can either use the \cs{aemph}
2057% is described below in \vref{sec:emphasis}:--- 2057% command that is described below in \vref{sec:emphasis} or insert
2058% the \arb[trans]{'ab^gad} number in |\arb[novoc]{}|:---
2058% \begin{quote} 2059% \begin{quote}
2059% |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is| 2060% |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is|
2060% |\abjad{1874}| The \arb[trans]{'abjad} number for 1874 is 2061% |\abjad{1874}| The \arb[trans]{'abjad} number for 1874 is
@@ -2063,6 +2064,10 @@ word that \cs{arbnull} is applied to.
2063% |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is| 2064% |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is|
2064% |\aemph*{\abjad{1874}}| The \arb[trans]{'abjad} number for 1874 2065% |\aemph*{\abjad{1874}}| The \arb[trans]{'abjad} number for 1874
2065% is \aemph*{\abjad{1874}}. 2066% is \aemph*{\abjad{1874}}.
2067%
2068% |The| |\arb[trans]{'abjad}| |number| |for| |1874| |is|
2069% |\arb[novoc]{\abjad{1874}}| The \arb[trans]{'abjad} number for
2070% 1874 is \arb[novoc]{\abjad{1874}}.
2066% \end{quote} 2071% \end{quote}
2067% \end{quoting} 2072% \end{quoting}
2068% 2073%
@@ -4349,6 +4354,7 @@ wa-ya.sIru ta.hta 'l-jild-i
4349\RequirePackage{environ} 4354\RequirePackage{environ}
4350\RequirePackage{adjustbox} 4355\RequirePackage{adjustbox}
4351\RequirePackage{xstring} 4356\RequirePackage{xstring}
4357\RequirePackage[normalem]{ulem}
4352% \end{macrocode} 4358% \end{macrocode}
4353% The following boolean will be set to |true| in |RL| mode: 4359% The following boolean will be set to |true| in |RL| mode:
4354% \begin{macrocode} 4360% \begin{macrocode}
@@ -4420,11 +4426,17 @@ wa-ya.sIru ta.hta 'l-jild-i
4420% \end{macro} 4426% \end{macro}
4421% \begin{macro}{\aemph} Arabic emphasis. Needs to be redefined as 4427% \begin{macro}{\aemph} Arabic emphasis. Needs to be redefined as
4422% well. The function is actually coded in Lua. 4428% well. The function is actually coded in Lua.
4429% \changes{v1.16}{2018/11/06}{Now uses \textsf{ulem}}
4423% \begin{macro}{\aemph*} The \enquote*{starred} version of this 4430% \begin{macro}{\aemph*} The \enquote*{starred} version of this
4424% command alway puts the stroke over its argument. 4431% command alway puts the stroke over its argument.
4425% \changes{v1.9.2}{2017/10/24}{Starred version which always puts the 4432% \changes{v1.9.2}{2017/10/24}{Starred version which always puts the
4426% stroke over its argument} 4433% stroke over its argument}As of v1.16 \package{arabluatex} uses
4434% \package{ulem} to render the strokes, thus allowing line breaks
4435% and manual hyphenation for transliterated Arabic.
4427% \begin{macrocode} 4436% \begin{macrocode}
4437\def\oline{\@ifstar\@oline\@@oline}
4438\newcommand{\@oline}[1]{$\overline{\text{#1}}$}
4439\def\@@oline{\bgroup \ULdepth=-3ex \ULset}
4428\AtBeginDocument{\ifdef{\aemph}% 4440\AtBeginDocument{\ifdef{\aemph}%
4429 {\RenewDocumentCommand{\aemph}{s m}{% 4441 {\RenewDocumentCommand{\aemph}{s m}{%
4430 \IfBooleanTF{#1}{% 4442 \IfBooleanTF{#1}{%
@@ -4845,12 +4857,12 @@ wa-ya.sIru ta.hta 'l-jild-i
4845 \ifdefined\abjad% 4857 \ifdefined\abjad%
4846 \RenewDocumentCommand{\abjad}{m}% 4858 \RenewDocumentCommand{\abjad}{m}%
4847 {\ifbool{al@rlmode}% 4859 {\ifbool{al@rlmode}%
4848 {\aemph{\luadirect{tex.sprint(abjadify(\luastring{#1}))}}} 4860 {\oline*{\luadirect{tex.sprint(abjadify(\luastring{#1}))}}}
4849 {\luadirect{tex.sprint(abjadify(\luastring{#1}))}}} 4861 {\luadirect{tex.sprint(abjadify(\luastring{#1}))}}}
4850 \else% 4862 \else%
4851 \NewDocumentCommand{\abjad}{m}% 4863 \NewDocumentCommand{\abjad}{m}%
4852 {\ifbool{al@rlmode}% 4864 {\ifbool{al@rlmode}%
4853 {\aemph{\luadirect{tex.sprint(abjadify(\luastring{#1}))}}} 4865 {\oline*{\luadirect{tex.sprint(abjadify(\luastring{#1}))}}}
4854 {\luadirect{tex.sprint(abjadify(\luastring{#1}))}}} 4866 {\luadirect{tex.sprint(abjadify(\luastring{#1}))}}}
4855 \fi} 4867 \fi}
4856% \end{macrocode} 4868% \end{macrocode}
diff --git a/arabluatex.lua b/arabluatex.lua
index 66bbbde..43167eb 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -705,7 +705,7 @@ local function processarbtoutf(str)
705 bbody = string.sub(bbody, 2, -2) 705 bbody = string.sub(bbody, 2, -2)
706 if tonumber(bbody) ~= nil then 706 if tonumber(bbody) ~= nil then
707 bbody = abjadify(bbody) 707 bbody = abjadify(bbody)
708 return string.format("\\aemph{\\arb[novoc]{%s}}", bbody) 708 return string.format("\\oline*{\\arb[novoc]{%s}}", bbody)
709 else 709 else
710 return string.format("%s{%s}", btag, bbody) 710 return string.format("%s{%s}", btag, bbody)
711 end 711 end
@@ -1149,12 +1149,12 @@ end
1149 1149
1150function aemph(str, opt) 1150function aemph(str, opt)
1151 if tex.textdir == "TRT" then 1151 if tex.textdir == "TRT" then
1152 str = "$\\overline{\\text{\\textdir TRT{}"..str.."}}$" 1152 str = "\\oline{\\textdir TRT{}"..str.."}"
1153 elseif tex.textdir == "TLT" then 1153 elseif tex.textdir == "TLT" then
1154 if opt == "over" then 1154 if opt == "over" then
1155 str = "$\\overline{\\text{"..str.."}}$" 1155 str = "\\oline{"..str.."}"
1156 else 1156 else
1157 str = "$\\underline{\\text{"..str.."}}$" 1157 str = "\\uline{"..str.."}"
1158 end 1158 end
1159 end 1159 end
1160 return str 1160 return str