diff options
author | Karl Berry <karl@freefriends.org> | 2018-06-26 21:55:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-06-26 21:55:06 +0000 |
commit | 775480ef50d7ef9930bb2432b3f08611ce683f01 (patch) | |
tree | a61b08c56f979f1f81003a6551e087b13b00561d /Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty | |
parent | a781f9769e9b30ef860595d168a44217c2c57734 (diff) |
arabluatex (26jun18)
git-svn-id: svn://tug.org/texlive/trunk@48094 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty index de0afaba955..67485aaf4c3 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty @@ -41,7 +41,7 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{arabluatex}% -[2018/03/31 v1.11 An ArabTeX-like interface for LuaLaTeX] +[2018/06/24 v1.12 An ArabTeX-like interface for LuaLaTeX] \RequirePackage{ifluatex} \ifluatex\else \PackageError{arabluatex}{lualatex needed}{% @@ -61,6 +61,8 @@ \def\al@mode@fullvoc{fullvoc} \def\al@mode@novoc{novoc} \def\al@mode@trans{trans} +\RequirePackage{xcolor} +\RequirePackage{luacolor} \RequirePackage{etoolbox} \RequirePackage{arabluatex-patch} \RequirePackage{fontspec} @@ -71,7 +73,6 @@ \RequirePackage{adjustbox} \newbool{al@rlmode} \luadirect{dofile(kpse.find_file("arabluatex.lua"))} -\luadirect{tex.enableprimitives("luatex",tex.extraprimitives("omega"))} \AtBeginDocument{\ifdefined\arabicfont\relax\else \PackageWarning{arabluatex}{\string\arabicfont\ is not defined.^^JI will try to load Amiri}% @@ -84,17 +85,22 @@ \AtBeginDocument{\ifdef{\RL}% {\RenewDocumentCommand{\RL}{m}{\bgroup\textdir TRT\rmfamily#1\egroup}} {\NewDocumentCommand{\RL}{m}{\bgroup\textdir TRT#1\rmfamily\egroup}}} -\DeclareDocumentCommand{\MkArbBreak}{m}{% - \luadirect{mkarbbreak(\luastringN{#1})}} +\NewDocumentCommand{\MkArbBreak}{s m}{% + \IfBooleanTF{#1} + {\luadirect{mkarbbreak(\luastringN{#2}, "out")}} + {\luadirect{mkarbbreak(\luastringN{#2}, "dflt")}} +} \AtBeginDocument{\ifdef{\aemph}% {\RenewDocumentCommand{\aemph}{s m}{% \IfBooleanTF{#1}{% - $\overline{\text{#2}}$} - {\luadirect{tex.sprint(aemph(\luastringN{#2}))}}}} + \luadirect{tex.sprint(aemph(\luastringN{#2}, "over"))}} + {\luadirect{tex.sprint(aemph(\luastringN{#2}, "dflt"))}}}} {\NewDocumentCommand{\aemph}{s m}{% \IfBooleanTF{#1}{% - $\overline{\text{#2}}$} - {\luadirect{tex.sprint(aemph(\luastringN{#2}))}}}}} + \luadirect{tex.sprint(aemph(\luastringN{#2}, "over"))}} + {\luadirect{tex.sprint(aemph(\luastringN{#2}, "dflt"))}}}}} +\NewDocumentCommand{\arbcolor}{o m}{% + \IfNoValueTF{#1}{#2}{\textcolor{#1}{#2}}} \def\al@input@scheme{arabtex} \NewDocumentCommand{\SetInputScheme}{m}{\def\al@input@scheme{#1}} \def\al@arb@rules{dflt} @@ -126,7 +132,7 @@ \NewDocumentCommand{\txarb}{+m}{\bgroup\textdir TRT\arabicfont#1\egroup} \NewDocumentCommand{\txtrans}{+m}{\bgroup\textdir - TLT\al@trans@font#1\egroup} + TLT\al@trans@font\al@trans@style#1\egroup} \NewDocumentEnvironment{txarab}{}{% \par% \booltrue{al@rlmode}% @@ -134,19 +140,25 @@ \NewDocumentCommand{\arb}{O{\al@mode} +m}% {\edef\@tempa{#1}% \ifx\@tempa\al@mode@voc% + \booltrue{al@rlmode}% \bgroup\textdir TRT\arabicfont% \luadirect{tex.sprint(processvoc(\luastringN{#2}, \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% + \boolfalse{al@rlmode}% \else% \ifx\@tempa\al@mode@fullvoc% + \booltrue{al@rlmode}% \bgroup\textdir TRT\arabicfont% \luadirect{tex.sprint(processfullvoc(\luastringN{#2}, \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% + \boolfalse{al@rlmode}% \else% \ifx\@tempa\al@mode@novoc% + \booltrue{al@rlmode}% \bgroup\textdir TRT\arabicfont% \luadirect{tex.sprint(processnovoc(\luastringN{#2}, \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% + \boolfalse{al@rlmode}% \else% \ifx\@tempa\al@mode@trans% \bgroup\textdir TLT\al@trans@style% @@ -243,15 +255,22 @@ \AtBeginDocument{% \ifdefined\abjad% \RenewDocumentCommand{\abjad}{m}% - {\luadirect{tex.sprint(abjadify(#1))}}% + {\ifbool{al@rlmode}% + {\aemph{\luadirect{tex.sprint(abjadify(\luastring{#1}))}}} + {\luadirect{tex.sprint(abjadify(\luastring{#1}))}}} \else% \NewDocumentCommand{\abjad}{m}% - {\luadirect{tex.sprint(abjadify(#1))}} -\fi} + {\ifbool{al@rlmode}% + {\aemph{\luadirect{tex.sprint(abjadify(\luastring{#1}))}}} + {\luadirect{tex.sprint(abjadify(\luastring{#1}))}}} + \fi} \NewDocumentCommand{\arbnull}{m}{\relax} \NewDocumentCommand{\abraces}{+m}{% \luadirect{tex.sprint(abraces(\luastringN{#1}))}} -\DeclareDocumentCommand{\LRmarginpar}{m}{\marginpar{\textdir TLT #1}} +\DeclareDocumentCommand{\LRmarginpar}{o m}{% + \IfNoValueTF{#1} + {\marginpar{\textdir TLT #2}} + {\marginpar[\textdir TLT #1]{\textdir TLT #2}}} \DeclareDocumentCommand{\LRfootnote}{m}{\bgroup\pardir TLT\textdir TLT\footnote{#1}\egroup} \DeclareDocumentCommand{\RLfootnote}{m}{\bgroup\pardir @@ -261,6 +280,15 @@ {\AtBeginDocument{\deffootnote{2em}{1.6em}{\LR{\thefootnotemark}.\enskip}}}% {\RequirePackage{scrextend} \AtBeginDocument{\deffootnote{2em}{1.6em}{\LR{\thefootnotemark}.\enskip}}}} +\newcommand{\al@warning}[1]{\PackageWarning{arabluatex}{#1}} +\newcommand{\al@error}[2]{\PackageError{arabluatex}{#1}{#2}} +\newcommand{\al@wrong@nesting}{\al@error{% + (RL/LR)\string\footnote\space is not allowed\MessageBreak inside + \string\RL{} and \string\RL{} commands}{% + Get rid of the surrounding \string\RL{} or \string\LR{} command.}} +\newcommand{\al@wrong@mark}{\al@warning{% + Unknown Arabic mark in \string\arbmark{}. Replaced + with\MessageBreak <??>. Please check your code}} \endinput %% %% End of file `arabluatex.sty'. |