% \iffalse meta-comment % % Copyright 1989-2001 Johannes L. Braams and any individual authors % listed elsewhere in this file. All rights reserved. % % This file is part of the Babel system release 3.7. % -------------------------------------------------- % % It may be distributed under the terms of the LaTeX Project Public % License, as described in lppl.txt in the base LaTeX distribution. % Either version 1.2 or, at your option, any later version. % \fi % \CheckSum{1256} % % \iffalse % Tell the \LaTeX\ system who we are and write an entry on the % transcript. %<*dtx> \ProvidesFile{bulgarian.dtx} % %\ProvidesLanguage{bulgarian} [2001/01/30 v1.0b Bulgarian support from the babel system] % %% File `bulgarian.dtx' %% Babel package for LaTeX version 2e %% Copyright (C) 1989-2001 %% by Johannes Braams,TeXniek % %% Bulgarian Language Definition File %% Copyright (C) 1995-2001 %% by Georgi.Boshnakov %% Johannes Braams,TeXniek % %% Adapted from russianb.dtx %% by Georgi.Boshnakov % %% Please report errors to:J.L.Braams %% babel@braams.cistron.nl % %<*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{bulgarian.dtx} \end{document} % %\fi % \GetFileInfo{bulgarian.dtx} % % \changes{bulgarian-0.99}{2000/06/10}{% % This is a prerelease version of this file. % Features needing further testing are removed.} % % \section{The Bulgarian language} % % The file \file{\filename}\footnote{The file described in this % section has version number \fileversion\ and was last revised on % \filedate. This file was initially derived from the August-1998 % version of \file{russianb.dtx}. % % It is (reasonably) backward compatible with the 1994/1996 % (non-babel) bulgarian style (bulgaria.sty) by Georgi % Boshnakov---files prepared for that style should compile % successfully (with vastly improved appearance due to usage of % standard fonts).} provides the language-specific macros for the % Bulgarian language. % % Users should take note of the vaious ``cyrillic'' dashes % available now (see below). These should remove many causes of % headache. Also, although by default the Bulgarian quotation marks % will appear automatically when typesetting in Bulgarian, it is % better to use the new commands \cs{"'} and \cs{"'} which % explicitly typeset them. % Note: automatic switch to Bulgarian quotation is withdrawn % for the moment and may not be reintroduced at all. % % For this language the character |"| is made active. In % table~\ref{tab:bulgarian-quote} an overview is given of its % purpose. % % \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 compound 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 ``). \\%'' % |"<| & for French left double quotes (looks like $<\!\!<$).\\ % |">| & for French right double quotes (looks like $>\!\!>$).\\ % \end{tabular} % \caption{The extra definitions made % by\file{bulgarian}}\label{tab:bulgarian-quote} % \end{center} % \end{table} % % The quotes in table~\ref{tab:bulgarian-quote} can also be typeset % by using the commands in table~\ref{tab:bmore-quote}. % % \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 ``).\\%'' % |\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:bmore-quote} % \end{center} % \end{table} % % 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}). % % The quotation marks traditionally used in Bulgarian were borrowed % from German o they keep their original names. French quotation % marks may be seen as well in older books. % % \StopEventually{} % % The macro |\LdfInit| takes care of preventing that this file is % loaded more than once, checking the category code of the % \texttt{@} sign, etc. % % \begin{macrocode} %<*code> \LdfInit{bulgarian}{captionsbulgarian} % \end{macrocode} % % When this file is read as an option, i.e., by the |\usepackage| % command, \texttt{bulgarian} will be an `unknown' language, in % which case we have to make it known. So we check for the % existence of |\l@bulgarian| to see whether we have to do % something here. % % \begin{macrocode} \ifx\l@bulgarian\@undefined \@nopatterns{Bulgarian} \adddialect\l@bulgarian0 \fi % \end{macrocode} % % % % \begin{macro}{\latinencoding} % % 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! % % \begin{macrocode} \let\latinencoding\cf@encoding % \end{macrocode} % % \end{macro} % % The user may choose between different available Cyrillic % encodings---e.g., \texttt{X2}, \texttt{LCY}, or \texttt{LWN}. % If the user wants to use a font encoding other than the default % (\texttt{T2A}), he has to load the corresponding file % \emph{before} \file{bulgarian.sty}. % This may be done in the following way: % % \begin{verbatim} % \usepackage[LCY,OT1]{fontenc} %overwrite the default encoding; % \usepackage[english,bulgarian]{babel} % \end{verbatim} % \unskip % % Note: most people would prefer the \texttt{T2A} to \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 Bulgarian phrase or vice % versa. On the other hand, switching the language is a good % practice anyway. With a decent text processing program it does % not involve more work than switching between the Bulgarian and % English keyboard. Moreover that the far most common disruption % occurs as a result of forgetting to switch back to cyrillic % keyboard. % % We parse the |\cdp@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. % % % \begin{macrocode} \def\reserved@a#1#2{% \edef\reserved@b{#1}% \edef\reserved@c{#2}% \ifx\reserved@b\reserved@c \let\cyrillicencoding\reserved@c \fi} \def\cdp@elt#1#2#3#4{% \reserved@a{#1}{OT2}% \reserved@a{#1}{LWN}% \reserved@a{#1}{LCY}% \reserved@a{#1}{X2}% \reserved@a{#1}{T2C}% \reserved@a{#1}{T2B}% \reserved@a{#1}{T2A}} \cdp@list % \end{macrocode} % % 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}). % % \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. % % \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} % % We avoid |\usepackage[\cyrillicencoding]{fontenc}| because we % don't want to force the switch of |\encodingdefault|. % % \begin{macrocode} \lowercase \expandafter{\expandafter\input\cyrillicencoding enc.def\relax}% \fi \fi % \end{macrocode} % % \begin{verbatim} % \PackageInfo{babel} % {Using `\cyrillicencoding' as a default Cyrillic encoding}% % \end{verbatim} % \unskip % % % % \begin{macrocode} \DeclareRobustCommand{\Bulgarian}{% \fontencoding\cyrillicencoding\selectfont \let\encodingdefault\cyrillicencoding \expandafter\set@hyphenmins\bulgarianhyphenmins \language\l@bulgarian} \DeclareRobustCommand{\English}{% \fontencoding\latinencoding\selectfont \let\encodingdefault\latinencoding \expandafter\set@hyphenmins\englishhyphenmins \language\l@english} \let\Bul\Bulgarian \let\Bg\Bulgarian \let\cyrillictext\Bulgarian \let\cyr\Bulgarian \let\Eng\English \def\selectenglanguage{\selectlanguage{english}} \def\selectbglanguage{\selectlanguage{bulgarian}} % \end{macrocode} % % Since the \texttt{X2} encoding does not contain Latin letters,we % should make some redefinitions of \LaTeX\ macros which implicitly % produce Latin letters. % % % \begin{macrocode} \expandafter\ifx\csname T@X2\endcsname\relax\else % \end{macrocode} % % 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@eng#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@eng#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} \let\@Alph\@Alph@eng \let\@alph\@alph@eng % \end{macrocode} % % 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} \DeclareTextSymbolDefault{\AA}{OT1} \DeclareTextSymbolDefault{\aa}{OT1} \DeclareTextCommand{\AA}{OT1}{\r A} \DeclareTextCommand{\aa}{OT1}{\r a} \fi % \end{macrocode} % % 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. % % \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 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 user should explicitly call the \pkg{inputenc} package by % |\usepackage{inputenc}|. We also removed |\AtBeginDocument|, so % \pkg{inputenc} should be used before \babel. % % \begin{macrocode} \@ifpackageloaded{inputenc}{}{% \def\reserved@a{LWN}% \ifx\reserved@a\cyrillicencoding\else \def\reserved@a{OT2}% \ifx\reserved@a\cyrillicencoding\else \PackageWarning{babel}% {No input encoding specified for Bulgarian language}\fi\fi} % \end{macrocode} % % Now we define two commands that offer the possibility to switch % between Cyrillic and Roman encodings. % % \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. % % We comment out |\latintext| since it is defined in the core of % babel (babel.def). We add the shorthand |\lat| for |\latintext|. % Note that |\cyrillictext| has been defined above. % % \begin{macrocode} % \DeclareRobustCommand{\latintext}{% % \fontencoding{\latinencoding}\selectfont % \def\encodingdefault{\latinencoding}} \let\lat\latintext % \end{macrocode} % % \end{macro} % \end{macro} % % \begin{macro}{\textcyrillic} % \begin{macro}{\textlatin} % % These commands take an argument which is then typeset using the % requested font encoding. % |\textlatin| is commented out since it is defined in the core of % babel. (It is defined there with |\DeclareRobustCommand| instead.) % % \begin{macrocode} \DeclareTextFontCommand{\textcyrillic}{\cyrillictext} % \DeclareTextFontCommand{\textlatin}{\latintext} % \end{macrocode} % % \end{macro} % \end{macro} % % The next step consists of defining commands to switch to (and % from) the Bulgarian language. % % \begin{macro}{\captionsbulgarian} % % The macro |\captionsbulgarian| defines all strings used in the % four standard document classes provided with \LaTeX. The two % commands |\cyr| and |\lat| activate Cyrillic resp. Latin encoding. % % \begin{macrocode} \addto\captionsbulgarian{% \def\prefacename{% {\cyr\CYRP\cyrr\cyre\cyrd\cyrg\cyro\cyrv\cyro\cyrr}}% \def\refname{% {\cyr\CYRL\cyri\cyrt\cyre\cyrr\cyra\cyrt\cyru\cyrr\cyra}}% \def\abstractname{% {\cyr\CYRA\cyrb\cyrs\cyrt\cyrr\cyra\cyrk\cyrt}}% \def\bibname{% {\cyr\CYRB\cyri\cyrb\cyrl\cyri\cyro\cyrg\cyrr\cyra\cyrf\cyri\cyrya}}% \def\chaptername{% {\cyr\CYRG\cyrl\cyra\cyrv\cyra}}% \def\appendixname{% {\cyr\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyre}}% \def\contentsname{% {\cyr\CYRS\cyrhrdsn\cyrd\cyrhrdsn\cyrr\cyrzh\cyra\cyrn\cyri\cyre}}% \def\listfigurename{% {\cyr\CYRS\cyrp\cyri\cyrs\cyrhrdsn\cyrk\ \cyrn\cyra\ \cyrf\cyri\cyrg\cyru\cyrr\cyri\cyrt\cyre}}% \def\listtablename{% {\cyr\CYRS\cyrp\cyri\cyrs\cyrhrdsn\cyrk\ \cyrn\cyra\ \cyrt\cyra\cyrb\cyrl\cyri\cyrc\cyri\cyrt\cyre}}% \def\indexname{% {\cyr\CYRA\cyrz\cyrb\cyru\cyrch\cyre\cyrn\ \cyru\cyrk\cyra\cyrz\cyra\cyrt\cyre\cyrl}}% \def\authorname{% {\cyr\CYRI\cyrm\cyre\cyrn\cyre\cyrn\ \cyru\cyrk\cyra\cyrz\cyra\cyrt\cyre\cyrl}}% \def\figurename{% {\cyr\CYRF\cyri\cyrg\cyru\cyrr\cyra}}% \def\tablename{% {\cyr\CYRT\cyra\cyrb\cyrl\cyri\cyrc\cyra}}% \def\partname{% {\cyr\CYRCH\cyra\cyrs\cyrt}}% \def\enclname{% {\cyr\CYRP\cyrr\cyri\cyrl\cyro\cyrzh\cyre\cyrn\cyri\cyrya}}% \def\ccname{% {\cyr\cyrk\cyro\cyrp\cyri\cyrya}}% \def\headtoname{% {\cyr\CYRZ\cyra}}% \def\pagename{% {\cyr\CYRS\cyrt\cyrr.}}% \def\seename{% {\cyr\cyrv\cyrzh.}}% \def\alsoname{% {\cyr\cyrv\cyrzh.\ \cyrs\cyrhrdsn\cyrshch\cyro\ \cyri}}% \def\proofname{Proof}% <-- Needs translation \def\glossaryname{Glossary}% <-- Needs translation } % \end{macrocode} % \end{macro} %% % \begin{macro}{\datebulgarian} % % The macro |\datebulgarian| redefines the command |\today| to % produce Bulgarian dates. % It also provides the command |\todayRoman| which produces the % date with the month in capital roman numerals, a popular format % for dates in Bulgarian. % % \begin{macrocode} \def\datebulgarian{% \def\month@bulgarian{\ifcase\month\or \cyrya\cyrn\cyru\cyra\cyrr\cyri\or \cyrf\cyre\cyrv\cyrr\cyru\cyra\cyrr\cyri\or \cyrm\cyra\cyrr\cyrt\or \cyra\cyrp\cyrr\cyri\cyrl\or \cyrm\cyra\cyrishrt\or \cyryu\cyrn\cyri\or \cyryu\cyrl\cyri\or \cyra\cyrv\cyrg\cyru\cyrs\cyrt\or \cyrs\cyre\cyrp\cyrt\cyre\cyrm\cyrv\cyrr\cyri\or \cyro\cyrk\cyrt\cyro\cyrm\cyrv\cyrr\cyri\or \cyrn\cyro\cyre\cyrm\cyrv\cyrr\cyri\or \cyrd\cyre\cyrk\cyre\cyrm\cyrv\cyrr\cyri\fi}% \def\month@Roman{\expandafter\@Roman\month}% \def\today{\number\day~\month@bulgarian\ \number\year~\cyrg.}% \def\todayRoman{\number\day.\,\month@Roman.\,\number\year~\cyrg.}% } % \end{macrocode} % % \end{macro} % % % % \begin{macro}{\todayRoman} % % The month is often written with roman numbers in Bulgarian dates. % Here we define date in this format: % % \begin{macrocode} \def\Romannumeral#1{\uppercase\expandafter{\romannumeral #1}} \def\todayRoman{\number\day.\Romannumeral{\month}.\number\year~\cyrg.} % \end{macrocode} % % \end{macro} % % \begin{macro}{\extrasbulgarian} % % The macro |\extrasbulgarian| will perform all the extra % definitions needed for the Bulgarian language. % The macro |\noextrasbulgarian| is used to cancel the actions of % |\extrasbulgarian|. % % The first action we define is to switch on the selected Cyrillic % encoding whenever we enter `bulgarian'. % % \begin{macrocode} \addto\extrasbulgarian{\cyrillictext} % \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 Bulgarian language is no longer `active'. % % \begin{macrocode} \addto\noextrasbulgarian{\latintext} % \end{macrocode} % % For Bulgarian the \texttt{"} character also is made active. % % \begin{macrocode} \initiate@active@char{"} % \end{macrocode} % % The code above is necessary because we need extra active % characters. The character |"| is used as indicated in % table~\ref{tab:bulgarian-quote}. We specify that the Bulgarian % group of shorthands should be used. % % \begin{macrocode} \addto\extrasbulgarian{\languageshorthands{bulgarian}} % \end{macrocode} % % These characters are `turned on' once, later their definition may % vary. % % \begin{macrocode} \addto\extrasbulgarian{% \bbl@activate{"}} \addto\noextrasbulgarian{% \bbl@deactivate{"}} % \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). % % 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. % % \begin{macrocode} %<*spanishligs> \declare@shorthand{bulgarian}{?`}{\UseTextSymbol{OT1}\textquestiondown} \declare@shorthand{bulgarian}{!`}{\UseTextSymbol{OT1}\textexclamdown} % % \end{macrocode} % % To be able to define the function of `|"|', we first define a % couple of `support' macros. % % \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@a{\endgroup \def÷ĀSS{\mathchar"7019} \def\dq{"}} \reserved@a % \end{macrocode} % % \end{macro} % % 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. % % \begin{macrocode} \declare@shorthand{bulgarian}{"`}{\glqq} \declare@shorthand{bulgarian}{"'}{\grqq} \declare@shorthand{bulgarian}{"<}{\flqq} \declare@shorthand{bulgarian}{">}{\frqq} % \end{macrocode} % % Some additional commands: % % \begin{macrocode} \declare@shorthand{bulgarian}{""}{\hskip\z@skip} \declare@shorthand{bulgarian}{"~}{\textormath{\leavevmode\hbox{-}}{-}} \declare@shorthand{bulgarian}{"=}{\nobreak-\hskip\z@skip} \declare@shorthand{bulgarian}{"|}{% \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: % % \begin{macrocode} \declare@shorthand{bulgarian}{"-}{% % \end{macrocode} % % If the next token is `|-|', we typeset an emdash, otherwise a % hyphen sign: % % \begin{macrocode} \def\bulgarian@sh@tmp{% \if\bulgarian@sh@next-\expandafter\bulgarian@sh@emdash \else\expandafter\bulgarian@sh@hyphen\fi }% % \end{macrocode} % % \TeX\ looks for the next token after the first `|-|': the meaning % of this token is written to |\bulgarian@sh@next| and % |\bulgarian@sh@tmp| is called. % % \begin{macrocode} \futurelet\bulgarian@sh@next\bulgarian@sh@tmp} % \end{macrocode} % % Here are the definitions of hyphen and emdash. First the hyphen: % % \begin{macrocode} \def\bulgarian@sh@hyphen{\nobreak\-\bbl@allowhyphens} % \end{macrocode} % % For the emdash definition, there are the two parameters: we must % `eat' two last hyphen signs of our emdash \dots : % % \begin{macrocode} \def\bulgarian@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 empb@{~}\def empc@{*}% \ifx\tempx@\tempa@\@Acdash\else \ifx\tempx@\tempb@\@Bcdash\else \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} % % % \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} % % \begin{macrocode} \def\@Bcdash{\leavevmode\ifdim\lastskip>\z@\unskip\fi \nobreak\cyrdash\penalty\exhyphenpenalty\hskip\z@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} % % \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 % |---|. % % \begin{macrocode} % Is there an IF necessary? \ifx\cyrdash\undefined \def\cyrdash{\hbox to.8em{--\hss--}} \fi % \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. % % \begin{macrocode} \declare@shorthand{bulgarian}{",}{\nobreak\hskip.2em\ignorespaces} % \end{macrocode} % % The Bulgarian hyphenation patterns can be used with % |\lefthyphenmin| and |\righthyphenmin| set to~2. % \changes{bulgarian-1.0b}{2000/09/22}{Now use \cs{providehyphenmins} to % provide a default value} % \begin{macrocode} \providehyphenmins{\CurrentOption}{\tw@\tw@} \fi % \end{macrocode} % % Now the action |\extrasbulgarian| has to execute is to make sure % that the command |\frenchspacing| is in effect. If this is not % the case the execution of |\noextrasbulgarian| will switch it off % again. % % \begin{macrocode} \addto\extrasbulgarian{\bbl@frenchspacing} \addto\noextrasbulgarian{\bbl@nonfrenchspacing} % \end{macrocode} % % Make the double quotes produce the traditional quotes % used in Bulgarian texts (these are the German quotes). % % \begin{macrocode} % \initiate@active@char{`} % \initiate@active@char{'} % \addto\extrasbulgarian{% % \bbl@activate{`}} % \addto\extrasbulgarian{% % \bbl@activate{'}} % \addto\noextrasbulgarian{% % \bbl@deactivate{`}} % \addto\noextrasbulgarian{% % \bbl@deactivate{'}} % \def\mlron{\bbl@activate{`}\bbl@activate{'}} % \def\mlroff{\bbl@deactivate{`}\bbl@deactivate{'}} % \declare@shorthand{bulgarian}{``}{\glqq} % \declare@shorthand{bulgarian}{''}{\grqq} % \end{macrocode} % % \end{macro} % % Next we add a new enumeration style for Bulgarian manuscripts with % Cyrillic letters,and later on we define some math operator names in % accordance with Bulgarian typesetting traditions. % % \begin{macro}{\@Alph@bul} % % We begin by defining |\@Alph@bul| which works like |\@Alph|, but % produces (uppercase) Cyrillic letters intead of Latin ones. The % letters ISHRT, HRDSN and SFTSN are skipped, as usual for such % enumeration. % % \begin{macrocode} \def\enumBul{\let\@Alph\@Alph@bul \let\@alph\@alph@bul} \def\enumEng{\let\@Alph\@Alph@eng \let\@alph\@alph@eng} \def\enumLat{\let\@Alph\@Alph@eng \let\@alph\@alph@eng} \addto\extrasbulgarian{\enumBul} \addto\noextrasbulgarian{\enumLat} \def\@Alph@bul#1{% \ifcase#1\or \CYRA\or \CYRB\or \CYRV\or \CYRG\or \CYRD\or \CYRE\or \CYRZH\or \CYRZ\or \CYRI\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@eng#1{% \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} % % % % \begin{macro}{\@alph@bul} % % The macro |\@alph@bul| is similar to |\@Alph@bul|; % it produces lowercase Bulgarian letters. % % \begin{macrocode} \def\@alph@bul#1{% \ifcase#1\or \cyra\or \cyrb\or \cyrv\or \cyrg\or \cyrd\or \cyre\or \cyrzh\or \cyrz\or \cyri\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@eng#1{% \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} % % Set up default Cyrillic math alphabets. To use Cyrillic letters % in math mode user should load the |textmath| package % \emph{before} loading fontenc package (or \babel). Note,that by % default Cyrillic letters are taken from upright font in math mode % (unlike Latin letters). % % \begin{macrocode} %\RequirePackage{textmath} \@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. % % \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 \SetMathAlphabet\cyrmathsf{bold}\cyrillicencoding \sfdefault\bfdefault\updefault \SetMathAlphabet\cyrmathit{bold}\cyrillicencoding \rmdefault\bfdefault\itdefault } % \end{macrocode} % % Some math functions in Bulgarian math books have other names: % e.g., \texttt{sinh} in Bulgarian is written as \texttt{sh} % etc. So we define a number of new math operators. % % |\sinh|: % % \begin{macrocode} \def\sh{\mathop{\operator@font sh}\nolimits} % \end{macrocode} % % |\cosh|: % % \begin{macrocode} \def\ch{\mathop{\operator@font ch}\nolimits} % \end{macrocode} % % |\tan|: % % \begin{macrocode} \def\tg{\mathop{\operator@font tg}\nolimits} % \end{macrocode} % % |\arctan|: % % \begin{macrocode} \def\arctg{\mathop{\operator@font arctg}\nolimits} % \end{macrocode} % % |\arccot|: % % \begin{macrocode} \def\arcctg{\mathop{\operator@font arcctg}\nolimits} % \end{macrocode} % % The following macro conflicts with |\th| defined in Latin~1 % encoding: |\tanh|: % % \begin{macrocode} \def\th{\mathop{\operator@font th}\nolimits} % \end{macrocode} % % |\cot|: % % \begin{macrocode} \def\ctg{\mathop{\operator@font ctg}\nolimits} % \end{macrocode} % % |\coth|: % % \begin{macrocode} \def\cth{\mathop{\operator@font cth}\nolimits} % \end{macrocode} % % |\csc|: % % \begin{macrocode} \def\cosec{\mathop{\operator@font cosec}\nolimits} % \end{macrocode} % % This is for compatibility with older Bulgarian packages. % % \begin{macrocode} \DeclareRobustCommand{\No}{% \ifmmode{\nfss@text{\textnumero}}\else\textnumero\fi} % \end{macrocode} % % The macro |\ldf@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. % % \begin{macrocode} \ldf@finish{bulgarian} % % \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