aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2016-11-13 10:56:06 +0100
committerRobert Alessi <alessi@robertalessi.net>2016-11-13 10:56:06 +0100
commit60c78040664d5f4b9c155c3298f60ab49e367213 (patch)
tree874dbf02a4ee8552c926079bc38679a75439ad9c
parent55c7d8a9ced9c5c6edf4e69ef145ae5c65c8e2e1 (diff)
downloadarabluatex-60c78040664d5f4b9c155c3298f60ab49e367213.tar.gz
arabluatex now accepts environments and can process RTL list environments; a new 'txarab' environment has been added which does for running paragraphs the same as 'txarb' does for short insertions of unicode Arabic
-rw-r--r--arabluatex.dtx135
-rw-r--r--arabluatex.ins1
2 files changed, 121 insertions, 15 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx
index 74474b8..3289b8e 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -2426,20 +2426,20 @@ wa-ya.sIru ta.hta 'l-jild-i
2426\def\al@mode@novoc{novoc} 2426\def\al@mode@novoc{novoc}
2427\def\al@mode@trans{trans} 2427\def\al@mode@trans{trans}
2428% \end{macrocode} 2428% \end{macrocode}
2429% The following line will be used in the next release of
2430% \package{arabluatex}:
2431% \begin{macrocode}
2432% \newif\ifal@mode@defined
2433% \end{macrocode}
2434% Packages that are required by \package{arabluatex}: 2429% Packages that are required by \package{arabluatex}:
2435% \begin{macrocode} 2430% \begin{macrocode}
2431\RequirePackage{etoolbox}
2432\RequirePackage{arabluatex-patch}
2436\RequirePackage{fontspec} 2433\RequirePackage{fontspec}
2437\RequirePackage{amsmath} 2434\RequirePackage{amsmath}
2438\RequirePackage{etoolbox}
2439\RequirePackage{luacode} 2435\RequirePackage{luacode}
2440\RequirePackage{xparse} 2436\RequirePackage{xparse}
2441\RequirePackage{environ} 2437\RequirePackage{environ}
2442% \end{macrocode} 2438% \end{macrocode}
2439% The following boolean will be set to |true| in |RL| mode:
2440% \begin{macrocode}
2441\newbool{al@rlmode}
2442% \end{macrocode}
2443% Here begins the real work: load |arabluatex.lua|: 2443% Here begins the real work: load |arabluatex.lua|:
2444% \begin{macrocode} 2444% \begin{macrocode}
2445\luadirect{dofile(kpse.find_file("arabluatex.lua"))} 2445\luadirect{dofile(kpse.find_file("arabluatex.lua"))}
@@ -2462,13 +2462,13 @@ wa-ya.sIru ta.hta 'l-jild-i
2462% This neutralizes what is defined by the same command in 2462% This neutralizes what is defined by the same command in
2463% \package{luabidi}: 2463% \package{luabidi}:
2464% \begin{macrocode} 2464% \begin{macrocode}
2465\AtBeginDocument{\def\setRL{\pardir TRT\textdir TRT}} 2465\AtBeginDocument{\def\setRL{\booltrue{al@rlmode}\pardir TRT\textdir TRT}}
2466% \end{macrocode} 2466% \end{macrocode}
2467% \end{macro} 2467% \end{macro}
2468% \begin{macro}{\setLR} 2468% \begin{macro}{\setLR}
2469% The same applies to \cs{setLR}: 2469% The same applies to \cs{setLR}:
2470% \begin{macrocode} 2470% \begin{macrocode}
2471\AtBeginDocument{\def\setLR{\pardir TLT\textdir TLT}} 2471\AtBeginDocument{\def\setLR{\boolfalse{al@rlmode}\pardir TLT\textdir TLT}}
2472% \end{macrocode} 2472% \end{macrocode}
2473% \end{macro} 2473% \end{macro}
2474% \begin{macro}{\LR} This command typesets its argument from left to 2474% \begin{macro}{\LR} This command typesets its argument from left to
@@ -2613,6 +2613,18 @@ wa-ya.sIru ta.hta 'l-jild-i
2613% \end{macrocode} 2613% \end{macrocode}
2614% \end{macro} 2614% \end{macro}
2615% \end{macro} 2615% \end{macro}
2616% \begin{environment}{txarab}
2617% \changes{v1.5}{2016/11/13}{New \texttt{txarab} environment for
2618% typesetting running paragraphs in unicode Arabic} The |txarab|
2619% environment does for paragraphs the same as \cs{txarb} does for
2620% short insertions of |utf8| Arabic text.
2621% \begin{macrocode}
2622\NewDocumentEnvironment{txarab}{}{%
2623 \par%
2624 \booltrue{al@rlmode}%
2625 \pardir TRT\textdir TRT\arabicfont}{\par}
2626% \end{macrocode}
2627% \end{environment}
2616% \begin{macro}{\arb} 2628% \begin{macro}{\arb}
2617% The \cs{arb} command detects which Arabic mode is to be used, 2629% The \cs{arb} command detects which Arabic mode is to be used,
2618% either globally if no option is set, or locally, then passes its 2630% either globally if no option is set, or locally, then passes its
@@ -2652,20 +2664,24 @@ wa-ya.sIru ta.hta 'l-jild-i
2652\NewEnviron{arab}[1][\al@mode]% 2664\NewEnviron{arab}[1][\al@mode]%
2653{\par\edef\@tempa{#1}% 2665{\par\edef\@tempa{#1}%
2654 \ifx\@tempa\al@mode@voc% 2666 \ifx\@tempa\al@mode@voc%
2667 \booltrue{al@rlmode}%
2655 \bgroup\pardir TRT\textdir TRT\arabicfont% 2668 \bgroup\pardir TRT\textdir TRT\arabicfont%
2656 \luadirect{tex.sprint(processvoc(\luastringO{\BODY}, 2669 \luadirect{tex.sprint(processvoc(\luastringO{\BODY},
2657 \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% 2670 \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
2658 \else% 2671 \else%
2659 \ifx\@tempa\al@mode@fullvoc% 2672 \ifx\@tempa\al@mode@fullvoc%
2673 \booltrue{al@rlmode}%
2660 \bgroup\pardir TRT\textdir TRT\arabicfont% 2674 \bgroup\pardir TRT\textdir TRT\arabicfont%
2661 \luadirect{tex.sprint(processfullvoc(\luastringO{\BODY}, 2675 \luadirect{tex.sprint(processfullvoc(\luastringO{\BODY},
2662 \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% 2676 \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
2663 \else% 2677 \else%
2664 \ifx\@tempa\al@mode@novoc% 2678 \ifx\@tempa\al@mode@novoc%
2679 \booltrue{al@rlmode}%
2665 \bgroup\pardir TRT\textdir TRT\arabicfont% 2680 \bgroup\pardir TRT\textdir TRT\arabicfont%
2666 \luadirect{tex.sprint(processnovoc(\luastringO{\BODY}, 2681 \luadirect{tex.sprint(processnovoc(\luastringO{\BODY},
2667 \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% 2682 \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
2668 \else \ifx\@tempa\al@mode@trans% 2683 \else%
2684 \ifx\@tempa\al@mode@trans%
2669 \bgroup\pardir TLT\textdir TLT\al@trans@style% 2685 \bgroup\pardir TLT\textdir TLT\al@trans@style%
2670 \luadirect{tex.sprint(processtrans(\luastringO{\BODY}, 2686 \luadirect{tex.sprint(processtrans(\luastringO{\BODY},
2671 \luastringO{\al@trans@convention}, 2687 \luastringO{\al@trans@convention},
@@ -2737,16 +2753,14 @@ wa-ya.sIru ta.hta 'l-jild-i
2737% \end{macrocode} 2753% \end{macrocode}
2738% \end{macro} 2754% \end{macro}
2739% That is it. Say goodbye before leaving. 2755% That is it. Say goodbye before leaving.
2740% \begin{macrocode}
2741\endinput
2742% \end{macrocode}
2743%
2744% \printbibliography[heading=bibintoc]
2745% 2756%
2746% \iffalse 2757% \iffalse
2747%</package> 2758%</package>
2748% \fi 2759% \fi
2749% 2760%
2761% \subsection*{Patches}
2762% \label{sec:patches}
2763%
2750% \iffalse 2764% \iffalse
2751%<*patch> 2765%<*patch>
2752% \fi 2766% \fi
@@ -2754,12 +2768,103 @@ wa-ya.sIru ta.hta 'l-jild-i
2754% \begin{macrocode} 2768% \begin{macrocode}
2755\NeedsTeXFormat{LaTeX2e} 2769\NeedsTeXFormat{LaTeX2e}
2756\ProvidesPackage{arabluatex-patch}% 2770\ProvidesPackage{arabluatex-patch}%
2757[2016/11/13 v1.0 arabluatex patches] 2771[2016/11/13 v1.0 patches for arabluatex]
2772\def\list#1#2{%
2773 \ifnum \@listdepth >5\relax
2774 \@toodeep
2775 \else
2776 \global\advance\@listdepth\@ne
2777 \fi
2778 \rightmargin\z@
2779 \listparindent\z@
2780 \itemindent\z@
2781 \csname @list\romannumeral\the\@listdepth\endcsname
2782 \def\@itemlabel{#1}%
2783 \let\makelabel\@mklab
2784 \@nmbrlistfalse
2785 #2\relax
2786 \@trivlist
2787 \parskip\parsep
2788 \parindent\listparindent
2789 \advance\linewidth -\rightmargin
2790 \advance\linewidth -\leftmargin
2791 \ifbool{al@rlmode}{\advance\@totalleftmargin \rightmargin}%
2792 {\advance\@totalleftmargin \leftmargin}
2793 \parshape \@ne \@totalleftmargin \linewidth
2794 \ignorespaces}
2795\def\@item[#1]{%
2796 \if@noparitem
2797 \@donoparitem
2798 \else
2799 \if@inlabel
2800 \indent \par
2801 \fi
2802 \ifhmode
2803 \unskip\unskip \par
2804 \fi
2805 \if@newlist
2806 \if@nobreak
2807 \@nbitem
2808 \else
2809 \addpenalty\@beginparpenalty
2810 \addvspace\@topsep
2811 \addvspace{-\parskip}%
2812 \fi
2813 \else
2814 \addpenalty\@itempenalty
2815 \addvspace\itemsep
2816 \fi
2817 \global\@inlabeltrue
2818 \fi
2819 \everypar{%
2820 \@minipagefalse
2821 \global\@newlistfalse
2822 \if@inlabel
2823 \global\@inlabelfalse
2824 {\setbox\z@\lastbox
2825 \ifvoid\z@
2826 \kern-\itemindent
2827 \fi}%
2828 \box\@labels
2829 \penalty\z@
2830 \fi
2831 \if@nobreak
2832 \@nobreakfalse
2833 \clubpenalty \@M
2834 \else
2835 \clubpenalty \@clubpenalty
2836 \everypar{}%
2837 \fi}%
2838 \if@noitemarg
2839 \@noitemargfalse
2840 \if@nmbrlist
2841 \refstepcounter\@listctr
2842 \fi
2843 \fi
2844 \ifbool{al@rlmode}{\sRLbox\@tempboxa{\makelabel{#1}}}{%
2845 \sbox\@tempboxa{\makelabel{#1}}}%
2846 \ifbool{al@rlmode}{\global\setbox\@labels\hbox dir TRT}%
2847 {\global\setbox\@labels\hbox}{%
2848 \unhbox\@labels
2849 \hskip \itemindent
2850 \hskip -\labelwidth
2851 \hskip -\labelsep
2852 \ifdim \wd\@tempboxa >\labelwidth
2853 \box\@tempboxa
2854 \else
2855 \hbox to\labelwidth {\unhbox\@tempboxa}%
2856 \fi
2857 \hskip \labelsep}%
2858 \ignorespaces}
2859\long\def\sRLbox#1#2{\setbox#1\hbox dir TRT{%
2860 \color@setgroup#2\color@endgroup}}
2758% \end{macrocode} 2861% \end{macrocode}
2759% 2862%
2760% \iffalse 2863% \iffalse
2761%</patch> 2864%</patch>
2762% \fi 2865% \fi
2763% 2866%
2867% \printbibliography[heading=bibintoc]
2868%
2764% \Finale 2869% \Finale
2765\endinput 2870\endinput
diff --git a/arabluatex.ins b/arabluatex.ins
index df4c625..5cf1bad 100644
--- a/arabluatex.ins
+++ b/arabluatex.ins
@@ -86,6 +86,7 @@ This release of 'arabluatex' consists of the following source files:
86\Msg{* more on this} 86\Msg{* more on this}
87\Msg{*} 87\Msg{*}
88\Msg{* \space\space arabluatex.sty} 88\Msg{* \space\space arabluatex.sty}
89\Msg{* \space\space arabluatex-patch.sty}
89\Msg{* \space\space arabluatex.lua} 90\Msg{* \space\space arabluatex.lua}
90\Msg{* \space\space arabluatex_voc.lua} 91\Msg{* \space\space arabluatex_voc.lua}
91\Msg{* \space\space arabluatex_fullvoc.lua} 92\Msg{* \space\space arabluatex_fullvoc.lua}