summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-04-22 17:24:07 +0000
committerKarl Berry <karl@freefriends.org>2007-04-22 17:24:07 +0000
commit8fcfac977e10f5e5d3ce8a74fd0505b4e62f56aa (patch)
tree37bf55bb929c32099a507687168835a01c0d4ef4 /Master/texmf-dist/tex/xelatex
parent09443fcc9d28c368cae1ee0a429df3196b4ea706 (diff)
new xelatex package bidi (17apr07)
git-svn-id: svn://tug.org/texlive/trunk@4176 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex')
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bidi.sty299
1 files changed, 299 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidi.sty b/Master/texmf-dist/tex/xelatex/bidi/bidi.sty
new file mode 100644
index 00000000000..9d4fe981f0d
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/bidi.sty
@@ -0,0 +1,299 @@
+%%
+%% This is file `bidi.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `package')
+%%
+%% ____________________________
+%% The bidi package
+%% (C) 2007 François Charette
+%% License information appended
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bidi}
+ [2007/03/06 v0.2 Bidirectional typesetting in XeLaTeX]
+%% this is not used for now:
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifx\TeXXeTstate\undefined\else%
+ \TeXXeTstate=1
+\fi
+\ifx\beginL\@undefined%
+ \newlinechar`\^^J
+ \typeout{^^JTo avoid this error message,^^J%
+ run TeX--XeT or e-TeX engine instead of regular TeX.^^J}
+ \errmessage{Right-to-Left Support Error: use TeX--XeT or e-TeX
+ engine}%
+\fi
+\newif\if@rl
+\let\n@xt=\
+\def\LR{\protect\pLR}%
+\def\pLR{\protect\afterassignment\moreLR \let\n@xt= }
+\def\moreLR{\bracetext \aftergroup\endL \beginL\@rlfalse}
+\def\RL{\protect\pRL}
+\def\pRL{\protect\afterassignment\moreRL \let\n@xt= }
+\def\moreRL{\bracetext \aftergroup\endR \beginR\@rltrue}
+\def\bracetext{\ifcat\n@xt{\else\ifcat\n@xt}\fi
+ \errmessage{Missing left brace has been substituted}\fi \bgroup}
+\everydisplay{\if@rl\aftergroup\beginR\fi }
+\def\rl@everypar{\if@rl{\setbox\z@\lastbox\beginR\usebox\z@}\fi}
+\let\o@everypar=\everypar
+%% The following, surely, will not play well with all packages, e.g. ledmac
+%% But we now use this instead, taken from Arabicore.sty in the Arabi package.
+%% Thanks to Youssef Jabri! Shukran jazilan!
+\newtoks\n@everypar
+\n@everypar\expandafter{\the\o@everypar}
+\o@everypar{\rl@everypar\the\n@everypar}
+\let\everypar=\n@everypar
+\def\@ensure@RL#1{\if@rl#1\else\RL{#1}\fi}
+\def\@ensure@LR#1{\if@rl\LR{#1}\else#1\fi}
+%%%preserve logos
+\let\@@TeX\TeX
+\def\TeX{\LR{\@@TeX}}
+\let\@@LaTeX\LaTeX
+\def\LaTeX{\LR{\@@LaTeX}}
+\let\@@LaTeXe\LaTeXe
+\def\LaTeXe{\LR{\@@LaTeXe}}
+\@ifpackageloaded{xltxtra}{
+\let\@@XeTeX\XeTeX
+\def\XeTeX{\LR{\@@XeTeX}}
+}{}
+%%VARIOUS LATEX MACROS
+\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
+ \if@rl
+ \advance\@totalleftmargin \rightmargin
+ \else
+ \advance\@totalleftmargin \leftmargin
+ \fi
+ \parshape \@ne \@totalleftmargin \linewidth
+ \ignorespaces}
+%%%
+\def\@dottedtocline#1#2#3#4#5{%
+ \ifnum #1>\c@tocdepth \else
+ \vskip \z@ \@plus.2\p@
+ {\if@rl\rightskip\else\leftskip\fi #2\relax
+ \if@rl\leftskip\else\rightskip\fi \@tocrmarg \parfillskip
+ -\if@rl\leftskip\else\rightskip\fi
+ \parindent #2\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima #3\relax
+ \advance\if@rl\rightskip\else\leftskip\fi \@tempdima
+ \null\nobreak\hskip -\if@rl\rightskip\else\leftskip\fi
+ {#4}\nobreak
+ \leaders\hbox{$\m@th
+ \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
+ mu$}\hfill
+ \nobreak
+ \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor \beginL#5\endL}%
+ \par}%
+ \fi}
+%%%
+\def\raggedright{%
+ \let\\\@centercr
+ \leftskip\z@skip\rightskip\@flushglue
+ \parindent\z@\parfillskip\z@skip}
+\let\@@raggedleft=\raggedleft
+\let\@@raggedright=\raggedright
+\renewcommand\raggedleft{\if@rl\@@raggedright%
+ \else\@@raggedleft\fi}
+\renewcommand\raggedright{\if@rl\@@raggedleft%
+ \else\@@raggedright\fi}
+\let\@@@underline=\underline
+\def\underline#1{\@@@underline{\if@rl\RL{#1}\else #1\fi}}
+\if@compatibility
+ \let\undertext=\underline
+\fi
+\newif\if@rl@footnote
+\if@rl\@rl@footnotetrue\else\@rl@footnotefalse\fi
+\let\@@footnoterule=\footnoterule
+\def\LRfootnoterule{\@@footnoterule}
+\def\RLfootnoterule{\vskip -\baselineskip\hb@xt@\hsize{\hss\vbox{\@@footnoterule}}}
+\def\setfootnoteRL{\@rl@footnotetrue}
+\def\unsetfootnoteRL{\@rl@footnotefalse}
+\def\setfootnoteLR{\unsetfootnoteRL}
+\def\footnoterule{\if@rl@footnote\RLfootnoterule\else\LRfootnoterule\fi}
+\def\setRL{\@rltrue\@rl@footnotetrue}
+\def\unsetRL{\@rlfalse\@rl@footnotefalse}
+\def\setLR{\unsetRL}
+\long\def\@footnotetext#1{\insert\footins{%
+ \if@rl@footnote\@rltrue\else\@rlfalse\fi
+ \reset@font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark
+ }%
+ \color@begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
+ \color@endgroup}}%
+\long\def\@mpfootnotetext#1{%
+ \global\setbox\@mpfootins\vbox{%
+ \if@rl@footnote\@rltrue\else\@rlfalse\fi
+ \unvbox\@mpfootins
+ \reset@font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel
+ {\csname p@mpfootnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
+ \color@endgroup
+ }}
+\ifx\@textcolor\@undefined\else%
+\AtBeginDocument{%
+ \def\@textcolor#1#2#3{%
+ \if@rl%
+ \beginL\protect\leavevmode{\color#1{#2}\beginR#3\endR}\endL%
+ \else%
+ \protect\leavevmode{\color#1{#2}#3}%
+ \fi%
+ }%
+}%
+\fi
+%%%
+\def\abjad#1{%
+\ifnum#1>1999 \PackageWarning{bidi}{Illegal value (#1) for abjad numeral} {#1}
+\else
+ \ifnum#1<\z@\space\PackageWarning{bidi}{Illegal value (#1) for abjad numeral}%
+ \else
+ \ifnum#1<10\expandafter\abj@num@i\number#1%
+ \else
+ \ifnum#1<100\expandafter\abj@num@ii\number#1%
+ \else
+ \ifnum#1<\@m\expandafter\abj@num@iii\number#1%
+ \else
+ \ifnum#1<\@M\expandafter\abj@num@iv\number#1%since #1<2000, we must have 1000
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+\fi
+}
+
+\def\abjadmaghribi#1{%
+\ifnum#1>1999 \PackageWarning{bidi}{Illegal value (#1) for abjad numeral} {#1}
+\else
+ \ifnum#1<\z@\space\PackageWarning{bidi}{Illegal value (#1) for abjad numeral}%
+ \else
+ \ifnum#1<10\expandafter\abj@num@i\number#1%
+ \else
+ \ifnum#1<100\expandafter\abj@maghribi@num@ii\number#1%
+ \else
+ \ifnum#1<\@m\expandafter\abj@maghribi@num@iii\number#1%
+ \else
+ \ifnum#1<\@M\expandafter\abj@maghribi@num@iv\number#1%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+\fi
+}
+
+\def\hebrewnumeral#1{%
+\ifnum#1>9999 \PackageWarning{bidi}{Illegal value (#1) for Hebrew numeral} {#1}
+\else
+ \ifnum#1<\z@\space\PackageWarning{bidi}{Illegal value (#1) for Hebrew numeral}%
+ \else
+ \ifnum#1<10\expandafter\heb@num@i\number#1%
+ \else
+ \ifnum#1<100\expandafter\heb@num@ii\number#1%
+ \else
+ \ifnum#1<\@m\expandafter\heb@num@iii\number#1%
+ \else
+ \ifnum#1<\@M\expandafter\heb@num@iv\number#1%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+\fi
+}
+\def\abjad@zero{}
+\def\hebnum@zero{}
+\def\abj@num@i#1{%
+ \ifcase#1\or\char"0627 \or\char"0628 \or\char"062C \char"200D\or\char"062F %
+ \or\char"0647 \or\char"0648 \or\char"0632 \or\char"062D \or\char"0637 \fi
+ \ifnum#1=\z@\abjad@zero\fi}
+\def\abj@num@ii#1{%
+ \ifcase#1\or\char"064A \or\char"0643 \or\char"0644 \or\char"0645 \or\char"0646 %
+ \or\char"0633 \or\char"0639 \or\char"0641 \or\char"0635 \fi
+ \ifnum#1=\z@\fi\abj@num@i}
+\def\abj@num@iii#1{%
+ \ifcase#1\or\char"0642 \or\char"0631 \or\char"0634 \or\char"062A \or\char"062B %
+ \or\char"062E \or\char"0630 \or\char"0636 \or\char"0638 \fi
+ \ifnum#1=\z@\fi\abj@num@ii}
+\def\abj@num@iv#1{%
+ \ifcase#1\or\char"063A \fi
+ \ifnum#1=\z@\fi\abj@num@iii}
+
+\def\abj@maghribi@num@ii#1{%
+ \ifcase#1\or\char"064A \or\char"0643 \or\char"0644 \or\char"0645 \or\char"0646 %
+ \or\char"0635 \or\char"0639 \or\char"0641 \or\char"0636 \fi
+ \ifnum#1=\z@\abjad@zero\fi\abj@num@i}
+\def\abj@maghribi@num@iii#1{%
+ \ifcase#1\or\char"0642 \or\char"0631 \or\char"0633 \or\char"062A \or\char"062B %
+ \or\char"062E \or\char"0630 \or\char"0638 \or\char"063A \fi
+ \ifnum#1=\z@\fi\abj@maghribi@num@ii}
+\def\abj@maghribi@num@iv#1{%
+ \ifcase#1\or\char"0634 \fi
+ \ifnum#1=\z@\fi\abj@maghribi@num@iii}
+
+\def\heb@num@i#1{%
+ \ifcase#1\or\char"05D0 \or\char"05D1 \or\char"05D2 \or\char"05D3 \or\char"05D4 %
+ \or\char"05D5 \or\char"05D6 \or\char"05D7 \or\char"05D8 \fi
+ \ifnum#1=\z@\hebnum@zero\fi}
+\def\heb@num@ii#1{%
+ \ifcase#1\or\char"05D9 \or\char"05DB \or\char"05DC \or\char"05DE \or\char"05E0 %
+ \or\char"05E1 \or\char"05E2 \or\char"05E4 \or\char"05E6 \fi
+ \ifnum#1=\z@\fi\heb@num@i}
+\def\heb@num@iii#1{%
+ \ifcase#1\or\char"05E7 \or\char"05E8 \or\char"05E9 \or\char"05EA \or\char"05DA %
+ \or\char"05DD \or\char"05DF \or\char"05E3 \or\char"05E5 \fi
+ \ifnum#1=\z@\fi\heb@num@ii}
+\def\heb@num@iv#1{%
+ \ifcase#1\or\char"05D0\char"05F3 \or\char"05D1\char"05F3 \or\char"05D2\char"05F3 %
+ \or\char"05D3\char"05F3 \or\char"05D4\char"05F3 \or\char"05D5\char"05F3 %
+ \or\char"05D6\char"05F3 \or\char"05D7\char"05F3 \or\char"05D8\char"05F3 \fi
+ \ifnum#1=\z@\fi\heb@num@iii}
+%%
+%% Copyright (C) 2007 by François Charette <firmicus at gmx dot net>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by François Charette.
+%%
+%% This work consists of the file bidi.dtx
+%% and the derived files bidi.sty and bidi.pdf.
+%%
+%%
+%% End of file `bidi.sty'.