texlive[44521] Master/texmf-dist: ukrainian (7jun17)

commits+karl at tug.org commits+karl at tug.org
Wed Jun 7 23:23:07 CEST 2017


Revision: 44521
          http://tug.org/svn/texlive?view=revision&revision=44521
Author:   karl
Date:     2017-06-07 23:23:07 +0200 (Wed, 07 Jun 2017)
Log Message:
-----------
ukrainian (7jun17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/generic/babel-ukrainian/ukraineb.pdf
    trunk/Master/texmf-dist/source/generic/babel-ukrainian/ukraineb.dtx
    trunk/Master/texmf-dist/source/generic/babel-ukrainian/ukraineb.ins
    trunk/Master/texmf-dist/tex/generic/babel-ukrainian/ukraineb.ldf

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/generic/babel-ukrainian/README.md

Added: trunk/Master/texmf-dist/doc/generic/babel-ukrainian/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/babel-ukrainian/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/generic/babel-ukrainian/README.md	2017-06-07 21:23:07 UTC (rev 44521)
@@ -0,0 +1,91 @@
+----------------------------------------------------------------
+
+Ukrainian language module for Babel, v1.3h
+
+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 Ukrainian. The support is adapted for use both
+under legacy TEX engines, and under X∃TEX and LuaTEX.
+
+Based on Russian language module v1.3i by Igor A. Kotelnikov <kia999 at mail dot ru>.
+
+The Current Maintainer is Sergiy Ponomarenko <sergiy.ponomarenko at gmail.com>.
+
+1. INSTALLATION
+
+- unpack babel-ukrainian.zip
+- run "xelatex.exe ukraineb.dtx" (recommended)
+  or "pdflatex.exe ukraineb.dtx";
+  run "tex.exe ukraineb.dtx"
+  or "tex.exe ukraineb.ins", if you don't need documentation
+- move "ukraineb.ldf" to <textmf>/tex/generic/babel/babel-ukrainian/
+- move "ukraineb.pdf" and README to <textmf>/doc/generic/babel-ukrainian/
+- update filename base (see documentation for your TeX system)
+
+2. USAGE
+
+Ukrainian language definition file can be used both with legacy 8-bit engines
+(such as latex.exe or pdflatex.exe) and Unicode compilers (xelatex.exe or
+lualatex.exe). 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.
+
+2.1. 8-bit mode
+
+2.1.1 PDFLATeX, LaTeX
+
+    \usepackage[T1,T2A]{fontenc}
+    \usepackage[utf8]{inputenc}
+    \usepackage[english,ukrainian]{babel}
+
+2.1.2 LuaLaTeX
+
+    \usepackage[T1,T2A]{fontenc}
+    \usepackage[lutf8]{luainputenc}
+    \usepackage[english,ukrainian]{babel}
+
+2.1.3 XeLaTeX
+
+    \XeTeXinputencoding "bytes"
+    \usepackage[utf8]{inputenc}
+    \usepackage[T2A]{fontenc}
+    \usepackage[english,ukrainian]{babel}
+
+2.2 Unicode mode, LuaLaTeX or XeLaTeX
+
+    \usepackage{fontspec}
+        \defaultfontfeatures{Ligatures={TeX}}
+        \setmainfont{CMU Serif}
+        \setsansfont{CMU Sans Serif}
+        \setmonofont{CMU Typewriter Text}
+    \usepackage[english,ukrainian]{babel}
+
+Instead of the Computer Modern Unicode (CMU) fonts loaded in this example,
+you may try any True Type or Open Type font installed on your computer provided
+that that font came with Ukrainian letters.
+
+3. DOCUMENTATION
+
+See ukraineb.pdf for more information.
+
+4. 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.
+
+5. CHANGES
+
+2017-06-06 version 1.3h
+
+    * Initial version
+
+Original source:  russianb.dtx,
+    2017-01-12 v1.3i Ukrainian support from the babel system.
+
+----------------------------------------------------------------


Property changes on: trunk/Master/texmf-dist/doc/generic/babel-ukrainian/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/generic/babel-ukrainian/ukraineb.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/generic/babel-ukrainian/ukraineb.dtx
===================================================================
--- trunk/Master/texmf-dist/source/generic/babel-ukrainian/ukraineb.dtx	2017-06-07 21:22:48 UTC (rev 44520)
+++ trunk/Master/texmf-dist/source/generic/babel-ukrainian/ukraineb.dtx	2017-06-07 21:23:07 UTC (rev 44521)
@@ -1,809 +1,1099 @@
 % \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 Johannes Braams.
-% 
-% 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.
+% !TEX program  = LuaLaTeX
+%<*internal>
+\iffalse
+%</internal>
+%<*readme>
+----------------------------------------------------------------
+
+Ukrainian language module for Babel, v1.3h
+
+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 Ukrainian. The support is adapted for use both
+under legacy TEX engines, and under X∃TEX and LuaTEX.
+
+Based on Russian language module v1.3i by Igor A. Kotelnikov <kia999 at mail dot ru>.
+
+The Current Maintainer is Sergiy Ponomarenko <sergiy.ponomarenko at gmail.com>.
+
+
+1. INSTALLATION
+
+- unpack babel-ukrainian.zip
+- run "xelatex.exe ukraineb.dtx" (recommended)
+  or "pdflatex.exe ukraineb.dtx";
+  run "tex.exe ukraineb.dtx"
+  or "tex.exe ukraineb.ins", if you don't need documentation
+- move "ukraineb.ldf" to <textmf>/tex/generic/babel/babel-ukrainian/
+- move "ukraineb.pdf" and README to <textmf>/doc/generic/babel-ukrainian/
+- update filename base (see documentation for your TeX system)
+
+
+2. USAGE
+
+Ukrainian language definition file can be used both with legacy 8-bit engines
+(such as latex.exe or pdflatex.exe) and Unicode compilers (xelatex.exe or
+lualatex.exe). 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.
+
+2.1. 8-bit mode
+
+2.1.1 PDFLATeX, LaTeX
+
+    \usepackage[T1,T2A]{fontenc}
+    \usepackage[utf8]{inputenc}
+    \usepackage[english,ukrainian]{babel}
+
+2.1.2 LuaLaTeX
+
+    \usepackage[T1,T2A]{fontenc}
+    \usepackage[lutf8]{luainputenc}
+    \usepackage[english,ukrainian]{babel}
+
+2.1.3 XeLaTeX
+
+    \XeTeXinputencoding "bytes"
+    \usepackage[utf8]{inputenc}
+    \usepackage[T2A]{fontenc}
+    \usepackage[english,ukrainian]{babel}
+
+2.2 Unicode mode, LuaLaTeX or XeLaTeX
+
+    \usepackage{fontspec}
+        \defaultfontfeatures{Ligatures={TeX}}
+        \setmainfont{CMU Serif}
+        \setsansfont{CMU Sans Serif}
+        \setmonofont{CMU Typewriter Text}
+    \usepackage[english,ukrainian]{babel}
+
+Instead of the Computer Modern Unicode (CMU) fonts loaded in this example,
+you may try any True Type or Open Type font installed on your computer provided
+that that font came with Ukrainian letters.
+
+3. DOCUMENTATION
+
+See ukraineb.pdf for more information.
+
+
+4. 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.
+
+5. CHANGES
+
+2017-06-06 version 1.3h
+
+    * Initial version
+
+Original source:  russianb.dtx,
+    2017-01-12 v1.3i Ukrainian 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
+----------------------------------------------------------------
+Ukrainian Language Support for the Babel package
+E-mail: sergiy.ponomarenko at gmailcom
+Released under the LaTeX Project Public License v1.3c or later
+See http://www.latex-project.org/lppl.txt
+----------------------------------------------------------------
+\endpreamble
+\postamble
+----------------------------------------------------------------
+Copyright 2017 Sergiy М. Ponomarenko
+Copyright 2011-2017 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 Ukrainian-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
+Sergiy М. Ponomarenko.
+
+The package consists of the file  ukraineb.dtx
+and the derived files             ukraineb.ins,
+                                  ukraineb.ldf,
+                                  ukraineb.pdf,
+                                  README.
+----------------------------------------------------------------
+\endpostamble
+\usedir{tex/generic/babel/contrib}
+\generate{
+  \file{\jobname.ldf}{\from{\jobname.dtx}{code}}
+}
+%</install>
+%<install>\endbatchfile
+%<*internal>
+\usedir{source/latex/babel-ukrainian}
+\generate{
+  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
+}
+\nopreamble\nopostamble
+\usedir{doc/latex/babel-ukrainian}
+\generate{
+  \file{README.}{\from{\jobname.dtx}{readme}}
+}
+\ifx\fmtname\nameofplainTeX
+  \expandafter\endbatchfile
+\else
+  \expandafter\endgroup
+\fi
+%</internal>
+%<*code>
+\NeedsTeXFormat{LaTeX2e}
+%\ProvidesLanguage{\jobname}[2017/06/06 1.3h Ukrainian support for the Babel system]
+\ProvidesLanguage{ukraineb}[2017/06/06 1.3h Ukrainian 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[%
+	a4paper,%
+	footskip=1cm,%
+	headsep=0.3cm,% 
+	top=2cm, %поле сверху
+	bottom=2cm, %поле снизу
+	left=4cm, %поле ліворуч
+	right=2cm, %поле праворуч
+    ]{geometry}
+\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}
+    \DeclareUnicodeCharacter{0462}{\CYRYAT}
+    \DeclareTextSymbolDefault{\CYRYAT}{X2}
+    \DeclareUnicodeCharacter{0463}{\cyryat}
+    \DeclareTextSymbolDefault{\cyryat}{X2}
+    %% serbian letter, looks as a ligature IE, not defined anywhare
+    %\DeclareUnicodeCharacter{0464}{\CYRESHRT} % no surch cmd in X2
+    %% serbian letter, looks as a ligature ie, not defined anywhare
+    %\DeclareUnicodeCharacter{0465}{\cyreshrt} % no surch cmd in X2
+    %% therefor, we substitute it with є (#0454, \cyrie)
+    \DeclareUnicodeCharacter{0464}{\CYRIE}%
+    %\DeclareTextSymbolDefault{\CYRIE}{X2}
+    \DeclareUnicodeCharacter{0465}{\cyrie}%
+    %\DeclareTextSymbolDefault{\cyrie}{X2}
+\fi
+\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%
+   	,pdfpagelayout=TwoPageRight%
+   	,pdfauthor={Ponomarenko S.M. aka sergiokapone}%
+   	,pdfdisplaydoctitle=true%
+   	,pdfencoding=auto%
+   	]{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
+     ,\Ukrainian,\cyrdash,\cdash
+     ,\cyr,\cyrillictext,\textcyrillic,\cyrillicencoding
+     ,\addto,\captionsukrainian,\dateukrainian,\noextrasukrainian,\extrasukrainian
+     ,\languageattribute
+     ,\Asbuk,\asbuk,\ch,\sh,\tg,\ctg,\arctg,\arcctg\,\th,\cth,\cosec
+     ,\nod3,\nsk,\prog,\NSF\,\NSK,\Prog
+     ,\dq,\Proj,\nsd,\NSD,\nsk,\NSK,\Prob,\Variance
+     ,\XeTeXinputencoding
+    }
+    ,keywordstyle=[0]\color{thered}
+    ,keywords=[1]{main,ukrainian,english,german,frenchb
+     ,shorthands,extrasenglish
+     ,stringprocess,afterextras
+     ,soft,empty,nobreak,hard
+     ,Renderer,Ligatures
+     ,modern,ancient
+     ,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 at tempa{#1}%
+  \ifx\bbl at 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
-% \CheckSum{1472}
 %
-% \iffalse
-%    Tell the \LaTeX\ system who we are and write an entry on the
-%    transcript.
-%<*dtx>
-\ProvidesFile{ukraineb.dtx}
-%</dtx>
-%<code>\ProvidesLanguage{ukraineb}
-        [2008/03/21 v1.1l Ukrainian support from the babel system]
+%\GetFileInfo{\jobname.dtx}
+%\GetFileInfo{\jobname.ldf}
 %
-%% File `ukraineb.dtx'
-%% Babel package for LaTeX version 2e
-%% Copyright (C) 1989 - 2008
-%%           by Johannes Braams, TeXniek
+%\title{^^A
+%  \textsf{Ukrainian} --- description text\thanks{^^A
+%    This file describes version \fileversion, last revised \filedate.^^A
+%  }^^A
+%}
+%\author{^^A
+%  You\thanks{E-mail: you at your.domain}^^A
+%}
+% \title{The Ukrainian Language\\
+%  in the \babel\ system\\[0.5em]
+%  \large Version \fileversion}
 %
-%% ukraineb Language Definition File
-%% Copyright (C) 1997 - 2008
-%%           by Andrij Shvaika ashv at icmp.lviv.ua
+% \author{Sergiy M. Ponomarenko\footnote{E-mail: \href{mailto:sergiy.ponomarenko at gmail.com}{sergiy dot ponomarenko at gmail dot com}.}}
 %
-%% derived from the Russianb Language Definition File
-%% Copyright (C) 1995 - 2008
-%%           by Olga Lapko cyrtug at mir.msk.su
-%%              Johannes Braams, TeXniek
-% adapted to the new T2 and X2 Cyrillic encodings
-%           by Vladimir Volovich TeX at vvv.vsu.ru
-%              Werner Lemberg wl at gnu.org
+% \date{Released \filedate}
 %
-%% Please report errors to: J.L. Braams
-%%                          babel at braams.xs4all.nl
+% \maketitle
 %
-%<*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{ukraineb.dtx}
-\end{document}
-%</filedriver>
-%\fi
-% \GetFileInfo{ukraineb.dtx}
+% {\small\tableofcontents}
 %
-% \changes{ukraineb-1.1e}{1999/08/19}{replaced all \cs{penalty}\cs{@M}
-%    with \cs{nobreak}}
 %
-%  \section{The Ukrainian language}
+% \section{The Ukrainian Language Definition File}
 %
-%    The file \file{\filename}\footnote{The file described in this
-%    section has version number \fileversion.
-%    This file was derived from the \file{russianb.dtx} version 1.1g.}
-%    defines all the language-specific macros for the Ukrainian
-%    language. It needs the file \file{cyrcod} for success documentation
-%    with Ukrainian encodings (see below).
+% 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 Ukrainian Language Definition file
+% \file{\jobname.ldf} to be loaded by the \babel\ package with
+% the option \Lopt{ukrainian}. It's based on the Russian language definition
+% file \file{russianb.ldf} derived by Igor~A.~Kotelnikov.
 %
-%    For this language the character |"| is made active. In
-%    table~\ref{tab:ukrainian-quote} an overview is given of its
-%    purpose. 
+% \section{Usage}
 %
-%    \begin{table}[htb]
-%      \begin{center}
-%      \begin{tabular}{lp{8cm}}
-%       \verb="|= & disable ligature at this position.               \\
-%       |"-| & an explicit hyphen sign, allowing hyphenation
-%                   in the rest of the word.                         \\
-%       |"---| & Cyrillic emdash in plain text.                      \\
-%       |"--~| & Cyrillic emdash in compound names (surnames).       \\
-%       |"--*| & Cyrillic emdash for denoting direct speech.         \\
-%       |""| & like |"-|, but producing no hyphen sign
-%                   (for compund words with hyphen, e.g.\ |x-""y|
-%                   or some other signs  as ``disable/enable'').     \\
-%       |"~| & for a compound word mark without a breakpoint.        \\
-%       |"=| & for a compound word mark with a breakpoint, allowing
-%              hyphenation in the composing words.                   \\
-%       |",| & thinspace for initials with a breakpoint
-%               in following surname.                                \\
-%       |"`| & for German left double quotes
-%                   (looks like ,\kern-0.08em,).                     \\
-%       |"'| & for German right double quotes (looks like ``).       \\%^^A''
-%       |"<| & for French left double quotes (looks like $<\!\!<$).  \\
-%       |">| & for French right double quotes (looks like $>\!\!>$). \\
-%      \end{tabular}
-%      \caption{The extra definitions made
-%               by \file{ukraineb}}\label{tab:ukrainian-quote}
-%      \end{center}
-%    \end{table}
+% Typesetting Ukrainian 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.
 %
-%    The quotes in table~\ref{tab:ukrainian-quote} (see, also
-%    table~\ref{tab:russian-quote}) can also be typeset by using the commands
-%    in table~\ref{tab:umore-quote} (see, also table~\ref{tab:rmore-quote}).
+% 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.
 %
-%    \begin{table}[htb]
-%      \begin{center}
-%      \begin{tabular}{lp{8cm}}
-%       |\cdash---| & Cyrillic emdash in plain text.                    \\
-%       |\cdash--~| & Cyrillic emdash in compound names (surnames).     \\
-%       |\cdash--*| & Cyrillic emdash for denoting direct speech.       \\
-%       |\glqq| & for German left double quotes
-%                    (looks like ,\kern-0.08em,).                       \\
-%       |\grqq| & for German right double quotes (looks like ``).       \\%^^A''
-%       |\flqq| & for French left double quotes (looks like $<\!\!<$).  \\
-%       |\frqq| & for French right double quotes (looks like $>\!\!>$). \\
-%       |\dq|   & the original quotes character (|"|).                  \\
-%      \end{tabular}
-%      \caption{More commands which produce quotes, defined
-%               by \babel}\label{tab:umore-quote}
-%      \end{center}
-%    \end{table}
+% 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.
 %
-%    The French quotes are also available as ligatures `|<<|' and `|>>|' in
-%    8-bit Cyrillic font encodings (\texttt{LCY}, \texttt{X2}, \texttt{T2*})
-%    and as `|<|' and `|>|' characters in 7-bit Cyrillic font encodings
-%    (\texttt{OT2} and \texttt{LWN}).
+% Since earlier versions \pkg{babel} did not
+% support Xe\LaTeX\ (at least for some languages including Ukrainian), 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.
 %
-%    The quotation marks traditionally used in Ukrainian and Russian
-%    languages were borrowed from other languages (e.g. French and German)
-%    so they keep their original names.
 %
-% \StopEventually{}
+% \subsection{\LaTeX}
 %
-%    The macro |\LdfInit| takes care of preventing that this file is loaded
-%    more than once, checking the category code of the \texttt{@} sign, etc.
+% When user's document is compiled with \file{latex.exe} or \file{pdflatex.exe},
+% 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,ukrainian]{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.
 %
-%    \begin{macrocode}
-%<*code>
-\LdfInit{ukrainian}{captionsukrainian}
-%    \end{macrocode}
+% Input encoding should be declared as option to the \pkg{inputenc}
+% package. Known Cyrillic encodings include \texttt{cp866} (MS DOS),
+% \texttt{cp1251} (Windows), \texttt{koi8-u} (UNIX) and their variants.
+% Nowadays, this list is appended with \texttt{utf8} input encoding.
 %
-%    When this file is read as an option, i.e., by the |\usepackage|
-%    command, \texttt{ukraineb} will be an `unknown' language, in which case
-%    we have to make it known. So we check for the existence of |\l at ukrainian|
-%    to see whether we have to do something here.
+% 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 excluded from Ukrainian support stating version 1.2 of
+% \file{\filename} since \texttt{LWN} is excluded from the \pkg{cyrillic}
+% bundle of related files.
 %
-%    \begin{macrocode}
-\ifx\l at ukrainian\@undefined
-  \@nopatterns{Ukrainian}
-  \adddialect\l at ukrainian0
-\fi
-%    \end{macrocode}
 %
-%  \begin{macro}{\latinencoding}
+% \subsection{Lua\LaTeX}
 %
-%    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!
+% 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,ukrainian]{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}.
 %
-%    \begin{macrocode}
-\let\latinencoding\cf at encoding
-%    \end{macrocode}
 %
-%  \end{macro}
+% 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,ukrainian]{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,ukrainian]{babel}
+%\end{verbatim}
+% Here |Renderer=Basic,Ligatures={TeX}| activates ligatures which are existed
+% in \LaTeX.
 %
-%    The user may choose between different available Cyrillic
-%    encodings---e.g., \texttt{X2}, \texttt{LCY}, or \texttt{LWN}.\@
-%    Hopefully, \texttt{X2} will eventually replace the two latter encodings
-%    (\texttt{LCY} and \texttt{LWN}).\@ If the user wants to use another
-%    font encoding than the default (\texttt{T2A}), he has to load the
-%    corresponding file \emph{before} \file{ukraineb.sty}. This may be done
-%    in the following way:
+% 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=ukrainian,german]{babel}
+%\end{verbatim}
+% %\unskip
 %
-%    \begin{verbatim}
-%      % override the default X2 encoding used in Babel
-%      \usepackage[LCY,OT1]{fontenc}
-%      \usepackage[english,ukrainian]{babel}
-%    \end{verbatim}
-%    \unskip
 %
-%    Note: for the Ukrainian 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 Ukrainian phrase or vice versa.
 %
-%    We parse the |\cdp at 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.
+% \subsection{Xe\LaTeX}
 %
-%    \begin{macrocode}
-\def\reserved at a#1#2{%
-   \edef\reserved at b{#1}%
-   \edef\reserved at c{#2}%
-   \ifx\reserved at b\reserved at c
-     \let\cyrillicencoding\reserved at c
-   \fi}
-\def\cdp at elt#1#2#3#4{%
-   \reserved at a{#1}{OT2}%
-   \reserved at a{#1}{LWN}%
-   \reserved at a{#1}{LCY}%
-   \reserved at a{#1}{X2}%
-   \reserved at a{#1}{T2C}%
-   \reserved at a{#1}{T2B}%
-   \reserved at a{#1}{T2A}}
-\cdp at list
-%    \end{macrocode}
+% 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,ukrainian]{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;
 %
-%    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}).
+% \noindent%
+% 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}.
 %
-%    \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.
+% 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,ukrainian]{babel}
+%\end{verbatim}
 %
-%    \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}
+%\section{User's commands}
 %
-%    We avoid |\usepackage[\cyrillicencoding]{fontenc}| because we don't
-%    want to force the switch of |\encodingdefault|.
+% In a multilingual document, some typographic rules are language
+% dependent and should apply to the whole document.
 %
-%    \begin{macrocode}
-    \lowercase
-      \expandafter{\expandafter\input\cyrillicencoding enc.def\relax}%
-  \fi
-\fi
-%    \end{macrocode}
+%^^AAs of version~1.2, \file{\jobname.ldf} behaves differently
+%^^Aaccording to \babel's \emph{main language} defined as the \emph{last}
+%^^Aoption. When Ukrainian is
+%^^A|babel|'s main language, it adjusts global layout of the document
+%^^Aaccording to typographical conventions of Ukrainian language. Namely,
+%^^A\file{\jobname.ldf} makes the following changes to global layout even
+%^^Ain the parts where Ukrainian 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}
 %
-%    \begin{verbatim}
-%      \PackageInfo{babel}
-%        {Using `\cyrillicencoding' as a default Cyrillic encoding}%
-%    \end{verbatim}
-%    \unskip
+% Regarding local typography, the macro |\selectlanguage{ukrainian}|
+% switches to the Ukrainian language, with the following effects:
+% \begin{enumerate}
+% \item Ukrainian hyphenation patterns are made active;
+% \item |\today| prints the date in Ukrainian;
+% \item the caption names are translated into Ukrainian
+%      (\LaTeX{} only);
+% \item emdash typed by the ligature |---| might be 20\% shorter when Ukrainian
+% 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 Ukrainian 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:ukrainian-quote}.
+% \end{enumerate}
 %
-%    \begin{macrocode}
-\DeclareRobustCommand{\Ukrainian}{%
-  \fontencoding\cyrillicencoding\selectfont
-  \let\encodingdefault\cyrillicencoding
-  \expandafter\set at hyphenmins\ukrainianhyphenmins
-  \language\l at ukrainian}%
-\DeclareRobustCommand{\English}{%
-  \fontencoding\latinencoding\selectfont
-  \let\encodingdefault\latinencoding
-  \expandafter\set at hyphenmins\englishhyphenmins
-  \language\l at english}%
-\let\Ukr\Ukrainian
-\let\Eng\English
-\let\cyrillictext\Ukrainian
-\let\cyr\Ukrainian
-%    \end{macrocode}
+% Since Ukrainian has its own numbering system, \file{\jobname.ldf} adds macros
+% |\asbuk|\marg{counter} and |\Asbuk|\marg{counter} for formatting numbers appropriately the alphabetic
+% sequence in the Ukrainian 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}
 %
-%    Since the \texttt{X2} encoding does not contain Latin letters, we
-%    should make some redefinitions of \LaTeX\ macros which implicitly
-%    produce Latin letters.
+% The macro |\Ukrainian| is now defined as an alias for
+% |\selectlanguage{ukrainian}|, and its ``opponent'' |\English|, existed
+% in \file{\jobname.ldf} prior to version 1.2 has been removed since the Ukrainian
+% language definition file is wrong place for definition of macros which
+% switch to a distinct other language.
 %
-%    \begin{macrocode}
-\expandafter\ifx\csname T at X2\endcsname\relax\else
-%    \end{macrocode}
+% The macro |\textcyrillic|\marg{text} is intended to typeset small chunks of text
+% in Ukrainian; it is essentially an alias for |\foreignlanguage{ukrainian}|\marg{text}.
 %
-%    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).
 %
-%    \begin{macrocode}
-  \def\@alph#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#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}}%
-%    \end{macrocode}
+% \subsection{Active character}
 %
-%    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}).
+% Table~\ref{tab:ukrainian-quote} shows macros and active string which can be
+% used to typeset various dashes and quotes.
+% In the Ukrainian 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{macrocode}
-  \DeclareTextSymbolDefault{\AA}{OT1}
-  \DeclareTextSymbolDefault{\aa}{OT1}
-  \DeclareTextCommand{\aa}{OT1}{\r a}
-  \DeclareTextCommand{\AA}{OT1}{\r A}
-\fi
-%    \end{macrocode}
+% \begin{table}[!ht]\centering
+%  \caption{Extra definitions made
+%           by \file{\jobname.ldf}\label{tab:ukrainian-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}|.
 %
-%    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.
+% \medskip
 %
-% \changes{ukraineb-1.1i}{2001/02/21}{As this code generates a
-%    textfont 7 error it is commented out for now.}
-%    \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 quotation marks traditionally used in Ukrainian were borrowed from
+% other languages (e.g., French and German) so they keep their original
+% names.
 %
-%    The user must 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.
+% 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}).
 %
