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

Subversion Repositories avs_aes

[/] [avs_aes/] [trunk/] [doc/] [manual/] [src/] [sfmath.sty] - Rev 11

Compare with Previous | Blame | View Log

% sfmath.sty by Olaf Dietrich (olaf@dtrx.de)

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sfmath}[2005/04/05 v0.7 sans serif maths]


% This is a simple package for sans serif maths in documents.
%
% Usage: \usepackage{sfmath} or \usepackage[OPTIONS]{sfmath}
%
% OPTIONS are
%
% * slantedGreek: for slanted uppercase Greek letters
%
% * cm: use Computer Modern (cmss) for maths (explicitly)
% * lm: use Latin Modern (lmss) for maths (explicitly) (+)
% * helvet: use Postscript Helvetica (phv) for maths (explicitly)
% * cmbright: use CM-Bright fonts (cmbr) for maths (explicitely)
% * tx: use Postscript txfonts (tx) for maths (explicitly)
% * px: use Postscript pxfonts (tx) for maths (explicitly)
%
% * T1experimental: use T1 font encoding for standard maths (+)
% * AlphT1experimental: use T1 font encoding for \math*{...} commands (+)
%
% * mathrmOrig: do not change the behavior of the \mathrm command
% * mathbfOrig: do not change the behavior of the \mathbf command
% * mathitOrig: do not change the behavior of the \mathit command
% * mathsfOrig: do not change the behavior of the \mathsf command
%
%
% This package should work with pdflatex and produce documents
% with Postscript Type 1 Fonts. If \sfdefault is changed by a
% package like pslatex.sty, times.sty (obsolete), or helvet.sty or manually,
% then include sfmath.sty _after_ having changed \sfdefault.
% Alternatively, select the desired sans serif font with the
% package options helvet or cm.
%
% Functionality is limited by the intention to work without additionally
% defined (virtual) fonts; instead, only standard fonts are used.
%
% (+): Options marked with (+) are experimental. Known limitations:
%      T1experimental produces a warning about the encoding of the
%                     operators font.
%      AlphT1experimental DOES NOT WORK with uppercase Greek letters
%                      within the \math*{...} command!
%      These options should only be used with the ec fonts.
%
%      lm includes T1experimental and AlphT1experimental with the limitations
%      mentioned above
%
%      RECOMMENDATION: use the fix-cm package instead of the experimental
%                      T1 options: with fix-cm.sty, the chosen ec fonts 
%                      harmonize much better with the cm sans serif math fonts.
%                      Add \RequirePackage{fix-cm} _before_ \documentclass{...}.



% CHANGES:
%
% v0.7:
%
% * Add (experimental) support for latin modern (lmodern) fonts.
%
%
% v0.6:
%
% * Add some artificial intelligence to use slanted bold letters
%   if available (e.g., for phv, txfonts, or pxfonts).
%   Add options to select txfonts, pxfonts, and cmbright (probably
%   not very useful) explicitely.
%   (Thanks to Alberto Lusiani who asked for slanted bold letters.)
%
%
% v0.5:
%
% * Add experimental options for T1 font encoding of maths fonts.
%   Using these options can be useful with ec fonts which look
%   slightly different from the standard cm maths fonts (especially
%   at large font size). About limitations see above.
%   
%
% v0.4:
%
% * Add \upDelta, \upOmega command (to be a little more compatible
%   with other packages that provide the slantedGreek option)
%
%
% v0.3:
%
% * Add sans serif shapes for "," and ".", "\ldotp"
%
% * Modified documentation
%
%
% v0.2:
%
% * New option slantedGreek for slanted greek capitals
%
% * Options helvet and cm to select explicitly the sans serif font
%   for maths. Without any of these options, the current \sfdefault
%   is chosen.
%
% * Options mathxxOrig: don't change the alphabet command \mathxx;
%   available for \mathrm, \mathbf, \mathit, and \mathsf
%
% * Provide dotlessi and dotlessj (if available)
%


