-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbelarusian.dtx
1992 lines (1943 loc) · 80.2 KB
/
belarusian.dtx
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
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% \iffalse meta-comment
% !TEX program = xeLaTeX
% !Mode:: TEX:DTX:UNIX:UTF-8:US:RU
%<*internal>
\iffalse
%</internal>
%<*readme>
Belarusian language module for Babel, v1.5
==========================================
Released under the LaTeX Project Public License v1.3c or later.
See http://www.latex-project.org/lppl.txt
The package provides support for use of Babel in documents written in Belarusian
(in both official and ‘classic’ forms). The support is adapted for use both
under legacy TEX engines, and under X∃TEX and LuaTEX.
Based on Russian language module v1.3h by Igor A. Kotelnikov <kia999 at mail dot ru>
and Belarusian language module v1.1l by Aleksey Novodvorsky <[email protected]>.
The current maintainer is Andrej Shadura <[email protected]>.
Installation
------------
- unpack babel-belarusian.zip
- run `xelatex belarusian.dtx` (recommended)
or `pdflatex belarusian.dtx`;
run `tex belarusian.dtx`
or `tex belarusian.ins`, if you don’t need documentation
- move "belarusian.ldf" to ${texmf}/tex/generic/babel/contrib/
- move "belarusian.pdf" and README to ${texmf}/doc/latex/belarusian-babel/
- update filename base (see documentation for your TeX system)
Usage
-----
Belarusian language definition file can be used both with legacy 8-bit engines
(such as latex or pdflatex) and Unicode compilers (xelatex or lualatex).
The Unicode engines can be ran either in Unicode mode or 8-bit
compatibility mode, which emulates the legacy engines. The two modes differ by
a set of packages loaded in the preamble of a source TeX file. It is important
to keep recommended order of the packages loaded, especially when running
Unicode engines in a compatibility 8-bit mode.
In the examples below, it is assumed that a source file has utf8 input encoding.
### 8-bit mode
#### PDFLATeX, LaTeX
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,belarusian]{babel}
#### LuaLaTeX
\usepackage[T1,T2A]{fontenc}
\usepackage[lutf8]{luainputenc}
\usepackage[english,belarusian]{babel}
#### XeLaTeX
\XeTeXinputencoding "bytes"
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[english,belarusian]{babel}
### Unicode mode, LuaLaTeX or XeLaTeX
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\setmainfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}
\usepackage[english,belarusian]{babel}
Instead of the Computer Modern Unicode (CMU) fonts loaded in this example,
you may use any True Type or Open Type fonts installed on your computer.
### Using "classic" (Taraškievič) spelling
\usepackage[english,belarusian]{babel}
\languageattribute{belarusian}{classic}
or
\usepackage[english,belarusian.classic]{babel}
or
\usepackage[english,belarusian]{babel}
\languageattribute{belarusian}{tarask}
or
\usepackage[english,belarusian.tarask]{babel}
Documentation
-------------
See belarusian.pdf for more information.
Known problems
--------------
Before switching from a legacy 8-bit engine (tex, pdftex) to an Unicode
engine (xetex, luatex) and vise versa delete all .aux, .toc, .lot, .lof
files as they might have stored incompatible internal encodings.
Changes
-------
2018-10-09 version 1.5
* Replace \cyrmath with \textnormal.
Patch by Ivan Kokan.
2018-08-25 version 1.4
* Rename belarusianb.dtx to belarusian.dtx since the patch to Babel
has been never submitted.
* Use textcomp package in the documentation.
* Formatting fixes.
* Convert the README to Markdown.
* Rename the Unicode detection macro to fix conflicts with babel-russian.
2016-04-07 version 1.3h
* Initial version
Original source: russianb.dtx
2016-02-18 v1.3h Russian support from the babel system.
%</readme>
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
\expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble
----------------------------------------------------------------
Belarusian Language Support for the Babel package
E-mail: [email protected]
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
----------------------------------------------------------------
\endpreamble
\postamble
----------------------------------------------------------------
Copyright 2016, 2018 Andrej Shadura
Copyright 2011-2016 Igor A. Kotelnikov.
Copyright 2000 Aleksey Novodvorsky
Copyright 1995-2008 Olga Lapko.
Copyright 1989-2012 Johannes L. Braams.
This file is a part of the Belarusian-Babel package.
It may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
version 1.3c of this license or (at your option) any later
version. The latest version of this license is in the file:
http://www.latex-project.org/lppl.txt
The package is "maintained" (as per LPPL maintenance status) by
Andrej Shadura.
The package consists of the file belarusian.dtx
and the derived files belarusian.ins,
belarusian.ldf,
belarusian.pdf,
README.md
----------------------------------------------------------------
\endpostamble
\usedir{tex/generic/babel/contrib}
\generate{
\file{\jobname.ldf}{\from{\jobname.dtx}{code}}
}
%</install>
%<install>\endbatchfile
%<*internal>
\usedir{source/latex/babel-belarusian}
\generate{
\file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
\usedir{doc/latex/babel-belarusian}
\generate{
\file{README.md}{\from{\jobname.dtx}{readme}}
}
\ifx\fmtname\nameofplainTeX
\expandafter\endbatchfile
\else
\expandafter\endgroup
\fi
%</internal>
%<*code>
\NeedsTeXFormat{LaTeX2e}
%\ProvidesFile{belarusian.ldf}[2018/10/09 1.5 Belarusian support for the Babel system]
\ProvidesLanguage{belarusian}[2018/10/09 1.5 Belarusian support for the Babel system]
%</code>
%<*driver>
\documentclass[a4paper]{ltxdoc}
%%
%% This document should be compiled by
%% XeLaTeX or LuaLaTex since some cyrillic
%% glyphs are absent in T2* encodings used
%% by LaTeX.
%%
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi>0
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\setmainfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}
%\setmonofont[Scale=MatchLowercase]{Courier New}
%\setmonofont[Scale=MatchUppercase]{Courier New}
%\setmonofont{Courier New}
\else
\usepackage[X2,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\fi
\usepackage{textcomp}
\usepackage[belarusian.classic,main=english]{babel}
%\languageattribute{belarusian}{classic}
\usepackage[dvipsnames,usenames]{xcolor}
\definecolor{thered} {rgb}{0.65,0.04,0.07}
\definecolor{thegreen}{rgb}{0.06,0.44,0.08}
\definecolor{thegrey} {gray}{0.8}
\definecolor{theshade}{rgb}{1,1,0.97}
\definecolor{theframe}{gray}{0.6}
\definecolor{theblue}{cmyk}{1.00, 0.50, 0.00, 0.40}
%\usepackage[numbered]{hypdoc}
\usepackage[colorlinks=true
,linkcolor=violet %theblue %
,filecolor=purple %thegreen%
,citecolor=teal %thegreen%
]{hyperref}
% ====================================
\newcommand*\TeXhax{\TeX hax}
\newcommand*\babel{\textsf{babel}}
\newcommand*\Babel{\textsf{Babel}}
\newcommand*\xetex{\textsf{xetex}}
\newcommand*\luatex{\textsf{luatex}}
\providecommand*\m[1]{\mbox{$\langle$\normalfont\itshape#1\/$\rangle$}}
\newcommand*\langlist{%
\meta{language}\texttt{,}\meta{language}\texttt{,}...}
\newcommand*\langvar{\m{lang}}
\newcommand*\note[1]{}
\newcommand*\Lopt[1]{\textsf{#1}}
\newcommand*\Lenv[1]{\textsf{#1}}
\newcommand*\menv[1]{\char`\{#1\char`\}}
\newcommand*\Eenv[1]{%
\quad\ldots\quad
\texttt{\color{thered}\string\end\menv{#1}}}
\newcommand*\file[1]{\texttt{#1}}
\newcommand*\cls[1]{\texttt{#1}}
\newcommand*\pkg[1]{\texttt{#1}}
% ====================================
\IfFileExists{listings.sty}{
\usepackage{listings}
\lstset{
gobble=1,
columns=flexible,
keepspaces,
basicstyle=\MacroFont,
keywords=[0]{\selectlanguage,\foreignlanguage
,\babelhyphen,\babelhyphenation
,\lefthyphenmin,\righthyphenmin
,\StartBabelCommands,\SetString,\EndBabelCommands,\shorthandoff,\shorthandon
,\languageshorthands,\useshorthands,\defineshorthand
,\AddBabelHook,\SetStringLoop,\SetCase,\AfterBabelLanguage
,\defaultfontfeatures,\setmainfont,\setsansfont,\setmonofont
,\Belarusian,\cyrdash,\cdash
,\cyr,\cyrillictext,\textcyrillic,\cyrillicencoding
,\addto,\captionsbelarusian,\datebelarusian,\noextrasbelarusian,\extrasbelarusian
,\languageattribute
,\Asbuk,\asbuk,\ch,\sh,\tg,\ctg,\arctg,\arcctg\,\th,\cth,\cosec
,\nod,\nok,\prog,\NOF\,\NOK,\Prog
,\dq,\Proj,\nad,\NAD,\nak,\NAK,\Prob,\Variance
,\nod,\NOD,\nok,\NOK
,\XeTeXinputencoding
}
,keywordstyle=[0]\color{thered}
,keywords=[1]{main,belarusian,english,german,frenchb
,shorthands,extrasenglish
,stringprocess,afterextras
,soft,empty,nobreak,hard
,Renderer,Ligatures
,official,classic,tarask
,T1,T2A,lutf8,utf8
,fontspec,babel,inputenc,fontenc
},
keywordstyle=[1]\color{thegreen},
comment=[l]\%,
commentstyle=\color{thegrey}\itshape,
alsoother={0123456789_},
frame=single,
backgroundcolor=\color{theshade},
rulecolor=\color{theframe},
framerule=\fboxrule,
}
\let\verbatim\relax
\lstnewenvironment{verbatim}[1][]{\lstset{##1}}{}
\AtBeginDocument{%
\DeleteShortVerb{\|}%
\lstMakeShortInline|%
}
}{}
\def\PrintDescribeMacro#1{%
\strut\MacroFont\color{thered}\normalsize\string#1}
\def\Describe#1{%
\par\penalty-500\vskip3ex\noindent
\DescribeMacro{#1}\args}
\def\DescribeOther{\vskip-5.8ex\Describe}
\makeatletter
\def\args#1{%
\def\bbl@tempa{#1}%
\ifx\bbl@tempa\@empty\else#1\vskip1ex\fi\ignorespaces}
\makeatother
% ====================================
\EnableCrossrefs
%\DisableCrossrefs % Say \DisableCrossrefs if index is ready
\CodelineIndex % Index code by line number
\RecordChanges % Gather update information
%\PageIndex % Index code by page number
% ====================================
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
%\GetFileInfo{belarusian.dtx}
%\GetFileInfo{belarusian.ldf}
%
%\title{^^A
% \textsf{Belarusian} --- description text\thanks{^^A
% This file describes version \fileversion, last revised \filedate.^^A
% }^^A
%}
%\author{^^A
% You\thanks{E-mail: [email protected]}^^A
%}
% \title{The Belarusian Language\\
% in the \babel\ system\\[0.5em]
% \large Version \fileversion}
%
% \author{Andrej Shadura\footnote{E-mail: \href{mailto:[email protected]}{[email protected]}.}}
%
% \date{Released \filedate}
%
% \maketitle
%
% {\small\tableofcontents}
%
%
% \section{The Belarusian Language Definition File}
%
% The file \file{\filename}\footnote{The file described in this document
% has the version number \fileversion\ and was last revised on \filedate.}
% is the source file for the Belarusian Language Definition file
% \file{belarusian.ldf} to be loaded by the \babel\ package with
% the option \Lopt{belarusian}. It's based on the Russian language definition
% file derived by Igor A. Kotelnikov from the original version of \file{\filename}, first
% released by Olga Lapko and Johannes Braams and then
% adapted to the T2* and X2 Cyrillic encodings
% by Vladimir Volovich and Werner Lemberg, and the Belarusian language definition
% file written by Aleksey Novodvorsky based on even older version of the Russian
% language definition file.
%
% Just like \file{russianb.ldf}, \file{belarusian.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. A
% few obsolete and controversial macros has been eliminated in first public
% release of version 1.2 of \file{russianb.ldf}.
%
% Similarly to \file{russianb.ldf}'s support for typesetting ancient and
% Church Slavonic books, \file{belarusian.ldf} supports two versions of Belarusian
% orthography, the official one (\Lopt{official}) and the ‘classic’ (Taraškievič)
% orthography.
%
% \section{Usage}
%
% Typesetting Belarusian texts implies that a special input and output
% encodings should be used. Input encodings are those which are used in source
% (\file{.tex}) file. Output encoding is also known as the font encoding. It is
% implemented within the font files.
%
% Generally, the user may choose between different available Cyrillic
% encodings. The current support for Cyrillic uses LH family of MetaFont fonts
% and theirs Postscript versions such as CM-super. Lua\LaTeX\ and Xe\LaTeX,
% being the Unicode-based succeeders of \LaTeX, allow also for any Open Type
% (OTF) and True Type (TTF) fonts which has Cyrillic script, e.g. Computer
% Modern Unicode, Linux Libertine, and many other system fonts that came with
% Linux, Mac and Windows operating systems.
%
% With the advent of Unicode, \LaTeX\ community are moving towards eliminating
% all existing encodings in favor of Unicode, but nowadays one should take
% care when switching from \LaTeX\ to Lua\LaTeX\ or Xe\LaTeX\ since
% different packages should be loaded for those compilers.
%
% Since earlier versions \pkg{babel} did not
% support Xe\LaTeX\ (at least for some languages including Belarusian), the
% \pkg{polyglossia} package was generally recommended in the past for
% use with Xe\LaTeX\ as a replacement for \pkg{babel}. Nowadays, \pkg{babel}
% can be used with any engines, including \LaTeX, PDF\LaTeX, Lua\LaTeX, and
% Xe\LaTeX. Nevertheless some troubles may occur with some languages which
% have no promptly updated \file{.ldf} files.
%
%
% \subsection{\LaTeX}
%
% When user's document is compiled with \file{latex} or \file{pdflatex},
% recommended set of packages includes the \pkg{inputenc} and \pkg{fontenc}
% packages. They should be loaded before \pkg{babel}, for example,
% \begin{verbatim}
% \usepackage[T1,T2A]{fontenc}
% \usepackage[utf8]{inputenc}
% \usepackage[english,belarusian]{babel}
%\end{verbatim}
% Some variations in the order of loading the packages are allowed in this case
% but it is better to follow one and the same convention at all circumstances:
% the \pkg{babel} package should go last, and \pkg{fontenc} must be the first.
%
% Input encoding should be declared as option to the \pkg{inputenc}
% package. Known Cyrillic encodings include
% \texttt{cp1251} (Windows), \texttt{koi8-u} (UNIX) and their variants.
% Nowadays, this list is appended with \texttt{utf8} input encoding.
%
% Output encodings (also known as font encodings) are declared as options to
% the \pkg{fontenc} package. Known Cyrillic encodings are \texttt{T2A},
% \texttt{T2B}, \texttt{T2C}, \texttt{LCY}, and \texttt{X2};
% \texttt{LWN} is not supported since \texttt{LWN} has been excluded
% from the \pkg{cyrillic} bundle of related files.
%
%
% \subsection{Lua\LaTeX}
%
% If Unicode fonts are not available, Lua\LaTeX\ can run in compatibility
% (8-bit) mode to use same font as \LaTeX\ does. However the package
% \pkg{inputenc} does not work with Lua\LaTeX\ and should be substituted with
% \pkg{luainputenc}. Source file is to be converted to \texttt{UTF8}
% (Unicode-8) encoding; it is the only input encoding accepted by
% Lua\LaTeX. The 8-bit mode is invoked by the following sequence of packages:
%\begin{verbatim}
%\usepackage[T1,T2A]{fontenc}
%\usepackage[lutf8]{luainputenc}
%\usepackage[english,belarusian]{babel}
%\end{verbatim}
% The order of the packages is crucial for Lua\LaTeX\ in 8-bit mode. Since both
% \pkg{luainputenc} and \pkg{babel} should know what is a selected font encoding,
% the \pkg{fontenc} package should be loaded first. Input encoding management for
% Lua\TeX\ is needed only for compatibility with old documents. For new
% documents, using UTF-8 encoding and Unicode fonts is strongly recommended.
% \emph{You've been warned!} See
% \href{http://tex.stackexchange.com/questions/31709/can-one-instruct-lualatex-to-use-t2a-encoded-fonts}%
% {tex.stackexchange.com/questions/31709/can-one-instruct-lualatex-to-use-t2a-encoded-fonts}.
%
%
% To invoke Unicode mode, one needs to load the \pkg{fontspec} package instead
% of \pkg{luainputenc} and \pkg{fontspec} and explicitly indicate which True Type
% or Open Type fonts should be used for romanic, sans-serif and monospaced types.
% The following example shows how to load Computer Modern Unicode (CMU) fonts,
% which is a part of all modern \LaTeX\ distributions:
%\begin{verbatim}
%\usepackage{fontspec}
% \defaultfontfeatures{Renderer=Basic,Ligatures={TeX}}
% \setmainfont{CMU Serif}
% \setsansfont{CMU Sans Serif}
% \setmonofont{CMU Typewriter Text}
%\usepackage[english,belarusian]{babel}
%\end{verbatim}
% The |\defaultfontfeatures| declares default font features for subsequent
% |\setmainfont| (which sets romanic fonts), |\setsansfont| (sans-serif) and
% |\setmonofont| (monospaced font). Font features can be set up on per font
% bases; for example
% \begin{verbatim}
% \usepackage{fontspec}
% \setmainfont[Renderer=Basic,Ligatures={TeX}]{CMU Serif}
% \setsansfont[Renderer=Basic,Ligatures={TeX,Historic}]{CMU Sans Serif}
% \setmonofont{CMU Typewriter Text}
% \usepackage[english,belarusian]{babel}
%\end{verbatim}
% Here |Renderer=Basic,Ligatures={TeX}| activates ligatures which are existed
% in \LaTeX.
%
% Recall that the language enlisted last in the list of options of the \pkg{babel}
% package is assumed to be the main language of the document, which is also active
% language right after |\begin{document}|. As of version 3.9, the main language
% can be set as a value of the |main| option as follows
%\begin{verbatim}
% \usepackage{fontspec}
% \usepackage[english,main=belarusian,german]{babel}
%\end{verbatim}
% %\unskip
%
%
%
% \subsection{Xe\LaTeX}
%
% In Xe\LaTeX, there is also a special mode for 8-bit compatibility.
% One can use |\XeTeXinputencoding| to change the input encoding
% temporarily, and the \texttt{"bytes"} encoding makes Xe\LaTeX\ works
% like a 8-bit \LaTeX\ engine:
% \begin{verbatim}
% \XeTeXinputencoding "bytes"
% \usepackage[utf8]{inputenc}
% \usepackage[T2A]{fontenc}
% \usepackage[english,belarusian]{babel}
%\end{verbatim}
% \unskip
% Xe\TeX\ can use a different input encoding but it always uses the Unicode
% internally, so that |\XeTeXinputencoding| performs a conversion of the input
% into Unicode;
% see \href{http://tex.stackexchange.com/questions/36188/do-xetex-and-luatex-always-use-unicode}
% {tex.stackexchange.com/questions/36188/do-xetex-and-luatex-always-use-unicode}.
%
%
% Unicode mode is set up same way as for Lua\LaTeX, however the option
% |Renderer=Basic| can be dropped:
%\begin{verbatim}
% \usepackage{fontspec}
% \defaultfontfeatures{Ligatures={TeX}}
% \setmainfont{CMU Serif}
% \setsansfont{CMU Sans Serif}
% \setmonofont{CMU Typewriter Text}
% \usepackage[english,belarusian]{babel}
%\end{verbatim}
% %\unskip
%
%
% \subsection{Official and ‘classic’ spelling}
% \label{ssec:spelling}
%
% By default, the official spelling is enabled. The ‘classic’ (Taraškievič)
% spelling can be enabled by setting the attribute to \Lopt{classic} or
% \Lopt{tarask}. To set an attribute, put the |\languageattribute| macro
% within a document preamble after \babel, for example,
%\begin{verbatim}
% \usepackage[english,belarusian]{babel}
% \languageattribute{belarusian}{classic}
%\end{verbatim}
% Setting the \Lopt{classic} attribute changes the built-in strings (caption names)
% and a date format. For example, the references list will be entitled as
% `\textcyrillic{Спіс літаратуры}' by default and as `\textcyrillic{Сьпіс літаратуры}' if the
% Belarusian language attribute is set to \Lopt{classic}.
% The same result can be achieved using a modifier as follows:
%\begin{verbatim}
%\usepackage[english,belarusian.classic]{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).
%
% Both attributes \Lopt{classic} and \Lopt{tarask} may be used interchangeably.
%
%\section{User's commands}
%
% In a multilingual document, some typographic rules are language
% dependent and should apply to the whole document.
%
%^^AAs of version~1.2, \file{belarusian.ldf} behaves differently
%^^Aaccording to \babel's \emph{main language} defined as the \emph{last}
%^^Aoption. When Belarusian is
%^^A|babel|'s main language, it adjusts global layout of the document
%^^Aaccording to typographical conventions of Belarusian language. Namely,
%^^A\file{belarusian.ldf} makes the following changes to global layout even
%^^Ain the parts where Belarusian is not current language:
%^^A\begin{enumerate}
%^^A\item
%^^A the first paragraph of any section becomes indented (\LaTeX{} only).
%^^A (this is obsolete statement starting from version 1.2a)
%^^A\end{enumerate}
%
% Regarding local typography, the macro |\selectlanguage{belarusian}|
% switches to the Belarusian language, with the following effects:
% \begin{enumerate}
% \item Belarusian hyphenation patterns are made active;
% \item |\today| prints the date in Belarusian;
% \item the caption names are translated into Belarusian
% (\LaTeX{} only);
% \item emdash typed by the ligature |---| might be 20\% shorter when Belarusian
% is the current language; the result depends on the current encoding; |---|
% always produce long emdash in Lua\TeX\ and Xe\TeX\ since these engines
% use same encodings for all languages;
% \item emdash typed by the ligature |"---| in Belarusian is 20\% shorter, however
% the ligature |"---| might not be defined in other languges; a
% shorter emdash (i.e. |\cyrdash|) can be typeset in any language using
% special macros enlisted in table \ref{tab:belarusian-quote}.
% \end{enumerate}
%
% By default, the official spelling is used for built-it strings (caption names) and
% the date. The spelling can be reverted to the classic one by setting the language
% attribute to \Lopt{classic} in the document preamble as discussed in
% Sec.~\ref{ssec:spelling}.
%
% Since Belarusian has its own numbering system, \file{belarusian.ldf} adds macros
% |\asbuk|\marg{counter} and |\Asbuk|\marg{counter} for formatting numbers appropriately the alphabetic
% sequence in the Belarusian alphabet. Additional commands are provided
% to typeset quotes:
% \begin{enumerate}
% \item French quotation marks can be entered using the commands
% |\guillemotleft| and |\guillemotright| which work in \LaTeXe\
% and Plain\TeX.
% \item German quotation marks can be entered using the commands
% |\glqq| and |\grqq| which work in \LaTeXe\ and Plain\TeX.
% \end{enumerate}
%
% The macro |\Belarusian| is now defined as an alias for
% |\selectlanguage{belarusian}|, and its ``opponent'' |\English|, existed
% in \file{belarusian.ldf} prior to version 1.2 has been removed since the Belarusian
% language definition file is wrong place for definition of macros which
% switch to a distinct other language.
%
% The macro |\textcyrillic|\marg{text} is intended to typeset small chunks of text
% in Belarusian; it is essentially an alias for |\foreignlanguage{belarusian}|\marg{text}.
%
%
% \subsection{Active character}
%
% Table~\ref{tab:belarusian-quote} shows macros and active string which can be
% used to typeset various dashes and quotes.
% In the Belarusian language, the character |"| is made active. It can be
% considered as second escape character in addition to |\|. Some dashes and
% all quotes can be typed using both active character |"| and ordinary
% macros as indicated in the table. However, some shorthanded hyphenations
% have no macro counterpart.
%
% \begin{table}[ht]\centering
% \caption{Extra definitions made
% by \file{belarusian.ldf}}\label{tab:belarusian-quote}
% \medskip
% \begin{tabular}{llp{7cm}}
% \hline\hline\\[-0.5em]
% |\glqq| & |"`| &
% German opening double quote (looks like ,\kern-0.08em,). \\
% |\grqq| & |"'| &
% German closing double quote (looks like ``). \\
% |\guillemotleft| & |"<| &
% French opening double quote (looks like $<\!\!<$). \\
% |\guillemotright| & |">| &
% French closing double quote (looks like $>\!\!>$). \\
% |\dq| & &
% Original quotes character (|"|). \\[0.5em]
% |\babelhyphen{soft}|
% & |"-| & Optional (soft) hyphen sign, similar to |\-| but allows
% hyphenation in the rest of the word;
% equivalent to |\babelhyphen{soft}| in \pkg{babel} 3.9. \\
% |\babelhyphen{empty}|
% & |""| & Similar to |"-| but prints no hyphen sign
% (used for compound words with hyphen, e.g. |x-""y|);
% equivalent to |\babelhyphen{empty}| in \pkg{babel} 3.9. \\
% |\babelhyphen*{nobreak}|
% & |"~| & Compound word mark without a breakpoint, prints hyphen
% prohibiting hyphenation at the point;
% equivalent to |\babelhyphen*{nobreak}| in \pkg{babel} 3.9. \\
% |\babelhyphen{hard}|
% & |"=| & A compound word mark with a breakpoint, prints hyphen
% allowing hyphenation in the composing words.
% equivalent to |\babelhyphen{hard}| in \pkg{babel} 3.9. \\
% |\babelhyphen{nobreak}|
% & \verb="|= & Disables ligature at this position;
% equivalent to |\babelhyphen{nobreak}| (??) in \pkg{babel} 3.9.
% \\[0.5em]
% |\cyrdash| & & Row Cyrillic emdash (does not care
% spaces around). \\
% |\cdash---| & |"---| &
% Cyrillic emdash in plain text. \\
% |\cdash--~| & |"--~| &
% Cyrillic emdash in compound names
% (as in |Mendeleev"--~Klapeiron|). \\
% |\cdash--*| & |"--*| &
% Cyrillic emdash for denoting direct speech. \\
% & |",| & Thin space
% (allows further hyphenation as in |D.",Mendeleev|). \\[0.5em]
% \hline\hline
% \end{tabular}
% \end{table}
% Note that the standard soft hyphen |\-| is equivalent to |\babelhyphen*{soft}|.
%
% \medskip
%
% The quotation marks traditionally used in Belarusian were borrowed from
% other languages (e.g., French and German) so they keep their original
% names.
%
% The French quotes are also available as ligatures `|<<|' and `|>>|' in
% 8-bit Cyrillic font encodings (\texttt{LCY}, \texttt{X2}, \texttt{T2*})
% and in Unicode encodings (\texttt{EU1} and \texttt{EU2})
% and as `|<|' and `|>|' characters in 7-bit Cyrillic font encodings
% (\texttt{OT2} and \texttt{LWN}).
%
% In Unicode encodings \texttt{EU1} and \texttt{EU2} cyrdashes and quotes
% can be typed as single character if text editor makes it possible to
% insert characters which absent of standard keyboard. This method works
% as well for 8-bit fonts encoded according to \texttt{T2A} if source file
% is encoded with \texttt{cp1251} or {utf8}.
%
% By default, active double quote is switched on. It can be switched off
% any time using |\shorthandoff{"}| and the switched on again using
% |\shorthandon{"}|. The aliases |\mdqoff| and |\mdqon| for these two macros
% has been removed from \file{belarusian.ldf} starting from version 1.3 in favour of
% the macros |\shorthandon| and |\shorthandoff| provided in the \pkg{babel} core.
%
%
% \subsection{Math commands}
%
% \file{\filename} defines few macros than can be used independently
% of current language. These are 9 macros to be used in math mode to type
% the names of trigonometric functions common for Belarusian documents:
% |\sh|, |\ch|, |\tg|, |\ctg|, |\arctg|, |\arcctg|, |\th|, |\cth|, and
% |\cosec|. Cyrillic letters in math mode can be typed with the aid of
% text commands such as |\textbf|, |\textsf|, |\textit|, |\texttt|, e.t.c.
%
% The macros |\Prob|, |\Variance|, |\NAD|, |\nad|, |\NAK|, |\nak|, |\Proj|
% print some rare Belarusian mathematical symbols.
%
%
% \section{\TeX{}nical details}
%
% The packages \pkg{inputenc} and \pkg{luainputenc}
% make Cyrillic letters active so that a compiler converts them into
% corresponding |\cyr...| macro at compilation time.
% For example, Belarusian letter `a' matches
% macro |\cyra|, and capital Belarusian letter `A' matches |\CYRA|. The
% package \pkg{fontenc} then matches every macro |\cyr...| to corresponding
% glyph in a font file depending on a declared font encoding.
%
% Nowadays, Unicode makes |\cyr...| macros outdated since both source
% file and font file are encoded consistently. These macros
% should therefore be removed because mixing them with Unicode characters
% breaks sorting mechanism of such utilities as \file{bibtex} and
% \file{makeindex}. For the sake of backward compatibility, |\cyr...| are
% still kept for \LaTeX, but they are bypassed if Lua\LaTeX\ or Xe\LaTeX\
% are detected.
%
% Some inconsistences of prior versions of \file{\filename} was also
% overcame in the version 1.2. Those users who used |\selectlanguage| macro,
% defined in the core \pkg{babel} system, to switch between
% different languages should not worry. However, the macros
% |\Belarusian|, |\Englsih| and their aliases |\Rus|, |\cyr|,
% |\Eng| are modified or removed as they did not
% conform the mechanism of language switching encoded into the
% core of \pkg{babel} and therefore can mess it.
%
%
% \section{Known problems}
%
% Before switching from a legacy 8-bit engine (tex, pdftex) to an Unicode
% engine (xetex, luatex) and vise versa delete all |.aux|, |.toc|, |.lot|,
% |.lof| files as they might have stored incompatible internal encodings.
%
% \cs{cyrdash} might produce dashes of different width in same document after
% switching to/from Belarusian language if the document is compiled with legacy
% engines.
%
% \section{History}
%
%\StopEventually{^^A
% \setlength{\postmulticols}{100pt} % 20pt by default
% \PrintChanges
% \PrintIndex
%}
%
%\iffalse
%<*code>
%\fi
%
%
% \section{Implementation}
%
% \changes{1.3e}{2014/10/14}{Update documentation}
% \changes{1.3d}{2014/10/02}{Fix bug in \cs{Proj}}
% \changes{1.3c}{2014/06/02}{Fix bug in \cs{datebelarusian}}
% \changes{1.3b}{2013/04/06}{Renamed to belarusian to work with babel 3.9}
% \changes{1.2b}{2013/01/08}{Renamed to belarusianu to work with babel-beta 3.9}
% \changes{1.2a}{2012/06/06}{Indentation of 1st paragraph removed}
% \changes{1.1c}{1996/07/11}{Replaced \cs{undefined} with
% \cs{@undefined} and \cs{empty} with \cs{@empty} for consistency
% with \LaTeX}
% \changes{1.1d}{1996/10/10}{Moved the definition of
% \cs{atcatcode} right to the beginning.}
% \changes{1.1k}{1999/08/19}{replaced all \cs{penalty}\cs{@M}
% with \cs{nobreak}}
% \changes{1.1f}{1998/06/26}{%
% Added definitions of Cyrillic emdash stuff and thinspace}
% \changes{1.1f}{1998/06/26}{%
% Added definitions of Cyrillic emdash stuff and thinspace}
%
%
% \subsection{Initial setup}
%
% The macro |\LdfInit| performs a couple of standard checks that
% must be made at the beginning of a language definition file,
% such as checking the category code of the \texttt{@}-sign, preventing
% the \file{.ldf} file from being processed twice, etc.
%
% \changes{1.1d}{1996/11/03}{Now use \cs{LdfInit} to perform
% initial checks}
% \changes{1.1e}{1996/12/29}{Added closing brace to second
% argument of \cs{LdfInit}}
% \begin{macrocode}
\LdfInit{belarusian}{captionsbelarusian}
% \end{macrocode}
%
% First, we check if Lua\LaTeX\ or Xe\LaTeX\ is running. If so, we set
% boolean key |\if@uni@ode@be| to true. It will be used to eliminate |\cyr...|
% commands, which were introduced in \LaTeX2e\ to handle various
% Cyrillic input encoding. With the advent of Unicode \LaTeX\ is
% moving to universal input encoding, so we consider these |\cyr...|
% commands as obsolete. They are preserved though for backward
% compatibility in case if \LaTeX\ or PDF\LaTeX\ are running.
%
% We don't load the \pkg{ifluatex} or \pkg{ifxetex} package because
% |\RequirePackage| is not allowed at the stage of processing options
% (note that babel loads this file right when it processes its own options)
% but we borrow code from these packages.
%
% \changes{1.2}{2011/10/20}{Check for LuaTeX}
% \begin{macrocode}
\ifdefined\if@uni@ode@be
\PackageError{babel}{if@uni@ode already defined.\MessageBreak
Please contact author of belarusian.ldf}
\relax
\fi
\newif\if@uni@ode@be
\ifdefined\luatexversion \@uni@ode@betrue \else
\ifdefined\XeTeXrevision \@uni@ode@betrue \fi\fi
% \end{macrocode}
%
% Check if hyphenation patterns for the Belarusian language have been
% loaded in \file{language.dat}. Namely, we check for the existence of
% |\l@belarusian|. If it is not defined, we declare Belarusian as dialect
% for the default language number 0 which almost for sure is English.
%
% \begin{macrocode}
\ifx\l@belarusian\@undefined
\@nopatterns{Belarusian}
\adddialect\l@belarusian0
\fi
% \end{macrocode}
% Now |\l@belarusian| is always defined.
%
% \subsection{Output encoding}
%
% We need to know font encoding that is supposed to be
% active at the end of the \babel\ package. Default font encoding, set by
% \LaTeX\ core, is \texttt{OT1}. This can be changed by the \pkg{fontenc}
% package in case of \LaTeX\ and by \pkg{fontspec} package in case of
% Lua\LaTeX. It matters weather these packages are loaded before of after
% \pkg{babel}. In the latter case or if these packages are not loaded at all,
% \file{belarusian.ldf} ignores their effect and tries to provide some
% reasonable settings. In particular, \texttt{T2A} will be selected for
% Belarusian language if \LaTeX\ is running but \texttt{EU1} in case of
% Xe\LaTeX\ and \texttt{EU2} in case of Lua\LaTeX.
%
% \begin{macro}{\latinencoding}
% \changes{1.2}{2011/10/20}{Removed \cs{latinencoding}}
%
% The macro |\latinencoding| keeps the name of Latin encoding. It is
% defined in \file{babel.def} and is wrapped into |\AtBeginDocument| to allow
% for late loading \pkg{fontenc}. Therefore it does not matter
% whether \pkg{babel} is loaded before or after the \pkg{fontenc}.
% As of version 1.2, definition of |\latinencoding| was removed from
% \file{belarusian.ldf} since it is overruled in \file{babel.def}.
% For example, after
%\begin{verbatim}
%\usepackage[T1,T2A]{fontenc}
%\usepackage[english,belarusian]{babel}
%\end{verbatim}%
% as well as after
%\begin{verbatim}
%\usepackage[english,belarusian]{babel}
%\usepackage[T1,T2A]{fontenc}
%\end{verbatim}%
% |\latinencoding| will be set to \texttt{T1}.
% After
%\begin{verbatim}
%\usepackage[english,belarusian]{babel}
%\end{verbatim}%
% |\latinencoding| will be \texttt{OT1}.
%
% In Unicode mode, the package \pkg{fontspec} should be loaded instead of
% \pkg{fontenc} to make font preparation; \pkg{fontspec} loads the package
% \pkg{xunicode} which sets current encoding (kept in |\cf@encoding|) to
% \texttt{EU1} for Xe\LaTeX\ and \texttt{EU2} for Lua\LaTeX, and the \pkg{babel}
% package sets the macro |\latinencoding| to |\cf@encoding|. Since \pkg{babel} scan
% for value |\cf@encoding| within |\AtBeginDocument|, |\latinencoding| will
% be set to either \texttt{EU1} for Xe\LaTeX\ or \texttt{EU2} for Lua\LaTeX\
% no matter which of the packages, \pkg{babel} or \pkg{fontspec} is loaded first.
%
% \end{macro}
%
% \Describe\cyrillicencoding{}
% There is a limited list of encodings appropriate for Cyrillic text. We
% will look which of them is declared and keep its name in the macro
% |\cyrillicencoding|.
% Correct (but obsolete and now deleted) 7-bit Cyrillic encoding is
% \texttt{LWN}.
% Correct 8-bit Cyrillic encodings are
% \texttt{T2A} (default for 8-bit compilers), \texttt{T2B}, \texttt{T2C},
% \texttt{LCY} and \texttt{X2}.
% Correct utf8 encodings are
% \texttt{EU1} (default for Xe\LaTeX),
% \texttt{EU2} (default for Lua\LaTeX).
%
% In 8-bit (\LaTeX) mode, user may choose between different non-unicode Cyrillic
% encodings---e.g., \texttt{X2} or \texttt{LCY}.\@ If user wants
% to use another font encoding rather than default (\texttt{T2A}),
% he has to load the corresponding file \emph{before} \file{babel.sty}.
%
% Remember that for the Belarusian language, the \texttt{T2A} encoding is
% better than \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 Belarusian phrase
% or vice versa.
%
%
% We parse the |\cdp@list| containing encodings known to \LaTeX\
% in the order they were loaded by the time when \pkg{babel} is loaded.
% We set the |\cyrillicencoding| to the \emph{last} loaded encoding in the
% list of supported Cyrillic encodings: \texttt{OT2}, \texttt{LCY},
% \texttt{X2}, \texttt{T2C}, \texttt{T2B}, \texttt{T2A}. In Unicode mode
% we also try the Unicode encodings \texttt{EU1} and \texttt{EU2}; 8-bit
% encodings are kept for Unicode compilers (Lua\LaTeX\ and Xe\LaTeX) since
% they can run in compatibility (8-bit) mode.
%
% \changes{1.2}{2011/10/20}{EU1 and EU2 encodings added}
% \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}{LCY}%
\sce@a{##1}{X2}%
\sce@a{##1}{T2C}%
\sce@a{##1}{T2B}%
\sce@a{##1}{T2A}%
\if@uni@ode@be
\sce@a{##1}{EU1}%
\sce@a{##1}{EU2}%
\fi}%
\cdp@list
}
\@setcyrillicencoding
\@onlypreamble\@setcyrillicencoding
\@onlypreamble\sce@a
\@onlypreamble\sce@b
\@onlypreamble\sce@c
% \end{macrocode}
% The last lines are to free the memory occupied by the macros
% |\@setcyrillicencoding| and |\sce@x| that are useless in the document.
% The contents of |\@begindocumenthook| is cleared automatically.
%
% If |\cyrillicencoding| is still undefined, we issue warning and provide
% reasonable default value for |\cyrillicencoding|. We then load default
% encoding definitions; we use the lowercase names (i.e.,
% \texttt{lcyenc.def} instead of \texttt{LCYenc.def}) when we do that.
%
% \changes{1.2}{2011/10/20}{Removed test for present of
% encoding files}
% \begin{macrocode}
\ifdefined\cyrillicencoding
\else
\if@uni@ode@be
\ifdefined\XeTeXrevision
\edef\cyrillicencoding{EU1}
\else\ifdefined\luatexversion
\edef\cyrillicencoding{EU2}
\fi\fi
\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