blob: 0f03d8646f2148610ff712401f281e9fa3a62016 (
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
%%
%% This is file `tocstyle-xetex-bidi.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bidi.dtx (with options: `table,tocstyle-xetex-bidi.def')
%%
%% __________________________________________________
%% Vafa Khalighi
%%
%% Copyright (c) 2007--2024 Vafa Khalighi
%% Copyright (c) 2018--2020 bidi-tex GitHub Organization
%%
%% It may be distributed and/or modified under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%%
%% This work is “author-maintained” (as per LPPL maintenance status)
%% by Vafa Khalighi.
%%
%%
%% \CheckSum{58558}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
\ProvidesFile{tocstyle-xetex-bidi.def}[2010/07/25 v0.1 bidi adaptations for tocstyle package for XeTeX engine]
\renewcommand*{\tocstyle@dottedtocline}[5]{%
\let\numberline\tocstyle@numberline
\ifnum #1>\c@tocdepth \else
\if@tocstyle@penalties
\begingroup
\@tempcnta 20010
\advance \@tempcnta by -#1
\ifnum \@tempcnta>\lastpenalty
\aftergroup\penalty\aftergroup\@lowpenalty
\fi
\endgroup
\fi
\edef\tocstyledepth{#1}%
\tocstyle@activate@features
\ifx\tocstyle@feature@entryvskip\relax
\vskip \z@ \@plus.2\p@
\else
\addvspace{\tocstyle@feature@entryvskip}%
\fi
{%
\parskip \z@ \parindent \z@ \if@RTL\rightskip\else\leftskip\fi \z@ \if@RTL\leftskip\else\rightskip\fi \z@
\tocstyle@feature@raggedhook
\@tempdima #3\relax
\@tempdimb #2\relax
\typeout{m (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
\ifnum #1>\z@\relax
\@tempcnta #1\relax \advance\@tempcnta \m@ne
\ifcsname tocstyle@skipwidth@\tocstyleTOC @\the\@tempcnta\endcsname
\ifcsname tocstyle@numwidth@\tocstyleTOC @\the\@tempcnta\endcsname
\@tempdimb
\csname tocstyle@skipwidth@\tocstyleTOC @\the\@tempcnta\endcsname
\advance\@tempdimb
\csname tocstyle@numwidth@\tocstyleTOC @\the\@tempcnta\endcsname
\fi
\fi
\fi
\typeout{C (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
\ifcsname tocstyle@skipwidth@\tocstyleTOC @#1\endcsname
\ifdim \@tempdimb>
\csname tocstyle@skipwidth@\tocstyleTOC @#1\endcsname\relax
\expandafter\xdef\csname tocstyle@skipwidth@\tocstyleTOC
@#1\endcsname{\the\@tempdimb}%
\fi
\else
\expandafter\xdef\csname tocstyle@skipwidth@\tocstyleTOC
@#1\endcsname{\the\@tempdimb}%
\fi
\iftocstyle@autolength
\ifcsname tocstyle@maxskipwidth@\tocstyleTOC @#1\endcsname
\@tempdimb \csname tocstyle@maxskipwidth@\tocstyleTOC @#1\endcsname
\relax
\fi
\ifcsname tocstyle@maxnumwidth@\tocstyleTOC @#1\endcsname
\@tempdima \csname tocstyle@maxnumwidth@\tocstyleTOC @#1\endcsname
\relax
\fi
\typeout{a (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
\typeout{A (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
\else
\@tempdimb #2\relax
\typeout{M (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
\fi
\ifcsname tocstyle@unumwidth@\tocstyleTOC @\endcsname
\ifdim \@tempdima>
\csname tocstyle@unumwidth@\tocstyleTOC @\endcsname\relax
\expandafter\xdef\csname tocstyle@unumwidth@\tocstyleTOC
@\endcsname{\the\@tempdima}%
\fi
\else
\expandafter\xdef\csname tocstyle@unumwidth@\tocstyleTOC
@\endcsname{\the\@tempdima}%
\fi
\ifcase\tocstyle@indentstyle\relax\else
\@tempdimb \z@
\ifcsname tocstyle@maxunumwidth@\tocstyleTOC @\endcsname
\@tempdima \csname tocstyle@maxunumwidth@\tocstyleTOC @\endcsname
\relax
\fi
\typeout{s (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
\typeout{S (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
\fi
\advance\parindent \@tempdimb\@afterindenttrue
\advance\if@RTL\rightskip\else\leftskip\fi \parindent
\advance\if@RTL\leftskip\else\rightskip\fi \@tocrmarg
\parfillskip -\if@RTL\leftskip\else\rightskip\fi
\ifx\tocstyle@feature@parfillskip\relax\else
\advance\parfillskip \tocstyle@feature@parfillskip\relax
\fi
\interlinepenalty\@M
\leavevmode
\advance\if@RTL\rightskip\else\leftskip\fi \@tempdima
\null\nobreak
\iftocstyle@indentnotnumbered\else
\hskip -\if@RTL\rightskip\else\leftskip\fi
\fi
\tocstyle@feature@entryhook
{#4}\nobreak
\ifx\tocstyle@feature@leaders\relax
\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{\tocstyle@feature@dothook .}%
\mkern \@dotsep mu$}\hfill
\else
\tocstyle@feature@leaders
\fi
\nobreak
\ifx\tocstyle@feature@pagenumberbox\relax
\hb@xt@\@pnumwidth{\hfil\tocstyle@feature@pagenumberhook #5}%
\else
\tocstyle@feature@pagenumberbox{\tocstyle@feature@pagenumberhook #5}%
\fi
\par
}%
\if@tocstyle@penalties
\bgroup
\@tempcnta 20009
\advance\@tempcnta by -#1
\edef\reserved@a{\egroup\penalty\the\@tempcnta\relax}%
\reserved@a
\fi
\fi}
\renewcommand*{\tocstyle@numberline}[1]{%
\begingroup
\ifx\tocstyle@feature@spaceafternumber\relax
\settowidth\@tempdima{\tocstyle@@numberline{#1}\enskip}%
\else
\settowidth\@tempdima{\tocstyle@@numberline{#1}}%
\advance \@tempdima \tocstyle@feature@spaceafternumber\relax
\fi
\ifcsname tocstyle@numwidth@\tocstyleTOC @\tocstyledepth\endcsname
\ifdim \@tempdima >
\csname tocstyle@numwidth@\tocstyleTOC @\tocstyledepth\endcsname\relax
\expandafter\xdef\csname tocstyle@numwidth@\tocstyleTOC
@\tocstyledepth\endcsname{\the\@tempdima}%
\fi
\else
\expandafter\xdef\csname tocstyle@numwidth@\tocstyleTOC
@\tocstyledepth\endcsname{\the\@tempdima}%
\fi
\endgroup
\iftocstyle@indentnotnumbered
\hskip -\if@RTL\rightskip\else\leftskip\fi
\fi
\ifcase \tocstyle@indentstyle
\hb@xt@\@tempdima{\tocstyle@@numberline{#1}\hfil}%
\or
\hb@xt@\@tempdima{\tocstyle@@numberline{#1}\hfil}%
\else
\ifx\tocstyle@feature@spaceafternumber\relax
\hbox{\tocstyle@@numberline{#1}\enskip}%
\else
\hbox{\tocstyle@@numberline{#1}\hskip
\tocstyle@feature@spaceafternumber\relax}%
\fi
\fi
}
\AtBeginDocument{%
\ifcsname l@part\endcsname
\ifcsname l@chapter\endcsname
\setbox\@tempboxa\vbox{\hsize\maxdimen
\l@part{\tocstyle@l@define{part}{-1}}{}}%
\else
\setbox\@tempboxa\vbox{\hsize\maxdimen
\l@part{\tocstyle@l@define{part}{0}}{}}%
\fi
\fi
\ifcsname l@chapter\endcsname
\setbox\@tempboxa\vbox{\hsize\maxdimen
\l@chapter{\tocstyle@l@define{chapter}{0}}{}}%
\fi
\ifcsname l@section\endcsname
\setbox\@tempboxa\vbox{\hsize\maxdimen
\l@section{\tocstyle@l@define{section}{1}}{}}%
\fi
\ifcsname l@subsection\endcsname
\setbox\@tempboxa\vbox{\hsize\maxdimen
\l@subsection{\tocstyle@l@define{subsection}{2}}{}}%
\fi
\ifcsname l@subsubsection\endcsname
\setbox\@tempboxa\vbox{\hsize\maxdimen
\l@subsubsection{\tocstyle@l@define{subsubsection}{3}}{}}%
\fi
\ifcsname l@paragraph\endcsname
\setbox\@tempboxa\vbox{\hsize\maxdimen
\l@paragraph{\tocstyle@l@define{paragraph}{4}}{}}%
\fi
\ifcsname l@subparagraph\endcsname
\setbox\@tempboxa\vbox{\hsize\maxdimen
\l@subparagraph{\tocstyle@l@define{subparagraph}{5}}{}}%
\fi
\ifcsname l@table\endcsname
\setbox\@tempboxa\vbox{\hsize\maxdimen
\l@table{\tocstyle@l@define{table}{1}}{}}%
\fi
\ifcsname l@figure\endcsname
\setbox\@tempboxa\vbox{\hsize\maxdimen
\l@figure{\tocstyle@l@define{figure}{1}}{}}%
\fi
\def\@tempa#1#2#3#4#5{%
\ifnum #1>\c@tocdepth \else
\vskip \z@ \@plus.2\p@
{\if@RTL\rightskip\else\leftskip\fi #2\relax \if@RTL\leftskip\else\rightskip\fi \@tocrmarg \parfillskip -\if@RTL\leftskip\else\rightskip\fi
\parindent #2\relax\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima #3\relax
\advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
{#4}\nobreak
\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill
\nobreak
\hb@xt@\@pnumwidth{{\hfil \normalfont \normalcolor #5}}%
\par}%
\fi}%
\ifx\@dottedtocline\@tempa\else
\tocstyle@macrochangewarning\@dottedtocline
\fi
\let\tocstyle@saved@dottedtocline\@dottedtocline
\def\@tempa#1{\hb@xt@\@tempdima{#1\autodot\hfil}}%
\ifx\numberline\@tempa\else
\def\@tempa#1{\hb@xt@\@tempdima{#1\hfil}}%
\ifx\numberline@tempa\else
\tocstyle@macrochangewarning\numberline
\fi
\fi
\let\tocstyle@saved@numberline\numberline
}
\renewcommand*{\tocstyle@l@define}[2]{%
\advance\if@RTL\rightskip\else\leftskip\fi-\@tempdima
\edef\@tempa{%
\noexpand\global\noexpand\let
\expandafter\noexpand\csname tocstyle@saved@l@#1\endcsname
\expandafter\noexpand\csname l@#1\endcsname
\noexpand\gdef
\expandafter\noexpand\csname tocstyle@l@#1\endcsname{%
\noexpand\@dottedtocline{#2}{\the\if@RTL\rightskip\else\leftskip\fi}{\the\@tempdima}}%
\noexpand\g@addto@macro\noexpand\tocstyle@activate@all@l{%
\noexpand\let\expandafter\noexpand\csname l@#1\endcsname
\expandafter\noexpand\csname tocstyle@l@#1\endcsname
}%
}%
\PackageInfo{tocstyle}{prepare \expandafter\string
\csname l@#1\endcsname\space for redefinition}%
\@tempa
}
\endinput
%%
%% End of file `tocstyle-xetex-bidi.def'.
|