-% \changes{ukraineb-1.1f}{1999/08/27}{Made not using inputenc a
-%    warning instead of an error}
-%    \begin{macrocode}
-\@ifpackageloaded{inputenc}{}{%
-  \def\reserved at a{LWN}%
-  \ifx\reserved at a\cyrillicencoding\else
-    \def\reserved at a{OT2}%
-    \ifx\reserved at a\cyrillicencoding\else
-      \PackageWarning{babel}%
-        {No input encoding specified for Ukrainian language}
-  \fi\fi}
-%    \end{macrocode}
+% 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}.
 %
-%    Now we define two commands that offer the possibility to switch between
-%    Cyrillic and Roman encodings.
+% 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{\jobname.ldf} starting from version 1.3 in favour of
+% the macros |\shorthandon| and |\shorthandoff| provided in the \pkg{babel} core.
 %
-%  \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.
+% \subsection{Math commands}
 %
-% \changes{ukraineb-1.1j}{2003/10/12}{\cs{latintext} is already
-%    defined by the core of \babel}
-%    \begin{macrocode}
-%\DeclareRobustCommand{\latintext}{%
-%  \fontencoding{\latinencoding}\selectfont
-%  \def\encodingdefault{\latinencoding}}
-\let\lat\latintext
-%    \end{macrocode}
+% \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 Ukrainian 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.
 %
-%  \end{macro}
-%  \end{macro}
+% The macros |\Prob|, |\Variance|, |\NSD|, |\nsd|, |\NSK|, |\nsk|, |\Proj|
+% print  some rare Ukrainian mathematical symbols.
 %
-%  \begin{macro}{\textcyrillic}
-%  \begin{macro}{\textlatin}
 %
-%    These commands take an argument which is then typeset using the
-%    requested font encoding.
-% \changes{ukraineb-1.1j}{2003/10/12}{\cs{latintext} is already
-%    defined by the core of \babel}
-%    \begin{macrocode}
-\DeclareTextFontCommand{\textcyrillic}{\cyrillictext}
-%\DeclareTextFontCommand{\textlatin}{\latintext}
-%    \end{macrocode}
+%    \section{\TeX{}nical details}
 %
-%  \end{macro}
-%  \end{macro}
+%    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, Ukrainian letter `a' matches
+%    macro |\cyra|, and capital Ukrainian 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.
 %
-%    We make the \TeX
-%    \begin{macrocode}
-%\ifx\ltxTeX\undefined\let\ltxTeX\TeX\fi
-%\ProvideTextCommandDefault{\TeX}{\textlatin{\ltxTeX}}
-%    \end{macrocode}
-%    and \LaTeX\ logos encoding independent.
-%    \begin{macrocode}
-%\ifx\ltxLaTeX\undefined\let\ltxLaTeX\LaTeX\fi
-%\ProvideTextCommandDefault{\LaTeX}{\textlatin{\ltxLaTeX}}
-%    \end{macrocode}
+%    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.
 %
-%    The next step consists of defining commands to switch to (and
-%    from) the Ukrainian language.
+%    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
+%    |\Ukrainian|, |\Englsih| and their aliases |\Ukr|, |\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.
 %
-% \begin{macro}{\captionsukrainian}
 %
-%    The macro |\captionsukrainian| defines all strings used in the four
-%    standard document classes provided with \LaTeX. The two commands |\cyr|
-%    and |\lat| activate Cyrillic resp.\ Latin encoding.
-% \changes{ukraineb-1.1d}{1999/04/03}{replace \cs{CYRUKRI} with
-%    \cs{CYRII} in \cs{authorname} }
-% \changes{ukraineb-1.1g}{2000/09/20}{Added \cs{glossaryname}}
-% \changes{ukraineb-1.1h}{2001/02/13}{Added translation for
-%    `Glossary'}
-%    \begin{macrocode}
-\addto\captionsukrainian{%
-  \def\prefacename{{\cyr\CYRV\cyrs\cyrt\cyru\cyrp}}%
-% \def\prefacename{{\cyr\CYRP\cyre\cyrr\cyre\cyrd\cyrm\cyro\cyrv\cyra}}%
-  \def\refname{%
-    {\cyr\CYRL\cyrii\cyrt\cyre\cyrr\cyra\cyrt\cyru\cyrr\cyra}}%
-%  \def\refname{%
-%    {\cyr\CYRP\cyre\cyrr\cyre\cyrl\cyrii\cyrk
-%         \ \cyrp\cyro\cyrs\cyri\cyrl\cyra\cyrn\cyrsftsn}}%
-  \def\abstractname{%
-    {\cyr\CYRA\cyrn\cyro\cyrt\cyra\cyrc\cyrii\cyrya}}%
-%  \def\abstractname{{\cyr\CYRR\cyre\cyrf\cyre\cyrr\cyra\cyrt}}%
-  \def\bibname{%
-    {\cyr\CYRB\cyrii\cyrb\cyrl\cyrii\cyro\cyrgup\cyrr\cyra\cyrf\cyrii\cyrya}}%
-% \def\bibname{{\cyr\CYRL\cyrii\cyrt\cyre\cyrr\cyra\cyrt\cyru\cyrr\cyra}}%
-  \def\chaptername{{\cyr\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}}%
-%  \def\chaptername{{\cyr\CYRG\cyrl\cyra\cyrv\cyra}}%
-  \def\appendixname{{\cyr\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}}%
-  \def\contentsname{{\cyr\CYRZ\cyrm\cyrii\cyrs\cyrt}}%
-  \def\listfigurename{{\cyr\CYRP\cyre\cyrr\cyre\cyrl\cyrii\cyrk
-         \ \cyrii\cyrl\cyryu\cyrs\cyrt\cyrr\cyra\cyrc\cyrii\cyrishrt}}%
-  \def\listtablename{{\cyr\CYRP\cyre\cyrr\cyre\cyrl\cyrii\cyrk
-         \ \cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyrsftsn}}%
-  \def\indexname{{\cyr\CYRP\cyro\cyrk\cyra\cyrzh\cyrch\cyri\cyrk}}%
-  \def\authorname{{\cyr\CYRII\cyrm\cyre\cyrn\cyrn\cyri\cyrishrt
-         \ \cyrp\cyro\cyrk\cyra\cyrzh\cyrch\cyri\cyrk}}%
-  \def\figurename{{\cyr\CYRR\cyri\cyrs.}}%
-%  \def\figurename{\cyr\CYRR\cyri\cyrs\cyru\cyrn\cyro\cyrk}}%
-  \def\tablename{{\cyr\CYRT\cyra\cyrb\cyrl.}}%
-%  \def\tablename{\cyr\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrya}}%
-  \def\partname{{\cyr\CYRCH\cyra\cyrs\cyrt\cyri\cyrn\cyra}}%
-  \def\enclname{{\cyr\cyrv\cyrk\cyrl\cyra\cyrd\cyrk\cyra}}%
-  \def\ccname{{\cyr\cyrk\cyro\cyrp\cyrii\cyrya}}%
-  \def\headtoname{{\cyr\CYRD\cyro}}%
-  \def\pagename{{\cyr\cyrs.}}%
-%  \def\pagename{{\cyr\cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrk\cyra}}%
-  \def\seename{{\cyr\cyrd\cyri\cyrv.}}%
-  \def\alsoname{{\cyr\cyrd\cyri\cyrv.\ \cyrt\cyra\cyrk\cyro\cyrzh}}
-  \def\proofname{{\cyr\CYRD\cyro\cyrv\cyre\cyrd\cyre\cyrn\cyrn\cyrya}}%
-  \def\glossaryname{{\cyr\CYRS\cyrl\cyro\cyrv\cyrn\cyri\cyrk\ %
-                   \cyrt\cyre\cyrr\cyrm\cyrii\cyrn\cyrii\cyrv}}%
-  }
-%    \end{macrocode}
+%    \section{Known problems}
 %
