summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/mathcomp/mathcomp.dtx
blob: 28484f17a967f90b7297df914283284f0125b7c1 (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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
% \iffalse
%
%% File `mathcomp.dtx'.
%% Copyright (C) 1996-2001 Tilmann B{\"o}{\ss}.
%% This program can be 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 any later version.
%
%% Please mail suggestions, enhancements ... to the author.
%
% \fi

% ^^A  don't forget to update \mathcompversion + \mathcompdate below
\def\fileversion{v0.1f}
\def\filedate{2001/01/07}

%
% \changes{0.1a}{1996/10/07}{first usable version}
% \changes{0.1b}{1996/10/08}{documentation added}
% \changes{0.1c}{1996/10/09}{better documentation}
% \changes{0.1d}{1997/06/12}{added style options to change font family}
% \changes{0.1e}{1998/08/27}{corrected \texttt{\symbol{92}mathalpha} to \texttt{\symbol{92}mathord}}
% \changes{0.1f}{2001/01/07}{protected against bold mathversion being undefined (WaS)}
% \changes{0.1f}{2001/01/07}{added \texttt{\symbol{92}tcdegree} and \texttt{\symbol{92}tccelsius} (WaS)}
% \changes{0.1f}{2001/01/07}{fixed \texttt{\symbol{92}dagger} and \texttt{\symbol{92}ddagger} (WaS)}
% \CheckSum{64}
%
% \iffalse
%<*driver>
\def\mathcompversion{v0.1f}	 %  version of this file, not of textcomp!
\def\mathcompdate{2001/01/07}	 %  date of this file, not of textcomp!
\def\textcomp{\textsf{textcomp}}
\def\mathcomp{\textsf{mathcomp}}
\def\TSone{\textsf{TS1}}
\documentclass{ltxdoc}
\usepackage{textcomp, mathcomp}
\RecordChanges
\setlength{\parindent}{0pt}
\setlength{\parskip}{3pt plus1pt minus1pt}
\begin{document}
 \title{The \mathcomp\ package for using Text Companion fonts in math
	mode
	\thanks{Preliminary version \mathcompversion}}
 \author{Tilmann B{\"o}{\ss}\\ \texttt{tboess@t-online.de}}
 \date{\mathcompdate}
 \maketitle
 \DocInput{mathcomp.dtx} \PrintChanges
\end{document}
%</driver>
% \fi
%
% \section{Purpose}
%
% It always bothered me that I had to write the unit `$\mu$m' with an italic
% `$\mu$'.
% There is a `\textmu' 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 \LaTeXe.
% 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:
%
% \begin{center}
% \begin{tabular}{ll@{\qquad}ll}
% |$\tcohm$| & $\tcohm$ & |$\tcperthousand$| & $\tcperthousand$ \\
% |$\tccelsius$| & $\tccelsius$ & |$\tcpertenthousand$|
% & $\tcpertenthousand$ \\
% |$\tcmu$| & $\tcmu$ & |$\tcdegree$| & $\tcdegree$\\
% |$\tcdigitoldstyle{0}$| & $\tcdigitoldstyle{0}$ \dots & 
% |$\tcdigitoldstyle{9}$| & $\tcdigitoldstyle{9}$ \\
% \end{tabular}
% \end{center}
% The names for the symbols are the same as in the \textcomp\ package except
% that you have to type \texttt{\bslash tc\textit{symbol-name}} instead of
% \texttt{\bslash text\textit{symbol-name}}.
% The oldstyle digits are defined in a different way, see section~\ref{s:code}.
% |\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\footnote{Ver.~1.4, 1995/12/11} by Sebastian Rahtz.
% This package is required because I didn't want to declare the font encoding
% \TSone\ once again.
%
% The \mathcomp\ package is preliminary because both the \TSone\ encoding and the
% \textcomp\ package might change in the future.
%
% \StopEventually{}
%
% \section{The code}\label{s:code}
%
% The code is quite simple, short and obvious so there is not much to say.
% The package is announced (but not too loudly).
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{mathcomp}[\filedate\space\fileversion\space(TBo)]
%    \end{macrocode}
%
% The \textcomp\ package is loaded to define the \TSone\ encoding.
%    \begin{macrocode}
\RequirePackage{textcomp}
%    \end{macrocode}
%
% The new symbol font |TS1/cmr/m/n| is declared under the name \texttt{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\footnote{Thanks to Walter Schmidt for this fix and the other
% improvements in version 0.1f.}.
%    \begin{macrocode}
\DeclareSymbolFont{TC}{TS1}{cmr}{m}{n}
\ifx\mv@bold\@undefined\else
  \SetSymbolFont{TC}{bold}{TS1}{cmr}{bx}{n}
\fi  
%    \end{macrocode}
%
% The package option |rmdefault| overwrites these declarations with the
% document's roman font family.
%
%    \begin{macrocode}
\DeclareOption{rmdefault}{
\DeclareSymbolFont{TC}{TS1}{\rmdefault}{m}{n}
\ifx\mv@bold\@undefined\else
  \SetSymbolFont{TC}{bold}{TS1}{\rmdefault}{bx}{n}
\fi
}
%    \end{macrocode}
%
% Any other package option overwrites the font declarations with the font family
% given.
%
%    \begin{macrocode}
\DeclareOption*{
\DeclareSymbolFont{TC}{TS1}{\CurrentOption}{m}{n}
\ifx\mv@bold\@undefined\else
  \SetSymbolFont{TC}{bold}{TS1}{\CurrentOption}{bx}{n}
\fi  
}
%    \end{macrocode}
%
% The symbol alphabet for the oldstyle digits is declared:
%    \begin{macrocode}
\DeclareSymbolFontAlphabet{\tcdigitoldstyle}{TC}
%    \end{macrocode}
%
% Finally, the extra symbols\footnote{Thanks to D.~Arsenau who found
% the error that was corrected in version 0.1e.} are defined.
%    \begin{macrocode}
\DeclareMathSymbol{\tcohm}{\mathord}{TC}{'127}
\DeclareMathSymbol{\tcperthousand}{\mathord}{TC}{'207}
\DeclareMathSymbol{\tccelsius}{\mathord}{TC}{'211}
\let\tccentigrade=\tccelsius
\DeclareMathSymbol{\tcdegree}{\mathord}{TC}{176}
\DeclareMathSymbol{\tcpertenthousand}{\mathord}{TC}{'230}
\DeclareMathSymbol{\tcmu}{\mathord}{TC}{'265}
\DeclareMathSymbol{\dagger}{\mathbin}{TC}{132}
\DeclareMathSymbol{\ddagger}{\mathbin}{TC}{133}

%    \end{macrocode}
%
% And the package options are processed.
%
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
%
% \Finale
\endinput