summaryrefslogtreecommitdiff
path: root/fonts/cmolddig/texinput/cmolddig.sty
blob: 1fe649090a92a7789f9977768b7b2fe702d6ef3f (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
% cmolddig.sty -- a LaTeX package file to use CM oldstyle digits.
%
% Copyright 1998 Rowland McDonnell
% rowland.mcdonnell@physics.org
%
% This program can redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or (at your option) any later version.
%
% Partly stolen from Allin Cottrell (cottrell@wfu.edu)
% http://www.wfu.edu/~cottrell
%
% In conjuction with the files listed below, this package file gives 
% you old style figures in cmr by default.
%
% The cm founts do not have any italic or slanted old style figures, 
% so you only get them with:
% cmr/m/n, cmr/m/sc, cmr/bx/n, and cmr/b/n. 
%
% ot1cmrod.fd
% cmbj10.vf    cmbj10.tfm  
% cmbxj10.vf   cmbxj10.tfm 
% cmbxj12.vf   cmbxj12.tfm 
% cmbxj5.vf    cmbxj5.tfm  
% cmbxj6.vf    cmbxj6.tfm  
% cmbxj7.vf    cmbxj7.tfm  
% cmbxj8.vf    cmbxj8.tfm  
% cmbxj9.vf    cmbxj9.tfm  
% cmcscj10.vf  cmcscj10.tfm
% cmcscj9.vf   cmcscj9.tfm - optional extra for those with the AMS founts
% cmcscj8.vf   cmcscj8.tfm - optional extra for those with the AMS founts
% cmrj10.vf    cmrj10.tfm  
% cmrj12.vf    cmrj12.tfm  
% cmrj17.vf    cmrj17.tfm  
% cmrj5.vf     cmrj5.tfm   
% cmrj6.vf     cmrj6.tfm   
% cmrj7.vf     cmrj7.tfm   
% cmrj8.vf     cmrj8.tfm   
% cmrj9.vf     cmrj9.tfm   
% cmbj10.vf    cmbj10.tfm  
%
% 1999/06/23 v1.6 Added noams options
% 1999/06/20 v1.5 Fixed maths default and option switching
% 1999/05/31 v1.4 Added maths switching; fiddled with option names 
%     and stuff
% 1999/04/14 v1.3 Dealt with AMS extra csc founts
% 1998/09/25 v1.2 Added \cmoldstyledigits and \cmliningdigits
% 1998/09/25 v1.1 Possibly got cmcsc and cmr5 sorted out
% 1998/05/25 v1.0 In the beginning...
%
\NeedsTeXFormat{LaTeX2e}[1998/12/01]
\ProvidesPackage{cmolddig}[1999/06/23 v1.6 Use old style digits in cmr]

\renewcommand{\rmdefault}{cmrj}
% Well, that takes care of 'Roman'.  Italic is 'left as an
% exercise' (said Allin)
%
% Isn't it just?  Personally, I have no intention of doing the 
% necessary Metafont hacking. (said Rowland)

% A couple of options to use (or not) old style digits by default in 
% maths mode

\newif\ifCMO@oldstylemaths\CMO@oldstylemathsfalse

%
% Bleedin' Yanks
%
\DeclareOption{cmoldstylemathdigits}{\CMO@oldstylemathstrue}
\DeclareOption{cmliningmathdigits}{\CMO@oldstylemathsfalse}
%
% Speak English or die
%
\DeclareOption{cmoldstylemathsdigits}{\CMO@oldstylemathstrue}
\DeclareOption{cmliningmathsdigits}{\CMO@oldstylemathsfalse}

\newif\ifCMO@extracmsc\CMO@extracmscfalse

\DeclareOption{extracmcsc}{\CMO@extracmsctrue}%\ equivalent; for those
\DeclareOption{amsfonts}{\CMO@extracmsctrue}%  / with the AMS founts

\DeclareOption{noextracmcsc}{\CMO@extracmscfalse}%\ equivalent; for those
\DeclareOption{noamsfonts}{\CMO@extracmscfalse}%  / without the AMS founts

\ExecuteOptions{cmliningmathdigits,noamsfonts}

\ProcessOptions

% Set up maths digits\ldots
% (with a little help from Allin Cottrell and the nameless Canadian 
% guru)

\DeclareMathSymbol{0}{\mathalpha}{operators}{`0}
\DeclareMathSymbol{1}{\mathalpha}{operators}{`1}
\DeclareMathSymbol{2}{\mathalpha}{operators}{`2}
\DeclareMathSymbol{3}{\mathalpha}{operators}{`3}
\DeclareMathSymbol{4}{\mathalpha}{operators}{`4}
\DeclareMathSymbol{5}{\mathalpha}{operators}{`5}
\DeclareMathSymbol{6}{\mathalpha}{operators}{`6}
\DeclareMathSymbol{7}{\mathalpha}{operators}{`7}
\DeclareMathSymbol{8}{\mathalpha}{operators}{`8}
\DeclareMathSymbol{9}{\mathalpha}{operators}{`9}

\edef\cmliningmathdigits{%
\mathcode`0=\the\mathcode`0
\mathcode`1=\the\mathcode`1
\mathcode`2=\the\mathcode`2
\mathcode`3=\the\mathcode`3
\mathcode`4=\the\mathcode`4
\mathcode`5=\the\mathcode`5
\mathcode`6=\the\mathcode`6
\mathcode`7=\the\mathcode`7
\mathcode`8=\the\mathcode`8
\mathcode`9=\the\mathcode`9
}

\DeclareMathSymbol{0}{0}{letters}{'060}
\DeclareMathSymbol{1}{0}{letters}{'061}
\DeclareMathSymbol{2}{0}{letters}{'062}
\DeclareMathSymbol{3}{0}{letters}{'063}
\DeclareMathSymbol{4}{0}{letters}{'064}
\DeclareMathSymbol{5}{0}{letters}{'065}
\DeclareMathSymbol{6}{0}{letters}{'066}
\DeclareMathSymbol{7}{0}{letters}{'067}
\DeclareMathSymbol{8}{0}{letters}{'070}
\DeclareMathSymbol{9}{0}{letters}{'071}

\edef\cmoldstylemathdigits{%
\mathcode`0=\the\mathcode`0
\mathcode`1=\the\mathcode`1
\mathcode`2=\the\mathcode`2
\mathcode`3=\the\mathcode`3
\mathcode`4=\the\mathcode`4
\mathcode`5=\the\mathcode`5
\mathcode`6=\the\mathcode`6
\mathcode`7=\the\mathcode`7
\mathcode`8=\the\mathcode`8
\mathcode`9=\the\mathcode`9
}

\ifCMO@oldstylemaths
  \cmoldstylemathdigits
  \else
  \cmliningmathdigits
  \fi

\InputIfFileExists{ot1cmrj.fd}{}{%
  \PackageError{cmolddig}
    {Can't find file ot1cmrj.fd}
    {The file ot1cmrj.fd seems to be missing.  I can't 
     switch to oldstyle digits without it.}}

%
% If you've got the AMS founts:
%
\ifCMO@extracmsc
  \DeclareFontShape{OT1}{cmrj}{m}{sc}{
    <10><10.95><12> <14.4><17.28><20.74><24.88> cmcscj10
    <9> cmcscj9
    <5><6><7><8> cmcscj8}{}
  \fi

\newcommand{\cmoldstyledigits}{%
  \renewcommand{\rmdefault}{cmrj}\rmfamily}

\newcommand{\cmliningdigits}{%
  \renewcommand{\rmdefault}{cmr}\rmfamily}

\endinput
%% end of cmolddig.sty