summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/luabidi/luabidi.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-10-28 20:55:00 +0000
committerKarl Berry <karl@freefriends.org>2019-10-28 20:55:00 +0000
commit788fcfc57037c4c25d9c6136eca5ef7600847f98 (patch)
tree9746943f1d66bc47445c74382c7d96d222192651 /Master/texmf-dist/tex/lualatex/luabidi/luabidi.sty
parentba76810f09d4e94c1daac4a1053b995f9600ad27 (diff)
luabidi (28oct19)
git-svn-id: svn://tug.org/texlive/trunk@52549 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/luabidi/luabidi.sty')
-rw-r--r--Master/texmf-dist/tex/lualatex/luabidi/luabidi.sty52
1 files changed, 38 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/lualatex/luabidi/luabidi.sty b/Master/texmf-dist/tex/lualatex/luabidi/luabidi.sty
index abc1d2a9367..4277a1f1738 100644
--- a/Master/texmf-dist/tex/lualatex/luabidi/luabidi.sty
+++ b/Master/texmf-dist/tex/lualatex/luabidi/luabidi.sty
@@ -1,4 +1,5 @@
%% This file is luabidi.sty
+%% This is part of the luabidi package
%%
%% Copyright © 2009 Vafa Khalighi, 2013--2019 Arthur Reutenauer, 2019 Jürgen Spitzmüller
%%
@@ -6,11 +7,30 @@
%% 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}[2019/08/24 v0.4
+\ProvidesPackage{luabidi}[2019/10/27 v0.5
Bidirectional typesetting in LuaTeX]
+
+\RequirePackage{etoolbox}
+
+%
+% Package options
+%
+
+\DeclareOption{arabmaths}{\input{luabidi-arabmaths.def}}
+\newif\ifluabidi@autofootnoterule
+\DeclareOption{autofootnoterule}{\luabidi@autofootnoteruletrue}
+\newif\ifluabidi@textwidthfootnoterule
+\DeclareOption{textwidthfootnoterule}{\luabidi@textwidthfootnoteruletrue}
+\ProcessOptions
+
+%
+% General command and switches
+%
+
\newif\if@RTL
\newif\if@RTLmain
-\def\setRTLmain{\pagedir TRT \bodydir TRT \pardir TRT \textdir TRT}
+\@RTLmainfalse
+\def\setRTLmain{\@RTLmaintrue\pagedir TRT \bodydir TRT \pardir TRT \textdir TRT}
\def\setRTL{\@RTLtrue\pardir TRT \textdir TRT}
\let\setRL=\setRTL
\def\setLTR{\@RTLfalse\pardir TLT \textdir TLT}
@@ -25,9 +45,6 @@
\def\@ensure@LTR#1{\if@RTL\LRE{#1}\else{#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= }
@@ -39,18 +56,25 @@
\def\moreRLE{\bracetext \aftergroup\unsetRTL \setRTL\@RTLtrue}
\let\LR=\LRE
\let\RL=\RLE
+\def\hboxR#1{\hbox{\RL{#1}}}
-\def\Footnote#1{%
-\begingroup
-\footnotemark
-\renewcommand{\thefootnote}{\@arabic\c@footnote}%
-\pardir TLT \textdir TLT\footnotetext{#1}%
-\endgroup
-}
+%
+% Footnotes
+%
-\DeclareOption{autofootnoterule}{\input{autofootnoterule}}
+\input{luabidi-footnotes.def}
+\ifluabidi@textwidthfootnoterule
+ \textwidthfootnoterule
+\fi
+% This needs to be loaded late because of the switch
+\AtEndPreamble{%
+ \makeatletter
+ \ifluabidi@autofootnoterule
+ \input{luabidi-autofootnoterule.def}
+ \fi
+ \makeatother
+}
-\ProcessOptions
\endinput