summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/sanskrit/skt.sty
blob: 70158c886943366933b6b5d1c9e9e26e766bfd3c (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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
%
% SKT.STY
%
% Revision 2.0 1996/11/27 Charles Wikner wikner@nacdh4.nac.ac.za
% Revision 2.2 2002/01/02 Charles Wikner wikner@nac.ac.za
%
% Copyright 1996 & 2002 Charles Wikner
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
\ProvidesFile{skt.sty}[1995/10/27 skt-series sanskrit fonts]
\RequirePackage{relsize}
\RequirePackage{ifthen}
%
\DeclareOption{xitalic}{%
\def\sktx{\usefont{OT1}{cmr}{m}{it}}%
\def\sktX{\usefont{OT1}{cmr}{bx}{it}}%
}
%
\DeclareOption{iitalic}{%
\def\skti{\usefont{OT1}{cmr}{m}{it}}%
\def\sktI{\usefont{OT1}{cmr}{bx}{it}}%
}
%
\DeclareOption{titalic}{%
\def\sktt{\usefont{OT1}{cmr}{m}{it}}%
\def\sktT{\usefont{OT1}{cmr}{bx}{it}}%
}
%
\DeclareOption{uitalic}{%
\def\sktu{\usefont{OT1}{cmr}{m}{it}}%
\def\sktU{\usefont{OT1}{cmr}{bx}{it}}%
}
%
\DeclareOption{larger}{%
\def\skt{\usefont{OT1}{skt}{m}{n}\larger\sktcommon}%
\def\skts{\usefont{OT1}{skt}{m}{sl}\larger\sktcommon}%
\def\sktb{\usefont{OT1}{skt}{b}{n}\larger\sktcommon}%
\def\sktbs{\usefont{OT1}{skt}{b}{sl}\larger\sktcommon}%
\def\sktf{\usefont{OT1}{skt}{f}{n}\larger\sktcommon}%
\def\sktfs{\usefont{OT1}{skt}{f}{sl}\larger\sktcommon}%
}
\def\sktcommon{\tolerance=10000%
               \pretolerance=10000%
               \emergencystretch=.2\hsize%
               \baselineskip 1.333\baselineskip}
%
\ProcessOptions
%
% if the "xitalic" option is not exercised, then ...
\providecommand{\sktx}{\usefont{OT1}{cmr}{m}{n}}%
\providecommand{\sktX}{\usefont{OT1}{cmr}{bx}{n}}
%
% if the "iitalic" option is not exercised, then ...
\providecommand{\skti}{\usefont{OT1}{cmr}{m}{n}}%
\providecommand{\sktI}{\usefont{OT1}{cmr}{bx}{n}}
%
% if the "titalic" option is not exercised, then ...
\providecommand{\sktt}{\usefont{OT1}{cmr}{m}{n}}%
\providecommand{\sktT}{\usefont{OT1}{cmr}{bx}{n}}
%
% if the "uitalic" option is not exercised, then ...
\providecommand{\sktu}{\usefont{OT1}{cmr}{m}{n}}%
\providecommand{\sktU}{\usefont{OT1}{cmr}{bx}{n}}
%
% if the "larger" option is not exercised, then ...
\providecommand{\skt}{\usefont{OT1}{skt}{m}{n}\sktcommon}%
\providecommand{\skts}{\usefont{OT1}{skt}{m}{sl}\sktcommon}%
\providecommand{\sktb}{\usefont{OT1}{skt}{b}{n}\sktcommon}%
\providecommand{\sktbs}{\usefont{OT1}{skt}{b}{sl}\sktcommon}%
\providecommand{\sktf}{\usefont{OT1}{skt}{f}{n}\sktcommon}%
\providecommand{\sktfs}{\usefont{OT1}{skt}{f}{sl}\sktcommon}%
%
\def\@skt#1{{\skt\number #1}}
% This allows the printing of page numbers in Sanskrit
% using LaTeX command "\pagenumbering{skt}".
%
% The SKT preprocessor makes use of the following commands:
%

\protect\newcounter{SKTCNTS}
\protect\newcounter{SKTCNTX}
\protect\newcounter{SKTCNTY}
\protect\newcounter{SKTCNTZ}
\newsavebox{\SKTBOXA}
\newsavebox{\SKTBOXB}
\protect\newlength{\SKTDIMV} % vertical dimensions
\protect\newlength{\SKTDIMH} % horizontal dimensions
\protect\newlength{\SKTDIMS} % scratch dimensions
%
\newcommand{\ZB}[1]%
%     Imbedded Roman punctuation (#1) printed boldface for sktb.
{\textrm{\textbf{{#1}}}%
}
%
\newcommand{\ZN}[1]%
%     Imbedded Roman punctuation (#1) printed boldface for skt.
{\textrm{\textbf{{#1}}}%
}
%
\newcommand{\ZF}[1]%
%     Imbedded Roman punctuation (#1) printed normal weight for sktf.
{\textmd{\textrm{{#1}}}%
}
%
\newcommand{\ZX}[1]%
%     Print full height sktt capital letter string #1
{{\relsize{-1}#1}%
}
%
\newcommand{\ZY}[1]%
%     Print half height sktt capital letter string #1
{{\relsize{-3}#1}}%
%
\newcommand{\ZS}[1]%
%     Horizontal space `cursor' #1 times 1/24 of 1em.
{\setlength{\SKTDIMS}{.041667em}%
 \kern#1\SKTDIMS%
}
%
\newcommand{\ZH}[2]%
%     Horizontal space `cursor' #1 times 1/24 of 1em,
%     print #2, and return `cursor' to original position.
{\setlength{\SKTDIMS}{.041667em}%
 \protect\makebox[0pt][l]{\kern#1\SKTDIMS{{#2}}}%
}
%
\newcommand{\ZV}[2]%
%     Vertical space `cursor' #1 times 1/24 of 1ex,
%     print #2, and return `cursor' to original position.
%     Note: if font is slanted, then increase horizontal
%     space by (font slope) * (vertical space).
{\setlength{\SKTDIMS}{.041667ex}%
 \setlength{\SKTDIMH}{0ex}%
 \setlength{\SKTDIMV}{#1\SKTDIMS}%
 \ifthenelse{\lengthtest{\the\fontdimen1\the\font > 0pt}}%
    {\setlength{\SKTDIMS}{\the\fontdimen1\the\font}%
     \setlength{\SKTDIMS}{.0039062\SKTDIMS}%
     \protect\setcounter{SKTCNTS}{\SKTDIMS}%
     \setlength{\SKTDIMS}{\theSKTCNTS\SKTDIMV}%
     \setlength{\SKTDIMS}{.0039062\SKTDIMS}%
     \addtolength{\SKTDIMH}{\SKTDIMS}%
    }{}%
 \protect\makebox[0pt][l]{\kern\SKTDIMH\protect\raisebox{\SKTDIMV}{{#2}}}%
}
%
\newcommand{\ZW}[1]%
%     In sktt mode underline and print string #1
{\settodepth{\SKTDIMV}{#1}%                  get character depth
 \addtolength{\SKTDIMV}{.45ex}%              additional depth before underline
 \settowidth{\SKTDIMH}{#1}%                  get character width
 \protect\savebox{\SKTBOXA}{\rule{\SKTDIMH}{.15ex}}%  define underline rule
%     The next five lines of code determine how much to offset the line
%     horizontally so as to line up with the slope of the characters,
%     for example when they are italic, the line should shift left slightly.
%     The fontdimen1 specificies the amount of horizontal shift per 1pt
%     height of the character; this dimension is then loaded into an
%     integer counter! The result is a dimensionless slope, which needs
%     to be divided by 65536 (2^16) to convert it to a fraction. This
%     division is done in two stages to prevent overflows.
%     The depth of the rule below the baseline is multiplied by this
%     ratio to determine the horizontal shift needed for the underline.
 \setlength{\SKTDIMS}{\the\fontdimen1\the\font}%
 \setlength{\SKTDIMS}{.0039062\SKTDIMS}%         divide by 256
 \protect\setcounter{SKTCNTS}{\SKTDIMS}%                see TeX book bottom page 118
 \setlength{\SKTDIMH}{\theSKTCNTS\SKTDIMV}%
 \setlength{\SKTDIMH}{.0039062\SKTDIMH}%         divide by 256
%     Now print the rule with its horizontal and vertical offsets, as a
%     zero-width box, i.e. return 'cursor' to point before printing.
 \protect\makebox[0pt][l]{\kern-\SKTDIMH\protect\raisebox{-\SKTDIMV}{\usebox{\SKTBOXA}}}%
 {#1}%    and finally print the basic character(s).
} 
%
\newcommand{\ZZ}[1]%
%     Print character #1 with '..' diacritic beneath it
%     See \ZW command above for detail; the principle is the same.
{\settodepth{\SKTDIMV}{#1}%
 \addtolength{\SKTDIMV}{.5ex}%
 \protect\savebox{\SKTBOXA}{{\kern.02em.\kern-.07em.}}% define diacritic
%     Diacritic horizontal displacement = ( width(char) - width(accent) ) / 2.
 \settowidth{\SKTDIMH}{#1}%
 \settowidth{\SKTDIMS}{\usebox{\SKTBOXA}}%
 \addtolength{\SKTDIMH}{-\SKTDIMS}%
 \setlength{\SKTDIMH}{.5\SKTDIMH}%
%     Determine extra horizontal displacement according to font slope.
 \setlength{\SKTDIMS}{\the\fontdimen1\the\font}%
 \setlength{\SKTDIMS}{.0039062\SKTDIMS}%
 \protect\setcounter{SKTCNTS}{\SKTDIMS}%
 \setlength{\SKTDIMS}{\theSKTCNTS\SKTDIMV}%
 \setlength{\SKTDIMS}{.0039062\SKTDIMS}%
 \addtolength{\SKTDIMH}{-\SKTDIMS}%     combine the two horizontal displacements
%     Now print the diacritic with its horizontal and vertical offsets,
%     as a zero-width box, i.e. return 'cursor' to point before printing.
 \protect\makebox[0pt][l]{\kern\SKTDIMH{\protect\raisebox{-\SKTDIMV}{\usebox{\SKTBOXA}}}}%
 {#1}%    and finally print the basic character(s)
}

\newcommand{\ZA}[2]%
%     Print character #2 with additional diacritics 
%     Range of diacritic code #1 is 0--89, where 0--29 is the accent code
%     and 30 is added to this if the vowel is nasalised (\~) as well; and
%     a further 30 is added to replace the tilde (\~) by breve(\u). Thus
%     0--29 produces the accent only; 30--59 produces a tilde with accent
%     accent above; and 60--89 produces breve with accent above.
%     The accent codes are: 
%     1 Rigveda svarita (!),                2 Rigveda anudaatta (_),
%     3 Rigveda kampa-3 (__3!),             4 Rigveda kampa-1 (_1!),  
%     5 General udaatta (^u),               6 Taittiriiya diirgha svarita (!!),
%     7 Western svarita (\`),               8 Western udaatta (\'), 
%     9 Saamaveda udaatta (^1),            10 Saamaveda svarita (^2), 
%    11 Saamaveda anudaatta (^3),          12 Saamaveda (^2r), 
%    13 Saamaveda (^2u),                   14 Saamaveda (^3k), 
%    15 Saamaveda (1_),                    16 Rig(?)veda (_3!),
%    17 Maitraaya.nii Jaatya Svarita (u),  18 Yajurveda Jaatya Svarita (w),
%    19 Yajurveda Jaatya Svarita (|___),   20 Maitrayaniya Svarita (.),
%    21 Sentence end udaatta (..),         22 Kaa.thaka Anudaatta (!),
%    23 Atharvaveda Jaatya Svarita (s),    24 Kaa.thaka Jaatya (^),
%    25 Maitraaya.nii dependent svarita (!!!).
%     
%     See \ZW command above for detail; the principle is the similar.
{%
 \settoheight{\SKTDIMV}{#2}%
 \protect\setcounter{SKTCNTY}{#1}%
 \protect\savebox{\SKTBOXA}{#2}%
 \setlength{\SKTDIMS}{\the\fontdimen1\the\font}%
 \setlength{\SKTDIMS}{.0039062\SKTDIMS}%
 \protect\setcounter{SKTCNTX}{\SKTDIMS}%                  this value will be used in
% horizontally positioning accents for italic fonts; if non-zero, it also 
% changes the sans serif font used for some accents, to slanted sans serif.
 \ifthenelse{\value{SKTCNTY}>29}%                 add nasal or breve accent
    {\ifthenelse{\value{SKTCNTY}>59}%
        {\protect\savebox{\SKTBOXB}{\u{}}\addtocounter{SKTCNTY}{-60}}%
        {\protect\savebox{\SKTBOXB}{\~{}}\addtocounter{SKTCNTY}{-30}}%
     \addtolength{\SKTDIMV}{-1ex}%
% the next eight lines of code are repeated three more times in this command
     \settowidth{\SKTDIMH}{\usebox\SKTBOXA}%
     \settowidth{\SKTDIMS}{\usebox\SKTBOXB}%
     \addtolength{\SKTDIMH}{-\SKTDIMS}%
     \setlength{\SKTDIMH}{.5\SKTDIMH}%
     \setlength{\SKTDIMS}{\theSKTCNTX\SKTDIMV}%
     \setlength{\SKTDIMS}{.0039062\SKTDIMS}%
     \addtolength{\SKTDIMH}{\SKTDIMS}%
     \protect\makebox[0pt][l]{\kern\SKTDIMH{\protect\raisebox{\SKTDIMV}{\usebox{\SKTBOXB}}}}%
     \protect\setcounter{SKTCNTZ}{#1}%
     \ifthenelse{\value{SKTCNTZ}>59}
        {\addtolength{\SKTDIMV}{1.6ex}}% raise accents above breve a little more
        {\addtolength{\SKTDIMV}{1.5ex}}%
    }{}%
 \addtolength{\SKTDIMV}{.2ex}%
 \ifthenelse{\value{SKTCNTY}>8 \and \value{SKTCNTY}<15}% raise SV accents only
    {\ifthenelse{\lengthtest{\SKTDIMV<1.7ex}}%
        {\setlength{\SKTDIMV}{1.7ex}}%
        {}}%
    {}%
 \protect\savebox{\SKTBOXB}{{}}%  default empty accent box
% Now for the accents themselves:
 \ifthenelse{\value{SKTCNTY}=1}%
    {\ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-3}\mdseries\textsf{\i}}}}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-3}\mdseries\slshape\textsf{\i}}}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=2}%
    {\settodepth{\SKTDIMV}{\usebox\SKTBOXA}%
     \addtolength{\SKTDIMV}{.4ex}%
     \setlength{\SKTDIMV}{-\SKTDIMV}%
     \protect\savebox{\SKTBOXB}{\rule{.3em}{.1ex}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=3}%
    {\settodepth{\SKTDIMV}{\usebox\SKTBOXA}%
     \addtolength{\SKTDIMV}{.4ex}%
     \setlength{\SKTDIMV}{-\SKTDIMV}%
     \protect\savebox{\SKTBOXB}{\rule{.3em}{.1ex}}}%
    {}%
% accent code 4 will use the empty accent box
 \ifthenelse{\value{SKTCNTY}=5}%
    {\protect\savebox{\SKTBOXB}{\protect\raisebox{.1ex}{\relsize{-3}u}}}%
    {}%
% \ifthenelse{\value{SKTCNTY}=6}{\protect\savebox{\SKTBOXB}%
%            {\rule[.1ex]{.05em}{.6ex}\kern.1em\rule[.1ex]{.05em}{.6ex}}}{}%
 \ifthenelse{\value{SKTCNTY}=6}%
    {\ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-3}\mdseries\textsf{\i\i}}}}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-3}\mdseries\slshape\textsf{\i\i}}}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=7}%
    {\protect\savebox{\SKTBOXB}{\`{}}\addtolength{\SKTDIMV}{-1.2ex}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=8}%
    {\protect\savebox{\SKTBOXB}{\'{}}\addtolength{\SKTDIMV}{-1.2ex}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=9}%
    {\ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-4}\mdseries\textsf{1}}}}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-4}\mdseries\slshape\textsf{1}}}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=10}%
    {\ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-4}\mdseries\textsf{2}}}}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-4}\mdseries\slshape\textsf{2}}}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=11}%
    {\ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-4}\mdseries\textsf{3}}}}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-4}\mdseries\slshape\textsf{3}}}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=12}%
    {\ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-4}\mdseries\textsf{2r}}}}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-4}\mdseries\slshape\textsf{2r}}}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=13}%
    {\ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-4}\mdseries\textsf{2u}}}}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-4}\mdseries\slshape\textsf{2u}}}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=14}%
    {\ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-4}\mdseries\textsf{3k}}}}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-4}\mdseries\slshape\textsf{3k}}}}}%
    {}%
% accent codes 15 and 16 will use the empty accent box
 \ifthenelse{\value{SKTCNTY}=17}%
    {\settodepth{\SKTDIMV}{\usebox\SKTBOXA}%
     \addtolength{\SKTDIMV}{.8ex}%
     \setlength{\SKTDIMV}{-\SKTDIMV}%
     \ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\protect\raisebox{-1ex}[0ex][.4ex]{\mdseries\textsf{\u{}}}}}}%
        {\protect\savebox{\SKTBOXB}{{\protect\raisebox{-1ex}[0ex][.4ex]{\mdseries\slshape\textsf{\u{}}}}}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=18}%
    {\settodepth{\SKTDIMV}{\usebox\SKTBOXA}%
     \addtolength{\SKTDIMV}{.3ex}%
     \setlength{\SKTDIMV}{-\SKTDIMV}%
     \ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\protect\raisebox{-1ex}[0ex][.4ex]{\relsize{-3}\mdseries\textsf%
                             {\u{}\kern-.26em\u{}}}}}}%
        {\protect\savebox{\SKTBOXB}{{\protect\raisebox{-1ex}[0ex][.4ex]{\relsize{-3}\mdseries\slshape\textsf%
                             {\u{}\kern-.26em\u{}}}}}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=19}%
    {\settodepth{\SKTDIMV}{\usebox\SKTBOXA}%
     \addtolength{\SKTDIMV}{.5ex}%
     \setlength{\SKTDIMV}{-\SKTDIMV}%
     \protect\savebox{\SKTBOXB}{\kern0.05em\rule{.05em}{.3ex}\kern-.05em\rule{.3em}{.10ex}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=20}%
    {\settodepth{\SKTDIMV}{\usebox\SKTBOXA}%
     \addtolength{\SKTDIMV}{.7ex}%
     \setlength{\SKTDIMV}{-\SKTDIMV}%
     \ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\protect\raisebox{-1ex}[0ex][.4ex]{\relsize{-2}\mdseries\textsf{\symbol{"17}}}}}}%
      {\protect\savebox{\SKTBOXB}{{\kern-.02em\protect\raisebox{-1ex}[0ex][.4ex]{\relsize{-2}\mdseries\slshape\textsf{\symbol{"17}}}}}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=21}%
    {\settodepth{\SKTDIMV}{\usebox\SKTBOXA}%
     \addtolength{\SKTDIMV}{.7ex}%
     \setlength{\SKTDIMV}{-\SKTDIMV}%
     \ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\kern0.035em\protect\raisebox{-1ex}[0ex][.4ex]{\relsize{-2}\mdseries\textsf%
                             {\symbol{"17}\kern-.42em\symbol{"17}}}}}}%
        {\protect\savebox{\SKTBOXB}{{\kern0.035em\protect\raisebox{-1ex}[0ex][.4ex]{\relsize{-2}\mdseries\slshape\textsf%
                             {\symbol{"17}\kern-.42em\symbol{"17}}}}}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=22}%
    {\settodepth{\SKTDIMV}{\usebox\SKTBOXA}%
     \addtolength{\SKTDIMV}{0.9ex}%
     \setlength{\SKTDIMV}{-\SKTDIMV}%
     \ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-3}\mdseries\textsf\i}}}%
        {\protect\savebox{\SKTBOXB}{{\kern.02em\relsize{-3}\mdseries\slshape\textsf\i}}}}%
    {}%
% accent code 23 will use the empty accent box
 \ifthenelse{\value{SKTCNTY}=24}%
    {\settodepth{\SKTDIMV}{\usebox\SKTBOXA}%
     \addtolength{\SKTDIMV}{.8ex}%
     \setlength{\SKTDIMV}{-\SKTDIMV}%
     \ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\protect\raisebox{-1ex}{\mdseries\textsf{\^{}}}}}}%
        {\protect\savebox{\SKTBOXB}{{\kern-.02em\protect\raisebox{-1ex}[0ex][.4ex]{\mdseries\slshape\textsf{\^{}}}}}}}%
    {}%
 \ifthenelse{\value{SKTCNTY}=25}%
    {\ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-3}\mdseries\textsf{\i\i\i}}}}%
        {\protect\savebox{\SKTBOXB}{{\relsize{-3}\mdseries\slshape\textsf{\i\i\i}}}}}%
    {}%
% this space reserved for more accent codes
 \settowidth{\SKTDIMH}{\usebox\SKTBOXA}%        calculate hor. and vert. offsets
 \settowidth{\SKTDIMS}{\usebox\SKTBOXB}%
 \addtolength{\SKTDIMH}{-\SKTDIMS}%
 \setlength{\SKTDIMH}{.5\SKTDIMH}%
 \setlength{\SKTDIMS}{\theSKTCNTX\SKTDIMV}%
 \setlength{\SKTDIMS}{.0039062\SKTDIMS}%
 \addtolength{\SKTDIMH}{\SKTDIMS}%                     and then print the accent
 \protect\makebox[0pt][l]{\kern\SKTDIMH{\protect\raisebox{\SKTDIMV}{\usebox{\SKTBOXB}}}}%
 \usebox{\SKTBOXA}%      print the basic character now so that font is restored 
% Now for those accents that add a following numeral:
 \ifthenelse{\value{SKTCNTY}=3  \or \value{SKTCNTY}=4%
         \or \value{SKTCNTY}=15 \or \value{SKTCNTY}=16}%
    {\ifthenelse{\value{SKTCNTY}=3 \or \value{SKTCNTY}=16}%
        {\protect\savebox{\SKTBOXA}{{\relsize{-2}3}}}%                  save the numeral
        {\protect\savebox{\SKTBOXA}{{\relsize{-2}1}}}%
     \protect\savebox{\SKTBOXB}{\rule{.3em}{.1ex}}%    calculate hor. line below numeral
     \settodepth{\SKTDIMV}{\usebox\SKTBOXA}%
     \addtolength{\SKTDIMV}{.4ex}%
     \setlength{\SKTDIMV}{-\SKTDIMV}%
     \settowidth{\SKTDIMH}{\usebox\SKTBOXA}%
     \settowidth{\SKTDIMS}{\usebox\SKTBOXB}%
     \addtolength{\SKTDIMH}{-\SKTDIMS}%
     \setlength{\SKTDIMH}{.5\SKTDIMH}%
     \setlength{\SKTDIMS}{\theSKTCNTX\SKTDIMV}%
     \setlength{\SKTDIMS}{.0039062\SKTDIMS}%
     \addtolength{\SKTDIMH}{\SKTDIMS}%                  and then print under-bar
     \protect\makebox[0pt][l]{\kern\SKTDIMH{\protect\raisebox{\SKTDIMV}{\usebox{\SKTBOXB}}}}%
% If the accent numeral is to have a vertical line above it, then calculate it:
     \ifthenelse{\value{SKTCNTY}=3 \or \value{SKTCNTY}=4 \or \value{SKTCNTY}=16}%
        {\ifthenelse{\value{SKTCNTX}=0}%
            {\protect\savebox{\SKTBOXB}{{\relsize{-3}\mdseries\textsf{\i}}}}%
            {\protect\savebox{\SKTBOXB}{{\relsize{-3}\mdseries\slshape\textsf{\i}}}}%
         \settoheight{\SKTDIMV}{\usebox\SKTBOXA}%
         \addtolength{\SKTDIMV}{.3ex}%
         \settowidth{\SKTDIMH}{\usebox\SKTBOXA}%
         \settowidth{\SKTDIMS}{\usebox\SKTBOXB}%
         \addtolength{\SKTDIMH}{-\SKTDIMS}%
         \setlength{\SKTDIMH}{.5\SKTDIMH}%
         \setlength{\SKTDIMS}{\theSKTCNTX\SKTDIMV}%
         \setlength{\SKTDIMS}{.0039062\SKTDIMS}%
         \addtolength{\SKTDIMH}{\SKTDIMS}%          and then print the over-line
         \protect\makebox[0pt][l]{\kern\SKTDIMH{\protect\raisebox{\SKTDIMV}{\usebox{\SKTBOXB}}}}}
        {}%
     \usebox{\SKTBOXA}}%                     and print the accent numeral itself
    {}%
% Now for the <s> accent
 \ifthenelse{\value{SKTCNTY}=23}%
    {\ifthenelse{\value{SKTCNTX}=0}%
        {\protect\savebox{\SKTBOXB}{{\kern.075em{\relsize{-3}\mdseries\textsf%
                 {\protect\raisebox{.35ex}{\j}\kern-.365em\protect\raisebox{.15ex}{\'{}}}}}}}%
        {\protect\savebox{\SKTBOXB}{{\kern.075em{\relsize{-3}\mdseries\slshape\textsf%
                 {\protect\raisebox{.30ex}{\j}\kern-.385em\protect\raisebox{.10ex}{\'{}}}}}}}%
     \usebox{\SKTBOXB}}%                                print the accent itself
    {}%
% Finally, add strut to ensure at least .2ex separation from previous text line.
 \settoheight{\SKTDIMS}{\usebox{\SKTBOXB}}%
 \addtolength{\SKTDIMV}{\SKTDIMS}%
 \addtolength{\SKTDIMV}{.2ex}%
 \rule{0pt}{\SKTDIMV}% 
}
%
%---------------------------------------------------------------------------
%

%
% Print string at relative position x,y: \ZP{x}{y}{string}
%
\newcommand{\ZP}[3]%
%     Horizontal space `cursor' #1 times 1/24 of 1em,
%     vertical space `cursor' #2 times 1/24 of 1em,
%     print #3, and return `cursor' to original position.
%     Note: if font is slanted, then increase horizontal
%     space by (font slope) * (vertical space).
{\setlength{\SKTDIMS}{.041667em}%
%\typeout{ZP:x=#1,y=#2,z=#3 }%
 \setlength{\SKTDIMH}{#1\SKTDIMS}%
 \setlength{\SKTDIMS}{.041667ex}%
 \setlength{\SKTDIMV}{#2\SKTDIMS}%
 \ifthenelse{\lengthtest{\the\fontdimen1\the\font > 0pt}}%
    {\setlength{\SKTDIMS}{\the\fontdimen1\the\font}%
     \setlength{\SKTDIMS}{.0039062\SKTDIMS}%
     \protect\setcounter{SKTCNTS}{\SKTDIMS}%
     \setlength{\SKTDIMS}{\theSKTCNTS\SKTDIMV}%
     \setlength{\SKTDIMS}{.0039062\SKTDIMS}%
     \addtolength{\SKTDIMH}{\SKTDIMS}%
    }{}%
 \protect\makebox[0pt][l]{\kern\SKTDIMH\protect\raisebox{\SKTDIMV}{{#3}}}%
}

%
% Print \ZL{xxx} string of encoded mini-chars:
%
\newcommand{\ZL}[1]{\ZT #1{}{}{}\endZT}

%
% Decode mini-char value and print it, then loop: only used by \ZL.
%
\def\ZT #1#2#3\endZT{\ZC{#1}\symbol{\value{SKTCNTS}}%
                      \loop%
                      \ifnum\catcode`#2 > 10%
                      \ZT #2#3{}\endZT%
                      \repeat%
}

%
% Decode a mini-char value in \ZL or \ZM commands.
%
\newcommand{\ZC}[1]{%
  \protect\setcounter{SKTCNTS}{`#1}%           set value = ASCII code + 128
  \addtocounter{SKTCNTS}{128}%
  \ifthenelse{\catcode`#1 = 12}%        check for category codes 11 or 12
             {}%
             {\ifthenelse{\catcode`#1 = 11}%
                         {}%
                         {\errmessage{SKT macro ZC: invalid parameter "#1"}%
                          \protect\setcounter{SKTCNTS}{0}%  set error value to zero.
                         }%
             }%$
}

%
% Print encoded mini-char position string \ZM{xycxyc...}
%
\newcommand{\ZM}[1]{\protect\ZR #1!}

%
% Extract X-position, Y-position, decode mini-char, print it, and loop:
% only used by ZQ command.
%
\def\ZR #1#2#3#4!{%
                         \ZD{#1}\protect\setcounter{SKTCNTX}{\value{SKTCNTS}}%
                         \ZD{#2}\protect\setcounter{SKTCNTY}{\value{SKTCNTS}}%
                         \ZC{#3}\protect\setcounter{SKTCNTZ}{\value{SKTCNTS}}%
                         \ZP{\theSKTCNTX}{\theSKTCNTY}{\symbol{\theSKTCNTZ}}%
                         \ifthenelse{\equal{#4}{}}{}{\ZR #4!}%
}

%
% Decode a position value: only used by \ZM command.
%
\newcommand{\ZD}[1]{%
  \protect\setcounter{SKTCNTS}{0}%      set default value = 0
  \ifthenelse{\equal{#1}{0}}%    if char. not "0", then ...
             {}%
             {\ifthenelse{\catcode`#1 = 11}%             if A-Z or a-z, then ...
                         {\protect\setcounter{SKTCNTS}{`#1}%    convert A-Z to   1-26,
                          \addtocounter{SKTCNTS}{-64}%      and a-z to -(1-26).
                          \ifthenelse{\value{SKTCNTS} > 32}%
                                     {\protect\setcounter{SKTCNTS}{-\value{SKTCNTS}}%
                                      \addtocounter{SKTCNTS}{32}%
                                     }%
                                     {}%
                         }%
                         {\errmessage{SKT macro ZD: invalid parameter "#1"}}%
             }%
}

%
% All naagarii accent characters are in the form \ZK{x} where `x' is the 
% accent character. To colour the accents separately, this command may be
% redefined anywhere in the .skt file as \renewcommand{\ZK}[1]{{\red #1}}.
% It actually makes the text easier to read when the accents are coloured.
%
\newcommand{\ZK}[1]{{#1}}

\endinput