OpenCores
URL https://opencores.org/ocsvn/avs_aes/avs_aes/trunk

Subversion Repositories avs_aes

[/] [avs_aes/] [trunk/] [doc/] [manual/] [src/] [sfmath.sty] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 ruschi
% sfmath.sty by Olaf Dietrich (olaf@dtrx.de)
2
 
3
\NeedsTeXFormat{LaTeX2e}
4
\ProvidesPackage{sfmath}[2005/04/05 v0.7 sans serif maths]
5
 
6
 
7
% This is a simple package for sans serif maths in documents.
8
%
9
% Usage: \usepackage{sfmath} or \usepackage[OPTIONS]{sfmath}
10
%
11
% OPTIONS are
12
%
13
% * slantedGreek: for slanted uppercase Greek letters
14
%
15
% * cm: use Computer Modern (cmss) for maths (explicitly)
16
% * lm: use Latin Modern (lmss) for maths (explicitly) (+)
17
% * helvet: use Postscript Helvetica (phv) for maths (explicitly)
18
% * cmbright: use CM-Bright fonts (cmbr) for maths (explicitely)
19
% * tx: use Postscript txfonts (tx) for maths (explicitly)
20
% * px: use Postscript pxfonts (tx) for maths (explicitly)
21
%
22
% * T1experimental: use T1 font encoding for standard maths (+)
23
% * AlphT1experimental: use T1 font encoding for \math*{...} commands (+)
24
%
25
% * mathrmOrig: do not change the behavior of the \mathrm command
26
% * mathbfOrig: do not change the behavior of the \mathbf command
27
% * mathitOrig: do not change the behavior of the \mathit command
28
% * mathsfOrig: do not change the behavior of the \mathsf command
29
%
30
%
31
% This package should work with pdflatex and produce documents
32
% with Postscript Type 1 Fonts. If \sfdefault is changed by a
33
% package like pslatex.sty, times.sty (obsolete), or helvet.sty or manually,
34
% then include sfmath.sty _after_ having changed \sfdefault.
35
% Alternatively, select the desired sans serif font with the
36
% package options helvet or cm.
37
%
38
% Functionality is limited by the intention to work without additionally
39
% defined (virtual) fonts; instead, only standard fonts are used.
40
%
41
% (+): Options marked with (+) are experimental. Known limitations:
42
%      T1experimental produces a warning about the encoding of the
43
%                     operators font.
44
%      AlphT1experimental DOES NOT WORK with uppercase Greek letters
45
%                      within the \math*{...} command!
46
%      These options should only be used with the ec fonts.
47
%
48
%      lm includes T1experimental and AlphT1experimental with the limitations
49
%      mentioned above
50
%
51
%      RECOMMENDATION: use the fix-cm package instead of the experimental
52
%                      T1 options: with fix-cm.sty, the chosen ec fonts
53
%                      harmonize much better with the cm sans serif math fonts.
54
%                      Add \RequirePackage{fix-cm} _before_ \documentclass{...}.
55
 
56
 
57
 
58
% CHANGES:
59
%
60
% v0.7:
61
%
62
% * Add (experimental) support for latin modern (lmodern) fonts.
63
%
64
%
65
% v0.6:
66
%
67
% * Add some artificial intelligence to use slanted bold letters
68
%   if available (e.g., for phv, txfonts, or pxfonts).
69
%   Add options to select txfonts, pxfonts, and cmbright (probably
70
%   not very useful) explicitely.
71
%   (Thanks to Alberto Lusiani who asked for slanted bold letters.)
72
%
73
%
74
% v0.5:
75
%
76
% * Add experimental options for T1 font encoding of maths fonts.
77
%   Using these options can be useful with ec fonts which look
78
%   slightly different from the standard cm maths fonts (especially
79
%   at large font size). About limitations see above.
80
%
81
%
82
% v0.4:
83
%
84
% * Add \upDelta, \upOmega command (to be a little more compatible
85
%   with other packages that provide the slantedGreek option)
86
%
87
%
88
% v0.3:
89
%
90
% * Add sans serif shapes for "," and ".", "\ldotp"
91
%
92
% * Modified documentation
93
%
94
%
95
% v0.2:
96
%
97
% * New option slantedGreek for slanted greek capitals
98
%
99
% * Options helvet and cm to select explicitly the sans serif font
100
%   for maths. Without any of these options, the current \sfdefault
101
%   is chosen.
102
%
103
% * Options mathxxOrig: don't change the alphabet command \mathxx;
104
%   available for \mathrm, \mathbf, \mathit, and \mathsf
105
%
106
% * Provide dotlessi and dotlessj (if available)
107
%
108
 
