summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2011-08-02 18:37:42 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2011-08-02 18:37:42 +0000
commitff94e44b3898f59065c492d5e5e597234f1b49b1 (patch)
treeca2da7b855c1964f46c29a41ed2e2c50be200d9f /Master/texmf-dist/tex/latex
parent2880aaf97110f638a133d7ba59e8ecbd15150b2f (diff)
bidi v1.2.4
git-svn-id: svn://tug.org/texlive/trunk@23326 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/bidi/bidi.sty17
-rw-r--r--Master/texmf-dist/tex/latex/bidi/bidi.tex8
-rw-r--r--Master/texmf-dist/tex/latex/bidi/bidicode.sty16
-rw-r--r--Master/texmf-dist/tex/latex/bidi/biditufte-book.cls83
-rw-r--r--Master/texmf-dist/tex/latex/bidi/biditufte-handout.cls52
-rw-r--r--Master/texmf-dist/tex/latex/bidi/bidituftefloat.sty590
-rw-r--r--Master/texmf-dist/tex/latex/bidi/bidituftegeneralstructure.sty135
-rw-r--r--Master/texmf-dist/tex/latex/bidi/bidituftehyperref.sty53
-rw-r--r--Master/texmf-dist/tex/latex/bidi/bidituftesidenote.sty485
-rw-r--r--Master/texmf-dist/tex/latex/bidi/bidituftetitle.sty166
-rw-r--r--Master/texmf-dist/tex/latex/bidi/bidituftetoc.sty163
-rw-r--r--Master/texmf-dist/tex/latex/bidi/extrafootnotefeatures.def74
-rw-r--r--Master/texmf-dist/tex/latex/bidi/footnote-xetex-bidi.def2
-rw-r--r--Master/texmf-dist/tex/latex/bidi/hvfloat-xetex-bidi.def406
-rw-r--r--Master/texmf-dist/tex/latex/bidi/loadingorder-bidi.def8
-rw-r--r--Master/texmf-dist/tex/latex/bidi/natbib-xetex-bidi.def75
-rw-r--r--Master/texmf-dist/tex/latex/bidi/plain-xetex-bidi.def12
-rw-r--r--Master/texmf-dist/tex/latex/bidi/sidecap-xetex-bidi.def35
-rw-r--r--Master/texmf-dist/tex/latex/bidi/titlesec-xetex-bidi.def22
-rw-r--r--Master/texmf-dist/tex/latex/bidi/xetex-bidi.def183
20 files changed, 2499 insertions, 86 deletions
diff --git a/Master/texmf-dist/tex/latex/bidi/bidi.sty b/Master/texmf-dist/tex/latex/bidi/bidi.sty
index e93955a5bb6..d148e33dafd 100644
--- a/Master/texmf-dist/tex/latex/bidi/bidi.sty
+++ b/Master/texmf-dist/tex/latex/bidi/bidi.sty
@@ -13,10 +13,9 @@
%%
%%
\NeedsTeXFormat{LaTeX2e}
-\def\bididate{2011/03/21}
-\def\bidiversion{v1.1.7}
-\def\bidicommit{commit 150}
-\ProvidesPackage{bidi}[\bididate\space \bidiversion\space <\bidicommit>
+\def\bididate{2011/08/01}
+\def\bidiversion{v1.2.4}
+\ProvidesPackage{bidi}[\bididate\space \bidiversion\space
Bidirectional typesetting in plain TeX and LaTeX]
\edef\bidiinfo{%
bidi package (Support for bidirectional typesetting in plain TeX and LaTeX)^^J
@@ -24,9 +23,9 @@ Description: A convenient interface for typesetting bidirectional^^J
texts in plain TeX and LaTeX. The package includes adaptations for use^^J
with many other commonly-used packages.^^J
Copyright © 2009–2011 Vafa Khalighi^^J
-\bidiversion, <\bidicommit>, \bididate^^J
+\bidiversion, \bididate^^J
License: LaTeX Project Public License, version 1.3c or higher (your choice)^^J
-Home: http://bitbucket.org/vafa/bidi^^J
+Home: https://bitbucket.org/vafa/bidi^^J
Location on CTAN: /macros/latex/contrib/bidi}
\typeout{\bidiinfo}
\edef\bidi@everyjob{\the\everyjob}
@@ -47,7 +46,6 @@ Location on CTAN: /macros/latex/contrib/bidi}
\newif\if@RTLbibitems
\newif\if@sentdir
\newif\if@RTL@footnote
-\newif\if@developmentversion
\let\if@rlmain=\if@RTLmain
\let\@rlmaintrue=\@RTLmaintrue
\let\@rlmainfalse=\@RTLmainfalse
@@ -75,7 +73,6 @@ Location on CTAN: /macros/latex/contrib/bidi}
\def\pRLE{\protect\afterassignment\moreRLE \let\n@xt= }
\def\bracetext{\ifcat\n@xt{\else\ifcat\n@xt}\fi
\errmessage{Missing left brace has been substituted}\fi \bgroup}
-\input{loadingorder-bidi.def}
\ifXeTeX
\input{xetex-bidi.def}
\else
@@ -85,9 +82,7 @@ Location on CTAN: /macros/latex/contrib/bidi}
\PackageError{bidi}{TeX engines other than XeTeX and LuaTeX are not yet supported}{}
\fi
\fi
-\if@developmentversion
- \PackageWarningNoLine{bidi}{Thanks for testing the development version of bidi package. The development version may not work correctly or may not work at all. The development version is not recommended to be used for production purposes and should only be used for testing purposes. You are encouraged to use the stable version of bidi package available on CTAN for production purposes}
-\fi
+\input{loadingorder-bidi.def}
\ProcessOptions
%%
%% Copyright © 2009–2011 Vafa Khalighi <vafa018@gmail.com>
diff --git a/Master/texmf-dist/tex/latex/bidi/bidi.tex b/Master/texmf-dist/tex/latex/bidi/bidi.tex
index 2679c947de8..fd901900a1e 100644
--- a/Master/texmf-dist/tex/latex/bidi/bidi.tex
+++ b/Master/texmf-dist/tex/latex/bidi/bidi.tex
@@ -12,19 +12,19 @@
%% License information appended.
%%
%%
-\def\bididate{2011/03/21}
+\def\bididate{2011/08/01}
\def\bidiversion{v0.1}
-\def\bidicommit{commit 150}
\catcode`@=11
+\newlinechar`\^^J
\edef\bidiinfo{%
bidi package (Support for bidirectional typesetting in plain TeX and LaTeX)^^J
Description: A convenient interface for typesetting bidirectional^^J
texts in plain TeX and LaTeX. The package includes adaptations for use^^J
with many other commonly-used packages.^^J
Copyright © 2009–2011 Vafa Khalighi^^J
-\bidiversion, <\bidicommit>, \bididate^^J
+\bidiversion, \bididate^^J
License: LaTeX Project Public License, version 1.3c or higher (your choice)^^J
-Home: http://bitbucket.org/vafa/bidi^^J
+Home: https://bitbucket.org/vafa/bidi^^J
Location on CTAN: /macros/latex/contrib/bidi}
\message{\bidiinfo}
\edef\bidi@everyjob{\the\everyjob}
diff --git a/Master/texmf-dist/tex/latex/bidi/bidicode.sty b/Master/texmf-dist/tex/latex/bidi/bidicode.sty
index 99d4d7606b3..9decf055881 100644
--- a/Master/texmf-dist/tex/latex/bidi/bidicode.sty
+++ b/Master/texmf-dist/tex/latex/bidi/bidicode.sty
@@ -35,21 +35,21 @@
extendedchars=true,
showspaces=false,
showstringspaces=false,
+ numbers=left,
+ numbersep=0.9em,
+ numberstyle=\tiny, %
+ frame=single,
captionpos=b,
xleftmargin=1em,
breaklines=true,
- breakautoindent=true,
+ breakautoindent=false,
+ breakindent=0pt,
escapeinside=**,
- pos=b,
+ pos=r,
explpreset={%
xleftmargin=1em,columns=flexible,language=[LaTeX]TEX},
- morekeywords={setLTR,setLR,setRTL,setRL,LRE,LR,RLE,RL,lr,bidiversion,bididate,%
- bidicommit}
+ morekeywords={setLTR,setLR,setRTL,setRL,LRE,LR,RLE,RL,lr,bidiversion,bididate}
}
-\lstdefinestyle{syntax}{backgroundcolor=\color{blue!20},numbers=none,xleftmargin=0pt,xrightmargin=0pt,pos=b}
-\lstdefinestyle{code}{backgroundcolor=\color{red!20},numbers=none,xleftmargin=0pt,xrightmargin=0pt,pos=b}
-\lst@UserCommand\lstlistlistingname{List of Examples} % \lstlistoflistings
-\lst@UserCommand\lstlistingname{Example}
\newcommand\HLON{%
\gdef\lst@alloverstyle##1{%
\fboxrule=0pt
diff --git a/Master/texmf-dist/tex/latex/bidi/biditufte-book.cls b/Master/texmf-dist/tex/latex/bidi/biditufte-book.cls
new file mode 100644
index 00000000000..a20caae4f67
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bidi/biditufte-book.cls
@@ -0,0 +1,83 @@
+%%
+%% This is file `biditufte-book.cls',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `biditufte-book.cls')
+%%
+%% ______________________________________
+%% Copyright © 2009–2011 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}[1994/06/01]
+\ProvidesClass{biditufte-book}[2011/06/18 v0.1 biditufte-book class]
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{bidituftefloat}}
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{bidituftetoc}}
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{bidituftehyperref}}
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{bidituftetitle}}
+\ProcessOptions\relax
+\LoadClass{book}
+\RequirePackage{bidituftefloat}
+\RequirePackage{bidituftesidenote}
+\RequirePackage{bidituftetoc}
+\RequirePackage{bidituftegeneralstructure}
+\RequirePackage{bidituftehyperref}
+\RequirePackage{bidituftetitle}
+%%
+%%
+\renewcommand\frontmatter{%
+ \cleardoublepage%
+ \@mainmatterfalse%
+ \pagenumbering{arabic}%
+ %\pagestyle{plain}%
+ \fancyhf{}%
+ \ifthenelse{\boolean{@bidituftefloat@twoside}}%
+ {\fancyhead[LE,RO]{\thepage}}%
+ {\fancyhead[RE,RO]{\thepage}}%
+}
+%%
+\renewcommand\mainmatter{%
+ \cleardoublepage%
+ \@mainmattertrue%
+ \fancyhf{}%
+ \ifthenelse{\boolean{@bidituftefloat@twoside}}%
+ {\renewcommand{\chaptermark}[1]{\markboth{##1}{}}%
+ \fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plaintitle}}}% book title
+ \fancyhead[RO]{\smallcaps{\newlinetospace{\leftmark}}\quad\thepage}}% chapter title
+ {\fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}}% book title
+}
+%%
+\renewcommand\backmatter{%
+ \if@openright%
+ \cleardoublepage%
+ \else%
+ \clearpage%
+ \fi%
+ \@mainmatterfalse%
+}
+%%
+\setcounter{tocdepth}{0}
+\AtBeginDocument{%
+\IfFileExists{biditufte-book.cfg}
+ {\input{biditufte-book.cfg}
+ \ClassInfo{biditufte-book}{Loading biditufte-book configuration file \@gobble}}
+ {}%
+}
+%%
+%% Copyright © 2009–2011 Vafa Khalighi <vafa018@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 `biditufte-book.cls'.
diff --git a/Master/texmf-dist/tex/latex/bidi/biditufte-handout.cls b/Master/texmf-dist/tex/latex/bidi/biditufte-handout.cls
new file mode 100644
index 00000000000..89ce5b6427b
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bidi/biditufte-handout.cls
@@ -0,0 +1,52 @@
+%%
+%% This is file `biditufte-handout.cls',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `biditufte-handout.cls')
+%%
+%% ______________________________________
+%% Copyright © 2009–2011 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}[1994/06/01]
+\ProvidesClass{biditufte-handout}[2011/06/18 v0.1 biditufte-handout class]
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{bidituftefloat}}
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{bidituftetoc}}
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{bidituftehyperref}}
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{bidituftetitle}}
+\ProcessOptions\relax
+\LoadClass{article}
+\RequirePackage{bidituftefloat}
+\RequirePackage{bidituftesidenote}
+\RequirePackage{bidituftetoc}
+\RequirePackage{bidituftegeneralstructure}
+\RequirePackage{bidituftehyperref}
+\RequirePackage{bidituftetitle}
+\renewenvironment{abstract}
+ {\begin{quotation}}
+ {\end{quotation}}
+\AtBeginDocument{%
+\IfFileExists{biditufte-handout.cfg}
+ {\input{biditufte-handout.cfg}
+ \ClassInfo{biditufte-handout}{Loading biditufte-handout configuration file \@gobble}}
+ {}%
+}
+%%
+%% Copyright © 2009–2011 Vafa Khalighi <vafa018@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 `biditufte-handout.cls'.
diff --git a/Master/texmf-dist/tex/latex/bidi/bidituftefloat.sty b/Master/texmf-dist/tex/latex/bidi/bidituftefloat.sty
new file mode 100644
index 00000000000..8120e51110a
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bidi/bidituftefloat.sty
@@ -0,0 +1,590 @@
+%%
+%% This is file `bidituftefloat.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidituftefloat.sty')
+%%
+%% ______________________________________
+%% Copyright © 2009–2011 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bidituftefloat}[2011/06/14 v0.1
+bidi implementation of tufte float]
+\RequirePackage{xifthen}
+\newcommand{\@bidituftefloat@pkgname}{bidituftefloat}
+\newcommand{\bidituftefloatError}[2]{\PackageError{\@bidituftefloat@pkgname}{#1}{#2}}
+\newcommand{\bidituftefloatDebugInfoNL}[1]{\ifthenelse{\boolean{@bidituftefloat@debug}}{\bidituftefloatInfoNL{#1}}{}}
+\newcommand{\bidituftefloatInfoNL}[1]{\PackageInfo{\@bidituftefloat@pkgname}{#1\@gobble}}
+\newboolean{@bidituftefloat@RTLgeometry}
+\setboolean{@bidituftefloat@RTLgeometry}{true}
+\DeclareOption{RTLgeometry}{\setboolean{@bidituftefloat@RTLgeometry}{true}}
+\DeclareOption{LTRgeometry}{\setboolean{@bidituftefloat@RTLgeometry}{false}}
+\newboolean{@bidituftefloat@afourpaper}
+\DeclareOption{a4paper}{\setboolean{@bidituftefloat@afourpaper}{true}}
+\newboolean{@bidituftefloat@bfivepaper}
+\DeclareOption{b5paper}{\setboolean{@bidituftefloat@bfivepaper}{true}}
+\newboolean{@bidituftefloat@symmetric}
+\newboolean{@bidituftefloat@twoside}
+\DeclareOption{twoside}{%
+\@twosidetrue \@mparswitchtrue%
+\setboolean{@bidituftefloat@twoside}{true}%
+\setboolean{@bidituftefloat@symmetric}{true}%
+}
+\DeclareOption{oneside}{%
+\@twosidefalse \@mparswitchfalse%
+\setboolean{@bidituftefloat@twoside}{false}%
+\setboolean{@bidituftefloat@symmetric}{false}%
+}
+\@ifclassloaded{book}{\ExecuteOptions{twoside}}{}
+\newboolean{@bidituftefloat@debug}
+\newcommand*{\@bidituftefloat@caption@justification}{\@bidituftefloat@justification@autodetect}
+\ProcessOptions
+%% Globally sets the length
+\newcommand*{\gsetlength}[2]{%
+ \setlength{#1}{#2}%
+ \global#1=#1\relax%
+}
+%% Globally sets a boolean
+\newcommand*{\gsetboolean}[2]{% based on code from ifthen pkg
+ \lowercase{\def\@tempa{#2}}%
+ \@ifundefined{@tempswa\@tempa}%
+ {\PackageError{ifthen}{You can only set a boolean to `true' or `false'}\@ehc}%
+ {\@ifundefined{#1\@tempa}%
+ {\PackageError{ifthen}{Boolean #1 undefined}\@ehc}%
+ {\global\csname#1\@tempa\endcsname}%
+ }%
+}
+%% Set the font sizes and baselines to match bidituftefloat's books
+\renewcommand\normalsize{%
+ \@setfontsize\normalsize\@xpt{14}%
+ \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
+ \abovedisplayshortskip \z@ \@plus3\p@
+ \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
+ \belowdisplayskip \abovedisplayskip
+ \let\@listi\@listI}
+\normalbaselineskip=14pt
+\normalsize
+\renewcommand\footnotesize{%
+ \@setfontsize\footnotesize\@viiipt{10}%
+ \abovedisplayskip 6\p@ \@plus2\p@ \@minus4\p@
+ \abovedisplayshortskip \z@ \@plus\p@
+ \belowdisplayshortskip 3\p@ \@plus\p@ \@minus2\p@
+ \def\@listi{\leftmargin\leftmargini
+ \topsep 3\p@ \@plus\p@ \@minus\p@
+ \parsep 2\p@ \@plus\p@ \@minus\p@
+ \itemsep \parsep}%
+ \belowdisplayskip \abovedisplayskip
+}
+%% Paragraph indentation and separation for marginal text
+\newcommand{\@bidituftefloat@margin@par}{%
+ \setlength{\RaggedRightParindent}{0.5pc}%
+ \setlength{\JustifyingParindent}{0.5pc}%
+ \setlength{\parindent}{0.5pc}%
+ \setlength{\parskip}{0pt}%
+}
+\RequirePackage{ragged2e}
+\ifthenelse{\boolean{@bidituftefloat@RTLgeometry}}{%
+\RequirePackage[letterpaper,right=1in,top=1in,headsep=2\baselineskip,textwidth=26pc,marginparsep=2pc,marginparwidth=12pc,textheight=44\baselineskip,headheight=\baselineskip]{geometry}
+\ifthenelse{\boolean{@bidituftefloat@afourpaper}}
+ {\geometry{a4paper,right=24.8mm,top=27.4mm,headsep=2\baselineskip,textwidth=107mm,marginparsep=8.2mm,marginparwidth=49.4mm,textheight=49\baselineskip,headheight=\baselineskip}}
+ {}
+\ifthenelse{\boolean{@bidituftefloat@bfivepaper}}
+ {\geometry{paperwidth=176mm,paperheight=250mm,right=14.66mm,top=13.88mm,textwidth=102.66mm,marginparsep=7.33mm,marginparwidth=36.66mm,textheight=38\baselineskip,includehead}}
+ {}}{%
+\RequirePackage[letterpaper,left=1in,top=1in,headsep=2\baselineskip,textwidth=26pc,marginparsep=2pc,marginparwidth=12pc,textheight=44\baselineskip,headheight=\baselineskip]{geometry}
+\ifthenelse{\boolean{@bidituftefloat@afourpaper}}
+ {\geometry{a4paper,left=24.8mm,top=27.4mm,headsep=2\baselineskip,textwidth=107mm,marginparsep=8.2mm,marginparwidth=49.4mm,textheight=49\baselineskip,headheight=\baselineskip}}
+ {}
+\ifthenelse{\boolean{@bidituftefloat@bfivepaper}}
+ {\geometry{paperwidth=176mm,paperheight=250mm,left=14.66mm,top=13.88mm,textwidth=102.66mm,marginparsep=7.33mm,marginparwidth=36.66mm,textheight=38\baselineskip,includehead}}
+ {}}
+\ifthenelse{\boolean{@bidituftefloat@symmetric}}
+ {}
+ {\geometry{asymmetric}}% forces internal LaTeX `twoside'
+\setlength\marginparpush{10pt}
+%% Font for margin items
+\newcommand{\@bidituftefloat@marginfont}{\normalfont\footnotesize}
+\newcommand*{\@bidituftefloat@caption@font}{\@bidituftefloat@marginfont}
+\newcommand*{\setcaptionfont}[1]{\renewcommand*{\@bidituftefloat@caption@font}{#1}}
+\newcommand{\@bidituftefloat@justification}{\justifying}%
+\setlength\abovedisplayskip{6pt plus 2pt minus 4pt}
+\setlength\belowdisplayskip{6pt plus 2pt minus 4pt}
+\newboolean{@bidituftefloat@changepage}
+\IfFileExists{changepage.sty}{%
+ \bidituftefloatDebugInfoNL{Found changepage.sty}
+ \RequirePackage[strict]{changepage}
+ \setboolean{@bidituftefloat@changepage}{true}
+}{%
+ \bidituftefloatDebugInfoNL{Found chngpage.sty}
+ \RequirePackage[strict]{chngpage}
+ \setboolean{@bidituftefloat@changepage}{false}
+}
+\newboolean{@bidituftefloat@odd@page}
+\setboolean{@bidituftefloat@odd@page}{true}
+\newcommand*{\@bidituftefloat@checkoddpage}{%
+ \checkoddpage%
+ \ifthenelse{\boolean{@bidituftefloat@changepage}}{%
+ \ifoddpage%
+ \setboolean{@bidituftefloat@odd@page}{true}%
+ \else%
+ \setboolean{@bidituftefloat@odd@page}{false}%
+ \fi%
+ }{%
+ \ifcpoddpage%
+ \setboolean{@bidituftefloat@odd@page}{true}%
+ \else%
+ \setboolean{@bidituftefloat@odd@page}{false}%
+ \fi%
+ }%
+}
+\newlength{\@bidituftefloat@overhang}% used by the fullwidth environment and the running heads
+\newlength{\@bidituftefloat@fullwidth}
+\newlength{\@bidituftefloat@caption@fill}
+\newcommand{\bidituftefloatRecalculate}{%
+ \setlength{\@bidituftefloat@overhang}{\marginparwidth}
+ \addtolength{\@bidituftefloat@overhang}{\marginparsep}
+
+ \setlength{\@bidituftefloat@fullwidth}{\textwidth}
+ \addtolength{\@bidituftefloat@fullwidth}{\marginparsep}
+ \addtolength{\@bidituftefloat@fullwidth}{\marginparwidth}
+
+ \setlength{\@bidituftefloat@caption@fill}{\textwidth}
+ \addtolength{\@bidituftefloat@caption@fill}{\marginparsep}
+}
+\AtBeginDocument{\bidituftefloatRecalculate}
+\RequirePackage{optparams}% provides multiple optional arguments for commands
+\RequirePackage{placeins}
+\newsavebox{\@bidituftefloat@margin@floatbox}
+\newenvironment{@bidituftefloat@margin@float}[2][-1.2ex]%
+ {\FloatBarrier% process all floats before this point so the figure/table numbers stay in order.
+ \begin{lrbox}{\@bidituftefloat@margin@floatbox}%
+ \begin{minipage}{\marginparwidth}%
+ \@bidituftefloat@caption@font%
+ \def\@captype{#2}%
+ \hbox{}\vspace*{#1}%
+ \@bidituftefloat@caption@justification%
+ \@bidituftefloat@margin@par%
+ \noindent%
+ }
+ {\end{minipage}%
+ \end{lrbox}%
+ \marginpar{\usebox{\@bidituftefloat@margin@floatbox}}%
+ }
+\newenvironment{marginfigure}[1][-1.2ex]%
+ {\begin{@bidituftefloat@margin@float}[#1]{figure}}
+ {\end{@bidituftefloat@margin@float}}
+\newenvironment{margintable}[1][-1.2ex]%
+ {\begin{@bidituftefloat@margin@float}[#1]{table}}
+ {\end{@bidituftefloat@margin@float}}
+\newcommand*{\@bidituftefloat@justification@autodetect}{\justifying}%
+
+\newcommand{\@bidituftefloat@float@debug@info}{}% contains debug info generated as the float is processed
+\newcommand{\@bidituftefloat@float@debug}[1]{% adds debug info to the queue for output
+ \ifthenelse{\equal{\@bidituftefloat@float@debug@info}{}}%
+ {\def\@bidituftefloat@float@debug@info{#1}}%
+ {\g@addto@macro\@bidituftefloat@float@debug@info{\MessageBreak#1}}%
+}
+\newcommand{\floatalignment}{x}% holds the current float alignment (t, b, h, p)
+\newcommand{\setfloatalignment}[1]{\global\def\floatalignment{#1}\@bidituftefloat@float@debug{Forcing position: [#1]}}% manually sets the float alignment
+\newboolean{@bidituftefloat@float@recto}
+\newcommand{\forcerectofloat}{\gsetboolean{@bidituftefloat@float@recto}{true}\@bidituftefloat@float@debug{Forcing page: [recto]}}
+\newcommand{\forceversofloat}{\gsetboolean{@bidituftefloat@float@recto}{false}\@bidituftefloat@float@debug{Forcing page: [verso]}}
+\newsavebox{\@bidituftefloat@figure@box}
+\newsavebox{\@bidituftefloat@caption@box}
+\let\@bidituftefloat@orig@float\@float
+\let\@bidituftefloat@orig@endfloat\end@float
+\newlength{\@bidituftefloat@caption@vertical@offset}
+\setlength{\@bidituftefloat@caption@vertical@offset}{0pt}
+\newcommand{\@bidituftefloat@stored@shortcaption}{}
+\newcommand{\@bidituftefloat@stored@caption}{}
+\newcommand{\@bidituftefloat@stored@label}{}
+\long\def\@bidituftefloat@caption[#1][#2]#3{%
+ \ifthenelse{\isempty{#1}}%
+ {\gdef\@bidituftefloat@stored@shortcaption{#3}}%
+ {\gdef\@bidituftefloat@stored@shortcaption{#1}}%
+ \gsetlength{\@bidituftefloat@caption@vertical@offset}{-#2}% we want a positive offset to lower captions
+ \gdef\@bidituftefloat@stored@caption{#3}%
+}
+\newcommand{\@bidituftefloat@label}[1]{%
+ \gdef\@bidituftefloat@stored@label{#1}%
+}
+\newcommand{\@bidituftefloat@fps}{}
+\newboolean{@bidituftefloat@float@star}
+\newlength{\@bidituftefloat@float@contents@width}
+\newenvironment{@bidituftefloat@float}[3][htbp]%
+ {% begin @bidituftefloat@float
+ % Should this float be full-width or just text-width?
+ \ifthenelse{\equal{#3}{star}}%
+ {\gsetboolean{@bidituftefloat@float@star}{true}}%
+ {\gsetboolean{@bidituftefloat@float@star}{false}}%
+ % Check page side (recto/verso) and store detected value -- can be overriden in environment contents
+ \@bidituftefloat@checkoddpage%
+ \ifthenelse{\boolean{@bidituftefloat@odd@page}}%
+ {\gsetboolean{@bidituftefloat@float@recto}{true}\@bidituftefloat@float@debug{Detected page: [recto/odd]}}%
+ {\gsetboolean{@bidituftefloat@float@recto}{false}\@bidituftefloat@float@debug{Detected page: [verso/even]}}%
+ % If the float placement specifier is 'b' and only 'b', then bottom-align the mini-pages, otherwise top-align them.
+ \renewcommand{\@bidituftefloat@fps}{#1}%
+ \@bidituftefloat@float@debug{Allowed positions: [#1]}%
+ \ifthenelse{\equal{#1}{b}\OR\equal{#1}{B}}%
+ {\renewcommand{\floatalignment}{b}\@bidituftefloat@float@debug{Presumed position: [bottom]}}%
+ {\renewcommand{\floatalignment}{t}\@bidituftefloat@float@debug{Presumed position: [top]}}%
+ % Capture the contents of the \caption and \label commands to use later
+ \global\let\@bidituftefloat@orig@caption\caption%
+ \global\let\@bidituftefloat@orig@label\label%
+ \renewcommand{\caption}{\optparams{\@bidituftefloat@caption}{[][0pt]}}%
+ \renewcommand{\label}[1]{\@bidituftefloat@label{##1}}%
+ % Handle subfigure package compatibility
+ \ifthenelse{\boolean{@bidituftefloat@packages@subfigure}}{%
+ % don't move the label while inside a \subfigure or \subtable command
+ \global\let\label\@bidituftefloat@orig@label%
+ }{}% subfigure package is not loaded
+ \@bidituftefloat@orig@float{#2}[#1]%
+ \ifthenelse{\boolean{@bidituftefloat@float@star}}%
+ {\setlength{\@bidituftefloat@float@contents@width}{\@bidituftefloat@fullwidth}}%
+ {\setlength{\@bidituftefloat@float@contents@width}{\textwidth}}%
+ \begin{lrbox}{\@bidituftefloat@figure@box}%
+ \begin{minipage}[\floatalignment]{\@bidituftefloat@float@contents@width}\hbox{}%
+ }{% end @bidituftefloat@float
+ \par\hbox{}\vspace{-\baselineskip}\ifthenelse{\prevdepth>0}{\vspace{-\prevdepth}}{}% align baselines of boxes
+ \end{minipage}%
+ \end{lrbox}%
+ % build the caption box
+ \begin{lrbox}{\@bidituftefloat@caption@box}%
+ \begin{minipage}[\floatalignment]{\marginparwidth}\hbox{}%
+ \ifthenelse{\NOT\equal{\@bidituftefloat@stored@caption}{}}{\@bidituftefloat@orig@caption[\@bidituftefloat@stored@shortcaption]{\@bidituftefloat@stored@caption}}{}%
+ \ifthenelse{\NOT\equal{\@bidituftefloat@stored@label}{}}{\@bidituftefloat@orig@label{\@bidituftefloat@stored@label}}{}%
+ \par\vspace{-\prevdepth}%% TODO: DOUBLE-CHECK FOR SAFETY
+ \end{minipage}%
+ \end{lrbox}%
+ % now typeset the stored boxes
+ \begin{fullwidth}%
+ \begin{minipage}[\floatalignment]{\linewidth}%
+ \ifthenelse{\boolean{@bidituftefloat@float@star}}%
+ {\@bidituftefloat@float@fullwidth[\@bidituftefloat@caption@vertical@offset]{\@bidituftefloat@figure@box}{\@bidituftefloat@caption@box}}%
+ {\@bidituftefloat@float@textwidth[\@bidituftefloat@caption@vertical@offset]{\@bidituftefloat@figure@box}{\@bidituftefloat@caption@box}}%
+ \end{minipage}%
+ \end{fullwidth}%
+ \@bidituftefloat@orig@endfloat% end original LaTeX float environment
+ % output debug info
+ \ifthenelse{\boolean{@bidituftefloat@debug}}{%
+ \typeout{^^J^^J----------- bidituftefloat package float information ----------}%
+ \ifthenelse{\equal{\@bidituftefloat@stored@label}{}}%
+ {\typeout{Warning: Float unlabeled!}}%
+ {\typeout{Float label: [\@bidituftefloat@stored@label]}}%
+ \typeout{Page number: [\thepage]}%
+ \def\MessageBreak{^^J}%
+ \typeout{\@bidituftefloat@float@debug@info}%
+ \ifthenelse{\boolean{@bidituftefloat@symmetric}}%
+ {\typeout{Symmetric: [true]}}%
+ {\typeout{Symmetric: [false]}}%
+ \typeout{----------------------------------------------------^^J^^J}%
+ }{}%
+ % reset commands and temp boxes and captions
+ \gdef\@bidituftefloat@float@debug@info{}%
+ \let\caption\@bidituftefloat@orig@caption%
+ \let\label\@bidituftefloat@orig@label%
+ \begin{lrbox}{\@bidituftefloat@figure@box}\hbox{}\end{lrbox}%
+ \begin{lrbox}{\@bidituftefloat@caption@box}\hbox{}\end{lrbox}%
+ \gdef\@bidituftefloat@stored@shortcaption{}%
+ \gdef\@bidituftefloat@stored@caption{}%
+ \gdef\@bidituftefloat@stored@label{}%
+ \gsetlength{\@bidituftefloat@caption@vertical@offset}{0pt}% reset caption offset
+ }
+\newcommand{\@bidituftefloat@float@textwidth}[3][0pt]{%
+ \ifthenelse{\NOT\boolean{@bidituftefloat@symmetric}\OR\boolean{@bidituftefloat@float@recto}}{%
+ % asymmetric or page is odd, so caption is on the right
+ \hbox{%
+ \usebox{#2}%
+ \hspace{\marginparsep}%
+ \smash{\raisebox{#1}{\usebox{#3}}}%
+ }
+ \@bidituftefloat@float@debug{Caption position: [right]}%
+ }{% symmetric pages and page is even, so caption is on the left
+ \hbox{%
+ \smash{\raisebox{#1}{\usebox{#3}}}%
+ \hspace{\marginparsep}%
+ \usebox{#2}%
+ }
+ \@bidituftefloat@float@debug{Caption position: [left]}%
+ }%
+}
+\newcommand{\@bidituftefloat@float@fullwidth}[3][0pt]{%
+ \ifthenelse{\equal{\floatalignment}{b}}%
+ {% place caption above figure
+ \ifthenelse{\NOT\boolean{@bidituftefloat@symmetric}\OR\boolean{@bidituftefloat@float@recto}}%
+ {\hfill\smash{\raisebox{#1}{\usebox{#3}}}\par\usebox{#2}\@bidituftefloat@float@debug{Caption position: [above right]}}% caption on the right
+ {\smash{\raisebox{#1}{\usebox{#3}}}\hfill\par\usebox{#2}\@bidituftefloat@float@debug{Caption position: [above left]}}% caption on the left
+ }{% place caption below figure
+ \ifthenelse{\NOT\boolean{@bidituftefloat@symmetric}\OR\boolean{@bidituftefloat@float@recto}}%
+ {\usebox{#2}\par\hfill\smash{\raisebox{#1}{\usebox{#3}}}\@bidituftefloat@float@debug{Caption position: [below right]}}% caption on the right
+ {\usebox{#2}\par\smash{\raisebox{#1}{\usebox{#3}}}\hfill\@bidituftefloat@float@debug{Caption position: [below left]}}% caption on the left
+ }%
+}
+\renewenvironment{figure}[1][htbp]%
+ {\ifvmode\else\unskip\fi\begin{@bidituftefloat@float}[#1]{figure}{}}
+ {\end{@bidituftefloat@float}}
+\renewenvironment{table}[1][htbp]
+ {\ifvmode\else\unskip\fi\begin{@bidituftefloat@float}[#1]{table}{}}
+ {\end{@bidituftefloat@float}}
+\renewenvironment{figure*}[1][htbp]%
+ {\ifvmode\else\unskip\fi\begin{@bidituftefloat@float}[#1]{figure}{star}}
+ {\end{@bidituftefloat@float}}
+\renewenvironment{table*}[1][htbp]%
+ {\ifvmode\else\unskip\fi\begin{@bidituftefloat@float}[#1]{table}{star}}
+ {\end{@bidituftefloat@float}}
+\newenvironment{fullwidth}
+ {\ifthenelse{\boolean{@bidituftefloat@symmetric}}%
+ {\ifthenelse{\boolean{@bidituftefloat@changepage}}{\begin{adjustwidth*}{}{-\@bidituftefloat@overhang}}{\begin{adjustwidth}[]{}{-\@bidituftefloat@overhang}}}%
+ {\begin{adjustwidth}{}{-\@bidituftefloat@overhang}}%
+ }%
+ {\ifthenelse{\boolean{@bidituftefloat@symmetric}}%
+ {\ifthenelse{\boolean{@bidituftefloat@changepage}}{\end{adjustwidth*}}{\end{adjustwidth}}}%
+ {\end{adjustwidth}}%
+ }
+\long\def\@caption#1[#2]#3{%
+ \par%
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
+ \begingroup%
+ \@parboxrestore%
+ \if@minipage%
+ \@setminipage%
+ \fi%
+ \@bidituftefloat@caption@font\@bidituftefloat@caption@justification%
+ \noindent\csname fnum@#1\endcsname: \ignorespaces#3\par%
+ %\@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \endgroup}
+%%
+\DeclareRobustCommand{\@biditufteheading@newlinetospace}{%
+ \@ifstar{\@biditufteheading@newlinetospace@i}{\@biditufteheading@newlinetospace@i}%
+}
+\def\@biditufteheading@newlinetospace@i{%
+ \ifdim\lastskip>\z@\else\space\fi
+ \ignorespaces%
+}
+\DeclareRobustCommand{\newlinetospace}[1]{%
+ \let\@biditufteheading@orig@cr\\% save the original meaning of \\
+ \def\\{\@biditufteheading@newlinetospace}% turn \\ and \\* into \space
+ \let\newline\\% turn \newline into \space
+ #1%
+ \let\\\@biditufteheading@orig@cr% revert to original meaning of \\
+}
+\RequirePackage{fancyhdr}
+\pagestyle{fancy}
+\AtBeginDocument{%
+ \ifthenelse{\boolean{@bidituftefloat@symmetric}}
+ {\fancyhfoffset[LE,RO]{\@bidituftefloat@overhang}}
+ {\fancyhfoffset[RE,RO]{\@bidituftefloat@overhang}}
+}
+\renewcommand{\headrulewidth}{0pt}
+\renewcommand{\footrulewidth}{0pt}
+\fancyhf{} % clear header and footer fields
+ \ifthenelse{\boolean{@bidituftefloat@symmetric}}
+ {\fancyhead[LE]{\thepage\quad\textsl{\newlinetospace{\plainauthor}}}%
+ \fancyhead[RO]{\textsl{\newlinetospace{\plaintitle}}\quad\thepage}}%
+ {\fancyhead[RE,RO]{\textsl{\newlinetospace{\plaintitle}}\quad\thepage}}%
+\fancypagestyle{plain}{
+ \fancyhf{} % clear header and footer fields
+ % Uncomment the following five lines of code if you want the opening page
+ % of the chapter to express the folio in the lower outside corner.
+ % \ifthenelse{\boolean{@bidituftefloat@symmetric}}
+ % {\fancyfoot[LE,RO]{\thepage}}
+ % {\fancyfoot[RE,RO]{\thepage}}
+}
+\fancypagestyle{empty}{
+ \fancyhf{} % clear header and footer fields
+}
+\def\morefloats{% provides a total of 52 floats
+ \ifthenelse{\isundefined{\bx@S}}{%
+ \bidituftefloatDebugInfoNL{Adding 34 more float slots.}
+ \newinsert\bx@S
+ \newinsert\bx@T
+ \newinsert\bx@U
+ \newinsert\bx@V
+ \newinsert\bx@W
+ \newinsert\bx@X
+ \newinsert\bx@Y
+ \newinsert\bx@Z
+ \newinsert\bx@a
+ \newinsert\bx@b
+ \newinsert\bx@c
+ \newinsert\bx@d
+ \newinsert\bx@e
+ \newinsert\bx@f
+ \newinsert\bx@g
+ \newinsert\bx@h
+ \newinsert\bx@i
+ \newinsert\bx@j
+ \newinsert\bx@k
+ \newinsert\bx@l
+ \newinsert\bx@m
+ \newinsert\bx@n
+ \newinsert\bx@o
+ \newinsert\bx@p
+ \newinsert\bx@q
+ \newinsert\bx@r
+ \newinsert\bx@s
+ \newinsert\bx@t
+ \newinsert\bx@u
+ \newinsert\bx@v
+ \newinsert\bx@w
+ \newinsert\bx@x
+ \newinsert\bx@y
+ \newinsert\bx@z
+ \gdef\@freelist{\@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E
+ \@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J
+ \@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N
+ \@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R
+ \@elt\bx@S\@elt\bx@T\@elt\bx@U\@elt\bx@V
+ \@elt\bx@W\@elt\bx@X\@elt\bx@Y\@elt\bx@Z
+ \@elt\bx@a\@elt\bx@b\@elt\bx@c\@elt\bx@d\@elt\bx@e
+ \@elt\bx@f\@elt\bx@g\@elt\bx@h\@elt\bx@i\@elt\bx@j
+ \@elt\bx@k\@elt\bx@l\@elt\bx@m\@elt\bx@n
+ \@elt\bx@o\@elt\bx@p\@elt\bx@q\@elt\bx@r
+ \@elt\bx@s\@elt\bx@t\@elt\bx@u\@elt\bx@v
+ \@elt\bx@w\@elt\bx@x\@elt\bx@y\@elt\bx@z}%
+ }{% we've already added another 34 floats, so we'll add 26 more, but that's it!
+ \ifthenelse{\isundefined{\bx@AA}}{%
+ \bidituftefloatDebugInfoNL{Adding 26 more float slots.}
+ \newinsert\bx@AA
+ \newinsert\bx@BB
+ \newinsert\bx@CC
+ \newinsert\bx@DD
+ \newinsert\bx@EE
+ \newinsert\bx@FF
+ \newinsert\bx@GG
+ \newinsert\bx@HH
+ \newinsert\bx@II
+ \newinsert\bx@JJ
+ \newinsert\bx@KK
+ \newinsert\bx@LL
+ \newinsert\bx@MM
+ \newinsert\bx@NN
+ \newinsert\bx@OO
+ \newinsert\bx@PP
+ \newinsert\bx@QQ
+ \newinsert\bx@RR
+ \newinsert\bx@SS
+ \newinsert\bx@TT
+ \newinsert\bx@UU
+ \newinsert\bx@VV
+ \newinsert\bx@WW
+ \newinsert\bx@XX
+ \newinsert\bx@YY
+ \newinsert\bx@ZZ
+ \gdef\@freelist{\@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E
+ \@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J
+ \@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N
+ \@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R
+ \@elt\bx@S\@elt\bx@T\@elt\bx@U\@elt\bx@V
+ \@elt\bx@W\@elt\bx@X\@elt\bx@Y\@elt\bx@Z
+ \@elt\bx@a\@elt\bx@b\@elt\bx@c\@elt\bx@d\@elt\bx@e
+ \@elt\bx@f\@elt\bx@g\@elt\bx@h\@elt\bx@i\@elt\bx@j
+ \@elt\bx@k\@elt\bx@l\@elt\bx@m\@elt\bx@n
+ \@elt\bx@o\@elt\bx@p\@elt\bx@q\@elt\bx@r
+ \@elt\bx@s\@elt\bx@t\@elt\bx@u\@elt\bx@v
+ \@elt\bx@w\@elt\bx@x\@elt\bx@y\@elt\bx@z
+ \@elt\bx@AA\@elt\bx@BB\@elt\bx@CC\@elt\bx@DD\@elt\bx@EE
+ \@elt\bx@FF\@elt\bx@GG\@elt\bx@HH\@elt\bx@II\@elt\bx@JJ
+ \@elt\bx@KK\@elt\bx@LL\@elt\bx@MM\@elt\bx@NN
+ \@elt\bx@OO\@elt\bx@PP\@elt\bx@QQ\@elt\bx@RR
+ \@elt\bx@SS\@elt\bx@TT\@elt\bx@UU\@elt\bx@VV
+ \@elt\bx@WW\@elt\bx@XX\@elt\bx@YY\@elt\bx@ZZ}%
+ }{%
+ \bidituftefloatError{You may only call \string\morefloats\space twice. See the\MessageBreak bidituftefloat package documentation for other workarounds}
+ {There are already 78 float slots allocated. Try using \string\FloatBarrier\space or\MessageBreak \string\clearpage\space to place some floats before creating more.}
+ }%
+ }%
+}
+\newboolean{@bidituftefloat@packages@subfigure}
+\setboolean{@bidituftefloat@packages@subfigure}{false}
+\AtBeginDocument{%
+ \@ifpackageloaded{subfigure}
+ {\gsetboolean{@bidituftefloat@packages@subfigure}{true}}
+ {\gsetboolean{@bidituftefloat@packages@subfigure}{false}}%
+}
+\AtBeginDocument{%
+ \@ifpackageloaded{float}{%
+ % Save the redefined float environment (instead of the LaTeX float environment)
+ \let\@bidituftefloat@orig@float\@float
+ \let\@bidituftefloat@orig@endfloat\end@float
+
+ % Define Tuftian float styles (with the caption in the margin)
+ \newcommand{\floatc@bidituftefloatplain}[2]{%
+ \begin{lrbox}{\@bidituftefloat@caption@box}%
+ \begin{minipage}[\floatalignment]{\marginparwidth}\hbox{}%
+ \@bidituftefloat@caption@font{\@fs@cfont #1:} #2\par%
+ \end{minipage}%
+ \end{lrbox}%
+ \smash{\hspace{\@bidituftefloat@caption@fill}\usebox{\@bidituftefloat@caption@box}}%
+ }
+ \newcommand{\fs@bidituftefloatplain}{%
+ \def\@fs@cfont{\@bidituftefloat@caption@font}%
+ \let\@fs@capt\floatc@bidituftefloatplain%
+ \def\@fs@pre{}%
+ \def\@fs@post{}%
+ \def\@fs@mid{}%
+ \let\@fs@iftopcapt\iftrue%
+ }
+ \let\fs@bidituftefloatplaintop=\fs@bidituftefloatplain
+ \let\floatc@bidituftefloatplaintop=\floatc@bidituftefloatplain
+ \newcommand\floatc@bidituftefloatruled[2]{%
+ {\@fs@cfont #1} #2\par%
+ }
+ \newcommand\fs@bidituftefloatruled{%
+ \def\@fs@cfont{\@bidituftefloat@caption@font}%
+ \let\@fs@capt\floatc@bidituftefloatplain%
+ \def\@fs@pre{\hrule height.8pt depth0pt width\textwidth \kern2pt}%
+ \def\@fs@post{\kern2pt\hrule width\textwidth\relax}%
+ \def\@fs@mid{}%
+ \let\@fs@iftopcapt\iftrue%
+ }
+ \newcommand\fs@bidituftefloatboxed{%
+ \def\@fs@cfont{}%
+ \let\@fs@capt\floatc@bidituftefloatplain%
+ \def\@fs@pre{%
+ \setbox\@currbox\vbox{\hbadness10000
+ \moveleft3.4pt\vbox{\advance\hsize by6.8pt
+ \hrule \hbox to\hsize{\vrule\kern3pt
+ \vbox{\kern3pt\box\@currbox\kern3pt}\kern3pt\vrule}\hrule}}
+ }%
+ \def\@fs@mid{\kern2pt}%
+ \def\@fs@post{}%
+ \let\@fs@iftopcapt\iftrue%
+ }
+ }{%
+ % Nothing to do
+ }
+}
+\AtBeginDocument{%
+ \@ifpackageloaded{algorithm}{%
+ % Set the float style to the Tuftian version
+ \ifthenelse{\equal{\ALG@floatstyle}{plain}\OR\equal{\ALG@floatstyle}{ruled}\OR\equal{\ALG@floatstyle}{boxed}}{%
+ \bidituftefloatInfoNL{Switching algorithm float style from \ALG@floatstyle\MessageBreak to bidituftefloat\ALG@floatstyle}%
+ \floatstyle{bidituftefloat\ALG@floatstyle}%
+ \restylefloat{algorithm}%
+ }{}%
+ }{%
+ % Nothing to do
+ }
+}
+\PassOptionsToPackage{caption=false}{subfig}
+%%
+%% Copyright © 2009–2011 Vafa Khalighi <vafa018@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 `bidituftefloat.sty'.
diff --git a/Master/texmf-dist/tex/latex/bidi/bidituftegeneralstructure.sty b/Master/texmf-dist/tex/latex/bidi/bidituftegeneralstructure.sty
new file mode 100644
index 00000000000..fd3d8e8fd3e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bidi/bidituftegeneralstructure.sty
@@ -0,0 +1,135 @@
+%%
+%% This is file `bidituftegeneralstructure.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidituftegeneralstructure.sty')
+%%
+%% ______________________________________
+%% Copyright © 2009–2011 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bidituftegeneralstructure}[2011/06/18 v0.1
+bidi implementation of tufte general structure]
+\renewcommand\small{%
+ \@setfontsize\small\@ixpt{12}%
+ \abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@
+ \abovedisplayshortskip \z@ \@plus2\p@
+ \belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@
+ \def\@listi{\leftmargin\leftmargini
+ \topsep 4\p@ \@plus2\p@ \@minus2\p@
+ \parsep 2\p@ \@plus\p@ \@minus\p@
+ \itemsep \parsep}%
+ \belowdisplayskip \abovedisplayskip
+}
+\renewcommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt}
+\renewcommand\tiny{\@setfontsize\tiny\@vpt\@vipt}
+\renewcommand\large{\@setfontsize\large\@xipt{15}}
+\renewcommand\Large{\@setfontsize\Large\@xiipt{16}}
+\renewcommand\LARGE{\@setfontsize\LARGE\@xivpt{18}}
+\renewcommand\huge{\@setfontsize\huge\@xxpt{30}}
+\renewcommand\Huge{\@setfontsize\Huge{24}{36}}
+\setlength\leftmargini {1pc}
+\setlength\leftmarginii {1pc}
+\setlength\leftmarginiii {1pc}
+\setlength\leftmarginiv {1pc}
+\setlength\leftmarginv {1pc}
+\setlength\leftmarginvi {1pc}
+\setlength\labelsep {.5pc}
+\setlength\labelwidth {\leftmargini}
+\addtolength\labelwidth{-\labelsep}
+\setlength{\parindent}{1.0pc}%
+\setlength{\parskip}{0pt}%
+\RequirePackage{ragged2e}
+\setlength{\RaggedRightRightskip}{\z@ plus 0.08\hsize}
+\newcommand{\@bidituftegeneralstructure@reset@par}{%
+ \setlength{\RaggedRightParindent}{1.0pc}%
+ \setlength{\JustifyingParindent}{1.0pc}%
+ \setlength{\parindent}{1pc}%
+ \setlength{\parskip}{0pt}%
+}
+\@bidituftegeneralstructure@reset@par
+\RequirePackage{paralist}
+\def\@compactenum@{%
+ \expandafter\list\csname label\@enumctr\endcsname{%
+ \usecounter{\@enumctr}%
+ \rightmargin=2em% added this
+ \parsep\plparsep
+ \itemsep\plitemsep
+ \topsep\pltopsep
+ \partopsep\plpartopsep
+ \def\makelabel##1{\hss\llap{##1}}}}
+%%
+\providecommand\newthought[1]{%
+ \addvspace{1.0\baselineskip plus 0.5ex minus 0.2ex}%
+ \noindent\textbf{#1}%
+}
+%%
+\renewenvironment{verse}
+ {\let\\\@centercr
+ \list{}{\itemsep \z@
+ \itemindent -1pc%
+ \listparindent\itemindent
+ \rightmargin \leftmargin
+ \advance\leftmargin 1pc}%
+ \small%
+ \item\relax}
+ {\endlist}
+\renewenvironment{quotation}
+ {\list{}{\listparindent 1pc%
+ \itemindent \listparindent
+ \rightmargin \leftmargin
+ \parsep \z@ \@plus\p@}%
+ \small%
+ \item\relax\noindent\ignorespaces}
+ {\endlist}
+\renewenvironment{quote}
+ {\list{}{\rightmargin\leftmargin}%
+ \small%
+ \item\relax}
+ {\endlist}
+\renewcommand*\descriptionlabel[1]{\hspace\labelsep\normalfont\em #1}
+%%
+\@ifundefined{chapter}%
+ {\renewcommand\bibsection{\section*{\refname}}}
+ {\@ifundefined{NAT@sectionbib}%
+ {\renewcommand\bibsection{\chapter{\bibname}}}
+ {\renewcommand\bibsection{\section*{\bibname}}}}
+\RequirePackage{multicol}
+\renewenvironment{theindex}{%
+\@ifundefined{chapter}%
+ {\section*{\indexname}}%
+ {\chapter{\indexname}}%
+ \begin{fullwidth}%
+ \small%
+ \parskip0pt%
+ \parindent0pt%
+ \let\item\@idxitem%
+ \begin{multicols}{3}%
+}{%
+ \end{multicols}%
+ \end{fullwidth}%
+}
+\renewcommand\@idxitem{\par\hangindent 2em}
+\renewcommand\subitem{\par\hangindent 3em\hspace*{1em}}
+\renewcommand\subsubitem{\par\hangindent 4em\hspace*{2em}}
+\renewcommand\indexspace{\par\addvspace{1.0\baselineskip plus 0.5ex minus 0.2ex}\relax}%
+\newcommand{\lettergroup}[1]{}% swallow the letter heading in the index
+%%
+%% Copyright © 2009–2011 Vafa Khalighi <vafa018@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 `bidituftegeneralstructure.sty'.
diff --git a/Master/texmf-dist/tex/latex/bidi/bidituftehyperref.sty b/Master/texmf-dist/tex/latex/bidi/bidituftehyperref.sty
new file mode 100644
index 00000000000..1e4b2f0fcf7
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bidi/bidituftehyperref.sty
@@ -0,0 +1,53 @@
+%%
+%% This is file `bidituftehyperref.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidituftehyperref.sty')
+%%
+%% ______________________________________
+%% Copyright © 2009–2011 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bidituftehyperref}[2011/06/18 v0.1
+bidi implementation of tufte hyperref]
+%%
+\RequirePackage[usenames,dvipsnames,svgnames]{xcolor}%
+\newboolean{@bidituftehyperref@loadhyper}
+\setboolean{@bidituftehyperref@loadhyper}{true}
+\DeclareOption{hyper}{\setboolean{@bidituftehyperref@loadhyper}{true}}
+\DeclareOption{nohyper}{\setboolean{@bidituftehyperref@loadhyper}{false}}
+\ProcessOptions
+%% Loads the hyperref package and sets some default options.
+\newcommand{\bidituftehyperrefLoadHyperref}{%
+\RequirePackage[hyperfootnotes=false,colorlinks=true]{hyperref}
+ \hypersetup{%
+ bookmarksdepth = section,
+ citecolor = DarkGreen,
+ linkcolor = DarkBlue,
+ urlcolor = DarkGreen,
+ }%
+}
+\ifthenelse{\boolean{@bidituftehyperref@loadhyper}}{%
+ \bidituftehyperrefLoadHyperref%
+}{% hyperfootnotes override our modifications to the \footnote* and \@footnote* commands.
+ \PassOptionsToPackage{hyperfootnotes=false}{hyperref}
+}
+%%
+%% Copyright © 2009–2011 Vafa Khalighi <vafa018@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 `bidituftehyperref.sty'.
diff --git a/Master/texmf-dist/tex/latex/bidi/bidituftesidenote.sty b/Master/texmf-dist/tex/latex/bidi/bidituftesidenote.sty
new file mode 100644
index 00000000000..821a0aaf8bb
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bidi/bidituftesidenote.sty
@@ -0,0 +1,485 @@
+%%
+%% This is file `bidituftesidenote.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidituftesidenote.sty')
+%%
+%% ______________________________________
+%% Copyright © 2009–2011 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bidituftesidenote}[2011/06/17 v0.1
+bidi implementation of tufte sidenote]
+\RequirePackage{xifthen}
+\RequirePackage{ragged2e}
+\RequirePackage{setspace}
+\RequirePackage{hopatch}
+\def\bidituftesidenotemarginpar{%
+ \ifhmode
+ \@bsphack
+ \@floatpenalty -\@Mii
+ \else
+ \@floatpenalty-\@Miii
+ \fi
+ \ifinner
+ \@parmoderr
+ \@floatpenalty\z@
+ \else
+ \@next\@currbox\@freelist{}{}%
+ \@next\@marbox\@freelist{\global\count\@marbox\m@ne}%
+ {\@floatpenalty\z@
+ \@fltovf\def\@currbox{\@tempboxa}\def\@marbox{\@tempboxa}}%
+ \fi
+ \@ifnextchar [\@bidituftesidenotexmpar\@bidituftesidenoteympar}
+\long\def\@bidituftesidenotexmpar[#1]#2{%
+ \@bidituftesidenotesavemarbox\@marbox{#1}%
+ \@bidituftesidenotesavemarbox\@currbox{#2}%
+ \@xympar}
+\long\def\@bidituftesidenoteympar#1{%
+ \@bidituftesidenotesavemarbox\@marbox{#1}%
+ \global\setbox\@currbox\copy\@marbox
+ \@xympar}
+\long\def \@bidituftesidenotesavemarbox #1#2{%
+ \global\setbox #1%
+ \color@vbox
+ \vtop{%
+ \hsize\marginparwidth
+ \@parboxrestore
+ \@bidituftesidenotemarginparreset
+ #2%
+ \@minipagefalse
+ \outer@nobreak
+ }%
+ \color@endbox
+}
+\def \@bidituftesidenotemarginparreset {%
+ \reset@font
+ \normalsize
+ \@minipagetrue
+ \everypar{\@minipagefalse\everypar{}\if@RTL@footnote\beginR\else\beginL\fi}%
+}
+\def\LTRbidituftesidenotemarginpar{%
+ \ifhmode
+ \@bsphack
+ \@floatpenalty -\@Mii
+ \else
+ \@floatpenalty-\@Miii
+ \fi
+ \ifinner
+ \@parmoderr
+ \@floatpenalty\z@
+ \else
+ \@next\@currbox\@freelist{}{}%
+ \@next\@marbox\@freelist{\global\count\@marbox\m@ne}%
+ {\@floatpenalty\z@
+ \@fltovf\def\@currbox{\@tempboxa}\def\@marbox{\@tempboxa}}%
+ \fi
+ \@ifnextchar [\@LTRbidituftesidenotexmpar\@LTRbidituftesidenoteympar}
+\long\def\@LTRbidituftesidenotexmpar[#1]#2{%
+ \@LTRbidituftesidenotesavemarbox\@marbox{#1}%
+ \@LTRbidituftesidenotesavemarbox\@currbox{#2}%
+ \@xympar}
+\long\def\@LTRbidituftesidenoteympar#1{%
+ \@LTRbidituftesidenotesavemarbox\@marbox{#1}%
+ \global\setbox\@currbox\copy\@marbox
+ \@xympar}
+\long\def \@LTRbidituftesidenotesavemarbox #1#2{%
+ \global\setbox #1%
+ \color@vbox
+ \vtop{%
+ \hsize\marginparwidth
+ \@parboxrestore
+ \@LTRbidituftesidenotemarginparreset
+ #2%
+ \@minipagefalse
+ \outer@nobreak
+ }%
+ \color@endbox
+}
+\def \@LTRbidituftesidenotemarginparreset {%
+ \reset@font
+ \normalsize
+ \@minipagetrue
+ \everypar{\@minipagefalse\everypar{}\beginL}%
+}
+\def\RTLbidituftesidenotemarginpar{%
+ \ifhmode
+ \@bsphack
+ \@floatpenalty -\@Mii
+ \else
+ \@floatpenalty-\@Miii
+ \fi
+ \ifinner
+ \@parmoderr
+ \@floatpenalty\z@
+ \else
+ \@next\@currbox\@freelist{}{}%
+ \@next\@marbox\@freelist{\global\count\@marbox\m@ne}%
+ {\@floatpenalty\z@
+ \@fltovf\def\@currbox{\@tempboxa}\def\@marbox{\@tempboxa}}%
+ \fi
+ \@ifnextchar [\@RTLbidituftesidenotexmpar\@RTLbidituftesidenoteympar}
+\long\def\@RTLbidituftesidenotexmpar[#1]#2{%
+ \@RTLbidituftesidenotesavemarbox\@marbox{#1}%
+ \@RTLbidituftesidenotesavemarbox\@currbox{#2}%
+ \@xympar}
+\long\def\@RTLbidituftesidenoteympar#1{%
+ \@RTLbidituftesidenotesavemarbox\@marbox{#1}%
+ \global\setbox\@currbox\copy\@marbox
+ \@xympar}
+\long\def \@RTLbidituftesidenotesavemarbox #1#2{%
+ \global\setbox #1%
+ \color@vbox
+ \vtop{%
+ \hsize\marginparwidth
+ \@parboxrestore
+ \@RTLbidituftesidenotemarginparreset
+ #2%
+ \@minipagefalse
+ \outer@nobreak
+ }%
+ \color@endbox
+}
+\def \@RTLbidituftesidenotemarginparreset {%
+ \reset@font
+ \normalsize
+ \@minipagetrue
+ \everypar{\@minipagefalse\everypar{}\beginR}%
+}
+\newcommand{\@bidituftesidenote@marginfont}{\normalfont\footnotesize}
+\newcommand*{\@bidituftesidenote@sidenote@font}{\@bidituftesidenote@marginfont}
+\newcommand*{\@bidituftesidenote@marginnote@font}{\@bidituftesidenote@marginfont}
+\newcommand*{\@bidituftesidenote@citation@font}{\@bidituftesidenote@marginfont}
+\newcommand*{\setsidenotefont}[1]{\renewcommand*{\@bidituftesidenote@sidenote@font}{#1}}
+\newcommand*{\setmarginnotefont}[1]{\renewcommand*{\@bidituftesidenote@marginnote@font}{#1}}
+\newcommand*{\setcitationfont}[1]{\renewcommand*{\@bidituftesidenote@citation@font}{#1}}
+\newcommand*{\@bidituftesidenote@sidenote@justification}{\@bidituftesidenote@justification@autodetect}
+\newcommand*{\@bidituftesidenote@marginnote@justification}{\@bidituftesidenote@justification@autodetect}
+\newcommand*{\@bidituftesidenote@citation@justification}{\@bidituftesidenote@justification@autodetect}
+\newcommand*{\@bidituftesidenote@justification@autodetect}{\justifying}%
+\newcommand{\@bidituftesidenote@margin@par}{%
+ \setlength{\RaggedRightParindent}{0.5pc}%
+ \setlength{\JustifyingParindent}{0.5pc}%
+ \setlength{\parindent}{0.5pc}%
+ \setlength{\parskip}{0pt}%
+}
+%%
+\@ifundefined{gsetlength}{%
+\newcommand*{\gsetlength}[2]{%
+ \setlength{#1}{#2}%
+ \global#1=#1\relax%
+}%
+}{}
+%%
+\@ifundefined{gsetboolean}{%
+\newcommand*{\gsetboolean}[2]{% based on code from ifthen pkg
+ \lowercase{\def\@tempa{#2}}%
+ \@ifundefined{@tempswa\@tempa}%
+ {\PackageError{ifthen}{You can only set a boolean to `true' or `false'}\@ehc}%
+ {\@ifundefined{#1\@tempa}%
+ {\PackageError{ifthen}{Boolean #1 undefined}\@ehc}%
+ {\global\csname#1\@tempa\endcsname}%
+ }%
+}%
+}{}
+%%
+\catcode`\Q=3
+\def\@bidituftesidenote@trim@spaces#1{%
+ % Use grouping to emulate a multi-token afterassignment queue
+ \begingroup%
+ % Put `\toks 0 {' into the afterassignment queue
+ \aftergroup\toks\aftergroup0\aftergroup{%
+ % Apply \trimb to the replacement text of #1, adding a leading
+ % \noexpand to prevent brace stripping and to serve another purpose
+ % later.
+ \expandafter\@bidituftesidenote@trim@b\expandafter\noexpand#1Q Q}%
+ % Transfer the trimmed text back into #1.
+ \edef#1{\the\toks0}%
+}
+\def\@bidituftesidenote@trim@b#1 Q{\@bidituftesidenote@trim@c#1Q}
+\def\@bidituftesidenote@trim@c#1Q#2{\afterassignment\endgroup \vfuzz\the\vfuzz#1}
+\catcode`\Q=11
+%%
+
+\RequirePackage{natbib}
+\RequirePackage{bibentry} % allows bibitems to be typeset outside thebibliography environment
+\renewcommand\BR@b@bibitem[2][]{%
+ \ifthenelse{\isempty{#1}}%
+ {\BR@bibitem{#2}}%
+ {\BR@bibitem[#1]{#2}}%
+ \BR@c@bibitem{#2}%
+}
+\nobibliography* % pre-loads the bibliography keys
+%%
+\newcounter{@bidituftesidenote@num@bibkeys}%
+\newcommand{\@bidituftesidenote@normal@cite}[2][0pt]{%
+ % Snag the last bibentry in the list for later comparison
+ \let\@temp@last@bibkey\@empty%
+ \@for\@temp@bibkey:=#2\do{\let\@temp@last@bibkey\@temp@bibkey}%
+ \sidenote[][#1]{%
+ % Loop through all the bibentries, separating them with semicolons and spaces
+ \normalsize\normalfont\@bidituftesidenote@citation@font%
+ \setcounter{@bidituftesidenote@num@bibkeys}{0}%
+ \@for\@temp@bibkeyx:=#2\do{%
+ \ifthenelse{\equal{\@temp@last@bibkey}{\@temp@bibkeyx}}%
+ {\ifthenelse{\equal{\value{@bidituftesidenote@num@bibkeys}}{0}}{}{and\ }%
+ \@bidituftesidenote@trim@spaces\@temp@bibkeyx% trim spaces around bibkey
+ \bibentry{\@temp@bibkeyx}}%
+ {\@bidituftesidenote@trim@spaces\@temp@bibkeyx% trim spaces around bibkey
+ \bibentry{\@temp@bibkeyx};\ }%
+ \stepcounter{@bidituftesidenote@num@bibkeys}%
+ }%
+ }%
+}
+%%
+\gdef\@bidituftesidenote@citations{}% list of cite keys
+\newcommand\@bidituftesidenote@add@citation[1]{\relax% adds a new bibkey to the list of cite keys
+ \ifx\@bidituftesidenote@citations\@empty\else
+ \g@addto@macro\@bidituftesidenote@citations{,}% separate by commas
+ \fi
+ \g@addto@macro\@bidituftesidenote@citations{#1}
+}
+\newcommand{\@bidituftesidenote@print@citations}[1][0pt]{% puts the citations in a margin note
+ % Snag the last bibentry in the list for later comparison
+ \let\@temp@last@bibkey\@empty%
+ \@for\@temp@bibkey:=\@bidituftesidenote@citations\do{\let\@temp@last@bibkey\@temp@bibkey}%
+ \marginpar{%
+ \hbox{}\vspace*{#1}%
+ \@bidituftesidenote@citation@font%
+ \@bidituftesidenote@citation@justification%
+ \@bidituftesidenote@margin@par% use parindent and parskip settings for marginal text
+ \vspace*{-1\baselineskip}%
+ % Loop through all the bibentries, separating them with semicolons and spaces
+ \setcounter{@bidituftesidenote@num@bibkeys}{0}%
+ \@for\@temp@bibkeyx:=\@bidituftesidenote@citations\do{%
+ \ifthenelse{\equal{\@temp@last@bibkey}{\@temp@bibkeyx}}%
+ {\ifthenelse{\equal{\value{@bidituftesidenote@num@bibkeys}}{0}}{}{and\ }%
+ \@bidituftesidenote@trim@spaces\@temp@bibkeyx% trim spaces around bibkey
+ \bibentry{\@temp@bibkeyx}}%
+ {\@bidituftesidenote@trim@spaces\@temp@bibkeyx% trim spaces around bibkey
+ \bibentry{\@temp@bibkeyx};\ }%
+ \stepcounter{@bidituftesidenote@num@bibkeys}%
+ }%
+ }%
+}
+%%
+\newcommand{\@bidituftesidenote@sidenote@citations}{}% contains list of \cites in sidenote
+\newcommand{\@bidituftesidenote@infootnote@cite}[1]{%
+ \@bidituftesidenote@add@citation{#1}
+}
+%%
+\let\cite\@bidituftesidenote@normal@cite
+%%
+\RequirePackage{optparams}% for our new sidenote commands -- provides multiple optional arguments for commands
+\providecommand{\footnotelayout}{\@bidituftesidenote@sidenote@font\@bidituftesidenote@sidenote@justification}
+\renewcommand{\footnotelayout}{\@bidituftesidenote@sidenote@font\@bidituftesidenote@sidenote@justification}
+\hopatch@AfterPackage{bidi}{\long\def\@makefntext#1{\@textsuperscript{\@bidituftesidenote@sidenote@font\tiny\@thefnmark}\,\footnotelayout#1}}
+\hopatch@AfterPackage{bidi}{\def\@makefnmark{\hbox{\@textsuperscript{\normalfont\footnotesize\@thefnmark}}}}
+\providecommand*{\multiplefootnotemarker}{3sp}
+\providecommand*{\multfootsep}{,}
+\hopatch@AfterPackage{bidi}{%
+\renewcommand{\@footnotemark}{%
+ \leavevmode%
+ \ifhmode%
+ \edef\@x@sf{\the\spacefactor}%
+ \@bidituftesidenote@check@multiple@sidenotes%
+ \nobreak%
+ \fi%
+ \@makefnmark%
+ \ifhmode\spacefactor\@x@sf\fi%
+ \relax%
+}%
+}
+\newcommand{\@bidituftesidenote@check@multiple@sidenotes}{%
+ \ifdim\lastkern=\multiplefootnotemarker\relax%
+ \edef\@x@sf{\the\spacefactor}%
+ \unkern%
+ \textsuperscript{\multfootsep}%
+ \spacefactor\@x@sf\relax%
+ \fi
+}
+\hopatch@AfterPackage{bidi}{%
+\renewcommand\@footnotetext[2][0pt]{%
+ \bidituftesidenotemarginpar{%
+ \hbox{}\vspace*{#1}%
+ \def\baselinestretch {\setspace@singlespace}%
+ \reset@font\footnotesize%
+ \@bidituftesidenote@margin@par% use parindent and parskip settings for marginal text
+ \vspace*{-1\baselineskip}\noindent%
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark%
+ }%
+ \color@begingroup%
+ \@makefntext{%
+ \ignorespaces#2%
+ }%
+ \color@endgroup%
+ }%
+}%
+\renewcommand\@LTRfootnotetext[2][0pt]{%
+ \LTRbidituftesidenotemarginpar{%
+ \hbox{}\vspace*{#1}%
+ \def\baselinestretch {\setspace@singlespace}%
+ \reset@font\footnotesize%
+ \@bidituftesidenote@margin@par% use parindent and parskip settings for marginal text
+ \vspace*{-1\baselineskip}\noindent%
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark%
+ }%
+ \color@begingroup%
+ \@makefntext{%
+ \ignorespaces#2%
+ }%
+ \color@endgroup%
+ }%
+}%
+\renewcommand\@RTLfootnotetext[2][0pt]{%
+ \RTLbidituftesidenotemarginpar{%
+ \hbox{}\vspace*{#1}%
+ \def\baselinestretch {\setspace@singlespace}%
+ \reset@font\footnotesize%
+ \@bidituftesidenote@margin@par% use parindent and parskip settings for marginal text
+ \vspace*{-1\baselineskip}\noindent%
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark%
+ }%
+ \color@begingroup%
+ \@makefntext{%
+ \ignorespaces#2%
+ }%
+ \color@endgroup%
+ }%
+}%
+}
+\newlength{\@bidituftesidenote@sidenote@vertical@offset}
+\setlength{\@bidituftesidenote@sidenote@vertical@offset}{0pt}
+\long\def\@bidituftesidenote@sidenote[#1][#2]#3{%
+ \let\cite\@bidituftesidenote@infootnote@cite% use the in-sidenote \cite command
+ \gdef\@bidituftesidenote@citations{}% clear out any old citations
+ \ifthenelse{\NOT\isempty{#2}}{%
+ \gsetlength{\@bidituftesidenote@sidenote@vertical@offset}{#2}%
+ }{%
+ \gsetlength{\@bidituftesidenote@sidenote@vertical@offset}{0pt}%
+ }%
+ \ifthenelse{\isempty{#1}}{%
+ % no specific footnote number provided
+ \stepcounter\@mpfn%
+ \protected@xdef\@thefnmark{\thempfn}%
+ \@footnotemark\@footnotetext[\@bidituftesidenote@sidenote@vertical@offset]{#3}%
+ }{%
+ % specific footnote number provided
+ \begingroup%
+ \csname c@\@mpfn\endcsname #1\relax%
+ \unrestored@protected@xdef\@thefnmark{\thempfn}%
+ \endgroup%
+ \@footnotemark\@footnotetext[\@bidituftesidenote@sidenote@vertical@offset]{#3}%
+ }%
+ \@bidituftesidenote@print@citations% print any citations
+ \let\cite\@bidituftesidenote@normal@cite% go back to using normal in-text \cite command
+ \unskip\ignorespaces% remove extra white space
+ \kern-\multiplefootnotemarker% remove \kern left behind by sidenote
+ \kern\multiplefootnotemarker\relax% add new \kern here to replace the one we yanked
+}
+\long\def\@LTRbidituftesidenote@sidenote[#1][#2]#3{%
+ \let\cite\@bidituftesidenote@infootnote@cite% use the in-sidenote \cite command
+ \gdef\@bidituftesidenote@citations{}% clear out any old citations
+ \ifthenelse{\NOT\isempty{#2}}{%
+ \gsetlength{\@bidituftesidenote@sidenote@vertical@offset}{#2}%
+ }{%
+ \gsetlength{\@bidituftesidenote@sidenote@vertical@offset}{0pt}%
+ }%
+ \ifthenelse{\isempty{#1}}{%
+ % no specific footnote number provided
+ \stepcounter\@mpfn%
+ \protected@xdef\@thefnmark{\thempfn}%
+ \@footnotemark\@LTRfootnotetext[\@bidituftesidenote@sidenote@vertical@offset]{#3}%
+ }{%
+ % specific footnote number provided
+ \begingroup%
+ \csname c@\@mpfn\endcsname #1\relax%
+ \unrestored@protected@xdef\@thefnmark{\thempfn}%
+ \endgroup%
+ \@footnotemark\@LTRfootnotetext[\@bidituftesidenote@sidenote@vertical@offset]{#3}%
+ }%
+ \@bidituftesidenote@print@citations% print any citations
+ \let\cite\@bidituftesidenote@normal@cite% go back to using normal in-text \cite command
+ \unskip\ignorespaces% remove extra white space
+ \kern-\multiplefootnotemarker% remove \kern left behind by sidenote
+ \kern\multiplefootnotemarker\relax% add new \kern here to replace the one we yanked
+}
+\long\def\@RTLbidituftesidenote@sidenote[#1][#2]#3{%
+ \let\cite\@bidituftesidenote@infootnote@cite% use the in-sidenote \cite command
+ \gdef\@bidituftesidenote@citations{}% clear out any old citations
+ \ifthenelse{\NOT\isempty{#2}}{%
+ \gsetlength{\@bidituftesidenote@sidenote@vertical@offset}{#2}%
+ }{%
+ \gsetlength{\@bidituftesidenote@sidenote@vertical@offset}{0pt}%
+ }%
+ \ifthenelse{\isempty{#1}}{%
+ % no specific footnote number provided
+ \stepcounter\@mpfn%
+ \protected@xdef\@thefnmark{\thempfn}%
+ \@footnotemark\@RTLfootnotetext[\@bidituftesidenote@sidenote@vertical@offset]{#3}%
+ }{%
+ % specific footnote number provided
+ \begingroup%
+ \csname c@\@mpfn\endcsname #1\relax%
+ \unrestored@protected@xdef\@thefnmark{\thempfn}%
+ \endgroup%
+ \@footnotemark\@RTLfootnotetext[\@bidituftesidenote@sidenote@vertical@offset]{#3}%
+ }%
+ \@bidituftesidenote@print@citations% print any citations
+ \let\cite\@bidituftesidenote@normal@cite% go back to using normal in-text \cite command
+ \unskip\ignorespaces% remove extra white space
+ \kern-\multiplefootnotemarker% remove \kern left behind by sidenote
+ \kern\multiplefootnotemarker\relax% add new \kern here to replace the one we yanked
+}
+\newcommand{\sidenote}{\optparams{\@bidituftesidenote@sidenote}{[][0pt]}}
+\newcommand{\LTRsidenote}{\optparams{\@LTRbidituftesidenote@sidenote}{[][0pt]}}
+\newcommand{\RTLsidenote}{\optparams{\@RTLbidituftesidenote@sidenote}{[][0pt]}}
+\hopatch@AfterPackage{bidi}{%
+\renewcommand{\footnote}{\optparams{\@bidituftesidenote@sidenote}{[][0pt]}}%
+\renewcommand{\LTRfootnote}{\optparams{\@LTRbidituftesidenote@sidenote}{[][0pt]}}%
+\renewcommand{\RTLfootnote}{\optparams{\@RTLbidituftesidenote@sidenote}{[][0pt]}}%
+}
+%%
+\newcommand\marginnote[2][0pt]{%
+ \let\cite\@bidituftesidenote@infootnote@cite% use the in-sidenote \cite command
+ \gdef\@bidituftesidenote@citations{}% clear out any old citations
+ \bidituftesidenotemarginpar{\hbox{}\vspace*{#1}\@bidituftesidenote@marginnote@font\@bidituftesidenote@marginnote@justification\@bidituftesidenote@margin@par\vspace*{-1\baselineskip}\noindent #2}%
+ \@bidituftesidenote@print@citations% print any citations
+ \let\cite\@bidituftesidenote@normal@cite% go back to using normal in-text \cite command
+}
+\newcommand\LTRmarginnote[2][0pt]{%
+ \let\cite\@bidituftesidenote@infootnote@cite% use the in-sidenote \cite command
+ \gdef\@bidituftesidenote@citations{}% clear out any old citations
+ \LTRbidituftesidenotemarginpar{\hbox{}\vspace*{#1}\@bidituftesidenote@marginnote@font\@bidituftesidenote@marginnote@justification\@bidituftesidenote@margin@par\vspace*{-1\baselineskip}\noindent #2}%
+ \@bidituftesidenote@print@citations% print any citations
+ \let\cite\@bidituftesidenote@normal@cite% go back to using normal in-text \cite command
+}
+\newcommand\RTLmarginnote[2][0pt]{%
+ \let\cite\@bidituftesidenote@infootnote@cite% use the in-sidenote \cite command
+ \gdef\@bidituftesidenote@citations{}% clear out any old citations
+ \RTLbidituftesidenotemarginpar{\hbox{}\vspace*{#1}\@bidituftesidenote@marginnote@font\@bidituftesidenote@marginnote@justification\@bidituftesidenote@margin@par\vspace*{-1\baselineskip}\noindent #2}%
+ \@bidituftesidenote@print@citations% print any citations
+ \let\cite\@bidituftesidenote@normal@cite% go back to using normal in-text \cite command
+}
+%%
+%% Copyright © 2009–2011 Vafa Khalighi <vafa018@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 `bidituftesidenote.sty'.
diff --git a/Master/texmf-dist/tex/latex/bidi/bidituftetitle.sty b/Master/texmf-dist/tex/latex/bidi/bidituftetitle.sty
new file mode 100644
index 00000000000..58f40a764be
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bidi/bidituftetitle.sty
@@ -0,0 +1,166 @@
+%%
+%% This is file `bidituftetitle.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidituftetitle.sty')
+%%
+%% ______________________________________
+%% Copyright © 2009–2011 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bidituftetitle}[2011/06/18 v0.1
+bidi implementation of tufte title]
+\RequirePackage{etoolbox}
+%%
+\newboolean{@bidituftetitle@titlepage}
+\DeclareOption{titlepage}{\setboolean{@bidituftetitle@titlepage}{true}}
+\DeclareOption{notitlepage}{\setboolean{@bidituftetitle@titlepage}{false}}
+\@ifclassloaded{book}{%
+\ExecuteOptions{titlepage}}{%
+\@ifclassloaded{article}{%
+\ExecuteOptions{notitlepage}}%
+{}}
+\ProcessOptions
+%%
+\newcommand{\plaintitle}{}% plain-text-only title
+\newcommand{\plainauthor}{}% plain-text-only author
+\newcommand{\plainpublisher}{}% plain-text-only publisher
+\newcommand{\thanklesstitle}{}% full title text minus \thanks{}
+\newcommand{\thanklessauthor}{}% full author text minus \thanks{}
+\newcommand{\thanklesspublisher}{}% full publisher minus \thanks{}
+\newcommand{\@publisher}{}% full publisher with \thanks{}
+\newcommand{\thedate}{\today}
+\hopatch@AfterPackage{bidi}{%
+\renewcommand{\thanks}[1]{\footnote{#1}}
+\renewcommand{\LTRthanks}[1]{\LTRfootnote{#1}}
+\renewcommand{\RTLthanks}[1]{\RTLfootnote{#1}}
+}
+\renewcommand{\title}[2][]{%
+ \gdef\@title{#2}%
+ \begingroup%
+ % TODO store contents of \thanks command
+ \renewcommand{\thanks}[1]{}% swallow \thanks contents
+ \renewcommand{\LTRthanks}[1]{}% swallow \LTRthanks contents
+ \renewcommand{\RTLthanks}[1]{}% swallow \RTLthanks contents
+ \protected@xdef\thanklesstitle{#2}%
+ \endgroup%
+ \ifthenelse{\isempty{#1}}%
+ {\renewcommand{\plaintitle}{\thanklesstitle}}% use thankless title
+ {\renewcommand{\plaintitle}{#1}}% use provided plain-text title
+ \@ifundefined{hypersetup}%
+ {}% hyperref is not loaded; do nothing
+ {\hypersetup{pdftitle={\plaintitle}}}% set the PDF metadata title
+}
+\let\@author\@empty% suppress default latex.ltx ``no author'' warning
+\renewcommand{\author}[2][]{%
+ \ifthenelse{\isempty{#2}}{}{\gdef\@author{#2}}%
+ \begingroup%
+ % TODO store contents of \thanks command
+ \renewcommand{\thanks}[1]{}% swallow \thanks contents
+ \renewcommand{\LTRthanks}[1]{}% swallow \LTRthanks contents
+ \renewcommand{\RTLthanks}[1]{}% swallow \RTLthanks contents
+ \protected@xdef\thanklessauthor{#2}%
+ \endgroup%
+ \ifthenelse{\isempty{#1}}%
+ {\renewcommand{\plainauthor}{\thanklessauthor}}% use thankless author
+ {\renewcommand{\plainauthor}{#1}}% use provided plain-text author
+ \@ifundefined{hypersetup}%
+ {}% hyperref is not loaded; do nothing
+ {\hypersetup{pdfauthor={\plainauthor}}}% set the PDF metadata author
+}
+\renewcommand{\date}[1]{%
+ \gdef\@date{#1}%
+ \begingroup%
+ % TODO store contents of \thanks command
+ \renewcommand{\thanks}[1]{}% swallow \thanks contents
+ \renewcommand{\LTRthanks}[1]{}% swallow \LTRthanks contents
+ \renewcommand{\RTLthanks}[1]{}% swallow \RTLthanks contents
+ \protected@xdef\thedate{#1}%
+ \endgroup%
+}
+%%
+\newcommand{\publisher}[2][]{%
+ \gdef\@publisher{#2}%
+ \begingroup%
+ \renewcommand{\thanks}[1]{}% swallow \thanks contents
+ \renewcommand{\LTRthanks}[1]{}% swallow \LTRthanks contents
+ \renewcommand{\RTLthanks}[1]{}% swallow \RTLthanks contents
+ \protected@xdef\thanklesspublisher{#2}%
+ \endgroup%
+ \ifthenelse{\isempty{#1}}
+ {\renewcommand{\plainpublisher}{\thanklesspublisher}}% use thankless publisher
+ {\renewcommand{\plainpublisher}{#1}}% use provided plain-text publisher
+}
+%%
+\newcommand{\maketitlepage}[0]{%
+ \cleardoublepage%
+ {%
+ \bfseries%
+ \begin{fullwidth}%
+ \fontsize{18}{20}\selectfont\par\noindent\thanklessauthor%
+ \vspace{11.5pc}%
+ \fontsize{36}{40}\selectfont\par\noindent\thanklesstitle%
+ \vfill%
+ \fontsize{14}{16}\selectfont\par\noindent\thanklesspublisher%
+ \end{fullwidth}%
+ }
+ \thispagestyle{empty}%
+ \clearpage%
+}
+%%
+\AfterEndPreamble{%
+\renewcommand{\maketitle}{%
+ \newpage%
+ \global\@topnum\z@% prevent floats from being placed at the top of the page
+ \begingroup%
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{4pt}%
+ \let\@@title\@empty%
+ \let\@@author\@empty%
+ \let\@@date\@empty%
+ \gdef\@@title{\LARGE\itshape\@title\par}%
+ \gdef\@@author{\Large\itshape\@author\par}%
+ \gdef\@@date{\Large\itshape\@date\par}%
+ \@@title%
+ \@@author%
+ \@@date%
+ \endgroup%
+ \thispagestyle{plain}% suppress the running head
+}%
+}
+%%
+\AfterEndPreamble{%
+\ifthenelse{\boolean{@bidituftetitle@titlepage}}
+ {\renewcommand{\maketitle}{\maketitlepage}}
+ {}
+}
+%%
+\def\cleardoublepage{\clearpage\if@twoside\ifodd\c@page\else
+ \hbox{}
+ %\vspace*{\fill}
+ %\begin{center}
+ % This page intentionally contains only this sentence.
+ %\end{center}
+ %\vspace{\fill}
+ \thispagestyle{empty}
+ \newpage
+ \if@twocolumn\hbox{}\newpage\fi\fi\fi}
+%%
+%% Copyright © 2009–2011 Vafa Khalighi <vafa018@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 `bidituftetitle.sty'.
diff --git a/Master/texmf-dist/tex/latex/bidi/bidituftetoc.sty b/Master/texmf-dist/tex/latex/bidi/bidituftetoc.sty
new file mode 100644
index 00000000000..0c71d35eeb5
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bidi/bidituftetoc.sty
@@ -0,0 +1,163 @@
+%%
+%% This is file `bidituftetoc.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidituftetoc.sty')
+%%
+%% ______________________________________
+%% Copyright © 2009–2011 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bidituftetoc}[2011/06/17 v0.1
+bidi implementation of tufte toc]
+\RequirePackage{titlesec,titletoc,xifthen,hopatch}
+\newcommand{\@bidituftetoc@pkgname}{bidituftetoc}
+\newcommand{\bidituftetocError}[2]{\PackageError{\@bidituftetoc@pkgname}{#1}{#2}}
+%%
+\setcounter{secnumdepth}{-1}
+\newboolean{@bidituftetoc@toc}
+\setboolean{@bidituftetoc@toc}{true}
+\DeclareOption{notoc}{\setboolean{@bidituftetoc@toc}{false}}
+\DeclareOption{toc}{\setboolean{@bidituftetoc@toc}{true}}
+\ProcessOptions
+%%
+\hopatch@AfterPackage{bidi}{%
+\titleformat{\chapter}%
+ [display]% shape
+ {\relax\ifthenelse{\NOT\boolean{@bidituftefloat@symmetric}}{\begin{fullwidth}}{}}% format applied to label+text
+ {\itshape\huge\thechapter}% label
+ {0pt}% horizontal separation between label and title body
+ {\huge\rmfamily\itshape}% before the title body
+ [\ifthenelse{\NOT\boolean{@bidituftefloat@symmetric}}{\end{fullwidth}}{}]% after the title body
+\titleformat{\section}%
+ [hang]% shape
+ {\normalfont\Large\itshape}% format applied to label+text
+ {\thesection}% label
+ {1em}% horizontal separation between label and title body
+ {}% before the title body
+ []% after the title body
+\titleformat{\subsection}%
+ [hang]% shape
+ {\normalfont\large\itshape}% format applied to label+text
+ {\thesubsection}% label
+ {1em}% horizontal separation between label and title body
+ {}% before the title body
+ []% after the title body
+\titleformat{\paragraph}%
+ [runin]% shape
+ {\normalfont\itshape}% format applied to label+text
+ {\theparagraph}% label
+ {1em}% horizontal separation between label and title body
+ {}% before the title body
+ []% after the title body
+\titlespacing*{\chapter}{0pt}{50pt}{40pt}
+\titlespacing*{\section}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
+\titlespacing*{\subsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus.2ex}
+}
+\renewcommand\subsubsection{%
+ \bidituftetocError{\noexpand\subsubsection is undefined by this class.%
+ \MessageBreak See Robert Bringhurst's _The Elements of
+ \MessageBreak Typographic Style_, section 4.2.2.
+ \MessageBreak \noexpand\subsubsection was used}
+ {From Bringhurst's _The Elements of Typographic Style_, section 4.2.2: Use as
+ \MessageBreak many levels of headings as you need, no more and no fewer. Also see the many
+ \MessageBreak related threads on Ask E.T. at http://www.edwardbidituftetoc.com/.}
+}
+\renewcommand\subparagraph{%
+ \bidituftetocError{\noexpand\subparagraph is undefined by this class.%
+ \MessageBreak See Robert Bringhurst's _The Elements of
+ \MessageBreak Typographic Style_, section 4.2.2.
+ \MessageBreak \noexpand\subparagraph was used}
+ {From Bringhurst's _The Elements of Typographic Style_, section 4.2.2: Use as
+ \MessageBreak many levels of headings as you need, no more and no fewer. Also see the many
+ \MessageBreak related threads on Ask E.T. at http://www.edwardbidituftetoc.com/.}
+}
+\ifthenelse{\boolean{@bidituftetoc@toc}}{%
+ \hopatch@AfterPackage{bidi}{%
+ \titlecontents{part}% FIXME
+ [0em] % distance from left margin
+ {\vspace{1.5\baselineskip}\begin{fullwidth}\LARGE\rmfamily\itshape} % above (global formatting of entry)
+ {\contentslabel{2em}} % before w/label (label = ``II'')
+ {} % before w/o label
+ {\rmfamily\upshape\qquad\thecontentspage} % filler + page (leaders and page num)
+ [\end{fullwidth}] % after
+ \titlecontents{chapter}%
+ [0em] % distance from left margin
+ {\vspace{1.5\baselineskip}\begin{fullwidth}\LARGE\rmfamily\itshape} % above (global formatting of entry)
+ {\hspace*{0em}\contentslabel{2em}} % before w/label (label = ``2'')
+ {\hspace*{0em}} % before w/o label
+ {\rmfamily\upshape\qquad\thecontentspage} % filler + page (leaders and page num)
+ [\end{fullwidth}] % after
+ \titlecontents{section}% FIXME
+ [0em] % distance from left margin
+ {\vspace{0\baselineskip}\begin{fullwidth}\Large\rmfamily\itshape} % above (global formatting of entry)
+ {\hspace*{2em}\contentslabel{2em}} % before w/label (label = ``2.6'')
+ {\hspace*{2em}} % before w/o label
+ {\rmfamily\upshape\qquad\thecontentspage} % filler + page (leaders and page num)
+ [\end{fullwidth}] % after
+ \titlecontents{subsection}% FIXME
+ [0em] % distance from left margin
+ {\vspace{0\baselineskip}\begin{fullwidth}\large\rmfamily\itshape} % above (global formatting of entry)
+ {\hspace*{4em}\contentslabel{4em}} % before w/label (label = ``2.6.1'')
+ {\hspace*{4em}} % before w/o label
+ {\rmfamily\upshape\qquad\thecontentspage} % filler + page (leaders and page num)
+ [\end{fullwidth}] % after
+ \titlecontents{paragraph}% FIXME
+ [0em] % distance from left margin
+ {\vspace{0\baselineskip}\begin{fullwidth}\normalsize\rmfamily\itshape} % above (global formatting of entry)
+ {\hspace*{6em}\contentslabel{2em}} % before w/label (label = ``2.6.0.0.1'')
+ {\hspace*{6em}} % before w/o label
+ {\rmfamily\upshape\qquad\thecontentspage} % filler + page (leaders and page num)
+ [\end{fullwidth}] % after
+}%
+}{}
+%%
+\renewcommand\listoffigures{%
+ \@ifundefined{chapter}%
+ {\section*{\listfigurename}}%
+ {\chapter*{\listfigurename}}%
+ \@starttoc{lof}%
+}
+\renewcommand\listoftables{%
+ \@ifundefined{chapter}%
+ {\section*{\listtablename}}%
+ {\chapter*{\listtablename}}%
+ \@starttoc{lot}%
+}
+\newcommand{\@bidituftetoc@lof@line}[2]{%
+ % #1 is the figure/table number and its caption text
+ % #2 is the page number on which the figure/table appears
+ \leftskip 0.0em
+ \rightskip 0em
+ \parfillskip 0em plus 1fil
+ \parindent 0.0em
+ \@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima 2.0em
+ \if@RTL\advance\rightskip\@tempdima\else\advance\leftskip\@tempdima\fi
+ \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {#1}\nobreak\qquad\nobreak#2%
+ \par%
+}
+\renewcommand*\l@figure{\@bidituftetoc@lof@line}
+\let\l@table\l@figure
+%%
+%% Copyright © 2009–2011 Vafa Khalighi <vafa018@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 `bidituftetoc.sty'.
diff --git a/Master/texmf-dist/tex/latex/bidi/extrafootnotefeatures.def b/Master/texmf-dist/tex/latex/bidi/extrafootnotefeatures.def
index 69ccd937d76..2de5239b6b3 100644
--- a/Master/texmf-dist/tex/latex/bidi/extrafootnotefeatures.def
+++ b/Master/texmf-dist/tex/latex/bidi/extrafootnotefeatures.def
@@ -12,7 +12,10 @@
%% License information appended.
%%
%%
-\ProvidesFile{extrafootnotefeatures}[2011/03/01 v0.1 bidi extra footnote features for XeTeX engine]
+\ProvidesFile{extrafootnotefeatures}[2011/08/01 v0.2 bidi extra footnote features for XeTeX engine]
+\newif\if@parafootRTL
+\newcommand{\setRTLparagraphfootnotes}{\@parafootRTLtrue}
+\newcommand{\setLTRparagraphfootnotes}{\@parafootRTLfalse}
\let\m@mold@footnotetext\@footnotetext
\let\m@mold@LTRfootnotetext\@LTRfootnotetext
\let\m@mold@RTLfootnotetext\@RTLfootnotetext
@@ -99,11 +102,8 @@
\m@mdoextrafeetendmini
\@minipagefalse
\color@endgroup
- \egroup
- \if@RTL\endL\fi
\egroup
- \egroup
- \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa\leavevmode}}
+ \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}}
\newcommand{\m@make@footstart}[1]{%
\@namedef{@footstart#1}{%
\vskip\bigskipamount
@@ -1408,7 +1408,9 @@
\newcommand*{\m@minterparanoteglue}[1]{%
{\foottextfont\global\m@mipn@skip=#1\relax}}
\m@minterparanoteglue{1em plus.4em minus.4em}
-\newcommand*{\m@mmakehboxofhboxes}{\setbox0=\hbox{}%
+\newcommand*{\m@mmakehboxofhboxes}{%
+ \if@parafootRTL\@RTLtrue\else\@RTLfalse\fi%
+ \setbox0=\hbox{}%
\loop
\unpenalty
\setbox2=\lastbox
@@ -1421,11 +1423,15 @@
\newcommand{\paragraphfootnotes}{%
\@namedef{foottextfontv@r}{\foottextfont}% % [RS]
\let\@footnotetext\@parafootnotetext
+ \let\@LTRfootnotetext\@paraLTRfootnotetext
+ \let\@RTLfootnotetext\@paraRTLfootnotetext
\dimen\footinsv@r=\footinsdim
\count\footinsv@r=1000\relax
\m@make@para@footgroup{v@r}%
\let\@footgroupv@r\@para@footgroupv@r
\let\@mpfootnotetext\@mpparafootnotetext
+ \let\@mpLTRfootnotetext\@mpparaLTRfootnotetext
+ \let\@mpRTLfootnotetext\@mpparaRTLfootnotetext
\m@make@mppara@footgroup{v@r}%
\let\mp@footgroupv@r\@mppara@footgroupv@r
{\foottextfont
@@ -1433,7 +1439,29 @@
\multiply\dimen0 by 1024
\divide\dimen0 by \hsize \multiply\dimen0 by \footfudgefiddle
\xdef\footfudgefactor{\expandafter\strip@pt\dimen0 }}}
-\newcommand{\@parafootnotetext}[1]{\insert\footinsv@r{
+\newcommand{\@parafootnotetext}[1]{\insert\footinsv@r{\@RTLfalse
+ \def\baselinestretch{\m@m@footnote@spacing}%
+ \reset@font\foottextfont
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark}%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@parafootfmt{\if@RTL@footnote\beginR\else\beginL\fi#1\if@RTL@footnote\endR\else\endL\fi}%
+ \color@endgroup}%
+ \m@mungebox}\m@mmf@prepare}
+\newcommand{\@paraLTRfootnotetext}[1]{\insert\footinsv@r{\@RTLfalse
+ \def\baselinestretch{\m@m@footnote@spacing}%
+ \reset@font\foottextfont
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark}%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@parafootfmt{\beginL#1\endL}%
+ \color@endgroup}%
+ \m@mungebox}\m@mmf@prepare}
+\newcommand{\@paraRTLfootnotetext}[1]{\insert\footinsv@r{\@RTLfalse
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\foottextfont
\@preamfntext
@@ -1441,7 +1469,7 @@
\csname p@footnote\endcsname\@thefnmark}%
\setbox0=\vbox{\hsize=\maxdimen
\color@begingroup
- \noindent \@parafootfmt{#1}%
+ \noindent \@parafootfmt{\beginR#1\endR}%
\color@endgroup}%
\m@mungebox}\m@mmf@prepare}
\newcommand{\@parafootfmt}[1]{%
@@ -1449,7 +1477,33 @@
\parfillskip=0pt \@plus 1fil
{\footfootmark\strut {\foottextfont #1}\penalty-10}}
\newcommand{\@mpparafootnotetext}[1]{%
- \global\setbox\@mpfootinsv@r\vbox{%
+ \global\setbox\@mpfootinsv@r\vbox{\@RTLfalse%
+ \unvbox\@mpfootinsv@r
+ \def\baselinestretch{\m@m@footnote@spacing}%
+ \reset@font\foottextfont
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark}%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@parafootfmt{\if@RTL@footnote\beginR\else\beginL\fi#1\if@RTL@footnote\endR\else\endL\fi}%
+ \color@endgroup}%
+ \m@mungebox}\m@mmf@prepare}
+\newcommand{\@mpparaLTRfootnotetext}[1]{%
+ \global\setbox\@mpfootinsv@r\vbox{\@RTLfalse%
+ \unvbox\@mpfootinsv@r
+ \def\baselinestretch{\m@m@footnote@spacing}%
+ \reset@font\foottextfont
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark}%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@parafootfmt{\beginL#1\endL}%
+ \color@endgroup}%
+ \m@mungebox}\m@mmf@prepare}
+\newcommand{\@mpparaRTLfootnotetext}[1]{%
+ \global\setbox\@mpfootinsv@r\vbox{\@RTLfalse%
\unvbox\@mpfootinsv@r
\def\baselinestretch{\m@m@footnote@spacing}%
\reset@font\foottextfont
@@ -1458,7 +1512,7 @@
\csname p@mpfootnote\endcsname\@thefnmark}%
\setbox0=\vbox{\hsize=\maxdimen
\color@begingroup
- \noindent \@parafootfmt{#1}%
+ \noindent \@parafootfmt{\beginR#1\endR}%
\color@endgroup}%
\m@mungebox}\m@mmf@prepare}
\newcommand{\paragraphfootstyle}[1]{%
diff --git a/Master/texmf-dist/tex/latex/bidi/footnote-xetex-bidi.def b/Master/texmf-dist/tex/latex/bidi/footnote-xetex-bidi.def
index 211ae291d37..33f3b7ef23d 100644
--- a/Master/texmf-dist/tex/latex/bidi/footnote-xetex-bidi.def
+++ b/Master/texmf-dist/tex/latex/bidi/footnote-xetex-bidi.def
@@ -202,7 +202,7 @@
\@pboxswfalse
\setlength\@tempdima{#4}%
\def\@mpargs{{#1}{#2}[#3]{#4}}%
- \setbox\@tempboxa\vbox\bgroup\hbox\bgroup\if@RTL\beginL\fi\if #1t\vtop\else\vbox\fi\bgroup
+ \setbox\@tempboxa\vbox\bgroup
\color@begingroup
\hsize\@tempdima
\textwidth\hsize \columnwidth\hsize
diff --git a/Master/texmf-dist/tex/latex/bidi/hvfloat-xetex-bidi.def b/Master/texmf-dist/tex/latex/bidi/hvfloat-xetex-bidi.def
new file mode 100644
index 00000000000..eeaac71bdbd
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bidi/hvfloat-xetex-bidi.def
@@ -0,0 +1,406 @@
+%%
+%% This is file `hvfloat-xetex-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `hvfloat-xetex-bidi.def')
+%%
+%% ______________________________________
+%% Copyright © 2009–2011 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\ProvidesFile{hvfloat-xetex-bidi.def}[2011/06/11 v0.1 bidi adaptations for hvfloat package for XeTeX engine]
+\def\do@@hvFloat[#1]#2#3{%
+\def\hv@shortCap{#1}
+\def\hv@longCap{#2}
+\def\hv@label{#3}
+\def\@tempa{90}%
+\ifx\hvSet@rotAngle\@tempa
+\setlength{\hvMaxCapWidth}{\textheight}
+\else
+\setlength{\hvMaxCapWidth}{\linewidth}
+\fi
+\ifx\hvSet@objectAngle\hv@Zero % rotate the object?
+\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}
+\else
+\savebox{\hvObjectBox}{%
+\rotatebox{\hvSet@objectAngle}{%
+\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}}
+\fi
+\setlength{\hvObjectWidth}{\wd\hvObjectBox}
+\ifx\hvSet@capWidth\hv@Width
+\setlength{\hvCapWidth}{\hvObjectWidth}
+\else
+\ifx\hvSet@capWidth\hv@Height
+\setlength{\hvCapWidth}{\ht\hvObjectBox}
+\else
+\setlength{\hvCapWidth}{\hvObjectWidth}
+\ifx\hvSet@capPos\hv@Left
+\addtolength{\hvMaxCapWidth}{-\hvObjectWidth}
+\fi
+\ifx\hvSet@capPos\hv@Right
+\addtolength{\hvMaxCapWidth}{-\hvObjectWidth}
+\fi
+\ifdim\hvSet@capWidth\columnwidth<\hvMaxCapWidth
+\setlength{\hvCapWidth}{\hvSet@capWidth\columnwidth}
+\else
+\setlength{\hvCapWidth}{\hvMaxCapWidth}
+\fi
+\fi
+\fi
+\def\fps@figure{\hvSet@floatPos}
+\ifhv@nonFloat%
+\begingroup% Start the nonfloat part
+\else%
+\begin{\hv@floatType}% Start the floating environment
+\fi%
+\saveCaptionSkip% we put this space ourselve
+\ifx\hvSet@capAngle\hv@Width % need rotation?
+\sbox{\hvCaptionBox}{%
+\begin{minipage}[b]{\hvCapWidth}% minipage, to get hyphenation
+\ifhv@nonFloat%
+\ifhv@onlyText%
+#2%
+\else%
+ \ifthenelse{\equal{\hv@floatType}{figure}}{%
+\ifthenelse{\equal{#1}{}}{\figcaption{#2}}{\figcaption[#1]{#2}}%
+ }{%
+\ifthenelse{\equal{#1}{}}{\tabcaption{#2}}{\tabcaption[#1]{#2}}%
+ }%
+\fi%
+\else%
+\ifx\hv@shortCap\empty\caption{#2}\else\caption[#1]{#2}\fi%
+\fi%
+\label{#3}%
+\end{minipage}%
+}%
+\else%
+\sbox{\hvCaptionBox}{%
+\rotatebox{\hvSet@capAngle}{%
+\begin{minipage}[b]{\hvCapWidth}% minipage, to get hyphenation
+\ifhv@nonFloat%
+\ifhv@onlyText%
+#2%
+\else%
+ \ifthenelse{\equal{\hv@floatType}{figure}}{%
+\ifthenelse{\equal{#1}{}}{\figcaption{#2}}{\figcaption[#1]{#2}}%
+ }{%
+\ifthenelse{\equal{#1}{}}{\tabcaption{#2}}{\tabcaption[#1]{#2}}%
+ }%
+\fi%
+\else%
+\ifx\hv@shortCap\empty\caption{#2}\else\caption[#1]{#2}\fi%
+\fi%
+\label{#3}%
+\end{minipage}%
+}%
+}%
+\fi%
+%%
+\restoreCaptionSkip% save old values
+ \if@RTL%
+ \ifx\hvSet@objectPos\hv@Left%
+\raggedright%
+\else%
+\ifx\hvSet@objectPos\hv@Center%
+\ifhv@nonFloat%
+\hspace*{\fill}%
+\else%
+\centering
+\fi%
+\fi%
+\fi%
+ \else
+\ifx\hvSet@objectPos\hv@Right%
+\raggedleft%
+\else%
+\ifx\hvSet@objectPos\hv@Center%
+\ifhv@nonFloat%
+\hspace*{\fill}%
+\else%
+\centering
+\fi%
+\fi%
+\fi%
+ \fi
+\savebox{\@tempboxa}{\if@RTL%
+ \ifx\hvSet@capPos\hv@Right % caption on left side
+\ifx\hvSet@capVPos\hv@Center%
+\ifhv@framedCaption%
+\fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}%
+\else
+\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}
+\fi%
+ \hspace{\hvSet@floatCapSep pt}% capfloatsep
+\ifhv@framedObject%
+\fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}}
+\else
+\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}
+\fi%
+\else%
+\ifx\hvSet@capVPos\hv@Top % caption at top
+\ifhv@framedCaption%
+\fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}%
+\else
+\raisebox{-\height}{\usebox{\hvCaptionBox}}%
+\fi
+\hspace{\hvSet@floatCapSep pt}% capfloatsep
+\ifhv@framedObject%
+\fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}%
+\else
+\raisebox{-\height}{\usebox{\hvObjectBox}}%
+\fi%
+\else% caption on bottom
+\ifhv@framedCaption%
+\fbox{\usebox{\hvCaptionBox}}
+\else
+\usebox{\hvCaptionBox}
+\fi%
+\hspace{\hvSet@floatCapSep pt}%
+\ifhv@framedObject%
+\fbox{\usebox{\hvObjectBox}}
+\else
+\usebox{\hvObjectBox}
+\fi%
+\fi%
+\fi%
+\else
+\ifx\hvSet@capPos\hv@Top
+\ifdim\wd\hvCaptionBox>\wd\hvObjectBox
+\begin{minipage}{\wd\hvCaptionBox}
+\else
+\begin{minipage}{\wd\hvObjectBox}
+\fi
+\centering
+\ifhv@framedCaption%
+\fbox{\usebox{\hvCaptionBox}}\\[\hvBelowCaptionSkip]
+\else
+\usebox{\hvCaptionBox}\\[\hvBelowCaptionSkip]%
+\fi%
+\ifhv@framedObject%
+\fbox{\usebox{\hvObjectBox}}%
+\else
+\usebox{\hvObjectBox}%
+\fi%
+\end{minipage}
+\else
+\ifx\hvSet@capPos\hv@Bottom
+\ifdim\wd\hvCaptionBox>\wd\hvObjectBox
+\begin{minipage}{\wd\hvCaptionBox}
+\else
+\begin{minipage}{\wd\hvObjectBox}
+\fi
+\centering
+\ifhv@framedObject
+\fbox{\usebox{\hvObjectBox}}\\[\hvAboveCaptionSkip]
+\else
+\usebox{\hvObjectBox}\\[\hvAboveCaptionSkip]
+\fi%
+\ifhv@framedCaption
+\fbox{\usebox{\hvCaptionBox}}%
+\else
+\usebox{\hvCaptionBox}%
+\fi%
+\end{minipage}
+\else% the last option: put the caption on the right
+\ifx\hvSet@capVPos\hv@Center%
+\ifhv@framedObject
+\fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}}
+\else
+\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}
+\fi%
+\hspace{\hvSet@floatCapSep pt}%
+\ifhv@framedCaption
+\fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}%
+\else
+\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}
+\fi%
+\else%
+\ifx\hvSet@capVPos\hv@Top
+\ifhv@framedObject
+\fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}%
+\else
+\raisebox{-\height}{\usebox{\hvObjectBox}}%
+\fi%
+\hspace{\hvSet@floatCapSep pt}%
+\ifhv@framedCaption
+\fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}%
+\else
+\raisebox{-\height}{\usebox{\hvCaptionBox}}%
+\fi
+\else
+\ifhv@framedObject
+\fbox{\usebox{\hvObjectBox}}%
+\else
+\usebox{\hvObjectBox}%
+\fi
+\hspace{\hvSet@floatCapSep pt}%
+\ifhv@framedCaption
+\fbox{\usebox{\hvCaptionBox}}%
+\else
+\usebox{\hvCaptionBox}%
+\fi%
+\fi%
+\fi
+\fi
+\fi
+\fi
+ \else
+\ifx\hvSet@capPos\hv@Left % caption on left side
+\ifx\hvSet@capVPos\hv@Center%
+\ifhv@framedCaption%
+\fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}%
+\else
+\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}
+\fi%
+ \hspace{\hvSet@floatCapSep pt}% capfloatsep
+\ifhv@framedObject%
+\fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}}
+\else
+\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}
+\fi%
+\else%
+\ifx\hvSet@capVPos\hv@Top % caption at top
+\ifhv@framedCaption%
+\fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}%
+\else
+\raisebox{-\height}{\usebox{\hvCaptionBox}}%
+\fi
+\hspace{\hvSet@floatCapSep pt}% capfloatsep
+\ifhv@framedObject%
+\fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}%
+\else
+\raisebox{-\height}{\usebox{\hvObjectBox}}%
+\fi%
+\else% caption on bottom
+\ifhv@framedCaption%
+\fbox{\usebox{\hvCaptionBox}}
+\else
+\usebox{\hvCaptionBox}
+\fi%
+\hspace{\hvSet@floatCapSep pt}%
+\ifhv@framedObject%
+\fbox{\usebox{\hvObjectBox}}
+\else
+\usebox{\hvObjectBox}
+\fi%
+\fi%
+\fi%
+\else
+\ifx\hvSet@capPos\hv@Top
+\ifdim\wd\hvCaptionBox>\wd\hvObjectBox
+\begin{minipage}{\wd\hvCaptionBox}
+\else
+\begin{minipage}{\wd\hvObjectBox}
+\fi
+\centering
+\ifhv@framedCaption%
+\fbox{\usebox{\hvCaptionBox}}\\[\hvBelowCaptionSkip]
+\else
+\usebox{\hvCaptionBox}\\[\hvBelowCaptionSkip]%
+\fi%
+\ifhv@framedObject%
+\fbox{\usebox{\hvObjectBox}}%
+\else
+\usebox{\hvObjectBox}%
+\fi%
+\end{minipage}
+\else
+\ifx\hvSet@capPos\hv@Bottom
+\ifdim\wd\hvCaptionBox>\wd\hvObjectBox
+\begin{minipage}{\wd\hvCaptionBox}
+\else
+\begin{minipage}{\wd\hvObjectBox}
+\fi
+\centering
+\ifhv@framedObject
+\fbox{\usebox{\hvObjectBox}}\\[\hvAboveCaptionSkip]
+\else
+\usebox{\hvObjectBox}\\[\hvAboveCaptionSkip]
+\fi%
+\ifhv@framedCaption
+\fbox{\usebox{\hvCaptionBox}}%
+\else
+\usebox{\hvCaptionBox}%
+\fi%
+\end{minipage}
+\else% the last option: put the caption on the right
+\ifx\hvSet@capVPos\hv@Center%
+\ifhv@framedObject
+\fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}}
+\else
+\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}
+\fi%
+\hspace{\hvSet@floatCapSep pt}%
+\ifhv@framedCaption
+\fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}%
+\else
+\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}
+\fi%
+\else%
+\ifx\hvSet@capVPos\hv@Top
+\ifhv@framedObject
+\fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}%
+\else
+\raisebox{-\height}{\usebox{\hvObjectBox}}%
+\fi%
+\hspace{\hvSet@floatCapSep pt}%
+\ifhv@framedCaption
+\fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}%
+\else
+\raisebox{-\height}{\usebox{\hvCaptionBox}}%
+\fi
+\else
+\ifhv@framedObject
+\fbox{\usebox{\hvObjectBox}}%
+\else
+\usebox{\hvObjectBox}%
+\fi
+\hspace{\hvSet@floatCapSep pt}%
+\ifhv@framedCaption
+\fbox{\usebox{\hvCaptionBox}}%
+\else
+\usebox{\hvCaptionBox}%
+\fi%
+\fi%
+\fi
+\fi
+\fi
+\fi
+\fi}% End savebox Object and caption
+\ifx\hvSet@rotAngle\hv@Zero
+\usebox{\@tempboxa}
+\else
+\rotatebox{\hvSet@rotAngle}{\usebox{\@tempboxa}}
+\fi
+\ifhv@nonFloat
+\ifx\hvSet@objectPos\hv@Center
+\ifhv@nonFloat
+\hspace{\fill}
+\fi
+\fi
+\endgroup% End the nonfloat part
+\else
+\end{\hv@floatType}% End the floating environment
+\fi
+\ifhv@fbox % reset local settings
+ \setkeys{hvSet}{framedCaption=true, framedObject=true}
+\fi
+}
+%%
+%% Copyright © 2009–2011 Vafa Khalighi <vafa018@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 `hvfloat-xetex-bidi.def'.
diff --git a/Master/texmf-dist/tex/latex/bidi/loadingorder-bidi.def b/Master/texmf-dist/tex/latex/bidi/loadingorder-bidi.def
index f503306a273..68b8ef3c101 100644
--- a/Master/texmf-dist/tex/latex/bidi/loadingorder-bidi.def
+++ b/Master/texmf-dist/tex/latex/bidi/loadingorder-bidi.def
@@ -35,6 +35,7 @@
\bidi@isloaded{xunicode}
\bidi@isloaded{wrapfig}
\bidi@isloaded{graphicx}
+\bidi@isloaded{hvfloat}
\bidi@isloaded{hyperref}
\bidi@isloaded{fancyhdr}
\bidi@isloaded{draftwatermark}
@@ -58,6 +59,7 @@
\bidi@isloaded{multicol}
\bidi@isloaded{multienum}
\bidi@isloaded{minitoc}
+\bidi@isloaded{natbib}
\bidi@isloaded{ragged2e}
\bidi@isloaded{tabls}
\bidi@isloaded{tabulary}
@@ -113,6 +115,9 @@
\if@bidi@graphicxloaded@\else
\bidi@isloaded[\PackageError{bidi}{Oops! you have loaded package graphicx after bidi package. Please load package graphicx before bidi package, and then try to run xelatex on your document again}{}]{graphicx}
\fi%
+ \if@bidi@hvfloatloaded@\else
+ \bidi@isloaded[\PackageError{bidi}{Oops! you have loaded package hvfloat after bidi package. Please load package hvfloat before bidi package, and then try to run xelatex on your document again}{}]{hvfloat}
+ \fi%
\if@bidi@hyperrefloaded@\else
\bidi@isloaded[\PackageError{bidi}{Oops! you have loaded package hyperref after bidi package. Please load package hyperref before bidi package, and then try to run xelatex on your document again}{}]{hyperref}
\fi%
@@ -182,6 +187,9 @@
\if@bidi@minitocloaded@\else
\bidi@isloaded[\PackageError{bidi}{Oops! you have loaded package minitoc after bidi package. Please load package minitoc before bidi package, and then try to run xelatex on your document again}{}]{minitoc}
\fi%
+ \if@bidi@natbibloaded@\else
+ \bidi@isloaded[\PackageError{bidi}{Oops! you have loaded package natbib after bidi package. Please load package natbib before bidi package, and then try to run xelatex on your document again}{}]{natbib}
+ \fi%
\csname if@bidi@ragged2eloaded@\endcsname\else
\bidi@isloaded[\PackageError{bidi}{Oops! you have loaded package ragged2e after bidi package. Please load package ragged2e before bidi package, and then try to run xelatex on your document again}{}]{ragged2e}
\fi%
diff --git a/Master/texmf-dist/tex/latex/bidi/natbib-xetex-bidi.def b/Master/texmf-dist/tex/latex/bidi/natbib-xetex-bidi.def
new file mode 100644
index 00000000000..66443911023
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bidi/natbib-xetex-bidi.def
@@ -0,0 +1,75 @@
+%%
+%% This is file `natbib-xetex-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `natbib-xetex-bidi.def')
+%%
+%% ______________________________________
+%% Copyright © 2009–2011 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\ProvidesFile{natbib-xetex-bidi.def}[2011/06/04 v0.1 bidi adaptations for natbib package for XeTeX engine]
+\renewenvironment{LTRbibitems}[1][\labelsep]
+ {\par\@RTLfalse
+ \ifNAT@numbers
+ \leftskip\labelwidth
+ \else
+ \leftskip\labelsep
+ \fi
+ \advance\leftskip #1
+ \advance\rightskip -\leftmargin
+ \ignorespaces}{\endtrivlist}
+\renewenvironment{RTLbibitems}[1][\labelsep]
+ {\par\@RTLtrue
+ \ifNAT@numbers
+ \rightskip\labelwidth
+ \else
+ \rightskip\labelsep
+ \fi
+ \advance\rightskip #1
+ \advance\leftskip -\leftmargin
+ \ignorespaces}{\endtrivlist}
+\renewenvironment{thebibliography}[1]{%
+ \bibsection
+ \parindent\z@
+ \bibpreamble
+ \bibfont
+ \if@RTL\if@LTRbibitems\@RTLfalse\else\fi\else\if@RTLbibitems\@RTLtrue\else\fi\fi
+ \list{\@biblabel{\the\c@NAT@ctr}}{\@bibsetup{#1}\global\c@NAT@ctr\z@}%
+ \ifNAT@openbib
+ \renewcommand\newblock{\par}%
+ \else
+ \renewcommand\newblock{\hskip .11em \@plus.33em \@minus.07em}%
+ \fi
+ \sloppy\clubpenalty4000\widowpenalty4000
+ \sfcode`\.\@m
+ \let\NAT@bibitem@first@sw\@firstoftwo
+ \let\citeN\cite \let\shortcite\cite
+ \let\citeasnoun\cite
+}{%
+ \bibitem@fin
+ \bibpostamble
+ \def\@noitemerr{%
+ \PackageWarning{natbib}{Empty `thebibliography' environment}%
+ }%
+ \endlist
+ \bibcleanup
+}%
+%%
+%% Copyright © 2009–2011 Vafa Khalighi <vafa018@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 `natbib-xetex-bidi.def'.
diff --git a/Master/texmf-dist/tex/latex/bidi/plain-xetex-bidi.def b/Master/texmf-dist/tex/latex/bidi/plain-xetex-bidi.def
index c93d7c4a76a..6639ff7f743 100644
--- a/Master/texmf-dist/tex/latex/bidi/plain-xetex-bidi.def
+++ b/Master/texmf-dist/tex/latex/bidi/plain-xetex-bidi.def
@@ -12,9 +12,9 @@
%% License information appended.
%%
%%
-\ifx\TeXXeTstate\undefined\else%
- \TeXXeTstate=1
-\fi
+\def\TeXXeTOn{\TeXXeTstate=1 }
+\def\TeXXeTOff{\TeXXeTstate=0 }
+\TeXXeTOn
\def\Bidi@RTL@everypar{\if@RTL{\setbox\z@\lastbox\beginR\box\z@}\fi}
\let\o@everypar=\everypar
\newtoks\n@everypar
@@ -45,18 +45,16 @@
\everyvbox{%
\aftergroup\egroup
\everyvbox{}%
- \beginR
+ \@RTLtrue
\bgroup
- \aftergroup\endR
\aftergroup\egroup
}\vbox}
\protected\def\vboxL{\vbox\bgroup
\everyvbox{%
\aftergroup\egroup
\everyvbox{}%
- \beginL
+ \@RTLfalse
\bgroup
- \aftergroup\endL
\aftergroup\egroup
}\vbox}
\def\LTR{\par\@RTLfalse\@RTL@footnotefalse\hsize\linewidth\parshape\z@}
diff --git a/Master/texmf-dist/tex/latex/bidi/sidecap-xetex-bidi.def b/Master/texmf-dist/tex/latex/bidi/sidecap-xetex-bidi.def
new file mode 100644
index 00000000000..9a4083e202c
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bidi/sidecap-xetex-bidi.def
@@ -0,0 +1,35 @@
+%%
+%% This is file `sidecap-xetex-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `sidecap-xetex-bidi.def')
+%%
+%% ______________________________________
+%% Copyright © 2009–2011 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\ProvidesFile{sidecap-xetex-bidi.def}[2010/08/01 v0.1 bidi adaptations for sidecap package for XeTeX engine]
+\renewcommand*{\SC@FLOAT}[2]{\if@RTL%
+ \isSC@ODD{{#1}\hspace{\sidecaptionsep}{#2}} {{#2}\hspace{\sidecaptionsep}{#1}}\else%
+\isSC@ODD{{#2}\hspace{\sidecaptionsep}{#1}} {{#1}\hspace{\sidecaptionsep}{#2}}\fi}
+ \renewcommand*\SC@justify@caption{\if@RTL%
+\isSC@ODD{\RaggedLeft}{\RaggedRight}\else%
+ \isSC@ODD{\RaggedRight}{\RaggedLeft}\fi}
+%%
+%% Copyright © 2009–2011 Vafa Khalighi <vafa018@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 `sidecap-xetex-bidi.def'.
diff --git a/Master/texmf-dist/tex/latex/bidi/titlesec-xetex-bidi.def b/Master/texmf-dist/tex/latex/bidi/titlesec-xetex-bidi.def
index 00d3aaa1c09..ddf214ac43d 100644
--- a/Master/texmf-dist/tex/latex/bidi/titlesec-xetex-bidi.def
+++ b/Master/texmf-dist/tex/latex/bidi/titlesec-xetex-bidi.def
@@ -19,6 +19,28 @@
\let\\\@centercr
\advance\rightskip\z@ \@plus 1fil
\parfillskip\z@}
+\def\ttlh@hang#1#2#3#4#5#6#7#8{%
+ \gdef\ttl@makeline##1{\ttl@calc\hspace{#6}##1\ttl@calc\hspace{#7}}%
+ \setlength\leftskip{#6}%
+ \setlength\rightskip{#7}%
+ \interlinepenalty\@M
+ \ttl@changecentercr
+ \ttl@beginlongest
+ #1{\ifhmode\ttl@hmode@error\fi
+ \ttl@glcmds
+ \parindent\z@
+ \leavevmode
+ \begingroup
+ \ifttl@label
+ \sbox\z@{#2\strut\ttl@calc\hspace{#3}}%
+ \if@RTL\advance\rightskip\wd\z@\else\advance\leftskip\wd\z@\fi
+ \llap{\box\z@}%
+ \fi
+ #4{#8}%
+ \kern\z@\strut\@@par
+ \endgroup
+ \nobreak\ttl@midlongest#5\@@par}%
+ \ttl@endlongest}
%%
%% Copyright © 2009–2011 Vafa Khalighi <vafa018@gmail.com>
%%
diff --git a/Master/texmf-dist/tex/latex/bidi/xetex-bidi.def b/Master/texmf-dist/tex/latex/bidi/xetex-bidi.def
index aeada1a71a0..27b9e5bf025 100644
--- a/Master/texmf-dist/tex/latex/bidi/xetex-bidi.def
+++ b/Master/texmf-dist/tex/latex/bidi/xetex-bidi.def
@@ -12,10 +12,10 @@
%% License information appended.
%%
%%
-\ProvidesFile{xetex-bidi.def}[2010/08/01 v0.8 bidi adaptations for XeTeX engine]
-\ifx\TeXXeTstate\undefined\else%
- \TeXXeTstate=1
-\fi
+\ProvidesFile{xetex-bidi.def}[2011/07/25 v0.9 bidi adaptations for XeTeX engine]
+\newcommand{\TeXXeTOn}{\TeXXeTstate=1 }
+\newcommand{\TeXXeTOff}{\TeXXeTstate=0 }
+\TeXXeTOn
\def\Bidi@RTL@everypar{\if@RTL{\setbox\z@\lastbox\beginR\usebox\z@}\fi}
\let\o@everypar=\everypar
\newtoks\n@everypar
@@ -46,18 +46,16 @@
\everyvbox{%
\aftergroup\egroup
\everyvbox{}%
- \beginR
+ \@RTLtrue
\bgroup
- \aftergroup\endR
\aftergroup\egroup
}\vbox}
\protected\def\vboxL{\vbox\bgroup
\everyvbox{%
\aftergroup\egroup
\everyvbox{}%
- \beginL
+ \@RTLfalse
\bgroup
- \aftergroup\endL
\aftergroup\egroup
}\vbox}
\def\LTR{\par\@RTLfalse\@RTL@footnotefalse\hsize\linewidth\parshape\z@}
@@ -97,6 +95,8 @@
\let\setRL=\setRTL
\let\setLR=\setLTR
\let\unsetRL=\setLTR
+\@ifpackageloaded{mathtools}{\RequirePackage{graphicx}}{}
+\@ifpackageloaded{sidecap}{\RequirePackage{ragged2e}}{}
\DeclareOption{RTLdocument}{\@RTLtrue\@RTL@footnotetrue\g@addto@macro\document{\autofootnoterule}}
\DeclareOption{rldocument}{\@RTLtrue\@RTL@footnotetrue\g@addto@macro\document{\autofootnoterule}}
\def\rcases#1{\left.\vcenter{\normalbaselines\m@th
@@ -145,6 +145,18 @@
\advance\rightskip #1
\advance\leftskip -\leftmargin
\ignorespaces}{\endtrivlist}
+\newenvironment{LTRbibitems}[1][\labelsep]
+ {\par\@RTLfalse
+ \leftskip\labelwidth
+ \advance\leftskip #1
+ \advance\rightskip -\leftmargin
+ \ignorespaces}{\endtrivlist}
+\newenvironment{RTLbibitems}[1][\labelsep]
+ {\par\@RTLtrue
+ \rightskip\labelwidth
+ \advance\rightskip #1
+ \advance\leftskip -\leftmargin
+ \ignorespaces}{\endtrivlist}
\def\raggedright{%
\let\\\@centercr
\leftskip\z@skip\rightskip\@flushglue
@@ -303,42 +315,98 @@ $\@@underline{\hbox{#1}}\m@th$\relax\fi\fi}
\setlength\@tempdima{#1}% support calc
\hb@xt@\@tempdima{\csname bm@#2\endcsname}%
\@end@tempboxa}
-\def\bm@l{\if@RTL\hss\else\fi\unhbox\@tempboxa\if@RTL\else\hss\fi}\let\bm@t\bm@l
-\def\bm@r{\if@RTL\else\hss\fi\unhbox\@tempboxa\if@RTL\hss\else\fi}\let\bm@b\bm@r
-\def\endminipage{%
- \par
- \unskip
- \ifvoid\@mpfootins\else
- \vskip\skip\@mpfootins
- \normalcolor
- \footnoterule
- \unvbox\@mpfootins
- \fi
- \@minipagefalse %% added 24 May 89
- \color@endgroup
- \egroup
- \if@RTL\endL\fi
- \egroup
- \egroup
- \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa\leavevmode}}
-\long\def\@iiiparbox#1#2[#3]#4#5{%
- \leavevmode
- \@pboxswfalse
- \setlength\@tempdima{#4}%
- \@begin@tempboxa\vbox{\hbox{\if@RTL\beginL\fi\if #1t\vtop\else\vbox\fi{\hsize\@tempdima\@parboxrestore#5\@@par}\if@RTL\endL\fi}}%
- \ifx\relax#2\else
- \setlength\@tempdimb{#2}%
- \edef\@parboxto{to\the\@tempdimb}%
- \fi
- \if#1b\vbox
- \else\if #1t\vtop
- \else\ifmmode\vcenter
- \else\@pboxswtrue $\vcenter
- \fi\fi\fi
- \@parboxto{\let\hss\vss\let\unhbox\unvbox
- \csname bm@#3\endcsname}%
- \if@pboxsw \m@th$\fi
- \@end@tempboxa}
+\def\bm@l{\if@RTL\hss\else\fi\unhbox\@tempboxa\if@RTL\else\hss\fi}
+\def\bm@r{\if@RTL\else\hss\fi\unhbox\@tempboxa\if@RTL\hss\else\fi}
+\def\bm@b{\hss\unhbox\@tempboxa}
+\def\bm@t{\unhbox\@tempboxa\hss}
+\def\LTRmarginpar{%
+ \ifhmode
+ \@bsphack
+ \@floatpenalty -\@Mii
+ \else
+ \@floatpenalty-\@Miii
+ \fi
+ \ifinner
+ \@parmoderr
+ \@floatpenalty\z@
+ \else
+ \@next\@currbox\@freelist{}{}%
+ \@next\@marbox\@freelist{\global\count\@marbox\m@ne}%
+ {\@floatpenalty\z@
+ \@fltovf\def\@currbox{\@tempboxa}\def\@marbox{\@tempboxa}}%
+ \fi
+ \@ifnextchar [\@LTRxmpar\@LTRympar}
+\long\def\@LTRxmpar[#1]#2{%
+ \@LTRsavemarbox\@marbox{#1}%
+ \@LTRsavemarbox\@currbox{#2}%
+ \@xympar}
+\long\def\@LTRympar#1{%
+ \@LTRsavemarbox\@marbox{#1}%
+ \global\setbox\@currbox\copy\@marbox
+ \@xympar}
+\long\def \@LTRsavemarbox #1#2{%
+ \global\setbox #1%
+ \color@vbox
+ \vtop{%
+ \hsize\marginparwidth
+ \@parboxrestore
+ \@LTRmarginparreset
+ #2%
+ \@minipagefalse
+ \outer@nobreak
+ }%
+ \color@endbox
+}
+\def \@LTRmarginparreset {%
+ \reset@font
+ \normalsize
+ \@minipagetrue
+ \everypar{\@minipagefalse\everypar{}\beginL}%
+}
+\def\RTLmarginpar{%
+ \ifhmode
+ \@bsphack
+ \@floatpenalty -\@Mii
+ \else
+ \@floatpenalty-\@Miii
+ \fi
+ \ifinner
+ \@parmoderr
+ \@floatpenalty\z@
+ \else
+ \@next\@currbox\@freelist{}{}%
+ \@next\@marbox\@freelist{\global\count\@marbox\m@ne}%
+ {\@floatpenalty\z@
+ \@fltovf\def\@currbox{\@tempboxa}\def\@marbox{\@tempboxa}}%
+ \fi
+ \@ifnextchar [\@RTLxmpar\@RTLympar}
+\long\def\@RTLxmpar[#1]#2{%
+ \@RTLsavemarbox\@marbox{#1}%
+ \@RTLsavemarbox\@currbox{#2}%
+ \@xympar}
+\long\def\@RTLympar#1{%
+ \@RTLsavemarbox\@marbox{#1}%
+ \global\setbox\@currbox\copy\@marbox
+ \@xympar}
+\long\def \@RTLsavemarbox #1#2{%
+ \global\setbox #1%
+ \color@vbox
+ \vtop{%
+ \hsize\marginparwidth
+ \@parboxrestore
+ \@RTLmarginparreset
+ #2%
+ \@minipagefalse
+ \outer@nobreak
+ }%
+ \color@endbox
+}
+\def \@RTLmarginparreset {%
+ \reset@font
+ \normalsize
+ \@minipagetrue
+ \everypar{\@minipagefalse\everypar{}\beginR}%
+}
\def\@addmarginpar{\@next\@marbox\@currlist{\@cons\@freelist\@marbox
\@cons\@freelist\@currbox}\@latexbug\@tempcnta\@ne
\if@twocolumn
@@ -467,7 +535,7 @@ $\@@underline{\hbox{#1}}\m@th$\relax\fi\fi}
\everydisplay\expandafter{\the\everydisplay\predisplaydirection=0 }
\def\@eqnnum{{\normalfont \normalcolor \if@RTL\beginR\fi(\theequation)\if@RTL\endR\fi}}
\input{footnote-xetex-bidi.def}
-\@ifclassloaded{article}{\input{article-xetex-bidi.def}}{}
+\@ifclassloaded{article}{\@ifclassloaded{svmult}{}{\input{article-xetex-bidi.def}}}{}
\@ifclassloaded{extarticle}{\input{extarticle-xetex-bidi.def}}{}
\@ifclassloaded{artikel1}{\input{artikel1-xetex-bidi.def}}{}
\@ifclassloaded{artikel2}{\input{artikel2-xetex-bidi.def}}{}
@@ -506,6 +574,7 @@ $\@@underline{\hbox{#1}}\m@th$\relax\fi\fi}
\@ifpackageloaded{xltxtra}{\input{xltxtra-xetex-bidi.def}}{}
\@ifpackageloaded{wrapfig}{\input{wrapfig-xetex-bidi.def}}{}
\@ifpackageloaded{graphicx}{\input{graphicx-xetex-bidi.def}}{}
+\@ifpackageloaded{hvfloat}{\input{hvfloat-xetex-bidi.def}}{}
\@ifpackageloaded{hyperref}{\input{hyperref-xetex-bidi.def}}{}
\@ifpackageloaded{fancyhdr}{\input{fancyhdr-xetex-bidi.def}}{}
\@ifpackageloaded{draftwatermark}{\input{draftwatermark-xetex-bidi.def}}{}
@@ -519,12 +588,36 @@ $\@@underline{\hbox{#1}}\m@th$\relax\fi\fi}
\@ifpackageloaded{titlesec}{\input{titlesec-xetex-bidi.def}}{}
\@ifpackageloaded{titletoc}{\input{titletoc-xetex-bidi.def}}{}
\@ifpackageloaded{array}{\input{array-xetex-bidi.def}}{}
+\@ifpackageloaded{sidecap}{\input{sidecap-xetex-bidi.def}}{}
+\@ifpackagewith{sidecap}{innercaption}{%
+\if@RTL \renewcommand*{\SC@FLOAT}[2]{%
+ \isSC@ODD{{#2}\hspace{\sidecaptionsep}{#1}} {{#1}\hspace{\sidecaptionsep}{#2}}}
+ \renewcommand*\SC@justify@caption{%
+ \isSC@ODD{\RaggedRight}{\RaggedLeft}}\else
+ \renewcommand*{\SC@FLOAT}[2]{%
+ \isSC@ODD{{#1}\hspace{\sidecaptionsep}{#2}} {{#2}\hspace{\sidecaptionsep}{#1}}}
+ \renewcommand*\SC@justify@caption{%
+ \isSC@ODD{\RaggedLeft}{\RaggedRight}}\fi
+}{}
+\@ifpackagewith{sidecap}{rightcaption}{%
+ \if@RTL\renewcommand*{\SC@FLOAT}[2]{{#1}\hspace{\sidecaptionsep}{#2}}
+ \def\SC@justify@caption{\RaggedLeft}\else%
+ \renewcommand*{\SC@FLOAT}[2]{{#2}\hspace{\sidecaptionsep}{#1}}
+ \def\SC@justify@caption{\RaggedRight}\fi%
+}{}
+\@ifpackagewith{sidecap}{leftcaption}{%
+\if@RTL \renewcommand*{\SC@FLOAT}[2]{{#2}\hspace{\sidecaptionsep}{#1}}
+ \def\SC@justify@caption{\RaggedRight}\else%
+ \renewcommand*{\SC@FLOAT}[2]{{#1}\hspace{\sidecaptionsep}{#2}}
+ \def\SC@justify@caption{\RaggedLeft}\fi%
+}{}
\@ifpackageloaded{stabular}{\input{stabular-xetex-bidi.def}}{}
\@ifpackageloaded{subfigure}{\input{subfigure-xetex-bidi.def}}{}
\@ifpackageloaded{longtable}{\input{longtable-xetex-bidi.def}}{}
\@ifpackageloaded{arydshln}{\input{arydshln-xetex-bidi.def}}{}
\@ifpackageloaded{multicol}{\input{multicol-xetex-bidi.def}}{}
\@ifpackageloaded{multienum}{\input{multienum-xetex-bidi.def}}{}
+\@ifpackageloaded{natbib}{\input{natbib-xetex-bidi.def}}{}
\@ifpackageloaded{minitoc}{\input{minitoc-xetex-bidi.def}}{}
\@ifpackageloaded{quotchap}{\input{quotchap-xetex-bidi.def}}{}
\@ifpackageloaded{ragged2e}{\input{ragged2e-xetex-bidi.def}}{}