%%
%% This is file `extrafootnotefeatures-xetex-bidi.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bidi.dtx  (with options: `table,extrafootnotefeatures-xetex-bidi.def')
%% 
%%   __________________________________________________
%%   Vafa Khalighi
%% 
%%   Copyright (c) 2007--2025  Vafa Khalighi
%%   Copyright (c) 2018--2020 bidi-tex GitHub Organization
%% 
%%   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.
%% 
%% 
%% \CheckSum{54313}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\ProvidesFile{extrafootnotefeatures-xetex-bidi.def}[2025/09/13 v2.8 bidi extra footnote features for XeTeX engine]
\newdimen\bidi@columnwidth
\def\bidi@floathook{%
  \bidi@columnwidth\columnwidth
}
\newcommand*{\@bidi@before@Hy@hyperfootnotes}{%
\if@bidi@csundef{ifHy@hyperfootnotes}{}{%
\if@bidi@csundef{HLTR@@LTRfootnotetext}{}{%
\ifHy@hyperfootnotes
  \let\@@H@@footnotetext\@footnotetext
  \let\@@HLTR@@LTRfootnotetext\@LTRfootnotetext
  \let\@@HRTL@@RTLfootnotetext\@RTLfootnotetext
  \let\@@H@@mpfootnotetext\@mpfootnotetext
  \let\@@HLTR@@mpLTRfootnotetext\@mpLTRfootnotetext
  \let\@@HRTL@@mpRTLfootnotetext\@mpRTLfootnotetext
\fi
}%
}%
}
\newcommand*{\@bidi@after@Hy@hyperfootnotes}{%
\if@bidi@csundef{ifHy@hyperfootnotes}{}{%
\if@bidi@csundef{HLTR@@LTRfootnotetext}{}{%
\ifHy@hyperfootnotes
  \let\H@@footnotetext\@footnotetext
  \let\@footnotetext\@@H@@footnotetext
  \let\HLTR@@LTRfootnotetext\@LTRfootnotetext
  \let\@LTRfootnotetext\@@HLTR@@LTRfootnotetext
  \let\HRTL@@RTLfootnotetext\@RTLfootnotetext
  \let\@RTLfootnotetext\@@HRTL@@RTLfootnotetext
  \let\H@@mpfootnotetext\@mpfootnotetext
  \let\@mpfootnotetext\@@H@@mpfootnotetext
  \let\HLTR@@mpLTRfootnotetext\@mpLTRfootnotetext
  \let\@mpLTRfootnotetext\@@HLTR@@mpLTRfootnotetext
  \let\HRTL@@mpRTLfootnotetext\@mpRTLfootnotetext
  \let\@mpRTLfootnotetext\@@HRTL@@mpRTLfootnotetext
\fi
}%
}%
}
\let\autofootnoterule\relax
\let\rightfootnoterule\relax
\let\leftfootnoterule\relax
\let\textwidthfootnoterule\relax
\let\LRfootnoterule\relax
\def\footnoterule{\kern-3\p@
  \hrule \@width \columnwidth \kern 2.6\p@}