109
 
110
% BUGS/LIMITATIONS/PROBLEMS:
111
%
112
% * The font metrics are not adjusted to maths usage (this may result in
113
%   typographically unsatisfying results).
114
%
115
% * In many constellations with Postscript fonts (helvet.sty,
116
%   pslatex.sty, ...) the upper-case greek letters are not chosen
117
%   correctly within \mathrm, \mathbf, \mathit, ... (because
118
%   they should be part of OT1-encoded fonts but are not included
119
%   in these standard postscript fonts).
120
%
121
% * Bold math symbols are not always available (e.g. with pslatex.sty)
122
%   or at least not slanted (e.g. with cmss fonts), so better don't
123
%   use bold maths with this package. (This has been partially improved
124
%   in version 0.6.)
125
%
126
% * There is a visual difference between the ec sans serif text fonts
127
%   and the cm sans serif maths fonts, especially at larger font sizes.
128
%   The fix-cm package might help to reduce the ugliness of the ec
129
%   sans serif fonts and the differences between the ec text fonts
130
%   and the cm math fonts.
131
%   Alternatively, the experimental options T1experimental and
132
%   AlphT1Experimental might help by using the ec fonts for maths as well.
133
%
134
% * The txfonts and pxfonts are reported to have several deficiencies
135
%   with respect to font metrics and macro implementation; using
136
%   these fonts is not recommended by the package author.
137
%
138
% * The set symbols \mathbb{N} or \mathbbm{N} (from bbm.sty) are not
139
%   changed. You might like to use \mathbbmss{N} (from bbm.sty).
140
%
141
% * Some symbols have serifish shapes (\sum, \prod, probably more) and
142
%   are not changed.
143
%
144
% * Lower-case greek letters are not available in sans serif shape
145
%   (they don't have real serifs, but cannot be expected to harmonize
146
%   with the sans serif latin letters).
147
%
148
% * Is this the Right Way to do it? Or would it be preferable to define
149
%   one or two new math _versions_ (sans, sansbold), such that formulas
150
%   are switched to sans by \mathversion{sans}?
151
%
152
% * New virtual fonts for maths would be a more complicated but
153
%   better solution.
154
%
155
 
156
 
157
 
158
% HERE WE GO:
159
 
160
% Declare options and defaults and process options
161
 
162
\DeclareOption{slantedGreek}{%
163
  \renewcommand{\greek@shape}{sl}%
164
  \renewcommand{\greek@bold@shape}{\greek@bold@sl}%
165
}
166
 
167
\DeclareOption{cm}{\renewcommand{\math@sfdefault}{cmss}}
168
\DeclareOption{lm}{\renewcommand{\math@sfdefault}{lmss}}
169
\DeclareOption{helvet}{\renewcommand{\math@sfdefault}{phv}}
170
\DeclareOption{cmbright}{\renewcommand{\math@sfdefault}{cmbr}}
171
\DeclareOption{tx}{\renewcommand{\math@sfdefault}{txss}}
172
\DeclareOption{px}{\renewcommand{\math@sfdefault}{pxss}}
173
 
174
\DeclareOption{T1experimental}{\renewcommand{\math@encoding}{T1}}
175
\DeclareOption{AlphT1experimental}{\renewcommand{\math@lph@encoding}{T1}}
176
 
