summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/babel-contrib/serbian/serbian.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/babel-contrib/serbian/serbian.dtx')
-rw-r--r--macros/latex/contrib/babel-contrib/serbian/serbian.dtx85
1 files changed, 82 insertions, 3 deletions
diff --git a/macros/latex/contrib/babel-contrib/serbian/serbian.dtx b/macros/latex/contrib/babel-contrib/serbian/serbian.dtx
index dd46341dfc..106ac9b7aa 100644
--- a/macros/latex/contrib/babel-contrib/serbian/serbian.dtx
+++ b/macros/latex/contrib/babel-contrib/serbian/serbian.dtx
@@ -1,7 +1,8 @@
% \iffalse meta-comment
%
-% Copyright 2019 Uroš Stefanović and any individual authors
+% Copyright 2019--2021 Uroš Stefanović and any individual authors
% listed elsewhere in this file. All rights reserved.
+% Earlier Maintainers: Dejan Muhamedagić, Slobodan Janković, Javier Bezos López, Johannes L. Braams
%
% This file is intended to be used with the Babel system.
% ------------------------------------------------------
@@ -31,7 +32,7 @@
%<code>\ProvidesLanguage{serbian}
%\fi
%\ProvidesFile{serbian.dtx}
- [2019/12/15 2.0a Serbian Latin support for the Babel system]
+ [2021/04/10 2.1 Serbian Latin support for the Babel system]
%\iffalse
%% File `serbian.dtx'
%
@@ -99,6 +100,18 @@
% (used when after the date is the punctuation mark, such as comma).
% Alternatively, the commands |\todayRoman| and |\todayRoman*| prints the current date using Roman numerals for months.
%
+% The alphabetical enumerations in texts use the Latin alphabet and alphabetic order,
+% but the letters q, w, x and y are omitted by the rules of the Serbian language (22 letters are used).
+% However, if the user wants to use the English alphabet for the enumeration (26 letters), this option is also available.
+% We will also provide the enumeration with the Latin letters but in alphabetic order that matches the Cyrillic alphabet (30 letters).
+% This of course shouldn't be used when the text is written in the Latin script.
+% However, sometimes the text is written in the Latin script so it can be later
+% converted into Cyrillic script (for example using the |OT2| encoding); in such case this alphabet order will be useful.
+% 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{serbian} 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.
+%
% Apart from defining shorthands we need to make sure that the
% first paragraph of each section is indented. Furthermore the
% following new math operators are defined: |\sh|, |\ch|, |\tg|, |\ctg|,
@@ -285,7 +298,7 @@
% \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|,
+% |\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.)
%
% \begin{macrocode}
@@ -319,6 +332,72 @@
\addto\noextrasserbian{\bbl@nonserbianindent}
% \end{macrocode}
%
+% We redefine the macro |\Alph|, which now produces (uppercase) Latin letters without the letters q, w, x and y
+% when Serbian is switched on, but we will keep the English alphabet if the user wants to use it.
+% Also we will define Latin alphabet in order that matches Cyrillic alphabet.
+% 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}
+\newcount\srbl@lettering \srbl@lettering=\z@
+\addto\extrasserbian{\babel@save\@Alph \let\@Alph\srbl@Alph}
+\def\srbl@Alph#1{%
+\ifcase\srbl@lettering
+ \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
+ \if@srb@uni@ode
+ \ifcase#1\or A\or B\or V\or G\or D\or Đ\or E\or Ž\or Z\or
+ I\or J\or K\or L\or Lj\or M\or N\or Nj\or O\or
+ P\or R\or S\or T\or Ć\or U\or F\or H\or C\or
+ Č\or Dž\or Š\else\@ctrerr\fi
+ \else
+ \ifcase#1\or A\or B\or V\or G\or D\or\DJ\or E\or\v Z\or Z\or
+ I\or J\or K\or L\or Lj\or M\or N\or Nj\or O\or
+ P\or R\or S\or T\or\'C\or U\or F\or H\or C\or
+ \v C\or D\v z\or\v S\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 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 same thing will be done with the macro |\alph|.
+%
+% \begin{macrocode}
+\addto\extrasserbian{\babel@save\@alph \let\@alph\srbl@alph}
+\def\srbl@alph#1{%
+\ifcase\srbl@lettering
+ \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
+ \if@srb@uni@ode
+ \ifcase#1\or a\or b\or v\or g\or d\or đ\or e\or ž\or z\or
+ i\or j\or k\or l\or lj\or m\or n\or nj\or o\or
+ p\or r\or s\or t\or ć\or u\or f\or h\or c\or
+ č\or dž\or š\else\@ctrerr\fi
+ \else
+ \ifcase#1\or a\or b\or v\or g\or d\or\dj\or e\or\v z\or z\or
+ i\or j\or k\or l\or lj\or m\or n\or nj\or o\or
+ p\or r\or s\or t\or\'c\or u\or f\or h\or c\or
+ \v c\or d\v z\or\v s\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 q\or r\or s\or t\or u\or v\or
+ w\or x\or y\or z\else\@ctrerr\fi
+\fi}%
+\addto\extrasserbian{%
+ \babel@save\enumEng \def\enumEng{\srbl@lettering=\tw@}
+ \babel@save\enumLat \def\enumLat{\srbl@lettering=\z@}
+ \babel@save\enumCyr \def\enumCyr{\srbl@lettering=\@ne}
+}%
+% \end{macrocode}
+%
% An |ijekav| attribute changes default behavior and activates an
% alternative set of captions suitable for typesetting in ijekavian dialect.
% The |quotes| attribute changes the |"'| shorthand to produce '' as closing quote,