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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
%%
%% This is file `tocstyle-xetex-bidi.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bidi.dtx (with options: `tocstyle-xetex-bidi.def')
%%
%% ______________________________________
%% Copyright © 2009–2010 Vafa Khalighi
%%
%% License information appended.
%%
%%
\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
}
%%
%% Copyright © 2009–2010 Vafa Khalighi <vafakhlgh@gmail.com>
%%
%% 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.
%%
%% In addition to the terms of LPPL any distributed version
%% (unchanged or modified) of bidi has to keep the statement
%% about the moral obligation for using bidi. In case of major
%% changes where this would not be appropriate the author of the
%% changed version should contact the copyright holder.
%%
%%
%%
%% Moral obligation for using bidi:
%% ____________________________________
%%
%% Users of bidi who wish to include or use bidi or a modified
%% version in a proprietary and commercially market product are asked
%% under certain conditions (see below) for the payment of a license
%% fee. The size of this fee is to be determined, in each instance,
%% by the commercial user, depending on his/her judgment of the value of
%% bidi for his/her product.
%%
%%
%% The conditions for this are as follows:
%%
%% The producer of a proprietary and commercially market product
%% that involves typesetting using bidi is asked to determine
%% the value of a license fee for using bidi if
%%
%% - the product is a document and the producer has decided to
%% include bidi to typeset (parts of) the document or has
%% directed the author of the document to include bidi (for
%% example, by providing a class file to be used by the author)
%%
%% - the product is a LaTeX class or package that includes bidi
%%
%%
%% There is no moral obligation in case
%%
%% - the product is a document but producer has not directed
%% the author to include bidi (in that case the moral obligation
%% lies with the author of the document)
%%
%% - the product does not involve typesetting, e.g., consists, for
%% example, of distributing bidi and its documentation.
%%
%% - the product is not proprietary, i.e., is made available as free
%% software itself (which doesn't prohibit its commercial marketing)
%%
%% - bidi is used for non-commercial purposes
%%
%%
%% Determinating a license fee might result in a license fee of zero
%% (i.e., no payment) in case a producer has determined that the use
%% of bidi has no enhancing effect on the product. This is a
%% plausible scenario, i.e., in the above two cases the producer is
%% only asked to evaluate the value of bidi for the product
%% not for the payment of a license fee per se (which might or might
%% not follow from this evaluation).
%%
%% The license fee, if any, can be payed to the author of
%% the program who can be contacted at
%%
%% vafakhlgh@gmail.com
%%
%%
%%
%%
%% End of file `tocstyle-xetex-bidi.def'.
|