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