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
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
|
% \iffalse meta-comment
%
%Copyright 2019--2022 Uroš Stefanović,
%2002--2019 Filip Brčić
%All rights reserved.
%
% This file is intended to be used with the Babel system.
% ------------------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work is Uroš Stefanović.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
% \fi
% \iffalse
% Tell the \LaTeX\ system who we are and write an entry on the
% transcript.
%<*dtx>
\ProvidesFile{serbianc.dtx}
%</dtx>
%<code>\ProvidesLanguage{serbianc}
%\fi
%\ProvidesFile{serbianc.dtx}
[2022/09/30 3.2a Serbian Cyrillic support for the Babel system]
%\iffalse
%% File `serbianc.dtx'
%
% This file is part of the babel system, it provides the source
% code for the Serbian Cyrillic language definition file.
%<*filedriver>
\documentclass{ltxdoc}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[a4paper,top=2.0cm,left=3cm,right=2.5cm,bottom=2cm,includefoot,includehead]{geometry}
\title{The Serbian Cyrillic Language in the \babel\ system}
\author{Uroš Stefanović\footnote{\texttt{urostajms@gmail.com}}}
\newcommand*\babel{\textsf{babel}}
\newcommand*\langvar{$\langle \it lang \rangle$}
\newcommand*\note[1]{}
\newcommand*\Lopt[1]{\textsf{#1}}
\newcommand*\file[1]{\texttt{#1}}
\begin{document}
\maketitle
\DocInput{serbianc.dtx}
\end{document}
%</filedriver>
%\fi
% \GetFileInfo{serbianc.dtx}
%
% \section*{Serbian Cyrillic Language}
%
% The file \file{\filename} defines all the language definition
% macros for Serbian language, typeset in a Cyrillic script.
%
% For this language the character |"| is made active. In
% table~\ref{tab:serbianc-quote} an overview is given of its
% purpose. One of the reasons for this is that, in the Serbian
% language, some special characters are used.
%
% \begin{table}[htb]
% \begin{center}
% \begin{tabular}{lp{8cm}}
% |"-| & An explicit hyphen sign, allowing hyphenation
% in the rest of the word; inserts a hyphen which is repeated at the beginning of the
% next line (recommended to use for compound words with hyphen). \\
% \verb="|= & Disables ligature at this position. \\
% |""| & Similar to |"-| but prints no hyphen sign. \\
% |"~| & Compound word mark without a breakpoint, prints hyphen
% prohibiting hyphenation at the point. \\
% |"=| & A compound word mark with a breakpoint, prints hyphen
% allowing hyphenation in the composing words. \\
% |"`| & German opening double quote (looks like ,\kern-0.08em,). \\
% |"'| & German closing double quote (looks like ``). \\
% |"'| & (if the \Lopt{quotes} attribute is used) Closing double quote (looks like ''). \\
% |"<| & French opening double quote (looks like $<\!\!<$). \\
% |">| & French closing double quote (looks like $>\!\!>$). \\
% \end{tabular}
% \caption{The extra definitions made
% by \file{serbianc.ldf}}\label{tab:serbianc-quote}
% \end{center}
% \end{table}
%
% Macro |\today| prints the date in Serbian. Alternatively, if attribute \Lopt{datei} is used,
% |\today| prints the current date, but prints `јуни' and `јули' for `June' and `July'.
% If you prefer to use `јуни' and `јули' instead of default `јун' and `јул',
% use the \Lopt{datei} attribute. Also, the |\today*| macro prints the date without dot after the year
% (used when after the date is the punctuation mark, such as comma).
% Alternatively, the commands |\todayRoman| and |\todayRoman*| prints the current date using Roman numerals for months;
% |\todayGen| and |\todayGen*| prints the current month name in the genitive case,
% and |\todayArabic| and |\todayArabic*| prints the current month as a number.
%
% The alphabetical enumerations in texts use the Cyrillic alphabet and alphabetic order (all 30 letters of the Serbian language are used).
% Also, the Serbian language allows enumeration with the Latin alphabet.
% If the Latin alphabet is used in the enumeration the letters q, w, x and y are omitted by the rules of the Serbian language
% (22 letters are used in that case).
% However, if the user wants to use the English alphabet for the enumeration (26 letters), this option is also available.
% One can manually switch the enumeration alphabet with the commands |\enumCyr|, |\enumLat| and |\enumEng|.
% This commands can be used after the |\begin{document}| when the \Lopt{serbianc} language is active.
% In principle, enumerations are a matter for class and style designers but the same can be
% said also about things, other than enumerations, such as names of sections and bibliography lists.
%
% Apart from defining shorthands, we need to make sure that the
% first paragraph of each section is indented. Furthermore, the
% following new math operators are defined: |\sh|, |\ch|, |\tg|, |\ctg|,
% |\arctg|, |\arcctg|, |\th|, |\cth|, |\arsh|,
% |\arch|, |\arth|, |\arcth|, |\cosec|, |\Prob|, |\Expect|, |\Variance|,
% |\arcsec|, |\arccosec|, |\sech|, |\cosech|, |\arsech|, |\arcosech|,
% |\NZD|, |\nzd|, |\NZS|, |\nzs|. Cyrillic letters
% in math mode can be typed with the aid of text commands such as |\textbf|, |\textsf|, |\textit|,
% |\texttt|, e.t.c.
%
% By default, ekavian spelling is enabled. Ijekavian
% spelling can be enabled by setting the attribute to \Lopt{ijekav}. To set
% an attribute, put the |\languageattribute| macro within a document preamble after
% \babel, for example,
%\begin{verbatim}
% \usepackage[english,serbianc]{babel}
% \languageattribute{serbianc}{ijekav}
%\end{verbatim}
% Setting the \Lopt{ijekav} attribute changes the built-in strings (caption names).
% For example, the part will be entitled as
% `Део' by default and as `Дио' if the
% Serbianc language attribute is set to \Lopt{ijekav}.
% Same result can be achieved using a modifier as follows:
%\begin{verbatim}
% \usepackage[english,serbianc.ijekav]{babel}
%\end{verbatim}
% Using a modifier in a package option is often better. A modifier is set after
% the language name, and is prefixed with a dot (only when the language is set
% as package option — neither global options nor the main key accept them).
% Also, it's possible to use more than one attribute:
%\begin{verbatim}
% \usepackage[english,serbianc.ijekav.datei.quotes]{babel}
%\end{verbatim}
%
% The file \file{serbianc.ldf} is designed to work both with
% legacy non-unicode (8-bit) and new Unicode encodings of the source document
% files (input encodings) and of the font files (font encodings). This is
% achieved by excluding (bypassing) the |\cyr...| macros, which map every letter
% in a source file with given input encoding to a corresponding code point in a
% font file with a given font encoding when running modern engines, such as
% Lua\LaTeX\ or Xe\LaTeX, in native Unicode mode instead of legacy engines, such
% as \LaTeX\ or PDF\LaTeX, or Unicode engines in a compatibility (8-bit) mode.
%
% For Lua\LaTeX\ or Xe\LaTeX\ one needs to load the |fontspec| package.
% The following example shows how to load Computer Modern Unicode (CMU) fonts (which is a
% part of all modern \LaTeX\ distributions), and also to get correct italic shape of the letters |б|, |г|, |д|, |п| and |т| for Serbian language:
%\begin{verbatim}
% \usepackage{fontspec}
% \defaultfontfeatures{Ligatures={TeX},Language=Serbian,Script=Cyrillic}
% \setmainfont{CMU Serif}
% \setsansfont{CMU Sans Serif}
% \setmonofont{CMU Typewriter Text}
% \usepackage[english,serbianc]{babel}
%\end{verbatim}
%
% \StopEventually{}
%
% \section*{The code}
%
% The macro |\LdfInit| takes care of preventing this file from
% loading more than once, checking the category code of the
% \texttt{@} sign, etc.
%
% \begin{macrocode}
%<*code>
\LdfInit{serbianc}{captionsserbianc}
% \end{macrocode}
%
% First, we check if Lua\LaTeX\ or Xe\LaTeX\ is running. If it is, we set
% the boolean key |\if@srbc@uni@ode| to true. It will be used to eliminate |\cyr...|
% commands, which were introduced in \LaTeX2e\ to handle various
% Cyrillic input encodings. With the introduction of Unicode, \LaTeX\ is
% moving to universal input encoding, so we consider these |\cyr...|
% commands obsolete. However, they are still preserved for backward
% compatibility in case \LaTeX\ or PDF\LaTeX\ are running.
%
% \begin{macrocode}
\ifdefined\if@srbc@uni@ode
\PackageError{babel}{if@srbc@uni@ode already defined.}
\relax
\fi
\newif\if@srbc@uni@ode
\ifdefined\luatexversion \@srbc@uni@odetrue \else
\ifdefined\XeTeXrevision \@srbc@uni@odetrue \fi\fi
% \end{macrocode}
%
% Check if hyphenation patterns for the Serbianc language have been
% loaded in \file{language.dat}. Namely, we check for the existence of
% |\l@serbianc|. If it is not defined, we declare Serbianc as dialect
% for the default language number 0, which is almost certainly English.
%
% \begin{macrocode}
\ifx\l@serbianc\@undefined
\@nopatterns{Serbianc}
\adddialect\l@serbianc0
\fi
% \end{macrocode}
%
% There is a limited list of encodings appropriate for Serbian Cyrillic text. We
% will look at which one of them is declared and keep its name in the macro
% |\cyrillicencoding|.
% The correct 7-bit Cyrillic encoding is \texttt{OT2}.
% The correct 8-bit Cyrillic encodings are
% \texttt{T2A} (default for 8-bit compilers) and \texttt{X2}.
% The correct utf8 encodings are
% \texttt{TU} (default for Xe\LaTeX\ and Lua\LaTeX),
% \texttt{EU1} (obsolete, formerly used for Xe\LaTeX),
% \texttt{EU2} (obsolete, formerly used for Lua\LaTeX).
%
% In 8-bit (\LaTeX) mode, the user may choose a different non-unicode Cyrillic
% encoding---\texttt{X2} or \texttt{OT2}. If one wants
% to use another font encoding rather than default (\texttt{T2A}),
% he or she has to load the corresponding file \emph{before} \file{babel.sty}.
%
% Remember that, for the Serbian language, the \texttt{T2A} encoding is
% better than \texttt{X2}, because \texttt{X2} does not contain Latin
% letters, and users should pay attention and switch the language
% every time they want to type a Latin word inside a Serbian phrase
% or vice versa.
%
% We parse the |\cdp@list| containing encodings known to \LaTeX\
% in the order in which they have been loaded by the time \texttt{babel} is called.
% We set the |\cyrillicencoding| to the \emph{last} loaded encoding in the
% list of supported Cyrillic encodings: \texttt{OT2},
% \texttt{X2}, \texttt{T2A}. In Unicode mode,
% |\cyrillicencoding| is set to \texttt{TU} by \texttt{fontspec}. Nevertheless,
% here we provide similar definitions; 8-bit encodings are kept for Unicode
% compilers (Lua\LaTeX\ and Xe\LaTeX) since they can run in compatibility
% (8-bit) mode.
%
% \begin{macrocode}
\def\@setcyrillicencoding{%
\def\sce@a##1##2{%
\edef\sce@b{##1}%
\edef\sce@c{##2}%
\ifx\sce@b\sce@c
\let\cyrillicencoding\sce@c
\fi}%
\def\cdp@elt##1##2##3##4{%
\sce@a{##1}{OT2}%
\sce@a{##1}{X2}%
\sce@a{##1}{T2A}%
\if@srbc@uni@ode
\sce@a{##1}{TU}%
\fi}%
\cdp@list
}
\ifx\cyrillicencoding\undefined
\@setcyrillicencoding
\fi
\@onlypreamble\@setcyrillicencoding
\@onlypreamble\sce@a
\@onlypreamble\sce@b
\@onlypreamble\sce@c
\ifx\cyrillicencoding\undefined
\if@srbc@uni@ode
\edef\cyrillicencoding{TU}
\else
\edef\cyrillicencoding{T2A}
\fi
\PackageWarning{babel}%
{No Cyrillic font encoding has been loaded so far.\MessageBreak
A font encoding should be declared before babel.\MessageBreak
Default `\cyrillicencoding' encoding will be loaded
}%
\lowercase\expandafter{\expandafter\input\cyrillicencoding enc.def\relax}%
\AtBeginDocument{\@setcyrillicencoding}
\fi
% \end{macrocode}
%
% We define the macro |\Serbianc| simply as an alias for
% |\selectlanguage{serbianc}|.
%
% \begin{macrocode}
\DeclareRobustCommand{\Serbianc}{\selectlanguage{\serbianc}}
% \end{macrocode}
%
% We define |\cyrillictext| and its alias |\cyr|; these macros are intended for use within the \texttt{babel} macros and
% do not perform the complete change of the language.
%
% In particular, they to do not change the captions and the name of current
% language stored in the macro |\languagename|. This inconsistency might
% break some assumptions embedded into \texttt{babel}.
% For example, the |\iflanguage| macro will fail.
%
% Furthermore, |\cyrillictext| does
% not activate shorthands, so |"<|, |">|, |"`|, |"'|, e.t.c. will not work.
%
% Lastly, |\cyrillictext| does not write its trace
% to \file{.aux} file, which might result in wrong typesetting of
% table of contents, list of tables and list of figures in multilingual
% documents.
%
% For these reasons, the use of the declaration |\cyrillictext| and
% its aliases in ordinary text is strongly discouraged. Instead of the
% declaration |\cyrillictext|, it is recommended to use |\Serbianc| or the
% command |\foreignlanguage| defined in the \texttt{babel} core; their
% functionality is similar to |\selectlanguage{serbianc}|, but they do not
% change caption names, dates and shorthands.
%
% \begin{macrocode}
\DeclareRobustCommand{\cyrillictext}{%
\fontencoding\cyrillicencoding\selectfont
\let\encodingdefault\cyrillicencoding
\expandafter\set@hyphenmins\serbianchyphenmins
\language\l@serbianc}%
\let\cyr\cyrillictext
% \end{macrocode}
%
% The macro |\textcyrillic| takes an argument which is then typeset using the
% |\cyrillictext| declaration.
%
% \begin{macrocode}
\DeclareTextFontCommand{\textcyrillic}{\cyrillictext}
% \end{macrocode}
%
% For Serbian, the \texttt{"} character is made active. This is done
% once; later on, its definition may vary. Other languages in the
% same document may also use the \texttt{"}~character for
% shorthands; we specify that the Serbian group of shorthands
% should be used. We save the original double quote character
% in the |\dq| macro to keep it available. The shorthand \texttt{"-}
% should be used in places where a word contains an explictit
% hyphenation character. According to the rules of the Serbian language, when
% a word break occurs at an explicit hyphen, it must appear both at the end of the
% first line and at the beginning of the second line.
%
% \begin{macrocode}
\initiate@active@char{"}
\begingroup \catcode`\"12
\def\reserved@a{\endgroup
\def\@SS{\mathchar"7019 }
\def\dq{"}}
\reserved@a
\declare@shorthand{serbianc}{"`}{\quotedblbase}
\declare@shorthand{serbianc}{"'}{\textquotedblleft}
\declare@shorthand{serbianc}{"<}{\guillemotleft}
\declare@shorthand{serbianc}{">}{\guillemotright}
\declare@shorthand{serbianc}{""}{\hskip\z@skip}
\declare@shorthand{serbianc}{"~}{\textormath{\leavevmode\hbox{-}}{-}}
\declare@shorthand{serbianc}{"=}{\nobreak-\hskip\z@skip}
\declare@shorthand{serbianc}{"|}{\textormath{\nobreak\discretionary{-}{}{\kern.03em}\allowhyphens}{}}
\declare@shorthand{serbianc}{"-}{\nobreak\discretionary{-}{-}{-}\bbl@allowhyphens}
% \end{macrocode}
%
% The |\cyrdash| macro will be defined if it hadn't already been defined in a fontenc file. For |T2A| and |X2| fonts,
% |cyrdash| will be placed in the code of the English emdash.
%
% \begin{macrocode}
\ProvideTextCommandDefault{\cyrdash}{\hbox to.8em{--\hss--}}
% \end{macrocode}
%
% The macro |\captionsserbianc| defines all strings used in the four
% standard documentclasses provided by \LaTeX.
%
% \begin{macrocode}
\if@srbc@uni@ode
\addto\captionsserbianc{%
\def\prefacename{Предговор}%
\def\refname{Литература}%
\def\abstractname{Сажетак}%
\def\bibname{Библиографија}%
\def\chaptername{Глава}%
\def\appendixname{Додатак}%
\def\contentsname{Садржај}%
\def\listfigurename{Списак слика}%
\def\listtablename{Списак табела}%
\def\indexname{Индекс}%
\def\figurename{Слика}%
\def\tablename{Табела}%
\def\partname{Део}%
\def\enclname{Прилози}%
\def\ccname{Копије}%
\def\headtoname{Прима}%
\def\pagename{страна}%
\def\seename{види}%
\def\alsoname{види такође}%
\def\proofname{Доказ}%
\def\glossaryname{Речник}%
}%
\let\captionsserbianc@ijekav=\captionsserbianc
\addto\captionsserbianc@ijekav{%
\def\partname{Дио}%
\def\glossaryname{Рjечник}%
}
\else
\addto\captionsserbianc{%
\def\prefacename{{\cyr\CYRP\cyrr\cyre\cyrd\cyrg\cyro\cyrv\cyro\cyrr}}%
\def\refname{{\cyr\CYRL\cyri\cyrt\cyre\cyrr\cyra\cyrt\cyru\cyrr\cyra}}%
\def\abstractname{{\cyr\CYRS\cyra\cyrzh\cyre\cyrt\cyra\cyrk}}%
\def\bibname{{\cyr\CYRB\cyri\cyrb\cyrl\cyri\cyro\cyrg\cyrr\cyra\cyrf\cyri\cyrje\cyra}}%
\def\chaptername{{\cyr\CYRG\cyrl\cyra\cyrv\cyra}}%
\def\appendixname{{\cyr\CYRD\cyro\cyrd\cyra\cyrt\cyra\cyrk}}%
\def\contentsname{{\cyr\CYRS\cyra\cyrd\cyrr\cyrzh\cyra\cyrje}}%
\def\listfigurename{{\cyr\CYRS\cyrp\cyri\cyrs\cyra\cyrk\ \cyrs\cyrl\cyri\cyrk\cyra}}%
\def\listtablename{{\cyr\CYRS\cyrp\cyri\cyrs\cyra\cyrk\ \cyrt\cyra\cyrb\cyre\cyrl\cyra}}%
\def\indexname{{\cyr\CYRI\cyrn\cyrd\cyre\cyrk\cyrs}}%
\def\figurename{{\cyr\CYRS\cyrl\cyri\cyrk\cyra}}%
\def\tablename{{\cyr\CYRT\cyra\cyrb\cyre\cyrl\cyra}}%
\def\partname{{\cyr\CYRD\cyre\cyro}}%
\def\enclname{{\cyr\CYRP\cyrr\cyri\cyrl\cyro\cyrz\cyri}}%
\def\ccname{{\cyr\CYRK\cyro\cyrp\cyri\cyrje\cyre}}%
\def\headtoname{{\cyr\CYRP\cyrr\cyri\cyrm\cyra}}%
\def\pagename{{\cyr\cyrs\cyrt\cyrr\cyra\cyrn\cyra}}%
\def\seename{{\cyr\cyrv\cyri\cyrd\cyri}}%
\def\alsoname{{\cyr\cyrv\cyri\cyrd\cyri\ \cyrt\cyra\cyrk\cyro\cyrdje\cyre}}%
\def\proofname{{\cyr\CYRD\cyro\cyrk\cyra\cyrz}}%
\def\glossaryname{{\cyr\CYRR\cyre\cyrch\cyrn\cyri\cyrk}}%
}%
\let\captionsserbianc@ijekav=\captionsserbianc
\addto\captionsserbianc@ijekav{%
\def\partname{{\cyr\CYRD\cyri\cyro}}%
\def\glossaryname{{\cyr\CYRR\cyrje\cyre\cyrch\cyrn\cyri\cyrk}}%
}
\fi
% \end{macrocode}
%
% The macro |\dateserbianc| redefines the commands |\today|, |\today*|, |\todayRoman| and |\todayRoman*| to produce Serbian dates.
% Also, the commands |\todayGen|, |\todayGen*|, |\todayArabic| and |\todayArabic*| are provided.
%
% \begin{macrocode}
\if@srbc@uni@ode
\addto\dateserbianc{%
\def\month@serbianc{\ifcase\month\or
јануар\or
фебруар\or
март\or
април\or
мај\or
јун\or
јул\or
август\or
септембар\or
октобар\or
новембар\or
децембар\fi}%
\def\month@serbianc@gen{\ifcase\month\or
јануара\or
фебруара\or
марта\or
априла\or
маја\or
јуна\or
јула\or
августа\or
септембра\or
октобра\or
новембра\or
децембра\fi}%
\def\today{\number\day.~\month@serbianc\ \number\year\@ifstar{}{.}}%
\def\todayRoman{\number\day.~\@Roman\month~\number\year\@ifstar{}{.}}%
\def\todayGen{\number\day.~\month@serbianc@gen\ \number\year\@ifstar{}{.}}%
\def\todayArabic{\number\day.~\number\month.~\number\year\@ifstar{}{.}}}
\let\dateserbianc@datei=\dateserbianc
\addto\dateserbianc@datei{%
\def\month@serbianc@datei{\ifnum\month=6 јуни%
\else\ifnum\month=7 јули\else\month@serbianc\fi\fi}%
\def\today{\number\day.~\month@serbianc@datei\ \number\year\@ifstar{}{.}}}
\else
\def\dateserbianc{%
\def\month@serbianc{\ifcase\month\or
\cyrje\cyra\cyrn\cyru\cyra\cyrr\or
\cyrf\cyre\cyrb\cyrr\cyru\cyra\cyrr\or
\cyrm\cyra\cyrr\cyrt\or
\cyra\cyrp\cyrr\cyri\cyrl\or
\cyrm\cyra\cyrje\or
\cyrje\cyru\cyrn\or
\cyrje\cyru\cyrl\or
\cyra\cyrv\cyrg\cyru\cyrs\cyrt\or
\cyrs\cyre\cyrp\cyrt\cyre\cyrm\cyrb\cyra\cyrr\or
\cyro\cyrk\cyrt\cyro\cyrb\cyra\cyrr\or
\cyrn\cyro\cyrv\cyre\cyrm\cyrb\cyra\cyrr\or
\cyrd\cyre\cyrc\cyre\cyrm\cyrb\cyra\cyrr\fi}%
\def\month@serbianc@gen{\ifcase\month\or
\cyrje\cyra\cyrn\cyru\cyra\cyrr\cyra\or
\cyrf\cyre\cyrb\cyrr\cyru\cyra\cyrr\cyra\or
\cyrm\cyra\cyrr\cyrt\cyra\or
\cyra\cyrp\cyrr\cyri\cyrl\cyra\or
\cyrm\cyra\cyrje\cyra\or
\cyrje\cyru\cyrn\cyra\or
\cyrje\cyru\cyrl\cyra\or
\cyra\cyrv\cyrg\cyru\cyrs\cyrt\cyra\or
\cyrs\cyre\cyrp\cyrt\cyre\cyrm\cyrb\cyrr\cyra\or
\cyro\cyrk\cyrt\cyro\cyrb\cyrr\cyra\or
\cyrn\cyro\cyrv\cyre\cyrm\cyrb\cyrr\cyra\or
\cyrd\cyre\cyrc\cyre\cyrm\cyrb\cyrr\cyra\fi}%
\def\today{\number\day.~\month@serbianc\ \number\year\@ifstar{}{.}}%
\def\todayRoman{\number\day.~\@Roman\month~\number\year\@ifstar{}{.}}%
\def\todayGen{\number\day.~\month@serbianc@gen\ \number\year\@ifstar{}{.}}%
\def\todayArabic{\number\day.~\number\month.~\number\year\@ifstar{}{.}}}
\let\dateserbianc@datei=\dateserbianc
\addto\dateserbianc@datei{%
\def\month@serbianc@datei{\ifnum\month=6\cyrje\cyru\cyrn\cyri%
\else\ifnum\month=7\cyrje\cyru\cyrl\cyri\else\month@serbianc\fi\fi}%
\def\today{\number\day.~\month@serbianc@datei\ \number\year\@ifstar{}{.}}
}
\fi
% \end{macrocode}
%
% The Serbian hyphenation patterns can be used with |\lefthyphenmin| and
% |\righthyphenmin| set to~2. (Actually, the “official” definition allows even one character for |lefthyphen|,
% but it is recommended to use the value two for the better results.)
%
% \begin{macrocode}
\providehyphenmins{\CurrentOption}{\tw@\tw@}
\providehyphenmins{serbianc}{\tw@\tw@}
% \end{macrocode}
%
% We instruct babel to switch font encoding using earlier defined macros
% |\cyrillictext| and |\latintext|.
%
% \begin{macrocode}
\addto\extrasserbianc{\cyrillictext}
\addto\noextrasserbianc{\latintext}
% \end{macrocode}
%
% Also, we specify that the Serbian group of shorthands should be used.
%
% \begin{macrocode}
\addto\extrasserbianc{\languageshorthands{serbianc}}
\addto\extrasserbianc{\bbl@activate{"}}
\addto\noextrasserbianc{\bbl@deactivate{"}}
% \end{macrocode}
%
% Serbian typesetting requires |frenchspacing|. So, we add commands to
% |\extrasserbianc| and |\noextrasserbianc| to turn it on and off, respectively.
%
% \begin{macrocode}
\addto\extrasserbianc{\bbl@frenchspacing}
\addto\noextrasserbianc{\bbl@nonfrenchspacing}
% \end{macrocode}
%
% In Serbian, the first paragraph of each section should be indented.
%
% \begin{macrocode}
\let\@aifORI\@afterindentfalse
\def\bbl@serbiancindent{\let\@afterindentfalse\@afterindenttrue\@afterindenttrue}
\def\bbl@nonserbiancindent{\let\@afterindentfalse\@aifORI\@afterindentfalse}
\addto\extrasserbianc{\bbl@serbiancindent}
\addto\noextrasserbianc{\bbl@nonserbiancindent}
% \end{macrocode}
%
% We redefine the macro |\Alph|, which now produces (uppercase) Cyrillic letters instead of Latin
% ones when Serbian is switched on. Also we will define Serbian Latin and English alphabets so
% the user can choose which alphabet to use through the commands |\enumCyr|, |\enumLat| and |\enumEng|
% (or even to switch from one enumeration to another).
%
% \begin{macrocode}
\newcount\srbc@lettering \srbc@lettering=\z@
\addto\extrasserbianc{\babel@save\@Alph \let\@Alph\srbc@Alph}
\def\srbc@Alph#1{%
\ifcase\srbc@lettering
\if@srbc@uni@ode
\ifcase#1\or А\or Б\or В\or Г\or Д\or Ђ\or Е\or Ж\or З\or
И\or Ј\or К\or Л\or Љ\or М\or Н\or Њ\or О\or П\or Р\or С\or
Т\or Ћ\or У\or Ф\or Х\or Ц\or Ч\or Џ\or Ш\else\@ctrerr\fi
\else
\ifcase#1\or\CYRA\or\CYRB\or\CYRV\or\CYRG\or\CYRD\or\CYRDJE\or
\CYRE\or\CYRZH\or\CYRZ\or\CYRI\or\CYRJE\or\CYRK\or\CYRL\or
\CYRLJE\or\CYRM\or\CYRN\or\CYRNJE\or\CYRO\or\CYRP\or\CYRR\or
\CYRS\or\CYRT\or\CYRTSHE\or\CYRU\or\CYRF\or\CYRH\or\CYRC\or
\CYRCH\or\CYRDZHE\or\CYRSH\else\@ctrerr\fi
\fi
\or
\ifcase#1\or A\or B\or C\or D\or E\or F\or G\or H\or I\or
J\or K\or L\or M\or N\or O\or P\or R\or S\or T\or U\or V\or
Z\else\@ctrerr\fi
\or
\ifcase#1\or A\or B\or C\or D\or E\or F\or G\or H\or I\or
J\or K\or L\or M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or
W\or X\or Y\or Z\else\@ctrerr\fi
\fi}%
% \end{macrocode}
%
% The same thing will be done with the macro |\alph|.
%
% \begin{macrocode}
\addto\extrasserbianc{\babel@save\@alph \let\@alph\srbc@alph}
\def\srbc@alph#1{%
\ifcase\srbc@lettering
\if@srbc@uni@ode
\ifcase#1\or а\or б\or в\or г\or д\or ђ\or е\or ж\or з\or
и\or ј\or к\or л\or љ\or м\or н\or њ\or о\or п\or р\or с\or
т\or ћ\or у\or ф\or х\or ц\or ч\or џ\or ш\else\@ctrerr\fi
\else
\ifcase#1\or\cyra\or\cyrb\or\cyrv\or\cyrg\or\cyrd\or\cyrdje\or
\cyre\or\cyrzh\or\cyrz\or\cyri\or\cyrje\or\cyrk\or\cyrl\or
\cyrlje\or\cyrm\or\cyrn\or\cyrnje\or\cyro\or\cyrp\or\cyrr\or
\cyrs\or\cyrt\or\cyrtshe\or\cyru\or\cyrf\or\cyrh\or\cyrc\or
\cyrch\or\cyrdzhe\or\cyrsh\else\@ctrerr\fi
\fi
\or
\ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or
j\or k\or l\or m\or n\or o\or p\or r\or s\or t\or u\or v\or
z\else\@ctrerr\fi
\or
\ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or
j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or
w\or x\or y\or z\else\@ctrerr\fi
\fi}%
\addto\extrasserbianc{%
\babel@save\enumEng\def\enumEng{\srbc@lettering=\tw@}%
\babel@save\enumLat\def\enumLat{\srbc@lettering=\@ne}%
\babel@save\enumCyr\def\enumCyr{\srbc@lettering=\z@}%
}%
% \end{macrocode}
%
% An |ijekav| attribute changes the default behavior and activates an
% alternative set of captions suitable for typesetting in ijekavian dialect.
% The |quotes| attribute changes the |"'| shorthand to produce '' as closing quotation mark,
% instead of the traditional `` quotation mark of Serbian language.
% Also, the |datei| attribute will produce `јуни' and `јули' instead `јун' and `јул'
% for date.
%
% \begin{macrocode}
\bbl@declare@ttribute{serbianc}{ijekav}{%
\PackageInfo{babel}{Serbianc attribute set to ijekav}%
\let\captionsserbianc=\captionsserbianc@ijekav }
\@onlypreamble\captionsserbianc@ijekav
\bbl@declare@ttribute{serbianc}{quotes}{%
\PackageInfo{babel}{Serbianc attribute set to quotes}%
\declare@shorthand{serbianc}{"'}{\textquotedblright} }
\bbl@declare@ttribute{serbianc}{datei}{%
\PackageInfo{babel}{Serbianc attribute set to datei}%
\let\dateserbianc=\dateserbianc@datei }
\@onlypreamble\dateserbianc@datei
% \end{macrocode}
%
% Some math functions in Serbian math books have other names:
% e.g. |sinh| in Serbian is written as |sh| etc. So we define a
% number of new math operators.
%
% \begin{macrocode}
\def\sh{\mathop{\operator@font sh}\nolimits}
\def\ch{\mathop{\operator@font ch}\nolimits}
\def\tg{\mathop{\operator@font tg}\nolimits}
\def\ctg{\mathop{\operator@font ctg}\nolimits}
\def\arctg{\mathop{\operator@font arctg}\nolimits}
\def\arcctg{\mathop{\operator@font arcctg}\nolimits}
\addto\extrasserbianc{%
\babel@save{\th}%
\let\ltx@th\th
\def\th{\textormath{\ltx@th}%
{\mathop{\operator@font th}\nolimits}}%
}
\def\cth{\mathop{\operator@font cth}\nolimits}
\def\arsh{\mathop{\operator@font arsh}\nolimits}
\def\arch{\mathop{\operator@font arch}\nolimits}
\def\arth{\mathop{\operator@font arth}\nolimits}
\def\arcth{\mathop{\operator@font arcth}\nolimits}
\def\cosec{\mathop{\operator@font cosec}\nolimits}
\def\arcsec{\mathop{\operator@font arcsec}\nolimits}
\def\arccosec{\mathop{\operator@font arccosec}\nolimits}
\def\sech{\mathop{\operator@font sech}\nolimits}
\def\cosech{\mathop{\operator@font cosech}\nolimits}
\def\arsech{\mathop{\operator@font arsech}\nolimits}
\def\arcosech{\mathop{\operator@font arcosech}\nolimits}
\def\Prob{\mathop{\kern\z@\mathsf{P}}\nolimits}
\def\Expect{\mathop{\kern\z@\mathsf{E}}\nolimits}
\def\Variance{\mathop{\kern\z@\mathsf{D}}\nolimits}
\addto\extrasserbianc{%
\babel@save\nzs \babel@save\nzd
\babel@save\NZS \babel@save\NZD
\if@srbc@uni@ode
\def\nzs{\mathop{\mathrm{нзс}}\nolimits}%
\def\nzd{\mathop{\mathrm{нзд}}\nolimits}%
\def\NZS{\mathop{\mathrm{НЗС}}\nolimits}%
\def\NZD{\mathop{\mathrm{НЗД}}\nolimits}%
\else
\def\nzs{\mathop{\textnormal{\cyrn\cyrz\cyrs}}\nolimits}%
\def\nzd{\mathop{\textnormal{\cyrn\cyrz\cyrd}}\nolimits}%
\def\NZS{\mathop{\textnormal{\CYRN\CYRZ\CYRS}}\nolimits}%
\def\NZD{\mathop{\textnormal{\CYRN\CYRZ\CYRD}}\nolimits}%
\fi}
% \end{macrocode}
%
% The macro |\ldf@finish| takes care of looking for a
% configuration file, setting the main language to be switched on
% at |\begin{document}| and resetting the category code of
% \texttt{@} to its original value.
%
% \begin{macrocode}
\ldf@finish{serbianc}
%</code>
% \end{macrocode}
%
% \Finale
%%
%% \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 \~}
%%
\endinput
|