diff options
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty | 70 |
1 files changed, 55 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty index f5d9d08fbe6..a7c85007d86 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty @@ -11,7 +11,7 @@ %% This file is part of the `arabluatex' package %% %% ArabLuaTeX -- Processing ArabTeX notation under LuaLaTeX -%% Copyright (C) 2016--2019 Robert Alessi +%% Copyright (C) 2016--2020 Robert Alessi %% %% Please send error reports and suggestions for improvements to Robert %% Alessi <alessi@robertalessi.net> @@ -41,15 +41,9 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{arabluatex} - [2019/03/24 v1.17 An ArabTeX-like interface for LuaLaTeX] -\RequirePackage{ifluatex} -\ifluatex\else - \PackageError{arabluatex}{lualatex needed}{% - Package `arabluatex' needs LuaTeX.\MessageBreak - So you should use `lualatex' to process your document.\MessageBreak - See documentation of `arabluatex' for further information.}% - \expandafter\expandafter\expandafter\csname endinput\endcsname -\fi + [2020/02/29 v1.18 An ArabTeX-like interface for LuaLaTeX] +\RequirePackage{iftex} +\RequireLuaTeX \RequirePackage{xkeyval} \DeclareOptionX{voc}{\def\al@mode{voc}} \DeclareOptionX{fullvoc}{\def\al@mode{fullvoc}} @@ -81,9 +75,10 @@ \providebool{al@rlmode} \luadirect{dofile(kpse.find_file("arabluatex.lua"))} \AtBeginDocument{\ifdefined\arabicfont\relax\else -\PackageWarning{arabluatex}{\string\arabicfont\ is not defined.^^J - I will try to load Amiri}% -\newfontfamily\arabicfont[Script=Arabic]{Amiri}\fi}% + \PackageInfo{arabluatex}{% + \string\arabicfont\ is not defined.\MessageBreak + arabluatex will try to load Amiri}% + \newfontfamily\arabicfont{Amiri}[Script=Arabic]\fi}% \AtBeginDocument{\def\setRL{\booltrue{al@rlmode}\pardir TRT% \textdir TRT}} \AtBeginDocument{\def\setLR{\boolfalse{al@rlmode}\pardir TLT% @@ -149,6 +144,7 @@ \bgroup\SetTranslitStyle{\relax}% \IfBooleanTF{#1}{\txtrans{#2}}{\arb[trans]{\uc{#2}}}\egroup} \NewDocumentCommand{\txarb}{+m}{% + \ifvmode\leavevmode\fi% \bgroup\textdir TRT\arabicfont#1\egroup} \NewDocumentCommand{\txtrans}{+m}{% \bgroup\textdir TLT\al@trans@font\al@trans@style#1\egroup} @@ -156,19 +152,26 @@ \par% \booltrue{al@rlmode}% \pardir TRT\textdir TRT\arabicfont}{\par} +\NewDocumentEnvironment{txarabtr}{}{% + \par% + \pardir TLT\textdir TLT% + \al@trans@font\al@trans@style}{\par} \NewDocumentCommand{\arb}{O{\al@mode} +m}% {\edef\@tempa{#1}% \ifx\@tempa\al@mode@voc% + \ifvmode\leavevmode\fi% \bgroup\booltrue{al@rlmode}\textdir TRT\arabicfont% \luadirect{tex.sprint(arabluatex.processvoc(\luastringN{#2}, \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% \else% \ifx\@tempa\al@mode@fullvoc% + \ifvmode\leavevmode\fi% \bgroup\booltrue{al@rlmode}\textdir TRT\arabicfont% \luadirect{tex.sprint(arabluatex.processfullvoc(\luastringN{#2}, \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% \else% \ifx\@tempa\al@mode@novoc% + \ifvmode\leavevmode\fi% \bgroup\booltrue{al@rlmode}\textdir TRT\arabicfont% \luadirect{tex.sprint(arabluatex.processnovoc(\luastringN{#2}, \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% @@ -190,7 +193,7 @@ \NewDocumentCommand{\newarbmark}{m m m}{% \luadirect{arabluatex.newarbmark(\luastringN{#1}, \luastringN{#2}, \luastringN{#3})}} -\NewDocumentEnvironment{arab}{O{\al@mode} +b}% +\NewDocumentEnvironment{arab}{!O{\al@mode} +b}% {\par\edef\@tempa{#1}% \ifx\@tempa\al@mode@voc% \booltrue{al@rlmode}% @@ -232,7 +235,7 @@ trans}{\def\al@mode{#1}} \presetkeys[al]{verse}{metre={}, utf=false, delim=false}{} -\NewDocumentEnvironment{arabverse}{O{}}% +\NewDocumentEnvironment{arabverse}{!O{}}% {\bgroup\setkeys[al]{verse}[width, gutter, color, utf, delim, metre]{#1}% \if@pkg@export\ifal@verse@export% @@ -297,6 +300,43 @@ \adjustbox{width=\al@bayt@width, height=\Height}{\arb@utf{#4}}% \ifdefined\spewnotes\spewnotes\else\fi% } +\NewDocumentCommand{\SetDefaultIndex}{m}{ + \edef\@tempa{#1} + \ifx\@tempa\empty + \def\al@default@index{\jobname} + \else + \def\al@default@index{#1} + \fi +} +\def\al@index@mode{\al@mode} +\NewDocumentCommand{\SetIndexMode}{m}{ + \def\al@index@mode{#1} +} +\define@cmdkeys[al]{index}[alind@]{index,root,form} +\NewDocumentCommand{\arind}{o m}{% + \IfNoValueTF{#1}{% + \ifdefined\al@default@index% + \csname index\endcsname[\al@default@index]{#2}% + \else% + \csname index\endcsname{#2}% + \fi% + }{% + \bgroup + \setkeys[al]{index}{#1}% + \def\al@one{% + \ifdefined\alind@root!\LR{\alind@root}\else!\LR{1}\fi}% + \def\al@two{% + \ifdefined\alind@form @\arb[\al@index@mode]{\alind@form}\else\fi}% + \ifdefined\alind@index% + \csname index\endcsname[\alind@index]{#2\al@one\al@two}% + \else% + \ifdefined\al@default@index% + \csname index\endcsname[\al@default@index]{#2\al@one\al@two}% + \else% + \csname index\endcsname{#2\al@one\al@two}% + \fi% + \fi% + \egroup}} \AtBeginDocument{% \ifdefined\abjad% \RenewDocumentCommand{\abjad}{m}% |