summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ncclatex/cp1251-light.def
blob: 8fb2c361dc2ca8b6de2ca5cdfa7f78424e20e595 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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'.