\newcommand{\@preamnormalfmt}{%
  \parindent 1em%
  \noindent
}
\newcommand{\@normalfootfmt}[1]{%
  \@preamnormalfmt
  \footfootmark
  \rule\z@\footnotesep\ignorespaces{\foottextfont #1}%
  \@finalstrut\strutbox
}
\newcommand{\@normalRTLfootfmt}[1]{%
  \@preamnormalfmt
  \RTLfootfootmark
  \rule\z@\footnotesep\ignorespaces{\RTLfoottextfont #1}%
  \@finalstrut\strutbox
}
\newcommand{\@normalLTRfootfmt}[1]{%
  \@preamnormalfmt
  \LTRfootfootmark
  \rule\z@\footnotesep\ignorespaces{\LTRfoottextfont #1}%
  \@finalstrut\strutbox
}
\renewcommand{\@footnotetext}[1]{%
    \insert\footins{%
    \if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi%
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font
    \foottextfont
    \@preamfntext
    \hsize\columnwidth
    \protected@edef\@currentlabel{%
      \csname p@footnote\endcsname\@thefnmark}%
    \color@begingroup
      \@normalfootfmt{#1}%
    \color@endgroup}%
      \m@mmf@prepare}
\renewcommand{\@RTLfootnotetext}[1]{%
    \insert\footins{%
    \@RTLtrue%
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font
    \RTLfoottextfont
    \@preamfntext
    \hsize\columnwidth
    \protected@edef\@currentlabel{%
      \csname p@footnote\endcsname\@thefnmark}%
    \color@begingroup
      \@normalRTLfootfmt{#1}%
    \color@endgroup}%
      \m@mmf@prepare}
\renewcommand{\@LTRfootnotetext}[1]{%
    \insert\footins{%
    \@RTLfalse%
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font
    \LTRfoottextfont
    \@preamfntext
    \hsize\columnwidth
    \protected@edef\@currentlabel{%
      \csname p@footnote\endcsname\@thefnmark}%
    \color@begingroup
      \@normalLTRfootfmt{#1}%
    \color@endgroup}%
      \m@mmf@prepare}
\renewcommand{\@mpfootnotetext}[1]{%
  \global\setbox\@mpfootins\vbox{%
    \unvbox\@mpfootins
    \if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font%
    \foottextfont \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@normalfootfmt{#1}%
  \color@endgroup}}
\renewcommand{\@mpLTRfootnotetext}[1]{%
  \global\setbox\@mpfootins\vbox{%
    \unvbox\@mpfootins
    \@RTLfalse
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font%
    \LTRfoottextfont \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@normalLTRfootfmt{#1}%
  \color@endgroup}}
\renewcommand{\@mpRTLfootnotetext}[1]{%
  \global\setbox\@mpfootins\vbox{%
    \unvbox\@mpfootins
    \@RTLtrue
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font%
    \RTLfoottextfont \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@normalRTLfootfmt{#1}%
  \color@endgroup}}
\let\m@mold@footnotetext\@footnotetext
\let\m@mold@LTRfootnotetext\@LTRfootnotetext
\let\m@mold@RTLfootnotetext\@RTLfootnotetext
\let\m@mold@mpfootnotetext\@mpfootnotetext
\let\m@mold@mpLTRfootnotetext\@mpLTRfootnotetext
\let\m@mold@mpRTLfootnotetext\@mpRTLfootnotetext
\bidi@ensure@newcommand{\normalfootnotes}{%
  \@bidi@before@Hy@hyperfootnotes
  \let\@footnotetext\m@mold@footnotetext
  \let\@LTRfootnotetext\m@mold@LTRfootnotetext
  \let\@RTLfootnotetext\m@mold@RTLfootnotetext
  \let\@mpfootnotetext\m@mold@mpfootnotetext
  \let\@mpLTRfootnotetext\m@mold@mpLTRfootnotetext
  \let\@mpRTLfootnotetext\m@mold@mpRTLfootnotetext
  \@bidi@after@Hy@hyperfootnotes
  \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth
}
\IfClassLoadedT{memoir}{\let\plainfootnotes\normalfootnotes}
\bidi@ensure@newcommand*{\setSingleSpace}[1]{%
  \def\m@m@singlespace{#1}%
  \def\m@m@footnote@spacing{#1}%
  \def\m@m@float@spacing{#1} %
}
\setSingleSpace{1}
\bidi@ensure@newcommand*{\multiplefootnotemarker}{3sp}
\bidi@ensure@newcommand*{\m@mmf@prepare}{%
  \kern-\multiplefootnotemarker
  \kern\multiplefootnotemarker\relax}
\bidi@ensure@newlength{\footmarkwidth}
\bidi@ensure@newcommand*{\footmarkstyle}[1]{\def\footscript##1{#1}}
\bidi@ensure@newcommand*{\LTRfootmarkstyle}[1]{\def\LTRfootscript##1{#1}}
\bidi@ensure@newcommand*{\RTLfootmarkstyle}[1]{\def\RTLfootscript##1{#1}}
\bidi@ensure@newcommand{\footfootmark}{%
  \ifdim\footmarkwidth < \z@
    \llap{\hb@xt@ -\footmarkwidth{%
            \hss\normalfont\footscript{\@thefnmark}}%
          \hspace*{-\footmarkwidth}}%
  \else
    \ifdim\footmarkwidth = \z@
      {\normalfont\footscript{\@thefnmark}}%
    \else
      \hb@xt@\footmarkwidth{\hss\normalfont\footscript{\@thefnmark}}%
    \fi
  \fi}
\bidi@ensure@newcommand{\LTRfootfootmark}{%
  \ifdim\footmarkwidth < \z@
    \llap{\hb@xt@ -\footmarkwidth{%
            \hss\normalfont\LTRfootscript{\@thefnmark}}%
          \hspace*{-\footmarkwidth}}%
  \else
    \ifdim\footmarkwidth = \z@
      {\normalfont\LTRfootscript{\@thefnmark}}%
    \else
      \hb@xt@\footmarkwidth{\hss\normalfont\LTRfootscript{\@thefnmark}}%
    \fi
  \fi}
\bidi@ensure@newcommand{\RTLfootfootmark}{%
  \ifdim\footmarkwidth < \z@
    \llap{\hb@xt@ -\footmarkwidth{%
            \hss\normalfont\RTLfootscript{\@thefnmark}}%
          \hspace*{-\footmarkwidth}}%
  \else
    \ifdim\footmarkwidth = \z@
      {\normalfont\RTLfootscript{\@thefnmark}}%
    \else
      \hb@xt@\footmarkwidth{\hss\normalfont\RTLfootscript{\@thefnmark}}%
    \fi
  \fi}
\footmarkstyle{\textsuperscript{#1}}
\LTRfootmarkstyle{\textsuperscript{#1}}
\RTLfootmarkstyle{\textsuperscript{#1}}
\newcommand*{\bidi@normal@footmarkwidth}{%
  \setlength{\footmarkwidth}{1em plus.3em minus.3em}%
}
\newcommand*{\bidi@star@footmarkwidth}{%
  \setlength{\footmarkwidth}{0em plus.3em minus.3em}%
}
\bidi@normal@footmarkwidth
\bidi@ensure@newcommand{\m@mdoextrafeet}{\extrafeetins}
\bidi@ensure@newcommand*{\extrafeetins}{%
  \bidi@joinfootnotes\footinsv@r\@footstartv@r\@footgroupv@r
  \bidi@joinfootnotes\footinsv@l\@footstartv@l\@LTRfootgroupv@l
  \bidi@joinfootnotes\@bidi@copyins@{}{\unvbox\@bidi@copyins@}%
    \extrafeetinshook}
\bidi@ensure@newcommand{\extrafeetinshook}{}
\bidi@ensure@newcommand{\foottextfont}{\footnotesize}
\bidi@ensure@newcommand{\LTRfoottextfont}{\footnotesize}
\bidi@ensure@newcommand{\RTLfoottextfont}{\footnotesize}
\bidi@ensure@newlength{\footinsdim}
  \setlength{\footinsdim}{8in}   % standard for \dimen\footins
\bidi@ensure@newcommand{\@preamfntext}{%
  \interlinepenalty\interfootnotelinepenalty
  \floatingpenalty \@MM
  \splittopskip=\footnotesep
  \splitmaxdepth=\dp\strutbox
  \@parboxrestore}
\def\bidi@ifmulticol#1#2{\@tempswafalse
  \ifnum\col@number>\@ne
    \ifnum\count\footins>1999 \@tempswatrue \fi
  \fi
  \if@tempswa #1\else #2\fi
}
\def\bidi@joinfootnotes#1#2#3{%
  \ifvoid#1
  \else
    \@tempskipa\skip#1%
    \bidi@ifmulticol{\divide\@tempskipa\col@number}{}%
    \edef\bidi@footskip{\vskip\the\@tempskipa\relax}%
    \bidi@removexfootskip
    \ifvoid\footins
      \global\setbox\footins\vbox{#2#3}%
    \else
      \global\setbox\footins\vbox{%
         \unvbox\footins
         \bidi@footskip
         #2#3%
       }%
    \fi
  \fi
}
\def\bidi@joinmpfootnotes#1#2#3{%
  \ifvoid#1
  \else
    \@tempskipa\skip#1%
    \bidi@ifmulticol{\divide\@tempskipa\col@number}{}%
    \edef\bidi@footskip{\vskip\the\@tempskipa\relax}%
    \bidi@removexfootskip
    \ifvoid\@mpfootins
      \global\setbox\@mpfootins\vbox{#2#3}%
    \else
      \global\setbox\@mpfootins\vbox{%
         \unvbox\@mpfootins
         \bidi@footskip
         #2#3%
       }%
    \fi
  \fi
}
\bidi@ensure@newcommand{\m@mdoextrafeetmini}{%
  \extrafeetminihook}
\bidi@ensure@newcommand{\extrafeetendmini}{%
\bidi@joinmpfootnotes\@mpfootinsv@r\@footstartv@r\mp@footgroupv@r
  \bidi@joinmpfootnotes\@mpfootinsv@l\@footstartv@l\mp@LTRfootgroupv@l
  \extrafeetendminihook}
\bidi@ensure@newcommand{\extrafeetendminihook}{}
\bidi@ensure@newcommand{\m@mdoextrafeetendmini}{\extrafeetendmini}
\def\endminipage{%
  \par
  \unskip
  \m@mdoextrafeetendmini
  \ifvoid\@mpfootins
  \else
    \vskip\skip\@mpfootins
    \normalcolor
    \footnoterule
    \unvbox\@mpfootins
  \fi
  \@minipagefalse
  \color@endgroup
  \egroup
  \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}}
\bidi@ensure@newcommand{\m@make@footstart}[1]{%
  \@namedef{@footstart#1}{%
    \leftskip=\z@
    \rightskip=\z@
    \parindent=\z@
  }%
}
\newinsert\footinsv@r
\skip\footinsv@r\skip\footins
\count\footinsv@r=1000 % no magnifcation
\dimen\footinsv@r=\footinsdim
\m@make@footstart{v@r}
\newinsert\footinsv@l
\skip\footinsv@l\skip\footins
\count\footinsv@l=1000 % no magnifcation
\dimen\footinsv@l=\footinsdim
\m@make@footstart{v@l}
\bidi@ensure@newcommand{\@footgroupv@r}{}
\newinsert\@mpfootinsv@r
\skip\@mpfootinsv@r\skip\@mpfootins
\newinsert\@mpfootinsv@l
\skip\@mpfootinsv@l\skip\@mpfootins
\bidi@ensure@newcommand{\mp@footgroupv@r}{}
\newcount\m@m@k \newdimen\m@m@h
\bidi@ensure@newcommand*{\m@mrigidbalance}[3]{\setbox0=\box#1 \m@m@k=#2 \m@m@h=#3
  \@@line{\beginR\splittopskip=\m@m@h \vbadness=\@M \hfilneg
  \valign{##\vfill\cr\m@mdosplits}\endR}}
\newcommand*{\bidi@LTRrigidbalance}[3]{\setbox0=\box#1 \m@m@k=#2 \m@m@h=#3
  \@@line{\beginL\splittopskip=\m@m@h \vbadness=\@M \hfilneg
  \valign{##\vfill\cr\m@mdosplits}\endL}}
\bidi@ensure@newcommand*{\m@mdosplits}{\ifnum\m@m@k>0 \noalign{\hfil}\m@msplitoff
  \global\advance\m@m@k-1\cr\m@mdosplits\fi}
\bidi@ensure@newcommand*{\m@msplitoff}{\dimen0=\ht0
  \divide\dimen0 by\m@m@k \advance\dimen0 by\m@m@h
  \setbox2 \vsplit0 to \dimen0
  \unvbox2 }
\bidi@ensure@newcommand{\twocolumnfootnotes}{%
  \@namedef{foottextfontv@r}{\foottextfont}%  % [RS]
  \@namedef{foottextfontv@l}{\LTRfoottextfont}%
  \@bidi@before@Hy@hyperfootnotes
  \let\@footnotetext\@twocolfootnotetext
  \let\@LTRfootnotetext\@twocolLTRfootnotetext
  \let\@RTLfootnotetext\@twocolRTLfootnotetext
  \dimen\footinsv@r=2\footinsdim
  \count\footinsv@r=500\relax
  \m@make@twocol@footgroup{v@r}%
  \let\@footgroupv@r\@twocol@footgroupv@r
  \dimen\footinsv@l=2\footinsdim
  \count\footinsv@l=500\relax
  \bidi@make@twocol@LTRfootgroup{v@l}%
  \let\@LTRfootgroupv@l\@twocol@LTRfootgroupv@l
  \let\@mpfootnotetext\@mptwocolfootnotetext
  \let\@mpLTRfootnotetext\@mptwocolLTRfootnotetext
  \let\@mpRTLfootnotetext\@mptwocolRTLfootnotetext
  \@bidi@after@Hy@hyperfootnotes
  \m@make@mptwocol@footgroup{v@r}%
  \let\mp@footgroupv@r\@mptwocol@footgroupv@r
  \bidi@make@mptwocol@LTRfootgroup{v@l}%
  \let\mp@LTRfootgroupv@l\@mptwocol@LTRfootgroupv@l
  \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth
}
\bidi@ensure@newcommand{\@twocolfootnotetext}[1]{\insert
  \if@RTL@footnote
    \footinsv@r
  \else
    \footinsv@l
  \fi
{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\foottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@twocolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@twocolLTRfootnotetext}[1]{\insert\footinsv@l{\@RTLfalse%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\LTRfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@twocolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@twocolRTLfootnotetext}[1]{\insert\footinsv@r{\@RTLtrue%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\RTLfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@twocolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@preamtwofmt}{%
  \hsize .45\hsize
  \parindent=\z@
  \tolerance=5000\relax
  \leavevmode}
\bidi@ensure@newcommand{\@twocolfootfmt}[1]{%
  \@preamtwofmt
  {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@twocolLTRfootfmt}[1]{%
  \@preamtwofmt
  {\LTRfootfootmark\strut {\LTRfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@twocolRTLfootfmt}[1]{%
  \@preamtwofmt
  {\RTLfootfootmark\strut {\RTLfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@mptwocolfootnotetext}[1]{%
  \global\setbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
  \vbox{%
    \unvbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
    \if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\foottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@twocolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mptwocolLTRfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@l\vbox{%
    \unvbox\@mpfootinsv@l
    \@RTLfalse
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\LTRfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@twocolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mptwocolRTLfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@r\vbox{%
    \unvbox\@mpfootinsv@r
    \@RTLtrue
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\RTLfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@twocolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\m@make@twocol@footgroup}[1]{%
  \@namedef{@twocol@footgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \m@mrigidbalance{\@nameuse{footins#1}}{\tw@}{\splittopskip}}}}
\newcommand{\bidi@make@twocol@LTRfootgroup}[1]{%
  \@namedef{@twocol@LTRfootgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \bidi@LTRrigidbalance{\@nameuse{footins#1}}{\tw@}{\splittopskip}}}}
\bidi@ensure@newcommand{\m@make@mptwocol@footgroup}[1]{%
\@namedef{@mptwocol@footgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \m@mrigidbalance{\@nameuse{@mpfootins#1}}{\tw@}{\splittopskip}}}}
\newcommand{\bidi@make@mptwocol@LTRfootgroup}[1]{%
\@namedef{@mptwocol@LTRfootgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \bidi@LTRrigidbalance{\@nameuse{@mpfootins#1}}{\tw@}{\splittopskip}}}}
\bidi@ensure@newcommand{\threecolumnfootnotes}{%
  \@namedef{foottextfontv@r}{\foottextfont}%  % [RS]
  \@namedef{foottextfontv@l}{\LTRfoottextfont}%
  \@bidi@before@Hy@hyperfootnotes
  \let\@footnotetext\@threecolfootnotetext
  \let\@LTRfootnotetext\@threecolLTRfootnotetext
  \let\@RTLfootnotetext\@threecolRTLfootnotetext
  \dimen\footinsv@r=3\footinsdim
  \count\footinsv@r=333\relax
  \m@make@threecol@footgroup{v@r}%
  \let\@footgroupv@r\@threecol@footgroupv@r
  \dimen\footinsv@l=3\footinsdim
  \count\footinsv@l=333\relax
  \bidi@make@threecol@LTRfootgroup{v@l}%
  \let\@LTRfootgroupv@l\@threecol@LTRfootgroupv@l
  \let\@mpfootnotetext\@mpthreecolfootnotetext
  \let\@mpLTRfootnotetext\@mpthreecolLTRfootnotetext
  \let\@mpRTLfootnotetext\@mpthreecolRTLfootnotetext
  \@bidi@after@Hy@hyperfootnotes
  \m@make@mpthreecol@footgroup{v@r}%
  \let\mp@footgroupv@r\@mpthreecol@footgroupv@r
  \bidi@make@mpthreecol@LTRfootgroup{v@l}%
  \let\mp@LTRfootgroupv@l\@mpthreecol@LTRfootgroupv@l
  \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth
}
\bidi@ensure@newcommand{\@threecolfootnotetext}[1]{\insert
  \if@RTL@footnote
    \footinsv@r
  \else
    \footinsv@l
  \fi
{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\foottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@threecolfootfmt{#1}%
  \color@endgroup}\m@mmf@prepare}
\bidi@ensure@newcommand{\@threecolLTRfootnotetext}[1]{\insert\footinsv@l{\@RTLfalse%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\LTRfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@threecolLTRfootfmt{#1}%
  \color@endgroup}\m@mmf@prepare}
\bidi@ensure@newcommand{\@threecolRTLfootnotetext}[1]{\insert\footinsv@r{\@RTLtrue%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\RTLfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@threecolRTLfootfmt{#1}%
  \color@endgroup}\m@mmf@prepare}
\bidi@ensure@newcommand{\@preamthreefmt}{%
  \hsize .3\hsize
  \parindent=\z@
  \tolerance=5000\relax
  \leavevmode}
\bidi@ensure@newcommand{\@threecolfootfmt}[1]{%
  \@preamthreefmt
  {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@threecolLTRfootfmt}[1]{%
  \@preamthreefmt
  {\LTRfootfootmark\strut {\LTRfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@threecolRTLfootfmt}[1]{%
  \@preamthreefmt
  {\RTLfootfootmark\strut {\RTLfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@mpthreecolfootnotetext}[1]{%
  \global\setbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
  \vbox{%
    \unvbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
    \if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\foottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@threecolfootfmt{#1}%
  \color@endgroup}\m@mmf@prepare}
\bidi@ensure@newcommand{\@mpthreecolLTRfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@l\vbox{%
    \unvbox\@mpfootinsv@l
    \@RTLfalse
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\LTRfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@threecolLTRfootfmt{#1}%
  \color@endgroup}\m@mmf@prepare}
\bidi@ensure@newcommand{\@mpthreecolRTLfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@r\vbox{%
    \unvbox\@mpfootinsv@r
    \@RTLtrue
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\RTLfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@threecolRTLfootfmt{#1}%
  \color@endgroup}\m@mmf@prepare}
\bidi@ensure@newcommand{\m@make@threecol@footgroup}[1]{%
\@namedef{@threecol@footgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
 \hsize\bidi@columnwidth
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \m@mrigidbalance{\@nameuse{footins#1}}{\thr@@}{\splittopskip}}}}
\newcommand{\bidi@make@threecol@LTRfootgroup}[1]{%
\@namedef{@threecol@LTRfootgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
 \hsize\bidi@columnwidth
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \bidi@LTRrigidbalance{\@nameuse{footins#1}}{\thr@@}{\splittopskip}}}}
\bidi@ensure@newcommand{\m@make@mpthreecol@footgroup}[1]{%
\@namedef{@mpthreecol@footgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \m@mrigidbalance{\@nameuse{@mpfootins#1}}{\thr@@}{\splittopskip}}}}
\newcommand{\bidi@make@mpthreecol@LTRfootgroup}[1]{%
\@namedef{@mpthreecol@LTRfootgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \bidi@LTRrigidbalance{\@nameuse{@mpfootins#1}}{\thr@@}{\splittopskip}}}}
\bidi@ensure@newcommand{\fourcolumnfootnotes}{%
  \@namedef{foottextfontv@r}{\foottextfont}%  % [RS]
  \@namedef{foottextfontv@l}{\LTRfoottextfont}%
  \@bidi@before@Hy@hyperfootnotes
  \let\@footnotetext\@fourcolfootnotetext
  \let\@LTRfootnotetext\@fourcolLTRfootnotetext
  \let\@RTLfootnotetext\@fourcolRTLfootnotetext
  \dimen\footinsv@r=4\footinsdim
  \count\footinsv@r=250\relax
  \m@make@fourcol@footgroup{v@r}%
  \let\@footgroupv@r\@fourcol@footgroupv@r
  \dimen\footinsv@l=4\footinsdim
  \count\footinsv@l=250\relax
  \bidi@make@fourcol@LTRfootgroup{v@l}%
  \let\@LTRfootgroupv@l\@fourcol@LTRfootgroupv@l
  \let\@mpfootnotetext\@mpfourcolfootnotetext
  \let\@mpLTRfootnotetext\@mpfourcolLTRfootnotetext
  \let\@mpRTLfootnotetext\@mpfourcolRTLfootnotetext
  \@bidi@after@Hy@hyperfootnotes
  \m@make@mpfourcol@footgroup{v@r}%
  \let\mp@footgroupv@r\@mpfourcol@footgroupv@r
  \bidi@make@mpfourcol@LTRfootgroup{v@l}%
  \let\mp@LTRfootgroupv@l\@mpfourcol@LTRfootgroupv@l
  \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth
}
\bidi@ensure@newcommand{\@fourcolfootnotetext}[1]{\insert
  \if@RTL@footnote
    \footinsv@r
  \else
    \footinsv@l
  \fi
{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\foottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@fourcolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@fourcolLTRfootnotetext}[1]{\insert\footinsv@l{\@RTLfalse%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\LTRfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@fourcolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@fourcolRTLfootnotetext}[1]{\insert\footinsv@r{\@RTLtrue%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\RTLfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@fourcolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@preamfourfmt}{%
  \hsize .25\hsize
  \parindent=\z@
  \tolerance=5000\relax
  \leavevmode}
\bidi@ensure@newcommand{\@fourcolfootfmt}[1]{%
  \@preamfourfmt
  {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@fourcolLTRfootfmt}[1]{%
  \@preamfourfmt
  {\LTRfootfootmark\strut {\LTRfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@fourcolRTLfootfmt}[1]{%
  \@preamfourfmt
  {\RTLfootfootmark\strut {\RTLfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@mpfourcolfootnotetext}[1]{%
  \global\setbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
  \vbox{%
    \unvbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
    \if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\foottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@fourcolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mpfourcolLTRfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@l\vbox{%
    \unvbox\@mpfootinsv@l
    \@RTLfalse
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\LTRfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@fourcolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mpfourcolRTLfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@r\vbox{%
    \unvbox\@mpfootinsv@r
    \@RTLtrue
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\RTLfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@fourcolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\m@make@fourcol@footgroup}[1]{%
  \@namedef{@fourcol@footgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \m@mrigidbalance{\@nameuse{footins#1}}{4}{\splittopskip}}}}
\newcommand{\bidi@make@fourcol@LTRfootgroup}[1]{%
  \@namedef{@fourcol@LTRfootgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \bidi@LTRrigidbalance{\@nameuse{footins#1}}{4}{\splittopskip}}}}
\bidi@ensure@newcommand{\m@make@mpfourcol@footgroup}[1]{%
\@namedef{@mpfourcol@footgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \m@mrigidbalance{\@nameuse{@mpfootins#1}}{4}{\splittopskip}}}}
\newcommand{\bidi@make@mpfourcol@LTRfootgroup}[1]{%
\@namedef{@mpfourcol@LTRfootgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \bidi@LTRrigidbalance{\@nameuse{@mpfootins#1}}{4}{\splittopskip}}}}
\bidi@ensure@newcommand{\fivecolumnfootnotes}{%
  \@namedef{foottextfontv@r}{\foottextfont}%  % [RS]
  \@namedef{foottextfontv@l}{\LTRfoottextfont}%
  \@bidi@before@Hy@hyperfootnotes
  \let\@footnotetext\@fivecolfootnotetext
  \let\@LTRfootnotetext\@fivecolLTRfootnotetext
  \let\@RTLfootnotetext\@fivecolRTLfootnotetext
  \dimen\footinsv@r=5\footinsdim
  \count\footinsv@r=200\relax
  \m@make@fivecol@footgroup{v@r}%
  \let\@footgroupv@r\@fivecol@footgroupv@r
  \dimen\footinsv@l=5\footinsdim
  \count\footinsv@l=200\relax
  \bidi@make@fivecol@LTRfootgroup{v@l}%
  \let\@LTRfootgroupv@l\@fivecol@LTRfootgroupv@l
  \let\@mpfootnotetext\@mpfivecolfootnotetext
  \let\@mpLTRfootnotetext\@mpfivecolLTRfootnotetext
  \let\@mpRTLfootnotetext\@mpfivecolRTLfootnotetext
  \@bidi@after@Hy@hyperfootnotes
  \m@make@mpfivecol@footgroup{v@r}%
  \let\mp@footgroupv@r\@mpfivecol@footgroupv@r
  \bidi@make@mpfivecol@LTRfootgroup{v@l}%
  \let\mp@LTRfootgroupv@l\@mpfivecol@LTRfootgroupv@l
  \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth
}
\bidi@ensure@newcommand{\@fivecolfootnotetext}[1]{\insert
  \if@RTL@footnote
    \footinsv@r
  \else
    \footinsv@l
  \fi
{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\foottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@fivecolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@fivecolLTRfootnotetext}[1]{\insert\footinsv@l{\@RTLfalse%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\LTRfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@fivecolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@fivecolRTLfootnotetext}[1]{\insert\footinsv@r{\@RTLtrue%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\RTLfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@fivecolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@preamfivefmt}{%
  \hsize .2\hsize
  \parindent=\z@
  \tolerance=5000\relax
  \leavevmode}
\bidi@ensure@newcommand{\@fivecolfootfmt}[1]{%
  \@preamfivefmt
  {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@fivecolLTRfootfmt}[1]{%
  \@preamfivefmt
  {\LTRfootfootmark\strut {\LTRfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@fivecolRTLfootfmt}[1]{%
  \@preamfivefmt
  {\RTLfootfootmark\strut {\RTLfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@mpfivecolfootnotetext}[1]{%
  \global\setbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
  \vbox{%
    \unvbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
    \if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\foottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@fivecolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mpfivecolLTRfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@l\vbox{%
    \unvbox\@mpfootinsv@l
    \@RTLfalse
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\LTRfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@fivecolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mpfivecolRTLfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@r\vbox{%
    \unvbox\@mpfootinsv@r
    \@RTLtrue
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\RTLfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@fivecolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\m@make@fivecol@footgroup}[1]{%
  \@namedef{@fivecol@footgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \m@mrigidbalance{\@nameuse{footins#1}}{5}{\splittopskip}}}}
\newcommand{\bidi@make@fivecol@LTRfootgroup}[1]{%
  \@namedef{@fivecol@LTRfootgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \bidi@LTRrigidbalance{\@nameuse{footins#1}}{5}{\splittopskip}}}}
\bidi@ensure@newcommand{\m@make@mpfivecol@footgroup}[1]{%
\@namedef{@mpfivecol@footgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \m@mrigidbalance{\@nameuse{@mpfootins#1}}{5}{\splittopskip}}}}
\newcommand{\bidi@make@mpfivecol@LTRfootgroup}[1]{%
\@namedef{@mpfivecol@LTRfootgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \bidi@LTRrigidbalance{\@nameuse{@mpfootins#1}}{5}{\splittopskip}}}}
\bidi@ensure@newcommand{\sixcolumnfootnotes}{%
  \@namedef{foottextfontv@r}{\foottextfont}%  % [RS]
  \@namedef{foottextfontv@l}{\LTRfoottextfont}%
  \@bidi@before@Hy@hyperfootnotes
  \let\@footnotetext\@sixcolfootnotetext
  \let\@LTRfootnotetext\@sixcolLTRfootnotetext
  \let\@RTLfootnotetext\@sixcolRTLfootnotetext
  \dimen\footinsv@r=6\footinsdim
  \count\footinsv@r=166\relax
  \m@make@sixcol@footgroup{v@r}%
  \let\@footgroupv@r\@sixcol@footgroupv@r
  \dimen\footinsv@l=6\footinsdim
  \count\footinsv@l=166\relax
  \bidi@make@sixcol@LTRfootgroup{v@l}%
  \let\@LTRfootgroupv@l\@sixcol@LTRfootgroupv@l
  \let\@mpfootnotetext\@mpsixcolfootnotetext
  \let\@mpLTRfootnotetext\@mpsixcolLTRfootnotetext
  \let\@mpRTLfootnotetext\@mpsixcolRTLfootnotetext
  \@bidi@after@Hy@hyperfootnotes
  \m@make@mpsixcol@footgroup{v@r}%
  \let\mp@footgroupv@r\@mpsixcol@footgroupv@r
  \bidi@make@mpsixcol@LTRfootgroup{v@l}%
  \let\mp@LTRfootgroupv@l\@mpsixcol@LTRfootgroupv@l
  \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth
}
\bidi@ensure@newcommand{\@sixcolfootnotetext}[1]{\insert
  \if@RTL@footnote
    \footinsv@r
  \else
    \footinsv@l
  \fi
{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\foottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@sixcolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@sixcolLTRfootnotetext}[1]{\insert\footinsv@l{\@RTLfalse%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\LTRfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@sixcolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@sixcolRTLfootnotetext}[1]{\insert\footinsv@r{\@RTLtrue%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\RTLfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@sixcolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@preamsixfmt}{%
  \hsize .16\hsize
  \parindent=\z@
  \tolerance=5000\relax
  \leavevmode}
\bidi@ensure@newcommand{\@sixcolfootfmt}[1]{%
  \@preamsixfmt
  {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@sixcolLTRfootfmt}[1]{%
  \@preamsixfmt
  {\LTRfootfootmark\strut {\LTRfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@sixcolRTLfootfmt}[1]{%
  \@preamsixfmt
  {\RTLfootfootmark\strut {\RTLfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@mpsixcolfootnotetext}[1]{%
  \global\setbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
  \vbox{%
    \unvbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
    \if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\foottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@sixcolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mpsixcolLTRfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@l\vbox{%
    \unvbox\@mpfootinsv@l
    \@RTLfalse
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\LTRfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@sixcolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mpsixcolRTLfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@r\vbox{%
    \unvbox\@mpfootinsv@r
    \@RTLtrue
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\RTLfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@sixcolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\m@make@sixcol@footgroup}[1]{%
  \@namedef{@sixcol@footgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \m@mrigidbalance{\@nameuse{footins#1}}{6}{\splittopskip}}}}
\newcommand{\bidi@make@sixcol@LTRfootgroup}[1]{%
  \@namedef{@sixcol@LTRfootgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \bidi@LTRrigidbalance{\@nameuse{footins#1}}{6}{\splittopskip}}}}
\bidi@ensure@newcommand{\m@make@mpsixcol@footgroup}[1]{%
\@namedef{@mpsixcol@footgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \m@mrigidbalance{\@nameuse{@mpfootins#1}}{6}{\splittopskip}}}}
\newcommand{\bidi@make@mpsixcol@LTRfootgroup}[1]{%
\@namedef{@mpsixcol@LTRfootgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \bidi@LTRrigidbalance{\@nameuse{@mpfootins#1}}{6}{\splittopskip}}}}
\bidi@ensure@newcommand{\sevencolumnfootnotes}{%
  \@namedef{foottextfontv@r}{\foottextfont}%  % [RS]
  \@namedef{foottextfontv@l}{\LTRfoottextfont}%
  \@bidi@before@Hy@hyperfootnotes
  \let\@footnotetext\@sevencolfootnotetext
  \let\@LTRfootnotetext\@sevencolLTRfootnotetext
  \let\@RTLfootnotetext\@sevencolRTLfootnotetext
  \dimen\footinsv@r=7\footinsdim
  \count\footinsv@r=142\relax
  \m@make@sevencol@footgroup{v@r}%
  \let\@footgroupv@r\@sevencol@footgroupv@r
  \dimen\footinsv@l=7\footinsdim
  \count\footinsv@l=142\relax
  \bidi@make@sevencol@LTRfootgroup{v@l}%
  \let\@LTRfootgroupv@l\@sevencol@LTRfootgroupv@l
  \let\@mpfootnotetext\@mpsevencolfootnotetext
  \let\@mpLTRfootnotetext\@mpsevencolLTRfootnotetext
  \let\@mpRTLfootnotetext\@mpsevencolRTLfootnotetext
  \@bidi@after@Hy@hyperfootnotes
  \m@make@mpsevencol@footgroup{v@r}%
  \let\mp@footgroupv@r\@mpsevencol@footgroupv@r
  \bidi@make@mpsevencol@LTRfootgroup{v@l}%
  \let\mp@LTRfootgroupv@l\@mpsevencol@LTRfootgroupv@l
  \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth
}
\bidi@ensure@newcommand{\@sevencolfootnotetext}[1]{\insert
  \if@RTL@footnote
    \footinsv@r
  \else
    \footinsv@l
  \fi
{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\foottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@sevencolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@sevencolLTRfootnotetext}[1]{\insert\footinsv@l{\@RTLfalse%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\LTRfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@sevencolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@sevencolRTLfootnotetext}[1]{\insert\footinsv@r{\@RTLtrue%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\RTLfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@sevencolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@preamsevenfmt}{%
  \hsize .142\hsize
  \parindent=\z@
  \tolerance=5000\relax
  \leavevmode}
\bidi@ensure@newcommand{\@sevencolfootfmt}[1]{%
  \@preamsevenfmt
  {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@sevencolLTRfootfmt}[1]{%
  \@preamsevenfmt
  {\LTRfootfootmark\strut {\LTRfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@sevencolRTLfootfmt}[1]{%
  \@preamsevenfmt
  {\RTLfootfootmark\strut {\RTLfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@mpsevencolfootnotetext}[1]{%
  \global\setbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
  \vbox{%
    \unvbox
     \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
    \if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\foottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@sevencolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mpsevencolLTRfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@l\vbox{%
    \unvbox\@mpfootinsv@l
    \@RTLfalse
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\LTRfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@sevencolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mpsevencolRTLfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@r\vbox{%
    \unvbox\@mpfootinsv@r
    \@RTLtrue
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\RTLfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@sevencolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\m@make@sevencol@footgroup}[1]{%
  \@namedef{@sevencol@footgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \m@mrigidbalance{\@nameuse{footins#1}}{7}{\splittopskip}}}}
\newcommand{\bidi@make@sevencol@LTRfootgroup}[1]{%
  \@namedef{@sevencol@LTRfootgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \bidi@LTRrigidbalance{\@nameuse{footins#1}}{7}{\splittopskip}}}}
\bidi@ensure@newcommand{\m@make@mpsevencol@footgroup}[1]{%
\@namedef{@mpsevencol@footgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \m@mrigidbalance{\@nameuse{@mpfootins#1}}{7}{\splittopskip}}}}
\newcommand{\bidi@make@mpsevencol@LTRfootgroup}[1]{%
\@namedef{@mpsevencol@LTRfootgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \bidi@LTRrigidbalance{\@nameuse{@mpfootins#1}}{7}{\splittopskip}}}}
\bidi@ensure@newcommand{\eightcolumnfootnotes}{%
  \@namedef{foottextfontv@r}{\foottextfont}%  % [RS]
  \@namedef{foottextfontv@l}{\LTRfoottextfont}%
  \@bidi@before@Hy@hyperfootnotes
  \let\@footnotetext\@eightcolfootnotetext
  \let\@LTRfootnotetext\@eightcolLTRfootnotetext
  \let\@RTLfootnotetext\@eightcolRTLfootnotetext
  \dimen\footinsv@r=8\footinsdim
  \count\footinsv@r=125\relax
  \m@make@eightcol@footgroup{v@r}%
  \let\@footgroupv@r\@eightcol@footgroupv@r
  \dimen\footinsv@l=8\footinsdim
  \count\footinsv@l=125\relax
  \bidi@make@eightcol@LTRfootgroup{v@l}%
  \let\@LTRfootgroupv@l\@eightcol@LTRfootgroupv@l
  \let\@mpfootnotetext\@mpeightcolfootnotetext
  \let\@mpLTRfootnotetext\@mpeightcolLTRfootnotetext
  \let\@mpRTLfootnotetext\@mpeightcolRTLfootnotetext
  \@bidi@after@Hy@hyperfootnotes
  \m@make@mpeightcol@footgroup{v@r}%
  \let\mp@footgroupv@r\@mpeightcol@footgroupv@r
  \bidi@make@mpeightcol@LTRfootgroup{v@l}%
  \let\mp@LTRfootgroupv@l\@mpeightcol@LTRfootgroupv@l
  \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth
}
\bidi@ensure@newcommand{\@eightcolfootnotetext}[1]{\insert
  \if@RTL@footnote
    \footinsv@r
  \else
    \footinsv@l
  \fi
{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\foottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@eightcolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@eightcolLTRfootnotetext}[1]{\insert\footinsv@l{\@RTLfalse%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\LTRfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@eightcolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@eightcolRTLfootnotetext}[1]{\insert\footinsv@r{\@RTLtrue%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\RTLfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@eightcolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@preameightfmt}{%
  \hsize .125\hsize
  \parindent=\z@
  \tolerance=5000\relax
  \leavevmode}
\bidi@ensure@newcommand{\@eightcolfootfmt}[1]{%
  \@preameightfmt
  {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@eightcolLTRfootfmt}[1]{%
  \@preameightfmt
  {\LTRfootfootmark\strut {\LTRfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@eightcolRTLfootfmt}[1]{%
  \@preameightfmt
  {\RTLfootfootmark\strut {\RTLfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@mpeightcolfootnotetext}[1]{%
  \global\setbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
  \vbox{%
    \unvbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
    \if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\foottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@eightcolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mpeightcolLTRfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@l\vbox{%
    \unvbox\@mpfootinsv@l
    \@RTLfalse
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\LTRfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@eightcolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mpeightcolRTLfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@r\vbox{%
    \unvbox\@mpfootinsv@r
    \@RTLtrue
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\RTLfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@eightcolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\m@make@eightcol@footgroup}[1]{%
  \@namedef{@eightcol@footgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \m@mrigidbalance{\@nameuse{footins#1}}{8}{\splittopskip}}}}
\newcommand{\bidi@make@eightcol@LTRfootgroup}[1]{%
  \@namedef{@eightcol@LTRfootgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \bidi@LTRrigidbalance{\@nameuse{footins#1}}{8}{\splittopskip}}}}
\bidi@ensure@newcommand{\m@make@mpeightcol@footgroup}[1]{%
\@namedef{@mpeightcol@footgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \m@mrigidbalance{\@nameuse{@mpfootins#1}}{8}{\splittopskip}}}}
\newcommand{\bidi@make@mpeightcol@LTRfootgroup}[1]{%
\@namedef{@mpeightcol@LTRfootgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \bidi@LTRrigidbalance{\@nameuse{@mpfootins#1}}{8}{\splittopskip}}}}
\bidi@ensure@newcommand{\ninecolumnfootnotes}{%
  \@namedef{foottextfontv@r}{\foottextfont}%  % [RS]
  \@namedef{foottextfontv@l}{\LTRfoottextfont}%
  \@bidi@before@Hy@hyperfootnotes
  \let\@footnotetext\@ninecolfootnotetext
  \let\@LTRfootnotetext\@ninecolLTRfootnotetext
  \let\@RTLfootnotetext\@ninecolRTLfootnotetext
  \dimen\footinsv@r=9\footinsdim
  \count\footinsv@r=111\relax
  \m@make@ninecol@footgroup{v@r}%
  \let\@footgroupv@r\@ninecol@footgroupv@r
  \dimen\footinsv@l=9\footinsdim
  \count\footinsv@l=111\relax
  \bidi@make@ninecol@LTRfootgroup{v@l}%
  \let\@LTRfootgroupv@l\@ninecol@LTRfootgroupv@l
  \let\@mpfootnotetext\@mpninecolfootnotetext
  \let\@mpLTRfootnotetext\@mpninecolLTRfootnotetext
  \let\@mpRTLfootnotetext\@mpninecolRTLfootnotetext
  \@bidi@after@Hy@hyperfootnotes
  \m@make@mpninecol@footgroup{v@r}%
  \let\mp@footgroupv@r\@mpninecol@footgroupv@r
  \bidi@make@mpninecol@LTRfootgroup{v@l}%
  \let\mp@LTRfootgroupv@l\@mpninecol@LTRfootgroupv@l
  \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth
}
\bidi@ensure@newcommand{\@ninecolfootnotetext}[1]{\insert
  \if@RTL@footnote
    \footinsv@r
  \else
    \footinsv@l
  \fi
{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\foottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@ninecolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@ninecolLTRfootnotetext}[1]{\insert\footinsv@l{\@RTLfalse%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\LTRfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@ninecolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@ninecolRTLfootnotetext}[1]{\insert\footinsv@r{\@RTLtrue%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\RTLfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@ninecolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@preamninefmt}{%
  \hsize .1\hsize
  \parindent=\z@
  \tolerance=5000\relax
  \leavevmode}
\bidi@ensure@newcommand{\@ninecolfootfmt}[1]{%
  \@preamninefmt
  {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@ninecolLTRfootfmt}[1]{%
  \@preamninefmt
  {\LTRfootfootmark\strut {\LTRfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@ninecolRTLfootfmt}[1]{%
  \@preamninefmt
  {\RTLfootfootmark\strut {\RTLfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@mpninecolfootnotetext}[1]{%
  \global\setbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
  \vbox{%
    \unvbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
    \if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\foottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@ninecolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mpninecolLTRfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@l\vbox{%
    \unvbox\@mpfootinsv@l
    \@RTLfalse
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\LTRfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@ninecolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mpninecolRTLfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@r\vbox{%
    \unvbox\@mpfootinsv@r
    \@RTLtrue
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\RTLfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@ninecolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\m@make@ninecol@footgroup}[1]{%
  \@namedef{@ninecol@footgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \m@mrigidbalance{\@nameuse{footins#1}}{9}{\splittopskip}}}}
\newcommand{\bidi@make@ninecol@LTRfootgroup}[1]{%
  \@namedef{@ninecol@LTRfootgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \bidi@LTRrigidbalance{\@nameuse{footins#1}}{9}{\splittopskip}}}}
\bidi@ensure@newcommand{\m@make@mpninecol@footgroup}[1]{%
\@namedef{@mpninecol@footgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \m@mrigidbalance{\@nameuse{@mpfootins#1}}{9}{\splittopskip}}}}
\newcommand{\bidi@make@mpninecol@LTRfootgroup}[1]{%
\@namedef{@mpninecol@LTRfootgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \bidi@LTRrigidbalance{\@nameuse{@mpfootins#1}}{9}{\splittopskip}}}}
\bidi@ensure@newcommand{\tencolumnfootnotes}{%
  \@namedef{foottextfontv@r}{\foottextfont}%  % [RS]
  \@namedef{foottextfontv@l}{\LTRfoottextfont}%
  \@bidi@before@Hy@hyperfootnotes
  \let\@footnotetext\@tencolfootnotetext
  \let\@LTRfootnotetext\@tencolLTRfootnotetext
  \let\@RTLfootnotetext\@tencolRTLfootnotetext
  \dimen\footinsv@r=10\footinsdim
  \count\footinsv@r=100\relax
  \m@make@tencol@footgroup{v@r}%
  \let\@footgroupv@r\@tencol@footgroupv@r
  \dimen\footinsv@l=10\footinsdim
  \count\footinsv@l=100\relax
  \bidi@make@tencol@LTRfootgroup{v@l}%
  \let\@LTRfootgroupv@l\@tencol@LTRfootgroupv@l
  \let\@mpfootnotetext\@mptencolfootnotetext
  \let\@mpLTRfootnotetext\@mptencolLTRfootnotetext
  \let\@mpRTLfootnotetext\@mptencolRTLfootnotetext
  \@bidi@after@Hy@hyperfootnotes
  \m@make@mptencol@footgroup{v@r}%
  \let\mp@footgroupv@r\@mptencol@footgroupv@r
  \bidi@make@mptencol@LTRfootgroup{v@l}%
  \let\mp@LTRfootgroupv@l\@mptencol@LTRfootgroupv@l
  \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth
}
\bidi@ensure@newcommand{\@tencolfootnotetext}[1]{\insert
  \if@RTL@footnote
    \footinsv@r
  \else
    \footinsv@l
  \fi
{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\foottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@tencolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@tencolLTRfootnotetext}[1]{\insert\footinsv@l{\@RTLfalse%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\LTRfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@tencolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@tencolRTLfootnotetext}[1]{\insert\footinsv@r{\@RTLtrue%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\RTLfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@tencolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@preamtenfmt}{%
  \hsize .1\hsize
  \parindent=\z@
  \tolerance=5000\relax
  \leavevmode}
\bidi@ensure@newcommand{\@tencolfootfmt}[1]{%
  \@preamtenfmt
  {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@tencolLTRfootfmt}[1]{%
  \@preamtenfmt
  {\LTRfootfootmark\strut {\LTRfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@tencolRTLfootfmt}[1]{%
  \@preamtenfmt
  {\RTLfootfootmark\strut {\RTLfoottextfont #1}\strut\par}\allowbreak}
\bidi@ensure@newcommand{\@mptencolfootnotetext}[1]{%
  \global\setbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
  \vbox{%
    \unvbox
    \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
    \if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\foottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@tencolfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mptencolLTRfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@l\vbox{%
    \unvbox\@mpfootinsv@l
    \@RTLfalse
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\LTRfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@tencolLTRfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\@mptencolRTLfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@r\vbox{%
    \unvbox\@mpfootinsv@r
    \@RTLtrue
    \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\RTLfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
  \color@begingroup
    \@tencolRTLfootfmt{#1}%
  \color@endgroup}%
  \m@mmf@prepare}
\bidi@ensure@newcommand{\m@make@tencol@footgroup}[1]{%
  \@namedef{@tencol@footgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \m@mrigidbalance{\@nameuse{footins#1}}{10}{\splittopskip}}}}
\newcommand{\bidi@make@tencol@LTRfootgroup}[1]{%
  \@namedef{@tencol@LTRfootgroup#1}{{%
   \def\baselinestretch{\m@m@footnote@spacing}%
   \hsize\bidi@columnwidth
    \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
     \bidi@LTRrigidbalance{\@nameuse{footins#1}}{10}{\splittopskip}}}}
\bidi@ensure@newcommand{\m@make@mptencol@footgroup}[1]{%
\@namedef{@mptencol@footgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \m@mrigidbalance{\@nameuse{@mpfootins#1}}{10}{\splittopskip}}}}
\newcommand{\bidi@make@mptencol@LTRfootgroup}[1]{%
\@namedef{@mptencol@LTRfootgroup#1}{{%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
  \bidi@LTRrigidbalance{\@nameuse{@mpfootins#1}}{10}{\splittopskip}}}}
\bidi@ensure@newcommand{\m@munvxh}[1]{%
  \setbox0=\vbox{\unvbox#1%
    \global\setbox1=\lastbox}%
  \unhbox1
  \unskip
  \unskip
  \unpenalty
  \hskip\m@mipn@skip}
\bidi@ensure@newcommand{\m@mungebox}{%
  \setbox0=\hbox{\m@munvxh0}%
  \dp0=\z@
  \ht0=\footfudgefactor\wd0
  \box0
  \penalty0}
\newskip\m@mipn@skip
\bidi@ensure@newcommand*{\m@minterparanoteglue}[1]{%
  {\foottextfont\global\m@mipn@skip=#1\relax}}
\m@minterparanoteglue{1em plus.3em minus.3em}
\bidi@ensure@newcommand*{\m@mmakehboxofhboxes}{%
 \setbox0=\hbox{}%
  \loop
    \unpenalty
    \setbox2=\lastbox
  \ifhbox2
    \setbox0=\hbox{\box2\unhbox0}
  \repeat}
\bidi@ensure@newcommand*{\m@mremovehboxes}{\setbox0=\lastbox
  \ifhbox0{\m@mremovehboxes}\unhbox0 \fi}
\newcommand*\AddExtraParaSkip[1]{%
    \def\bidi@xparaskip{\advance\@tempdima#1\relax}%
}
\let\bidi@xparaskip\relax
\@onlypreamble\AddExtraParaSkip
\@onlypreamble\bidi@xparaskip
\def\bidi@startparafootskip#1{%
  \global\advance\skip#1\bidi@paraskip
}
\@onlypreamble\bidi@startparafootskip
\bidi@ensure@newcommand{\paragraphfootnotes}{%
  \@namedef{foottextfontv@r}{\foottextfont}%  % [RS]
  \@namedef{foottextfontv@l}{\LTRfoottextfont}%
  \@bidi@before@Hy@hyperfootnotes
  \let\@footnotetext\@parafootnotetext
  \let\@LTRfootnotetext\@paraLTRfootnotetext
  \let\@RTLfootnotetext\@paraRTLfootnotetext
  \dimen\footinsv@r=\footinsdim
  \count\footinsv@r=1000\relax
  \let\bidi@removexfootskip\bidi@removexparafootskip
  \m@make@para@footgroup{v@r}%
  \m@make@para@footstart{v@r}%
  \let\@footgroupv@r\@para@footgroupv@r
  \let\@footstartv@r\@para@footstartv@r
  \dimen\footinsv@l=\footinsdim
  \count\footinsv@l=1000\relax
  \bidi@make@para@LTRfootgroup{v@l}%
  \m@make@para@footstart{v@l}%
  \let\@LTRfootgroupv@l\@para@LTRfootgroupv@l
  \let\@footstartv@l\@para@footstartv@l
  \let\@mpfootnotetext\@mpparafootnotetext
  \let\@mpLTRfootnotetext\@mpparaLTRfootnotetext
  \let\@mpRTLfootnotetext\@mpparaRTLfootnotetext
  \@bidi@after@Hy@hyperfootnotes
  \m@make@mppara@footgroup{v@r}%
  \bidi@make@mppara@LTRfootgroup{v@l}%
  \let\mp@footgroupv@r\@mppara@footgroupv@r
  \let\mp@LTRfootgroupv@l\@mppara@LTRfootgroupv@l
  \g@addto@macro\bidi@floathook{%
    \begingroup
      \foottextfont \@tempdima\normalbaselineskip
      \multiply \@tempdima \@cclvi
      \@tempdimb \columnwidth
      \divide \@tempdimb \@cclvi
      \divide \@tempdima \@tempdimb
      \xdef\footfudgefactor{\strip@pt\@tempdima}%
    \endgroup
  }
  \AtBeginDocument{%
    \begingroup
      \foottextfont
      \@tempdima\footnotesep
      \advance\@tempdima -\ht\strutbox
      \ifdim\@tempdima<\z@ \@tempdima\z@ \fi
      \advance\@tempdima.5\normalbaselineskip
      \bidi@xparaskip
      \xdef\bidi@paraskip{\the\@tempdima\relax}%
    \endgroup
    \bidi@startparafootskip\footinsv@r
    \bidi@startparafootskip\footinsv@l
  }
   \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth
}
\newcommand{\normalRTLparaLTRfootnotes}{%
  \@namedef{foottextfontv@l}{\LTRfoottextfont}%
  \@bidi@before@Hy@hyperfootnotes
  \if@RTL@footnote
    \let\@footnotetext\m@mold@footnotetext
  \else
    \let\@footnotetext\@parafootnotetext
  \fi
  \let\@LTRfootnotetext\@paraLTRfootnotetext
  \let\@RTLfootnotetext\m@mold@RTLfootnotetext
  \dimen\footinsv@l=\footinsdim
  \count\footinsv@l=1000\relax
  \let\bidi@removexfootskip\bidi@removexparafootskip
  \bidi@make@para@LTRfootgroup{v@l}%
  \m@make@para@footstart{v@l}%
  \let\@LTRfootgroupv@l\@para@LTRfootgroupv@l
  \let\@footstartv@l\@para@footstartv@l
  \if@RTL@footnote
    \let\@mpfootnotetext\m@mold@mpfootnotetext
  \else
    \let\@mpfootnotetext\@mpparafootnotetext
  \fi
  \let\@mpLTRfootnotetext\@mpparaLTRfootnotetext
  \let\@mpRTLfootnotetext\m@mold@mpRTLfootnotetext
  \@bidi@after@Hy@hyperfootnotes
  \bidi@make@mppara@LTRfootgroup{v@l}%
  \let\mp@LTRfootgroupv@l\@mppara@LTRfootgroupv@l
  \g@addto@macro\bidi@floathook{%
    \begingroup
      \LTRfoottextfont \@tempdima\normalbaselineskip
      \multiply \@tempdima \@cclvi
      \@tempdimb \columnwidth
      \divide \@tempdimb \@cclvi
      \divide \@tempdima \@tempdimb
      \xdef\footfudgefactor{\strip@pt\@tempdima}%
    \endgroup
  }
  \AtBeginDocument{%
    \begingroup
      \LTRfoottextfont
      \@tempdima\footnotesep
      \advance\@tempdima -\ht\strutbox
      \ifdim\@tempdima<\z@ \@tempdima\z@ \fi
      \advance\@tempdima.5\normalbaselineskip
      \bidi@xparaskip
      \xdef\bidi@paraskip{\the\@tempdima\relax}%
    \endgroup
    \bidi@startparafootskip\footinsv@l
  }
   \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth
}
\bidi@ensure@newcommand{\@parafootnotetext}[1]{\insert
  \if@RTL@footnote
    \footinsv@r
  \else
    \footinsv@l
  \fi
  {%
  \let\bidi@RTL@everypar\@empty%
  \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{#1}%
    \color@endgroup}%
  \m@mungebox}\m@mmf@prepare}
\bidi@ensure@newcommand{\@paraLTRfootnotetext}[1]{\insert\footinsv@l{%
 \let\bidi@RTL@everypar\@empty%
 \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\LTRfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \setbox0=\vbox{\hsize=\maxdimen
    \color@begingroup
      \noindent \@paraLTRfootfmt{#1}%
    \color@endgroup}%
  \m@mungebox}\m@mmf@prepare}
\bidi@ensure@newcommand{\@paraRTLfootnotetext}[1]{\insert\footinsv@r{%
  \let\bidi@RTL@everypar\@empty%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \reset@font\RTLfoottextfont
  \@preamfntext
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \setbox0=\vbox{\hsize=\maxdimen
    \color@begingroup
      \noindent \@paraRTLfootfmt{#1}%
    \color@endgroup}%
  \m@mungebox}\m@mmf@prepare}
\bidi@ensure@newcommand{\@parafootfmt}[1]{%
  \parindent=\z@
  \parfillskip=0pt \@plus 1fil
  {\footfootmark\strut {\foottextfont #1}\penalty-10}}
\bidi@ensure@newcommand{\@paraLTRfootfmt}[1]{%
  \parindent=\z@
  \parfillskip=0pt \@plus 1fil
  {\LTRfootfootmark\strut {\LTRfoottextfont #1}\penalty-10}}
\bidi@ensure@newcommand{\@paraRTLfootfmt}[1]{%
  \parindent=\z@
  \parfillskip=0pt \@plus 1fil
  {\RTLfootfootmark\strut {\RTLfoottextfont #1}\penalty-10}}
\bidi@ensure@newcommand{\@mpparafootnotetext}[1]{%
  \global\setbox
  \if@RTL@footnote
    \@mpfootinsv@r
  \else
    \@mpfootinsv@l
  \fi
  \vbox{%
    \unvbox
    \if@RTL@footnote
      \@mpfootinsv@r
    \else
      \@mpfootinsv@l
    \fi
    \let\bidi@RTL@everypar\@empty
    \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{#1}%
      \color@endgroup}%
  \m@mungebox}\m@mmf@prepare}
\bidi@ensure@newcommand{\@mpparaLTRfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@l\vbox{%
   \unvbox\@mpfootinsv@l
   \let\bidi@RTL@everypar\@empty
   \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\LTRfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
    \setbox0=\vbox{\hsize=\maxdimen
      \color@begingroup
      \noindent \@paraLTRfootfmt{#1}%
      \color@endgroup}%
  \m@mungebox}\m@mmf@prepare}
\bidi@ensure@newcommand{\@mpparaRTLfootnotetext}[1]{%
  \global\setbox\@mpfootinsv@r\vbox{%
  \unvbox\@mpfootinsv@r
   \let\bidi@RTL@everypar\@empty
   \def\baselinestretch{\m@m@footnote@spacing}%
    \reset@font\RTLfoottextfont
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
    \setbox0=\vbox{\hsize=\maxdimen
      \color@begingroup
      \noindent \@paraRTLfootfmt{#1}%
      \color@endgroup}%
  \m@mungebox}\m@mmf@prepare}
\bidi@ensure@newcommand{\m@make@para@footgroup}[1]{%
\@namedef{@para@footgroup#1}{%
  \unvbox\@nameuse{footins#1}
  \@RTLtrue
  \m@mmakehboxofhboxes
  \setbox0=\hbox{\unhbox0 \m@mremovehboxes}%
  \hsize\bidi@columnwidth
  \@parboxrestore
  \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1}%
  \noindent\unhbox0\par}}
\bidi@ensure@newcommand{\bidi@make@para@LTRfootgroup}[1]{%
\@namedef{@para@LTRfootgroup#1}{%
  \unvbox\@nameuse{footins#1}
  \@RTLfalse
  \m@mmakehboxofhboxes
  \setbox0=\hbox{\unhbox0 \m@mremovehboxes}%
  \hsize\bidi@columnwidth
  \@parboxrestore
  \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1}%
  \noindent\unhbox0\par}}
\newcommand{\bidi@removexparafootskip}{%
  \advance\@tempskipa -\bidi@paraskip
  \edef\bidi@footskip{\vskip\the\@tempskipa\relax}%
}
\let\bidi@removexfootskip\relax
\bidi@ensure@newcommand{\m@make@mppara@footgroup}[1]{%
\@namedef{@mppara@footgroup#1}{%
  \unvbox\@nameuse{@mpfootins#1}
  \@RTLtrue
  \m@mmakehboxofhboxes
  \setbox0=\hbox{\unhbox0 \m@mremovehboxes}%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1}%
  \noindent\unhbox0\par}}
\bidi@ensure@newcommand{\bidi@make@mppara@LTRfootgroup}[1]{%
\@namedef{@mppara@LTRfootgroup#1}{%
  \unvbox\@nameuse{@mpfootins#1}
  \@RTLfalse
  \m@mmakehboxofhboxes
  \setbox0=\hbox{\unhbox0 \m@mremovehboxes}%
  \def\baselinestretch{\m@m@footnote@spacing}%
  \@nameuse{foottextfont#1}%
  \noindent\unhbox0\par}}
\bidi@ensure@newcommand{\m@make@para@footstart}[1]{%
\@namedef{@para@footstart#1}{%
  \leftskip=\z@
  \rightskip=\z@
  \parindent=\z@
  }%
}
\bidi@ensure@newcommand*{\m@m@makecolfloats}{%
  \xdef\@freelist{\@freelist\@midlist}%
  \global\let\@midlist\@empty
  \@combinefloats}
\bidi@ensure@newcommand*{\m@m@makecoltext}{%
  \ifvbox\@kludgeins
    \@makespecialcolbox
  \else
    \setbox\@outputbox \vbox to\@colht{%
      \@texttop
      \dimen@ \dp\@outputbox
      \unvbox \@outputbox
      \vskip -\dimen@
      \@textbottom}%
  \fi}
\bidi@ensure@newcommand*{\m@m@makecolintro}{}
\bidi@ensure@newcommand*{\m@mopfootnote}{\setbox\@outputbox \vbox{%
  \boxmaxdepth\@maxdepth
  \@tempdima\dp\@cclv
  \unvbox\@cclv
  \vskip-\@tempdima
  \bidi@mopfn@bottom
  \vskip \skip\footins
  \color@begingroup
    \normalcolor
    \footnoterule
    \unvbox \footins
  \color@endgroup
  }%
}
\newcommand*{\bidi@mopfootnotebf}{%
  \setbox\@outputbox \vbox{%
  \boxmaxdepth\@maxdepth
  \unvbox\@outputbox
  \bidi@mopfn@bottom
  \vskip\skip\footins
  \color@begingroup
    \normalcolor
    \footnoterule
    \unvbox \footins
  \color@endgroup
  }%
}
\gdef\mem@makecol{%
  \m@m@makecolintro
  \m@mdoextrafeet
  \ifvoid\footins
    \setbox\@outputbox \box\@cclv
  \else
    \m@mopfootnote
  \fi
  \m@m@makecolfloats
  \m@m@makecoltext
  \global \maxdepth \@maxdepth}
\gdef\bidi@makecolbf{%
  \m@m@makecolintro
  \m@mdoextrafeet
  \setbox\@outputbox \box\@cclv
  \m@m@makecolfloats
  \ifvoid\footins
  \else
    \bidi@mopfootnotebf
  \fi
  \m@m@makecoltext
  \global \maxdepth \@maxdepth}
\newcommand{\FeetAboveFloat}{\gdef\@makecol{\mem@makecol}}
\newcommand{\FeetBelowFloat}{\gdef\@makecol{\bidi@makecolbf}}
\newcommand\FeetAtBottom{\def\bidi@mopfn@bottom{\vfill\relax}}
\newcommand\FeetBelowRagged{\let\bidi@mopfn@bottom\relax}
\FeetAboveFloat
\FeetBelowRagged
\def\bidi@reinserts#1{\ifvoid#1\else
    \ifnum\count\@currbox>\z@
      \advance\@pageht \ht#1%
      \advance\@pageht \skip#1%
      \advance\@pageht \dp#1%
    \fi
    \insert#1{\unvbox#1}%
  \fi
}
\def\bidi@init@multi@footins#1{%
    \multiply\count#1\col@number
    \multiply\skip#1\col@number
}
\def\bidi@reinsert@footnotes#1{\ifvoid#1\else
         \insert#1{}\fi}
\AtBeginDocument{%
  \bidi@preto\@doclearpage\m@mdoextrafeet
  \g@addto@macro\@reinserts{%
    \bidi@reinserts\footinsv@r
    \bidi@reinserts\footinsv@l
  }
  \bidi@floathook
  \g@addto@macro\@floatplacement{%
    \bidi@ifmulticol{}{\bidi@floathook}%
  }%
  \if@bidi@csundef{multi@column@out}{%
    \@onlypreamble\bidi@init@multi@footins
    \let\bidi@ifmulticol\@secondoftwo
  }{%
    \bidi@preto\multi@column@out\m@mdoextrafeet
    \g@addto@macro\init@mult@footins{%
      \bidi@init@multi@footins\footinsv@r
      \bidi@init@multi@footins\footinsv@l
    }%
    \g@addto@macro\reinsert@footnotes{%
      \bidi@reinsert@footnotes\footinsv@r
      \bidi@reinsert@footnotes\footinsv@l
    }%
  }%
}
\endinput
%%
%% End of file `extrafootnotefeatures-xetex-bidi.def'.
