Debian Codegraph @

texmf-dist/tex/latex/polyglossia/gloss-russian.ldf

raw
1 % Language definition file (part of polyglossia v2.10 -- 2026/04/18)
2 %
3 \ProvidesFile{gloss-russian.ldf}[polyglossia: module for Russian]
4
5 \RequirePackage{xpg-cyrillicnumbers}
6
7 \PolyglossiaSetup{russian}{
8 bcp47=ru,
9 bcp47-language=ru,
10 bcp47-variant=luna1918,
11 bcp47-script=Cyrl,
12 script=Cyrillic,
13 scripttag=cyrl,
14 langtag=RUS,
15 hyphennames={russian},
16 hyphenmins={2,2},
17 frenchspacing=true,
18 indentfirst=true,
19 localnumeral=russiannumerals,
20 Localnumeral=Russiannumerals
21 }
22
23 % BCP-47 compliant aliases
24 \setlanguagealias*{russian}{ru}
25 \setlanguagealias*[spelling=modern]{russian}{ru-luna1918}
26 \setlanguagealias*[spelling=old]{russian}{ru-petr1708}
27
28 \newif\if@russian@modern
29
30 \def\captionsrussian{%
31 \if@russian@modern\captionsrussian@modern\else\captionsrussian@old\fi%
32 }%
33
34 \def\daterussian{%
35 \if@russian@modern\daterussian@modern\else\daterussian@old\fi%
36 }%
37
38 \newif\ifcyrillic@numerals
39 \newif\ifcyrillic@asbuk@numerals
40
41 \DeclareKeys[polyglossia/gloss/russian]
42 {
43 babelshorthands.if = russian@babelshorthands,
44 babelshorthands.default:n = true,
45 forceheadingpunctuation.if = russian@forceheadingpunctuation,
46 forceheadingpunctuation.default:n = true,
47 mathfunctions.if = russian@mathfunctions,
48 mathfunctions.default:n = true,
49 spelling.choice:,
50 spelling / modern.code =
51 {%
52 \@russian@moderntrue
53 \SetLanguageKeys{russian}{bcp47=ru,bcp47-variant=luna1918}%
54 },
55 spelling / old.code =
56 {%
57 \@russian@modernfalse
58 \SetLanguageKeys{russian}{bcp47=ru-petr1708,bcp47-variant=petr1708}%
59 },
60 spelling.default:n = modern,
61 numerals.choice:,
62 numerals / arabic.code =
63 {%
64 \cyrillic@numeralsfalse
65 \cyrillic@asbuk@numeralsfalse
66 \SetLanguageKeys{russian}{bcp47-extension-u=nu-latn}%
67 },
68 numerals / cyrillic.code =
69 {%
70 \cyrillic@numeralstrue
71 \cyrillic@asbuk@numeralsfalse
72 \SetLanguageKeys{russian}{bcp47-extension-u=nu-cyrl}%
73 },
74 numerals / cyrillic-trad.code =
75 {%
76 \cyrillic@numeralstrue
77 \cyrillic@asbuk@numeralsfalse
78 \SetLanguageKeys{russian}{bcp47-extension-u=nu-cyrl}%
79 },
80 numerals / cyrillic-alph.code =
81 {%
82 \cyrillic@numeralstrue
83 \cyrillic@asbuk@numeralstrue
84 \SetLanguageKeys{russian}{bcp47-extension-u=nu-cyrl}%
85 },
86 numerals.default:n = arabic,
87 numerals/unknown.code = \xpg@warning{Unknown Russian numerals value `#1'},
88 indentfirst.choice:,
89 indentfirst / true.code =
90 {%
91 \SetLanguageKeys{russian}{indentfirst=true}%
92 },
93 indentfirst / false.code =
94 {%
95 \SetLanguageKeys{russian}{indentfirst=false}%
96 },
97 indentfirst.default:n = true,
98 }
99
100 \ifsystem@babelshorthands
101 \SetGlossOptions{russian}{babelshorthands=true}
102 % Register default options
103 \InitializeGlossOptions{russian}{babelshorthands=true,
104 spelling=modern,
105 numerals=arabic,
106 indentfirst=true,
107 forceheadingpunctuation=true,
108 mathfunctions=true}
109 \else
110 \SetGlossOptions{russian}{babelshorthands=false}
111 % Register default options
112 \InitializeGlossOptions{russian}{babelshorthands=false,
113 spelling=modern,
114 numerals=arabic,
115 indentfirst=true,
116 forceheadingpunctuation=true,
117 mathfunctions=true}
118 \fi
119
120 \InitializeBabelShorthands
121
122 \def\russian@shorthands{%
123 \xpg@activate@shorthands%
124 \def\language@group{russian}%
125 % \declare@shorthand{russian}{"`}{„}%
126 % \declare@shorthand{russian}{"'}{“}%
127 % \declare@shorthand{russian}{"<}{«}%
128 % \declare@shorthand{russian}{">}{»}%
129 \declare@shorthand{russian}{""}{\xpg@invisible@break}%
130 \declare@shorthand{russian}{"~}{\xpg@nobreak@hyphen}%
131 \declare@shorthand{russian}{"=}{\xpg@breakable@hyphen}%
132 \declare@shorthand{russian}{"|}{\xpg@ligature@break}%
133 \declare@shorthand{russian}{"-}{\xpg@cyrillic@dash}%
134 \declare@shorthand{russian}{",}{\xpg@thinspace@allow@hyphenation@after}%
135 }
136
137 \ifx\cyrdash\undefined
138 \def\cyrdash{\leavevmode\hbox to.8em{\textendash\hss\textendash}}%
139 \fi
140
141 \def\norussian@shorthands{%
142 \xpg@deactivate@shorthands%
143 }
144
145
146 \def\captionsrussian@modern{%
147 \def\prefacename{Предисловие}%
148 \def\refname{Список литературы}%
149 \def\abstractname{Аннотация}%
150 \def\bibname{Литература}%
151 \def\chaptername{Глава}%
152 \def\appendixname{Приложение}%
153 \@ifundefined{thechapter}%
154 {\def\contentsname{Содержание}}%
155 {\def\contentsname{Оглавление}}%
156 \def\listfigurename{Список иллюстраций}%
157 \def\listtablename{Список таблиц}%
158 \def\indexname{Предметный указатель}%
159 \def\authorname{Именной указатель}%
160 \def\figurename{Рис.}%
161 \def\tablename{Таблица}%
162 \def\partname{Часть}%
163 \def\enclname{вкл.}%
164 \def\ccname{исх.}%
165 \def\headtoname{вх.}%
166 \def\pagename{с.}%
167 \def\seename{см.}%
168 \def\alsoname{см.~также}%
169 \def\proofname{Доказательство}%
170 }
171 \def\daterussian@modern{%
172 \def\today{\number\day%
173 \space\ifcase\month\or%
174 января\or
175 февраля\or
176 марта\or
177 апреля\or
178 мая\or
179 июня\or
180 июля\or
181 августа\or
182 сентября\or
183 октября\or
184 ноября\or
185 декабря\fi%
186 \space \number\year\space г.}%
187 }
188
189 \def\captionsrussian@old{%
190 \def\prefacename{Предисловіе}%
191 \def\refname{Примѣчанія}%
192 \def\abstractname{Аннотація}%
193 \def\bibname{Библіографія}%
194 \def\chaptername{Глава}%
195 \def\appendixname{Приложеніе}%
196 \@ifundefined{thechapter}%
197 {\def\contentsname{Содержаніе}}%
198 {\def\contentsname{Оглавленіе}}%
199 \def\listfigurename{Списокъ иллюстрацій}%
200 \def\listtablename{Списокъ таблицъ}%
201 \def\indexname{Предмѣтный указатель}%
202 \def\authorname{Именной указатель}%
203 \def\figurename{Рис.}%
204 \def\tablename{Таблица}%
205 \def\partname{Часть}%
206 \def\enclname{вкл.}%
207 \def\ccname{исх.}%
208 \def\headtoname{вх.}%
209 \def\pagename{с.}%
210 \def\seename{см.}%
211 \def\alsoname{см.~также}%
212 \def\proofname{Доказательство}%
213 }
214
215 \def\daterussian@old{%
216 \def\today{\number\day%
217 \space\ifcase\month\or%
218 января\or
219 февраля\or
220 марта\or
221 апреля\or
222 мая\or
223 іюня\or
224 іюля\or
225 августа\or
226 сентября\or
227 октября\or
228 ноября\or
229 декабря\fi%
230 \space \number\year\space г.}%
231 }
232
233 % Russian needs trailing dots in all headings
234 \def\xpg@save@autodot{}
235 \ifdef{\KOMAClassName}{%
236 \providecommand*\autodot{}%
237 \let\xpg@save@autodot\autodot%
238 }{}
239
240 \def\russian@capsformat{%
241 \ifrussian@forceheadingpunctuation%
242 \ifdef{\KOMAClassName}{%
243 \renewcommand*\autodot{.}%
244 }{%
245 % The following is based on some ideas from ruscor.sty
246 \def\@seccntformat##1{\csname pre##1\endcsname%
247 \csname the##1\endcsname%
248 \csname post##1\endcsname}%
249 \def\@aftersepkern{\hspace{0.5em}}%
250 \def\postchapter{.\@aftersepkern}%
251 \def\postsection{.\@aftersepkern}%
252 \def\postsubsection{.\@aftersepkern}%
253 \def\postsubsubsection{.\@aftersepkern}%
254 \def\postparagraph{.\@aftersepkern}%
255 \def\postsubparagraph{.\@aftersepkern}%
256 \def\prechapter{}%
257 \def\presection{}%
258 \def\presubsection{}%
259 \def\presubsubsection{}%
260 \def\preparagraph{}%
261 \def\presubparagraph{}%
262 }%
263 \fi%
264 }
265
266 \def\norussian@capsformat{%
267 \ifrussian@forceheadingpunctuation%
268 \ifdef{\KOMAClassName}{%
269 \let\autodot\xpg@save@autodot%
270 }{%
271 \def\@seccntformat##1{\csname the##1\endcsname\quad}% = LaTeX kernel
272 }%
273 \fi%
274 }
275
276 \newcommand{\russiannumerals}[2]{\russiannumber{#2}}
277 \newcommand{\Russiannumerals}[2]{\Russiannumber{#2}}
278
279 \def\russiannumber#1{%
280 \ifcyrillic@numerals
281 \ifcyrillic@asbuk@numerals
282 \russian@asbuk@alph{#1}%
283 \else
284 \cyr@alph{#1}%
285 \fi
286 \else
287 \number#1%
288 \fi%
289 }
290
291 \def\Russiannumber#1{%
292 \ifcyrillic@numerals
293 \ifcyrillic@asbuk@numerals
294 \russian@asbuk@Alph{#1}%
295 \else
296 \cyr@Alph{#1}%
297 \fi
298 \else
299 \number#1%
300 \fi%
301 }
302
303 \let\russiannumeral=\russiannumber
304 \let\Russiannumeral=\Russiannumber
305
306 \def\Asbuk#1{\expandafter\russian@asbuk@Alph\csname c@#1\endcsname}
307 \def\asbuk#1{\expandafter\russian@asbuk@alph\csname c@#1\endcsname}
308
309 \def\AsbukTrad#1{\expandafter\cyr@Alph\csname c@#1\endcsname}
310 \def\asbukTrad#1{\expandafter\cyr@alph\csname c@#1\endcsname}
311
312
313 % This is a poor man's cyrillic alphanumeric. It just uses the alphabet and
314 % thus ends at 30.
315 \def\russian@asbuk@Alph#1{\ifcase#1\or
316 А\or Б\or В\or Г\or Д\or Е\or Ж\or
317 З\or И\or К\or Л\or М\or Н\or О\or
318 П\or Р\or С\or Т\or У\or Ф\or Х\or
319 Ц\or Ч\or Ш\or Щ\or Э\or Ю\or Я%
320 \else\xpg@ill@value{#1}{russian@asbuk@Alph}\fi%
321 }
322
323 \def\russian@asbuk@alph#1{\ifcase#1\or
324 а\or б\or в\or г\or д\or е\or ж\or
325 з\or и\or к\or л\or м\or н\or о\or
326 п\or р\or с\or т\or у\or ф\or х\or
327 ц\or ч\or ш\or щ\or э\or ю\or я%
328 \else\xpg@ill@value{#1}{russian@asbuk@alph}\fi%
329 }
330
331 \def\russian@numbers{%
332 \let\latin@alph\@alph
333 \let\latin@Alph\@Alph
334 \ifcyrillic@numerals%
335 \def\russian@alph##1{\expandafter\russiannumeral\expandafter{\the##1}}%
336 \def\russian@Alph##1{\expandafter\Russiannumeral\expandafter{\the##1}}%
337 \let\@alph\russian@alph%
338 \let\@Alph\russian@Alph%
339 \fi
340 }
341
342 \def\norussian@numbers{%
343 \let\@alph\latin@alph%
344 \let\@Alph\latin@Alph%
345 }
346
347 \def\noextras@russian{%
348 \norussian@capsformat%
349 \ifcyrillic@numerals\norussian@numbers\fi%
350 \ifrussian@babelshorthands\norussian@shorthands\fi%
351 }
352
353 \def\blockextras@russian{%
354 \russian@capsformat%
355 \ifcyrillic@numerals\russian@numbers\else\norussian@numbers\fi%
356 \ifrussian@babelshorthands\russian@shorthands\else\norussian@shorthands\fi%
357 }
358
359 \def\inlineextras@russian{%
360 \ifrussian@babelshorthands\russian@shorthands\else\norussian@shorthands\fi%
361 }
362
363 %%% These lines taken from russianb.ldf, part of babel package.
364 \AtBeginDocument{%
365 \ifrussian@mathfunctions%
366 \def\sh {\mathop{\operator@font sh}\nolimits}
367 \def\ch {\mathop{\operator@font ch}\nolimits}
368 \def\tg {\mathop{\operator@font tg}\nolimits}
369 \def\arctg {\mathop{\operator@font arctg}\nolimits}
370 \def\arcctg{\mathop{\operator@font arcctg}\nolimits}
371 \def\th {\mathop{\operator@font th}\nolimits}
372 \def\ctg {\mathop{\operator@font ctg}\nolimits}
373 \def\cth {\mathop{\operator@font cth}\nolimits}
374 \def\cosec {\mathop{\operator@font cosec}\nolimits}
375 \def\Prob {\mathop{\kern\z@\mathsf{P}}\nolimits}
376 \def\Variance{\mathop{\kern\z@\mathsf{D}}\nolimits}
377 \def\nod {\mathop{\mathrm{н.о.д.}}\nolimits}
378 \def\nok {\mathop{\mathrm{н.о.к.}}\nolimits}
379 \def\NOD {\mathop{\mathrm{НОД}}\nolimits}
380 \def\NOK {\mathop{\mathrm{НОК}}\nolimits}
381 \def\Proj {\mathop{\mathrm{Пр}}\nolimits}
382 %\DeclareRobustCommand{\No}{№}
383 \fi
384 }
385
386 \endinput
387