177
\DeclareOption{mathrmOrig}{\renewcommand{\mathrm@lph}{cmr}}
178
\DeclareOption{mathbfOrig}{\renewcommand{\mathbf@lph}{cmr}}
179
\DeclareOption{mathitOrig}{\renewcommand{\mathit@lph}{cmr}}
180
\DeclareOption{mathsfOrig}{\renewcommand{\mathsf@lph}{cmss}}
181
 
182
 
183
\newcommand{\math@sfdefault}{\sfdefault}
184
\newcommand{\math@encoding}{OT1}
185
\newcommand{\math@lph@encoding}{OT1}
186
 
187
\newcommand{\mathrm@lph}{\math@sfdefault}
188
\newcommand{\mathbf@lph}{\math@sfdefault}
189
\newcommand{\mathit@lph}{\math@sfdefault}
190
\newcommand{\mathsf@lph}{\math@sfdefault}
191
 
192
 
193
% \math@sfGreek: Font for capital greeks: cmss or other?
194
% \greek@shape: Capital greeks: normal or slanted? [slantedGreek]
195
% \greek@bold@shape: Bold capital greeks: normal or slanted? [slantedGreek]
196
% \greek@bold@sl: Bold capital greeks: "sl" if slanted possible
197
%
198
% \mathnormal@bold@shape: Bold letters: normal or slanted? (always bold)
199
% \mathit@bold@series: Bold \mathit (\mathsl): medium or bold? (always slanted)
200
 
201
\newcommand{\math@sfGreek}{cmss}
202
\newcommand{\greek@shape}{n}
203
\newcommand{\greek@bold@shape}{n}
204
\newcommand{\greek@bold@sl}{n}
205
\newcommand{\mathnormal@bold@shape}{n}
206
\newcommand{\mathit@bold@series}{m}
207
 
208
 
209
 
210
\ProcessOptions
211
 
212
 
213
 
214
% check the current value of \math@sfdefault
215
 
216
\edef\tmp@sfdefault{\math@sfdefault}
217
 
218
\def\tmp@compare{cmss}
219
\ifx\tmp@sfdefault\tmp@compare
220
  % \sfdefault is cmss
221
  % no slanted bold letters
222
  % no slanted bold capital Greeks
223
  \renewcommand{\math@sfGreek}{cmss}
224
  \renewcommand{\greek@bold@sl}{n}
225
  \renewcommand{\mathnormal@bold@shape}{n}
226
  \renewcommand{\mathit@bold@series}{m}
227
\fi
228
 
229
\def\tmp@compare{phv}
230
\ifx\tmp@sfdefault\tmp@compare
231
  % \sfdefault is phv (helvet.sty)
232
  % slanted bold letters
233
  % no capital Greeks
234
  \renewcommand{\math@sfGreek}{cmss}
235
  \renewcommand{\greek@bold@sl}{n}
236
  \renewcommand{\mathnormal@bold@shape}{sl}
237
  \renewcommand{\mathit@bold@series}{bx}
238
\fi
239
 
240
\def\tmp@compare{txss}
241
\ifx\tmp@sfdefault\tmp@compare
242
  % \sfdefault is txss (txfonts.sty)
243
  % slanted bold letters
244
  % slanted bold capital Greeks
245
  \renewcommand{\math@sfGreek}{txss}
246
  \renewcommand{\greek@bold@sl}{sl}
247
  \renewcommand{\mathnormal@bold@shape}{sl}
248
  \renewcommand{\mathit@bold@series}{bx}
249
\fi
250
 
251
\def\tmp@compare{pxss}
252
\ifx\tmp@sfdefault\tmp@compare
253
  % \sfdefault is pxss (pxfonts.sty)
254
  % slanted bold letters
255
  % slanted bold capital Greeks
256
  \renewcommand{\math@sfGreek}{pxss}
257
  \renewcommand{\greek@bold@sl}{sl}
258
  \renewcommand{\mathnormal@bold@shape}{sl}
259
  \renewcommand{\mathit@bold@series}{bx}
260
\fi
261
 
262
\def\tmp@compare{cmbr}
263
\ifx\tmp@sfdefault\tmp@compare
264
  % \sfdefault is cmbr (cmbright.sty)
