%% This file is luabidi.sty %% %% Copyright © 2009 Vafa Khalighi, 2013 Arthur Reutenauer %% %%%% It may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luabidi}[2013/05/27 v0.2 Bidirectional typesetting in LuaTeX] \newif\if@RTL \newif\if@RTLmain \def\setRTLmain{\luatexpagedir TRT \luatexbodydir TRT \luatexpardir TRT \luatextextdir TRT} \def\setRTL{\@RTLtrue\luatexpardir TRT \luatextextdir TRT} \let\setRL=\setRTL \def\setLTR{\@RTLfalse\luatexpardir TLT \luatextextdir TLT} \let\setLR=\setLTR \let\unsetRTL=\setLTR \let\unsetLTR=\setRTL \def\RTL{\@RTLtrue\trivlist \luatexpardir TRT \luatextextdir TRT\item\relax} \def\endRTL{\@RTLfalse\endtrivlist} \def\LTR{\trivlist \luatexpardir TLT \luatextextdir TLT\item\relax} \def\endLTR{\endtrivlist} \def\@ensure@RTL#1{\if@RTL#1\else\RLE{#1}\fi} \def\@ensure@LTR#1{\if@RTL#1\else\LRE{#1}\fi} \def\@ensure@dir#1{\if@RTL\RLE{#1}\else{#1}\fi} \let\@ensure@maindir=\@ensuredir \@RTLmainfalse \DeclareOption{arabmaths}{\input{arabmaths}} \DeclareOption{textwidthfootnoterule}{\input{textwidthfootnoterule}} \let\n@xt=\ \DeclareRobustCommand*\LRE{\protect\pLRE} \def\pLRE{\protect\afterassignment\moreLRE \let\n@xt= } \DeclareRobustCommand*\RLE{\protect\pRLE} \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} \def\moreLRE{\bracetext \aftergroup\unsetLTR \setLTR\@RTLfalse} \def\moreRLE{\bracetext \aftergroup\unsetRTL \setRTL\@RTLtrue} \let\LR=\LRE \let\RL=\RLE \def\Footnote#1{% \begingroup \footnotemark \renewcommand{\thefootnote}{\@arabic\c@footnote}% \luatexpardir TLT \luatextextdir TLT\footnotetext{#1}% \endgroup } \DeclareOption{autofootnoterule}{\input{autofootnoterule}} \ProcessOptions \endinput