summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/babel-contrib/macedonian/macedonian.dtx
blob: ee0997a1f85c768e0cb4b3b0b6901683154b7f3c (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
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
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
% \iffalse meta-comment
%
% Copyright 1989-2008 Johannes L. Braams and any individual authors
% listed elsewhere in this file.  All rights reserved.
% 
% This file is part of 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 Stojan Trajanovski.
% 
% The list of all files belonging to the Babel system is
% given in the file `manifest.bbl. See also `legal.bbl' for additional
% information.
% 
% 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
%    \CheckSum{1401}
%    
%    \iffalse
%    Tell the \LaTeX\ system who we are and write an entry on the
%    transcript.
%<*dtx>
\ProvidesFile{macedonian.dtx}
%</dtx>
%<code>\ProvidesLanguage{macedonian}
          [2016/02/05 v1.1 Macedonian support from the babel system]
%
%% File `macedonian.dtx'
%% Babel package for LaTeX version 2e
%% Copyright (C) 1989-2008
%%               by Johannes Braams,TeXniek
%
%% Macedonian Language Definition File
%%               Copyright (C) [to be defined]
%
%% Adapted from bulgarian.dtx
%%               by Stojan.Trajanovski <stojan.trajanovski at gmail.com>
%
%
%<*filedriver>
\documentclass{ltxdoc}
\newcommand\TeXhax{\TeX hax}
\newcommand\babel{\textsf{babel}}
\newcommand\langvar{$\langle\it lang \rangle$}
\newcommand\note[1]{}
\newcommand\Lopt[1]{\textsf{#1}}
\newcommand\file[1]{\texttt{#1}}
\newcommand\pkg[1]{\texttt{#1}}
\begin{document}
 \DocInput{macedonian.dtx}
\end{document}
%</filedriver>
%\fi
% \GetFileInfo{macedonian.dtx}
%    
%    \section{The Macedonian language}
%    
%    The file \file{\filename}\footnote{The file described in this
%    section has version number \fileversion\ and was last revised on
%    \filedate.  This file provides the source
%    code for the Macedonian language definition file.  A contribution
%    was made by Stojan Trajanovski ([name].[surname]@gmail.com)
%    
%    The file heavily relies on the \file{bulgarian.dtx} version of the babel class and \file{bulgarian.dtx} was used as a starting point. \file{bulgarian.dtx} was initially developed by Georgi N. Boshnakov with a final modification by Johannes L. Braams. In addition, some parts from \file{serbianc.dtx} (created by Filip Br\v{c}i\'{c}) are also used. The specific differences of the Macedonian language from Bulgarian and Serbian have been addressed in this class.} provides the language-specific macros for the
%    Macedonian language.
%    
%    \subsection{Most important points}
% The following most important points of the Macedonian language are implemented in this class:
% \begin{enumerate}
%\item The alphabet is complete and is in a correct order, so the numbering (enumerate option) will be in a correct way in Macedonian.
%\item Some italic letters in Macedonian (like: d, g, t, p) differ from Bulgarian (and Russian). These characters in italic are perhaps similar to Serbian language. Moreover, the character gje "g with accent" is unique and does not appear in both Bulgarian and Serbian alphabets. These issues have been addressed in the class.
% \item The first paragraph of each section is indented.
%\item The date format is according to the Macedonian practice. (e.g., [dd] [month in Macadonian] [yyyy] god.)
%\item All the terms like chapter, bibliography, index, figure, table, theorem, months names are all adjusted according to the Macedonian practice in books and other materials.
%\end{enumerate}
%    Various ``cyrillic'' dashes  and quotation marks traditionally used in Macedonian are borrowed
%    from German language. French quotation marks may be seen as well in older books. To make them available, the implementation from \file{bulgarian.dtx} have been inherited for this class. Additional details for dashes and quotation marks can be found in \file{bulgarian.dtx}. % For example, the character |"| is made active. %  
%    \subsection{Updates to v1.1.}
% The month names are now in accordance with the Macedonian orthography i.e. a month starts with a non-capital letter\footnote{Dario Gjorgjevski contributed for this addition.}. A small typo is fixed.
% 
% \StopEventually{}
%    \subsection{Implementation}
% 
%    The macro |\LdfInit| takes care of preventing that this file is
%    loaded more than once, checking the category code of the
%    \texttt{@} sign, etc. 
%    
%    \begin{macrocode}
%<*code>
\LdfInit{macedonian}{captionsmacedonian}
%    \end{macrocode}
%    
%    When this file is read as an option, i.e., by the |\usepackage|
%    command, \texttt{macedonian} will be an `unknown' language, in
%    which case we have to make it known. So we check for the
%    existence of |\l@macedonian| to see whether we have to do
%    something here. 
%    
%    \begin{macrocode}
\ifx\l@macedonian\@undefined
  \@nopatterns{Macedonian}
  \adddialect\l@macedonian0
\fi
%    \end{macrocode}
%    
%    
%    
% \begin{macro}{\latinencoding}
%
%    We need to know the encoding for text that is supposed to be
%    which is active at the end of the \babel\ package. If the
%    \pkg{fontenc} package is loaded later, then \ldots too bad!
%    
%    \begin{macrocode}
\let\latinencoding\cf@encoding
%    \end{macrocode}
%    
% \end{macro}
%
%    The user may choose between different available Cyrillic
%    encodings---e.g., \texttt{X2}, \texttt{LCY}, or \texttt{LWN}.
%    If the user wants to use a font encoding other than the default
%    (\texttt{T2A}), he has to load the corresponding file
%    \emph{before} \file{macedonian.sty}. 
%    This may be done in the following way:
%    
%    \begin{verbatim}
%      \usepackage[LCY,OT1]{fontenc}     %overwrite the default encoding;
%      \usepackage[english,macedonian]{babel}
%    \end{verbatim}
%    \unskip
%    
%    Note: most people would prefer the \texttt{T2A} to \texttt{X2},
%    because \texttt{X2} does not contain Latin letters, and  users
%    should be very careful to switch the language every time they 
%    want to typeset a Latin word inside a Macedonian phrase or vice
%    versa. On the other hand, switching the language is a good
%    practice anyway. With a decent text processing program it does
%    not involve more work than switching between the Macedonian and
%    English keyboard. Moreover that the far most common disruption
%    occurs  as a result of forgetting to switch back to cyrillic
%    keyboard. 
%    
%    We parse the |\cdp@list| containing the encodings known to
%    \LaTeX\ in the order they were loaded. We set the
%    |\cyrillicencoding| to the \emph{last} loaded encoding in the
%    list of supported Cyrillic encodings: \texttt{OT2}, \texttt{LWN},
%    \texttt{LCY}, \texttt{X2}, \texttt{T2C}, \texttt{T2B},
%    \texttt{T2A}, if any. 
%    
%    
%    \begin{macrocode}
\def\reserved@a#1#2{%
   \edef\reserved@b{#1}%
   \edef\reserved@c{#2}%
   \ifx\reserved@b\reserved@c
     \let\cyrillicencoding\reserved@c
   \fi}
\def\cdp@elt#1#2#3#4{%
   \reserved@a{#1}{OT2}%
   \reserved@a{#1}{LWN}%
   \reserved@a{#1}{LCY}%
   \reserved@a{#1}{X2}%
   \reserved@a{#1}{T2C}%
   \reserved@a{#1}{T2B}%
   \reserved@a{#1}{T2A}}
\cdp@list
%    \end{macrocode}
%    
%    Now, if |\cyrillicencoding| is undefined, then the user did not
%    load any of supported encodings. So, we have to set
%    |\cyrillicencoding| to some default value. We test the presence
%    of the encoding definition files in the order from less
%    preferable to more preferable encodings. We use the lowercase
%    names (i.e., \file{lcyenc.def} instead of \file{LCYenc.def}).
%    
%    \begin{macrocode}
\ifx\cyrillicencoding\undefined
  \IfFileExists{ot2enc.def}{\def\cyrillicencoding{OT2}}\relax
  \IfFileExists{lwnenc.def}{\def\cyrillicencoding{LWN}}\relax
  \IfFileExists{lcyenc.def}{\def\cyrillicencoding{LCY}}\relax
  \IfFileExists{x2enc.def}{\def\cyrillicencoding{X2}}\relax
  \IfFileExists{t2cenc.def}{\def\cyrillicencoding{T2C}}\relax
  \IfFileExists{t2benc.def}{\def\cyrillicencoding{T2B}}\relax
  \IfFileExists{t2aenc.def}{\def\cyrillicencoding{T2A}}\relax
%    \end{macrocode}
%    
%    If |\cyrillicencoding| is still undefined, then the user seems
%    not to  have a properly installed distribution. A fatal error.
%    
%    \begin{macrocode}
\ifx\cyrillicencoding\undefined
    \PackageError{babel}%
    {No Cyrillic encoding definition files were found}%
    {Your installation is incomplete. \MessageBreak
    You need at least one of the following files: \MessageBreak
    \space\space
    x2enc.def, t2aenc.def, t2benc.def, t2cenc.def, \MessageBreak
    \space\space
    lcyenc.def, lwnenc.def, ot2enc.def.}%
  \else
%    \end{macrocode}
%    
%    We avoid |\usepackage[\cyrillicencoding]{fontenc}| because we
%    don't want to force the switch of |\encodingdefault|.
%    
%    \begin{macrocode}
    \lowercase
      \expandafter{\expandafter\input\cyrillicencoding enc.def\relax}%
  \fi
\fi
%    \end{macrocode}
%    
%    \begin{verbatim}
%      \PackageInfo{babel}
%        {Using `\cyrillicencoding' as a default Cyrillic encoding}%
%    \end{verbatim}
%    \unskip
%    
%    
%    
%    \begin{macrocode}
\DeclareRobustCommand{\Macedonian}{%
  \fontencoding\cyrillicencoding\selectfont
  \let\encodingdefault\cyrillicencoding
  \expandafter\set@hyphenmins\macedonianhyphenmins
  \language\l@macedonian}
\DeclareRobustCommand{\English}{%
  \fontencoding\latinencoding\selectfont
  \let\encodingdefault\latinencoding
  \expandafter\set@hyphenmins\englishhyphenmins
  \language\l@english}
\let\Mkd\Macedonian
\let\Mk\Macedonian
\let\cyrillictext\Macedonian
\let\cyr\Macedonian
\let\Eng\English
\def\selectenglanguage{\selectlanguage{english}}
\def\selectmklanguage{\selectlanguage{macedonian}}
%    \end{macrocode}
%    
%    Since the \texttt{X2} encoding does not contain Latin letters,we 
%    should make some redefinitions of \LaTeX\ macros which implicitly 
%    produce Latin letters.
%    
%    
%    \begin{macrocode}
\expandafter\ifx\csname T@X2\endcsname\relax\else
%    \end{macrocode}
%    
%    We put |\latinencoding| in braces to avoid problems with |\@alph|
%    inside minipages (e.g., footnotes inside minipages) where
%    |\@alph| is expanded and we get for example `|\fontencoding OT1|'
%    (|\fontencoding| is robust).
%    
% \changes{macedonian-1.0c}{2003/06/14}{Added missing closing brace}
%    \begin{macrocode}
  \def\@Alph@eng#1{{\fontencoding{\latinencoding}\selectfont 
      \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}}%
  \def\@alph@eng#1{{\fontencoding{\latinencoding}\selectfont
      \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}}%
  \let\@Alph\@Alph@eng
  \let\@alph\@alph@eng
%    \end{macrocode}
%    
%    Unfortunately, the commands |\AA| and |\aa| are not encoding
%    dependent in \LaTeX\ (unlike e.g., |\oe| or |\DH|). They are
%    defined as |\r{A}| and |\r{a}|. This leads to unpredictable
%    results when the font encoding does not contain the Latin letters
%    `A' and `a' (like \texttt{X2}). 
%    
%    \begin{macrocode}
  \DeclareTextSymbolDefault{\AA}{OT1}
  \DeclareTextSymbolDefault{\aa}{OT1}
  \DeclareTextCommand{\AA}{OT1}{\r A}
  \DeclareTextCommand{\aa}{OT1}{\r a}
\fi
%    \end{macrocode}
%    
%    The following block redefines the character class of uppercase
%    Greek letters and some accents, if it is equal to 7 (variable
%    family), to avoid incorrect results if the font encoding in some
%    math family does not contain these characters in places of OT1
%    encoding. The code was taken from |amsmath.dtx|. See comments and
%    further explanation there. 
%    
%    \begin{macrocode}
\begingroup\catcode`\"=12
% uppercase greek letters:
\def\@tempa#1{\expandafter\@tempb\meaning#1\relax\relax\relax\relax
 "0000\@nil#1}
\def\@tempb#1"#2#3#4#5#6\@nil#7{%
\ifnum"#2=7 \count@"1#3#4#5\relax
\ifnum\count@<"1000 \else \global\mathchardef#7="0#3#4#5\relax \fi
 \fi}
\@tempa\Gamma\@tempa\Delta\@tempa\Theta\@tempa\Lambda\@tempa\Xi
\@tempa\Pi\@tempa\Sigma\@tempa\Upsilon\@tempa\Phi\@tempa\Psi
\@tempa\Omega
% some accents:
\def\@tempa#1#2\@nil{\def\@tempc{#1}}\def\@tempb{\mathaccent}
\expandafter\@tempa\hat\relax\relax\@nil
\ifx\@tempb\@tempc
\def\@tempa#1\@nil{#1}%
\def\@tempb#1{\afterassignment\@tempa\mathchardef\@tempc=}%
\def\do#1"#2{}
\def\@tempd#1{\expandafter\@tempb#1\@nil
 \ifnum\@tempc>"FFF
 \xdef#1{\mathaccent"\expandafter\do\meaning\@tempc\space}%
 \fi}
\@tempd\hat\@tempd\check\@tempd\tilde\@tempd\acute\@tempd\grave
\@tempd\dot\@tempd\ddot\@tempd\breve\@tempd\bar
\fi
\endgroup
%    \end{macrocode}
%    
%    The user should use the \pkg{inputenc} package when any 8-bit
%    Cyrillic font encoding is used, selecting one of the Cyrillic
%    input encodings. We do not assume any default input encoding, so
%    the user should explicitly call the \pkg{inputenc} package by
%    |\usepackage{inputenc}|. We also removed |\AtBeginDocument|, so
%    \pkg{inputenc} should be used before \babel. 
%    
%    \begin{macrocode}
\@ifpackageloaded{inputenc}{}{%
\def\reserved@a{LWN}%
\ifx\reserved@a\cyrillicencoding\else
\def\reserved@a{OT2}%
\ifx\reserved@a\cyrillicencoding\else
\PackageWarning{babel}%
{No input encoding specified for Macedonian language}\fi\fi}
%    \end{macrocode}
%    
%    Now we define two commands that offer the possibility to switch
%    between Cyrillic and Roman encodings.
%    
% \begin{macro}{\cyrillictext}
% \begin{macro}{\latintext}
%
%    The command |\cyrillictext| will switch from Latin font encoding
%    to the Cyrillic font encoding, the command |\latintext| switches
%    back. This assumes that the `normal' font encoding is a Latin
%    one. These commands are \emph{declarations}, for shorter peaces
%    of text the commands |\textlatin| and |\textcyrillic| can be
%    used.
%    
%    We comment out |\latintext| since it is defined in the core of
%    babel (babel.def). We add the shorthand |\lat| for |\latintext|.
%    Note that |\cyrillictext| has been defined above.
%    
%    \begin{macrocode}
% \DeclareRobustCommand{\latintext}{%
% \fontencoding{\latinencoding}\selectfont
%   \def\encodingdefault{\latinencoding}}
\let\lat\latintext
%    \end{macrocode}
%    
% \end{macro}
% \end{macro}
%
% \begin{macro}{\textcyrillic}
% \begin{macro}{\textlatin}
%
%    These commands take an argument which is then typeset using the
%    requested font encoding.
%    |\textlatin| is commented out since it is defined in the core of
%    babel. (It is defined there with |\DeclareRobustCommand| instead.)
%    
%    \begin{macrocode}
\DeclareTextFontCommand{\textcyrillic}{\cyrillictext}
% \DeclareTextFontCommand{\textlatin}{\latintext}
%    \end{macrocode}
%    
% \end{macro}
% \end{macro}
%
%    The next step consists of defining commands to switch to (and 
%    from) the Macedonian language.
%    
% \begin{macro}{\captionsmacedonian}
%
%    The macro |\captionsmacedonian| defines all strings used in the
%    four standard document classes provided with \LaTeX. The two
%    commands |\cyr| and |\lat| activate Cyrillic resp. Latin encoding.
%    
%    \begin{macrocode}
\addto\captionsmacedonian{%
  \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\CYRA\cyrb\cyrs\cyrt\cyrr\cyra\cyrk\cyrt}}%
  \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\CYRP\cyrr\cyri\cyrl\cyro\cyrg}}%
  \def\contentsname{%
    {\cyr\CYRS\cyro\cyrd\cyrr\cyrzh\cyri\cyrn\cyra}}%
  \def\listfigurename{%
    {\cyr\CYRL\cyri\cyrs\cyrt\cyra\ \cyrn\cyra\ \cyrs\cyrl\cyri\cyrk\cyri}}%
  \def\listtablename{%
    {\cyr\CYRL\cyri\cyrs\cyrt\cyra\ \cyrn\cyra\ \cyrt\cyra\cyrb\cyre\cyrl\cyri}}%
  \def\indexname{%
    {\cyr\CYRI\cyrn\cyrd\cyre\cyrk\cyrs\ \cyrn\cyra\ \cyrt\cyre\cyrr\cyrm\cyri\cyrn\cyri}}%
  \def\authorname{%
    {\cyr\CYRA\cyrv\cyrt\cyro\cyrr}}%
  \def\figurename{%
    {\cyr\CYRS\cyrl\cyri\cyrk\cyra}}%
  \def\tablename{%
    {\cyr\CYRT\cyra\cyrb\cyre\cyrl\cyra}}%
  \def\partname{%
    {\cyr\CYRD\cyre\cyrl}}%
  \def\enclname{%
    {\cyr\CYRP\cyrr\cyri\cyrl\cyro\cyrz\cyri}}%
  \def\ccname{%
    {\cyr\cyrk\cyro\cyrp\cyri\cyrje\cyra}}%
  \def\headtoname{%
    {\cyr\CYRZ\cyra}}%
  \def\pagename{%
    {\cyr\cyrs\cyrt\cyrr.}}%
  \def\seename{%
    {\cyr\cyrv\cyri\cyrd\cyri}}%
  \def\alsoname{%
    {\cyr\cyrv\cyri\cyrd\cyri\ \cyri\cyrs\cyrt\cyro\cyrt\cyra\cyrk\cyra}}%
    \def\proofname{%
    {\normalfont \textbf{\cyr\cyrd\cyro\cyrk\cyra\cyrz}}}%
     \def\theoremname{%
    {\normalfont \textbf{\cyr\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyra}}}%
    \def\corollaryname{%
    {\normalfont \textbf{\cyr\CYRP\cyro\cyrs\cyrl\cyre\cyrd\cyri\cyrc\cyra}}}%
    \def\lemmaname{%
    {\normalfont \textbf{\cyr\CYRL\cyre\cyrm\cyra}}}%
    \def\glossaryname{%
    {\cyr\CYRR\cyre\cyrc\cyrn\cyri\cyrk}}%
}
%    \end{macrocode}    
% \end{macro}
%%    
% \begin{macro}{\datemacedonian}
%
%    The macro |\datemacedonian| redefines the command |\today| to
%    produce Macedonian dates.
%    It also provides the command |\todayRoman| which produces the
%    date with the month in capital roman numerals, a popular format
%    for dates in Macedonian. 
%    
%    \begin{macrocode}
\def\datemacedonian{%
  \def\month@macedonian{\ifcase\month\or 
    \cyrje\cyra\cyrn\cyru\cyra\cyrr\cyri\or 
    \cyrf\cyre\cyrv\cyrr\cyru\cyra\cyrr\cyri\or 
    \cyrm\cyra\cyrr\cyrt\or 
    \cyra\cyrp\cyrr\cyri\cyrl\or 
    \cyrm\cyra\cyrje\or 
    \cyrje\cyru\cyrn\cyri\or 
    \cyrje\cyru\cyrl\cyri\or 
    \cyra\cyrv\cyrg\cyru\cyrs\cyrt\or 
    \cyrs\cyre\cyrp\cyrt\cyre\cyrm\cyrv\cyrr\cyri\or 
    \cyro\cyrk\cyrt\cyro\cyrm\cyrv\cyrr\cyri\or 
    \cyrn\cyro\cyre\cyrm\cyrv\cyrr\cyri\or 
    \cyrd\cyre\cyrk\cyre\cyrm\cyrv\cyrr\cyri\fi}%
  \def\month@Roman{\expandafter\@Roman\month}%
  \def\today{\number\day~\month@macedonian\ \number\year~\cyrg\cyro\cyrd.}%
  \def\todayRoman{\number\day.\,\month@Roman.\,\number\year~\cyrg\cyro\cyrd.}%
}
%    \end{macrocode}
%    
% \end{macro}
%
%    
%    
% \begin{macro}{\todayRoman}
%
%    The month is often written with roman numbers in Macedonian dates.
%    Here we define date in this format:
%    
%    \begin{macrocode}
\def\Romannumeral#1{\uppercase\expandafter{\romannumeral #1}}
\def\todayRoman{\number\day.\Romannumeral{\month}.\number\year~\cyrg\cyro\cyrd.}
%    \end{macrocode}
%    
% \end{macro}
%
% \begin{macro}{\extrasmacedonian}
%
%    The macro |\extrasmacedonian| will perform all the extra
%    definitions needed for the Macedonian language.
%    The macro |\noextrasmacedonian| is used to cancel the actions of
%    |\extrasmacedonian|. 
%    
%    The first action we define is to switch on the selected Cyrillic
%    encoding whenever we enter `macedonian'.
%    
%    \begin{macrocode}
\addto\extrasmacedonian{\cyrillictext}
%    \end{macrocode}
%    
%    When the encoding definition file was processed by \LaTeX\ the
%    current font encoding is stored in |\latinencoding|, assuming
%    that \LaTeX\ uses \texttt{T1} or \texttt{OT1} as
%    default. Therefore we switch back to |\latinencoding| whenever
%    the Macedonian language is no longer `active'. 
%    
%    \begin{macrocode}
\addto\noextrasmacedonian{\latintext}
%    \end{macrocode}
%    
%    For Macedonian the \texttt{"} character also is made active.
%    
%    \begin{macrocode}
\initiate@active@char{"}
%    \end{macrocode}
%    
%    The code above is necessary because we need extra active
%    characters. The character |"| is used as indicated in
%    table~\ref{tab:macedonian-quote}. We specify that the Macedonian
%    group of shorthands should be used. 
%    
%    \begin{macrocode}
\addto\extrasmacedonian{\languageshorthands{macedonian}}
%    \end{macrocode}
%    
%    These characters are `turned on' once, later their definition may
%    vary.
%    
%    \begin{macrocode}
\addto\extrasmacedonian{%
  \bbl@activate{"}}
\addto\noextrasmacedonian{%
  \bbl@deactivate{"}}
%    \end{macrocode}
%    
%    The \texttt{X2} and \texttt{T2*} encodings do not contain
%    |spanish_shriek| and |spanish_query| symbols; as a consequence,
%    the ligatures `|?`|' and `|!`|' do not work with them (these
%    characters are useless for Cyrillic texts anyway). But we define
%    the shorthands to emulate these ligatures (optionally).
%    
%    We do not use |\latinencoding| here (but instead explicitly use
%    \texttt{OT1}) because the user may choose \texttt{T2A} to be the
%    primary encoding, but it does not contain these characters.
%    
%    \begin{macrocode}
%<*spanishligs>
\declare@shorthand{macedonian}{?`}{\UseTextSymbol{OT1}\textquestiondown}
\declare@shorthand{macedonian}{!`}{\UseTextSymbol{OT1}\textexclamdown}
%</spanishligs>
%    \end{macrocode}
%    
%    To be able to define the function of `|"|', we first define a
%    couple of `support' macros.
%    
% \begin{macro}{\dq}
%
%    We save the original double quote character in |\dq| to keep it 
%    available, the math accent |\"|can now be typed as `|"|'.
% \changes{macedonian-1.0c}{2003/04/10}{repaired typo}
%    \begin{macrocode}
\begingroup \catcode`\"12
\def\reserved@a{\endgroup
  \def\@SS{\mathchar"7019}
  \def\dq{"}}
\reserved@a
%    \end{macrocode}
%    
% \end{macro}
%
%    Now we can define the doublequote macros: german and french
%    quotes. We use definitions of these quotes made in babel.sty.
%    The french quotes are contained in the \texttt{T2*} encodings.
%    
%    \begin{macrocode}
\declare@shorthand{macedonian}{"`}{\glqq}
\declare@shorthand{macedonian}{"'}{\grqq}
\declare@shorthand{macedonian}{"<}{\flqq}
\declare@shorthand{macedonian}{">}{\frqq}
%    \end{macrocode}
%    
%    Some additional commands:
%    
%    \begin{macrocode}
\declare@shorthand{macedonian}{""}{\hskip\z@skip}
\declare@shorthand{macedonian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}
\declare@shorthand{macedonian}{"=}{\nobreak-\hskip\z@skip}
\declare@shorthand{macedonian}{"|}{%
\textormath{\nobreak\discretionary{-}{}{\kern.03em}%
\allowhyphens}{}}
%    \end{macrocode}
%    
%    The next two macros for |"-| and |"---| are somewhat different.
%    We must check whether the second token is a hyphen character:
%    
%    \begin{macrocode}
\declare@shorthand{macedonian}{"-}{%
%    \end{macrocode}
%    
%    If the next token is `|-|', we typeset an emdash, otherwise a
%    hyphen sign:
%    
%    \begin{macrocode}
  \def\macedonian@sh@tmp{%
    \if\macedonian@sh@next-\expandafter\macedonian@sh@emdash
    \else\expandafter\macedonian@sh@hyphen\fi
  }%
%    \end{macrocode}
%    
%    \TeX\ looks for the next token after the first `|-|': the meaning
%    of this token is written to |\macedonian@sh@next| and
%    |\macedonian@sh@tmp| is called.
%    
%    \begin{macrocode}
  \futurelet\macedonian@sh@next\macedonian@sh@tmp}
%    \end{macrocode}
%    
%    Here are the definitions of hyphen and emdash. First the hyphen:
%    
%    \begin{macrocode}
\def\macedonian@sh@hyphen{\nobreak\-\bbl@allowhyphens}
%    \end{macrocode}
%    
%    For the emdash definition, there are the two parameters: we must
%    `eat' two last hyphen signs of our emdash \dots :
%    
%    \begin{macrocode}
\def\macedonian@sh@emdash#1#2{\cdash-#1#2}
%    \end{macrocode}
%    
% \begin{macro}{\cdash}
%
%    \dots\ these two parameters are useful for another macro:
%    |\cdash|:
%    
% \changes{macedonian-1.0e}{2006/03/31}{Two occurences of \cmd{temp}
%    were changed into tab followed by emp} 
%    \begin{macrocode}
\ifx\cdash\undefined % should be defined earlier
\def\cdash#1#2#3{\def\tempx@{#3}%
\def\tempa@{-}\def\tempb@{~}\def\tempc@{*}%
 \ifx\tempx@\tempa@\@Acdash\else
  \ifx\tempx@\tempb@\@Bcdash\else
   \ifx\tempx@\tempc@\@Ccdash\else
    \errmessage{Wrong usage of cdash}\fi\fi\fi}
%    \end{macrocode}
%    
%  second parameter (or third for |\cdash|) shows what kind of emdash
%  to create in next step
%  \begin{center}
%  \begin{tabular}{@{}p{.1\hsize}@{}p{.9\hsize}@{}}
%   |"---| & ordinary (plain) Cyrillic emdash inside text:
%   an unbreakable thinspace will be inserted before only in case of
%   a \textit{space} before the dash (it is necessary for dashes after
%   display maths formulae: there could be lists, enumerations etc.\ 
%   started with ``---where $a$ is ...'' i.e., the dash starts a line).
%   (Firstly there were planned rather soft rules for user:he may put
%   a space before the dash or not. But it is difficult to place this
%   thinspace automatically, i.e., by checking modes because after
%   display formulae \TeX{} uses horizontal mode. Maybe there is a 
%   misunderstanding? Maybe there is another way?) After a dash
%   a breakable thinspace is always placed; \\
%  \end{tabular}
%  \end{center}
%    
%    
%    \begin{macrocode}
% What is more grammatically: .2em or .2\fontdimen6\font?
\def\@Acdash{\ifdim\lastskip>\z@\unskip\nobreak\hskip.2em\fi
\cyrdash\hskip.2em\ignorespaces}%
%    \end{macrocode}
%    
%      \begin{center}
%      \begin{tabular}{@{}p{.1\hsize}@{}p{.9\hsize}@{}}
%       |"--~| & emdash in compound names or surnames
%       (like Mendeleev--Klapeiron); this dash has no space characters
%       around; after the dash some space is added
%       |\exhyphenalty| \\
%      \end{tabular}
%      \end{center}
%    
%    \begin{macrocode}
\def\@Bcdash{\leavevmode\ifdim\lastskip>\z@\unskip\fi
 \nobreak\cyrdash\penalty\exhyphenpenalty\hskip\z@skip\ignorespaces}%
%    \end{macrocode}
%    
%    \begin{center}
%    \begin{tabular}{@{}p{.1\hsize}@{}p{.9\hsize}@{}}
%     |"--*| & for denoting direct speech (a space like |\enskip|
%     must follow the emdash); \\
%    \end{tabular}
%    \end{center}
%    
%    \begin{macrocode}
\def\@Ccdash{\leavevmode
 \nobreak\cyrdash\nobreak\hskip.35em\ignorespaces}%
%\fi
%    \end{macrocode}
%    
% \end{macro}
%
%    
%    
% \begin{macro}{\cyrdash}
%
%    Finally the macro for ``body'' of the Cyrillic emdash.
%    The |\cyrdash| macro will be defined in case this macro hasn't
%    been defined in a fontenc file. For T2*fonts, cyrdash will be
%    placed in the code of the English emdash thus it uses ligature
%    |---|. 
%    
%    \begin{macrocode}
% Is there an IF necessary?
\ifx\cyrdash\undefined
\def\cyrdash{\hbox to.8em{--\hss--}}
\fi
%    \end{macrocode}
%    
% \end{macro}
%
%    Here a really new macro---to place thinspace between initials.
%    This macro used instead of |\,| allows hyphenation in the
%    following surname.
%    
%    \begin{macrocode}
\declare@shorthand{macedonian}{",}{\nobreak\hskip.2em\ignorespaces}
%    \end{macrocode}
%    
%    The Macedonian hyphenation patterns can be used with
%    |\lefthyphenmin| and |\righthyphenmin| set to~2.
% \changes{macedonian-1.0b}{2000/09/22}{Now use \cs{providehyphenmins} to
%    provide a default value}
%    \begin{macrocode}
\providehyphenmins{\CurrentOption}{\tw@\tw@}
\fi
%    \end{macrocode}
%    
%    Now the action |\extrasmacedonian| has to execute is to make sure
%    that the command |\frenchspacing| is in effect. If this is not
%    the case the execution of |\noextrasmacedonian| will switch it off
%    again.
%    
%    \begin{macrocode}
\addto\extrasmacedonian{\bbl@frenchspacing}
\addto\noextrasmacedonian{\bbl@nonfrenchspacing}
%    \end{macrocode}
%    
%    Make the double quotes produce the traditional quotes
%    used in Macedonian texts (these are the German quotes). 
%    
%    \begin{macrocode}
% \initiate@active@char{`}
%  \initiate@active@char{'}
% \addto\extrasmacedonian{%
%   \bbl@activate{`}}
% \addto\extrasmacedonian{%
%   \bbl@activate{'}}
% \addto\noextrasmacedonian{%
%   \bbl@deactivate{`}}
% \addto\noextrasmacedonian{%
%   \bbl@deactivate{'}}
% \def\mlron{\bbl@activate{`}\bbl@activate{'}}
% \def\mlroff{\bbl@deactivate{`}\bbl@deactivate{'}}
% \declare@shorthand{macedonian}{``}{\glqq}
% \declare@shorthand{macedonian}{''}{\grqq}
%    \end{macrocode}
%
%    In Macedonian the first paragraph of each section should be indented. The implementation from \file{serbianc.dtx} 
%    (created by Filip Br\v{c}i\'{c} [brcha@gna.org]) is used for such a purpose.
%    \begin{macrocode}
\ifx\fmtname plain \else
  \let\@aifORI\@afterindentfalse
  \def\bbl@frenchindent{\let\@afterindentfalse\@afterindenttrue
                        \@afterindenttrue}
  \def\bbl@nonfrenchindent{\let\@afterindentfalse\@aifORI
                          \@afterindentfalse}
  \addto\extrasmacedonian{\bbl@frenchindent}
  \addto\noextrasmacedonian{\bbl@nonfrenchindent}
\fi
%    \end{macrocode}
%    
% \end{macro}
%
%    Next we add a new enumeration style for Macedonian manuscripts with
%    Cyrillic letters,and later on we define some math operator names in
%    accordance with Macedonian typesetting traditions.
%    
% \begin{macro}{\@Alph@mkd}
%
%    We begin by defining |\@Alph@mkd| which works like |\@Alph|, but
%    produces (uppercase) Cyrillic letters intead of Latin ones.%    
%    \begin{macrocode}

\def\enumBul{\let\@Alph\@Alph@mkd \let\@alph\@alph@mkd}
\def\enumEng{\let\@Alph\@Alph@eng \let\@alph\@alph@eng}
\def\enumLat{\let\@Alph\@Alph@eng \let\@alph\@alph@eng}
\addto\extrasmacedonian{\enumBul}
\addto\noextrasmacedonian{\enumLat}
\def\@Alph@mkd#1{%
  \ifcase#1\or
  \CYRA\or \CYRB\or \CYRV\or \CYRG\or \CYRD\or \'{\CYRG}\or \CYRE\or \CYRZH\or 
  \CYRZ\or \CYRDZE\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 \'{\CYRK}\or \CYRU\or \CYRF\or \CYRH\or \CYRC\or \CYRCH\or \CYRDZHE\or \CYRSH\else
  \@ctrerr\fi
 }
\def\@Alph@eng#1{%
  \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
  }
%    \end{macrocode}
%    
% \end{macro}
%
%    
%    
% \begin{macro}{\@alph@mkd}
%
%    The macro |\@alph@mkd| is similar to |\@Alph@mkd|;
%    it produces lowercase Macedonian letters.
%    
%    \begin{macrocode}
\def\@alph@mkd#1{%
  \ifcase#1\or 
  \cyra\or \cyrb\or \cyrv\or \cyrg\or \cyrd\or \'{\cyrg}\or \cyre\or \cyrzh\or 
  \cyrz\or \cyrdze\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 \'{\cyrk}\or \cyru\or \cyrf\or \cyrh\or \cyrc\or \cyrch\or \cyrdzhe\or \cyrsh\else
  \@ctrerr\fi
  }
\def\@alph@eng#1{%
  \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
  }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{Characters in italic}
% When writing in italic, Macedonian differs from Bulgarian, Russian and other Slavic languages. (Perhaps similar to Serbian), the small italic letters: b, d, g, t and p are different. Moreover, the character gje "g with accent" is kind of unique. The following code ensures these characters to have a correct appearance in Macedonian Italic.
%    \begin{macrocode}
\newcommand{\overbar}[1]{\mkern 1.5mu\overline{\mkern-1.5mu#1\mkern-0.2mu}\mkern 1.0mu}
\newcommand*{\textoverline}[1]{$\overbar{\hbox{#1}}\m@th$}
\newcommand{\overbarshort}[1]{\mkern 1.7mu\overline{\mkern-0.0mu#1\mkern+1.2mu}\mkern 0.0mu}
\newcommand*{\textoverlineshort}[1]{$\overbarshort{\hbox{#1}}\m@th$}
\newcommand*{\my@test@it}{it}
\newcommand*{\IfItalic}[2]{%
  \ifx\f@shape\my@test@it
    #1%\expandafter#1
  \else
    #2%\expandafter#2
  \fi
}
\newcommand{\tbar}[1]{\mbox{%
  \sbox0{#1}\sbox2{\'{}}%
  \ooalign{\hidewidth\raise\dimexpr\ht0-\ht2+0.45ex\box2 \hidewidth\cr#1\cr}}}
\let\oldcyrb\cyrb
\renewcommand{\cyrb}{\IfItalic{\textit{$\delta$}}{\oldcyrb}}
\let\oldcyrd\cyrd
\renewcommand{\cyrd}{\IfItalic{\textit{g}}{\oldcyrd}}
\let\oldcyrg\cyrg
\renewcommand{\cyrg}{\IfItalic{\textoverlineshort{\i}}{\oldcyrg}} 
\DeclareTextCompositeCommand{\'}{T2A}{\cyrg}{\IfItalic{\tbar{\textoverlineshort{\i}}}
{\'{\oldcyrg}}}
\let\oldcyrt\cyrt
\renewcommand{\cyrt}{\IfItalic{\textoverline{\textit{\cyrsh}}}{\oldcyrt}}
\let\oldcyrp\cyrp
\renewcommand{\cyrp}{\IfItalic{\textoverline{\textit{\cyri}}}{\oldcyrp}}
%    \end{macrocode}
% \end{macro}
%    Some math functions in Macedonian math books have other names:
%    e.g., \texttt{sinh} in Macedonian is written as \texttt{sh}
%    etc. So we define a number of new math operators.
%    
%    |\sinh|:
%    
%    \begin{macrocode}
\def\sh{\mathop{\operator@font sh}\nolimits}
%    \end{macrocode}
%    
%    |\cosh|:
%    
%    \begin{macrocode}
\def\ch{\mathop{\operator@font ch}\nolimits}
%    \end{macrocode}
%    
%    |\tan|:
%    
%    \begin{macrocode}
\def\tg{\mathop{\operator@font tg}\nolimits}
%    \end{macrocode}
%    
%    |\arctan|:
%    
%    \begin{macrocode}
\def\arctg{\mathop{\operator@font arctg}\nolimits}
%    \end{macrocode}
%    
%    |\arccot|:
%    
%    \begin{macrocode}
\def\arcctg{\mathop{\operator@font arcctg}\nolimits}
%    \end{macrocode}
%    
%    The following macro conflicts with |\th| defined in Latin~1
%    encoding:
%    |\tanh|:
% \changes{macedonian-1.0d}{2004/05/21}{Change definition of \cs{th}
%    only for this language}
%    \begin{macrocode}
\addto\extrasrussian{%
  \babel@save{\th}%
  \let\ltx@th\th
  \def\th{\textormath{\ltx@th}%
                     {\mathop{\operator@font th}\nolimits}}%
  }
%    \end{macrocode}
%    
%    |\cot|:
%    
%    \begin{macrocode}
\def\ctg{\mathop{\operator@font ctg}\nolimits}
%    \end{macrocode}
%    
%    |\coth|:
%    
%    \begin{macrocode}
\def\cth{\mathop{\operator@font cth}\nolimits}
%    \end{macrocode}
%    
%    |\csc|:
%    
%    \begin{macrocode}
\def\cosec{\mathop{\operator@font cosec}\nolimits}
%    \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{macedonian}
%</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