summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-10-28 20:58:49 +0000
committerKarl Berry <karl@freefriends.org>2019-10-28 20:58:49 +0000
commitffd652038baef26fb84de26fce9991a02e875485 (patch)
treec02e3f8fde2e20bb8ba3cc9ab3216e609648e350 /Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf
parentcffa8e2910c5d2a7b6b26032eef37d9e18b8b72d (diff)
polyglossia (28oct19)
git-svn-id: svn://tug.org/texlive/trunk@52555 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf')
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf148
1 files changed, 102 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf
index 5d207ff056e..f969aa258d3 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf
@@ -1,4 +1,7 @@
\ProvidesFile{gloss-russian.ldf}[polyglossia: module for russian]
+
+\RequirePackage{cyrillicnumbers}
+
\PolyglossiaSetup{russian}{
script=Cyrillic,
scripttag=cyrl,
@@ -6,22 +9,30 @@
hyphennames={russian},
hyphenmins={2,2},
frenchspacing=true,
- fontsetup
- %TODO localalph={russian@alph,russian@Alph}
+ fontsetup,
+ localnumeral=russiannumerals,
+ Localnumeral=Russiannumerals
}
+\newif\if@russian@modern
\define@key{russian}{spelling}[modern]{%
\ifstrequal{#1}{old}%
- {\def\captionsrussian{\captionsrussian@old}%
- \def\daterussian{\daterussian@old}}%
- {\def\captionsrussian{\captionsrussian@modern}%
- \def\daterussian{\daterussian@modern}}%
+ {\@russian@modernfalse}%
+ {\@russian@moderntrue}%
}
+\def\captionsrussian{%
+ \if@russian@modern\captionsrussian@modern\else\captionsrussian@old\fi%
+}%
+
+\def\daterussian{%
+ \if@russian@modern\daterussian@modern\else\daterussian@old\fi%
+}%
+
\newif\ifcyrillic@numerals
-\define@key{russian}{numerals}[latin]{%
+\define@key{russian}{numerals}[arabic]{%
\ifstrequal{#1}{cyrillic}%
- {\cyrillic@numeralstrue}
+ {\cyrillic@numeralstrue}%
{\cyrillic@numeralsfalse}%
}
@@ -38,6 +49,7 @@
\ifcsundef{initiate@active@char}{%
\input{babelsh.def}%
\initiate@active@char{"}%
+ \shorthandoff{"}%
}{}
\def\russian@shorthands{%
@@ -53,8 +65,8 @@
\declare@shorthand{russian}{"|}{\textormath{\nobreak\discretionary{-}{}{\kern.03em}\allowhyphens}{}}%
\declare@shorthand{russian}{"-}{%
\def\russian@sh@tmp{%
- \if\russian@sh@next-\expandafter\russian@sh@emdash
- \else\expandafter\russian@sh@hyphen\fi
+ \if\russian@sh@next-\expandafter\russian@sh@emdash%
+ \else\expandafter\russian@sh@hyphen\fi%
}%
\futurelet\russian@sh@next\russian@sh@tmp}%
\def\russian@sh@hyphen{%
@@ -73,7 +85,7 @@
\def\@Ccdash{\leavevmode
\nobreak\cyrdash\nobreak\hskip.35em\ignorespaces}%
\ifx\cyrdash\undefined
- \def\cyrdash{\hbox to.8em{--\hss--}}
+ \def\cyrdash{\hbox to.8em{--\hss--}}%
\fi
\declare@shorthand{russian}{",}{\nobreak\hskip.2em\ignorespaces}%
}
@@ -123,7 +135,8 @@
октября\or
ноября\or
декабря\fi%
- \space \number\year\space г.}}
+ \space \number\year\space г.}%
+}
\def\captionsrussian@old{%
\def\prefacename{Предисловіе}%
@@ -149,7 +162,8 @@
\def\seename{см.}%
\def\alsoname{см.~также}%
\def\proofname{Доказательство}%
-}
+}
+
\def\daterussian@old{%
\def\today{\number\day%
\space\ifcase\month\or%
@@ -165,18 +179,24 @@
октября\or
ноября\or
декабря\fi%
- \space \number\year\space г.}}
+ \space \number\year\space г.}%
+}
% The following is based on some ideas from ruscor.sty
\def\russian@capsformat{%
\ifdef{\KOMAScript}{%
\ifdef{\chapterformat}{%
\renewcommand{\chapterformat}{\prechapter\thechapter\postchapter}}{}%
- \renewcommand{\sectionformat}{\presection\thesection\postsection}%
- \renewcommand{\subsectionformat}{\presubsection\thesubsection\postsubsection}%
- \renewcommand{\subsubsectionformat}{\presubsubsection\thesubsubsection\postsubsubsection}%
- \renewcommand{\paragraphformat}{\preparagraph\theparagraph\postparagraph}%
- \renewcommand{\subparagraphformat}{\presubparagraph\thesubparagraph\postsubparagraph}%
+ \ifdef{\sectionformat}{%
+ \renewcommand{\sectionformat}{\presection\thesection\postsection}}{}%
+ \ifdef{\subsectionformat}{%
+ \renewcommand{\subsectionformat}{\presubsection\thesubsection\postsubsection}}{}%
+ \ifdef{\subsubsectionformat}{%
+ \renewcommand{\subsubsectionformat}{\presubsubsection\thesubsubsection\postsubsubsection}}{}%
+ \ifdef{\paragraphformat}{%
+ \renewcommand{\paragraphformat}{\preparagraph\theparagraph\postparagraph}}{}%
+ \ifdef{\subparagraphformat}{%
+ \renewcommand{\subparagraphformat}{\presubparagraph\thesubparagraph\postsubparagraph}}{}%
}{%
\def\@seccntformat##1{\csname pre##1\endcsname%
\csname the##1\endcsname%
@@ -194,27 +214,58 @@
\def\presubsection{}%
\def\presubsubsection{}%
\def\preparagraph{}%
- \def\presubparagraph{}}
-
-\def\Asbuk#1{\expandafter\russian@Alph\csname c@#1\endcsname}
-\def\russian@Alph#1{\ifcase#1\or
- А\or Б\or В\or Г\or Д\or Е\or Ж\or
- З\or И\or К\or Л\or М\or Н\or О\or
- П\or Р\or С\or Т\or У\or Ф\or Х\or
- Ц\or Ч\or Ш\or Щ\or Э\or Ю\or Я\else\xpg@ill@value{#1}{russian@Alph}\fi}
-\def\asbuk#1{\expandafter\russian@alph\csname c@#1\endcsname}
-\def\russian@alph#1{\ifcase#1\or
- а\or б\or в\or г\or д\or е\or ж\or
- з\or и\or к\or л\or м\or н\or о\or
- п\or р\or с\or т\or у\or ф\or х\or
- ц\or ч\or ш\or щ\or э\or ю\or я\else\xpg@ill@value{#1}{russian@alph}\fi}
+ \def\presubparagraph{}%
+}
+
+\newcommand{\russiannumerals}[2]{\russiannumber{#2}}
+\newcommand{\Russiannumerals}[2]{\Russiannumber{#2}}
+
+\def\russiannumber#1{%
+ \ifcyrillic@numerals
+ \cyr@alph{#1}%
+ \else
+ \number#1%
+ \fi%
+}
+
+\def\Russiannumber#1{%
+ \ifcyrillic@numerals
+ \cyr@Alph{#1}%
+ \else
+ \number#1%
+ \fi%
+}
+
+\let\russiannumeral=\russiannumber
+\let\Russiannumeral=\Russiannumber
+
+\def\Asbuk#1{\expandafter\cyr@Alph\csname c@#1\endcsname}
+
+\def\asbuk#1{\expandafter\cyr@alph\csname c@#1\endcsname}
+
+% This is a poor man's cyrillic alphanumeric. It just uses the alphabet and
+% thus ends at 30. We now use proper cyrillic numbering.
+
+%\def\russian@Alph#1{\ifcase#1\or
+% А\or Б\or В\or Г\or Д\or Е\or Ж\or
+% З\or И\or К\or Л\or М\or Н\or О\or
+% П\or Р\or С\or Т\or У\or Ф\or Х\or
+% Ц\or Ч\or Ш\or Щ\or Э\or Ю\or Я\else\xpg@ill@value{#1}{russian@Alph}\fi}
+
+%\def\russian@alph#1{\ifcase#1\or
+% а\or б\or в\or г\or д\or е\or ж\or
+% з\or и\or к\or л\or м\or н\or о\or
+% п\or р\or с\or т\or у\or ф\or х\or
+% ц\or ч\or ш\or щ\or э\or ю\or я\else\xpg@ill@value{#1}{russian@alph}\fi}
\def\russian@numbers{%
- \let\latin@alph\@alph%
- \let\latin@Alph\@Alph%
- \ifcyrillic@numerals
- \let\@alph\russian@alph%
- \let\@Alph\russian@Alph%
+ \let\latin@alph\@alph
+ \let\latin@Alph\@Alph
+ \ifcyrillic@numerals%
+ \def\russian@alph##1{\expandafter\russiannumeral\expandafter{\the##1}}%
+ \def\russian@Alph##1{\expandafter\Russiannumeral\expandafter{\the##1}}%
+ \let\@alph\russian@alph%
+ \let\@Alph\russian@Alph%
\fi
}
@@ -227,22 +278,27 @@
\ifdef{\KOMAScript}{%
\ifdef{\chapterformat}{%
\renewcommand{\chapterformat}{\thechapter\autodot\enskip}}{}%
- \renewcommand{\sectionformat}{\thesection\autodot\enskip}%
- \renewcommand{\subsectionformat}{\thesubsection\autodot\enskip}%
- \renewcommand{\subsubsectionformat}{\thesubsubsection\autodot\enskip}%
- \renewcommand{\paragraphformat}{\theparagraph\autodot\enskip}%
- \renewcommand{\subparagraphformat}{\thesubparagraph\autodot\enskip}%
+ \ifdef{\sectionformat}{%
+ \renewcommand{\sectionformat}{\thesection\autodot\enskip}}{}%
+ \ifdef{\subsectionformat}{%
+ \renewcommand{\subsectionformat}{\thesubsection\autodot\enskip}}{}%
+ \ifdef{\subsubsectionformat}{%
+ \renewcommand{\subsubsectionformat}{\thesubsubsection\autodot\enskip}}{}%
+ \ifdef{\paragraphformat}{%
+ \renewcommand{\paragraphformat}{\theparagraph\autodot\enskip}}{}%
+ \ifdef{\subparagraphformat}{%
+ \renewcommand{\subparagraphformat}{\thesubparagraph\autodot\enskip}}{}%
}{%
\def\@seccntformat##1{\csname the##1\endcsname\quad}% = LaTeX kernel
}%
- \ifcyrillic@numerals\norussian@numbers\fi
+ \ifcyrillic@numerals\norussian@numbers\fi%
\norussian@shorthands%
}
\def\blockextras@russian{%
\russian@capsformat%
- \ifcyrillic@numerals\russian@numbers\fi
- \ifrussian@babelshorthands\russian@shorthands\fi
+ \ifcyrillic@numerals\russian@numbers\fi%
+ \ifrussian@babelshorthands\russian@shorthands\fi%
}
\def\inlineextras@russian{%