265
  % no slanted bold letters
266
  % no slanted bold capital Greeks
267
  \renewcommand{\math@sfGreek}{cmbr}
268
  \renewcommand{\greek@bold@sl}{n}
269
  \renewcommand{\mathnormal@bold@shape}{n}
270
  \renewcommand{\mathit@bold@series}{m}
271
\fi
272
 
273
\def\tmp@compare{lmss}
274
\ifx\tmp@sfdefault\tmp@compare
275
  % \sfdefault is lmss (lmodern.sty sans serif)
276
  % T1 encoding only
277
  % slanted bold letters
278
  % no slanted bold capital Greeks
279
  \renewcommand{\math@encoding}{T1}
280
  \renewcommand{\math@lph@encoding}{T1}
281
  \renewcommand{\math@sfGreek}{cmss}
282
  \renewcommand{\greek@bold@sl}{n}
283
  \renewcommand{\mathnormal@bold@shape}{sl}
284
  \renewcommand{\mathit@bold@series}{bx}
285
\fi
286
 
287
 
288
 
289
% Change font for digits and "operators" (\sin, \exp, ...)
290
% to default sans serif font
291
 
292
\SetSymbolFont{operators}{normal}{\math@encoding}{\math@sfdefault}{m}{n}
293
\SetSymbolFont{operators}{bold}{\math@encoding}{\math@sfdefault}{bx}{n}
294
 
295
 