-% \end{macro}
+%    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.
 %
-% \begin{macro}{\dateukrainian}
 %
-%    The macro |\dateukrainian| redefines the command |\today| to produce
-%    Ukrainian dates.
+%\StopEventually{^^A
+%  \setlength{\postmulticols}{100pt}
+%  \PrintChanges
+%  \PrintIndex
+%}
 %
-%    \begin{macrocode}
-\def\dateukrainian{%
-  \def\today{\number\day~\ifcase\month\or
-    \cyrs\cyrii\cyrch\cyrn\cyrya\or
-    \cyrl\cyryu\cyrt\cyro\cyrg\cyro\or
-    \cyrb\cyre\cyrr\cyre\cyrz\cyrn\cyrya\or
-    \cyrk\cyrv\cyrii\cyrt\cyrn\cyrya\or
-    \cyrt\cyrr\cyra\cyrv\cyrn\cyrya\or
-    \cyrch\cyre\cyrr\cyrv\cyrn\cyrya\or
-    \cyrl\cyri\cyrp\cyrn\cyrya\or
-    \cyrs\cyre\cyrr\cyrp\cyrn\cyrya\or
-    \cyrv\cyre\cyrr\cyre\cyrs\cyrn\cyrya\or
-    \cyrzh\cyro\cyrv\cyrt\cyrn\cyrya\or
-    \cyrl\cyri\cyrs\cyrt\cyro\cyrp\cyra\cyrd\cyra\or
-    \cyrg\cyrr\cyru\cyrd\cyrn\cyrya\fi
-    \space\number\year~\cyrr.}}
-%    \end{macrocode}
+%\iffalse
+%<*code>
+%\fi
 %
-% \end{macro}
+%    \section{Implementation}
+%    \subsection{Initial setup}
 %
-% \begin{macro}{\extrasukrainian}
+%    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.
 %
-%    The macro |\extrasukrainian| will perform all the extra definitions
-%    needed for the Ukrainian language. The macro |\noextrasukrainian|
-%    is used to cancel the actions of |\extrasukrainian|.
-%
-%    The first action we define is to switch on the selected Cyrillic
-%    encoding whenever we enter `ukrainian'.
-%
 %    \begin{macrocode}
-\addto\extrasukrainian{\cyrillictext}
+\LdfInit{ukrainian}{captionsukrainian}
 %    \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 Ukrainian language is no longer `active'.
+%    First, we check if Lua\LaTeX\ or Xe\LaTeX\ is running. If so, we set
+%    boolean key |\if at ukr@uni at ode| 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.
+%
 %    \begin{macrocode}
-\addto\noextrasukrainian{\latintext}
+\ifdefined\if at ukr@uni at ode
+  \PackageError{babel}{if at ukr@uni at ode already defined.\MessageBreak
+    Please contact author of ukraineb.ldf}
+  \relax
+\fi
+\newif\if at ukr@uni at ode
+\ifdefined\luatexversion \@ukr at uni@odetrue \else
+\ifdefined\XeTeXrevision \@ukr at uni@odetrue \fi\fi
 %    \end{macrocode}
 %
-%    Next we must allow hyphenation in the Ukrainian words with apostrophe
-%    whenever we enter `ukrainian'. This solution was proposed by
-%    Vladimir Volovich <vvv at vvv.vsu.ru>
+%    Check if hyphenation patterns for the Ukrainian language have been
+%    loaded in \file{language.dat}. Namely, we check for the existence of
+%    |\l at ukrainian|. If it is not defined, we declare Ukrainian as dialect
+%    for the default language number 0 which almost for sure is English.
 %
 %    \begin{macrocode}
-\addto\extrasukrainian{\lccode`\'=`\'}
-\addto\noextrasukrainian{\lccode`\'=0}
+\ifx\l at ukrainian\@undefined
+  \@nopatterns{Ukrainian}
+  \adddialect\l at ukrainian0
+\fi
 %    \end{macrocode}
+%    Now |\l at ukrainian| is always defined.
 %
-%  \begin{macro}{\verbatim at font}
+%    \subsection{Output encoding}
 %
-%    In order to get both Latin and Cyrillic letters in verbatim text we
-%    need to change the definition of an internal \LaTeX\ command somewhat:
+%    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{ukraineb.ldf} ignores their effect and tries to provide some
+%    reasonable settings. In particular, \texttt{T2A} will be selected for
+%    Ukrainian language if \LaTeX\ is running but \texttt{EU1} in case of
+%    Xe\LaTeX\ and \texttt{EU2} in case of Lua\LaTeX.
 %
-%    \begin{macrocode}
-%\def\verbatim at font{%
-%  \let\encodingdefault\latinencoding
-%  \normalfont\ttfamily
-%  \expandafter\def\csname\cyrillicencoding-cmd\endcsname##1##2{%
-%    \ifx\protect\@typeset at protect
-%      \begingroup\UseTextSymbol\cyrillicencoding##1\endgroup
-%    \else\noexpand##1\fi}}
-%    \end{macrocode}
+%  \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{ukraineb.ldf} since it is overruled in \file{babel.def}.
+%    For example, after
+%\begin{verbatim}
+%\usepackage[T1,T2A]{fontenc}
+%\usepackage[english,ukrainian]{babel}
+%\end{verbatim}%
+%    as well as after
+%\begin{verbatim}
+%\usepackage[english,ukrainian]{babel}
+%\usepackage[T1,T2A]{fontenc}
+%\end{verbatim}%
+%    |\latinencoding| will be set to \texttt{T1}.
+%    After
+%\begin{verbatim}
+%\usepackage[english,ukrainian]{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 at encoding|) to
+%    \texttt{EU1} for Xe\LaTeX\ and \texttt{EU2} for Lua\LaTeX, and the \pkg{babel}
+%    package sets the macro |\latinencoding| to |\cf at encoding|. Since \pkg{babel} scan
+%    for value |\cf at 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}
 %
-%    The category code of the characters `\texttt{:}', `\texttt{;}',
-%    `\texttt{!}', and `\texttt{?}' is made |\active| to insert a little
-%    white space.
+%  \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).
 %
-%    For Ukrainian (as well as for Russian and German) the \texttt{"}
-%    character also is made active.
+%    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}.
 %
-%    Note: It is \emph{very} questionable whether the Russian typesetting
-%    tradition requires additional spacing before those punctuation signs.
-%    Therefore, we make the corresponding code optional. If you need it,
-%    then define the \texttt{frenchpunct} docstrip option in
-%    \file{babel.ins}.
+%    Remember that for the Ukrainian 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 Ukrainian phrase
+%    or vice versa.
 %
-%    Borrowed from french.
-%    Some users dislike automatic insertion of a space before
-%    `double punctuation', and prefer to decide themselves whether a
-%    space should be added or not; so a hook |\NoAutoSpaceBeforeFDP|
-%    is provided: if this command is added (in file |ukraineb.cfg|, or
-%    anywhere in a document) |ukraineb| will respect your typing, and
-%    introduce a suitable space before `double punctuation' \emph{if
-%    and only if} a space is typed in the source file before those
-%    signs.
 %
