The mathcomp package for using Text Companion fonts in math mode ^{∗}

Tilmann Böß

                   tboess@t-online.de

2001/01/07

1 Purpose

It always bothered me that I had to write the unit ‘μm’ with an italic ‘μ’. There is a ‘µ’ in the Text Companion (TC) fonts, and it’s available in most of the font families, shapes and series. The textcomp package provides access to the TC fonts from L^{A}TEX 2ε. But I wanted to use some of these fonts in math mode, so I decided to write a package to achieve this goal. Most of the characters don’t make sense in math mode or they are already present in the standard math fonts. The useful ones are:

     $\tcohm$  �  $\tcperthousand$  ‰
     $\tccelsius$  �  $\tcpertenthousand$  �
     $\tcmu$  µ  $\tcdegree$  °
     $\tcdigitoldstyle{0}$ 0 . . .  $\tcdigitoldstyle{9}$ 9

The names for the symbols are the same as in the textcomp package except that you have to type \tcsymbol-name instead of \textsymbol-name . The oldstyle digits are defined in a different way, see section 2. \tccelsius is also available with the name \tccentigrade, for the sake of compatibility with earlier versions of the textcomp and mathcomp packages. Additionally, the mathcomp package will redefine the macros \dagger and \ddagger so as to take their symbols from the text companion fonts, thus also making sure that the symbols produced by \fnsymbol will always match the text font family. The extra math symbols are made available for math versions ‘normal’ and ‘bold’, provided that a ‘bold’ math version is actually defined. The default behaviour of the mathcomp package is to use the text companion fonts from the font family CM Roman. Any other text font family can be specified as a package option; e.g., say \usepackage[ppl]{mathcomp} to make mathcomp use the Adobe Palatino (ppl) text companion fonts. The option rmdefault is special: It makes the mathcomp package load the particular font family which has been chosen as the default roman font family (\rmdefault) for the document, whatever it is. The package is based on the textcomp package^{1} by Sebastian Rahtz. This package is required because I didn’t want to declare the font encoding TS1 once again. The mathcomp package is preliminary because both the TS1 encoding and the textcomp package might change in the future.

∗Preliminary version v0.1f

2 The code

The code is quite simple, short and obvious so there is not much to say. The package is announced (but not too loudly).

 1 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
 2 \ProvidesPackage{mathcomp}[\filedate\space\fileversion\space(TBo)]

The textcomp package is loaded to define the TS1 encoding.

 3 \RequirePackage{textcomp}

The new symbol font TS1/cmr/m/n is declared under the name TC. It is the default font for all math versions. For the math version ‘bold’ TS1/cmr/bx/n is defined if bold math is available^{2}.

 4 \DeclareSymbolFont{TC}{TS1}{cmr}{m}{n}
 5 \ifx\mv@bold\@undefined\else
 6 \SetSymbolFont{TC}{bold}{TS1}{cmr}{bx}{n}
 7 \fi

The package option rmdefault overwrites these declarations with the document’s roman font family.

 8 \DeclareOption{rmdefault}{
 9 \DeclareSymbolFont{TC}{TS1}{\rmdefault}{m}{n}
10 \ifx\mv@bold\@undefined\else
11 \SetSymbolFont{TC}{bold}{TS1}{\rmdefault}{bx}{n}
12 \fi

13 }

Any other package option overwrites the font declarations with the font family given.

14 \DeclareOption*{
15 \DeclareSymbolFont{TC}{TS1}{\CurrentOption}{m}{n}
16 \ifx\mv@bold\@undefined\else
17 \SetSymbolFont{TC}{bold}{TS1}{\CurrentOption}{bx}{n}
18 \fi

19 }

The symbol alphabet for the oldstyle digits is declared:

20 \DeclareSymbolFontAlphabet{\tcdigitoldstyle}{TC}

1Ver. 1.4, 1995/12/11

2Thanks to Walter Schmidt for this fix and the other improvements in version 0.1f.

Finally, the extra symbols^{3} are defined.

21 \DeclareMathSymbol{\tcohm}{\mathord}{TC}{'127}
22 \DeclareMathSymbol{\tcperthousand}{\mathord}{TC}{'207}
23 \DeclareMathSymbol{\tccelsius}{\mathord}{TC}{'211}
24 \let\tccentigrade=\tccelsius
25 \DeclareMathSymbol{\tcdegree}{\mathord}{TC}{176}
26 \DeclareMathSymbol{\tcpertenthousand}{\mathord}{TC}{'230}
27 \DeclareMathSymbol{\tcmu}{\mathord}{TC}{'265}
28 \DeclareMathSymbol{\dagger}{\mathbin}{TC}{132}
29 \DeclareMathSymbol{\ddagger}{\mathbin}{TC}{133}

30

And the package options are processed.

31 \ProcessOptions

Change History

0.1a

General: first usable version . . . . . 1 0.1b

General: documentation added … 1 0.1c

General: better documentation … 1 0.1d

General: added style options to change font family . . . . . . . . . 1 0.1e

General: corrected \mathalpha to

\mathord . . . . . . . . . . . . . . . . 1 0.1f

General: added \tcdegree and \tccelsius (WaS) . . . . . . . . . 1

                                            fixed \dagger and \ddagger

(WaS) . . . . . . . . . . . . . . . . . . 1 protected against bold mathversion being undefined (WaS) … 1

3Thanks to D. Arsenau who found the error that was corrected in version 0.1e.