summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/simurgh/simurgh-ftnxtra.sty
blob: 3fb4106b01d3b4287ac573027089d4b48ecf2af6 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{simurgh-ftnxtra}[2013/09/18 v0.01a extend the applicability of footnotes]
\newtoks\simurgh@p@ftn
\let\FN@sf@@footnote\footnote
\let\FN@sf@@LTRfootnote\LTRfootnote
\let\FN@sf@@RTLfootnote\RTLfootnote
\def\footnote{\ifx\protect\@typeset@protect
    \expandafter\FN@sf@@footnote
  \else
    \expandafter\FN@sf@gobble@opt
  \fi
}
\def\LTRfootnote{\ifx\protect\@typeset@protect
    \expandafter\FN@sf@@LTRfootnote
  \else
    \expandafter\FN@sf@gobble@opt
  \fi
}
\def\RTLfootnote{\ifx\protect\@typeset@protect
    \expandafter\FN@sf@@RTLfootnote
  \else
    \expandafter\FN@sf@gobble@opt
  \fi
}
\edef\FN@sf@gobble@opt{\noexpand\protect
  \expandafter\noexpand\csname FN@sf@gobble@opt \endcsname}
\expandafter\def\csname FN@sf@gobble@opt \endcsname{%
  \@ifnextchar[%]
    \FN@sf@gobble@twobracket
    \@gobble
}
\def\FN@sf@gobble@twobracket[#1]#2{}
\let\FN@sf@@footnotemark\footnotemark
\def\footnotemark{\ifx\protect\@typeset@protect
    \expandafter\FN@sf@@footnotemark
  \else
    \expandafter\FN@sf@gobble@optonly
  \fi
}
\edef\FN@sf@gobble@optonly{\noexpand\protect
  \expandafter\noexpand\csname FN@sf@gobble@optonly \endcsname}
\expandafter\def\csname FN@sf@gobble@optonly \endcsname{%
  \@ifnextchar[%]
    \FN@sf@gobble@bracket
    {}%
}
\def\FN@sf@gobble@bracket[#1]{}
\def\@tabular{\if@RTL\@RTLtabtrue\fi
   \leavevmode \hbox \bgroup
   \let\@footnotetext\simurgh@p@ftntext
   \let\@LTRfootnotetext\simurgh@p@LTRftntext
   \let\@RTLfootnotetext\simurgh@p@RTLftntext
   \let\@xfootnotenext\simurgh@p@xftntext
   \let\@xfootnote\simurgh@p@xfootnote
   \let\@xLTRfootnotenext\simurgh@p@xLTRftntext
   \let\@xLTRfootnote\simurgh@p@xLTRfootnote
    \let\@xRTLfootnotenext\simurgh@p@xRTLftntext
   \let\@xRTLfootnote\simurgh@p@xRTLfootnote
   $\let\@acol\@tabacol
   \let\@classz\@tabclassz
   \let\@classiv\@tabclassiv \let\\\@tabularcr\@tabarray}
\def\endtabular{\crcr\egroup
                 \egroup $\egroup
                  \ifx\@captype\@undefined
                   \global\simurgh@p@ftn\expandafter{\expandafter}\the\simurgh@p@ftn\fi%
                 \@RTLtabfalse}
\long\def\simurgh@p@ftntext#1{%
  \edef\@tempy{\the\simurgh@p@ftn\noexpand\footnotetext[\the\csname c@\@mpfn\endcsname]}%
  \global\simurgh@p@ftn\expandafter{\@tempy{#1}}}%
\long\def\simurgh@p@LTRftntext#1{%
  \edef\@tempyi{\the\simurgh@p@ftn\noexpand\LTRfootnotetext[\the\csname c@\@mpfn\endcsname]}%
  \global\simurgh@p@ftn\expandafter{\@tempyi{#1}}}%
\long\def\simurgh@p@RTLftntext#1{%
  \edef\@tempyii{\the\simurgh@p@ftn\noexpand\RTLfootnotetext[\the\csname c@\@mpfn\endcsname]}%
  \global\simurgh@p@ftn\expandafter{\@tempyii{#1}}}%

\long\def\simurgh@p@xftntext[#1]#2{%
  \global\simurgh@p@ftn\expandafter{\the\simurgh@p@ftn\footnotetext[#1]{#2}}}

\long\def\simurgh@p@xLTRftntext[#1]#2{%
  \global\simurgh@p@ftn\expandafter{\the\simurgh@p@ftn\LTRfootnotetext[#1]{#2}}}

\long\def\simurgh@p@xRTLftntext[#1]#2{%
  \global\simurgh@p@ftn\expandafter{\the\simurgh@p@ftn\RTLfootnotetext[#1]{#2}}}

\def\simurgh@p@xfootnote[#1]{%
   \begingroup
     \csname c@\@mpfn\endcsname #1\relax
     \unrestored@protected@xdef\@thefnmark{\thempfn}%
   \endgroup
   \@footnotemark\simurgh@p@xftntext[#1]}

\def\simurgh@p@xLTRfootnote[#1]{%
   \begingroup
     \csname c@\@mpfn\endcsname #1\relax
     \unrestored@protected@xdef\@thefnmark{\thempfn}%
   \endgroup
   \@footnotemark\simurgh@p@xLTRftntext[#1]}

\def\simurgh@p@xRTLfootnote[#1]{%
   \begingroup
     \csname c@\@mpfn\endcsname #1\relax
     \unrestored@protected@xdef\@thefnmark{\thempfn}%
   \endgroup
   \@footnotemark\simurgh@p@xRTLftntext[#1]}

\def\@xfloat #1[#2]{%
  \@nodocument
  \def \@captype {#1}%
   \def \@fps {#2}%
   \@onelevel@sanitize \@fps
   \def \reserved@b {!}%
   \ifx \reserved@b \@fps
     \@fpsadddefault
   \else
     \ifx \@fps \@empty
       \@fpsadddefault
     \fi
   \fi
   \ifhmode
     \@bsphack
     \@floatpenalty -\@Mii
   \else
     \@floatpenalty-\@Miii
   \fi
  \ifinner
     \@parmoderr\@floatpenalty\z@
  \else
    \@next\@currbox\@freelist
      {%
       \@tempcnta \sixt@@n
       \expandafter \@tfor \expandafter \reserved@a
         \expandafter :\expandafter =\@fps
         \do
          {%
           \if \reserved@a h%
             \ifodd \@tempcnta
             \else
               \advance \@tempcnta \@ne
             \fi
           \fi
           \if \reserved@a t%
             \@setfpsbit \tw@
           \fi
           \if \reserved@a b%
             \@setfpsbit 4%
           \fi
           \if \reserved@a p%
             \@setfpsbit 8%
           \fi
           \if \reserved@a !%
             \ifnum \@tempcnta>15
               \advance\@tempcnta -\sixt@@n\relax
             \fi
           \fi
           }%
       \@tempcntb \csname ftype@\@captype \endcsname
       \multiply \@tempcntb \@xxxii
       \advance \@tempcnta \@tempcntb
       \global \count\@currbox \@tempcnta
       }%
    \@fltovf
  \fi
  \global \setbox\@currbox
    \color@vbox
      \normalcolor
      \vbox \bgroup
       \let\@footnotetext\simurgh@p@ftntext
       \let\@LTRfootnotetext\simurgh@p@LTRftntext
       \let\@RTLfootnotetext\simurgh@p@RTLftntext
       \let\@xfootnotenext\simurgh@p@xftntext
        \let\@xfootnote\simurgh@p@xfootnote
        \let\@xLTRfootnotenext\simurgh@p@xLTRftntext
        \let\@xLTRfootnote\simurgh@p@xLTRfootnote
        \let\@xRTLfootnotenext\simurgh@p@xRTLftntext
        \let\@xRTLfootnote\simurgh@p@xRTLfootnote
        \hsize\columnwidth
        \@parboxrestore
        \@floatboxreset
}
\def \@endfloatbox{%
      \par\vskip\z@skip      %% \par\vskip\z@ added 15 Dec 87
      \@minipagefalse
      \outer@nobreak
    \egroup                  %% end of vbox
    \global\simurgh@p@ftn\expandafter{\expandafter}\the\simurgh@p@ftn
  \color@endbox
}
\endinput