aboutsummaryrefslogtreecommitdiff
path: root/arabluatex.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'arabluatex.dtx')
-rw-r--r--arabluatex.dtx250
1 files changed, 238 insertions, 12 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx
index 3289b8e..9f54123 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -27,7 +27,7 @@
27%<package-info>\NeedsTeXFormat{LaTeX2e}[1999/12/01] 27%<package-info>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
28%<package-info>\ProvidesPackage{arabluatex} 28%<package-info>\ProvidesPackage{arabluatex}
29%<*package-info> 29%<*package-info>
30 [2016/10/05 v1.4.5 An ArabTeX-like interface for LuaLaTeX] 30 [2016/11/14 v1.5 An ArabTeX-like interface for LuaLaTeX]
31%</package-info> 31%</package-info>
32% 32%
33%<*driver> 33%<*driver>
@@ -145,7 +145,8 @@
145\defaultfontfeatures{RawFeature={+liga}} 145\defaultfontfeatures{RawFeature={+liga}}
146\setmainfont{Old Standard}[SmallCapsFont={Latin Modern Roman Caps}, 146\setmainfont{Old Standard}[SmallCapsFont={Latin Modern Roman Caps},
147 RawFeature={+mark;+ccmp;+ss05;+ss06}] 147 RawFeature={+mark;+ccmp;+ss05;+ss06}]
148\usepackage{arabluatex}[2016/10/05] 148\usepackage{arabluatex}[2016/11/14]
149\usepackage[nopar]{quran}
149\usepackage{varioref} 150\usepackage{varioref}
150\usepackage{hypdoc} 151\usepackage{hypdoc}
151\hypersetup{unicode=true, colorlinks, allcolors=blue, 152\hypersetup{unicode=true, colorlinks, allcolors=blue,
@@ -249,10 +250,10 @@
249% \maketitle 250% \maketitle
250% \footnotesize 251% \footnotesize
251% \tableofcontents 252% \tableofcontents
253% \pagebreak
252% \listoftables 254% \listoftables
253% \normalsize 255% \normalsize
254% 256%
255% \pagebreak
256% \begin{abstract} 257% \begin{abstract}
257% This package provides for \LuaLaTeX\ an Arab{\TeX}-like interface 258% This package provides for \LuaLaTeX\ an Arab{\TeX}-like interface
258% to generate Arabic writing from an \textsc{ascii} 259% to generate Arabic writing from an \textsc{ascii}
@@ -2163,7 +2164,37 @@ muhaddamaTaN mi'_danatu-hu}: \arb[trans]{ra'aytu
2163% Al-intiqaADi} with the correct vowel \meta{i} in place of the % 2164% Al-intiqaADi} with the correct vowel \meta{i} in place of the %
2164% \SetInputScheme{arabtex}% 2165% \SetInputScheme{arabtex}%
2165% \arb[trans]{'alif-u 'l-wa.sl-i}. 2166% \arb[trans]{'alif-u 'l-wa.sl-i}.
2166% 2167%
2168% \section{Unicode Arabic input}
2169% \label{sec:unicode-input}
2170% \NEWfeature{v1.5} As said above in \vref{sec:buckwalter-scheme}
2171% about the Buckwalter input scheme, even though \package{arabluatex}
2172% is primarily designed to process the Arab\TeX\ notation, it also
2173% accepts unicode Arabic input. It should be noted that
2174% \package{arabluatex} does in no way interfere with unicode Arabic
2175% input: none of the options |voc|, |fullvoc|, |novoc| or |trans| will
2176% have any effect on plain unicode Arabic for the time being.
2177%
2178% That said, there are two ways of inserting unicode
2179% Arabic:
2180% \begin{compactenum}[(a)]
2181% \item \DescribeMacro{\txarb} The \cs{txarb}\marg{unicode Arabic}
2182% command for inserting unicode Arabic text in paragraphs;
2183% \item The \DescribeEnv{txarab} |txarab| environment for inserting
2184% running paragraphs of Arabic text, like so:---\\%
2185% \iffalse
2186%<*example>
2187% \fi
2188\begin{arabluaverbatim}
2189 \begin{txarab}
2190 <Unicode Arabic text>
2191 \end{txarab}
2192\end{arabluaverbatim}
2193% \iffalse
2194%</example>
2195% \fi
2196% \end{compactenum}
2197%
2167% \section{\LaTeX\ Commands in Arabic environments} 2198% \section{\LaTeX\ Commands in Arabic environments}
2168% \label{sec:commands-in-arb} 2199% \label{sec:commands-in-arb}
2169% \paragraph{General principle} \label{ref:cmd-inside-arabic}\LaTeX\ 2200% \paragraph{General principle} \label{ref:cmd-inside-arabic}\LaTeX\
@@ -2296,6 +2327,133 @@ qAla barzawayhi bn-u 'azhar-a, ra's-u 'a.tibbA'-i fAris-a...
2296%</example> 2327%</example>
2297% \fi 2328% \fi
2298% 2329%
2330% \subsection{Environments}
2331% \label{sec:environments}
2332% \changes{v1.5}{2016/11/14}{Environments may be nested inside the
2333% \texttt{arab} environment}
2334% \NEWfeature{v1.5} Environments such as
2335% \arabluaverb{\begin{quote}... \end{quote}} may be nested inside the
2336% |arab| environment. Up to one optional argument may be passed to
2337% each nested environment, like so:---
2338% \iffalse
2339%<*example>
2340% \fi
2341\begin{arabluaverbatim}
2342\begin{arab}
2343 \begin{<environment>}[<options>]
2344 <Arabic text>
2345 \end{<environment>}
2346\end{arab}
2347\end{arabluaverbatim}
2348% \iffalse
2349%</example>
2350% \fi
2351%
2352% In the following example, the \package{quoting} package is used:---
2353% \iffalse
2354%<*example>
2355% \fi
2356\begin{arabluacode}
2357 \setquotestyle{arabic}
2358 \begin{arab}[fullvoc]
2359 kAna \cap{'abU} \cap{'l-hu_dayli} 'ahd_A 'il_A \cap{muwaysiN}
2360 dajAjaTaN. wa-kAnat dajAjatu-hu 'llatI 'ahdA-hA dUna mA kAna
2361 yuttaxa_du li-\cap{muwaysiN}. wa-l_akinna-hu bi-karami-hi
2362 wa-bi-.husni xuluqi-hi 'a.zhara 'l-ta`ajjuba min simani-hA
2363 wa-.tIbi la.hmi-hA. wa-kAna <\cap{'abU} \cap{'l-hu_dayli}> yu`rafu
2364 bi-'l-'imsAki 'l-^sadIdi. fa-qAla: \enquote{wa-kayfa ra'ayta yA
2365 \cap{'abA} \cap{`imrAna} tilka 'l-dajAjaTa?} qAla:
2366 \enquote{kAnat `ajabaN mina 'l-`ajabi!} fa-yaqUlu:
2367 \begin{quoting}[begintext=», endtext=«]
2368 wa-tadrI mA jinsu-hA? wa-tadrI mA sinnu-hA? fa-'inna
2369 'l-dajAjaTa 'inna-mA ta.tIbu bi-'l-jinsi wa-'l-sinni. wa-tadrI
2370 bi-'ayyi ^say'iN kunnA nusamminu-hA? wa-fI 'ayyi makAniN kunnA
2371 na`lifu-hA?
2372 \end{quoting}
2373 fa-lA yazAlu fI h_a_dA wa-'l-'A_haru ya.d.haku .da.hkaN na`rifu-hu
2374 na.hnu wa-lA ya`rifu-hu \cap{'abU} \cap{'l-hu_dayli}.
2375 \end{arab}
2376\end{arabluacode}
2377% \iffalse
2378%</example>
2379% \fi
2380%
2381% \subsubsection{Lists}
2382% \label{sec:lists}
2383% Lists environments are also accepted inside the |arab|
2384% environment. One may either use any of the three standard list
2385% environments, viz. |itemize|, |enumerate| and |description| or use a
2386% package that provides additional refinements such as
2387% \package{paralist}.
2388%
2389% To take a first example, should one wish to typeset a list of
2390% manuscripts, the |description| environment may be used like so:---
2391% \iffalse
2392%<*example>
2393% \fi
2394\begin{arabluacode}
2395 \setRL\paragraph{\arb[novoc]{rumUzi 'l-kitAbi}}\setLR
2396 \begin{arab}[novoc]
2397 \begin{description}
2398 \item[b] max.tU.tu 'l-maktabaTi 'l-'ahliyyaTi bi-\cap{bArIs} 2860
2399 `arabiyyuN.
2400 \item[s] max.tU.tu 'l-maktabaTi 'l-'ahliyyaTi bi-\cap{bArIs} 2859
2401 `arabiyyuN.
2402 \item[m] max.tU.tu majlisi \arb[novoc]{^sUrAY malY} .tahrAna 521.
2403 \end{description}
2404 \end{arab}
2405\end{arabluacode}
2406% \iffalse
2407%</example>
2408% \fi
2409%
2410% As a second example, the contents of a treatise may be typeset with
2411% the standard list environments, like so:---
2412% \iffalse
2413%<*example>
2414% \fi
2415\begin{arabluacode}
2416 \setRL\centerline{\arb{\textbf{al-qAnUnu fI 'l-.tibbi}}}\setLR
2417 \begin{arab}
2418 \begin{itemize}
2419 \item \textbf{al-fannu 'l-'awwalu} fI .haddi 'l-.tibbi
2420 wa-maw.dU`Ati-hi mina 'l-'umUri 'l-.tabI`iyyaTi wa-ya^stamilu
2421 `al_A sittaTi ta`AlImiN
2422 \begin{itemize}
2423 \item \textbf{al-ta`lImu 'l-'awwalu} [wa-huwa fa.slAni]
2424 \begin{itemize}
2425 \item \textbf{al-fa.slu 'l-'awwalu}
2426 \end{itemize}
2427 \end{itemize}
2428 \end{itemize}
2429 \end{arab}
2430\end{arabluacode}
2431% \iffalse
2432%</example>
2433% \fi
2434%
2435% \paragraph{Caveat}
2436% The various French definition files of the \package{babel} package
2437% viz. |acadian|, |canadien|, |francais|, |frenchb| or |french| all
2438% redefine the list environments, which breaks the standard definition
2439% file that is used by \package{arabluatex}. Therefore,
2440% \package{babel-french} must be loaded with the option
2441% |StandardLayout=true|, like so:---
2442% \iffalse
2443%<*example>
2444% \fi
2445\begin{arabluaverbatim}
2446\usepackage[french]{babel}
2447\frenchbsetup{StandardLayout=true}
2448\end{arabluaverbatim}
2449% \iffalse
2450%</example>
2451% \fi%
2452% This option will prevent \package{babel-french} from interfering
2453% with the layout of the document. Then the package \package{paralist}
2454% may be used to make the lists \enquote*{compact} as
2455% \package{babel-french} do.
2456%
2299% \subsection{\package{csquotes}} 2457% \subsection{\package{csquotes}}
2300% \label{sec:csquotes} 2458% \label{sec:csquotes}
2301% The recommended way of inserting quotation marks in running Arabic 2459% The recommended way of inserting quotation marks in running Arabic
@@ -2357,6 +2515,48 @@ wa-ya.sIru ta.hta 'l-jild-i
2357% \iffalse 2515% \iffalse
2358%</example> 2516%</example>
2359% \fi 2517% \fi
2518%
2519% \subsection{\package{quran}}
2520% \label{sec:pkg-quran}
2521% \changes{v1.5}{2016/11/14}{Compatibility with the \textsf{quran}
2522% package} \package{arabluatex} is compatible with the \package{quran}
2523% package so that both can be used in conjunction with one another for
2524% typesetting the \arb[trans]{\cap{qur'An}}. As \package{quran} draws
2525% the text of the \arb[trans]{\cap{qur'An}} from a unicode encoded
2526% database, its commands have to be passed as arguments to the
2527% \cs{txarb} command for short insertions in left-to-right paragraphs,
2528% or inserted inside the \index{txarab=txarab (environment)}|txarab|
2529% environment for typesetting running paragraphs of
2530% \arb[trans]{\cap{qur'An}}\emph{ic} text (see above
2531% \vref{sec:unicode-input} for more details). Please note that
2532% \package{arabluatex} takes care of formatting the Arabic: therefore,
2533% it is recommended to load the \package{quran} package with the
2534% option |nopar|, after \package{arabluatex} itself has been loaded,
2535% like so:--- %
2536% \iffalse
2537%<*example>
2538% \fi
2539\begin{arabluaverbatim}
2540 \usepackage{arabluatex}
2541 \usepackage[nopar]{quran}
2542\end{arabluaverbatim}
2543% \iffalse
2544%</example>
2545% \fi
2546%
2547% As an example, the following code will typeset the \arb[trans]{sUraT}
2548% \arb[trans]{al-\cap{fAti.haT}}:---
2549% \iffalse
2550%<*example>
2551% \fi
2552\begin{arabluacode}
2553 \begin{txarab}
2554 \quransurah[1]
2555 \end{txarab}
2556\end{arabluacode}
2557% \iffalse
2558%</example>
2559% \fi
2360% 2560%
2361% \section{Future work} 2561% \section{Future work}
2362% \label{sec:future-work} 2562% \label{sec:future-work}
@@ -2399,7 +2599,7 @@ wa-ya.sIru ta.hta 'l-jild-i
2399% \begin{macrocode} 2599% \begin{macrocode}
2400\NeedsTeXFormat{LaTeX2e} 2600\NeedsTeXFormat{LaTeX2e}
2401\ProvidesPackage{arabluatex}% 2601\ProvidesPackage{arabluatex}%
2402[2016/10/05 v1.4.5 An ArabTeX-like interface for LuaLaTeX] 2602[2016/11/14 v1.5 An ArabTeX-like interface for LuaLaTeX]
2403\RequirePackage{ifluatex} 2603\RequirePackage{ifluatex}
2404% \end{macrocode} 2604% \end{macrocode}
2405% \package{arabluatex} requires \LuaLaTeX\ of course. Issue a warning 2605% \package{arabluatex} requires \LuaLaTeX\ of course. Issue a warning
@@ -2599,12 +2799,12 @@ wa-ya.sIru ta.hta 'l-jild-i
2599% \end{macrocode} 2799% \end{macrocode}
2600% \end{macro} 2800% \end{macro}
2601% \begin{macro}{\txarb} \cs{txarb} sets the direction to right-to-left 2801% \begin{macro}{\txarb} \cs{txarb} sets the direction to right-to-left
2602% and selects the Arabic font. As it is supposed to be used 2802% and selects the Arabic font. It is used internally by several Lua
2603% internally by several Lua functions, this command is not 2803% functions, but available to the user should he wish to insert
2604% documented, but available to the user should he wish to insert
2605% |utf8| Arabic text in his document. 2804% |utf8| Arabic text in his document.
2606% \begin{macro}{\txtrans} \cs{txtrans} is used internally by several 2805% \begin{macro}{\txtrans} \cs{txtrans} is used internally by several
2607% Lua functions to insert transliterated Arabic text. 2806% Lua functions to insert transliterated Arabic text. Therefore, it is
2807% not documented.
2608% \begin{macrocode} 2808% \begin{macrocode}
2609\DeclareDocumentCommand{\txarb}{+m}{\bgroup\textdir 2809\DeclareDocumentCommand{\txarb}{+m}{\bgroup\textdir
2610 TRT\arabicfont#1\egroup} 2810 TRT\arabicfont#1\egroup}
@@ -2614,7 +2814,7 @@ wa-ya.sIru ta.hta 'l-jild-i
2614% \end{macro} 2814% \end{macro}
2615% \end{macro} 2815% \end{macro}
2616% \begin{environment}{txarab} 2816% \begin{environment}{txarab}
2617% \changes{v1.5}{2016/11/13}{New \texttt{txarab} environment for 2817% \changes{v1.5}{2016/11/14}{New \texttt{txarab} environment for
2618% typesetting running paragraphs in unicode Arabic} The |txarab| 2818% typesetting running paragraphs in unicode Arabic} The |txarab|
2619% environment does for paragraphs the same as \cs{txarb} does for 2819% environment does for paragraphs the same as \cs{txarb} does for
2620% short insertions of |utf8| Arabic text. 2820% short insertions of |utf8| Arabic text.
@@ -2764,11 +2964,21 @@ wa-ya.sIru ta.hta 'l-jild-i
2764% \iffalse 2964% \iffalse
2765%<*patch> 2965%<*patch>
2766% \fi 2966% \fi
2767%
2768% \begin{macrocode} 2967% \begin{macrocode}
2769\NeedsTeXFormat{LaTeX2e} 2968\NeedsTeXFormat{LaTeX2e}
2770\ProvidesPackage{arabluatex-patch}% 2969\ProvidesPackage{arabluatex-patch}%
2771[2016/11/13 v1.0 patches for arabluatex] 2970[2016/11/14 v1.0 patches for arabluatex]
2971% \end{macrocode}
2972% I have put in a separate |.sty| file external lines of code that
2973% I had to patch for a good reason. I hate doing this, and hopefully,
2974% most of these lines will disappear as soon as they are not required
2975% anymore.
2976%
2977% The following is taken from |latex.ltx|. I had to make this patch
2978% for I could not find a way to process the list environments in
2979% right-to-left mode. The \LuaTeX\ primitives \cs{bodydir} and
2980% \cs{pagedir} will eventually allow us to get rid of this:
2981% \begin{macrocode}
2772\def\list#1#2{% 2982\def\list#1#2{%
2773 \ifnum \@listdepth >5\relax 2983 \ifnum \@listdepth >5\relax
2774 \@toodeep 2984 \@toodeep
@@ -2788,8 +2998,14 @@ wa-ya.sIru ta.hta 'l-jild-i
2788 \parindent\listparindent 2998 \parindent\listparindent
2789 \advance\linewidth -\rightmargin 2999 \advance\linewidth -\rightmargin
2790 \advance\linewidth -\leftmargin 3000 \advance\linewidth -\leftmargin
3001% \end{macrocode}
3002% patch begins:
3003% \begin{macrocode}
2791 \ifbool{al@rlmode}{\advance\@totalleftmargin \rightmargin}% 3004 \ifbool{al@rlmode}{\advance\@totalleftmargin \rightmargin}%
2792 {\advance\@totalleftmargin \leftmargin} 3005 {\advance\@totalleftmargin \leftmargin}
3006% \end{macrocode}
3007% patch ends.
3008% \begin{macrocode}
2793 \parshape \@ne \@totalleftmargin \linewidth 3009 \parshape \@ne \@totalleftmargin \linewidth
2794 \ignorespaces} 3010 \ignorespaces}
2795\def\@item[#1]{% 3011\def\@item[#1]{%
@@ -2841,10 +3057,16 @@ wa-ya.sIru ta.hta 'l-jild-i
2841 \refstepcounter\@listctr 3057 \refstepcounter\@listctr
2842 \fi 3058 \fi
2843 \fi 3059 \fi
3060% \end{macrocode}
3061% patch begins:
3062% \begin{macrocode}
2844 \ifbool{al@rlmode}{\sRLbox\@tempboxa{\makelabel{#1}}}{% 3063 \ifbool{al@rlmode}{\sRLbox\@tempboxa{\makelabel{#1}}}{%
2845 \sbox\@tempboxa{\makelabel{#1}}}% 3064 \sbox\@tempboxa{\makelabel{#1}}}%
2846 \ifbool{al@rlmode}{\global\setbox\@labels\hbox dir TRT}% 3065 \ifbool{al@rlmode}{\global\setbox\@labels\hbox dir TRT}%
2847 {\global\setbox\@labels\hbox}{% 3066 {\global\setbox\@labels\hbox}{%
3067% \end{macrocode}
3068% patch ends.
3069% \begin{macrocode}
2848 \unhbox\@labels 3070 \unhbox\@labels
2849 \hskip \itemindent 3071 \hskip \itemindent
2850 \hskip -\labelwidth 3072 \hskip -\labelwidth
@@ -2856,6 +3078,10 @@ wa-ya.sIru ta.hta 'l-jild-i
2856 \fi 3078 \fi
2857 \hskip \labelsep}% 3079 \hskip \labelsep}%
2858 \ignorespaces} 3080 \ignorespaces}
3081% \end{macrocode}
3082% This is adapted from Vafa Khalighi's \package{bidi} package. Thanks
3083% to him.
3084% \begin{macrocode}
2859\long\def\sRLbox#1#2{\setbox#1\hbox dir TRT{% 3085\long\def\sRLbox#1#2{\setbox#1\hbox dir TRT{%
2860 \color@setgroup#2\color@endgroup}} 3086 \color@setgroup#2\color@endgroup}}
2861% \end{macrocode} 3087% \end{macrocode}