summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx')
-rw-r--r--macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx129
1 files changed, 80 insertions, 49 deletions
diff --git a/macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx b/macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx
index 2a33327ee9..cca22b76c0 100644
--- a/macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx
+++ b/macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%Copyright 2019 Uroš Stefanović,
+%Copyright 2019--2021 Uroš Stefanović,
%2002--2019 Filip Brčić
%All rights reserved.
%
@@ -32,7 +32,7 @@
%<code>\ProvidesLanguage{serbianc}
%\fi
%\ProvidesFile{serbianc.dtx}
- [2019/12/15 3.0a Serbian Cyrillic support for the Babel system]
+ [2021/04/10 3.1 Serbian Cyrillic support for the Babel system]
%\iffalse
%% File `serbianc.dtx'
%
@@ -98,7 +98,13 @@
% (used when after the date is the punctuation mark, such as comma).
% Alternatively, the commands |\todayRoman| and |\todayRoman*| print the current date using Roman numerals for months.
%
-% The alphabetical enumerations in texts use the Cyrillic alphabet and alphabetic order.
+% The alphabetical enumerations in texts use the Cyrillic alphabet and alphabetic order (all 30 letters of the Serbian language are used).
+% Also, the Serbian language allows enumeration with the Latin alphabet.
+% If the Latin alphabet is used in the enumeration the letters q, w, x and y are omitted by the rules of the Serbian language
+% (22 letters are used in that case).
+% However, if the user wants to use the English alphabet for the enumeration (26 letters), this option is also available.
+% One can manually switch the enumeration alphabet with the commands |\enumCyr|, |\enumLat| and |\enumEng|.
+% This commands can be used after the |\begin{document}| when the \Lopt{serbianc} language is active.
% In principle, enumerations are a matter for class and style designers but the same can be
% said also about things, other than enumerations, such as names of sections and bibliography lists.
%
@@ -471,8 +477,8 @@
% \end{macrocode}
%
% The Serbian hyphenation patterns can be used with |\lefthyphenmin| and
-% |\righthyphenmin| set to 2. (Actually, the “official” definition allows even one character for |lefthyphen|,
-% but it is recommended to use value two for better results.)
+% |\righthyphenmin| set to~2. (Actually, the “official” definition allows even one character for |lefthyphen|,
+% but it is recommended to use the value two for the better results.)
%
% \begin{macrocode}
\providehyphenmins{\CurrentOption}{\tw@\tw@}
@@ -514,46 +520,68 @@
% \end{macrocode}
%
% We redefine the macro |\Alph|, which now produces (uppercase) Cyrillic letters instead of Latin
-% ones when Serbian is switched on.
+% ones when Serbian is switched on. Also we will define Serbian Latin and English alphabets so
+% the user can choose which alphabet to use through the commands |\enumCyr|, |\enumLat| and |\enumEng|
+% (or even to switch from one enumeration to another).
%
% \begin{macrocode}
-\addto\extrasserbianc{%
-\babel@save\@Alph
-\if@srbc@uni@ode
- \def\@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\@Alph#1{\ifcase#1\or
- \CYRA\or\CYRB\or\CYRV\or\CYRG\or\CYRD\or\CYRDJE\or\CYRE\or\CYRZH\or\CYRZ\or
- \CYRI\or\CYRJE\or\CYRK\or\CYRL\or\CYRLJE\or\CYRM\or\CYRN\or\CYRNJE\or\CYRO\or
- \CYRP\or\CYRR\or\CYRS\or\CYRT\or\CYRTSHE\or\CYRU\or\CYRF\or\CYRH\or\CYRC\or
- \CYRCH\or\CYRDZHE\or\CYRSH\else\@ctrerr\fi}%
-\fi
-}
+\newcount\srbc@lettering \srbc@lettering=\z@
+\addto\extrasserbianc{\babel@save\@Alph \let\@Alph\srbc@Alph}
+\def\srbc@Alph#1{%
+\ifcase\srbc@lettering
+ \if@srbc@uni@ode
+ \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
+ \ifcase#1\or\CYRA\or\CYRB\or\CYRV\or\CYRG\or\CYRD\or\CYRDJE\or
+ \CYRE\or\CYRZH\or\CYRZ\or\CYRI\or\CYRJE\or\CYRK\or\CYRL\or
+ \CYRLJE\or\CYRM\or\CYRN\or\CYRNJE\or\CYRO\or\CYRP\or\CYRR\or
+ \CYRS\or\CYRT\or\CYRTSHE\or\CYRU\or\CYRF\or\CYRH\or\CYRC\or
+ \CYRCH\or\CYRDZHE\or\CYRSH\else\@ctrerr\fi
+ \fi
+\or
+ \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 R\or S\or T\or U\or V\or
+ Z\else\@ctrerr\fi
+\or
+ \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
+\fi}%
% \end{macrocode}
%
-% The macro |\alph| produces lowercase Cyrillic letters.
+% The same thing will be done with the macro |\alph|.
%
% \begin{macrocode}
+\addto\extrasserbianc{\babel@save\@alph \let\@alph\srbc@alph}
+\def\srbc@alph#1{%
+\ifcase\srbc@lettering
+ \if@srbc@uni@ode
+ \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
+ \ifcase#1\or\cyra\or\cyrb\or\cyrv\or\cyrg\or\cyrd\or\cyrdje\or
+ \cyre\or\cyrzh\or\cyrz\or\cyri\or\cyrje\or\cyrk\or\cyrl\or
+ \cyrlje\or\cyrm\or\cyrn\or\cyrnje\or\cyro\or\cyrp\or\cyrr\or
+ \cyrs\or\cyrt\or\cyrtshe\or\cyru\or\cyrf\or\cyrh\or\cyrc\or
+ \cyrch\or\cyrdzhe\or\cyrsh\else\@ctrerr\fi
+ \fi
+\or
+ \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 r\or s\or t\or u\or v\or
+ z\else\@ctrerr\fi
+\or
+ \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
+\fi}%
\addto\extrasserbianc{%
-\babel@save\@alph
-\if@srbc@uni@ode
- \def\@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\@alph#1{\ifcase#1\or
- \cyra\or\cyrb\or\cyrv\or\cyrg\or\cyrd\or\cyrdje\or\cyre\or\cyrzh\or\cyrz\or
- \cyri\or\cyrje\or\cyrk\or\cyrl\or\cyrlje\or\cyrm\or\cyrn\or\cyrnje\or\cyro\or
- \cyrp\or\cyrr\or\cyrs\or\cyrt\or\cyrtshe\or\cyru\or\cyrf\or\cyrh\or\cyrc\or
- \cyrch\or\cyrdzhe\or\cyrsh\else\@ctrerr\fi}%
-\fi
-}
+ \babel@save\enumEng \def\enumEng{\srbc@lettering=\tw@}
+ \babel@save\enumLat \def\enumLat{\srbc@lettering=\@ne}
+ \babel@save\enumCyr \def\enumCyr{\srbc@lettering=\z@}
+}%
% \end{macrocode}
%
% An |ijekav| attribute changes the default behavior and activates an
@@ -609,17 +637,20 @@
\def\Prob{\mathop{\kern\z@\mathsf{P}}\nolimits}
\def\Expect{\mathop{\kern\z@\mathsf{E}}\nolimits}
\def\Variance{\mathop{\kern\z@\mathsf{D}}\nolimits}
-\if@srbc@uni@ode
- \def\nzs{\mathop{\mathrm{нзс}}\nolimits}
- \def\nzd{\mathop{\mathrm{нзд}}\nolimits}
- \def\NZS{\mathop{\mathrm{НЗС}}\nolimits}
- \def\NZD{\mathop{\mathrm{НЗД}}\nolimits}
-\else
- \def\nzs{\mathop{\textnormal{\cyrn\cyrz\cyrs}}\nolimits}
- \def\nzd{\mathop{\textnormal{\cyrn\cyrz\cyrd}}\nolimits}
- \def\NZS{\mathop{\textnormal{\CYRN\CYRZ\CYRS}}\nolimits}
- \def\NZD{\mathop{\textnormal{\CYRN\CYRZ\CYRD}}\nolimits}
-\fi
+\addto\extrasserbianc{%
+ \babel@save\nzs \babel@save\nzd
+ \babel@save\NZS \babel@save\NZD
+ \if@srbc@uni@ode
+ \def\nzs{\mathop{\mathrm{нзс}}\nolimits}
+ \def\nzd{\mathop{\mathrm{нзд}}\nolimits}
+ \def\NZS{\mathop{\mathrm{НЗС}}\nolimits}
+ \def\NZD{\mathop{\mathrm{НЗД}}\nolimits}
+ \else
+ \def\nzs{\mathop{\textnormal{\cyrn\cyrz\cyrs}}\nolimits}
+ \def\nzd{\mathop{\textnormal{\cyrn\cyrz\cyrd}}\nolimits}
+ \def\NZS{\mathop{\textnormal{\CYRN\CYRZ\CYRS}}\nolimits}
+ \def\NZD{\mathop{\textnormal{\CYRN\CYRZ\CYRD}}\nolimits}
+ \fi}
% \end{macrocode}
%
% The macro |\ldf@finish| takes care of looking for a