summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/polyglossia/gloss-russian.ldf
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/polyglossia/gloss-russian.ldf')
-rw-r--r--Master/texmf-dist/tex/xelatex/polyglossia/gloss-russian.ldf180
1 files changed, 115 insertions, 65 deletions
diff --git a/Master/texmf-dist/tex/xelatex/polyglossia/gloss-russian.ldf b/Master/texmf-dist/tex/xelatex/polyglossia/gloss-russian.ldf
index 4e7684f3d50..194b40d5892 100644
--- a/Master/texmf-dist/tex/xelatex/polyglossia/gloss-russian.ldf
+++ b/Master/texmf-dist/tex/xelatex/polyglossia/gloss-russian.ldf
@@ -1,59 +1,88 @@
\ProvidesFile{gloss-russian.ldf}[polyglossia: module for russian]
\makeatletter
+\PolyglossiaSetup{russian}{
+ script=Cyrillic,
+ scripttag=cyrl,
+ langtag=RUS,
+ hyphennames={russian},
+ hyphenmins={2,2},
+ frenchspacing=true,
+ fontsetup
+ %TODO localalph={russian@alph,russian@Alph}
+}
+
+\define@key{russian}{spelling}[modern]{%
+ \ifstrequal{#1}{old}%
+ {\def\captionsrussian{\captionsrussian@old}%
+ \def\daterussian{\daterussian@old}}%
+ {\def\captionsrussian{\captionsrussian@modern}%
+ \def\daterussian{\daterussian@modern}}%
+}
+
+\newif\ifcyrillic@numerals
+\define@key{russian}{numerals}[latin]{%
+ \ifstrequal{#1}{cyrillic}%
+ {\cyrillic@numeralstrue}
+ {\cyrillic@numeralsfalse}
+}
+
+\define@boolkey{russian}[russian@]{babelshorthands}[false]{}
-\ifx\l@russian\@undefined
- \xpg@nopatterns{Russian}
- \adddialect\l@russian\l@nohyphenation
+\setkeys{russian}{spelling,numerals}
+
+\ifsystem@babelshorthands
+ \setkeys{russian}{babelshorthands=true}
+\else
+ \setkeys{russian}{babelshorthands=false}
\fi
-\def\russian@font{%
- \@ifundefined{russianfont}{%
- \@ifundefined{cyrillicfont}{%
- \normalfontlatin%
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt
- \zf@check@ot@script{cyrl}%
- \if@tempswa
- \addfontfeature{Script=Cyrillic}%
- \else
- \PackageError{polyglossia}{^^J
- The current font does not contain the Cyrillic script!^^J
- Please define \string\cyrillicfont\space or \string\russianfont\space with \string\newfontfamily}%
- \fi
- \zf@check@ot@lang{RUS}%
- \if@tempswa\addfontfeature{Language=Russian}\fi
+\ifcsundef{initiate@active@char}{%
+ \input{babelsh.def}%
+ \initiate@active@char{"}%
+}{}
+
+\def\russian@shorthands{%
+ \bbl@activate{"}%
+ \def\language@group{russian}%
+% \declare@shorthand{russian}{"`}{„}%
+% \declare@shorthand{russian}{"'}{“}%
+% \declare@shorthand{russian}{"<}{«}%
+% \declare@shorthand{russian}{">}{»}%
+ \declare@shorthand{russian}{""}{\hskip\z@skip}%
+ \declare@shorthand{russian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}%
+ \declare@shorthand{russian}{"=}{\nobreak\-\hskip\z@skip}%
+ \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
}%
- {\cyrillicfont%
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt
- \zf@check@ot@lang{RUS}%
- \if@tempswa\addfontfeature{Language=Russian}\fi}%
- }%
- {\russianfont}%
+ \futurelet\russian@sh@next\russian@sh@tmp}%
+ \def\russian@sh@hyphen{%
+ \nobreak\-\bbl@allowhyphens}%
+ \def\russian@sh@emdash##1##2{\cdash-##1##2}%
+ \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}
+ \def\@Acdash{\ifdim\lastskip>\z@\unskip\nobreak\hskip.2em\fi
+ \cyrdash\hskip.2em\ignorespaces}%
+ \def\@Bcdash{\leavevmode\ifdim\lastskip>\z@\unskip\fi
+ \nobreak\cyrdash\penalty\exhyphenpenalty\hskip\z@skip\ignorespaces}%
+ \def\@Ccdash{\leavevmode
+ \nobreak\cyrdash\nobreak\hskip.35em\ignorespaces}%
+ \ifx\cyrdash\undefined
+ \def\cyrdash{\hbox to.8em{--\hss--}}
+ \fi
+ \declare@shorthand{russian}{",}{\nobreak\hskip.2em\ignorespaces}%
}
-\def\tmp@old{old}
-\define@key{russian}{spelling}[modern]{%
- \def\@tmpa{#1}%
- \ifx\@tmpa\tmp@old
- \def\captionsrussian{\captionsrussian@old}
- \def\daterussian{\daterussian@old}%
- \else%
- \def\captionsrussian{\captionsrussian@modern}
- \def\daterussian{\daterussian@modern}%
- \fi}
-
-%TODO: enable key to switch between latin and cyrillic \alph
-\def\tmp@latin{latin}
-\newif\iflatin@numerals
-\define@key{russian}{numerals}[russian]{%
- \def\@tmpa{#1}%
- \ifx\@tmpa\tmp@latin
- \latin@numeralstrue
- \else
- \latin@numeralsfalse
- \fi
+\def\norussian@shorthands{%
+ \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
}
-\setkeys{russian}{spelling,numerals}
\def\captionsrussian@modern{%
\def\prefacename{Предисловие}%
@@ -122,7 +151,7 @@
\def\alsoname{см.~также}%
\def\proofname{Доказательство}%
}
-\def\daterussian@old{
+\def\daterussian@old{%
\def\today{\number\day%
\space\ifcase\month\or%
января\or
@@ -158,47 +187,68 @@
\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\russian@alph#1{\ifcase#1\or
+\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\russian@numbers{%
- \let\latin@Alph\@Alph%
- \let\latin@alph\@alph%
- \let\@Alph\russian@Alph%
- \let\@alph\russian@alph%
+ \let\latin@alph\@alph%
+ \let\latin@Alph\@Alph%
+ \ifcyrillic@numerals
+ \let\@alph\russian@alph%
+ \let\@Alph\russian@Alph%
+ \fi
}
\def\norussian@numbers{%
- \let\@Alph\latin@Alph%
\let\@alph\latin@alph%
+ \let\@Alph\latin@Alph%
}
-\def\russian@language{\language=\l@russian}
-
-\setlocalhyphenmins{russian}{2}{2}%
-
\def\noextras@russian{%
- \nonfrenchspacing%
\def\@seccntformat##1{\csname the##1\endcsname\quad}% = LaTeX kernel
- \iflatin@numerals\else\norussian@numbers\fi
- }
+ \ifcyrillic@numerals\norussian@numbers\fi
+ \norussian@shorthands%
+}
\def\blockextras@russian{%
- \frenchspacing%
\russian@capsformat%
- \iflatin@numerals\else\russian@numbers\fi
- }
+ \ifcyrillic@numerals\russian@numbers\fi
+ \ifrussian@babelshorthands\russian@shorthands\fi
+}
\def\inlineextras@russian{%
- \frenchspacing%
- }
+ \ifrussian@babelshorthands\russian@shorthands\fi%
+}
+
+%%% These lines taken from russianb.ldf, part of babel package.
+% make it optional?
+\def\sh {\mathop{\operator@font sh}\nolimits}
+\def\ch {\mathop{\operator@font ch}\nolimits}
+\def\tg {\mathop{\operator@font tg}\nolimits}
+\def\arctg {\mathop{\operator@font arctg}\nolimits}
+\def\arcctg{\mathop{\operator@font arcctg}\nolimits}
+\def\th {\mathop{\operator@font th}\nolimits}
+\def\ctg {\mathop{\operator@font ctg}\nolimits}
+\def\cth {\mathop{\operator@font cth}\nolimits}
+\def\cosec {\mathop{\operator@font cosec}\nolimits}
+\def\Prob {\mathop{\kern\z@\mathsf{P}}\nolimits}
+\def\Variance{\mathop{\kern\z@\mathsf{D}}\nolimits}
+\def\nod {\mathop{\mathrm{н.о.д.}}\nolimits}
+\def\nok {\mathop{\mathrm{н.о.к.}}\nolimits}
+\def\NOD {\mathop{\mathrm{НОД}}\nolimits}
+\def\NOK {\mathop{\mathrm{НОК}}\nolimits}
+\def\Proj {\mathop{\mathrm{Пр}}\nolimits}
+%\DeclareRobustCommand{\No}{№}
\endinput
+