summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/arabluatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-11-14 22:35:32 +0000
committerKarl Berry <karl@freefriends.org>2016-11-14 22:35:32 +0000
commita52d9f0e68444976ad0c87a021f58708f838b1da (patch)
treecc7fd15178d57a3c51c701f4dc25e13ac868ba45 /Master/texmf-dist/tex/lualatex/arabluatex
parentb23c4beb8524e95bcf6c111696cc20f4080530ef (diff)
arabluatex (14nov16)
git-svn-id: svn://tug.org/texlive/trunk@42510 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/arabluatex')
-rw-r--r--Master/texmf-dist/tex/lualatex/arabluatex/arabluatex-patch.sty136
-rw-r--r--Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua13
-rw-r--r--Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty20
-rw-r--r--Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua8
4 files changed, 171 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex-patch.sty b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex-patch.sty
new file mode 100644
index 00000000000..68f05a3b05a
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex-patch.sty
@@ -0,0 +1,136 @@
+%%
+%% This is file `arabluatex-patch.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% arabluatex.dtx (with options: `patch')
+%%
+%% This is a generated file.
+%%
+%% This file is part of the `arabluatex' package
+%%
+%% ArabLuaTeX -- Processing ArabTeX notation under LuaLaTeX
+%% Copyright (C) 2016 Robert Alessi
+%%
+%% Please send error reports and suggestions for improvements to Robert
+%% Alessi <alessi@robertalessi.net>
+%%
+%% This program is free software: you can redistribute it and/or modify
+%% it under the terms of the GNU General Public License as published by
+%% the Free Software Foundation, either version 3 of the License, or
+%% (at your option) any later version.
+%%
+%% This program is distributed in the hope that it will be useful, but
+%% WITHOUT ANY WARRANTY; without even the implied warranty of
+%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%% General Public License for more details.
+%%
+%% You should have received a copy of the GNU General Public License
+%% along with this program. If not, see
+%% <http://www.gnu.org/licenses/>.
+%%
+%% This release of 'arabluatex' consists of the following source files:
+%% - arabluatex.ins
+%% - arabluatex.dtx
+%% - arabluatex.lua
+%% - arabluatex_voc.lua
+%% - arabluatex_fullvoc.lua
+%% - arabluatex_novoc.lua
+%% - arabluatex_trans.lua
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{arabluatex-patch}%
+[2016/11/14 v1.0 patches for arabluatex]
+\def\list#1#2{%
+ \ifnum \@listdepth >5\relax
+ \@toodeep
+ \else
+ \global\advance\@listdepth\@ne
+ \fi
+ \rightmargin\z@
+ \listparindent\z@
+ \itemindent\z@
+ \csname @list\romannumeral\the\@listdepth\endcsname
+ \def\@itemlabel{#1}%
+ \let\makelabel\@mklab
+ \@nmbrlistfalse
+ #2\relax
+ \@trivlist
+ \parskip\parsep
+ \parindent\listparindent
+ \advance\linewidth -\rightmargin
+ \advance\linewidth -\leftmargin
+ \ifbool{al@rlmode}{\advance\@totalleftmargin \rightmargin}%
+ {\advance\@totalleftmargin \leftmargin}
+ \parshape \@ne \@totalleftmargin \linewidth
+ \ignorespaces}
+\def\@item[#1]{%
+ \if@noparitem
+ \@donoparitem
+ \else
+ \if@inlabel
+ \indent \par
+ \fi
+ \ifhmode
+ \unskip\unskip \par
+ \fi
+ \if@newlist
+ \if@nobreak
+ \@nbitem
+ \else
+ \addpenalty\@beginparpenalty
+ \addvspace\@topsep
+ \addvspace{-\parskip}%
+ \fi
+ \else
+ \addpenalty\@itempenalty
+ \addvspace\itemsep
+ \fi
+ \global\@inlabeltrue
+ \fi
+ \everypar{%
+ \@minipagefalse
+ \global\@newlistfalse
+ \if@inlabel
+ \global\@inlabelfalse
+ {\setbox\z@\lastbox
+ \ifvoid\z@
+ \kern-\itemindent
+ \fi}%
+ \box\@labels
+ \penalty\z@
+ \fi
+ \if@nobreak
+ \@nobreakfalse
+ \clubpenalty \@M
+ \else
+ \clubpenalty \@clubpenalty
+ \everypar{}%
+ \fi}%
+ \if@noitemarg
+ \@noitemargfalse
+ \if@nmbrlist
+ \refstepcounter\@listctr
+ \fi
+ \fi
+ \ifbool{al@rlmode}{\sRLbox\@tempboxa{\makelabel{#1}}}{%
+ \sbox\@tempboxa{\makelabel{#1}}}%
+ \ifbool{al@rlmode}{\global\setbox\@labels\hbox dir TRT}%
+ {\global\setbox\@labels\hbox}{%
+ \unhbox\@labels
+ \hskip \itemindent
+ \hskip -\labelwidth
+ \hskip -\labelsep
+ \ifdim \wd\@tempboxa >\labelwidth
+ \box\@tempboxa
+ \else
+ \hbox to\labelwidth {\unhbox\@tempboxa}%
+ \fi
+ \hskip \labelsep}%
+ \ignorespaces}
+\long\def\sRLbox#1#2{\setbox#1\hbox dir TRT{%
+ \color@setgroup#2\color@endgroup}}
+\endinput
+%%
+%% End of file `arabluatex-patch.sty'.
diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua
index 956f796bdfc..38fe87b31dd 100644
--- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua
+++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua
@@ -29,6 +29,9 @@ require("arabluatex_trans")
local function protectarb(str)
str = string.gsub(str, "(\\arb.?)(%[.-%])(%b{})", "\\@arb%2%3")
+ str = string.gsub(str, "(\\begin.?)(%b{})(%b[])", "\\@begin%3%2")
+ str = string.gsub(str, "(\\begin.?)(%b{})", "\\@begin%2")
+ str = string.gsub(str, "(\\end.?)(%b{})", "\\@end%2")
str = string.gsub(str, "\\par", "\\p@r{}")
str = string.gsub(str, "\\@@par", "\\p@r{}")
return str
@@ -36,11 +39,21 @@ end
local function unprotectarb(str)
str = string.gsub(str, "(\\@arb)(%[.-%])(%b{})", "\\arb%2%3")
+ str = string.gsub(str, "(\\@begin)(%b[])(%b{})", "\\begin%3%2")
+ str = string.gsub(str, "(\\@begin)(%b{})", "\\begin%2")
+ str = string.gsub(str, "(\\@end)(%b{})", "\\end%2")
str = string.gsub(str, "\\p@r{}", "\\par")
return str
end
local function breakcmd(str)
+ -- process \item[], then \item[]
+ str = string.gsub(str, "\\(item.?)(%b[])",
+ function(tag, body)
+ body = string.sub(body, 2, -2)
+ return string.format("}\\item[\\arb{%s}] \\arb{", body)
+ end)
+ str = string.gsub(str, "(\\item)(%s+)", "%1{}%2")
-- \edtext
str = string.gsub(str, "\\(edtext.-)(%b{})(%b{})",
function(tag, bodylem, bodyvar)
diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty
index 0f031110332..4921677093d 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}%
-[2016/10/05 v1.4.5 An ArabTeX-like interface for LuaLaTeX]
+[2016/11/14 v1.5 An ArabTeX-like interface for LuaLaTeX]
\RequirePackage{ifluatex}
\ifluatex\else
\PackageError{arabluatex}{lualatex needed}{%
@@ -60,20 +60,22 @@
\def\al@mode@fullvoc{fullvoc}
\def\al@mode@novoc{novoc}
\def\al@mode@trans{trans}
+\RequirePackage{etoolbox}
+\RequirePackage{arabluatex-patch}
\RequirePackage{fontspec}
\RequirePackage{amsmath}
-\RequirePackage{etoolbox}
\RequirePackage{luacode}
\RequirePackage{xparse}
\RequirePackage{environ}
+\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}%
\newfontfamily\arabicfont[Script=Arabic]{Amiri}\fi}%
-\AtBeginDocument{\def\setRL{\pardir TRT\textdir TRT}}
-\AtBeginDocument{\def\setLR{\pardir TLT\textdir TLT}}
+\AtBeginDocument{\def\setRL{\booltrue{al@rlmode}\pardir TRT\textdir TRT}}
+\AtBeginDocument{\def\setLR{\boolfalse{al@rlmode}\pardir TLT\textdir TLT}}
\AtBeginDocument{\ifdef{\LR}%
{\RenewDocumentCommand{\LR}{m}{\bgroup\textdir TLT\rmfamily#1\egroup}}
{\NewDocumentCommand{\LR}{m}{\bgroup\textdir TLT\rmfamily#1\egroup}}}
@@ -109,6 +111,10 @@
TRT\arabicfont#1\egroup}
\DeclareDocumentCommand{\txtrans}{+m}{\bgroup\textdir
TLT\al@trans@font#1\egroup}
+\NewDocumentEnvironment{txarab}{}{%
+ \par%
+ \booltrue{al@rlmode}%
+ \pardir TRT\textdir TRT\arabicfont}{\par}
\DeclareDocumentCommand{\arb}{O{\al@mode} +m}%
{\edef\@tempa{#1}%
\ifx\@tempa\al@mode@voc%
@@ -137,20 +143,24 @@
\NewEnviron{arab}[1][\al@mode]%
{\par\edef\@tempa{#1}%
\ifx\@tempa\al@mode@voc%
+ \booltrue{al@rlmode}%
\bgroup\pardir TRT\textdir TRT\arabicfont%
\luadirect{tex.sprint(processvoc(\luastringO{\BODY},
\luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
\else%
\ifx\@tempa\al@mode@fullvoc%
+ \booltrue{al@rlmode}%
\bgroup\pardir TRT\textdir TRT\arabicfont%
\luadirect{tex.sprint(processfullvoc(\luastringO{\BODY},
\luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
\else%
\ifx\@tempa\al@mode@novoc%
+ \booltrue{al@rlmode}%
\bgroup\pardir TRT\textdir TRT\arabicfont%
\luadirect{tex.sprint(processnovoc(\luastringO{\BODY},
\luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
- \else \ifx\@tempa\al@mode@trans%
+ \else%
+ \ifx\@tempa\al@mode@trans%
\bgroup\pardir TLT\textdir TLT\al@trans@style%
\luadirect{tex.sprint(processtrans(\luastringO{\BODY},
\luastringO{\al@trans@convention},
diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua
index 82459e946f4..87c85e9ac2b 100644
--- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua
+++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua
@@ -267,7 +267,13 @@ trigraphstrdmgeasy = { -- see the differences below under 'easy' tag
digraphstrdmg = {
{a="([uai]%-)(\"?[uai])", b="%1'"}, -- hyphen + initial alif without hamza
- {a="^(\"?[uai])", b="%1"}, -- initial alif without hamza
+ -- the following two are replaced with the 4 lines next for now
+-- {a="^(\"?[uai])", b="%1"}, -- initial alif without hamza
+-- {a="(%W)(\"?[uai])", b="%1%2"}, -- initial alif without hamza
+ {a="^(\"[uai])", b="'"}, -- initial alif without hamza
+ {a="(%W)(\"[uai])", b="%1'"}, -- initial alif without hamza
+ {a="^([uai])", b="%1"}, -- initial alif without hamza
+ {a="(%W)([uai])", b="%1%2"}, -- initial alif without hamza
-- this is not necessary, take out for now:
-- {a="([%_]?[uaiUAIY])(%s)([uai])", b="%1%2'"}, -- initial alif without hamza
{a="(aW)(%s)(\"?[uai])", b="awu%2%3"},