296
% Most special math symbols remain unmodified (and many of those
297
% don't have serifs); however all letters (A-Z, a-z) are
298
% explicitely changed to the sans serif version (again
299
% default sans serif font).
300
%
301
% Unfortunately, there is no standard slanted+bold sans serif font
302
% available (as Postscript Type 1 font), so try an upright
303
% version (may be better than nothing).
304
 
305
\DeclareSymbolFont{SFMath}{\math@encoding}{\math@sfdefault}{m}{sl}
306
\SetSymbolFont{SFMath}{normal}{\math@encoding}{\math@sfdefault}{m}{sl}
307
\SetSymbolFont{SFMath}{bold}{\math@encoding}{\math@sfdefault}{bx}{\mathnormal@bold@shape}
308
\DeclareMathSymbol{A}{\mathalpha}{SFMath}{`A}
309
\DeclareMathSymbol{B}{\mathalpha}{SFMath}{`B}
310
\DeclareMathSymbol{C}{\mathalpha}{SFMath}{`C}
311
\DeclareMathSymbol{D}{\mathalpha}{SFMath}{`D}
312
\DeclareMathSymbol{E}{\mathalpha}{SFMath}{`E}
313
\DeclareMathSymbol{F}{\mathalpha}{SFMath}{`F}
314
\DeclareMathSymbol{G}{\mathalpha}{SFMath}{`G}
315
\DeclareMathSymbol{H}{\mathalpha}{SFMath}{`H}
316
\DeclareMathSymbol{I}{\mathalpha}{SFMath}{`I}
317
\DeclareMathSymbol{J}{\mathalpha}{SFMath}{`J}
318
\DeclareMathSymbol{K}{\mathalpha}{SFMath}{`K}
319
\DeclareMathSymbol{L}{\mathalpha}{SFMath}{`L}
320
\DeclareMathSymbol{M}{\mathalpha}{SFMath}{`M}
321
\DeclareMathSymbol{N}{\mathalpha}{SFMath}{`N}
322
\DeclareMathSymbol{O}{\mathalpha}{SFMath}{`O}
323
\DeclareMathSymbol{P}{\mathalpha}{SFMath}{`P}
324
\DeclareMathSymbol{Q}{\mathalpha}{SFMath}{`Q}
325
\DeclareMathSymbol{R}{\mathalpha}{SFMath}{`R}
326
\DeclareMathSymbol{S}{\mathalpha}{SFMath}{`S}
327
\DeclareMathSymbol{T}{\mathalpha}{SFMath}{`T}
328
\DeclareMathSymbol{U}{\mathalpha}{SFMath}{`U}
329
\DeclareMathSymbol{V}{\mathalpha}{SFMath}{`V}
330
\DeclareMathSymbol{W}{\mathalpha}{SFMath}{`W}
331
\DeclareMathSymbol{X}{\mathalpha}{SFMath}{`X}
332
\DeclareMathSymbol{Y}{\mathalpha}{SFMath}{`Y}
333
\DeclareMathSymbol{Z}{\mathalpha}{SFMath}{`Z}
334
\DeclareMathSymbol{a}{\mathalpha}{SFMath}{`a}
335
\DeclareMathSymbol{b}{\mathalpha}{SFMath}{`b}
336
\DeclareMathSymbol{c}{\mathalpha}{SFMath}{`c}
337
\DeclareMathSymbol{d}{\mathalpha}{SFMath}{`d}
338
\DeclareMathSymbol{e}{\mathalpha}{SFMath}{`e}
339
\DeclareMathSymbol{f}{\mathalpha}{SFMath}{`f}
340
\DeclareMathSymbol{g}{\mathalpha}{SFMath}{`g}
341
\DeclareMathSymbol{h}{\mathalpha}{SFMath}{`h}
342
\DeclareMathSymbol{i}{\mathalpha}{SFMath}{`i}
343
\DeclareMathSymbol{j}{\mathalpha}{SFMath}{`j}
344
\DeclareMathSymbol{k}{\mathalpha}{SFMath}{`k}
345
\DeclareMathSymbol{l}{\mathalpha}{SFMath}{`l}
346
\DeclareMathSymbol{m}{\mathalpha}{SFMath}{`m}
347
\DeclareMathSymbol{n}{\mathalpha}{SFMath}{`n}
348
\DeclareMathSymbol{o}{\mathalpha}{SFMath}{`o}
349
\DeclareMathSymbol{p}{\mathalpha}{SFMath}{`p}
350
\DeclareMathSymbol{q}{\mathalpha}{SFMath}{`q}
351
\DeclareMathSymbol{r}{\mathalpha}{SFMath}{`r}
352
\DeclareMathSymbol{s}{\mathalpha}{SFMath}{`s}
353
\DeclareMathSymbol{t}{\mathalpha}{SFMath}{`t}
354
\DeclareMathSymbol{u}{\mathalpha}{SFMath}{`u}
355
\DeclareMathSymbol{v}{\mathalpha}{SFMath}{`v}
356
\DeclareMathSymbol{w}{\mathalpha}{SFMath}{`w}
357
\DeclareMathSymbol{x}{\mathalpha}{SFMath}{`x}
358
\DeclareMathSymbol{y}{\mathalpha}{SFMath}{`y}
359
\DeclareMathSymbol{z}{\mathalpha}{SFMath}{`z}
360
 
361
\DeclareMathSymbol{\imath}{\mathalpha}{SFMath}{"10}
362
\DeclareMathSymbol{\jmath}{\mathalpha}{SFMath}{"11}
363
 
364
 
365
% The symbols ",", ".", and "\ldotp" should be sans serif
366
% but upright.
367
 
368
\DeclareSymbolFont{SFMathUp}{\math@encoding}{\math@sfdefault}{m}{n}
369
\SetSymbolFont{SFMathUp}{normal}{\math@encoding}{\math@sfdefault}{m}{n}
370
\SetSymbolFont{SFMathUp}{bold}{\math@encoding}{\math@sfdefault}{bx}{n}
371
\DeclareMathSymbol{,}{\mathpunct}{SFMathUp}{`,}
372
\DeclareMathSymbol{.}{\mathord}{SFMathUp}{`.}
373
\DeclareMathSymbol{\ldotp}{\mathord}{SFMathUp}{`.}
374
 
375
 
376
% Take capital greek letters from cmss or [tp]xss; other sans serif fonts
377
% like helvetica don't have capital greeks, so here cmss is
378
% taken instead of \sfdefault. Unfortunately, this does not work
379
% within the alphabet commands \mathrm, \mathsf, ...
380
 
381
\DeclareSymbolFont{SFMathGreek}{OT1}{\math@sfGreek}{m}{\greek@shape}
382
\SetSymbolFont{SFMathGreek}{normal}{OT1}{\math@sfGreek}{m}{\greek@shape}
383
\SetSymbolFont{SFMathGreek}{bold}{OT1}{\math@sfGreek}{bx}{\greek@bold@shape}
384
 
385
\DeclareMathSymbol{\Gamma}{\mathalpha}{SFMathGreek}{"00}
386
\DeclareMathSymbol{\Delta}{\mathalpha}{SFMathGreek}{"01}
387
\DeclareMathSymbol{\Theta}{\mathalpha}{SFMathGreek}{"02}
388
\DeclareMathSymbol{\Lambda}{\mathalpha}{SFMathGreek}{"03}
389
\DeclareMathSymbol{\Xi}{\mathalpha}{SFMathGreek}{"04}
390
\DeclareMathSymbol{\Pi}{\mathalpha}{SFMathGreek}{"05}
391
\DeclareMathSymbol{\Sigma}{\mathalpha}{SFMathGreek}{"06}
392
\DeclareMathSymbol{\Upsilon}{\mathalpha}{SFMathGreek}{"07}
393
\DeclareMathSymbol{\Phi}{\mathalpha}{SFMathGreek}{"08}
394
\DeclareMathSymbol{\Psi}{\mathalpha}{SFMathGreek}{"09}
395
\DeclareMathSymbol{\Omega}{\mathalpha}{SFMathGreek}{"0A}
396
 
397
 
398
\DeclareSymbolFont{SFMathUpGreek}{OT1}{\math@sfGreek}{m}{n}
399
\SetSymbolFont{SFMathUpGreek}{normal}{OT1}{\math@sfGreek}{m}{n}
400
\SetSymbolFont{SFMathUpGreek}{bold}{OT1}{\math@sfGreek}{bx}{n}
401
 
402
\DeclareMathSymbol{\upDelta}{\mathalpha}{SFMathUpGreek}{"01}
403
\DeclareMathSymbol{\upOmega}{\mathalpha}{SFMathUpGreek}{"0A}
404
 
405
 
406
% Define new behavior for math alphabet commands
407
 
408
 
409
\SetMathAlphabet{\mathnormal}{normal}{\math@lph@encoding}{\math@sfdefault}{m}{sl}
410
\SetMathAlphabet{\mathnormal}{bold}{\math@lph@encoding}{\math@sfdefault}{bx}{\mathnormal@bold@shape}
411
 
412
\SetMathAlphabet{\mathrm}{normal}{\math@lph@encoding}{\mathrm@lph}{m}{n}
413
\SetMathAlphabet{\mathrm}{bold}{\math@lph@encoding}{\mathrm@lph}{bx}{n}
414
 
415
\SetMathAlphabet{\mathbf}{normal}{\math@lph@encoding}{\mathbf@lph}{bx}{n}
416
\SetMathAlphabet{\mathbf}{bold}{\math@lph@encoding}{\mathbf@lph}{bx}{n}
417
 
418
\SetMathAlphabet{\mathit}{normal}{\math@lph@encoding}{\mathit@lph}{m}{sl}
419
\SetMathAlphabet{\mathit}{bold}{\math@lph@encoding}{\mathit@lph}{\mathit@bold@series}{sl}
420
 
421
\SetMathAlphabet{\mathsf}{normal}{\math@lph@encoding}{\mathsf@lph}{m}{n}
422
\SetMathAlphabet{\mathsf}{bold}{\math@lph@encoding}{\mathsf@lph}{bx}{n}
423
 
424
 
425
 
426
% Define new math alphabet command \mathsl
427
 
428
\DeclareMathAlphabet{\mathsl}{\math@lph@encoding}{\math@sfdefault}{m}{sl}
429
\SetMathAlphabet{\mathsl}{bold}{\math@lph@encoding}{\math@sfdefault}{\mathit@bold@series}{sl}
430
 
431
 
432
\endinput

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.