-%    The command |\AutoSpaceBeforeFDP| switches back to the
-%    default behavior of |ukraineb|.
+%    We parse the |\cdp at 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}
-%<*frenchpunct>
-\initiate at active@char{:}
-\initiate at active@char{;}
-%</frenchpunct>
-%<*frenchpunct|spanishligs>
-\initiate at active@char{!}
-\initiate at active@char{?}
-%</frenchpunct|spanishligs>
-\initiate at active@char{"}
+\def\@setcyrillicencoding{%
+  \def\sce at a##1##2{%
+    \edef\sce at b{##1}%
+    \edef\sce at c{##2}%
+    \ifx\sce at b\sce at c
+      \let\cyrillicencoding\sce at c
+    \fi}%
+  \def\cdp at elt##1##2##3##4{%
+    \sce at a{##1}{OT2}%
+    \sce at a{##1}{LCY}%
+    \sce at a{##1}{X2}%
+    \sce at a{##1}{T2C}%
+    \sce at a{##1}{T2B}%
+    \sce at a{##1}{T2A}%
+    \if at ukr@uni at ode
+      \sce at a{##1}{EU1}%
+      \sce at a{##1}{EU2}%
+    \fi}%
+  \cdp at list
+}
+\@setcyrillicencoding
+\@onlypreamble\@setcyrillicencoding
+\@onlypreamble\sce at a
+\@onlypreamble\sce at b
+\@onlypreamble\sce at c
 %    \end{macrocode}
+%    The last lines are to free the memory occupied by the macros
+%    |\@setcyrillicencoding| and |\sce at x| that are useless in the document.
+%    The contents of |\@begindocumenthook| is cleared automatically.
 %
-%    The code above is necessary because we need extra active characters.
-%    The character |"| is used as indicated in
-%    table~\ref{tab:ukrainian-quote}.
+%    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.
 %
-%    We specify that the Ukrainian group of shorthands should be used.
-%
+% \changes{1.2}{2011/10/20}{Removed test for present of
+%    encoding files}
 %    \begin{macrocode}
-\addto\extrasukrainian{\languageshorthands{ukrainian}}
+\ifdefined\cyrillicencoding
+\else
+  \if at ukr@uni at ode
+    \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
+    }%
+  \lowercase\expandafter{\expandafter\input\cyrillicencoding enc.def\relax}%
 %    \end{macrocode}
-%
-%    These characters are `turned on' once, later their definition may
-%    vary.
-%
+%    As final wisdom, we repeat |\@setcyrillicencoding| at |\begin{document}|
+%    time. We could not avoid previous call to |\@setcyrillicencoding| since
+%    compiler scan \file{.aux} file before it executes delayed code, and
+%    \file{.aux} may contain |\set at langauge{ukrainian}|; the latter rises an
+%    error if |\cyrillicencoding| would not be defined by that time.
 %    \begin{macrocode}
-\addto\extrasukrainian{%
-%<frenchpunct>  \bbl at activate{:}\bbl at activate{;}%
-%<frenchpunct|spanishligs>  \bbl at activate{!}\bbl at activate{?}%
-  \bbl at activate{"}}
-\addto\noextrasukrainian{%
-%<frenchpunct>  \bbl at deactivate{:}\bbl at deactivate{;}%
-%<frenchpunct|spanishligs>  \bbl at deactivate{!}\bbl at deactivate{?}%
-  \bbl at deactivate{"}}
+  \AtBeginDocument{\@setcyrillicencoding}
+\fi
 %    \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).
+%  \Describe\Ukrainian{}
+%  \DescribeOther\cyr{}
+%  \DescribeOther\cyrillictext{}
+%    For the sake of backward compatibility we keep the macro |\Ukrainian|
+%    but redefine its meaning; now  |\Ukrainian| is simply an alias for
+%    |\selectlanguage{ukrainian}|.
 %
-%   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.
+%    We define |\cyrillictext| and its alias |\cyr| but remove another alias
+%    |\Ukr|; these macros are intended for use within \texttt{babel} macros and
+%    do not perform complete switch of the language.
+%    In particular, they to do no switch captions and the name of current
+%    language stored in the macro |\languagename|. This inconsistency might
+%    break some assumptions embedded into \pkg{babel}'s.
+%    For example, the |\iflanguage| macro will fail.
 %
-%    \begin{macrocode}
-%<*spanishligs>
-\declare at shorthand{ukrainian}{?`}{\UseTextSymbol{OT1}\textquestiondown}
-\declare at shorthand{ukrainian}{!`}{\UseTextSymbol{OT1}\textexclamdown}
-%</spanishligs>
-%    \end{macrocode}
+%    Second, |\cyrillictext| does
+%    not activate shorthands, so that |"<|, |">|, |"`|, |"'|,
+%    |"---|, e.t.c. will not work.
 %
-% \begin{macro}{\ukrainian at sh@;@}
-% \begin{macro}{\ukrainian at sh@:@}
-% \begin{macro}{\ukrainian at sh@!@}
-% \begin{macro}{\ukrainian at sh@?@}
+%    And third, |\cyrillictext| does not write its trace
+%    to \file{.aux} file, which might result in wrong typesetting of
+%    table of content, list of table and list of figures in multilingual
+%    documents.
 %
-%    We have to reduce the amount of white space before \texttt{;},
-%    \texttt{:} and \texttt{!}. This should only happen in horizontal mode,
-%    hence the test with |\ifhmode|.
+%    Due to any of these reasons the use of the declaration |\cyrillictext| and
+%    its aliases in ordinary text is strongly discouraged. Instead of the
+%    declaration |\cyrillictext| it is recommended to use |\Ukrainian| or the
+%    command |\foreignlanguage| defined in the \pkg{babel} core; their
+%    functionality is similar to |\selectlanguage{ukrainian}| but they did not
+%    switch caption names, dates and shorthands.
 %
 %    \begin{macrocode}
-%<*frenchpunct>
-\declare at shorthand{ukrainian}{;}{%
-  \ifhmode
+\DeclareRobustCommand{\Ukrainian}{\selectlanguage{\ukrainian}}
+\DeclareRobustCommand{\cyrillictext}{%
+  \fontencoding\cyrillicencoding\selectfont
+  \let\encodingdefault\cyrillicencoding
+  \expandafter\set at hyphenmins\ukrainianhyphenmins
+  \language\l at ukrainian}%
+\let\cyr\cyrillictext
 %    \end{macrocode}
 %
-%    In horizontal mode we check for the presence of a `space', `unskip' if
-%    it exists and place a |0.1em| kerning.
+%    Starting from version v.1.2 we remove the |\English| macro and its
+%    aliases. We believe that reasonable place for defining these macros
+%    would be \file{englishb.ldf}.
+%    Note also that the macro |\English| and its  alias |\Eng| are absent
+%    in \file{ukraineb.ldf}'s counterpart in the package \pkg{polyglossia},
+%    analog of \pkg{babel} for Xe\LaTeX.
 %
+% \changes{1.2}{2011/10/20}{Removed \cs{English} macro}
 %    \begin{macrocode}
-    \ifdim\lastskip>\z@
-      \unskip\nobreak\kern.1em
-    \else
+%%\DeclareRobustCommand{\English}{%
+%%  \fontencoding\latinencoding\selectfont
+%%  \let\encodingdefault\latinencoding
+%%  \expandafter\set at hyphenmins\englishhyphenmins
+%%  \language\l at english}%
+%%\let\Eng\English
 %    \end{macrocode}
-%    If no space has been typed, we add |\FDP at thinspace|
-%    which will be
-%    defined, up to the user's wishes, as an automatic added
-%    thinspace, or as |\@empty|.
 %
-%    \begin{macrocode}
-        \FDP at thinspace
-    \fi
-  \fi
-%    \end{macrocode}
+%    \textsc{Next part of code should be moved to \texttt{X2enc.def},
+%    \texttt{X2enc.dfu}, if needed.}
+%    Since the \texttt{X2} encoding does not contain Latin letters, we
+%    should make some redefinitions of \LaTeX\ macros which implicitly
+%    produce Latin letters.
 %
-%    Now we can insert a `|;|' character.
+%    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}
-  \string;}
+\expandafter\ifx\csname T at X2\endcsname\relax\else
+  \DeclareTextSymbolDefault{\AA}{OT1}
+  \DeclareTextSymbolDefault{\aa}{OT1}
+  \DeclareTextCommand{\aa}{OT1}{\r a}
+  \DeclareTextCommand{\AA}{OT1}{\r A}
+\fi
 %    \end{macrocode}
 %
-%    The other definitions are very similar.
 %
-%    \begin{macrocode}
-\declare at shorthand{ukrainian}{:}{%
-  \ifhmode
-    \ifdim\lastskip>\z@
-      \unskip\nobreak\kern.1em
-    \else
-        \FDP at thinspace
-    \fi
-  \fi
-  \string:}
-%    \end{macrocode}
+%   The macro |\cyrillictext| switches current (e.g., Latin) font encoding
+%   to a Cyrillic font encoding stored in |\cyrillicencoding|. The macro
+%   |\latintext| switches back. This method assumes that an font
+%   encoding is a Latin one. But in fact the latter assumption does not matter
+%   if any other language is switched on using same method, i.e.
+%   if corresponding \file{.ldf} file defines required macros to switch that
+%   language on from same standard (Latin) state.
+%   Since |\latintext| is defined by the core of babel we do not repeat its
+%   definition here.
 %
+% \changes{1.1o}{2003/10/12}{\cs{latintext} is already
+%    defined by the core of babel}
+% \changes{1.2}{2011/10/20}{\cs{lat} removed}
 %    \begin{macrocode}
-\declare at shorthand{ukrainian}{!}{%
-  \ifhmode
-    \ifdim\lastskip>\z@
-      \unskip\nobreak\kern.1em
-    \else
-        \FDP at thinspace
-    \fi
-  \fi
-  \string!}
+%\DeclareRobustCommand{\latintext}{%
+%  \fontencoding{\latinencoding}\selectfont
+%  \def\encodingdefault{\latinencoding}}
+%\let\lat\latintext
 %    \end{macrocode}
 %
+%  \Describe\textcyrillic{\marg{text}}
+%    The macros |\cyrillictext|  and |\latintext| are declarations.
+%    For shorter chunks of text the commands |\textcyrillic| and |\textlatin|
+%    can be used.
+%
+%    The macro |\textcyrillic| takes an argument which is then typeset using the
+%    requested font encoding. It is thus an equivalent or
+%    |\foreignlangauge{ukrainian}|.
+% \changes{1.1o}{2003/10/12}{\cs{textlatin} already defined
+%    by the core of babel}
 %    \begin{macrocode}
-\declare at shorthand{ukrainian}{?}{%
-  \ifhmode
-    \ifdim\lastskip>\z@
-      \unskip\nobreak\kern.1em
-    \else
-        \FDP at thinspace
-    \fi
-  \fi
-  \string?}
+\DeclareTextFontCommand{\textcyrillic}{\cyrillictext}
 %    \end{macrocode}
 %
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
 %
+%    \subsection{Input encoding}
 %
-%  \begin{macro}{\AutoSpaceBeforeFDP}
-%  \begin{macro}{\NoAutoSpaceBeforeFDP}
-%  \begin{macro}{\FDP at thinspace}
-%    |\FDP at thinspace| is defined as unbreakable
-%    spaces if |\AutoSpaceBeforeFDP| is activated or as |\@empty| if
-%    |\NoAutoSpaceBeforeFDP| is in use.
-%    The default is |\AutoSpaceBeforeFDP|.
+%    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 \pkg{inputenc} package should be  explicitly called by
+%    |\usepackage{inputenc}| \emph{before} \pkg{babel}.
+%    Note however that default font encoding \texttt{T2A} fits
+%    well enough to Ukrainian version of Windows ANSI encoding which is almost
+%    equivalent to \texttt{cp1251}.
+%
+% \changes{1.1l}{1999/08/27}{Made not using inputenc a
+%    warning instead of an error}
+% \changes{1.2}{2011/10/11}{Added EU1 and EU2 encodings}
+% \changes{1.2}{2011/10/11}{Removed LWN encoding}
 %    \begin{macrocode}
-\def\AutoSpaceBeforeFDP{%
-      \def\FDP at thinspace{\nobreak\kern.1em}}
-\def\NoAutoSpaceBeforeFDP{\let\FDP at thinspace\@empty}
-\AutoSpaceBeforeFDP
+\@ifpackageloaded{inputenc}{%
+ \if at ukr@uni at ode
+   \PackageWarning{babel}{inputenc should not be used with LuaTeX or XeTeX}
+ \fi
+}{%
+  %\def\reserved at a{LWN}%
+  %\ifx\reserved at a\cyrillicencoding\else
+    \def\reserved at a{OT2}%
+    \ifx\reserved at a\cyrillicencoding\else
+       \def\reserved at a{EU1}%
+       \ifx\reserved at a\cyrillicencoding\else
+          \def\reserved at a{EU2}%
+          \ifx\reserved at a\cyrillicencoding\else
+             \PackageWarning{babel}%
+                {No input encoding specified for Ukrainian language}
+    \fi\fi\fi
+  %\fi
+}
 %    \end{macrocode}
-%  \end{macro}
-%  \end{macro}
-%  \end{macro}
 %
-%  \begin{macro}{\FDPon}
-%  \begin{macro}{\FDPoff}
 %
-%     The next macros allow to switch on/off activeness of double
-%     punctuation signs.
+%    \subsection{Shorthands}
 %
+%    The double quote  character \texttt{"} is declared to be active in
+%    Ukrainian language.
+%
+% \changes{1.1a}{1995/03/07}{Use the new mechanism for dealing
+%    with active characters}
 %    \begin{macrocode}
-\def\FDPon{\bbl at activate{:}%
-        \bbl at activate{;}%
-        \bbl at activate{?}%
-        \bbl at activate{!}}
-\def\FDPoff{\bbl at deactivate{:}%
-        \bbl at deactivate{;}%
-        \bbl at deactivate{?}%
-        \bbl at deactivate{!}}
+\initiate at active@char{"}
 %    \end{macrocode}
-%  \end{macro}
-%  \end{macro}
 %
-%  \begin{macro}{\system at sh@:@}
-%  \begin{macro}{\system at sh@!@}
-%  \begin{macro}{\system at sh@?@}
-%  \begin{macro}{\system at sh@;@}
-%
-%    When the active characters appear in an environment where their
-%    Ukrainian behaviour is not wanted they should give an `expected'
-%    result. Therefore we define shorthands at system level as well.
-%
+%  \begin{macro}{\mdqon}
+%  \begin{macro}{\mdqoff}
+%    Obsolete: Active double quote can be both activated and deactivated at any time
+%    using the macros |\mdqon| and  |\mdqoff|.
 %    \begin{macrocode}
-\declare at shorthand{system}{:}{\string:}
-\declare at shorthand{system}{;}{\string;}
-%</frenchpunct>
-%<*frenchpunct&!spanishligs>
-\declare at shorthand{system}{!}{\string!}
-\declare at shorthand{system}{?}{\string?}
-%</frenchpunct&!spanishligs>
+%\def\mdqon{\bbl at activate{"}}
+%\def\mdqoff{\bbl at deactivate{"}}
 %    \end{macrocode}
-%
+%    Initial activation state will set to on later in section \ref{sss:extra}.
 %  \end{macro}
 %  \end{macro}
-%  \end{macro}
-%  \end{macro}
 %
-%    To be able to define the function of `|"|', we first define a couple of
-%    `support' macros.
+%  \Describe\dq{}
+%    The active character |"| is used as indicated in
+%    table~\ref{tab:ukrainian-quote}. We save the original double quote
+%    character in the |\dq| macro to keep it available.
+%    The math accent |\"| can now be typed as `|"|'.
 %
-%  \begin{macro}{\dq}
-%
-%    We save the original double quote character in |\dq| to keep it
-%    available, the math accent |\"| can now be typed as `|"|'.
-%
 %    \begin{macrocode}
 \begingroup \catcode`\"12
 \def\reserved at a{\endgroup
@@ -812,20 +1102,33 @@
 \reserved at a
 %    \end{macrocode}
 %
-%  \end{macro}
+%    \subsubsection{Quotes}
 %
-%    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.
+%    We set |"`| and |"'| as shorthands for |\quotedblbase| and
+%    |\textquotedblleft|, respectively. Prior to ver.1.2, these shorthands
+%    were defined through german quotes |\glqq| and |\grqq|, which in their turn
+%    are defined in \pkg{babel.def} via |\quotedblbase| and |\textquotedblleft|,
+%    respectively. It occurred, that old definition caused errors in Unicode
+%    mode if \pkg{fontspec} is loaded.
 %
+%    Prior to version 1.2, the shorthands |"<| and |">| were
+%    declared to be equivalents for the French quotes |\flqq| and |\frqq|,
+%    respectively. They are defined in \pkg{babel.def} via |\guillemotleft| and
+%    |\guillemotrigh|. However, |\flqq| and |\guillemotleft| (and their right
+%    counterparts) are typeset differently if current encoding is not
+%    \texttt{T1}. Therefore, since v.1.2, we define |"<| and |">|  directly
+%    through |\guillemotleft| and |\guillemotrigh|.
+%
 %    \begin{macrocode}
-\declare at shorthand{ukrainian}{"`}{\glqq}
-\declare at shorthand{ukrainian}{"'}{\grqq}
-\declare at shorthand{ukrainian}{"<}{\flqq}
-\declare at shorthand{ukrainian}{">}{\frqq}
+\declare at shorthand{ukrainian}{"`}{\quotedblbase}
+\declare at shorthand{ukrainian}{"'}{\textquotedblleft}
+\declare at shorthand{ukrainian}{"<}{\guillemotleft}
+\declare at shorthand{ukrainian}{">}{\guillemotright}
 %    \end{macrocode}
 %
-%    Some additional commands:
+%    Next set of shorthands is intended for variations of standard macro |\-|
+%    which indicates explicitly breakpoint for hyphenation in a word. Meaning
+%    of these shorthands is explained in table~\ref{tab:ukrainian-quote}.
 %
 %    \begin{macrocode}
 \declare at shorthand{ukrainian}{""}{\hskip\z at skip}
@@ -832,52 +1135,37 @@
 \declare at shorthand{ukrainian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}
 \declare at shorthand{ukrainian}{"=}{\nobreak-\hskip\z at skip}
 \declare at shorthand{ukrainian}{"|}{%
-  \textormath{\nobreak\discretionary{-}{}{\kern.03em}%
-              \allowhyphens}{}}
+  \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:
+%    \subsubsection{Emdash, endash and hyphenation sign}
 %
+%    To distinguish between |"-| and |"---| we must check whether the next
+%    after |-| token is a hyphen character.
+%    If it is, we output an emdash, otherwise a hyphen sign. Therefor
+%    \TeX\ looks for the next token after the first `|-|', writes
+%    its meaning to |\ukrainian at sh@next| and finally call for |\ukrainian at sh@tmp|.
+%
 %    \begin{macrocode}
 \declare at shorthand{ukrainian}{"-}{%
-%    \end{macrocode}
-%
-%    If the next token is `|-|', we typeset an emdash, otherwise a hyphen
-%    sign:
-%
-%    \begin{macrocode}
   \def\ukrainian at sh@tmp{%
     \if\ukrainian at sh@next-\expandafter\ukrainian at sh@emdash
-    \else\expandafter\ukrainian at sh@hyphen\fi
-  }%
-%    \end{macrocode}
-%
-%    \TeX\ looks for the next token after the first `|-|': the meaning of
-%    this token is written to |\ukrainian at sh@next| and |\ukrainian at sh@tmp| is
-%    called.
-%
-%    \begin{macrocode}
+    \else\expandafter\ukrainian at sh@hyphen\fi}%
   \futurelet\ukrainian at sh@next\ukrainian at sh@tmp}
 %    \end{macrocode}
-%
-%    Here are the definitions of hyphen and emdash. First the hyphen:
-%
+%    Two macros |\ukrainian at sh@hyphen| and |\ukrainian at sh@emdash| called by
+%    |\ukrainian at sh@tmp|  are defined below. The second of
+%    them has two parameters since it must gobble next two hyphen signs.
 %    \begin{macrocode}
-\def\ukrainian at sh@hyphen{%
-  \nobreak\-\bbl at allowhyphens}
+\def\ukrainian at sh@hyphen{\nobreak\-\bbl at allowhyphens}
+\def\ukrainian at sh@emdash#1#2{\cdash-#1#2}
 %    \end{macrocode}
 %
-%    For the emdash definition, there are the two parameters: we must `eat'
-%    two last hyphen signs of our emdash\dots :
+%  \Describe\cdash{}
+%    In its turn, |\ukrainian at sh@emdash| simply calls for |\cdash| which has
+%    rich use. It analyses 3rd of 3 characters and calls for one of few
+%    predefined macros |\@Acdash|, |\@Bcdash|, |\@Ccdash|.
 %    \begin{macrocode}
-\def\ukrainian at sh@emdash#1#2{\cdash-#1#2}
-%    \end{macrocode}
-%  \begin{macro}{\cdash}
-%    \dots\ these two parameters are useful for another macro:
-%    |\cdash|:
-%    \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
@@ -885,97 +1173,318 @@
    \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}
+%
+%   All these 3 internal macros call for |\cyrdash|, which type Cyrillic
+%   emdash, but put different spaces around the dash.
+%
+%   |\@Acdash| is invoked by |"---|. It types Cyrillic emdash to be used
+%   inside a text and puts an unbreakable thin space before the dash if a
+%   \textit{space} is placed before |"---| in the source file;
+%   can be used after display maths formulae, formatted lists, enumerations, etc.
 %    \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}
+%
+%   |\@Bcdash| is invoked by |"--~|. It types Cyrillic emdash in compound
+%   names (like Mendeleev--Klapeiron); requires no space characters around and
+%   adds extra space after the dash.
 %    \begin{macrocode}
 \def\@Bcdash{\leavevmode\ifdim\lastskip>\z@\unskip\fi
  \nobreak\cyrdash\penalty\exhyphenpenalty\hskip\z at 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}
+%
+%   |\@Ccdash| is invoked by |"--*|. It denotes direct speech and adds small
+%   space after the dash.
 %    \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 |---|.
+%  \Describe\cyrdash{}
+%   The |\cyrdash| can be defined in a fontenc file as it is done for
+%   the \texttt{T2*} encodings. We provide fake definition of |\cyrdash| only if
+%   it is not defined there.
+%
+%   Cyrillic \texttt{T2*} fonts contains shorter (Cyrillic) emdash. It can be
+%   typeset also via the ligature |---|. So, if |\laticencoding| differs from
+%   \texttt{T2*} switching of languages also changes the emdash length typed as
+%   ligature in the source file.
+%
 %    \begin{macrocode}
-% Is there an IF necessary?
-\ifx\cyrdash\undefined
-  \def\cyrdash{\hbox to.8em{--\hss--}}
-\fi
+%\ifx\cyrdash\undefined
+%  \def\cyrdash{\hbox to.8em{--\hss--}}
+%  \PackageInfo{babel}{\string\cyrdash\space is defined}
+%\fi
+\ProvideTextCommandDefault{\cyrdash}{\iflanguage{ukrainian}%
+    {\hbox to.8em{--\hss--}}{\textemdash}}
 %    \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.
+% \changes{1.1f}{1998/06/26}{%
+%    Add macro for thin space between initials}
 %
+%    Finally, we define a shorthand thin space to be placed between initials
+%    as in |D.",Mendeleev|. When used instead of |\,| as in |D.\,Mendeleev|
+%    it allows hyphenation in the next word.
+%
 %    \begin{macrocode}
 \declare at shorthand{ukrainian}{",}{\nobreak\hskip.2em\ignorespaces}
 %    \end{macrocode}
 %
-%  \begin{macro}{\mdqon}
-%  \begin{macro}{\mdqoff}
-%    All that's left to do now is to  define a couple of commands
-%    for |"|.
+%
+%   \subsection{Switching to and from Ukrainian}
+%
+%   Now we define additional macros used to reset current language to
+%   Ukrainian and back
+%   to some original state. The package \pkg{babel} based on the assumption
+%   that original state is characterized by a Latin encoding. Previously,
+%   for back reset the macro |\OriginalTeX| was used, but now use |\latintext|
+%   for the same purpose.
+%
+%
+%    \subsubsection{Caption names}
+%
+%    First, we define Ukrainian equivalents for Ukrainian caption names.
+%
+% \Describe\captionsukrainian{}
+%    The macro |\captionsukrainian| defines caption names used in the
+%    four standard document classes provided with \LaTeX. The macro |\cyr|
+%    activates Cyrillic encoding. It could be dropped if we would be sure
+%    that Ukrainian captions are called only if current language is Ukrainian.
+%    However, the macros such as |\Ukrainian| do not conform to strict rules
+%    of the package \pkg{babel} as explained in the above.
+%
+%    As of version v.1.2 we eliminate |\cyr...| macros from caption names
+%    if Unicode engine is running. In the latter case, Cyrillic letters are typed
+%    in by their Unicode code-points, the |^^^^abcd| notation is not used
+%    since it causes error at compilation time in case if \LaTeX\ is running
+%    and \texttt{utf8} input encoding is not declared.
+%
 %    \begin{macrocode}
-\def\mdqon{\bbl at activate{"}}
-\def\mdqoff{\bbl at deactivate{"}}
+\if at ukr@uni at ode
+  %\captionsukrainian
+  \addto\captionsukrainian{%
+    \def\prefacename{Вступ}%   [babel]
+    \def\refname{Література}% [only article]
+    \def\abstractname{Анотація}%    [only article, report]
+    \def\bibname{Бібліоґрафія}%        [only book, report]
+    \def\chaptername{Глава}%         [only book, report]
+    \def\appendixname{Додаток}%
+    \def\contentsname{Зміст}%
+    \let\tocname=\contentsname
+    \def\listfigurename{Перелік ілюстрацій}%
+    \def\listtablename{Перелік таблиць}%
+    \def\indexname{Предметний покажчик}%
+    \def\authorname{Іменний покажчик}%
+    \def\figurename{Рис.}%
+    \def\tablename{Таблиця}%
+    \def\partname{Частина}%
+    \def\enclname{вкл.}%
+    \def\ccname{вих.}%
+    \def\headtoname{вх.}%
+    \def\pagename{с.}%               [letter]
+    \def\seename{див.}%
+    \def\alsoname{див.\ також}%
+    \def\proofname{Доведення}%  [amsthm]
+    \def\glossaryname{Словник термінів}%
+    \def\acronymname{Абревіатури}%  [glossaries] {Acronyms}
+    \def\lstlistingname{Лістинг}%    [listings]  (the environment) {Listing}
+    \def\lstlistlistingname{Лістинги}% [listings]  (the "List of") {Listings}
+    \def\notesname{Нотатки}%         [endnotes] {Notes}
+  }%
 %    \end{macrocode}
-%  \end{macro}
-%  \end{macro}
+%    Additional definitions for the package \pkg{nomencl}:
+%    \begin{macrocode}
+  %% =========================================
+  %% nomencl
+  \ifdefined\nomname
+    \addto\captionsukrainian{%
+        \def\nomname{Позначення}%
+        \def\eqdeclaration#1{, див.\nobreakspace(#1)}%
+        \def\pagedeclaration#1{, стор.\nobreakspace#1}%
+    }%
+  \fi
+%    \end{macrocode}
+%    Additional captions for the \cls{revtex} class.
+%    \begin{macrocode}
+  %% =========================================
+  %% RevTeX4 & RevTeX4-1
+  %%\@ifclassloaded{revtex4-1}
+  %%{<true code>}
+  %%{<false coode>}%
+  %\@ifclassloaded{revtex4-1}
+  %{%
+  \ifnum\@ifclassloaded{revtex4}{1}{\@ifclassloaded{revtex4-1}{1}{0}}>0
+    \addto\captionsukrainian{%
+    \def\lofname{\listfigurename}
+    \def\lotname{\listtablename}
+    \def\figuresname{Рисунки}%{Figures}%
+    \def\tablesname{Таблиці}%{Tables}%
+    \def\appendixesname{Додатки}%{Appendixes}%
+    \def\acknowledgmentsname{Подяки}%{Acknowledgments}
+    \def\andname{та}%{and}
+    \def\@pacs at name{PACS коди: }%{PACS numbers: }%
+    \def\@keys at name{Ключові слова: }%{Keywords: }%
+    \def\Dated at name{Дата: }%{Dated: }%
+    \def\Received at name{Отримано }%{Received }%
+    \def\Revised at name{Виправлена версія }%{Revised }%
+    \def\Accepted at name{Прийнято }%{Accepted }%
+    \def\Published at name{Опубліковано }%{Published }%
+    }%
+  %}{}%
+  \fi
+%    \end{macrocode}
+%    \begin{macrocode}
+\else
+%\captionsukrainian
+\addto\captionsukrainian{%
+  \def\prefacename{{\cyr\CYRV\cyrs\cyrt\cyru\cyrp}}%
+  \def\refname{%
+    {\cyr\CYRL\cyrii\cyrt\cyre\cyrr\cyra\cyrt\cyru\cyrr\cyra}}%
+  \def\abstractname{%
+    {\cyr\CYRA\cyrn\cyro\cyrt\cyra\cyrc\cyrii\cyrya}}%
+  \def\bibname{%
+    {\cyr\CYRB\cyrii\cyrb\cyrl\cyrii\cyro\cyrgup\cyrr\cyra\cyrf\cyrii\cyrya}}%
+  \def\chaptername{{\cyr\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}}%
+  \def\appendixname{{\cyr\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}}%
+  \def\contentsname{{\cyr\CYRZ\cyrm\cyrii\cyrs\cyrt}}%
+  \let\tocname=\contentsname
+  \def\listfigurename{{\cyr\CYRP\cyre\cyrr\cyre\cyrl\cyrii\cyrk
+         \ \cyrii\cyrl\cyryu\cyrs\cyrt\cyrr\cyra\cyrc\cyrii\cyrishrt}}%
+  \def\listtablename{{\cyr\CYRP\cyre\cyrr\cyre\cyrl\cyrii\cyrk
+         \ \cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyrsftsn}}%
+  \def\indexname{{\cyr\CYRP\cyrr\cyre\cyrd\cyrm\cyre\cyrt\cyrn\cyri\cyrishrt
+  \ \cyrp\cyro\cyrk\cyra\cyrzh\cyrch\cyri\cyrk}}%
+  \def\authorname{{\cyr\CYRII\cyrm\cyre\cyrn\cyrn\cyri\cyrishrt
+         \ \cyrp\cyro\cyrk\cyra\cyrzh\cyrch\cyri\cyrk}}%
+  \def\figurename{{\cyr\CYRR\cyri\cyrs.}}%
+  \def\tablename{{\cyr\CYRT\cyra\cyrb\cyrl.}}%
+  \def\partname{{\cyr\CYRCH\cyra\cyrs\cyrt\cyri\cyrn\cyra}}%
+  \def\enclname{{\cyr\cyrv\cyrk\cyrl\cyra\cyrd\cyrk\cyra}}%
+  \def\ccname{{\cyr\cyrk\cyro\cyrp\cyrii\cyrya}}%
+  \def\headtoname{{\cyr\cyrv\cyrh.}}%
+  \def\pagename{{\cyr\cyrs.}}%
+  \def\seename{{\cyr\cyrd\cyri\cyrv.}}%
+  \def\alsoname{{\cyr\cyrd\cyri\cyrv.\ \cyrt\cyra\cyrk\cyro\cyrzh}}
+  \def\proofname{{\cyr\CYRD\cyro\cyrv\cyre\cyrd\cyre\cyrn\cyrn\cyrya}}%
+  \def\glossaryname{{\cyr\CYRS\cyrl\cyro\cyrv\cyrn\cyri\cyrk\ %
+                   \cyrt\cyre\cyrr\cyrm\cyrii\cyrn\cyrii\cyrv}}%
+  \def\nomname{\CYRP\cyro\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
+  \def\notesname{\CYRN\cyro\cyrt\cyra\cyrt\cyrk\cyri}%
+  }%
+  %% =========================================
+  %% RevTeX4 & RevTeX4-1
+  \ifnum \@ifclassloaded{revtex4}{1}{\@ifclassloaded{revtex4-1}{1}{0}}>0
+    \addto\captionsukrainian{%
+    \def\lofname{\listfigurename}
+    \def\lotname{\listtablename}
+    \def\figuresname{\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%{Figures}%
+    \def\tablesname{\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrii}%{Tables}%
+    \def\appendixesname{\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%{Appendixes}%
+    \def\acknowledgmentsname{\CYRP\cyro\cyrd\cyrya\cyrk\cyri}%{Acknowledgments}
+    \def\andname{\cyrt\cyra}%{and}
+    \def\@pacs at name{PACS \cyrk\cyro\cyrd\cyri: }%{PACS numbers: }%
+    \def\@keys at name{\CYRK\cyrl\cyryu\cyrch\cyro\cyrv\cyrii
+    \ \cyrs\cyrl\cyro\cyrv\cyra: }%{Keywords: }%
+    \def\Dated at name{\CYRD\cyra\cyrt\cyra: }%{Dated: }%
+    \def\Received at name{\CYRO\cyrt\cyrr\cyri\cyrm\cyra\cyrn\cyro }%{Received }%
+    \def\Revised at name{\CYRV\cyri\cyrp\cyrr\cyra\cyrv\cyrl\cyre\cyrn\cyro }%{Revised }%
+    \def\Accepted at name{\CYRP\cyrr\cyri\cyrishrt\cyrn\cyrya\cyrt\cyro }%{Accepted }%
+    \def\Published at name{\CYRO\cyrp\cyru\cyrb\cyrl\cyrii\cyrk\cyro\cyrv\cyra\cyrn\cyro }%{Published }%
+    }%
+  \fi
+\fi
+%    \end{macrocode}
+%    \subsubsection{Date in Ukrainian}
 %
-%    The Ukrainian hyphenation patterns can be used with |\lefthyphenmin|
-%    and |\righthyphenmin| set to~2.
-% \changes{ukraineb-1.1g}{2000/09/22}{Now use \cs{providehyphenmins} to
+% \Describe\dateukrainian{}
+%    The macro |\dateukrainian| is used to reset the macro |\today| in Ukrainian.
+%
+% \changes{1.2}{2011/10/20}{Unicode code-points added for LuaLaTeX}
+%    \begin{macrocode}
+\if at ukr@uni at ode
+  \addto\dateukrainian{%
+   \def\today{\number\day~\ifcase\month\or
+    січня\or
+    лютого\or
+    березня\or
+    квітня\or
+    травня\or
+    червня\or
+    липня\or
+    серпня\or
+    вересня\or
+    жовтня\or
+    листопада\or
+    грудня\fi
+    \space \number\year~р.}}
+\else
+\def\dateukrainian{%
+  \def\today{\number\day~\ifcase\month\or
+    \cyrs\cyrii\cyrch\cyrn\cyrya\or
+    \cyrl\cyryu\cyrt\cyro\cyrg\cyro\or
+    \cyrb\cyre\cyrr\cyre\cyrz\cyrn\cyrya\or
+    \cyrk\cyrv\cyrii\cyrt\cyrn\cyrya\or
+    \cyrt\cyrr\cyra\cyrv\cyrn\cyrya\or
+    \cyrch\cyre\cyrr\cyrv\cyrn\cyrya\or
+    \cyrl\cyri\cyrp\cyrn\cyrya\or
+    \cyrs\cyre\cyrr\cyrp\cyrn\cyrya\or
+    \cyrv\cyre\cyrr\cyre\cyrs\cyrn\cyrya\or
+    \cyrzh\cyro\cyrv\cyrt\cyrn\cyrya\or
+    \cyrl\cyri\cyrs\cyrt\cyro\cyrp\cyra\cyrd\cyra\or
+    \cyrg\cyrr\cyru\cyrd\cyrn\cyrya\fi
+    \space\number\year~\cyrr.}}
+\fi
+%    \end{macrocode}
+%
+%    \subsubsection{Hyphenation patterns}
+%
+%    Ukrainian hyphenation patterns are automatically activated every time
+%    Ukrainian language is selected via |\selectlanguage|, |\foreignlanguage|
+%    or equivalent command. But we need to declare values of
+%    |\lefthyphenmin| and |\righthyphenmin|; both are set to~2.
+%
+%    As of v.1.2 we removed a definition for |\englishhyphenmins|. It is
+%    not deal of \file{\jobname.ldf}.
+%
+% \changes{1.1a}{1995/07/04}{use \cs{ukrainianhyphenmins} to
+%    store the correct values}
+% \changes{1.1m}{2000/09/22}{Now use \cs{providehyphenmins} to
 %    provide a default value}
+% \changes{1.2}{2011/10/20}{\cs{englishhyphenmins} is removed}
 %    \begin{macrocode}
 \providehyphenmins{\CurrentOption}{\tw@\tw@}
-% temporary hack:
-\ifx\englishhyphenmins\undefined
-  \def\englishhyphenmins{\tw@\thr@@}
-\fi
+\providehyphenmins{ukrainian}{\tw@\tw@}
 %    \end{macrocode}
 %
+%    \subsubsection{Extra definitions\label{sss:extra}}
+%
+% \Describe\extrasukrainian{}
+% \DescribeOther\noextrasukrainian{}
+%    The macro |\extrasukrainian| performs extra definitions in addition to
+%    resetting the caption names and date.
+%    The macro |\noextrasukrainian| is used to cancel the actions of
+%    |\extrasukrainian|.
+%
+% \changes{1.1b}{1996/02/20}{Added switch to \texttt{LWN}
+%    encoding}
+%
+%    First, we instruct \pkg{babel} to switch font encoding using earlier
+%    defined macros |\cyrillictext| and |\latintext|.
+%
+%    \begin{macrocode}
+\addto\extrasukrainian{\cyrillictext}
+\addto\noextrasukrainian{\latintext}
+%    \end{macrocode}
+%
+%    Second, we specify that the Ukrainian group of shorthands should be used.
+%
+%    \begin{macrocode}
+\addto\extrasukrainian{\languageshorthands{ukrainian}}
+\addto\extrasukrainian{\bbl at activate{"}}
+\addto\noextrasukrainian{\bbl at deactivate{"}}
+%    \end{macrocode}
+%
 %    Now the action |\extrasukrainian| has to execute is to make sure that the
 %    command |\frenchspacing| is in effect. If this is not the case the
 %    execution of |\noextrasukrainian| will switch it off again.
@@ -985,174 +1494,236 @@
 \addto\noextrasukrainian{\bbl at nonfrenchspacing}
 %    \end{macrocode}
 %
-% \end{macro}
+%    \subsection{Alphabetic counters}
 %
-%    Next we add a new enumeration style for Ukrainian manuscripts with
-%    Cyrillic letters, and later on we define some math operator names in
-%    accordance with Ukrainian and Russian typesetting traditions.
+%    Do we need to reset |\@alph| and |\@Alph|? They are used in the
+%    \LaTeX\ core to define the macros |\alph| and |\Alph|, respectively, which
+%    type a counter with a corresponding letter of Latin alphabet.
+%    We just want to make sure that correct |\latinencoding| is used instead of
+%    |\latinencoding| to typeset the counter. Starting from v.1.2 we do not
+%    reset these macros since all Cyrillic encoding but \texttt{X2} do have
+%    Latin letters. When using the \texttt{X2} encoding user must himself
+%    take care about selecting correct encoding when he switches his keyboard.
+%    Our decision is motivated as follows. If selected Cyrillic font is visually
+%    different from Latin font, the macro |\@alph| and |\@Alph| will produce
+%    visually different output from surrounding text if they are used with
+%    Ukrainian text, which is completely legitimate.
 %
-%  \begin{macro}{\Asbuk}
+%    Notice for commented code:\\
+%    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).
 %
-%    We begin by defining |\Asbuk| which works like |\Alph|, but produces
-%    (uppercase) Cyrillic letters intead of Latin ones. The letters CYRGUP,
-%    and SFTSN are skipped, as usual for such enumeration.
+%    Note added on 2013/03/22: |{\fontencoding{\latinencoding}\selectfont|
+%    rises an error with recent version of \pkg{microtype} package after the
+%    |\appendix| declaration (which resets |\thechapter| to |\@Alph\c at chapter}|).
+%    Most languages do not reset |\@alph| and |\@Alph| macros and only
+%    \pkg{ukrainian} and \pkg{bulgarian} add |\fontencoding| to |\@alph| and
+%    |\@Alph|.
 %
+%    Since v.1.3 we do not reset |\@alph| and |\@Alph| here.
+%    Resetting |\fontencoding| in |\@alph| and |\@Alph| causes an error
+%    if the package |smartref| is loaded and a |\sref| occurs after the
+%    |\appendix| declaration which resets |\thechapter| to |\@Alph\c at chapter|.
+% \changes{1.3}{2013/03/22}{Removed \cs{@alph} and \cs{@Alph}}
+%
 %    \begin{macrocode}
-\def\Asbuk#1{\expandafter\@Asbuk\csname c@#1\endcsname}
-\def\@Asbuk#1{\ifcase#1\or
-  \CYRA\or\CYRB\or\CYRV\or\CYRG\or\CYRD\or\CYRE\or\CYRIE\or
-  \CYRZH\or\CYRZ\or\CYRI\or\CYRII\or\CYRYI\or\CYRISHRT\or
-  \CYRK\or\CYRL\or\CYRM\or\CYRN\or\CYRO\or\CYRP\or\CYRR\or
-  \CYRS\or\CYRT\or\CYRU\or\CYRF\or\CYRH\or\CYRC\or\CYRCH\or
-  \CYRSH\or\CYRSHCH\or\CYRYU\or\CYRYA\else\@ctrerr\fi}
+%\def\@alph#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#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}}%
 %    \end{macrocode}
 %
-%  \end{macro}
+%    We add new enumeration style for Ukrainian manuscripts with
+%    Cyrillic letters.
 %
-%  \begin{macro}{\asbuk}
+%  \Describe\Asbuk{}
+%    We begin by defining |\Asbuk| which works like |\Alph|, but produces
+%    (uppercase) Cyrillic letters instead of Latin ones. The letters YO,
+%    ISHRT, HRDSN, ERY, and SFTSN are skipped, as usual for such
+%    enumeration.
 %
+%    \begin{macrocode}
+\def\Asbuk#1{\expandafter\ukrainian at Alph\csname c@#1\endcsname}
+\if at ukr@uni at ode
+  \def\ukrainian at 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 Щ\or Ю\or Я\else\@ctrerr\fi}
+\else
+  \def\ukrainian at Alph#1{\ifcase#1\or
+    \CYRA\or\CYRB\or\CYRV\or\CYRG\or\CYRD\or\CYRE\or\CYRYE\or\CYRZH\or
+    \CYRZ\or\CYRI\or\CYRII\or\CYRYI\or\CYRK\or\CYRL\or\CYRM\or\CYRN\or\CYRO\or
+    \CYRP\or\CYRR\or\CYRS\or\CYRT\or\CYRU\or\CYRF\or\CYRH\or
+    \CYRC\or\CYRCH\or\CYRSH\or\CYRSHCH\or\CYRYU\or
+    \CYRYA\else\@ctrerr\fi}
+\fi
+%    \end{macrocode}
+%
+%  \Describe\asbuk{}
 %    The macro |\asbuk| is similar to |\alph|; it produces lowercase
 %    Ukrainian letters.
 %
 %    \begin{macrocode}
-\def\asbuk#1{\expandafter\@asbuk\csname c@#1\endcsname}
-\def\@asbuk#1{\ifcase#1\or
-  \cyra\or\cyrb\or\cyrv\or\cyrg\or\cyrd\or\cyre\or\cyrie\or
-  \cyrzh\or\cyrz\or\cyri\or\cyrii\or\cyryi\or\cyrishrt\or
-  \cyrk\or\cyrl\or\cyrm\or\cyrn\or\cyro\or\cyrp\or\cyrr\or
-  \cyrs\or\cyrt\or\cyru\or\cyrf\or\cyrh\or\cyrc\or\cyrch\or
-  \cyrsh\or\cyrshch\or\cyryu\or\cyrya\else\@ctrerr\fi}
+\def\asbuk#1{\expandafter\ukrainian at alph\csname c@#1\endcsname}
+\if at ukr@uni at ode
+  \def\ukrainian at 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 щ\or ю\or я\else\@ctrerr\fi}
+\else
+  \def\ukrainian at alph#1{\ifcase#1\or
+    \cyra\or\cyrb\or\cyrv\or\cyrg\or\cyrd\or\cyre\or\cyrye\or\cyrzh\or
+    \cyrz\or\cyri\or\cyrii\or\cyryi\or\cyrk\or\cyrl\or\cyrm\or\cyrn\or\cyro\or
+    \cyrp\or\cyrr\or\cyrs\or\cyrt\or\cyru\or\cyrf\or\cyrh\or
+    \cyrc\or\cyrch\or\cyrsh\or\cyrshch\or\cyryu\or
+    \cyrya\else\@ctrerr\fi}
+\fi
 %    \end{macrocode}
 %
-%  \end{macro}
+%    Babel 3.9 has introduced a notion of a language attribute.
+%    An \Lopt{ancient} attribute changes default behavior, which
+%    uses modern Ukrainian spelling, an activates an alternative set of
+%    captions and date macros suitable for typesetting ancient
+%    Slavonic and Church books.
+%    \begin{macrocode}
+\bbl at declare@ttribute{ukrainian}{ancient}{%
+ \PackageInfo{babel}{ukrainian attribute set to ancient}%
+ \let\captionsukrainian=\captionsukrainian at ancient
+ \let\dateukrainian=\dateukrainian at ancient
+}
+%    \end{macrocode}
+%    We don't want for long internal macros to waste memory. So we declare
+%    them to be usable within the preamble only.
+%    \begin{macrocode}
+\@onlypreamble\captionsukrainian at ancient
+\@onlypreamble\dateukrainian at ancient
+%    \end{macrocode}
 %
-%    Set up default Cyrillic math alphabets. The math groups for cyrillic
-%    letters are defined in the encoding definition files. First, declare
-%    a new alphabet for symbols, |\cyrmathrm|, based on the symbol font
-%    for Cyrillic letters defined in the encoding definition file. Note,
-%    that by default Cyrillic letters are taken from upright font in math
-%    mode (unlike Latin letters).
+%    \subsection{Cyrillic math}
+%
+%    For compatibility with older Ukrainian packages we could define the |\No|
+%    macro. However the Ukrainian number sign is now superseded with |\textnumero|.
+%    Moreover, it can be found on the keyboard. Therefore we discard |\No|
+%    since v.1.2.
 %    \begin{macrocode}
+%\DeclareRobustCommand{\No}{%
+%   \ifmmode{\nfss at text{\textnumero}}\else\textnumero\fi}
+%    \end{macrocode}
+%
+%
+%    As of version 1.2 the macros |\cyrmath..| are not supported any more. They
+%    requires package \pkg{textmath} which is not available now. Instead of
+%    |\cyrmath..| it is advised to use corresponding |\text..| commands; they
+%    do work in math mode.
+%    \begin{macrocode}
 %\RequirePackage{textmath}
-\@ifundefined{sym\cyrillicencoding letters}{}{%
-\SetSymbolFont{\cyrillicencoding letters}{bold}\cyrillicencoding
-  \rmdefault\bfdefault\updefault
-\DeclareSymbolFontAlphabet\cyrmathrm{\cyrillicencoding letters}
+%  \@ifundefined{sym\cyrillicencoding letters}{}{%
+%  \SetSymbolFont{\cyrillicencoding letters}{bold}\cyrillicencoding
+%    \rmdefault\bfdefault\updefault
+%  \DeclareSymbolFontAlphabet\cyrmathrm{\cyrillicencoding letters}
 %    \end{macrocode}
-%    And we need a few commands to be able to switch to different variants.
+%    And we need few commands to switch to different variants.
 %    \begin{macrocode}
-\DeclareMathAlphabet\cyrmathbf\cyrillicencoding
-  \rmdefault\bfdefault\updefault
-\DeclareMathAlphabet\cyrmathsf\cyrillicencoding
-  \sfdefault\mddefault\updefault
-\DeclareMathAlphabet\cyrmathit\cyrillicencoding
-  \rmdefault\mddefault\itdefault
-\DeclareMathAlphabet\cyrmathtt\cyrillicencoding
-  \ttdefault\mddefault\updefault
+%\DeclareMathAlphabet\cyrmathbf\cyrillicencoding
+%  \rmdefault\bfdefault\updefault
+%\DeclareMathAlphabet\cyrmathsf\cyrillicencoding
+%  \sfdefault\mddefault\updefault
+%\DeclareMathAlphabet\cyrmathit\cyrillicencoding
+%  \rmdefault\mddefault\itdefault
+%\DeclareMathAlphabet\cyrmathtt\cyrillicencoding
+%  \ttdefault\mddefault\updefault
 %
-\SetMathAlphabet\cyrmathsf{bold}\cyrillicencoding
-  \sfdefault\bfdefault\updefault
-\SetMathAlphabet\cyrmathit{bold}\cyrillicencoding
-  \rmdefault\bfdefault\itdefault
-}
+%\SetMathAlphabet\cyrmathsf{bold}\cyrillicencoding
+%  \sfdefault\bfdefault\updefault
+%\SetMathAlphabet\cyrmathit{bold}\cyrillicencoding
+%  \rmdefault\bfdefault\itdefault
+%}
 %    \end{macrocode}
 %
-%    Some math functions in Ukrainian and Russian math books have other
-%    names: e.g., \texttt{sinh} in Russian is written as \texttt{sh} etc.
-%    So we define a number of new math operators.
+%    \Describe\sh{}
+%    \DescribeOther\ch{}%
+%    \DescribeOther\tg{}%
+%    \DescribeOther\ctg{}%
+%    \DescribeOther\arctg{}%
+%    \DescribeOther\arcctg{}%
+%    \DescribeOther\th{}%
+%    \DescribeOther\cth{}%
+%    \DescribeOther\cosec{}%
+%    We also define few math operator names according to Ukrainian typesetting
+%    traditions. Some math functions in Ukrainian math books have names
+%    different from English writings. For example, \texttt{sinh} in
+%    Ukrainian is called \texttt{sh}. Special consideration needs the
+%    macro |\th| that conflicts with the text symbol |\th|
+%    defined in Latin~1 encoding:
 %
-%    |\sinh|:
 %    \begin{macrocode}
 \def\sh{\mathop{\operator at font sh}\nolimits}
-%    \end{macrocode}
-%    |\cosh|:
-%    \begin{macrocode}
 \def\ch{\mathop{\operator at font ch}\nolimits}
-%    \end{macrocode}
-%    |\tan|:
-%    \begin{macrocode}
 \def\tg{\mathop{\operator at font tg}\nolimits}
-%    \end{macrocode}
-%    |\arctan|:
-%    \begin{macrocode}
+\def\ctg{\mathop{\operator at font ctg}\nolimits}
 \def\arctg{\mathop{\operator at font arctg}\nolimits}
-%    \end{macrocode}
-%    arcctg:
-%    \begin{macrocode}
 \def\arcctg{\mathop{\operator at font arcctg}\nolimits}
-%    \end{macrocode}
-%    The following macro conflicts with |\th| defined in Latin~1 encoding:
-%
-%    |\tanh|:
-% \changes{ukraineb-1.1k}{2004/05/21}{Change definition of \cs{th}
-%    only for this language}
-%    \begin{macrocode}
-\addto\extrasrussian{%
+\addto\extrasukrainian{%
   \babel at save{\th}%
   \let\ltx at th\th
   \def\th{\textormath{\ltx at th}%
                      {\mathop{\operator at font th}\nolimits}}%
   }
-%    \end{macrocode}
-%    |\cot|:
-%    \begin{macrocode}
-\def\ctg{\mathop{\operator at font ctg}\nolimits}
-%    \end{macrocode}
-%    |\coth|:
-%    \begin{macrocode}
 \def\cth{\mathop{\operator at font cth}\nolimits}
-%    \end{macrocode}
-%    |\csc|:
-%    \begin{macrocode}
 \def\cosec{\mathop{\operator at font cosec}\nolimits}
 %    \end{macrocode}
-%
-%    And finally some other Ukrainian and Russian mathematical symbols:
+%    \Describe\Prob{}%
+%    \DescribeOther\Variance{}%
+%    \DescribeOther\nsd{}%
+%    \DescribeOther\nsk{}%
+%    \DescribeOther\NSD{}%
+%    \DescribeOther\NSK{}%
+%    \DescribeOther\Proj{}%
+%    Finally, we define some rare Ukrainian mathematical symbols:
 %    \begin{macrocode}
 \def\Prob{\mathop{\kern\z@\mathsf{P}}\nolimits}
 \def\Variance{\mathop{\kern\z@\mathsf{D}}\nolimits}
-\def\nsd{\mathop{\cyrmathrm{\cyrn.\cyrs.\cyrd.}}\nolimits}
-\def\nsk{\mathop{\cyrmathrm{\cyrn.\cyrs.\cyrk.}}\nolimits}
-\def\NSD{\mathop{\cyrmathrm{\CYRN\CYRS\CYRD}}\nolimits}
-\def\NSK{\mathop{\cyrmathrm{\CYRN\CYRS\CYRK}}\nolimits}
-  \def\nod{\mathop{\cyrmathrm{\cyrn.\cyro.\cyrd.}}\nolimits}    % ??????
-  \def\nok{\mathop{\cyrmathrm{\cyrn.\cyro.\cyrk.}}\nolimits}    % ??????
-  \def\NOD{\mathop{\cyrmathrm{\CYRN\CYRO\CYRD}}\nolimits}       % ??????
-  \def\NOK{\mathop{\cyrmathrm{\CYRN\CYRO\CYRK}}\nolimits}       % ??????
-\def\Proj{\mathop{\cyrmathrm{\CYRP\cyrr}}\nolimits}
+\if at ukr@uni at ode
+  \def\nsd{\mathop{\mathrm{н.с.д.}}\nolimits}
+  \def\nsk{\mathop{\mathrm{н.с.к.}}\nolimits}
+  \def\NSD{\mathop{\mathrm{НСД}}\nolimits}
+  \def\NSK{\mathop{\mathrm{НСК}}\nolimits}
+  \def\Proj{\mathop{\mathrm{Пр}}\nolimits}
+\else
+  \def\nsd{\mathop{\textrm{\textup{\cyrn.\cyrs.\cyrd.}}}\nolimits}
+  \def\nsk{\mathop{\textrm{\textup{\cyrn.\cyrs.\cyrk.}}}\nolimits}
+  \def\NSD{\mathop{\textrm{\textup{\CYRN\CYRS\CYRD}}}\nolimits}
+  \def\NSK{\mathop{\textrm{\textup{\CYRN\CYRS\CYRK}}}\nolimits}
+  \def\Proj{\mathop{\textrm{\textup{\CYRP\cyrr}}}\nolimits}
+\fi
 %    \end{macrocode}
 %
-% This is for compatibility with older Ukrainian packages.
-%    \begin{macrocode}
-\DeclareRobustCommand{\No}{%
-   \ifmmode{\nfss at text{\textnumero}}\else\textnumero\fi}
-%    \end{macrocode}
+%    \subsection{Final settings}
 %
-%    The macro |\ldf at 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.
+%    The macro |\ldf at finish| does work needed
+%    at the end of each \file{.ldf} file. This
+%    includes resetting the category code of the \texttt{@}-sign,
+%    loading a local configuration file, and preparing the language
+%    to be activated at |\begin{document}| time.
 %
 %    \begin{macrocode}
 \ldf at finish{ukrainian}
-%</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
+%\iffalse
+%</code>
+%\fi
+% \CheckSum{1519}
+%\Finale

Modified: trunk/Master/texmf-dist/source/generic/babel-ukrainian/ukraineb.ins
===================================================================
--- trunk/Master/texmf-dist/source/generic/babel-ukrainian/ukraineb.ins	2017-06-07 21:22:48 UTC (rev 44520)
+++ trunk/Master/texmf-dist/source/generic/babel-ukrainian/ukraineb.ins	2017-06-07 21:23:07 UTC (rev 44521)
@@ -1,147 +1,83 @@
 %%
-%% This file will generate fast loadable files and documentation
-%% driver files from the doc files in this package when run through
-%% LaTeX or TeX.
+%% This is file `ukraineb.ins',
+%% generated with the docstrip utility.
 %%
-%% 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 Johannes Braams.
-%% 
-%% The list of all files belonging to the LaTeX base distribution 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.
+%% The original source files were:
 %%
-%% --------------- start of docstrip commands ------------------
-%%
-\def\filedate{1999/03/13}
-\def\batchfile{ukraineb.ins}
+%% ukraineb.dtx  (with options: `install')
+%% ----------------------------------------------------------------
+%% Ukrainian Language Support for the Babel package
+%% E-mail: sergiy.ponomarenko at gmailcom
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
 \input docstrip.tex
-
-{\ifx\generate\undefined
-\Msg{**********************************************}
-\Msg{*}
-\Msg{* This installation requires docstrip}
-\Msg{* version 2.3c or later.}
-\Msg{*}
-\Msg{* An older version of docstrip has been input}
-\Msg{*}
-\Msg{**********************************************}
-\errhelp{Move or rename old docstrip.tex.}
-\errmessage{Old docstrip in input path}
-\batchmode
-\csname @@end\endcsname
-\fi}
-
-\declarepreamble\mainpreamble
-This is a generated file.
-
-Copyright 1989-2008 Johannes L. Braams and any individual authors
-listed elsewhere in this file.  All rights reserved.
-
-This file was generated from file(s) 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 Johannes Braams.
-
-This file may only be distributed together with a copy of the Babel
-system. You may however distribute the Babel system without
-such generated files.
-
-The list of all files belonging to the Babel distribution 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.
+\keepsilent
+\askforoverwritefalse
+\preamble
+----------------------------------------------------------------
+Ukrainian Language Support for the Babel package
+E-mail: sergiy.ponomarenko at gmailcom
+Released under the LaTeX Project Public License v1.3c or later
+See http://www.latex-project.org/lppl.txt
+----------------------------------------------------------------
 \endpreamble
+\postamble
+----------------------------------------------------------------
+Copyright 2017 Sergiy М. Ponomarenko
+Copyright 2011-2017 Igor A. Kotelnikov.
+Copyright 2000 Aleksey Novodvorsky
+Copyright 1995-2008 Olga Lapko.
+Copyright 1989-2012 Johannes L. Braams.
 
-\declarepreamble\fdpreamble
+This file is a part of the Ukrainian-Babel package.
 
-This is a generated file.
-
-Copyright 1989-2008 Johannes L. Braams and any individual authors
-listed elsewhere in this file.  All rights reserved.
-
-This file was generated from file(s) 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.
+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:
 
-This work has the LPPL maintenance status "maintained".
+   http://www.latex-project.org/lppl.txt
 
-The Current Maintainer of this work is Johannes Braams.
+The package is "maintained" (as per LPPL maintenance status) by
+Sergiy М. Ponomarenko.
 
-This file may only be distributed together with a copy of the Babel
-system. You may however distribute the Babel system without
-such generated files.
-
-The list of all files belonging to the Babel distribution is
-given in the file `manifest.bbl'. See also `legal.bbl for additional
-information.
-
-In particular, permission is granted to customize the declarations in
-this file to serve the needs of your installation.
-
-However, NO PERMISSION is granted to distribute a modified version
-of this file under its original name.
-
-\endpreamble
-
-\usedir{tex/generic/babel}
-\keepsilent
- 
-\usepreamble\mainpreamble
-
-\generate{\file{ukraineb.ldf}{\from{ukraineb.dtx}{code}}}
- 
-\ifToplevel{
-\Msg{***********************************************************}
-\Msg{*}
-\Msg{* To finish the installation you have to move the following}
-\Msg{* files into a directory searched by TeX:}
-\Msg{*}
-\Msg{* \space\space All *.fd}
-\Msg{*}
-\Msg{* To produce the documentation run the files ending with}
-\Msg{* `.fdd' through LaTeX.}
-\Msg{*}
-\Msg{* Happy TeXing}
-\Msg{***********************************************************}
+The package consists of the file  ukraineb.dtx
+and the derived files             ukraineb.ins,
+                                  ukraineb.ldf,
+                                  ukraineb.pdf,
+                                  README.
+----------------------------------------------------------------
+\endpostamble
+\usedir{tex/generic/babel/contrib}
+\generate{
+  \file{\jobname.ldf}{\from{\jobname.dtx}{code}}
 }
- 
-\endinput
+\endbatchfile
+%% ----------------------------------------------------------------
+%% Copyright 2017 Sergiy М. Ponomarenko
+%% Copyright 2011-2017 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 Ukrainian-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
+%% Sergiy М. Ponomarenko.
+%% 
+%% The package consists of the file  ukraineb.dtx
+%% and the derived files             ukraineb.ins,
+%%                                   ukraineb.ldf,
+%%                                   ukraineb.pdf,
+%%                                   README.
+%% ----------------------------------------------------------------
+%%
+%% End of file `ukraineb.ins'.

Modified: trunk/Master/texmf-dist/tex/generic/babel-ukrainian/ukraineb.ldf
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel-ukrainian/ukraineb.ldf	2017-06-07 21:22:48 UTC (rev 44520)
+++ trunk/Master/texmf-dist/tex/generic/babel-ukrainian/ukraineb.ldf	2017-06-07 21:23:07 UTC (rev 44521)
@@ -5,137 +5,213 @@
 %% The original source files were:
 %%
 %% ukraineb.dtx  (with options: `code')
-%% This is a generated file.
-%% 
-%% Copyright 1989-2008 Johannes L. Braams and any individual authors
-%% listed elsewhere in this file.  All rights reserved.
-%% 
-%% This file was generated from file(s) 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 Johannes Braams.
-%% 
-%% This file may only be distributed together with a copy of the Babel
-%% system. You may however distribute the Babel system without
-%% such generated files.
-%% 
-%% The list of all files belonging to the Babel distribution 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.
-\ProvidesLanguage{ukraineb}
-        [2008/03/21 v1.1l Ukrainian support from the babel system]
-%% File `ukraineb.dtx'
-%% Babel package for LaTeX version 2e
-%% Copyright (C) 1989 - 2008
-%%           by Johannes Braams, TeXniek
-%% ukraineb Language Definition File
-%% Copyright (C) 1997 - 2008
-%%           by Andrij Shvaika ashv at icmp.lviv.ua
-%% derived from the Russianb Language Definition File
-%% Copyright (C) 1995 - 2008
-%%           by Olga Lapko cyrtug at mir.msk.su
-%%              Johannes Braams, TeXniek
-%% Please report errors to: J.L. Braams
-%%                          babel at braams.xs4all.nl
+%% ----------------------------------------------------------------
+%% Ukrainian Language Support for the Babel package
+%% E-mail: sergiy.ponomarenko at gmailcom
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesLanguage{ukraineb}[2017/06/06 1.3h Ukrainian support for the Babel system]
 \LdfInit{ukrainian}{captionsukrainian}
+\ifdefined\if at ukr@uni at ode
+  \PackageError{babel}{if at ukr@uni at ode already defined.\MessageBreak
+    Please contact author of ukraineb.ldf}
+  \relax
+\fi
+\newif\if at ukr@uni at ode
+\ifdefined\luatexversion \@ukr at uni@odetrue \else
+\ifdefined\XeTeXrevision \@ukr at uni@odetrue \fi\fi
 \ifx\l at ukrainian\@undefined
   \@nopatterns{Ukrainian}
   \adddialect\l at ukrainian0
 \fi
-\let\latinencoding\cf at encoding
-\def\reserved at a#1#2{%
-   \edef\reserved at b{#1}%
-   \edef\reserved at c{#2}%
-   \ifx\reserved at b\reserved at c
-     \let\cyrillicencoding\reserved at c
-   \fi}
-\def\cdp at elt#1#2#3#4{%
-   \reserved at a{#1}{OT2}%
-   \reserved at a{#1}{LWN}%
-   \reserved at a{#1}{LCY}%
-   \reserved at a{#1}{X2}%
-   \reserved at a{#1}{T2C}%
-   \reserved at a{#1}{T2B}%
-   \reserved at a{#1}{T2A}}
-\cdp at list
-\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
-  \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.}%
+\def\@setcyrillicencoding{%
+  \def\sce at a##1##2{%
+    \edef\sce at b{##1}%
+    \edef\sce at c{##2}%
+    \ifx\sce at b\sce at c
+      \let\cyrillicencoding\sce at c
+    \fi}%
+  \def\cdp at elt##1##2##3##4{%
+    \sce at a{##1}{OT2}%
+    \sce at a{##1}{LCY}%
+    \sce at a{##1}{X2}%
+    \sce at a{##1}{T2C}%
+    \sce at a{##1}{T2B}%
+    \sce at a{##1}{T2A}%
+    \if at ukr@uni at ode
+      \sce at a{##1}{EU1}%
+      \sce at a{##1}{EU2}%
+    \fi}%
+  \cdp at list
+}
+\@setcyrillicencoding
+\@onlypreamble\@setcyrillicencoding
+\@onlypreamble\sce at a
+\@onlypreamble\sce at b
+\@onlypreamble\sce at c
+\ifdefined\cyrillicencoding
+\else
+  \if at ukr@uni at ode
+    \ifdefined\XeTeXrevision
+      \edef\cyrillicencoding{EU1}
+    \else\ifdefined\luatexversion
+      \edef\cyrillicencoding{EU2}
+    \fi\fi
   \else
-    \lowercase
-      \expandafter{\expandafter\input\cyrillicencoding enc.def\relax}%
+    \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
+    }%
+  \lowercase\expandafter{\expandafter\input\cyrillicencoding enc.def\relax}%
+  \AtBeginDocument{\@setcyrillicencoding}
 \fi
-\DeclareRobustCommand{\Ukrainian}{%
+\DeclareRobustCommand{\Ukrainian}{\selectlanguage{\ukrainian}}
+\DeclareRobustCommand{\cyrillictext}{%
   \fontencoding\cyrillicencoding\selectfont
   \let\encodingdefault\cyrillicencoding
   \expandafter\set at hyphenmins\ukrainianhyphenmins
   \language\l at ukrainian}%
-\DeclareRobustCommand{\English}{%
-  \fontencoding\latinencoding\selectfont
-  \let\encodingdefault\latinencoding
-  \expandafter\set at hyphenmins\englishhyphenmins
-  \language\l at english}%
-\let\Ukr\Ukrainian
-\let\Eng\English
-\let\cyrillictext\Ukrainian
-\let\cyr\Ukrainian
+\let\cyr\cyrillictext
+%%\DeclareRobustCommand{\English}{%
+%%  \fontencoding\latinencoding\selectfont
+%%  \let\encodingdefault\latinencoding
+%%  \expandafter\set at hyphenmins\englishhyphenmins
+%%  \language\l at english}%
+%%\let\Eng\English
 \expandafter\ifx\csname T at X2\endcsname\relax\else
-  \def\@alph#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#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}}%
   \DeclareTextSymbolDefault{\AA}{OT1}
   \DeclareTextSymbolDefault{\aa}{OT1}
   \DeclareTextCommand{\aa}{OT1}{\r a}
   \DeclareTextCommand{\AA}{OT1}{\r A}
 \fi
-\@ifpackageloaded{inputenc}{}{%
-  \def\reserved at a{LWN}%
-  \ifx\reserved at a\cyrillicencoding\else
+\DeclareTextFontCommand{\textcyrillic}{\cyrillictext}
+\@ifpackageloaded{inputenc}{%
+ \if at ukr@uni at ode
+   \PackageWarning{babel}{inputenc should not be used with LuaTeX or XeTeX}
+ \fi
+}{%
+  %\def\reserved at a{LWN}%
+  %\ifx\reserved at a\cyrillicencoding\else
     \def\reserved at a{OT2}%
     \ifx\reserved at a\cyrillicencoding\else
-      \PackageWarning{babel}%
-        {No input encoding specified for Ukrainian language}
-  \fi\fi}
-\let\lat\latintext
-\DeclareTextFontCommand{\textcyrillic}{\cyrillictext}
+       \def\reserved at a{EU1}%
+       \ifx\reserved at a\cyrillicencoding\else
+          \def\reserved at a{EU2}%
+          \ifx\reserved at a\cyrillicencoding\else
+             \PackageWarning{babel}%
+                {No input encoding specified for Ukrainian language}
+    \fi\fi\fi
+  %\fi
+}
+\initiate at active@char{"}
+\begingroup \catcode`\"12
+\def\reserved at a{\endgroup
+  \def\@SS{\mathchar"7019 }
+  \def\dq{"}}
+\reserved at a
+\declare at shorthand{ukrainian}{"`}{\quotedblbase}
+\declare at shorthand{ukrainian}{"'}{\textquotedblleft}
+\declare at shorthand{ukrainian}{"<}{\guillemotleft}
+\declare at shorthand{ukrainian}{">}{\guillemotright}
+\declare at shorthand{ukrainian}{""}{\hskip\z at skip}
+\declare at shorthand{ukrainian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}
+\declare at shorthand{ukrainian}{"=}{\nobreak-\hskip\z at skip}
+\declare at shorthand{ukrainian}{"|}{%
+  \textormath{\nobreak\discretionary{-}{}{\kern.03em}\allowhyphens}{}}
+\declare at shorthand{ukrainian}{"-}{%
+  \def\ukrainian at sh@tmp{%
+    \if\ukrainian at sh@next-\expandafter\ukrainian at sh@emdash
+    \else\expandafter\ukrainian at sh@hyphen\fi}%
+  \futurelet\ukrainian at sh@next\ukrainian at sh@tmp}
+\def\ukrainian at sh@hyphen{\nobreak\-\bbl at allowhyphens}
+\def\ukrainian at 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 at skip\ignorespaces}%
+\def\@Ccdash{\leavevmode
+ \nobreak\cyrdash\nobreak\hskip.35em\ignorespaces}%
+\ProvideTextCommandDefault{\cyrdash}{\iflanguage{ukrainian}%
+    {\hbox to.8em{--\hss--}}{\textemdash}}
+\declare at shorthand{ukrainian}{",}{\nobreak\hskip.2em\ignorespaces}
+\if at ukr@uni at ode
+  %\captionsukrainian
+  \addto\captionsukrainian{%
+    \def\prefacename{Вступ}%   [babel]
+    \def\refname{Література}% [only article]
+    \def\abstractname{Анотація}%    [only article, report]
+    \def\bibname{Бібліоґрафія}%        [only book, report]
+    \def\chaptername{Глава}%         [only book, report]
+    \def\appendixname{Додаток}%
+    \def\contentsname{Зміст}%
+    \let\tocname=\contentsname
+    \def\listfigurename{Перелік ілюстрацій}%
+    \def\listtablename{Перелік таблиць}%
+    \def\indexname{Предметний покажчик}%
+    \def\authorname{Іменний покажчик}%
+    \def\figurename{Рис.}%
+    \def\tablename{Таблиця}%
+    \def\partname{Частина}%
+    \def\enclname{вкл.}%
+    \def\ccname{вих.}%
+    \def\headtoname{вх.}%
+    \def\pagename{с.}%               [letter]
+    \def\seename{див.}%
+    \def\alsoname{див.\ також}%
+    \def\proofname{Доведення}%  [amsthm]
+    \def\glossaryname{Словник термінів}%
+    \def\acronymname{Абревіатури}%  [glossaries] {Acronyms}
+    \def\lstlistingname{Лістинг}%    [listings]  (the environment) {Listing}
+    \def\lstlistlistingname{Лістинги}% [listings]  (the "List of") {Listings}
+    \def\notesname{Нотатки}%         [endnotes] {Notes}
+  }%
+  %% =========================================
+  %% nomencl
+  \ifdefined\nomname
+    \addto\captionsukrainian{%
+        \def\nomname{Позначення}%
+        \def\eqdeclaration#1{, див.\nobreakspace(#1)}%
+        \def\pagedeclaration#1{, стор.\nobreakspace#1}%
+    }%
+  \fi
+  %% =========================================
+  %% RevTeX4 & RevTeX4-1
+  %%\@ifclassloaded{revtex4-1}
+  %%{<true code>}
+  %%{<false coode>}%
+  %\@ifclassloaded{revtex4-1}
+  %{%
+  \ifnum\@ifclassloaded{revtex4}{1}{\@ifclassloaded{revtex4-1}{1}{0}}>0
+    \addto\captionsukrainian{%
+    \def\lofname{\listfigurename}
+    \def\lotname{\listtablename}
+    \def\figuresname{Рисунки}%{Figures}%
+    \def\tablesname{Таблиці}%{Tables}%
+    \def\appendixesname{Додатки}%{Appendixes}%
+    \def\acknowledgmentsname{Подяки}%{Acknowledgments}
+    \def\andname{та}%{and}
+    \def\@pacs at name{PACS коди: }%{PACS numbers: }%
+    \def\@keys at name{Ключові слова: }%{Keywords: }%
+    \def\Dated at name{Дата: }%{Dated: }%
+    \def\Received at name{Отримано }%{Received }%
+    \def\Revised at name{Виправлена версія }%{Revised }%
+    \def\Accepted at name{Прийнято }%{Accepted }%
+    \def\Published at name{Опубліковано }%{Published }%
+    }%
+  %}{}%
+  \fi
+\else
 \addto\captionsukrainian{%
   \def\prefacename{{\cyr\CYRV\cyrs\cyrt\cyru\cyrp}}%
   \def\refname{%
@@ -147,11 +223,13 @@
   \def\chaptername{{\cyr\CYRR\cyro\cyrz\cyrd\cyrii\cyrl}}%
   \def\appendixname{{\cyr\CYRD\cyro\cyrd\cyra\cyrt\cyro\cyrk}}%
   \def\contentsname{{\cyr\CYRZ\cyrm\cyrii\cyrs\cyrt}}%
+  \let\tocname=\contentsname
   \def\listfigurename{{\cyr\CYRP\cyre\cyrr\cyre\cyrl\cyrii\cyrk
          \ \cyrii\cyrl\cyryu\cyrs\cyrt\cyrr\cyra\cyrc\cyrii\cyrishrt}}%
   \def\listtablename{{\cyr\CYRP\cyre\cyrr\cyre\cyrl\cyrii\cyrk
          \ \cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyrsftsn}}%
-  \def\indexname{{\cyr\CYRP\cyro\cyrk\cyra\cyrzh\cyrch\cyri\cyrk}}%
+  \def\indexname{{\cyr\CYRP\cyrr\cyre\cyrd\cyrm\cyre\cyrt\cyrn\cyri\cyrishrt
+  \ \cyrp\cyro\cyrk\cyra\cyrzh\cyrch\cyri\cyrk}}%
   \def\authorname{{\cyr\CYRII\cyrm\cyre\cyrn\cyrn\cyri\cyrishrt
          \ \cyrp\cyro\cyrk\cyra\cyrzh\cyrch\cyri\cyrk}}%
   \def\figurename{{\cyr\CYRR\cyri\cyrs.}}%
@@ -159,7 +237,7 @@
   \def\partname{{\cyr\CYRCH\cyra\cyrs\cyrt\cyri\cyrn\cyra}}%
   \def\enclname{{\cyr\cyrv\cyrk\cyrl\cyra\cyrd\cyrk\cyra}}%
   \def\ccname{{\cyr\cyrk\cyro\cyrp\cyrii\cyrya}}%
-  \def\headtoname{{\cyr\CYRD\cyro}}%
+  \def\headtoname{{\cyr\cyrv\cyrh.}}%
   \def\pagename{{\cyr\cyrs.}}%
   \def\seename{{\cyr\cyrd\cyri\cyrv.}}%
   \def\alsoname{{\cyr\cyrd\cyri\cyrv.\ \cyrt\cyra\cyrk\cyro\cyrzh}}
@@ -166,7 +244,48 @@
   \def\proofname{{\cyr\CYRD\cyro\cyrv\cyre\cyrd\cyre\cyrn\cyrn\cyrya}}%
   \def\glossaryname{{\cyr\CYRS\cyrl\cyro\cyrv\cyrn\cyri\cyrk\ %
                    \cyrt\cyre\cyrr\cyrm\cyrii\cyrn\cyrii\cyrv}}%
-  }
+  \def\nomname{\CYRP\cyro\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
+  \def\notesname{\CYRN\cyro\cyrt\cyra\cyrt\cyrk\cyri}%
+  }%
+  %% =========================================
+  %% RevTeX4 & RevTeX4-1
+  \ifnum \@ifclassloaded{revtex4}{1}{\@ifclassloaded{revtex4-1}{1}{0}}>0
+    \addto\captionsukrainian{%
+    \def\lofname{\listfigurename}
+    \def\lotname{\listtablename}
+    \def\figuresname{\CYRR\cyri\cyrs\cyru\cyrn\cyrk\cyri}%{Figures}%
+    \def\tablesname{\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyrii}%{Tables}%
+    \def\appendixesname{\CYRD\cyro\cyrd\cyra\cyrt\cyrk\cyri}%{Appendixes}%
+    \def\acknowledgmentsname{\CYRP\cyro\cyrd\cyrya\cyrk\cyri}%{Acknowledgments}
+    \def\andname{\cyrt\cyra}%{and}
+    \def\@pacs at name{PACS \cyrk\cyro\cyrd\cyri: }%{PACS numbers: }%
+    \def\@keys at name{\CYRK\cyrl\cyryu\cyrch\cyro\cyrv\cyrii
+    \ \cyrs\cyrl\cyro\cyrv\cyra: }%{Keywords: }%
+    \def\Dated at name{\CYRD\cyra\cyrt\cyra: }%{Dated: }%
+    \def\Received at name{\CYRO\cyrt\cyrr\cyri\cyrm\cyra\cyrn\cyro }%{Received }%
+    \def\Revised at name{\CYRV\cyri\cyrp\cyrr\cyra\cyrv\cyrl\cyre\cyrn\cyro }%{Revised }%
+    \def\Accepted at name{\CYRP\cyrr\cyri\cyrishrt\cyrn\cyrya\cyrt\cyro }%{Accepted }%
+    \def\Published at name{\CYRO\cyrp\cyru\cyrb\cyrl\cyrii\cyrk\cyro\cyrv\cyra\cyrn\cyro }%{Published }%
+    }%
+  \fi
+\fi
+\if at ukr@uni at ode
+  \addto\dateukrainian{%
+   \def\today{\number\day~\ifcase\month\or
+    січня\or
+    лютого\or
+    березня\or
+    квітня\or
+    травня\or
+    червня\or
+    липня\or
+    серпня\or
+    вересня\or
+    жовтня\or
+    листопада\or
+    грудня\fi
+    \space \number\year~р.}}
+\else
 \def\dateukrainian{%
   \def\today{\number\day~\ifcase\month\or
     \cyrs\cyrii\cyrch\cyrn\cyrya\or
@@ -182,140 +301,107 @@
     \cyrl\cyri\cyrs\cyrt\cyro\cyrp\cyra\cyrd\cyra\or
     \cyrg\cyrr\cyru\cyrd\cyrn\cyrya\fi
     \space\number\year~\cyrr.}}
+\fi
+\providehyphenmins{\CurrentOption}{\tw@\tw@}
+\providehyphenmins{ukrainian}{\tw@\tw@}
 \addto\extrasukrainian{\cyrillictext}
 \addto\noextrasukrainian{\latintext}
-\addto\extrasukrainian{\lccode`\'=`\'}
-\addto\noextrasukrainian{\lccode`\'=0}
-\initiate at active@char{"}
 \addto\extrasukrainian{\languageshorthands{ukrainian}}
-\addto\extrasukrainian{%
-  \bbl at activate{"}}
-\addto\noextrasukrainian{%
-  \bbl at deactivate{"}}
-\begingroup \catcode`\"12
-\def\reserved at a{\endgroup
-  \def\@SS{\mathchar"7019 }
-  \def\dq{"}}
-\reserved at a
-\declare at shorthand{ukrainian}{"`}{\glqq}
-\declare at shorthand{ukrainian}{"'}{\grqq}
-\declare at shorthand{ukrainian}{"<}{\flqq}
-\declare at shorthand{ukrainian}{">}{\frqq}
-\declare at shorthand{ukrainian}{""}{\hskip\z at skip}
-\declare at shorthand{ukrainian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}
-\declare at shorthand{ukrainian}{"=}{\nobreak-\hskip\z at skip}
-\declare at shorthand{ukrainian}{"|}{%
-  \textormath{\nobreak\discretionary{-}{}{\kern.03em}%
-              \allowhyphens}{}}
-\declare at shorthand{ukrainian}{"-}{%
-  \def\ukrainian at sh@tmp{%
-    \if\ukrainian at sh@next-\expandafter\ukrainian at sh@emdash
-    \else\expandafter\ukrainian at sh@hyphen\fi
-  }%
-  \futurelet\ukrainian at sh@next\ukrainian at sh@tmp}
-\def\ukrainian at sh@hyphen{%
-  \nobreak\-\bbl at allowhyphens}
-\def\ukrainian at 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 at skip\ignorespaces}%
-\def\@Ccdash{\leavevmode
- \nobreak\cyrdash\nobreak\hskip.35em\ignorespaces}%
-\ifx\cyrdash\undefined
-  \def\cyrdash{\hbox to.8em{--\hss--}}
+\addto\extrasukrainian{\bbl at activate{"}}
+\addto\noextrasukrainian{\bbl at deactivate{"}}
+\addto\extrasukrainian{\bbl at frenchspacing}
+\addto\noextrasukrainian{\bbl at nonfrenchspacing}
+\def\Asbuk#1{\expandafter\ukrainian at Alph\csname c@#1\endcsname}
+\if at ukr@uni at ode
+  \def\ukrainian at 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 Щ\or Ю\or Я\else\@ctrerr\fi}
+\else
+  \def\ukrainian at Alph#1{\ifcase#1\or
+    \CYRA\or\CYRB\or\CYRV\or\CYRG\or\CYRD\or\CYRE\or\CYRYE\or\CYRZH\or
+    \CYRZ\or\CYRI\or\CYRII\or\CYRYI\or\CYRK\or\CYRL\or\CYRM\or\CYRN\or\CYRO\or
+    \CYRP\or\CYRR\or\CYRS\or\CYRT\or\CYRU\or\CYRF\or\CYRH\or
+    \CYRC\or\CYRCH\or\CYRSH\or\CYRSHCH\or\CYRYU\or
+    \CYRYA\else\@ctrerr\fi}
 \fi
-\declare at shorthand{ukrainian}{",}{\nobreak\hskip.2em\ignorespaces}
-\def\mdqon{\bbl at activate{"}}
-\def\mdqoff{\bbl at deactivate{"}}
-\providehyphenmins{\CurrentOption}{\tw@\tw@}
-\ifx\englishhyphenmins\undefined
-  \def\englishhyphenmins{\tw@\thr@@}
+\def\asbuk#1{\expandafter\ukrainian at alph\csname c@#1\endcsname}
+\if at ukr@uni at ode
+  \def\ukrainian at 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 щ\or ю\or я\else\@ctrerr\fi}
+\else
+  \def\ukrainian at alph#1{\ifcase#1\or
+    \cyra\or\cyrb\or\cyrv\or\cyrg\or\cyrd\or\cyre\or\cyrye\or\cyrzh\or
+    \cyrz\or\cyri\or\cyrii\or\cyryi\or\cyrk\or\cyrl\or\cyrm\or\cyrn\or\cyro\or
+    \cyrp\or\cyrr\or\cyrs\or\cyrt\or\cyru\or\cyrf\or\cyrh\or
+    \cyrc\or\cyrch\or\cyrsh\or\cyrshch\or\cyryu\or
+    \cyrya\else\@ctrerr\fi}
 \fi
-\addto\extrasukrainian{\bbl at frenchspacing}
-\addto\noextrasukrainian{\bbl at nonfrenchspacing}
-\def\Asbuk#1{\expandafter\@Asbuk\csname c@#1\endcsname}
-\def\@Asbuk#1{\ifcase#1\or
-  \CYRA\or\CYRB\or\CYRV\or\CYRG\or\CYRD\or\CYRE\or\CYRIE\or
-  \CYRZH\or\CYRZ\or\CYRI\or\CYRII\or\CYRYI\or\CYRISHRT\or
-  \CYRK\or\CYRL\or\CYRM\or\CYRN\or\CYRO\or\CYRP\or\CYRR\or
-  \CYRS\or\CYRT\or\CYRU\or\CYRF\or\CYRH\or\CYRC\or\CYRCH\or
-  \CYRSH\or\CYRSHCH\or\CYRYU\or\CYRYA\else\@ctrerr\fi}
-\def\asbuk#1{\expandafter\@asbuk\csname c@#1\endcsname}
-\def\@asbuk#1{\ifcase#1\or
-  \cyra\or\cyrb\or\cyrv\or\cyrg\or\cyrd\or\cyre\or\cyrie\or
-  \cyrzh\or\cyrz\or\cyri\or\cyrii\or\cyryi\or\cyrishrt\or
-  \cyrk\or\cyrl\or\cyrm\or\cyrn\or\cyro\or\cyrp\or\cyrr\or
-  \cyrs\or\cyrt\or\cyru\or\cyrf\or\cyrh\or\cyrc\or\cyrch\or
-  \cyrsh\or\cyrshch\or\cyryu\or\cyrya\else\@ctrerr\fi}
-\@ifundefined{sym\cyrillicencoding letters}{}{%
-\SetSymbolFont{\cyrillicencoding letters}{bold}\cyrillicencoding
-  \rmdefault\bfdefault\updefault
-\DeclareSymbolFontAlphabet\cyrmathrm{\cyrillicencoding letters}
-\DeclareMathAlphabet\cyrmathbf\cyrillicencoding
-  \rmdefault\bfdefault\updefault
-\DeclareMathAlphabet\cyrmathsf\cyrillicencoding
-  \sfdefault\mddefault\updefault
-\DeclareMathAlphabet\cyrmathit\cyrillicencoding
-  \rmdefault\mddefault\itdefault
-\DeclareMathAlphabet\cyrmathtt\cyrillicencoding
-  \ttdefault\mddefault\updefault
-\SetMathAlphabet\cyrmathsf{bold}\cyrillicencoding
-  \sfdefault\bfdefault\updefault
-\SetMathAlphabet\cyrmathit{bold}\cyrillicencoding
-  \rmdefault\bfdefault\itdefault
+\bbl at declare@ttribute{ukrainian}{ancient}{%
+ \PackageInfo{babel}{ukrainian attribute set to ancient}%
+ \let\captionsukrainian=\captionsukrainian at ancient
+ \let\dateukrainian=\dateukrainian at ancient
 }
+\@onlypreamble\captionsukrainian at ancient
+\@onlypreamble\dateukrainian at ancient
 \def\sh{\mathop{\operator at font sh}\nolimits}
 \def\ch{\mathop{\operator at font ch}\nolimits}
 \def\tg{\mathop{\operator at font tg}\nolimits}
+\def\ctg{\mathop{\operator at font ctg}\nolimits}
 \def\arctg{\mathop{\operator at font arctg}\nolimits}
 \def\arcctg{\mathop{\operator at font arcctg}\nolimits}
-\addto\extrasrussian{%
+\addto\extrasukrainian{%
   \babel at save{\th}%
   \let\ltx at th\th
   \def\th{\textormath{\ltx at th}%
                      {\mathop{\operator at font th}\nolimits}}%
   }
-\def\ctg{\mathop{\operator at font ctg}\nolimits}
 \def\cth{\mathop{\operator at font cth}\nolimits}
 \def\cosec{\mathop{\operator at font cosec}\nolimits}
 \def\Prob{\mathop{\kern\z@\mathsf{P}}\nolimits}
 \def\Variance{\mathop{\kern\z@\mathsf{D}}\nolimits}
-\def\nsd{\mathop{\cyrmathrm{\cyrn.\cyrs.\cyrd.}}\nolimits}
-\def\nsk{\mathop{\cyrmathrm{\cyrn.\cyrs.\cyrk.}}\nolimits}
-\def\NSD{\mathop{\cyrmathrm{\CYRN\CYRS\CYRD}}\nolimits}
-\def\NSK{\mathop{\cyrmathrm{\CYRN\CYRS\CYRK}}\nolimits}
-  \def\nod{\mathop{\cyrmathrm{\cyrn.\cyro.\cyrd.}}\nolimits}    % ??????
-  \def\nok{\mathop{\cyrmathrm{\cyrn.\cyro.\cyrk.}}\nolimits}    % ??????
-  \def\NOD{\mathop{\cyrmathrm{\CYRN\CYRO\CYRD}}\nolimits}       % ??????
-  \def\NOK{\mathop{\cyrmathrm{\CYRN\CYRO\CYRK}}\nolimits}       % ??????
-\def\Proj{\mathop{\cyrmathrm{\CYRP\cyrr}}\nolimits}
-\DeclareRobustCommand{\No}{%
-   \ifmmode{\nfss at text{\textnumero}}\else\textnumero\fi}
+\if at ukr@uni at ode
+  \def\nsd{\mathop{\mathrm{н.с.д.}}\nolimits}
+  \def\nsk{\mathop{\mathrm{н.с.к.}}\nolimits}
+  \def\NSD{\mathop{\mathrm{НСД}}\nolimits}
+  \def\NSK{\mathop{\mathrm{НСК}}\nolimits}
+  \def\Proj{\mathop{\mathrm{Пр}}\nolimits}
+\else
+  \def\nsd{\mathop{\textrm{\textup{\cyrn.\cyrs.\cyrd.}}}\nolimits}
+  \def\nsk{\mathop{\textrm{\textup{\cyrn.\cyrs.\cyrk.}}}\nolimits}
+  \def\NSD{\mathop{\textrm{\textup{\CYRN\CYRS\CYRD}}}\nolimits}
+  \def\NSK{\mathop{\textrm{\textup{\CYRN\CYRS\CYRK}}}\nolimits}
+  \def\Proj{\mathop{\textrm{\textup{\CYRP\cyrr}}}\nolimits}
+\fi
 \ldf at finish{ukrainian}
+%% ----------------------------------------------------------------
+%% Copyright 2017 Sergiy М. Ponomarenko
+%% Copyright 2011-2017 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 Ukrainian-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
+%% Sergiy М. Ponomarenko.
+%% 
+%% The package consists of the file  ukraineb.dtx
+%% and the derived files             ukraineb.ins,
+%%                                   ukraineb.ldf,
+%%                                   ukraineb.pdf,
+%%                                   README.
+%% ----------------------------------------------------------------
 %%
-%% \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
-%%
 %% End of file `ukraineb.ldf'.



More information about the tex-live-commits mailing list