summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-10-09 23:43:27 +0000
committerKarl Berry <karl@freefriends.org>2011-10-09 23:43:27 +0000
commit09ab3a5d73d4bd916aa1fdfd114753087c851fe4 (patch)
tree540cfc9b0a7e5a530bdc9f8bc52fe9dbf4b50a92 /Master/texmf-dist/tex
parent0b310accd4feabf084b43f1c0286ea6d78eceae9 (diff)
bidi (9oct11)
git-svn-id: svn://tug.org/texlive/trunk@24248 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/bidi/bidi.sty45
-rw-r--r--Master/texmf-dist/tex/latex/bidi/biditools.sty495
-rw-r--r--Master/texmf-dist/tex/latex/bidi/hyperref-xetex-bidi.def16
-rw-r--r--Master/texmf-dist/tex/latex/bidi/loadingorder-bidi.def9
-rw-r--r--Master/texmf-dist/tex/latex/bidi/xetex-bidi.def4
5 files changed, 512 insertions, 57 deletions
diff --git a/Master/texmf-dist/tex/latex/bidi/bidi.sty b/Master/texmf-dist/tex/latex/bidi/bidi.sty
index 2444b8a391f..f300d867951 100644
--- a/Master/texmf-dist/tex/latex/bidi/bidi.sty
+++ b/Master/texmf-dist/tex/latex/bidi/bidi.sty
@@ -14,7 +14,7 @@
%%
\NeedsTeXFormat{LaTeX2e}
\def\bididate{2012/01/01}
-\def\bidiversion{v1.3.5}
+\def\bidiversion{v1.3.8}
\ProvidesPackage{bidi}[\bididate\space \bidiversion\space
Bidirectional typesetting in plain TeX and LaTeX]
\edef\bidiinfo{%
@@ -30,48 +30,7 @@ Location on CTAN: /macros/latex/contrib/bidi}
\edef\bidi@everyjob{\the\everyjob}
\everyjob{\bidi@everyjob\typeout{\bidiinfo}}
\RequirePackage{iftex}
-\def\@tagsextension{clo}
-\def\@definitionfileextension{def}
-\def\@iftagsloaded{\@ifl@aded\@tagsextension}
-\def\@ifdefinitionfileloaded{\@ifl@aded\@definitionfileextension}
-\def\eqnewif#1#2{%
- \count@\escapechar \escapechar\m@ne
- \let#1\iffalse
- \let#2\iffalse
- \eq@if#1#2\iftrue
- \eq@if#1#2\iffalse
- \escapechar\count@}
-\def\eq@if#1#2#3{%
- \expandafter\def\csname\expandafter\@gobbletwo\string#1%
- \expandafter\@gobbletwo\string#3\endcsname
- {\let#1#3%
- \let#2#3}%
- \expandafter\def\csname\expandafter\@gobbletwo\string#2%
- \expandafter\@gobbletwo\string#3\endcsname
- {\let#2#3%
- \let#1#3}}
-\newcommand*{\if@bidi@csdef}[1]{%
- \ifcsname#1\endcsname
- \expandafter\@firstoftwo
- \else
- \expandafter\@secondoftwo
- \fi}
-\newcommand{\if@bidi@def}[1]{%
- \ifdefined#1%
- \expandafter\@firstoftwo
- \else
- \expandafter\@secondoftwo
- \fi}
-\newcommand{\bidi@namelongdef}[1]{%
- \long\expandafter\def\csname #1\endcsname}
-\def\bidi@ensure@newcommand{\@star@or@long\bidi@ensure@new@command}
-\def\bidi@ensure@new@command#1{%
- \begingroup \escapechar\m@ne\xdef\@gtempa{{\string#1}}\endgroup
- \expandafter\if@bidi@csdef\@gtempa
- {\relax%
- \let\@ifdefinable\@rc@ifdefinable%
- \new@command#1}{\new@command#1}}
-\def\bidi@ensure@newlength#1{\if@bidi@def#1{}{\newskip#1}}
+\RequirePackage{biditools}
\eqnewif{\if@RTLmain}{\if@rlmain}
\eqnewif{\if@RTL}{\if@rl}
\newif\if@RTLmaths
diff --git a/Master/texmf-dist/tex/latex/bidi/biditools.sty b/Master/texmf-dist/tex/latex/bidi/biditools.sty
new file mode 100644
index 00000000000..020aad1d168
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bidi/biditools.sty
@@ -0,0 +1,495 @@
+%%
+%% This is file `biditools.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `biditools.sty')
+%%
+%% ______________________________________
+%% Copyright © 2009–2012 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{biditools}[2012/01/01 v0.1 Programming tools for bidi package]
+\def\@tagsextension{clo}
+\def\@definitionfileextension{def}
+\def\@iftagsloaded{\@ifl@aded\@tagsextension}
+\def\@ifdefinitionfileloaded{\@ifl@aded\@definitionfileextension}
+\def\eqnewif#1#2{%
+ \count@\escapechar \escapechar\m@ne
+ \let#1\iffalse
+ \let#2\iffalse
+ \eq@if#1#2\iftrue
+ \eq@if#1#2\iffalse
+ \escapechar\count@}
+\def\eq@if#1#2#3{%
+ \expandafter\def\csname\expandafter\@gobbletwo\string#1%
+ \expandafter\@gobbletwo\string#3\endcsname
+ {\let#1#3%
+ \let#2#3}%
+ \expandafter\def\csname\expandafter\@gobbletwo\string#2%
+ \expandafter\@gobbletwo\string#3\endcsname
+ {\let#2#3%
+ \let#1#3}}
+\newcommand*{\if@bidi@csdef}[1]{%
+ \ifcsname#1\endcsname
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\newcommand*{\if@bidi@csundef}[1]{%
+ \ifcsname#1\endcsname
+ \expandafter\ifx\csname#1\endcsname\relax
+ \expandafter\expandafter
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter
+ \expandafter\@secondoftwo
+ \fi
+ \else
+ \expandafter\@firstoftwo
+ \fi}
+\newcommand{\if@bidi@def}[1]{%
+ \ifdefined#1%
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\newcommand{\if@bidi@undef}[1]{%
+ \ifdefined#1%
+ \ifx#1\relax
+ \expandafter\expandafter
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter
+ \expandafter\@secondoftwo
+ \fi
+ \else
+ \expandafter\@firstoftwo
+ \fi}
+\newcommand{\if@bidi@blank}[1]{% from url.sty
+ \bidi@ifblank@i#1&&\@secondoftwo\@firstoftwo:}
+\long\def\bidi@ifblank@i#1#2&#3#4#5:{#4}
+\newcommand{\bidi@notblank}[1]{%
+ \bidi@ifblank@i#1&&\@firstoftwo\@secondoftwo:}
+\newcommand{\if@bidi@defmacro}{}
+\long\edef\if@bidi@defmacro#1{%
+ \noexpand\expandafter\noexpand\bidi@ifdefmacro
+ \noexpand\meaning#1\detokenize{macro}:&}
+\edef\bidi@ifdefmacro{%
+ \def\noexpand\bidi@ifdefmacro##1\detokenize{macro}:##2&}
+\bidi@ifdefmacro{\bidi@notblank{#2}}
+\newcommand*{\if@bidi@csmacro}[1]{%
+ \if@bidi@csdef{#1}
+ {\expandafter\if@bidi@defmacro\csname#1\endcsname}
+ {\@secondoftwo}}
+\newcommand{\if@bidi@defprimitive}[1]{%
+ \ifprimitive#1%
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\newcommand{\if@bidi@csprimitive}[1]{%
+ \expandafter\ifprimitive\csname#1\endcsname%
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\newcommand*{\bidi@csdefcs}[2]{%
+\expandafter\@ifdefinable \csname#1\endcsname{%
+\expandafter\def\csname#1\expandafter\endcsname{\csname#2\endcsname}}}
+\newcommand*{\bidi@csletcs}[2]{%
+\expandafter\@ifdefinable \csname#1\endcsname{%
+\expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname}}
+\newcommand*{\bidi@cslet}[2]{%
+\expandafter\@ifdefinable \csname#1\endcsname{%
+\expandafter\let\csname#1\endcsname#2}}
+\newcommand{\bidi@namelongdef}[1]{%
+ \long\expandafter\def\csname #1\endcsname}
+\def\bidi@ensure@newcommand{\@star@or@long\bidi@ensure@new@command}
+\def\bidi@ensure@new@command#1{%
+ \begingroup \escapechar\m@ne\xdef\@gtempa{{\string#1}}\endgroup
+ \expandafter\if@bidi@csundef\@gtempa
+ {\new@command#1}{\relax%
+ \let\@ifdefinable\@rc@ifdefinable%
+ \new@command#1}}
+\def\bidi@ensure@newlength#1{\if@bidi@undef#1{\newskip#1}{}}
+
+\protected\def\bidi@error{\PackageError{bidi}}
+\protected\def\bidi@warning{\PackageWarning{bidi}}
+\protected\def\bidi@info{\PackageInfo{bidi}}
+
+\newcommand*{\bidi@newrobustcmd}{}
+\protected\def\bidi@newrobustcmd{\@star@or@long\bidi@new@command}
+
+\def\bidi@new@command#1{\@testopt{\bidi@newcommand#1}0}
+
+\def\bidi@newcommand#1[#2]{%
+ \@ifnextchar[%]
+ {\bidi@xargdef#1[#2]}
+ {\ifx\l@ngrel@x\relax
+ \let\l@ngrel@x\protected
+ \else
+ \protected\def\l@ngrel@x{\protected\long}%
+ \fi
+ \@argdef#1[#2]}}
+
+\long\def\bidi@xargdef#1[#2][#3]#4{%
+ \@ifdefinable#1{%
+ \expandafter\protected
+ \expandafter\def
+ \expandafter#1%
+ \expandafter{%
+ \expandafter\@testopt
+ \csname\string#1\endcsname{#3}}%
+ \expandafter\@yargdef\csname\string#1\endcsname\tw@{#2}{#4}}}
+
+\bidi@newrobustcmd*{\bidi@renewrobustcmd}{\@star@or@long\bidi@renew@command}
+
+\def\bidi@renew@command#1{%
+ \if@bidi@undef{#1}
+ {\bidi@error{\string#1 undefined}\@ehc}
+ {}%
+ \let\@ifdefinable\@rc@ifdefinable
+ \bidi@new@command#1}
+
+\bidi@newrobustcmd*{\bidi@providerobustcmd}{\@star@or@long\bidi@provide@command}
+
+\def\bidi@provide@command#1{%
+ \if@bidi@undef{#1}
+ {\def\reserved@a{\bidi@new@command#1}}
+ {\def\reserved@a{\bidi@renew@command\reserved@a}}%
+ \reserved@a}
+
+\newcommand*{\bidi@csuse}[1]{%
+ \ifcsname#1\endcsname
+ \csname#1\expandafter\endcsname
+ \fi}
+
+\newcommand{\bidi@expandonce}[1]{%
+ \unexpanded\expandafter{#1}}
+
+\def\bidi@protected{%
+ \let\@@protect\protect
+ \let\protect\@unexpandable@protect
+ \afterassignment\restore@protect}
+
+\bidi@newrobustcmd{\bidi@appto}[2]{%
+ \if@bidi@undef{#1}
+ {\edef#1{\unexpanded{#2}}}
+ {\edef#1{\bidi@expandonce#1\unexpanded{#2}}}}
+\bidi@newrobustcmd{\bidi@eappto}[2]{%
+ \if@bidi@undef{#1}
+ {\edef#1{#2}}
+ {\edef#1{\bidi@expandonce#1#2}}}
+\bidi@newrobustcmd{\bidi@gappto}[2]{%
+ \if@bidi@undef{#1}
+ {\xdef#1{\unexpanded{#2}}}
+ {\xdef#1{\bidi@expandonce#1\unexpanded{#2}}}}
+\bidi@newrobustcmd{\bidi@xappto}[2]{%
+ \if@bidi@undef{#1}
+ {\xdef#1{#2}}
+ {\xdef#1{\bidi@expandonce#1#2}}}
+
+\bidi@newrobustcmd*{\bidi@protected@eappto}{\bidi@protected\bidi@eappto}
+\bidi@newrobustcmd*{\bidi@protected@xappto}{\bidi@protected\bidi@xappto}
+
+\bidi@newrobustcmd{\bidi@preto}[2]{%
+ \if@bidi@undef{#1}
+ {\edef#1{\unexpanded{#2}}}
+ {\edef#1{\unexpanded{#2}\bidi@expandonce#1}}}
+\bidi@newrobustcmd{\bidi@epreto}[2]{%
+ \if@bidi@undef{#1}
+ {\edef#1{#2}}
+ {\edef#1{#2\bidi@expandonce#1}}}
+\bidi@newrobustcmd{\bidi@gpreto}[2]{%
+ \if@bidi@undef{#1}
+ {\xdef#1{\unexpanded{#2}}}
+ {\xdef#1{\unexpanded{#2}\bidi@expandonce#1}}}
+\bidi@newrobustcmd{\bidi@xpreto}[2]{%
+ \if@bidi@undef{#1}
+ {\xdef#1{#2}}
+ {\xdef#1{#2\bidi@expandonce#1}}}
+
+\bidi@newrobustcmd*{\bidi@protected@epreto}{\bidi@protected\bidi@epreto}
+\bidi@newrobustcmd*{\bidi@protected@xpreto}{\bidi@protected\bidi@xpreto}
+
+\bidi@newrobustcmd*{\bidi@csappto}[1]{\expandafter\bidi@appto\csname#1\endcsname}
+\bidi@newrobustcmd*{\bidi@cseappto}[1]{\expandafter\bidi@eappto\csname#1\endcsname}
+\bidi@newrobustcmd*{\bidi@csgappto}[1]{\expandafter\bidi@gappto\csname#1\endcsname}
+\bidi@newrobustcmd*{\bidi@csxappto}[1]{\expandafter\bidi@xappto\csname#1\endcsname}
+\bidi@newrobustcmd*{\bidi@protected@cseappto}{\bidi@protected\bidi@cseappto}
+\bidi@newrobustcmd*{\bidi@protected@csxappto}{\bidi@protected\bidi@csxappto}
+
+\bidi@newrobustcmd*{\bidi@cspreto}[1]{\expandafter\bidi@preto\csname#1\endcsname}
+\bidi@newrobustcmd*{\bidi@csepreto}[1]{\expandafter\bidi@epreto\csname#1\endcsname}
+\bidi@newrobustcmd*{\bidi@csgpreto}[1]{\expandafter\bidi@gpreto\csname#1\endcsname}
+\bidi@newrobustcmd*{\bidi@csxpreto}[1]{\expandafter\bidi@xpreto\csname#1\endcsname}
+\bidi@newrobustcmd*{\bidi@protected@csepreto}{\bidi@protected\bidi@csepreto}
+\bidi@newrobustcmd*{\bidi@protected@csxpreto}{\bidi@protected\bidi@csxpreto}
+
+\bidi@newrobustcmd{\if@bidi@patchable}{%
+ \bidi@dbg@trce\if@bidi@patchable
+ \begingroup
+ \@makeother\#%
+ \@ifstar\bidi@ifpatchable@i\bidi@ifpatchable}
+
+\long\def\bidi@ifpatchable#1#2{%
+ \endgroup
+ \bidi@dbg@init#1%
+ \if@bidi@undef{#1}
+ {\bidi@dbg@fail{def}\@secondoftwo}
+ {\bidi@dbg@info{def}%
+ \if@bidi@defmacro{#1}
+ {\bidi@dbg@info{mac}%
+ \bidi@ifscanable{#1}
+ {\bidi@ifhashcheck{#2}
+ {\bidi@dbg@info{tok}%
+ \bidi@ifpattern#1{#2}
+ {\bidi@dbg@info{pat}%
+ \bidi@dbg@info{pos}\@firstoftwo}
+ {\bidi@dbg@fail{pat}\@secondoftwo}}
+ {\bidi@dbg@fail{hsh}\@secondoftwo}}
+ {\bidi@dbg@fail{tok}\@secondoftwo}}
+ {\bidi@dbg@fail{mac}\@secondoftwo}}}
+
+\long\def\bidi@ifpatchable@i#1{%
+ \endgroup
+ \bidi@dbg@init#1%
+ \if@bidi@undef{#1}
+ {\bidi@dbg@fail{def}\@secondoftwo}
+ {\bidi@dbg@info{def}%
+ \if@bidi@defmacro{#1}
+ {\bidi@dbg@info{mac}%
+ \if@bidi@defparam{#1}
+ {\bidi@dbg@info{prm}%
+ \bidi@ifscanable{#1}
+ {\bidi@dbg@info{tok}%
+ \bidi@dbg@info{pos}\@firstoftwo}
+ {\bidi@dbg@fail{tok}\@secondoftwo}}
+ {\bidi@dbg@info{prl}%
+ \if@bidi@defprotected{#1}
+ {\bidi@dbg@info{pro}}
+ {}%
+ \bidi@dbg@info{pos}\@firstoftwo}}
+ {\bidi@dbg@fail{mac}\@secondoftwo}}}
+
+\bidi@newrobustcmd*{\bidi@patchcmd}{%
+ \bidi@dbg@trce\bidi@patchcmd
+ \begingroup
+ \@makeother\#%
+ \bidi@@patchcmd}
+
+\newcommand{\bidi@@patchcmd}[4][########1]{%
+ \bidi@ifpatchable#2{#3}
+ {\bidi@dbg@succ{ret}%
+ \begingroup
+ \edef\bidi@resrvda{%
+ \def\noexpand\bidi@resrvda####1\detokenize{macro:}####2->####3&{%
+ #1\def\string\bidi@resrvda\space####2{\noexpand\bidi@resrvdb####3&}}%
+ \def\noexpand\bidi@resrvdb####1\detokenize{#3}####2&{%
+ ####1\detokenize{#4}####2}%
+ \edef\noexpand\bidi@resrvda{%
+ \noexpand\bidi@resrvda\meaning#2&}}%
+ \bidi@resrvda
+ \bidi@patchcmd@scantoks\bidi@resrvda
+ \let#2\bidi@resrvda
+ \bidi@undef\bidi@resrvda
+ \@firstoftwo}
+ {\@secondoftwo}}
+
+\def\bidi@patchcmd@scantoks#1{%
+ \edef\bidi@resrvda{\endgroup
+ \unexpanded{\makeatletter\scantokens}{#1}%
+ \catcode\number`\@=\the\catcode`\@\relax}%
+ \bidi@resrvda}
+
+\newcommand\bidi@isloaded[2][]{
+ \expandafter\ifx\csname if@bidi@#2loaded@\endcsname\relax
+ \expandafter\newif\csname if@bidi@#2loaded@\endcsname
+ \fi
+ \@ifpackageloaded{#2}
+ {\csname @bidi@#2loaded@true\endcsname #1}
+ {\csname @bidi@#2loaded@false\endcsname}}
+
+\protected\def\bidi@ifscanable#1{%
+ \begingroup
+ \edef\bidi@resrvda{%
+ \def\noexpand\bidi@resrvda####1\detokenize{macro}:####2->####3&{%
+ ####1\def\string\bidi@resrvda####2{####3}}%
+ \edef\noexpand\bidi@resrvda{\noexpand\bidi@resrvda\meaning#1&}}%
+ \bidi@resrvda
+ \makeatletter
+ \scantokens\expandafter{\bidi@resrvda}%
+ \expandafter\endgroup\ifx#1\bidi@resrvda
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+
+\protected\long\def\bidi@ifhashcheck#1{%
+ \begingroup
+ \edef\bidi@resrvda{\detokenize{#1}}%
+ \expandafter\endgroup
+ \expandafter\bidi@ifhashcheck@i\meaning\bidi@resrvda&}
+
+\edef\bidi@ifhashcheck@i#1&{%
+ \noexpand\expandafter
+ \noexpand\bidi@ifhashcheck@ii
+ \noexpand\strip@prefix#1\string#\string#&}
+
+\edef\bidi@ifhashcheck@ii{%
+ \def\noexpand\bidi@ifhashcheck@ii##1\string#\string###2&}
+\bidi@ifhashcheck@ii{\if@bidi@blank{#2}}
+
+\protected\long\def\bidi@ifpattern#1#2{%
+ \begingroup
+ \edef\bidi@resrvda{%
+ \def\noexpand\bidi@resrvda####1\detokenize{#2}####2&{%
+ \endgroup\noexpand\noexpand\noexpand\if@bidi@blank{####2}}%
+ \edef\noexpand\bidi@resrvda{\noexpand\bidi@resrvda
+ \expandafter\strip@prefix\meaning#1\detokenize{#2}&}%
+ \noexpand\bidi@resrvda}
+ \bidi@resrvda\@secondoftwo\@firstoftwo}
+
+\newcommand{\if@bidi@defparam}{}
+\long\edef\if@bidi@defparam#1{%
+ \noexpand\expandafter\noexpand\bidi@ifdefparam
+ \noexpand\meaning#1\detokenize{macro}:->&}
+\edef\bidi@ifdefparam{%
+ \def\noexpand\bidi@ifdefparam##1\detokenize{macro}:##2->##3&}
+\bidi@ifdefparam{\bidi@notblank{#2}}
+
+\newcommand{\if@bidi@defprotected}{}
+\long\edef\if@bidi@defprotected#1{%
+ \noexpand\expandafter\noexpand\bidi@ifdefprotected
+ \noexpand\meaning#1\string\protected&}
+\edef\bidi@ifdefprotected{%
+ \def\noexpand\bidi@ifdefprotected##1\string\protected##2&}
+\bidi@ifdefprotected{\bidi@notblank{#2}}
+
+\bidi@newrobustcmd{\bidi@undef}[1]{\let#1\bidi@undefined}
+
+\let\bidi@dbg@trce\@gobble
+\let\bidi@dbg@init\@gobble
+\let\bidi@dbg@info\@gobble
+\let\bidi@dbg@succ\@gobble
+\let\bidi@dbg@fail\@gobble
+
+\bidi@newrobustcmd*{\bidi@apptocmd}{%
+ \bidi@dbg@trce\bidi@apptocmd
+ \begingroup
+ \@makeother\#%
+ \bidi@hooktocmd\bidi@append}
+
+\bidi@newrobustcmd*{\bidi@pretocmd}{%
+ \bidi@dbg@trce\bidi@pretocmd
+ \begingroup
+ \@makeother\#%
+ \bidi@hooktocmd\bidi@prepend}
+
+\long\def\bidi@hooktocmd#1#2#3{%
+ \endgroup
+ \bidi@dbg@init#2%
+ \if@bidi@undef{#2}
+ {\bidi@dbg@fail{def}\@secondoftwo}
+ {\bidi@dbg@info{def}%
+ \if@bidi@defmacro{#2}
+ {\bidi@dbg@info{mac}%
+ \if@bidi@defparam{#2}
+ {\bidi@dbg@info{prm}%
+ \bidi@ifscanable{#2}
+ {\bidi@ifhashcheck{#3}
+ {\bidi@dbg@info{tok}%
+ \bidi@dbg@succ{ret}%
+ \bidi@hooktocmd@i#1#2{#3}%
+ \@firstoftwo}
+ {\bidi@dbg@fail{hsh}\@secondoftwo}}
+ {\bidi@dbg@fail{tok}\@secondoftwo}}
+ {\bidi@dbg@info{prl}%
+ \if@bidi@defprotected{#2}
+ {\bidi@dbg@info{pro}%
+ \bidi@dbg@succ{red}%
+ \protected}
+ {\bidi@dbg@succ{red}}%
+ \edef#2{#1{\bidi@expandonce#2}{\unexpanded{#3}}}%
+ \@firstoftwo}}
+ {\bidi@dbg@fail{mac}\@secondoftwo}}}
+
+\long\def\bidi@hooktocmd@i#1#2#3{%
+ \begingroup
+ \edef\bidi@resrvda{%
+ \def\noexpand\bidi@resrvda####1\detokenize{macro}:####2->####3&{%
+ ####1\def\string\bidi@resrvda\space####2{#1{####3}{\detokenize{#3}}}}%
+ \edef\noexpand\bidi@resrvda{%
+ \noexpand\bidi@resrvda\meaning#2&}}%
+ \bidi@resrvda
+ \bidi@patchcmd@scantoks\bidi@resrvda
+ \let#2\bidi@resrvda
+ \bidi@undef\bidi@resrvda}
+
+\long\def\bidi@append#1#2{#1#2}
+\long\def\bidi@prepend#1#2{#2#1}
+
+\bidi@newrobustcmd{\bidi@AtBeginEnvironment}[1]{%
+ \bidi@csgappto{@begin@#1@hook}}
+
+\bidi@patchcmd\begin
+ {\csname #1\endcsname}
+ {\bidi@csuse{@begin@#1@hook}%
+ \csname #1\endcsname}
+ {}
+ {\bidi@warning{%
+ Patching '\string\begin' failed!\MessageBreak
+ '\string\bidi@AtBeginEnvironment' will not work\@gobble}}
+
+\bidi@newrobustcmd{\bidi@AtEndEnvironment}[1]{%
+ \bidi@csgappto{@end@#1@hook}}
+
+\bidi@patchcmd\end
+ {\csname end#1\endcsname}
+ {\bidi@csuse{@end@#1@hook}%
+ \csname end#1\endcsname}
+ {}
+ {\bidi@warning{%
+ Patching '\string\end' failed!\MessageBreak
+ '\string\bidi@AtEndEnvironment' will not work\@gobble}}
+
+\bidi@newrobustcmd{\bidi@BeforeBeginEnvironment}[1]{%
+ \bidi@csgappto{@beforebegin@#1@hook}}
+
+\bidi@pretocmd\begin
+ {\bidi@csuse{@beforebegin@#1@hook}}
+ {}
+ {\bidi@warning{%
+ Patching '\string\begin' failed!\MessageBreak
+ '\string\bidi@BeforeBeginEnvironment' will not work\@gobble}}
+
+\bidi@newrobustcmd{\bidi@AfterEndEnvironment}[1]{%
+ \bidi@csgappto{@afterend@#1@hook}}
+
+\bidi@patchcmd\end
+ {\if@ignore}
+ {\bidi@csuse{@afterend@#1@hook}%
+ \if@ignore}
+ {}
+ {\bidi@warning{%
+ Patching '\string\end' failed!\MessageBreak
+ '\string\bidi@AfterEndEnvironment' will not work\@gobble}}
+%%
+%% Copyright © 2009–2012 Vafa Khalighi <vafaklg@gmail.com>
+%%
+%% It may be distributed and/or modified 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 “author-maintained” (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%% End of file `biditools.sty'.
diff --git a/Master/texmf-dist/tex/latex/bidi/hyperref-xetex-bidi.def b/Master/texmf-dist/tex/latex/bidi/hyperref-xetex-bidi.def
index bc1ed7b683a..24b9666fc57 100644
--- a/Master/texmf-dist/tex/latex/bidi/hyperref-xetex-bidi.def
+++ b/Master/texmf-dist/tex/latex/bidi/hyperref-xetex-bidi.def
@@ -12,7 +12,7 @@
%% License information appended.
%%
%%
-\ProvidesFile{hyperref-xetex-bidi.def}[2010/07/25 v0.4 bidi adaptations for hyperref package for XeTeX engine]
+\ProvidesFile{hyperref-xetex-bidi.def}[2012/01/01 v0.5 bidi adaptations for hyperref package for XeTeX engine]
\AtBeginDocument{%
\def\contentsline#1#2#3#4{%
\ifx\\#4\\%
@@ -223,10 +223,7 @@
\def\hyper@link#1#2#3{%
\beginL\hyper@linkstart{#1}{#2}\if@RTL\beginR\fi#3\if@RTL\endR\fi\hyper@linkend\endL
}
-\let\origin@href=\href
-\renewcommand\href[2]{\beginL\origin@href{#1}{\if@RTL\beginR\fi#2\if@RTL\endR\fi}\endL}
-\let\origin@url=\url
-\renewcommand\url[1]{\beginL\origin@url{#1}\endL}%
+\def\url@#1{\beginL\hyper@linkurl{\Hurl{#1}}{#1}\endL}
\def\hyper@natlinkstart#1{%
\Hy@backout{#1}%
\beginL\hyper@linkstart{cite}{cite.#1}\if@RTL\beginR\fi%
@@ -239,6 +236,15 @@
\if@RTL\endR\fi\hyper@linkend\endL#1\beginL\hyper@linkstart{cite}{cite.#2}\if@RTL\beginR\fi%
}%
}
+\begingroup
+ \catcode`\$=6 %
+ \catcode`\#=12 %
+ \gdef\href@$1{\expandafter\href@split$1##\\}%
+ \gdef\href@split$1#$2#$3\\$4{%
+ \beginL\hyper@@link{$1}{$2}{\if@RTL\beginR\fi$4\if@RTL\endR\fi}\endL%
+ \endgroup
+ }%
+\endgroup
%%
%% Copyright © 2009–2012 Vafa Khalighi <vafaklg@gmail.com>
%%
diff --git a/Master/texmf-dist/tex/latex/bidi/loadingorder-bidi.def b/Master/texmf-dist/tex/latex/bidi/loadingorder-bidi.def
index 99045775490..69b0f658a35 100644
--- a/Master/texmf-dist/tex/latex/bidi/loadingorder-bidi.def
+++ b/Master/texmf-dist/tex/latex/bidi/loadingorder-bidi.def
@@ -12,14 +12,7 @@
%% License information appended.
%%
%%
-\ProvidesFile{loadingorder-bidi.def}[2011/09/16 v0.7 making sure that bidi is the last package loaded]
-\newcommand\bidi@isloaded[2][]{
- \expandafter\ifx\csname if@bidi@#2loaded@\endcsname\relax
- \expandafter\newif\csname if@bidi@#2loaded@\endcsname
- \fi
- \@ifpackageloaded{#2}
- {\csname @bidi@#2loaded@true\endcsname #1}
- {\csname @bidi@#2loaded@false\endcsname}}
+\ProvidesFile{loadingorder-bidi.def}[2012/01/01 v0.8 making sure that bidi is the last package loaded]
\bidi@isloaded{amsmath}
\bidi@isloaded{amsthm}
\bidi@isloaded{breqn}
diff --git a/Master/texmf-dist/tex/latex/bidi/xetex-bidi.def b/Master/texmf-dist/tex/latex/bidi/xetex-bidi.def
index e6d682ff7ef..eaae1938649 100644
--- a/Master/texmf-dist/tex/latex/bidi/xetex-bidi.def
+++ b/Master/texmf-dist/tex/latex/bidi/xetex-bidi.def
@@ -12,7 +12,7 @@
%% License information appended.
%%
%%
-\ProvidesFile{xetex-bidi.def}[2011/07/25 v0.9 bidi adaptations for XeTeX engine]
+\ProvidesFile{xetex-bidi.def}[2012/01/01 v1.0.0 bidi adaptations for XeTeX engine]
\newcommand{\TeXXeTOn}{\TeXXeTstate=1 }
\newcommand{\TeXXeTOff}{\TeXXeTstate=0 }
\TeXXeTOn
@@ -97,6 +97,8 @@
\let\unsetRL=\setLTR
\@ifpackageloaded{mathtools}{\RequirePackage{graphicx}}{}
\@ifpackageloaded{sidecap}{\RequirePackage{ragged2e}}{}
+\bidi@BeforeBeginEnvironment{picture}{\ifmmode\else\LTR\beginL\fi}
+\bidi@AfterEndEnvironment{picture}{\ifmmode\else\endL\endLTR\fi}
\DeclareOption{RTLdocument}{\@RTLtrue\@RTL@footnotetrue\g@addto@macro\document{\autofootnoterule}}
\DeclareOption{rldocument}{\@RTLtrue\@RTL@footnotetrue\g@addto@macro\document{\autofootnoterule}}
\def\RTLcases#1{\left.\vcenter{\normalbaselines\m@th