summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/arabtex/asect.sty
blob: 15bf952e69add6c27893540fa063416ec504061d (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
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% asect.sty
% called by altxext.sty
% 26.04.2003
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Klaus Lagally
%     Institut fuer Formale Methoden der Informatik
%     Universitaet Stuttgart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\a@ident {asect.sty} {3.11 section macros for Arabic} {26.04.2003}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% sections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\iffalse % LaTeX 2.09 routines

\def\@xsect#1{\@tempskipa #1\relax
\ifdim \@tempskipa > \z@
       \par \nobreak
       \vskip\@tempskipa
       \@afterheading
\else \global\@nobreakfalse \global\@noskipsectrue
	\everypar 
	{\if@noskipsec \global\@noskipsecfalse
		\clubpenalty\@M \hskip -\parindent
		\begingroup \@svsechd 
		\endgroup 
		\unskip \hskip -#1\relax  % relax added 14 Jan 91
	\else \clubpenalty \@clubpenalty
		\everypar {}%
	\fi}
\fi \ignorespaces }
 
\def\@sect#1#2#3#4#5#6[#7]#8{%
\ifnum #2 > \c@secnumdepth \let\@svsec \@empty
\else \refstepcounter{#1}%
	\edef\@svsec {\csname the#1\endcsname \hskip 1em}%
\fi
\@tempskipa #5\relax
\ifdim \@tempskipa>\z@
	\begingroup #6\relax
		\@hangfrom {\hskip #3\relax \@svsec }%
			{\interlinepenalty \@M #8\par}%
	\endgroup
	\csname #1mark\endcsname {#7}%
	\addcontentsline {toc}{#1}%
		{\ifnum #2>\c@secnumdepth 
		\else \protect\numberline {\csname the#1\endcsname}%
		\fi #7}%
\else \def\@svsechd 
	{#6\hskip #3\relax  %% \relax added 2 May 90
	\@svsec #8\csname #1mark\endcsname {#7}%
	\addcontentsline {toc}{#1}%
		{\ifnum #2>\c@secnumdepth 
		\else \protect\numberline {\csname the#1\endcsname}%
		\fi #7}}%
\fi \@xsect{#5}}
 
\def\@ssect#1#2#3#4#5{\@tempskipa #3\relax
\ifdim \@tempskipa > \z@
	\begingroup #4%
		\@hangfrom {\hskip #1}%
			{\interlinepenalty \@M #5\par}%
	\endgroup
\else \def\@svsechd {#4\hskip #1\relax #5}%
\fi \@xsect{#3}}
 
\def\@startsection#1#2#3#4#5#6{\if@noskipsec \leavevmode \fi
\par \@tempskipa #4\relax
\@afterindenttrue
\ifdim \@tempskipa < \z@ 
	\@tempskipa -\@tempskipa \@afterindentfalse
\fi
\if@nobreak \everypar{}%
\else \addpenalty{\@secpenalty}\addvspace{\@tempskipa}%
\fi 
\@ifstar {\@ssect{#3}{#4}{#5}{#6}}%
	{\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
 
\def\@afterheading{\global\@nobreaktrue
\everypar {\if@nobreak \global\@nobreakfalse \clubpenalty \@M
		\if@afterindent \else {\setbox\z@\lastbox}\fi
	\else \clubpenalty \@clubpenalty \everypar{}%
	\fi}}

\fi % end of LaTeX 2.09 routines
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Arabic versions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def \a@startsection #1#2#3#4#5#6{% Arabic mode
%\tracingmacros 1
\if@noskipsec \leavea@vmode \fi
\a@@par \@tempskipa #4\relax \@afterindenttrue
\ifdim \@tempskipa <\z@ \@tempskipa -\@tempskipa \@afterindentfalse
\fi
\if@nobreak \a@@everypar {}%
\else \addpenalty \@secpenalty \addvspace \@tempskipa
\fi 
\@ifstar {\a@ssect {#3}{#4}{#5}{#6}}%
	{\@dblarg {\a@sect {#1}{#2}{#3}{#4}{#5}{#6}}}}
 
\def \a@ssect #1#2#3#4#5{% Arabic mode
\@tempskipa #3\relax
\ifdim \@tempskipa > \z@
	\begingroup \let \end \a@@par 
		#4\relax \set@arabfont % style
        	\a@hangfrom {\hskip #1\relax }% indentation
		\test@token #5 \end
	\endgroup
\else \def \@svsechd {\putwordb@x {#4\xpa\RL \xpa{#5}\hskip #1\relax }}%
\fi \a@xsect{#3}}
 
\def\a@sect #1#2#3#4#5#6[#7]#8{% Arabic mode
\ifnum #2 > \c@secnumdepth \let \@svsec \@empty 
\else \refstepcounter{#1}%
	\edef \@svsec {\hskip 1em \nxp\RL {\csname the#1\endcsname }}%
\fi
\@tempskipa #5\relax
\ifdim \@tempskipa > \z@
	\begingroup \let \end \a@@par 
		#6\relax \set@arabfont % style
	        \a@hangfrom {\hskip #3\relax \@svsec }% section number
		\test@token #8 \end
	\endgroup
	\csname #1mark\endcsname {\RL {#7}}%
	\addcontentsline {toc}{#1}%
		{\ifnum #2 > \c@secnumdepth \else
		\protect\numberline {\csname the#1\endcsname }\fi
		\protect\RL {#7}}%
\else \def \@svsechd % saved head, executed by \everypar
	{\putwordb@x {#6\xpa\RL {#8}\@svsec \hskip #3\relax }%
        \csname #1mark\endcsname {\RL {#7}}%
	\addcontentsline {toc}{#1}%
		{\ifnum #2>\c@secnumdepth \else
		\protect\numberline {\csname the#1\endcsname}\fi
		\protect\RL {#7}}}% \@svsechd
\fi \a@xsect {#5}}
 
\def\a@xsect #1{% Arabic mode
\@tempskipa #1\relax
\ifdim \@tempskipa>\z@ \a@@par \nobreak \vskip \@tempskipa
       \a@afterheading
\else \global\@nobreakfalse \global\@noskipsectrue
\a@@everypar {\if@noskipsec \global\@noskipsecfalse \clubpenalty \@M 
        	\putwordb@x {\hskip -\a@parindent }\@svsechd
        	\putwordb@x {\hskip -#1\relax }%
             \else \clubpenalty \@clubpenalty \a@@everypar {}%
             \fi}
\fi \a@spacefalse 
%\tracingmacros 0
\test@token }

\def \a@afterheading {% Arabic mode
\global\@nobreaktrue
\a@@everypar {% when entering Arabic horizontal mode
	\if@nobreak \global\@nobreakfalse \clubpenalty \@M
		\if@afterindent \else \putwordb@x {\hskip -\a@parindent }%
		\fi
	\else \clubpenalty \@clubpenalty \a@@everypar{}%
	\fi}}
 
\def \a@hangfrom #1{% hanging indentation for rest of paragraph (group)
\setbox0 \hbox {#1}\@tempdima \wd0
\advance \leftskip \@tempdima \advance \a@limit -\@tempdima
\putlineb@x {\rlap {\unhbox0 }}\a@spacefalse }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% for table of contents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\iffalse % LaTeX 2.09 routines

\def\contentsline#1{\csname l@#1\endcsname}
 
% \@dottedtocline{LEVEL}{INDENT}{NUMWIDTH}{TITLE}{PAGE} :
%   Macro to produce a table of contents line with the following
%   parameters:
%     LEVEL    : If LEVEL > \c@tocdepth, then no line produced.
%     INDENT   : Total indentation from the left margin.
%     NUMWIDTH : Width of box for number if the TITLE has a
%                \numberline command.
%                As of 25 Jan 88, this is also the amount of extra indentation
%                added to second and later lines of a multiple line entry.
%     TITLE    : Contents of entry.
%     PAGE     : Page number.
%
%  Uses the following parameters, which must be set by the document style.
%  They should be defined with \def's.
%    \@pnumwidth : Width of box in which page number is set.
%    \@tocrmarg  : Right margin indentation for all but last line of
%                  multiple-line entries.
%    \@dotsep    : Separation between dots, in mu units.  Should be \def'd to
%                  a number like 2 or 1.7
%

%% RmS 91/09/29: added \reset@font for page number 
\def\@dottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else
  \vskip \z@ plus.2\p@
  {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
    \parindent #2\relax\@afterindenttrue
   \interlinepenalty\@M
   \leavevmode
   \@tempdima #3\relax \advance\leftskip \@tempdima \hbox{}\hskip -\leftskip
    #4\nobreak\leaders\hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep
       mu$}\hfill \nobreak
           \hbox to\@pnumwidth{\hfil\reset@font\rm #5}\par}\fi}
 
 
%%% Note: \nobreak's added 7 Jan 86 to prevent bad line break that
%%% left the page number dangling by itself at left edge of a new line.
%%%
%%% Changed 25 Jan 88 to use \leftskip instead of \hangindent so
%%% leaders of multiple-line contents entries would line up properly.
 
% \numberline{NUMBER} : For use in a \contentsline command.
%   It puts NUMBER flushleft in a box of width \@tempdima
%   (Before 25 Jan 88 change, it also added \@tempdima to the hanging
%   indentation.)
 
\def\numberline#1{\hbox to\@tempdima{#1\hfil}}
 
\fi % end of LaTeX 2.09 routines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Arabic versions of toc auxiliary routines
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def \a@c@starttoc #1{\endarabtext 
\the\arabtext@hook \@starttoc {#1}\arabtext }
 
\def \a@t@ble #1#2{% \tableofcontents etc.
\a@c@section *{#1}\@mkboth {#1}{#1}\starttoc {#2}}

\def \a@c@@mkboth #1#2{\@mkboth {\RL{#1}}{\RL{#2}}\test@token }

\def \a@@lsection #1#2#3{% common part for \part and \section
	\begin{arabtext}
%	\tocp@rs {\z@ }{\@tempdima }#3 #1 {\hfill \thep@geno {#2}}
	\tocp@rs {\z@ }{\@tempdima }#3 #1 {#3\hfill \thep@geno {#2}}
	\end{arabtext}}

\def \a@dottedtocline #1#2#3#4#5{% for Arabic mode
\ifnum #1>\c@tocdepth 
\else \vskip \z@ plus.2\p@
	\begin{arabtext}
	\tocp@rs {#2}{#3}#4 {\le@ders \thep@geno {#5}}
	\end{arabtext}
\fi }

\def \a@c@tocp@rs #1#2{% change toc parameters
\advance \leftskip #1\relax \advance \a@limit -#1\relax
\advance \leftskip #2\relax \advance \a@limit -#2\relax
\advance \rightskip \@tocrmarg \advance \a@limit -\@tocrmarg
\@tempdima #2\relax % for \numberline, width of number
\parfillskip \z@ \test@token }

\def \a@c@le@ders {% for toc
\setbox \wordb@x \hbox to \z@ {\leaders \hbox 
{$\m@th \mkern \@dotsep mu\hbox {.}\mkern \@dotsep mu$}\hfill }%
\put@word \test@token }

\def \a@c@thep@geno #1{% pagenumber of width \@pnumwidth
\dimen@ \@pnumwidth \advance \dimen@ -\rightskip
\a@c@spreadbox {\dimen@ }{\hss #1 \hspace {-\rightskip }}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\iffalse
\def \a@numberline #1#2{% for arabic mode
#2\hbox to\@tempdima {\hfil \<#1>}}

\def \a@numberline #1\a@RL #2{% for arabic mode
\RL {\spreadbox \@tempdima {#1 \hfill }#2}}
\fi

\def \a@c@numberline #1{% external Arabic command
\a@c@hspace {-\@tempdima }\spreadbox \@tempdima {#1 \hfill }}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\at@arabtext {% modify LaTeX for Arabic mode
	\let \numberline \a@numberline
	\let \@dottedtocline \a@dottedtocline
\if@twocolumn
	\def\@pnumwidth{1.0em}
	\def\@tocrmarg {1em}
\fi
} 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def \a@c@addcontentsline #1#2#3{% Arabic version
\addcontentsline {#1}{#2}{\LR{#3}}\arab@tail }

\let \a@c@abstract \a@c@quotation
\let \endabstract \endquotation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\iffalse % LaTeX 2.09 routines

\def\@starttoc#1{\begingroup
  \makeatletter
  \@input{\jobname.#1}\if@filesw \expandafter\newwrite\csname tf@#1\endcsname
             \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
  \fi \global\@nobreakfalse \endgroup}
 
\fi % end of LaTeX 2.09 routines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\a@sect #1#2#3#4#5#6[#7]#8{% Arabic mode
\ifnum #2 > \c@secnumdepth \let \@svsec \@empty 
\else \refstepcounter{#1}%
	\edef \@svsec 
	{\nxp\RL {\nxp\stdcode {\csname the#1\endcsname }\hskip 1em}}%
\fi
\@tempskipa #5\relax
\ifdim \@tempskipa > \z@
	\begingroup \let \end \a@@par 
		#6\relax \set@arabfont % style
	        \a@hangfrom {\hskip #3\relax \@svsec }% section number
		\test@token #8 \end
	\endgroup
	\csname #1mark\endcsname {\RL {#7}}%
	\addcontentsline {toc}{#1}%
		{\ifnum #2 > \c@secnumdepth \else \protect\numberline 
		{\protect\RL{\protect\stdcode{\csname the#1\endcsname }}}\fi
		\protect\RL {#7}}%
\else \def \@svsechd {% saved head, executed by \everypar
	#6\relax \set@arabfont % style
	\let \a@@end \end \def \end {\let \end \a@@end }%
	\test@token \@svsec % saved section number
	\hskip #3\relax #8 \end
        \csname #1mark\endcsname {\RL {#7}}%
	\addcontentsline {toc}{#1}%
		{\ifnum #2>\c@secnumdepth \else \protect\numberline 
		{\protect\RL{\protect\stdcode{\csname the#1\endcsname }}}\fi
		\protect\RL {#7}}}% \@svsechd
\fi \a@xsect {#5}}

\allowarab \@svsec
 
\def\a@xsect #1{% Arabic mode
\@tempskipa #1\relax
\ifdim \@tempskipa>\z@ \a@@par \nobreak \vskip \@tempskipa
       \a@afterheading
\else \global\@nobreakfalse \global\@noskipsectrue
\a@@everypar {\if@noskipsec \global\@noskipsecfalse \clubpenalty \@M 
        	\putwordb@x {\hskip -\a@parindent }\@svsechd
        	\putwordb@x {\hskip -#1\relax }%
             \else \clubpenalty \@clubpenalty \a@@everypar {}%
             \fi}
\fi \a@spacefalse \test@token }

\def \a@c@numberline #1{% external Arabic command
\a@c@hspace {-\@tempdima }\spreadbox \@tempdima {#1 \hfill }}

\def \a@@lsection #1#2#3{% Text, Pageno, Font
% common part for \part and \section
	\begin{arabtext}
	#3\tocp@rs {\z@ }{\@tempdima }#1 \hfill \thep@geno {#2}
	\end{arabtext}}

\def \a@dottedtocline #1#2#3#4#5{% Level, Indent, Numwidth, Text, Pageno
% for Arabic mode
\ifnum #1>\c@tocdepth 
\else \vskip \z@ plus.2\p@
	\begin{arabtext}
	\tocp@rs {#2}{#3}#4 {\le@ders \thep@geno {#5}}
	\end{arabtext}
\fi }

\def \a@c@tocp@rs #1#2{% Indent, Numwidth
% change toc parameters
\leftskip #1\relax \advance \leftskip #2\relax 
\advance \rightskip \@tocrmarg 
\@tempdima #2\relax % for \numberline, width of number
\a@parindent \z@ \parfillskip \z@ \test@token }

\at@arabtext {% modify LaTeX for Arabic mode
	\let \numberline \a@numberline
	\let \@dottedtocline \a@dottedtocline
}

\c@secnumdepth \c@tocdepth % for test TOC

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%