summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ncclatex/cp1251-light.def
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/ncclatex/cp1251-light.def')
-rw-r--r--macros/latex/contrib/ncclatex/cp1251-light.def133
1 files changed, 133 insertions, 0 deletions
diff --git a/macros/latex/contrib/ncclatex/cp1251-light.def b/macros/latex/contrib/ncclatex/cp1251-light.def
new file mode 100644
index 0000000000..8fb2c361dc
--- /dev/null
+++ b/macros/latex/contrib/ncclatex/cp1251-light.def
@@ -0,0 +1,133 @@
+\ProvidesFile{cp1251-light.def}
+ [2005/12/24 v1.2 Light input encoding file]
+%
+% \changes{v1.0}{2004/09/23}{This version was uploaded to CTAN}
+% \changes{v1.1}{2005/01/09}{Replace \textrm{\normalfont...} to \textnormal}
+% \changes{v1.1}{2005/01/09}{More comprehensive test of font encoding}
+% \changes{v1.2}{2005/12/24}{Test the \cyrillicencoding to be \undefined}
+%
+% Using of cyrillic input encodings has two major disadvantages:
+%
+% * cyrillic letters are forbidden in names of labels because
+% they are active and
+% * cyrillic letters disappear in math mode because they do not
+% belong to ordinary math fonts.
+%
+% The light version of the CP1251 input encoding partially removes both
+% these disadvantages: it declares common cyrillic letters in the range
+% of \CYRA--\cyrya as `other' symbols (with catcode 12), activates them in
+% math mode only (with mathcode "8000), and typesets common cyrillic letters
+% in math mode with the default text font. All these actions are applied
+% if the output cyrillic encoding is one of T2A, T2B, T2C, or X2 for
+% which the input and output codes of common cyrillic letters coinside.
+% Otherwise, the cp1251-light works as cp1251.
+%
+\input{cp1251.def}
+%
+% Test the font encoding to have a valid type
+%
+\makeatletter
+\ifx\cyrillicencoding\undefined
+ \let\@tempa\encodingdefault%
+\else
+ \let\@tempa\cyrillicencoding
+\fi
+\expandafter\in@\expandafter{\@tempa}{T2A,T2B,T2C,X2}
+\ifin@ \else
+ \PackageWarning{inputenc}%
+ {Cannot apply cp1251-light encoding\MessageBreak
+ to the font encoding \@tempa.\MessageBreak
+ The cp1251 encoding is in use.\MessageBreak}%
+ \makeatother
+ \endinput
+\fi
+%
+% The macro \@tempa{code}{command} declares a symbol with
+% specified code as math-active symbol and prints its command
+% with the default text font (this is the usual practice for
+% typesetting cyrillic in math indices).
+%
+\def\@tempa#1#2{%
+ \@tempcnta#1\relax
+ \catcode\@tempcnta 12
+ \mathcode\@tempcnta "8000
+ \bgroup
+ \uccode`\~#1%
+ \uppercase{%
+ \egroup
+ \def~%
+ }{{\textnormal{#2}}}%
+}
+%
+% Redefine catcodes and mathcodes of common cyrillic letters
+% Do them active in mathmode only.
+%
+\@tempa{192}{\CYRA}
+\@tempa{193}{\CYRB}
+\@tempa{194}{\CYRV}
+\@tempa{195}{\CYRG}
+\@tempa{196}{\CYRD}
+\@tempa{197}{\CYRE}
+\@tempa{198}{\CYRZH}
+\@tempa{199}{\CYRZ}
+\@tempa{200}{\CYRI}
+\@tempa{201}{\CYRISHRT}
+\@tempa{202}{\CYRK}
+\@tempa{203}{\CYRL}
+\@tempa{204}{\CYRM}
+\@tempa{205}{\CYRN}
+\@tempa{206}{\CYRO}
+\@tempa{207}{\CYRP}
+\@tempa{208}{\CYRR}
+\@tempa{209}{\CYRS}
+\@tempa{210}{\CYRT}
+\@tempa{211}{\CYRU}
+\@tempa{212}{\CYRF}
+\@tempa{213}{\CYRH}
+\@tempa{214}{\CYRC}
+\@tempa{215}{\CYRCH}
+\@tempa{216}{\CYRSH}
+\@tempa{217}{\CYRSHCH}
+\@tempa{218}{\CYRHRDSN}
+\@tempa{219}{\CYRERY}
+\@tempa{220}{\CYRSFTSN}
+\@tempa{221}{\CYREREV}
+\@tempa{222}{\CYRYU}
+\@tempa{223}{\CYRYA}
+\@tempa{224}{\cyra}
+\@tempa{225}{\cyrb}
+\@tempa{226}{\cyrv}
+\@tempa{227}{\cyrg}
+\@tempa{228}{\cyrd}
+\@tempa{229}{\cyre}
+\@tempa{230}{\cyrzh}
+\@tempa{231}{\cyrz}
+\@tempa{232}{\cyri}
+\@tempa{233}{\cyrishrt}
+\@tempa{234}{\cyrk}
+\@tempa{235}{\cyrl}
+\@tempa{236}{\cyrm}
+\@tempa{237}{\cyrn}
+\@tempa{238}{\cyro}
+\@tempa{239}{\cyrp}
+\@tempa{240}{\cyrr}
+\@tempa{241}{\cyrs}
+\@tempa{242}{\cyrt}
+\@tempa{243}{\cyru}
+\@tempa{244}{\cyrf}
+\@tempa{245}{\cyrh}
+\@tempa{246}{\cyrc}
+\@tempa{247}{\cyrch}
+\@tempa{248}{\cyrsh}
+\@tempa{249}{\cyrshch}
+\@tempa{250}{\cyrhrdsn}
+\@tempa{251}{\cyrery}
+\@tempa{252}{\cyrsftsn}
+\@tempa{253}{\cyrerev}
+\@tempa{254}{\cyryu}
+\@tempa{255}{\cyrya}
+\let\@tempa\relax
+\makeatother
+\endinput
+%%
+%% End of file `cp1251-light.def'.