summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/luabidi/luabidi-footnotes.def
blob: db185e2578df6a40aca758e17ef17f21e268fdd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
%% This file is luabidi-footnotes.def
%% This is part of the luabidi package
%%
%% Copyright © 2009 Vafa Khalighi, 2013--2019 Arthur Reutenauer, 2019 Jürgen Spitzmüller
%%
%%%% 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.

%
% Footnotes
%

% These are defined in polyglossia. Provide simple fallbacks
\providecommand*\localnumeral{\@ifstar\@@localnumeral\@localnumeral}

\providecommand*\@localnumeral[1]{#1}
\providecommand*\@@localnumeral[1]{%
      \protect\@arabic\csuse{c@#1}%
}

\let\footnotemarkLR\footnotemark
\let\footnotemarkRL\footnotemark

\providecommand\LTRfootnote[2][]{%
  \begingroup
    \ifx#1\\\\\footnotemarkLR
        \renewcommand{\thefootnote}{\localnumeral*{footnote}}%
    \else%
        \footnotemarkLR[#1]%
        \renewcommand{\thefootnote}{\localnumeral{#1}}%
    \fi
    \pardir TLT \textdir TLT\footnotetext{#2}%
  \endgroup
}

\providecommand\RTLfootnote[2][]{%
  \begingroup
    \ifx#1\\\\\footnotemarkRL%
       \renewcommand{\thefootnote}{\localnumeral*{footnote}}%
    \else%
       \footnotemarkRL[#1]%
       \renewcommand{\thefootnote}{\localnumeral{#1}}%
    \fi
    \pardir TRT \textdir TRT\footnotetext{#2}%
  \endgroup
}

% backwards compatibility
\def\Footnote#1{\LTRfootnote{#1}}

%
% Footnote rules
%

% adjustable rule length
\newlength\footnoterulewidth
\setlength\footnoterulewidth{.4\columnwidth}

% The left, right and full width rules
\def\luabidi@left@fn{%
  \hbox to \columnwidth
  {\pagedir TLT\textdir TLT\vbox{\kern -3\p@
   \hrule\@width\footnoterulewidth\kern2.6\p@}\hfil}}
\def\luabidi@right@fn{%
   \pagedir TRT\textdir TRT\hrule\@width\footnoterulewidth\kern2.6\p@}
\def\luabidi@textwidth@fn{%
   \kern-3\p@\hrule\@width\textwidth\kern2.6\p@}

% switches for the rule position
\def\leftfootnoterule{\global\def\footnoterule{\luabidi@left@fn}}
\def\rightfootnoterule{\global\def\footnoterule{\luabidi@right@fn}}
\def\textwidthfootnoterule{\global\def\footnoterule{\luabidi@textwidth@fn}}
\def\autofootnoterule{\luabidi@autofootnoteruletrue}

% Finis