diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/bidi/footnote-xetex-bidi.def')
-rw-r--r-- | Master/texmf-dist/tex/latex/bidi/footnote-xetex-bidi.def | 256 |
1 files changed, 256 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/bidi/footnote-xetex-bidi.def b/Master/texmf-dist/tex/latex/bidi/footnote-xetex-bidi.def new file mode 100644 index 00000000000..c9d3cce14ba --- /dev/null +++ b/Master/texmf-dist/tex/latex/bidi/footnote-xetex-bidi.def @@ -0,0 +1,256 @@ +%% +%% This is file `footnote-xetex-bidi.def', + +%% +%% __________________________________ +%% Copyright © 2009-2010 Vafa Khalighi +%% +%% License information appended. +%% +%% +\ProvidesFile{footnote-xetex-bidi.def}[2010/07/25 v0.4 bidi footnote macros for XeTeX engine] +\if@RTLmain\@RTL@footnotetrue\else\@RTL@footnotefalse\fi +\def\bidi@footnote@output{{% + \dimen0=\ht\footins + \advance\dimen0 by\dp\footins + \def\@elt##1##2{% + \ifx\bidi@footnoterule\relax\global\let\bidi@footnoterule##2\fi + \advance\dimen0 by -##1\relax + \ifdim\dimen0<\z@ + {% + \let\@elt\relax\let\right@footnote\relax\let\left@footnote\relax + \dimen0=-\dimen0% + \xdef\new@bidi@footnote@list{\new@bidi@footnote@list\noexpand\@elt{\the\dimen0}{##2}}% +}% + \fi + \ifdim\dimen0>\z@\else +\let\right@footnote\relax\let\left@footnote\relax +\def\@elt####1####2{% + {\let\@elt\relax + \xdef\new@bidi@footnote@list{\new@bidi@footnote@list\noexpand\@elt{####1}{####2}}}% +}% + \fi + }% + \def\new@bidi@footnote@list{}% + \bidi@footnote@list + \global\let\bidi@footnote@list\new@bidi@footnote@list + }} +\def\right@footnote{% + \hbox to \columnwidth + {\beginR \vbox{\kern -3\p@ + \hrule width .4\columnwidth \kern2.6\p@}\hfil\endR}} +\def\left@footnote{% + \hrule width .4\columnwidth\kern 2.6\p@} +\def\textwidth@footnote{\kern-3\p@ + \hrule \@width \textwidth \kern 2.6\p@} +\def\right@footnoterule{\bidi@footnote@output\right@footnote\global\let\bidi@footnoterule\relax} +\def\left@footnoterule{\bidi@footnote@output\left@footnote\global\let\bidi@footnoterule\relax} +\def\textwidth@footnoterule{\bidi@footnote@output\textwidth@footnote\global\let\bidi@footnoterule\relax} +\def\auto@footnoterule{\bidi@footnote@output + \ifx\bidi@footnoterule\relax\if@RTL\right@footnote\else\left@footnote\fi\else\bidi@footnoterule\fi + \global\let\bidi@footnoterule\relax} +\def\leftfootnoterule{\def\footnoterule{\left@footnoterule}} +\let\LRfootnoterule=\leftfootnoterule +\def\rightfootnoterule{\def\footnoterule{\right@footnoterule}} +\def\textwidthfootnoterule{\def\footnoterule{\textwidth@footnoterule}} +\def\autofootnoterule{\def\footnoterule{\auto@footnoterule}} +\def\@makefnmark{\hbox{\@textsuperscript{\normalfont\@thefnmark}}} +\def\bidi@footnote@list{} +\let\bidi@footnoterule\relax +\def\RTLfootnote{\@ifnextchar[\@xRTLfootnote{\stepcounter\@mpfn + \protected@xdef\@thefnmark{\thempfn}% + \@footnotemark\@RTLfootnotetext}} +\def\@xRTLfootnote[#1]{% + \begingroup + \csname c@\@mpfn\endcsname #1\relax + \unrestored@protected@xdef\@thefnmark{\thempfn}% + \endgroup + \@footnotemark\@RTLfootnotetext} +\def\LTRfootnote{\@ifnextchar[\@xLTRfootnote{\stepcounter\@mpfn + \protected@xdef\@thefnmark{\thempfn}% + \@footnotemark\@LTRfootnotetext}} +\def\@xLTRfootnote[#1]{% + \begingroup + \csname c@\@mpfn\endcsname #1\relax + \unrestored@protected@xdef\@thefnmark{\thempfn}% + \endgroup + \@footnotemark\@LTRfootnotetext} +\def\insertRTL{\bgroup\beginR\@RTLtrue} +\def\endinsertRTL{\endR\egroup} +\def\insertLTR{\bgroup\beginL\@RTLfalse} +\def\endinsertLTR{\endL\egroup} +\DeclareRobustCommand\InLTR{\insertLTR} +\DeclareRobustCommand\EInLTR{\endinsertLTR} +\DeclareRobustCommand\InRTL{\insertRTL} +\DeclareRobustCommand\EInRTL{\endinsertRTL} +\long\def\parse@lsent#1#2\EInLTR#3#4#5\parse@end{\@sentdirfalse +\def\@tempa{\InLTR}\def\@tempb{\EInLTR}\def\@tempc{#1}\def\@tempd{#4}% +\ifx\@tempa\@tempc\ifx\@tempb\@tempd\@sentdirtrue\fi\fi} +\long\def\parse@rsent#1#2\EInRTL#3#4#5\parse@end{\@sentdirfalse +\def\@tempa{\InRTL}\def\@tempb{\EInRTL}\def\@tempc{#1}\def\@tempd{#4}% +\ifx\@tempa\@tempc\ifx\@tempb\@tempd\@sentdirtrue\fi\fi} +\long\def\iflsentence#1{\parse@lsent#1\EInLTR123\parse@end\if@sentdir} +\long\def\ifrsentence#1{\parse@rsent#1\EInRTL123\parse@end\if@sentdir} +\long\def\bidi@footnotetext@dir#1{% + \@tempswatrue + \ifrsentence{#1}\rtl\@tempswafalse\fi + \iflsentence{#1}\ltr\@tempswafalse\fi + \if@tempswa\if@RTL\rtl\else\ltr\fi\fi + \xdef\bidi@this@footnote{\if@RTL\noexpand\right@footnote\else\noexpand\left@footnote\fi}% +} +\def\bidi@footnotetext@after{% + {% + \let\@elt\relax\let\right@footnote\relax\let\left@footnote\relax + \dimen0=\ht\footins + \advance\dimen0 by\dp\footins + \xdef\bidi@footnote@list{\bidi@footnote@list\@elt{\the\dimen0}{\bidi@this@footnote}}% + }% +} +\def\setfootnoteRL{\@RTL@footnotetrue} +\def\unsetfootnoteRL{\@RTL@footnotefalse} +\def\setfootnoteLR{\unsetfootnoteRL} +\long\def\@footnotetext#1{% + \begingroup + \setbox\footins + \vbox{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi\reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \bidi@footnotetext@dir{#1}% + \protected@edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext + {\rule{\z@}{\footnotesep}\ignorespaces#1\strut}}% + \bidi@footnotetext@after + \insert\footins{\unvbox\footins}% + \endgroup} +\long\def\@RTLfootnotetext#1{% + \begingroup + \setbox\footins + \vbox{\@RTLtrue\reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \bidi@footnotetext@dir{#1}% + \protected@edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext + {\rule{\z@}{\footnotesep}\ignorespaces #1\strut}}% + \bidi@footnotetext@after + \insert\footins{\unvbox\footins}% + \endgroup} +\long\def\@LTRfootnotetext#1{% + \begingroup + \setbox\footins + \vbox{\@RTLfalse\reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \bidi@footnotetext@dir{#1}% + \protected@edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext + {\rule{\z@}{\footnotesep}\ignorespaces#1\strut}}% + \bidi@footnotetext@after + \insert\footins{\unvbox\footins}% + \endgroup} +\long\def\@mpRTLfootnotetext#1{% + \global\setbox\@mpfootins\vbox{\@RTLtrue% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \color@begingroup + \bidi@footnotetext@dir{#1} + \ifnum\c@mpfootnote=1\if@RTL\global\let\bidi@footnoterule\right@footnote\else\global\let\bidi@footnoterule\left@footnote\fi\fi + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \color@endgroup}} +\long\def\@mpLTRfootnotetext#1{% + \global\setbox\@mpfootins\vbox{\@RTLfalse% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \color@begingroup + \bidi@footnotetext@dir{#1} + \ifnum\c@mpfootnote=1\if@RTL\global\let\bidi@footnoterule\right@footnote\else\global\let\bidi@footnoterule\left@footnote\fi\fi + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \color@endgroup}} +\long\def\@mpfootnotetext#1{% + \global\setbox\@mpfootins\vbox{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \color@begingroup + \bidi@footnotetext@dir{#1} + \ifnum\c@mpfootnote=1\if@RTL\global\let\bidi@footnoterule\right@footnote\else\global\let\bidi@footnoterule\left@footnote\fi\fi + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \color@endgroup}} +\def\@iiiminipage#1#2[#3]#4{% + \leavevmode + \@pboxswfalse + \setlength\@tempdima{#4}% + \def\@mpargs{{#1}{#2}[#3]{#4}}% + \setbox\@tempboxa\vbox\bgroup + \color@begingroup + \hsize\@tempdima + \textwidth\hsize \columnwidth\hsize + \@parboxrestore + \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@ + \let\@footnotetext\@mpfootnotetext + \let\@LTRfootnotetext\@mpLTRfootnotetext + \let\@RTLfootnotetext\@mpRTLfootnotetext + \let\@listdepth\@mplistdepth \@mplistdepth\z@ + \@minipagerestore + \@setminipage} +\def\LTRthanks#1{\footnotemark + \protected@xdef\@thanks{\@thanks + \protect\LTRfootnotetext[\the\c@footnote]{#1}}% +} +\def\LTRfootnotetext{% + \@ifnextchar [\@xLTRfootnotenext + {\protected@xdef\@thefnmark{\thempfn}% + \@LTRfootnotetext}} +\def\@xLTRfootnotenext[#1]{% + \begingroup + \csname c@\@mpfn\endcsname #1\relax + \unrestored@protected@xdef\@thefnmark{\thempfn}% + \endgroup + \@LTRfootnotetext} +\def\RTLthanks#1{\footnotemark + \protected@xdef\@thanks{\@thanks + \protect\RTLfootnotetext[\the\c@footnote]{#1}}% +} +\let\@thanks\@empty +\def\RTLfootnotetext{% + \@ifnextchar [\@xRTLfootnotenext + {\protected@xdef\@thefnmark{\thempfn}% + \@RTLfootnotetext}} +\def\@xRTLfootnotenext[#1]{% + \begingroup + \csname c@\@mpfn\endcsname #1\relax + \unrestored@protected@xdef\@thefnmark{\thempfn}% + \endgroup + \@RTLfootnotetext} +%% +%% Copyright © 2009-2010 by Vafa Khalighi <vafakh84@gmail.com> +%% +%% Distributable under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) +%% by Vafa Khalighi. +%% +%% +%% +%% +%% +%% End of file `footnote-xetex-bidi.def'. |