% BUGS/LIMITATIONS/PROBLEMS:
%
% * The font metrics are not adjusted to maths usage (this may result in
%   typographically unsatisfying results).
%
% * In many constellations with Postscript fonts (helvet.sty,
%   pslatex.sty, ...) the upper-case greek letters are not chosen
%   correctly within \mathrm, \mathbf, \mathit, ... (because
%   they should be part of OT1-encoded fonts but are not included
%   in these standard postscript fonts).
%
% * Bold math symbols are not always available (e.g. with pslatex.sty)
%   or at least not slanted (e.g. with cmss fonts), so better don't
%   use bold maths with this package. (This has been partially improved
%   in version 0.6.)
%
% * There is a visual difference between the ec sans serif text fonts
%   and the cm sans serif maths fonts, especially at larger font sizes.
%   The fix-cm package might help to reduce the ugliness of the ec
%   sans serif fonts and the differences between the ec text fonts
%   and the cm math fonts.
%   Alternatively, the experimental options T1experimental and
%   AlphT1Experimental might help by using the ec fonts for maths as well.
%
% * The txfonts and pxfonts are reported to have several deficiencies
%   with respect to font metrics and macro implementation; using
%   these fonts is not recommended by the package author.
%
% * The set symbols \mathbb{N} or \mathbbm{N} (from bbm.sty) are not
%   changed. You might like to use \mathbbmss{N} (from bbm.sty).
%
% * Some symbols have serifish shapes (\sum, \prod, probably more) and
%   are not changed.
%
% * Lower-case greek letters are not available in sans serif shape
%   (they don't have real serifs, but cannot be expected to harmonize
%   with the sans serif latin letters).
%
% * Is this the Right Way to do it? Or would it be preferable to define
%   one or two new math _versions_ (sans, sansbold), such that formulas
%   are switched to sans by \mathversion{sans}?
%
% * New virtual fonts for maths would be a more complicated but
%   better solution.
%



% HERE WE GO:

% Declare options and defaults and process options

\DeclareOption{slantedGreek}{%
  \renewcommand{\greek@shape}{sl}%
  \renewcommand{\greek@bold@shape}{\greek@bold@sl}%
}

\DeclareOption{cm}{\renewcommand{\math@sfdefault}{cmss}}
\DeclareOption{lm}{\renewcommand{\math@sfdefault}{lmss}}
\DeclareOption{helvet}{\renewcommand{\math@sfdefault}{phv}}
\DeclareOption{cmbright}{\renewcommand{\math@sfdefault}{cmbr}}
\DeclareOption{tx}{\renewcommand{\math@sfdefault}{txss}}
\DeclareOption{px}{\renewcommand{\math@sfdefault}{pxss}}

\DeclareOption{T1experimental}{\renewcommand{\math@encoding}{T1}}
\DeclareOption{AlphT1experimental}{\renewcommand{\math@lph@encoding}{T1}}

\DeclareOption{mathrmOrig}{\renewcommand{\mathrm@lph}{cmr}}
\DeclareOption{mathbfOrig}{\renewcommand{\mathbf@lph}{cmr}}
\DeclareOption{mathitOrig}{\renewcommand{\mathit@lph}{cmr}}
\DeclareOption{mathsfOrig}{\renewcommand{\mathsf@lph}{cmss}}


\newcommand{\math@sfdefault}{\sfdefault}
\newcommand{\math@encoding}{OT1}
\newcommand{\math@lph@encoding}{OT1}

\newcommand{\mathrm@lph}{\math@sfdefault}
\newcommand{\mathbf@lph}{\math@sfdefault}
\newcommand{\mathit@lph}{\math@sfdefault}
\newcommand{\mathsf@lph}{\math@sfdefault}


% \math@sfGreek: Font for capital greeks: cmss or other?
% \greek@shape: Capital greeks: normal or slanted? [slantedGreek]
% \greek@bold@shape: Bold capital greeks: normal or slanted? [slantedGreek]
% \greek@bold@sl: Bold capital greeks: "sl" if slanted possible
%
% \mathnormal@bold@shape: Bold letters: normal or slanted? (always bold)
% \mathit@bold@series: Bold \mathit (\mathsl): medium or bold? (always slanted)

\newcommand{\math@sfGreek}{cmss}
\newcommand{\greek@shape}{n}
\newcommand{\greek@bold@shape}{n}
\newcommand{\greek@bold@sl}{n}
\newcommand{\mathnormal@bold@shape}{n}
\newcommand{\mathit@bold@series}{m}



\ProcessOptions



% check the current value of \math@sfdefault

\edef\tmp@sfdefault{\math@sfdefault}

