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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
|
%&latex
% File cmolddig.tex
% Copyright 1999 Rowland McDonnell
% rowland.mcdonnell@physics.org
%
% Part of the cmolddig package
%
% This file 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.
\documentclass[a4paper,11pt]{article}
\usepackage{array,xspace}
\makeatletter
\newcommand{\ttlb}{{\ttfamily\def\@tempcmda{OT1}%
\ifx\f@encoding\@tempcmda\char"7B\else\{\fi}}
\newcommand{\ttrb}{{\ttfamily\def\@tempcmda{OT1}%
\ifx\f@encoding\@tempcmda\char"7D\else\}\fi}}
\newcommand{\ttbs}{{\ttfamily\def\@tempcmda{OT1}%
\ifx\f@encoding\@tempcmda\char`\\\else\textbackslash\fi}}
\newcommand*{\comname}[2][VF500F2E]{{\ttfamily\ttbs #2%
\def\@tempcmda{VF500F2E}\def\@tempcmdb{#1}%
\ifx\@tempcmda\@tempcmdb\else\comarg{#1}\fi}}
\makeatother
\newcommand*{\comarg}[1]{{\ttfamily\ttlb$\langle$%
{\rmfamily\itshape#1}\/$\rangle$\ttrb}}
\newcommand*{\comoptarg}[1]{{\ttfamily[$\langle$%
{\rmfamily\itshape#1}\/$\rangle$]}}
\newcommand*{\filename}[1]{\texttt{#1}}
\newcommand*{\packname}[1]{\texttt{#1}}
\newcommand*{\optname}[1]{\texttt{#1}}
\newcommand*{\newsgroup}[1]{\texttt{news://#1}}
\newcommand*{\dvidriver}{dvi driver}
\newcommand*{\cmolddig}{\packname{cmolddig}\xspace}
\author{Rowland McDonnell}
\title{The \cmolddig package}
\date{23rd August 1999}
\begin{document}
\maketitle
\tableofcontents
\section{Introduction}
The \packname{cmolddig} package sets things up so that numbers are
printed using old style digits -- $\oldstylenums{1234567890}$ --
rather than the usual lining digits -- $1234567890$. It only works
with the original Computer Modern founts. You can choose whether
numbers are printed as old style or lining digits in text or in maths
mode.
You can get old style digits without any extra help by using the
command \comname{oldstylenums} in maths mode, but this package
arranges things so that all numbers are printed using old style digits
without you needing to do that.
To cut a very involved tale down to the barest essentials: old style
digits look better and are easier to read in text and the like; while
lining digits are more suitable for maths, in tables, and the like.
Both these assertions are argued over by typographers.
If you have the T1 encoded European Modern founts installed, you might
be interested in the \packname{eco} package, which is the T1
equivalent of \cmolddig. It avoids many of the limits of this package.
The \cmolddig package doesn't contain any new characters: you need to
have the OT1 encoded Computer Modern Roman founts installed before
this package is useful. As far as I know, all \TeX\ systems come with
these founts installed by default. It doesn't matter if you're using
Metafont, PostScript Type 1, or TrueType versions of the Computer
Modern founts; but you do need a \TeX\ system able to use virtual
founts. Almost all modern (1999) \TeX\ systems can use virtual founts;
the only exception I know of is Y\&Y \TeX's version.
\packname{Cmolddig} works by switching to a set of virtual founts that
have the normal lining digits replaced with old style digits from the
corresponding maths italic fount. These digits are conventional
upright digits despite living in a nominally italic fount.
The original Computer Modern founts have old style digits available
for the Computer Modern Roman family only, and even then only for the
upright shapes: Computer Modern Roman upright, bold extended, bold,
and small caps. Because of this, this package can't give you old style
digits for Computer Modern Sanserif or Computer Modern Typewriter; nor
does it give you old style digits if you're using any italic or
slanted fount.
Options exist to use old style digits in maths or not, independently
of the style of numbers in normal text. You can also choose to make
use of the extra small caps sizes included with the AMS fount set if
you have it installed.
\section{Installation}
You need to put three directories of files in the right places on
your \TeX\ system's directory tree: with that done, installation is
complete.
All the files in the \filename{texinputs} directory should go
into a directory that \TeX\ searches for input files. All the files in
the \filename{tfm} directory should go into a directory that
\TeX\ searches for \filename{tfm} (fount) files. All the files in
the \filename{vf} directory should go into a directory that
\TeX\ searches for \filename{vf} (virtual fount) files. If you don't
know where these places are, have a read of your \TeX\ system's
documentation.
Moving these files to the right places is all you need to do. Once
you've done this, try running \LaTeX\ on \filename{odshrtst.tex}: you
should see some old style digits in the output, showing that you've
installed the package correctly.
You can ignore all the files in the \filename{source} directory
unless you're interested in how I created the virtual founts at the
heart of this package. The \filename{source} directory can be thrown
away if you like.
\section{Using the \cmolddig package}
Make sure you include the \cmolddig package by saying:
\begin{verbatim}
\usepackage{cmolddig}
\end{verbatim}
in the preamble of your document. This will switch you to Computer
Modern Roman with old style digits in normal text only, not in maths
mode.
\subsection{Controlling the package}
You can switch between Computer Modern Roman with old style digits and
with normal lining digits inside your document using the new commands:
\comname{cmoldstyledigits} and \comname{cmliningdigits}.
\begin{verbatim}
\cmoldstyledigits 35,000 cabbages with old style digits,
\cmliningdigits or 15 turnips with lining digits.
\end{verbatim}
By default, the \cmolddig package doesn't affect numbers in maths mode.
If you want old style digits in maths mode, you can give the package
the \optname{cmoldstyledigits} option:
\begin{verbatim}
\usepackage[cmoldstyledigits]{cmolddig}
\end{verbatim}
the \optname{cmliningmathdigit} option forces lining digits in
maths mode; this is what \cmolddig usually does, so there's probably
no need to know about this option.
You can switch between Computer Modern Roman with old style digits in
maths and with normal lining digits in maths inside your document
using the commands: \comname{cmoldstyledigits} and
\comname{cmliningdigits}.
\begin{verbatim}
\cmoldstylemathdigits $35 \pi = x$% old style digits
\cmliningmathdigits $17x^{2}-32x+17=y$% lining digits
\end{verbatim}
You might like to note that it's \emph{very} unusual to use old style
digits in maths. I have come across one typographer who asserts that,
despite this, maths is more readable when typeset with old style
digits. Whatever the truth of the matter, it's probably best to keep
to lining digits in maths if you are producing work that needs to meet
any standard of conventionality.
If you have the AMS founts which come with Computer Modern Roman caps
and small caps in two extra sizes -- 8\,pt and 9\,pt -- you can tell
\cmolddig about it with the \optname{amsfonts} option:
\begin{verbatim}
\usepackage[amsfonts]{cmolddig}
\end{verbatim}
will tell \cmolddig to use these extra sizes if needed. The \cmolddig
package won't use these two extra founts unless you tell it to. The
\optname{extracsc} option is identical in effect to the
\optname{amsfonts} option.
The package also includes the \optname{noamsfonts} and
\optname{noextracsc}: a pair of options which tell \cmolddig to avoid
using the extra AMS small caps founts. I can't see any need for
anyone to use them, because the \cmolddig package avoids using these
extra founts by default.
\section{How it works and stuff}
There are three separate things that can be considered: the virtual
fount mechanism in \TeX, which makes this package possible; the
creation of the particular virtual founts used by \cmolddig; and what
the package actually does when you use it.
\subsection{Virtual founts}
A warning: the subject of \TeX\ and founts is complicated and
never-ending. This short section is inevitably inadequate, but I hope
it sheds a little light.
To begin with, all \TeX\ knows about a fount is the \filename{tfm}
file. When you select a fount for typesetting, \TeX\ reads the
appropriate \filename{tfm} file which tells it how much space each
character takes up (height, depth, and width), how much space to add
or subtract between certain pairs of letters (kerning information),
which pairs of characters should be replaced by a different character
(ligature information; replacing \texttt{ff} with an `ff' ligature,
for example), and similar things. There is no information about the
shape of any letters in this file.
Every \filename{tfm} file has up to 256 different characters listed in
it. Each character lives in a numbered slot: 0--255. There are a
number of standard \emph{encodings} defined for \LaTeX\ which say which
character should live in which numbered slot. In OT1 encoding (used
for the original Computer Modern Roman founts), character number 48 is
the number `0', character number 49 is the number `1', and so on.
In the normal run of things, \TeX\ places information about the fount
in the \filename{dvi} file, and when you come to print or preview that
\filename{dvi} file, the driver program finds a real fount (bitmap, PS
Type 1, TrueType, or whatever) and displays it. This approach has a
few problems, particularly when you come to work with founts that (in
their natural state) don't have the same characters in the same slots
as the standard \TeX\ encoding. For example, character number 1 in an
OT1 encoded fount is an upper-case Delta: $\Delta$. This is unique to
that encoding: character number 1 in a normal PS type 1 fount is
undefined. If you tried to use a normal PS Type 1 fount with \LaTeX's
OT1 encoding and took no precautions, things just wouldn't work at all
right and you'd get the wrong characters printed for lots of things.
The virtual fount mechanism is one method for getting round this (and
other) problems. The way it works (in brief) is this. You create a
pair of files: a \filename{tfm} file and a \filename{vf} file. The
\filename{tfm} file is a perfectly ordinary \filename{tfm} file. The
\filename{vf} (virtual fount) file is something new: it contains
information on how to print each character referred to in the
\filename{tfm} file. The instructions might be to get all the
characters except the numbers from (say) cmr10, and to get the numbers
from cmmi10. This is exactly what \filename{cmrj10.vf} does. These
\filename{vf} files can contain fragments of \filename{dvi} file so
all sorts of trickery is possible. A more common use for virtual
founts is re-mapping: re-arranging the characters so that they're in
the expected slots for the encoding you're using. In other words, you
might be using (say) a PS Type 1 version of Times using the
\packname{times} package and OT1 encoding. If you were to use a dot
accent, you'd be asking for character number 95. In the `natural' PS
text encoding, character number 95 is an underscore. The magic of
virtual founts means that character number 95 in the fount
(\filename{tfm} file) that \TeX\ sees `really' is a dot accent; when
the \dvidriver comes to display that fount, it sees that
it's a virtual fount, looks at the appropriate \filename{vf} file, and
displays character number 199 from the `real' Times fount every time
the \filename{dvi} file asks for character number 95. (For the sake of
a comprehensible explanation, I've ignored the widespread use of 8r
encoding as an intermediate step, and ignored re-encoding done by the
\dvidriver).
The \filename{vf} (virtual fount) file is a new type of file for
\TeX\ systems, but it's ignored by \TeX\ itself: \filename{vf} files
are used only by \filename{dvi} drivers. What happens is this: when
a modern \filename{dvi} driver looks at a \filename{dvi} file, it
checks to see if any of the \filename{tfm} files in it have
corresponding \filename{vf} files. If so, the driver looks in the
\filename{vf} files and follows the instructions in them on how to
print the characters referred to. A \filename{vf} file can refer to
any real fount or any virtual fount, so this business of looking
things up in virtual founts can get complicated.
You can find out more about virtual founts by running \filename{weave}
and then \TeX\ on these files from CTAN:
\begin{center}
\begin{tabular}{@{}p{\textwidth}@{}}
\filename{systems/knuth/etc/vftovp.web}\\
\filename{systems/knuth/etc/vptovf.web}
\end{tabular}
\end{center}
\subsection{What the package does}
A brief explanation to begin with: every fount in \LaTeX\ belongs to a
\emph{family}. Every family has a short internal name by which it is
referred to inside \LaTeX. The internal name of the Computer Modern
Roman family is \texttt{cmr}. The \cmolddig package defines a new
family, which has the internal name \texttt{cmrj}. The `j' is a code
that means `with old style digits', so \texttt{cmrj} stands for
`Computer Modern Roman with old style digits'. If you're interested,
the fontname documentation available from CTAN explains the full
details of this code.
This package's default behaviour is to define the \comname{rmdefault}
family to be \texttt{cmrj}. This command defines the fount family used
for typesetting normal text. What this change means is that when
\LaTeX\ comes across a request to typeset normal text, it sees that it
needs to use the \texttt{cmrj} family, it loads the file
\texttt{ot1cmrj.fd} (this is assuming that you're using OT1 encoding
-- if you're not, you'll get an error message instead). This file
tells \LaTeX\ which \filename{tfm} file to load when you ask for any
given fount. In this case, \LaTeX\ is told to use the new virtual
founts where they exist. You can learn more about \filename{fd} files
by reading \filename{fntguide.tex}, which is part of the standard
\LaTeX\ distribution.
The \cmolddig package makes two new commands:
\comname{cm\-old\-style\-digits}, which changes \comname{rmdefault} to
\texttt{cmrj} and switches to \comname{rmfamily}; and
\comname{cm\-lining\-digits}, which changes \comname{rmdefault} to
\texttt{cmr} and also switches to \comname{rmfamily}
Maths is a bit more tricky. By default, the \cmolddig package
doesn't affect maths mode behaviour. The package defines two
commands for switching between the two sorts of digits in maths mode:
\comname{cmoldstylemathdigits} and \comname{cmliningmathdigits}.
These commands are used by the package when you use the
\optname{cmoldstylemathdigits} and \optname{cmliningmathdigit}
options. What do they do? They change the mathcode of the numbers
0--9 to the appropriate values to select either normal lining digits
from the usual place, or old style digits from the appropriate maths
italic fount (which is where the normal upright roman old style digits
are kept, for reasons best known to Donald Knuth). If that makes
almost no sense to you and you'd like to know more, the best solution
is to read Knuth's \emph{The \TeX book}, the \LaTeX\ source code, and the
\cmolddig package file. In case you're wondering, I don't understand
maths fount selection at all well, and I found out how to perform this
particular switching by asking on \newsgroup{comp.text.tex}.
The maths digit switching doesn't require the fount files that come
with this package: it uses the normal `real' Computer Modern founts
without needing any virtual fount trickery.
\subsection{Creating the \cmolddig virtual founts}
You don't need to do this job: all the useful files that this process
creates are part of the \cmolddig distribution. I've included this
section and the corresponding source files to satisfy the curiosity
of people who want to know how I did the deed.
The contents of the virtual founts used by \cmolddig are pretty
straightforward: rounding errors aside, they are identical to the
Computer Modern originals with normal lining digits in the text
founts replaced with old style digits from the appropriate maths italic
fount. These old style digits are upright despite living in an italic
fount; ask Dr Knuth if you want to know why. The job of creating them
was non-trivial only because of certain eccentricities of
\packname{fontinst} and the equally eccentric encodings used by Donald
Knuth in his original Computer Modern family of founts.
I used \packname{fontinst} to help create the virtual founts used by
this package; \packname{fontinst} is a set of \TeX\ macros available
from CTAN: it'll run on any computer with a functioning \TeX\ on it.
To create the virtual founts the way I did, you need to install
\packname{fontinst}, and use the files in \cmolddig's
\filename{source} directory by following the instructions below. You
also need \packname{tftopl} and \packname{vptovf} which should be part
of your \TeX\ system.
Some of the files used to create the virtual founts at the heart of
this package have names that break the `8+3' filename limit imposed by
some archaic operating systems. Apologies for this; it's just the way
they turned out, and I didn't notice until it was far too late.%
\footnote{The computer I use now has a file system that dates back to
1984; it has a 31 character filename limit} Since there's no
\emph{need} to use the source files, I thought it'd be okay not to
fix this.
You'll need to use \filename{tftopl} to create the following
\filename{pl} files from the corresponding Computer Modern
\filename{tfm} files:
\begin{center}
\begin{tabular}{@{}>{\raggedright\small}p{\textwidth}@{}}
\filename{cmb10.pl}\\
\filename{cmbx10.pl},
\filename{cmbx12.pl},
\filename{cmbx5.pl},
\filename{cmbx6.pl},
\filename{cmbx7.pl},
\filename{cmbx8.pl},
\filename{cmbx9.pl}\\
\filename{cmcsc10.pl}\\
\filename{cmmi10.pl},
\filename{cmmi12.pl},
\filename{cmmi5.pl},
\filename{cmmi6.pl},
\filename{cmmi7.pl},
\filename{cmmi8.pl},
\filename{cmmi9.pl}\\
\filename{cmmib10.pl},
\filename{cmmib5.pl},
\filename{cmmib6.pl},
\filename{cmmib7.pl},
\filename{cmmib8.pl},
\filename{cmmib9.pl}\\
\filename{cmr10.pl},
\filename{cmr12.pl},
\filename{cmr17.pl},
\filename{cmr5.pl},
\filename{cmr6.pl},
\filename{cmr7.pl},
\filename{cmr8.pl},
\filename{cmr9.pl}\\
\end{tabular}
\end{center}
If you have access to the AMS extra founts, you'll also need:
\begin{center}
\begin{tabular}{@{}>{\raggedright\small}p{\textwidth}@{}}
\filename{cmcsc8.pl},
\filename{cmcsc9.pl}
\end{tabular}
\end{center}
The \filename{source} directory contains these five files:
\begin{center}
\begin{tabular}{@{}p{\textwidth}@{}}
\filename{dostretch.mtx}\\
\filename{instcmrj.tex}\\
\filename{ot1noflig.etx}, \filename{ot1nofligcj.etx}, \filename{ot1nofligj.etx}
\end{tabular}
\end{center}
Put these five source files in a directory with the \filename{pl}
files listed above. If you don't have the AMS extra founts, edit
\filename{instcmrj.tex} and comment out the lines referring to cmcscj9
and cmcscj8.
Then run Plain \TeX\ on \filename{instcmrj.tex}. The result of this
run will be a huge pile of files: run \packname{vptovf} on the files
ending in \filename{vpl} (virtual property list; human-readable
precursors to a machine-readable \filename{tfm}/\filename{vf} pair).
The resulting \filename{tfm} and \filename{vf} files are the files
that do the trick. The \filename{fd} file created by
\packname{fontinst} isn't particularly useful to begin with: compare
it to the one supplied with \cmolddig to see what modifications I felt
were needed.
You can throw away the debris now if you like: all the files
(\filename{mtx}, \filename{pl}, and \filename{fd}) that have been
worked with except the five files from \cmolddig's \filename{source}
directory are machine-generated so you don't need to keep them.
\subsubsection{So how does it work?}
You really ought to understand \LaTeX\ founts and \packname{fontinst}
to an extent before reading this section.
The \packname{fontinst}
file that does the work contains lines like this:
{\small
\begin{verbatim}
\installfont{cmrj10}{cmr10,kernoff,cmmi10,kernon,dostretch}{OT1j}
{OT1}{cmrj}{m}{n}{<10> <10.95>}
\end{verbatim}
}
The last 5 arguments (on the second line) are just the NFSS
parameters used in the \filename{fd} file that's created by
\packname{fontinst} for this installation. The interesting bit is
the first line: cmrj10 is the (virtual) fount about to be created.
In this case, the glyphs are taken from cmr10 and cmmi10
(\packname{fontinst} converts the \filename{pl} files to
\filename{mtx} files before it does anything with them).
The file \filename{kernoff.mtx} tells \packname{fontinst} to ignore
kerning information from subsequent founts: this ensures that the
newly created fount has kerning from cmr10 only. This is important,
since maths fount kerning is entirely unsuitable for text. The file
\filename{kernon.mtx} tells \packname{fontinst} to take notice of
kerning again. It's redundant, since no kerning information is held in
\filename{dostretch.mtx}, but kept there just for the sake of
neatness. So: kerning information is taken from cmr10, not from
cmmi10.
The file \filename{dostretch.mtx} tells \packname{fontinst} to take
the new virtual fount's spacing parameters from those that have been
set by the first fount read -- in other words, to take spacing from
cmr10 in this case. The third argument is the encoding file used to
build the fount: in this case, it's OT1j; that's OT1 encoding with old
style digits. Rather than using the glyphs called `one', `two',
`three', and so on, this \filename{mtx} file ensures that the glyphs
called `oneoldstyle', `twooldstyle', `threeoldstyle' are used instead.
The `oldstyle' digit glyphs are kept in the cmmi founts.
Some of these installation lines ask for the final encoding
OT1NOFLIGj. This calls \filename{ot1nofligj.etx}, which in turn calls
\filename{ot1noflig.etx}; this last file is a new encoding file I
wrote for use with \packname{fontinst v1.8}. It defines the
\textsc{tex text without f-ligatures} encoding, used in cmr5 and the
caps and small caps founts.
\end{document}
|