summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/luabidi/tex/luabidi.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-10-29 03:00:39 +0000
committerNorbert Preining <norbert@preining.info>2019-10-29 03:00:39 +0000
commit97f5151099967e6c823d640a90d87bca92c44035 (patch)
tree685caa49488599f87d0caa4e972833b2263d8567 /macros/luatex/latex/luabidi/tex/luabidi.sty
parent25a647b97ef526aefcc75269dd19c46dbe3ae4c1 (diff)
CTAN sync 201910290300
Diffstat (limited to 'macros/luatex/latex/luabidi/tex/luabidi.sty')
-rw-r--r--macros/luatex/latex/luabidi/tex/luabidi.sty52
1 files changed, 38 insertions, 14 deletions
diff --git a/macros/luatex/latex/luabidi/tex/luabidi.sty b/macros/luatex/latex/luabidi/tex/luabidi.sty
index abc1d2a936..4277a1f173 100644
--- a/macros/luatex/latex/luabidi/tex/luabidi.sty
+++ b/macros/luatex/latex/luabidi/tex/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