\def\tmp@compare{cmss}
\ifx\tmp@sfdefault\tmp@compare
  % \sfdefault is cmss
  % no slanted bold letters
  % no slanted bold capital Greeks
  \renewcommand{\math@sfGreek}{cmss}
  \renewcommand{\greek@bold@sl}{n}
  \renewcommand{\mathnormal@bold@shape}{n}
  \renewcommand{\mathit@bold@series}{m}
\fi

\def\tmp@compare{phv}
\ifx\tmp@sfdefault\tmp@compare
  % \sfdefault is phv (helvet.sty)
  % slanted bold letters
  % no capital Greeks
  \renewcommand{\math@sfGreek}{cmss}
  \renewcommand{\greek@bold@sl}{n}
  \renewcommand{\mathnormal@bold@shape}{sl}
  \renewcommand{\mathit@bold@series}{bx}
\fi

\def\tmp@compare{txss}
\ifx\tmp@sfdefault\tmp@compare
  % \sfdefault is txss (txfonts.sty)
  % slanted bold letters
  % slanted bold capital Greeks
  \renewcommand{\math@sfGreek}{txss}
  \renewcommand{\greek@bold@sl}{sl}
  \renewcommand{\mathnormal@bold@shape}{sl}
  \renewcommand{\mathit@bold@series}{bx}
\fi

\def\tmp@compare{pxss}
\ifx\tmp@sfdefault\tmp@compare
  % \sfdefault is pxss (pxfonts.sty)
  % slanted bold letters
  % slanted bold capital Greeks
  \renewcommand{\math@sfGreek}{pxss}
  \renewcommand{\greek@bold@sl}{sl}
  \renewcommand{\mathnormal@bold@shape}{sl}
  \renewcommand{\mathit@bold@series}{bx}
\fi

\def\tmp@compare{cmbr}
\ifx\tmp@sfdefault\tmp@compare
  % \sfdefault is cmbr (cmbright.sty)
  % no slanted bold letters
  % no slanted bold capital Greeks
  \renewcommand{\math@sfGreek}{cmbr}
  \renewcommand{\greek@bold@sl}{n}
  \renewcommand{\mathnormal@bold@shape}{n}
  \renewcommand{\mathit@bold@series}{m}
\fi

\def\tmp@compare{lmss}
\ifx\tmp@sfdefault\tmp@compare
  % \sfdefault is lmss (lmodern.sty sans serif)
  % T1 encoding only
  % slanted bold letters
  % no slanted bold capital Greeks
  \renewcommand{\math@encoding}{T1}
  \renewcommand{\math@lph@encoding}{T1}
  \renewcommand{\math@sfGreek}{cmss}
  \renewcommand{\greek@bold@sl}{n}
  \renewcommand{\mathnormal@bold@shape}{sl}
  \renewcommand{\mathit@bold@series}{bx}
\fi



% Change font for digits and "operators" (\sin, \exp, ...)
% to default sans serif font

\SetSymbolFont{operators}{normal}{\math@encoding}{\math@sfdefault}{m}{n}
\SetSymbolFont{operators}{bold}{\math@encoding}{\math@sfdefault}{bx}{n}


