1%%%%%%%%%%%%%%%%%%%%%%%%%%%%% arabtex.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2% arabtex.sty 3% this is the driver module for the ArabTeX macro package 4\def \theversion {3.11} 5\def \thedatum {22.08.2003} 6%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7% (c) Klaus Lagally EMail: lagallyk@acm.org 8% Institut fuer Formale 9% Methoden der Informatik TEL: +49-711-7816-392 10% Universitaet Stuttgart FAX: +49-711-7816-370 11% Universitaetsstrasse 38 12% D-70569 Stuttgart INFO: arabtex@informatik.uni-stuttgart.de 13%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14% This program can be redistributed and/or modified under the terms 15% of the LaTeX Project Public License distributed from CTAN 16% archives in directory macros/latex/base/lppl.txt; either 17% version 1 of the License, or (at your option) any later version. 18%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 20\ifx \undefined \Lagally \else 21\errhelp {ArabTex should be loaded *after* EDMAC (if applicable),^^J 22but *before* any non-standard LaTeX packages or options.^^J 23Correct your configuration and try again.} 24\errmessage {Inconsistent configuration.^^J 25The command `\string \undefined' has been redefined by some package.^^J 26`\string \undefined' is defined as `\meaning \undefined'.^^J 27This might utterly confuse ArabTeX which is therefore not loaded.^^J 28}\fi 29 30\ifx \ar@batcode \undefined \else \expandafter \endinput 31\fi % load only once 32 33\chardef \ar@batcode = \catcode`\@ \catcode`\@ = 11 \chardef \@other = 12 34\chardef \ar@bdqcode = \catcode`\" \catcode`\" = 12 % for german.sty 35 36%%%%%%%%%%%%%%%%%%%%%%%% auxiliary macros %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 37 38\def \ArabTeX {Arab\TeX } 39 40\let \xpa \expandafter \def \xxpa {\xpa \xpa \xpa } 41\def \xxxpa {\xpa \xxpa \xpa } 42 43\let \nxp \noexpand \def \nxxp {\nxp \nxp \nxp } 44\def \n@xp {\nxp \nxp \nxp } 45 46%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 47%%%%%%%%%%%%%%%%%%%% identify yourself %%%%%%%%%%%%%%%%%%%%%%% 48%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 49 50\input aconfig.sty % check environment 51 52\let \a@wlog \wlog \def \wlog #1{\relax } 53 54\a@ident {arabtex.sty} {\theversion \space ArabTeX main module} {\thedatum } 55 56\UsePackage {arabaux} % load auxiliary macros 57 58%%%%%%%%%%%%%%%%%%% various declarations %%%%%%%%%%%%%%%%%%%%% 59 60\newbox \wordb@x \newbox \lineb@x \newbox \tempb@x 61\newtoks \a@tokens \newtoks \sc@next \newtoks \sc@rest 62\newtoks \a@@cmd \newtoks \a@@name \newtoks \a@@tail 63\newtoks \a@digits \newtoks \a@first \newtoks \a@paren 64\newtoks \a@@everypar \newtoks \a@accent 65\newskip \a@parindent \newskip \a@parskip 66\newwrite \a@@err \newwrite \a@@out 67\newcount \tracingarab \def \quiet {\tracingarab = 0 } 68 69\newif \if@vocals \newif \ifv@c \newif \if@sukun 70\newif \if@suk \newif \if@wasla \newif \if@was 71\newif \if@high \newif \ifacc@hi \newif \ifa@vmode 72\newif \ifa@space \newif \iftr@ns \newif \ifa@oldhmode 73 74\newif \iftest % \testtrue % for internal use only 75\newif \iftest@scan \newif \iftest@trans 76\newif \iftest@parse \newif \iftest@write 77\newif \iftest@command \newif \iftest@font 78 79\newif \ifnewfont \newif \ifaRL 80 81%%%%%%%%%%%%%%%%%%% language specific switches %%%%%%%%%%%%%%%%%%%%% 82 83%% beware of moving arguments! 84 85\newif \ifarab % generate the arabic script 86\newif \ifshow % display the input text verbatim 87\newif \ifligs % set all ligatures active 88\newif \ifspread % spread characters by keshide 89\newif \iftrans % generate the transliteration 90 91%newif \ifRL % alias for \ifarab 92\let \RLtrue \arabtrue \let \RLfalse \arabfalse 93 94% internal switches 95 96\newif \ifaN@alif % tanwin on alif 97\newif \ifqur@n % old hamza rules 98\newif \ifh@mza % hamza rules, assimilation 99\newif \if@ssim % assimilation 100\newif \ifiz@fet % izafet rules 101\newif \ifyahd@ts % yah with dots 102\newif \ifk@fs % final kaf without mark 103\newif \iff@rsn % Farsi numerals 104\newif \ifk@sra % Kasra always below char 105 106\newif \ifp@sht % loop chars, e as two dots, diphtongs 107\newif \ifurd@ % e as long yah, urdu accent, two hah chars 108\newif \ifm@gh % variants of fah, vah and qaf 109\newif \ift@rk % special transliteration and coding 110\newif \ifk@rd % special transliteration and coding 111\newif \ifs@nd % special transliteration and coding 112\newif \ifu@gh % special transliteration and coding 113\newif \ifm@lay % special transliteration and coding 114\newif \ifk@sh % special transliteration and coding 115 116\newif \ifn@arab % load Arabic default 117 118%%%%%%%%%%%%%%%%%%% various robust options %%%%%%%%%%%%%%%%%%%%% 119 120\pdef \yahdots {\yahd@tstrue } \pdef \yahnodots {\yahd@tsfalse } 121\pdef \accentshigh {\acc@hitrue } \pdef \accentslow {\acc@hifalse } 122\pdef \oldtanwin {\aN@aliffalse } \pdef \newtanwin {\aN@aliftrue } 123\pdef \oldhamza {\qur@ntrue } \pdef \newhamza {\qur@nfalse } 124 125%%%%%%%%%%%%%%%%%%% various defaults %%%%%%%%%%%%%%%%%%%%% 126 127\def \transtrue {% activate the transliteration 128\iftr@ns \else \tr@zdmg \fi \let \iftrans \iftrue } 129 130\let \tr@zdmg \relax \n@arabtrue 131 132\def \arab@output {\ifx \a@lang \a@arab \else 133\tr@ceoff % switch to Arabic output conventions 134\def@arabchars % define character macros for Arabic 135\def@arabaccent % define accent macros for Arabic 136\def@arabvoc % define vowel parsing routines for Arabic 137\def@arabstrut % define strut for Arabic 138\tr@zdmg % define standard transliteration 139\let \a@write \a@@write \let \a@write@hook \relax 140\tr@ceon \let \a@lang \a@arab \fi } 141 142\def \a@arab {ARABIC} \def \a@lang {NONE} 143 144%%%%%%%%%%%%%%%%%%% ML-TeX compatibility (br) %%%%%%%%%%%%%%%%%%%%% 145 146\newcount \arab@charsubdefmax \arab@charsubdefmax \m@ne 147 148\ifx \charsubdefmax \undefined 149 \csname newcount\endcsname \charsubdefmax 150\else % save actual \charsubdefmax value 151 \arab@charsubdefmax=\charsubdefmax 152 % restore it, when outputting a new box in \output routine 153 \csname newtoks\endcsname \a@@output \a@@output=\output 154 \output={\charsubdefmax \arab@charsubdefmax \the\a@@output } 155\fi 156 157%%%%%%%%%%%%%%%%%%% language selection %%%%%%%%%%%%%%%%%%%%% 158 159\def \all@false {% reset language code to default 160\k@rdfalse \t@rkfalse \m@ghfalse \urd@false \p@shtfalse 161\s@ndfalse \m@layfalse \u@ghfalse \k@srafalse 162\h@mzafalse \@ssimfalse \iz@fetfalse \yahd@tsfalse \k@fsfalse \f@rsnfalse 163\let \vocalize \v@calize \let \fullvocalize \fullv@calize 164\arab@output \catcode`\<=\active } 165 166% all language selection commands are robust! 167 168\pdef \setarab {% kaf with mark, hamza rules, yah with dots 169\all@false \h@mzatrue \@ssimtrue \yahd@tstrue \oldtanwin 170\def \a@defaultfont {\setnash }} 171 172\pdef \setmaghribi {% variants of fah and qaf 173\setarab \m@ghtrue } 174 175\pdef \setfarsi {% no kaf mark, yah without dots, izafet 176\all@false \iz@fettrue \h@mzatrue \@ssimtrue \k@fstrue \f@rsntrue 177\newtanwin \def \a@defaultfont {\setnast }} 178 179\pdef \setkurdish {% no kaf mark, yah without dots, izafet 180\setfarsi \k@rdtrue } 181 182\pdef \setturk {% kaf with mark, yah without dots, izafet, hamza 183\all@false \iz@fettrue \h@mzatrue \@ssimtrue \newtanwin \t@rktrue 184\def \a@defaultfont {\setnash }} 185 186\pdef \seturdu {% two hah, long yah, urdu accent, long e, izafet 187\all@false \iz@fettrue \h@mzatrue \@ssimtrue \k@fstrue \f@rsntrue 188\newtanwin \urd@true \def \a@defaultfont {\setnast }} 189 190\pdef \setpashto {% pashto loop, e: two dots, izafet, hamza 191\all@false \iz@fettrue \h@mzatrue \@ssimtrue \yahd@tstrue \k@fstrue 192\newtanwin \p@shttrue \def \a@defaultfont {\setnast }} 193 194\pdef \setbalut {% temporary 195\setpashto} 196 197\pdef \setsindhi {% switch language specific processing 198\seturdu \h@mzafalse \ligsfalse \yahd@tstrue \s@ndtrue }% ALA-LC has dots! 199 200%\seturdu \h@mzafalse \ligsfalse \yahd@tsfalse \s@ndtrue }% A.Pandey not 201 202\pdef \setmalay {% p, ng, ny 203\seturdu \yahd@tstrue \m@laytrue \def \a@defaultfont {\setnash }} 204 205\pdef \setuighur {% switch language specific processing 206\let \vocalize \novocalize \let \fullvocalize \novocalize 207\novocalize \@ssimfalse \h@mzafalse 208\u@ghtrue \def \a@defaultfont {\setnash }} 209 210\pdef \setkashmiri {% Kashmiri language mode 211\seturdu \k@shtrue \newarabfont \settrans{kashmiri}} 212 213\pdef \setverb {% no special processing 214\all@false \yahd@tstrue \oldtanwin \def \a@defaultfont {\setnash }} 215 216\pdef \setnone {\catcode`\<=\@other }% deselect arabic quotations 217 218\pdef \setquot {\catcode`\<=\active }% select arabic quotations 219 220\pdef \setnoquot {\catcode`\<=\@other }% deselect arabic quotations 221 222%%%%%%%%%%%%%%%%%%%%%%% vowelization options %%%%%%%%%%%%%%%%%%%%%%%% 223 224% must be robust! 225 226\pdef \novocalize {% no diacritics except explicitly indicated 227\@vocalsfalse \v@cfalse \@sukunfalse \@sukfalse } 228 229\pdef \v@calize {% diacritics for short vowels only 230\@vocalstrue \v@ctrue \@sukunfalse \@sukfalse } 231 232\pdef \fullv@calize {% all diacritics 233\@vocalstrue \v@ctrue \@sukuntrue \@suktrue } 234 235\let \vocalize \v@calize \let \fullvocalize \fullv@calize 236 237%%%%%%%%%%%%%%%%%%%%%%%% robust font selection %%%%%%%%%%%%%%%%%%%%%%%% 238 239\def \setarabfont #1{% define font switching 240 \def \set@arabfont {\tr@ceoff #1\tr@ceon }} 241 242\pdef \set@nash {\setarabfont \nash } 243\pdef \set@nashbf {\setarabfont \nashbf } 244\pdef \set@nast {\setarabfont \nastaliq } 245\pdef \set@xnash {\setarabfont \xnash } 246\pdef \set@xnashbf {\setarabfont \xnashbf } 247 248% presently no nastaliq font 249\def \nastaliq {\nash } 250 251\def \newarabfont {% switch to new ArabTeX fonts version 252\setx@skels % activate new skeletons 253\let \setnash \set@xnash 254\let \setnashbf \set@xnashbf 255\let \setnastaliq \set@xnash 256\let \setnast \set@xnash 257\newfonttrue \setnash } 258 259\def \oldarabfont {% switch to old ArabTeX fonts version 260\seta@skels % activate old skeletons 261\let \setnash \set@nash 262\let \setnashbf \set@nashbf 263\let \setnastaliq \set@nash 264\let \setnast \set@nash 265\newfontfalse \setnash } 266 267\def \a@defaultfont {\setnash } 268\def \a@default {\a@defaultfont } 269\def \a@normalfont {\a@defaultfont } 270 271%%%%%%%%%%%%%%%%%%%%%%%% handling of special characters %%%%%%%%%%%%%%% 272 273\def \a@arab@codes {% save and set special characters 274\chardef \spc@de = \catcode`\ \catcode`\ = 10 275\chardef \dqc@de = \catcode`\" \catcode`\" = \@other 276\chardef \lsc@de = \catcode`\< \catcode`\< = \@other 277\csname originalTeX\endcsname % reset codes if BABEL is present 278\arab@charsubdefmax \charsubdefmax \charsubdefmax \m@ne } 279 280\def \a@unarab@codes {% reset catcodes 281\catcode`\ = \spc@de \catcode`\< = \lsc@de \catcode`\" = \dqc@de 282\charsubdefmax \arab@charsubdefmax 283\csname germanTeX\endcsname }% reset codes if german.sty is present 284 285\let \arab@codes \a@arab@codes \let \unarab@codes \a@unarab@codes 286 287%%%%%%%%%%%%%%%%%%%%%%% Arabic environment %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 288 289\newif \ifin@arab % inside Arabic environment? 290 291\def \arabtext {% environment for RTL formatting 292\a@parparams % aoutput::a@parparams 293\the\arabtext@hook \test@token } 294 295\newtoks \arabtext@hook 296 297\arabtext@hook = {% initialize RTL environment 298\in@arabtrue \a@parindent \parindent \a@parskip \parskip 299\edef \a@@font {\the\font }% 300\ifhmode \a@oldhmodetrue \else \a@oldhmodefalse \fi 301\a@vmodetrue \a@@everypar {}% 302\let \| \break \def \\{\hfil \break }% 303\let \emphasize \underbar % define internal commands 304\let \a@last@line \short@line \let \a@put@line \put@line 305\arab@codes \set@arabfont \@waslafalse \@wasfalse 306\def \next@command {\test@special}} 307 308\def \at@arabtext #1{% extend the initialization 309\arabtext@hook \xpa{\the\arabtext@hook #1}} 310 311\let \at@arabtex \at@arabtext % catch typo 312 313\def \a@par {% close a RTL paragraph 314\ifa@vmode \else % terminate last RTL line 315\a@last@line \spreadfalse \a@vmodetrue 316\parindent \a@parindent \parskip \a@parskip 317\a@resetpar \a@par@hook % aoutput:: 318\ifnum \tracingarab > 0 \message {##}\fi 319\fi } 320 321\let \a@@par \a@par % save for \a@@everypar in \a@c@autopar 322 323\def \endarabtext {% close RTL environment 324\a@last@line 325\ifa@oldhmode \noindent \fi 326\ifnum \tracingarab > 0 \message {||}\fi 327\global \@ignoretrue } 328 329\let \RLtext \arabtext \let \arabtex \arabtext % catch typo 330\let \endRLtext \endarabtext \let \endarabtex \endarabtext % catch typo 331 332%%%%%%%%%%%%%%%%%%%%%%%%%% next token %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 333 334\a@accent = {\lq \rq \cap \MIN \IN \a@tok \shadda \madda \sukun 335 \raphe \dagesh \mappiq \ldot \rdot \cdot \maqqef \abbr \,} 336 337{\catcode `\^^a0 12 \gdef \sp@ce {^^a0} 338}% catcode ^^a0 339 340\a@digits = {0123456789} \a@paren = {()[]} 341\a@first = {.^_-'`~,|"=:} % default, scanner dependent 342 343\def \test@@token {\iftest@command \tracingmacros 0 \fi 344\let \a@@word \empty \get@token } 345 346\def \get@token {\futurelet \next@token \test@space } 347 348\let \test@token \test@@token % get next token 349 350\def \test@space {% check for LTR space 351\if \space \nxp\next@token \a@@putword \xpa\kill@space 352\else \xpa\next@command \fi }% hook for acmd, aedpatch, arabext 353 354\xpa\def \xpa\kill@space \space {% gobble LTR space 355\futurelet \next@token \test@special } 356 357\xpa\def \xpa\kill@sp@ce \sp@ce {% gobble RTL space 358\futurelet \next@token \test@space } 359 360\def \obey@space {% after control characters 361\a@spacefalse \futurelet \next@token \obey@@space } 362 363\def \obey@@space {% check for space after control character 364\if \space \nxp\next@token \a@spacetrue \fi \test@space } 365 366\def \test@rest {% continue after \control sequence in text 367\global\let \test@token \test@@token % global! 368\xpa \xpa \xpa \test@token \xpa \a@rest \space } 369 370%%%%%%%%%%%%%%%%%%%%%% special cases %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 371 372\long\def \test@special #1{% check for special cases 373\if \bgroup \nxp \next@token % arabic group 374 \a@@putword \def \next {\arab@group {#1}}\else 375\if \relax \nxp #1% % command 376 \if\is@in@set #1\a@accent % known to scanner 377 \a@@append {#1}\def \next {\get@token }% 378 \else % general command 379 \a@@putword \def \next {\test@command #1}% 380 \fi \else 381\if \sp@ce \nxp \next@token % RTL space 382 \a@@putword \def \next {\get@token }\else 383\ifcat \nxp ~\nxp #1% % active character 384 \a@@putword \def \next {\test@command #1}\else 385\if \nxp <\nxp #1\unarab@codes % Roman insert 386 \a@@putword \let \next \test@insert \else 387\ifx $#1\unarab@codes % Math insert 388 \a@@putword \let \next \test@math 389\else \a@@append {#1}\def \next {\get@token}% % normal case 390\fi\fi\fi\fi\fi\fi \next } 391 392\def \a@@putword {% process characters 393\ifx \a@@word \empty \else 394 \ifarab \putwordb@x {\xpa\arab@item \a@@word \@@ }\fi 395 \a@spacetrue \xpa\a@showinput \xpa{\a@@word }% 396 \let \a@@word \empty 397\fi } 398 399\def \a@@append #1{% add character 400\a@extend \a@@word {#1}} 401 402%%%%%%%%%%%%%%%%%%%%%% Arabic word %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 403 404\def \arab@item #1#2\@@ {% split the word if necessary 405\ifx \relax #1\relax \else % empty word 406\ifx \relax #2\relax \a@rabwrite {#1}\else % single character 407\if\is@in@set #1\a@first 408 \a@rabwrite {#1#2}\else % start symbol: word 409\if\is@in@set #1\a@digits 410 \a@split #1#2\@@ \else % digit: number 411\if\is@in@set #1\a@paren 412 \arab@item #2\@@ \a@rabwrite {#1}\else % parenthesis: test content 413 \a@rabwrite {#1#2}% % normal case 414\fi\fi\fi\fi\fi } 415 416\def \a@rabwrite #1{% process an Arabic word (called within a group) 417\tracingmacros 0 % use \test@XXXtrue for testing ! 418 \a@scan #1>% % generate the token sequence 419 \xpa \a@parse \the\a@tokens >% split it into syllables and reverse 420 \xpa \a@write \the\a@revwd >% output the word 421\ifnum \tracingarab > 2 \message {.}\fi } 422 423%%%%%%%%%%%%%%%%%%%%%%%%%% Arabic commands %%%%%%%%%%%%%%%%%%%%%%%%%%%% 424 425\gdef \a@c@last@ {\\} \gdef \a@c@put@ {\|} \gdef \a@c@par@ {\par } 426 427{\catcode `\^ 7 \catcode `\^^M=\active \gdef \a@c@M {^^M}} 428 429{\catcode `\ =\active\gdef\a@c@SP{ }} 430 431\long \def \test@command #1{% check for special commands 432\gdef \a@arg {#1}\let \next \test@token 433\ifx \a@arg \a@c@par@ \a@@par \else % \par 434\ifx \a@arg \a@c@M \a@@par \else % \obeylines 435\ifx \a@arg \a@c@SP \else % \obeyspaces 436\ifx \a@arg \a@c@last@ \a@last@line \else % \\ 437\ifx \a@arg \a@c@put@ \a@put@line \else % \| 438 \def \next {\a@command #1}% process the command inside "acmd.sty" 439\fi\fi\fi\fi\fi \next } 440 441%%%%%%%%%%%%%%%%%%%%%%%%%% Arabic groups %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 442 443\def \arab@group #1{% process the next group 444\bgroup \initlineb@x 445\def \end {\global \setbox1 \hbox {\unhbox \lineb@x}% 446\egroup \putwordb@x {\unhbox1 }\a@spacetrue \test@token }% last line 447\test@token #1 \end } 448 449\def \a@sequence #1{% put a sequence of words into a \hbox 450\bgroup \transfalse \showfalse \let \end \relax 451\let \a@last@line \finish@line \let \a@put@line \break@line 452\def \next@command {\test@special}\let \put@word \addt@line 453\initlineb@x \test@token #1 \end \box\lineb@x \egroup } 454 455%%%%%%%%%%%%%%%%%%%%%%%%%% arabic number %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 456 457\def \a@split #1#2\@@ {% next word starts with digit 458\ifx \relax #2\relax \a@rabwrite {#1}\else 459 \def \a@body {}\def \a@number {#1}\a@splitnumber #2\@@ 460 \xpa \a@rabwrite \xpa {\a@body }% 461\fi } 462 463%{\catcode `\B =12 \gdef \f@sila {B}} % cf. awrite::ac@other 464%{\catcode `\C =12 \gdef \h@phen {C}} 465 466\def \a@splitnumber #1#2\@@ {% process word starting with digit 467\if\is@in@set #1\a@digits \edef \a@number {#1\a@number }\else 468\ifx -#1\edef \a@number {\h@phen \a@number }\else 469\ifx /#1\edef \a@number {/\a@number }\else 470\ifx ,#1\ifx \relax #2\relax 471 \edef \a@body {\a@body \a@number #1}\def \a@number {}% 472 \else \edef \a@number {\f@sila \a@number }\fi 473\else \edef \a@body {\a@body \a@number #1}\def \a@number {}% 474\fi\fi\fi\fi 475\ifx \relax #2\relax \edef \a@body {\a@body \a@number}\let \next \relax 476\else \def \next {\a@splitnumber #2\@@ }% 477\fi \next } 478 479%%%%%%%%%%%%%%%%%%%%%%%%%% insertions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 480 481\def \test@math #1${% Math insertion in Arabic text 482\def \next {#1}% test for display math 483\ifx \next \empty \def \next 484 {\begingroup \endarabtext $$\aftergroup \endgroup 485 \aftergroup \a@spacefalse \aftergroup \test@token }% 486\else \def \next 487 {\putwordb@x {$#1$}\a@spacetrue \arab@codes \test@token }% 488\fi \next } 489 490\def \test@insert #1>{% Roman insertion in Arabic text 491\putwordb@x {\rm #1}\a@spacetrue \arab@codes \test@token } 492%\putwordb@x {\a@@font #1}\a@spacetrue \arab@codes \test@token } 493 494% cf. abidir::\LR 495 496%%%%%%%%%%%%%%%%%%%%%%%%%% verbatim mode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 497 498\def \a@showinput #1{% show verbatim text and transliteration 499\ifshow \a@@verb {#1}\fi 500\iftrans {\tracingmacros 0 \set@transfont \trans@text #1 \end }\fi } 501 502\def \a@@verb #1{\def \verb@text {#1}% list input words verbatim 503 {\tracingmacros 0 \penalty \z@ \tt 504 \xpa \get@meaning \meaning \verb@text }\ } 505 506\def \get@meaning #1>{} % strip off macro header 507 508\def \a@verb #1>{\a@@verb {#1}} 509 510%%%%%%%%%%%%%%%%%%%%%%%%%%%% arabic insertion %%%%%%%%%%%%%%%%%%%%%%%% 511 512{\catcode `\< = \@other % better make sure 513 514\gdef \a@ins {% arabic insertion or 'less' 515\ifmmode \global\let \a@less < 516\else \global\let \a@less \arab@insert \leavevmode 517 \bgroup \arab@codes \set@arabfont \@waslafalse \@wasfalse 518\fi \a@less } 519 520\gdef \<{\protect \a@ins } % explicit command \< 521 522\catcode`\< = \active % prepare active < 523\gdef <{\protect \a@ins } 524} % catcode < 525 526\def \break@line {% \| inside insertion 527\box\lineb@x \break \initlineb@x } 528 529\def \finish@line {% \\ inside insertion 530\box\lineb@x \hfil \break \initlineb@x } 531 532\def \arab@insert #1>{% Arabic insertion in Roman text 533\ifshow \a@@verb {#1}\fi % verbating listing 534\ifarab \a@sequence {#1} \fi % arabic writing 535\iftrans \set@transfont \trans@text #1 \end \/\fi 536\ifnum \tracingarab > \@ne \message {>}\fi 537\unskip \egroup } 538 539% cf. abidir::\LR 540 541%%%%%%%%%%%%%%%%%%%%%%%%% transliteration %%%%%%%%%%%%%%%%%%%%%%%%%%%% 542 543\def \settransfont #1{% set transliteration style or \style 544\if \relax \nxp#1\relax \def \set@transfont 545 {\tr@ceoff #1\csname selectfont\endcsname \tr@ceon }% 546\else \def \set@transfont 547 {\tr@ceoff \csname #1\endcsname 548 \csname selectfont\endcsname \tr@ceon }% 549\fi} 550 551\settransfont {\rm \it }% standard font for transliteration 552 553\long \def \trans@text #1{% check for special cases 554\leavevmode \def \next {\trans@text }% 555\if\is@in@set {#1}\a@first \def \next {\trans@elem #1}\else % normal case 556\ifx \end #1\let \next \relax \else 557\ifx \par #1\endgraf \else 558\ifx \\#1\hfil \break \else 559\ifx \|#1\hfil \break \else 560\ifx \emphasize #1\def \next {\a@emp }\else 561\if \relax \nxp #1\relax % ignore control sequences 562\else \def \next {\trans@elem #1}% normal case 563\fi\fi\fi\fi\fi\fi\fi \next } 564 565\def \a@emp #1{\trans@text #1 } 566 567\def \trans@elem #1 {% transliterate next word of text 568\a@transword {#1}\trans@text } 569 570\def \a@transword #1{% transliterate a word 571{\tracingmacros 0 \a@scan #1>\xpa \a@trans \the\a@tokens >\ }} 572 573\ifx \a@trans \undefined % atrans.sty not yet loaded 574\def \a@trans #1>{\gdef \a@trans ##1>{\relax }% default 575\message {`atrans.sty' not loaded; transliteration ignored.}} 576\fi 577 578%%%%%%%%%%%%%%%%%%%%%%%%% initialization %%%%%%%%%%%%%%%%%%%%%%%% 579 580\def \startarab {% set default initializations 581\newarabfont 582\a@normalfont % default font 583\transfalse \arabtrue \vocalize \ligsfalse 584\tracingarab = 0 \setnone } % \catcode < := 12 for user macros 585 586%%%%%%%%%%%%%%%%%%%%%%% load the later passes %%%%%%%%%%%%%%%%%%%%%% 587 588\UsePackage {acmd} % load the command processor module 589\UsePackage {afonts} % load the default fonts 590\UsePackage {ascan} % generate a token sequence 591\UsePackage {aparse} % parse it into syllables and reverse them 592\UsePackage {awrite} % generate the basic writing 593\UsePackage {aligs} % modify for any ligatures 594\UsePackage {aoutput} % generate output lines 595\UsePackage {abidir} % bidirectional linebreaking 596\UsePackage {atrans} % generate the transliteration 597\UsePackage {alatex} % extensions for LaTeX 598\UsePackage {abjad} % abjad numerals 599\ifx \edmacloaded \relax 600 \UsePackage {aedpatch} \fi % patches for EDMAC ? 601\ifx \undefined \peek@token \else 602\ifx \undefined \bbl@test@token 603 \UsePackage {arababel} \fi\fi % patches for old BABEL ? 604\ifx \CJK \undefined \else 605 \UsePackage {acjk} \fi % patches for CJK ? 606\UsePackage {apatch} % any last minute corrections 607 608%%%%%%%%%%%%%%%%%%%%%%% statistics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 609 610\def \arab@stat {{\newlinechar `$ 611\wlog {$Parameterless commands valid in Arabic mode:} 612\wlog {\space (\the\a@@listzero )} 613\wlog {$Commands with 1 parameter valid in Arabic mode:} 614\wlog {\space (\the\a@@listone )} 615\wlog {$Commands with 2 parameters valid in Arabic mode:} 616\wlog {\space (\the\a@@listtwo )} 617\wlog {$User defined commands valid in Arabic mode:} 618\wlog {\space (\the\a@@listreg )}}} 619 620\let \arabstat \arab@stat 621 622%%%%%%%%%%%%%%%%%%%%%%%%%%%% here we go %%%%%%%%%%%%%%%%%%%%%%% 623 624\let \wlog \a@wlog 625 626\startarab \a@report 627 628\a@message {... now be patient ... } 629 630\catcode`\" = \ar@bdqcode \catcode`\@ = \ar@batcode 631 632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 633\endinput 634%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 635