% Most special math symbols remain unmodified (and many of those
% don't have serifs); however all letters (A-Z, a-z) are
% explicitely changed to the sans serif version (again
% default sans serif font).
%
% Unfortunately, there is no standard slanted+bold sans serif font
% available (as Postscript Type 1 font), so try an upright
% version (may be better than nothing).

\DeclareSymbolFont{SFMath}{\math@encoding}{\math@sfdefault}{m}{sl}
\SetSymbolFont{SFMath}{normal}{\math@encoding}{\math@sfdefault}{m}{sl}
\SetSymbolFont{SFMath}{bold}{\math@encoding}{\math@sfdefault}{bx}{\mathnormal@bold@shape}
\DeclareMathSymbol{A}{\mathalpha}{SFMath}{`A}
\DeclareMathSymbol{B}{\mathalpha}{SFMath}{`B}
\DeclareMathSymbol{C}{\mathalpha}{SFMath}{`C}
\DeclareMathSymbol{D}{\mathalpha}{SFMath}{`D}
\DeclareMathSymbol{E}{\mathalpha}{SFMath}{`E}
\DeclareMathSymbol{F}{\mathalpha}{SFMath}{`F}
\DeclareMathSymbol{G}{\mathalpha}{SFMath}{`G}
\DeclareMathSymbol{H}{\mathalpha}{SFMath}{`H}
\DeclareMathSymbol{I}{\mathalpha}{SFMath}{`I}
\DeclareMathSymbol{J}{\mathalpha}{SFMath}{`J}
\DeclareMathSymbol{K}{\mathalpha}{SFMath}{`K}
\DeclareMathSymbol{L}{\mathalpha}{SFMath}{`L}
\DeclareMathSymbol{M}{\mathalpha}{SFMath}{`M}
\DeclareMathSymbol{N}{\mathalpha}{SFMath}{`N}
\DeclareMathSymbol{O}{\mathalpha}{SFMath}{`O}
\DeclareMathSymbol{P}{\mathalpha}{SFMath}{`P}
\DeclareMathSymbol{Q}{\mathalpha}{SFMath}{`Q}
\DeclareMathSymbol{R}{\mathalpha}{SFMath}{`R}
\DeclareMathSymbol{S}{\mathalpha}{SFMath}{`S}
\DeclareMathSymbol{T}{\mathalpha}{SFMath}{`T}
\DeclareMathSymbol{U}{\mathalpha}{SFMath}{`U}
\DeclareMathSymbol{V}{\mathalpha}{SFMath}{`V}
\DeclareMathSymbol{W}{\mathalpha}{SFMath}{`W}
\DeclareMathSymbol{X}{\mathalpha}{SFMath}{`X}
\DeclareMathSymbol{Y}{\mathalpha}{SFMath}{`Y}
\DeclareMathSymbol{Z}{\mathalpha}{SFMath}{`Z}
\DeclareMathSymbol{a}{\mathalpha}{SFMath}{`a}
\DeclareMathSymbol{b}{\mathalpha}{SFMath}{`b}
\DeclareMathSymbol{c}{\mathalpha}{SFMath}{`c}
\DeclareMathSymbol{d}{\mathalpha}{SFMath}{`d}
\DeclareMathSymbol{e}{\mathalpha}{SFMath}{`e}
\DeclareMathSymbol{f}{\mathalpha}{SFMath}{`f}
\DeclareMathSymbol{g}{\mathalpha}{SFMath}{`g}
\DeclareMathSymbol{h}{\mathalpha}{SFMath}{`h}
\DeclareMathSymbol{i}{\mathalpha}{SFMath}{`i}
\DeclareMathSymbol{j}{\mathalpha}{SFMath}{`j}
\DeclareMathSymbol{k}{\mathalpha}{SFMath}{`k}
\DeclareMathSymbol{l}{\mathalpha}{SFMath}{`l}
\DeclareMathSymbol{m}{\mathalpha}{SFMath}{`m}
\DeclareMathSymbol{n}{\mathalpha}{SFMath}{`n}
\DeclareMathSymbol{o}{\mathalpha}{SFMath}{`o}
\DeclareMathSymbol{p}{\mathalpha}{SFMath}{`p}
\DeclareMathSymbol{q}{\mathalpha}{SFMath}{`q}
\DeclareMathSymbol{r}{\mathalpha}{SFMath}{`r}
\DeclareMathSymbol{s}{\mathalpha}{SFMath}{`s}
\DeclareMathSymbol{t}{\mathalpha}{SFMath}{`t}
\DeclareMathSymbol{u}{\mathalpha}{SFMath}{`u}
\DeclareMathSymbol{v}{\mathalpha}{SFMath}{`v}
\DeclareMathSymbol{w}{\mathalpha}{SFMath}{`w}
\DeclareMathSymbol{x}{\mathalpha}{SFMath}{`x}
\DeclareMathSymbol{y}{\mathalpha}{SFMath}{`y}
\DeclareMathSymbol{z}{\mathalpha}{SFMath}{`z}

\DeclareMathSymbol{\imath}{\mathalpha}{SFMath}{"10}
\DeclareMathSymbol{\jmath}{\mathalpha}{SFMath}{"11}


% The symbols ",", ".", and "\ldotp" should be sans serif
% but upright.

\DeclareSymbolFont{SFMathUp}{\math@encoding}{\math@sfdefault}{m}{n}
\SetSymbolFont{SFMathUp}{normal}{\math@encoding}{\math@sfdefault}{m}{n}
\SetSymbolFont{SFMathUp}{bold}{\math@encoding}{\math@sfdefault}{bx}{n}
\DeclareMathSymbol{,}{\mathpunct}{SFMathUp}{`,}
\DeclareMathSymbol{.}{\mathord}{SFMathUp}{`.}
\DeclareMathSymbol{\ldotp}{\mathord}{SFMathUp}{`.}


% Take capital greek letters from cmss or [tp]xss; other sans serif fonts
% like helvetica don't have capital greeks, so here cmss is
% taken instead of \sfdefault. Unfortunately, this does not work
% within the alphabet commands \mathrm, \mathsf, ...

\DeclareSymbolFont{SFMathGreek}{OT1}{\math@sfGreek}{m}{\greek@shape}
\SetSymbolFont{SFMathGreek}{normal}{OT1}{\math@sfGreek}{m}{\greek@shape}
\SetSymbolFont{SFMathGreek}{bold}{OT1}{\math@sfGreek}{bx}{\greek@bold@shape}

\DeclareMathSymbol{\Gamma}{\mathalpha}{SFMathGreek}{"00}
\DeclareMathSymbol{\Delta}{\mathalpha}{SFMathGreek}{"01}
\DeclareMathSymbol{\Theta}{\mathalpha}{SFMathGreek}{"02}
\DeclareMathSymbol{\Lambda}{\mathalpha}{SFMathGreek}{"03}
\DeclareMathSymbol{\Xi}{\mathalpha}{SFMathGreek}{"04}
\DeclareMathSymbol{\Pi}{\mathalpha}{SFMathGreek}{"05}
\DeclareMathSymbol{\Sigma}{\mathalpha}{SFMathGreek}{"06}
\DeclareMathSymbol{\Upsilon}{\mathalpha}{SFMathGreek}{"07}
\DeclareMathSymbol{\Phi}{\mathalpha}{SFMathGreek}{"08}
\DeclareMathSymbol{\Psi}{\mathalpha}{SFMathGreek}{"09}
\DeclareMathSymbol{\Omega}{\mathalpha}{SFMathGreek}{"0A}


\DeclareSymbolFont{SFMathUpGreek}{OT1}{\math@sfGreek}{m}{n}
\SetSymbolFont{SFMathUpGreek}{normal}{OT1}{\math@sfGreek}{m}{n}
\SetSymbolFont{SFMathUpGreek}{bold}{OT1}{\math@sfGreek}{bx}{n}

\DeclareMathSymbol{\upDelta}{\mathalpha}{SFMathUpGreek}{"01}
\DeclareMathSymbol{\upOmega}{\mathalpha}{SFMathUpGreek}{"0A}


% Define new behavior for math alphabet commands


\SetMathAlphabet{\mathnormal}{normal}{\math@lph@encoding}{\math@sfdefault}{m}{sl}
\SetMathAlphabet{\mathnormal}{bold}{\math@lph@encoding}{\math@sfdefault}{bx}{\mathnormal@bold@shape}

\SetMathAlphabet{\mathrm}{normal}{\math@lph@encoding}{\mathrm@lph}{m}{n}
\SetMathAlphabet{\mathrm}{bold}{\math@lph@encoding}{\mathrm@lph}{bx}{n}

\SetMathAlphabet{\mathbf}{normal}{\math@lph@encoding}{\mathbf@lph}{bx}{n}
\SetMathAlphabet{\mathbf}{bold}{\math@lph@encoding}{\mathbf@lph}{bx}{n}

\SetMathAlphabet{\mathit}{normal}{\math@lph@encoding}{\mathit@lph}{m}{sl}
\SetMathAlphabet{\mathit}{bold}{\math@lph@encoding}{\mathit@lph}{\mathit@bold@series}{sl}

\SetMathAlphabet{\mathsf}{normal}{\math@lph@encoding}{\mathsf@lph}{m}{n}
\SetMathAlphabet{\mathsf}{bold}{\math@lph@encoding}{\mathsf@lph}{bx}{n}



% Define new math alphabet command \mathsl

\DeclareMathAlphabet{\mathsl}{\math@lph@encoding}{\math@sfdefault}{m}{sl}
\SetMathAlphabet{\mathsl}{bold}{\math@lph@encoding}{\math@sfdefault}{\mathit@bold@series}{sl}


\endinput

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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