%\CheckSum{398}
%
% \iffalse
%
% Copyright (c) 1999-2004 Walter Schmidt
%
% This program may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.1
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.1 or later is part of all distributions of LaTeX
% version 1999/06/01 or later.
%
% This program consists of the files hvmaths.txt, hvmaths.dtx
% and hvmaths.ins.
%
% \fi
%
% \iffalse
%
\NeedsTeXFormat{LaTeX2e}[1997/12/01]
%<*driver>
\ProvidesFile{hvmaths.dtx}
%</driver>
%<+package>\ProvidesPackage{hvmaths}
           [2004/02/01 v1.5 (WaS/MicroPress)]
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{url}
\OnlyDescription
\begin{document}
 \DocInput{hvmaths.dtx}
\end{document}
%</driver>
% \fi
%
% \GetFileInfo{hvmaths.dtx}
% \DeleteShortVerb{\|}
% \MakeShortVerb{\+}
%
% \title{The \LaTeX{} macro package \textsf{hvmaths}}
% \author{Walter Schmidt}
% \date{(\fileversion{} -- \filedate)}
% \maketitle
%
%
% \section{The HV-Math font set}
%
% MicroPress' HV-Math font set extends the Adobe Helvetica fonts:
% \begin{itemize}
%   \item Additional text and text companion symbols make the
%   full OT1 and T1 character sets and a subset of the
%   text companion symbols available, including the Euro sign.
%   With \LaTeX, the enhanced Helveiica typefaces are provided
%   as a font family named \texttt{hvr}.
%   \item Several math fonts, matching the `Helvetica' style, are provided
%   to support all of \TeX's math typesetting capabilites and fully
%  replace the default Computer Modern fonts.
% \end{itemize}
%
%
% \section{The macro package \textsf{hvmaths}}
% Loading the package
% \begin{verse}
% +\usepackage{hvmaths}+
% \end{verse}
% effects the following:
% \begin{itemize}
% \item 
% The default sans serif font family for typesetting text
% is changed to \texttt{hvr}, i.\,e.\ Micropress HV-Math.
% \item
% The sans serif font family will be the default for the whole document.
% \item 
% The matching MicroPress~HV-Math fonts will be used in formulas.
% \end{itemize}
% Using the \textsf{hvmaths} package requires also the package
% \textsf{keyval}, which is part of the \textsc{Graphics} bundle
% and should be available in any decent \LaTeX\ system.
%
%
% \subsection{Font encoding}
% The package does \emph{not} change the default output font
% encoding from OT1.  It is, however, recommended to switch to
% the extended T1 and TS1 encodings,
% so as to provide access to all glyphs.
% This is enabled by means of the following additional commands:
% \begin{verse}
% +\usepackage[T1]{fontenc}+\\
% +\usepackage{textcomp}+
% \end{verse}
%
%
% \subsection{Using the AMS math symbol fonts}
% The HV-Math font set includes matching AMS symbol fonts, too.
% \LaTeX{} will use these, if the package \texttt{amssymb}
% is loaded in conjunction with \texttt{hvmaths}.  The sequence of loading does
% not matter.
%
%
% \subsection{Bold italic letters in formulas}
% The \texttt{hvmaths} package provides a {\bfseries\itshape bold italic}
% math alphabet  +\mathbold+.  It includes both Latin and Greek.
% (Do not mix this up with +\mathbf+, which implements
% the {\bfseries bold upright} text font for use in math!)
%
%
% \subsection{Upright Greek letters}
% A full upright Greek alphabet is made available.
% The macros +\upalpha+, +\upbeta+ \dots\ +\upGamma+, +\upDelta+ etc.\
% always produce upright Greek letters, regardless of the \texttt{slantedGreek} option
% described below,
%
%
% \subsection{Options}
% The behavior of the package, as described above, can be modified
% by various options:
%
% \subsubsection{The option \texttt{sans}}
% Loading the package with this option will only change
% the sans serif text font family to Helvetica.
% The default font family and the math fonts are untouched.
% Thus, the \textsf{hvmaths} package will behave like the PSNFSS
% package \textsf{helvet}.
%
% Using both \textsf{sans} and \textsf{roman} does not
% make sense, of course, and the \textsf{sans} option is ignored then.
%
%
% \subsubsection{The option \texttt{roman}}
% This option will cause HV-Math to be mapped
% to the default `roman' font family instead of
% the `sans serif' one.  This is provided for compatibility with the
% package \textsf{hvmath} only and should normally not be used.
%
%
% \subsubsection{The option \texttt{scaled}}
% Helvetica is noticeably larger than most other fonts (incl.\ CM),
% when used with the same nominal size.
% As a result, it may become difficult to mix fonts or add further
% math alphabets.
%  This can be fixed by loading the \textsf{hvmaths}
% package with the option
%\texttt{[scaled=}$\langle\textit{scale}\rangle$\texttt{]},
% e.g.:
% \begin{quote}
%   +\usepackage[scaled=.92]{hvmaths}+
% \end{quote}
% This will load the font family \texttt{hvr} (Helvetica) for sans-serif,
% scaled down to 92\% of its `natural' size, which blends well with
% Adobe Times.
% 
% The $\langle$\textit{scale}$\rangle$ can be omitted:
% \begin{quote}
%   +\usepackage[scaled]{hvmaths}+
% \end{quote}
% A default scaling of 0.95 will be assumed then, which makes the
% height of the Helvetica capitals comply with many other typeface
% families.
%
% As a side effect,
% the default line spacing of the standard \LaTeX{} document classes
% may be sufficient for the now scaled-down Helvetica,
% especially when the line width is not too large.
%
%
% \subsubsection{The option \texttt{slantedGreek}}
% When the macro package is loaded using the option \texttt{[slantedGreek]},
% uppercase Greek letters in math will, by default, be slanted.
%
%
% \subsection{Changes over \texttt{hvmath.sty}}
% As compared with MicroPress' original \texttt{hvmath.sty}, this package
% provides a number of improvements:
% \begin{itemize}
% \item the option \texttt{slantedGreek}
% \item support for a full upright Greek alphabet, without loading
% any additional package
% \item AMS symbols can be used by just loading the package \texttt{amssymb};
% no extra packages are needed, and the sequence of of loading does not matter.
% \end{itemize}
% In contrast to \texttt{hvmath}, the package does \emph{not} support MicroPress' 
% `local' font encoding LV1.
%
%
% \section{Availability and support}
% The latest version of this package can be obtained from the directory
% \begin{verse}
% \path{macros/latex/contrib/psnfssx/hvmath}
% \end{verse}
% of any CTAN host.
%
% \noindent The HV-Math fonts are provided by
% \begin{verse}
% MicroPress, Inc.\\
% 6830~Harrow~Street,
% Forest Hills NY 11375, 
% USA\\
% \path{<http://www.micropress-inc.com>}
% \end{verse}
% Please, address questions or bug reports via email to
% \begin{verse}
% \path{<support@micropress-inc.com>}.
% \end{verse}
%
% \StopEventually{\par\vfill\noindent{\sffamily\footnotesize
% Adobe is a trademark of Adobe Systems Incorporated.
% Helvetica is a trademark of Linotype-Hell AG.
% HV-Math is a trademark of MicroPress, Inc.
% \par }}
%
%
% \section{The package}
%
% \subsection{Declaring and processing options}
% Options processing uses the \textsf{keyval} package
% and a hack borrowed from \textsf{hyperref}:
%    \begin{macrocode}
%<*package>
\RequirePackage{keyval}
\newif\ifhvmath@slantedGreek
\newif\ifhvmath@roman
\newif\ifhvmath@sans
\define@key{Hvr}{scaled}[.95]{%
  \expandafter\def\csname OM1@hvr@scale\endcsname{#1}
  \expandafter\def\csname OT1@hvr@scale\endcsname{#1}
  \expandafter\def\csname T1@hvr@scale\endcsname{#1}
}
\define@key{Hvr}{slantedGreek}[true]{%
   \csname hvmath@slantedGreek#1\endcsname
}
\define@key{Hvr}{roman}[true]{%
   \csname hvmath@roman#1\endcsname
}  
\define@key{Hvr}{sans}[true]{%
   \csname hvmath@sans#1\endcsname
}
\def\ProcessOptionsWithKV#1{%
  \let\@tempc\relax
  \let\Hvr@tempa\@empty
  \@for\CurrentOption:=\@classoptionslist\do{%
    \@ifundefined{KV@#1@\CurrentOption}%
    {}%
    {%
      \edef\Hvr@tempa{\Hvr@tempa,\CurrentOption,}%
      \@expandtwoargs\@removeelement\CurrentOption
        \@unusedoptionlist\@unusedoptionlist
    }%
  }%
  \edef\Hvr@tempa{%
    \noexpand\setkeys{#1}{%
      \Hvr@tempa\@ptionlist{\@currname.\@currext}%
    }%
  }%
  \Hvr@tempa
  \let\CurrentOption\@empty
}
\ProcessOptionsWithKV{Hvr}
\AtEndOfPackage{%
  \let\@unprocessedoptions\relax
}
%    \end{macrocode}
% The HV-Math \texttt{.fd} files will evaluate
% +\T1@hvr@scale+, +\OT1@hvr@scale+ and +\OM1@hvr@scale+,
% thus determining whether or not the fonts are to be scaled.
%
%
% \subsection{Setting up the text fonts}
% The package \texttt{hvmaths} switches the default roman text font
% family to \texttt{tmr} and provides an improved definition of Aring
% for use with the OT1 encoding:
%    \begin{macrocode}
\ifhvmath@roman
  \hvmath@sansfalse
  \DeclareFontSubstitution{OT1}{hvr}{m}{n}
  \renewcommand{\rmdefault}{hvr}
\else
  \renewcommand{\sfdefault}{hvr}
  \ifhvmath@sans\else
    \renewcommand{\familydefault}{\sfdefault}
  \fi
\fi
\def\hvmath@Aring
{%
  \leavevmode
  \setbox0\hbox{h}%
  \dimen@\ht0 %
  \advance\dimen@-1ex%
  \ooalign{\hfil\raise.85\dimen@\hbox{\r{}}\hfil\crcr A}%
}%
\DeclareTextCompositeCommand{\r}{OT1}{A}{\hvmath@Aring}%
\normalfont
%    \end{macrocode}
%
%
% \subsection{Setting up the math fonts}
% The remaining code is not to be executed when the \textsf{sans}
% option has been specified:
%    \begin{macrocode}
\ifhvmath@sans\endinput\fi
%    \end{macrocode}
%    \begin{macrocode}
\DeclareSymbolFont{operators}{OT1}{hvr}{m}{n}%
\DeclareSymbolFont{letters}{OML}{hvm}{m}{it}%
\DeclareSymbolFont{symbols}{OMS}{hvsy}{m}{n}%
\DeclareSymbolFont{largesymbols}{OMX}{hvex}{m}{n}%
\SetSymbolFont{operators}{bold}{OT1}{hvr}{bx}{n}%
\SetSymbolFont{letters}{bold}{OML}{hvm}{b}{it}%
\SetSymbolFont{symbols}{bold}{OMS}{hvsy}{b}{n}%
\DeclareMathAlphabet{\mathbf}{OT1}{hvr}{bx}{n}%
\DeclareMathAlphabet{\mathit}{OT1}{hvr}{m}{it}%
\SetMathAlphabet\mathit{bold}{OT1}{hvr}{bx}{it}%
%    \end{macrocode}
%
% Define +\hbar+:
%    \begin{macrocode}
\DeclareMathSymbol{\hbar}{\mathord}{letters}{128}
%    \end{macrocode}
%
% Define +\mathbold+:
%    \begin{macrocode}
\DeclareMathAlphabet{\mathbold}{OML}{hvm}{b}{it}%
%    \end{macrocode}
%
% Make +\mathbold+ act on lowercase Greek, too:
%    \begin{macrocode}
\DeclareMathSymbol{\alpha}{\mathalpha}{letters}{11}
\DeclareMathSymbol{\beta}{\mathalpha}{letters}{12}
\DeclareMathSymbol{\gamma}{\mathalpha}{letters}{13}
\DeclareMathSymbol{\delta}{\mathalpha}{letters}{14}
\DeclareMathSymbol{\epsilon}{\mathalpha}{letters}{15}
\DeclareMathSymbol{\zeta}{\mathalpha}{letters}{16}
\DeclareMathSymbol{\eta}{\mathalpha}{letters}{17}
\DeclareMathSymbol{\theta}{\mathalpha}{letters}{18}
\DeclareMathSymbol{\iota}{\mathalpha}{letters}{19}
\DeclareMathSymbol{\kappa}{\mathalpha}{letters}{20}
\DeclareMathSymbol{\lambda}{\mathalpha}{letters}{21}
\DeclareMathSymbol{\mu}{\mathalpha}{letters}{22}
\DeclareMathSymbol{\nu}{\mathalpha}{letters}{23}
\DeclareMathSymbol{\xi}{\mathalpha}{letters}{24}
\DeclareMathSymbol{\pi}{\mathalpha}{letters}{25}
\DeclareMathSymbol{\rho}{\mathalpha}{letters}{26}
\DeclareMathSymbol{\sigma}{\mathalpha}{letters}{27}
\DeclareMathSymbol{\tau}{\mathalpha}{letters}{28}
\DeclareMathSymbol{\upsilon}{\mathalpha}{letters}{29}
\DeclareMathSymbol{\phi}{\mathalpha}{letters}{30}
\DeclareMathSymbol{\chi}{\mathalpha}{letters}{31}
\DeclareMathSymbol{\psi}{\mathalpha}{letters}{32}
\DeclareMathSymbol{\omega}{\mathalpha}{letters}{33}
\DeclareMathSymbol{\varepsilon}{\mathalpha}{letters}{34}
\DeclareMathSymbol{\vartheta}{\mathalpha}{letters}{35}
\DeclareMathSymbol{\varpi}{\mathalpha}{letters}{36}
\DeclareMathSymbol{\varphi}{\mathalpha}{letters}{39}
\DeclareMathSymbol{\varrho}{\mathalpha}{letters}{37}
\DeclareMathSymbol{\varsigma}{\mathalpha}{letters}{38}
%    \end{macrocode}
%
% The option \textsf{slantedGreek}:
%    \begin{macrocode}
\ifhvmath@slantedGreek
  \DeclareMathSymbol{\Gamma}{\mathalpha}{letters}{0}
  \DeclareMathSymbol{\Delta}{\mathalpha}{letters}{1}
  \DeclareMathSymbol{\Theta}{\mathalpha}{letters}{2}
  \DeclareMathSymbol{\Lambda}{\mathalpha}{letters}{3}
  \DeclareMathSymbol{\Xi}{\mathalpha}{letters}{4}
  \DeclareMathSymbol{\Pi}{\mathalpha}{letters}{5}
  \DeclareMathSymbol{\Sigma}{\mathalpha}{letters}{6}
  \DeclareMathSymbol{\Upsilon}{\mathalpha}{letters}{7}
  \DeclareMathSymbol{\Phi}{\mathalpha}{letters}{8}
  \DeclareMathSymbol{\Psi}{\mathalpha}{letters}{9}
  \DeclareMathSymbol{\Omega}{\mathalpha}{letters}{10}
\fi
%    \end{macrocode}
%
% \subsection{Upright Greek}
% Uppercase upright Greek is taken from the `operators' font:
%    \begin{macrocode}
\DeclareMathSymbol{\upGamma}  {\mathord}{operators}{"00}
\DeclareMathSymbol{\upDelta}  {\mathord}{operators}{"01}
\DeclareMathSymbol{\upTheta}  {\mathord}{operators}{"02}
\DeclareMathSymbol{\upLambda} {\mathord}{operators}{"03}
\DeclareMathSymbol{\upXi}     {\mathord}{operators}{"04}
\DeclareMathSymbol{\upPi}     {\mathord}{operators}{"05}
\DeclareMathSymbol{\upSigma}  {\mathord}{operators}{"06}
\DeclareMathSymbol{\upUpsilon}{\mathord}{operators}{"07}
\DeclareMathSymbol{\upPhi}    {\mathord}{operators}{"08}
\DeclareMathSymbol{\upPsi}    {\mathord}{operators}{"09}
\DeclareMathSymbol{\upOmega}  {\mathord}{operators}{"0A}
%    \end{macrocode}
% The lowercase upright Greek letters are -- unfortunately -- not in the `letters'
% font, so we  need to set up a particular math alphabet for them:
%    \begin{macrocode}
\DeclareFontFamily{U}{hvrmex}{}
\DeclareFontShape{U}{hvrmex}{m}{n}{<->hvrm10ex}{}
\DeclareFontShape{U}{hvrmex}{b}{n}{<->hvrb10ex}{}
\DeclareSymbolFont{upright}{U}{hvrmex}{m}{n}%
\SetSymbolFont{upright}{bold}{U}{hvrmex}{b}{n}
\DeclareMathSymbol{\upalpha}{\mathord}{upright}{211}
\DeclareMathSymbol{\upbeta}{\mathord}{upright}{212}
\DeclareMathSymbol{\upgamma}{\mathord}{upright}{213}
\DeclareMathSymbol{\updelta}{\mathord}{upright}{214}
\DeclareMathSymbol{\upepsilon}{\mathord}{upright}{215}
\DeclareMathSymbol{\upzeta}{\mathord}{upright}{216}
\DeclareMathSymbol{\upeta}{\mathord}{upright}{217}
\DeclareMathSymbol{\uptheta}{\mathord}{upright}{218}
\DeclareMathSymbol{\upiota}{\mathord}{upright}{219}
\DeclareMathSymbol{\upkappa}{\mathord}{upright}{220}
\DeclareMathSymbol{\uplambda}{\mathord}{upright}{221}
\DeclareMathSymbol{\upmu}{\mathord}{upright}{222}
\DeclareMathSymbol{\upnu}{\mathord}{upright}{223}
\DeclareMathSymbol{\upxi}{\mathord}{upright}{224}
\DeclareMathSymbol{\uppi}{\mathord}{upright}{225}
\DeclareMathSymbol{\uprho}{\mathord}{upright}{226}
\DeclareMathSymbol{\upsigma}{\mathord}{upright}{227}
\DeclareMathSymbol{\uptau}{\mathord}{upright}{228}
\DeclareMathSymbol{\upupsilon}{\mathord}{upright}{229}
\DeclareMathSymbol{\upphi}{\mathord}{upright}{230}
\DeclareMathSymbol{\upchi}{\mathord}{upright}{231}
\DeclareMathSymbol{\uppsi}{\mathord}{upright}{232}
\DeclareMathSymbol{\upomega}{\mathord}{upright}{233}
\DeclareMathSymbol{\upvarepsilon}{\mathord}{upright}{234}
\DeclareMathSymbol{\upvartheta}{\mathord}{upright}{235}
\DeclareMathSymbol{\upvarpi}{\mathord}{upright}{236}
\DeclareMathSymbol{\upvarphi}{\mathord}{upright}{239}
\DeclareMathSymbol{\upvarrho}{\mathord}{upright}{237}
\DeclareMathSymbol{\upvarsigma}{\mathord}{upright}{238}
%    \end{macrocode}
%
% \subsection{Peaceful coexistence with AMS-\LaTeX}
%    \begin{macrocode}
\AtBeginDocument{%
%    \end{macrocode}
%
% Fix multiple integrals from \textsf{amsmath} for use with HV-Math fonts:
%    \begin{macrocode}
  \@ifpackageloaded{amsmath}{%
    \def\intkern@{\mkern-6mu}
  }{}
%    \end{macrocode}
%
% Use the HV-Math versions of the AMS symbol fonts:
%    \begin{macrocode}
  \expandafter\ifx\csname OM1@hvr@scale\endcsname\relax
   \let\@l@scale\@empty
  \else
   \edef\@l@scale{s*[\csname OM1@hvr@scale\endcsname]}%
  \fi
  \DeclareFontFamily{U}{msa}{}
  \DeclareFontShape{U}{msa}{m}{n}{<->\@l@scale hvam10}{}
  \DeclareFontFamily{U}{msb}{}
  \DeclareFontShape{U}{msb}{m}{n}{<->\@l@scale hvbm10}{}
%    \end{macrocode}
%    \begin{macrocode}
}
%    \end{macrocode}
%
%
% \section*{DocStrip modules in this file \texttt{hvmaths.dtx}}
% \begin{quote}
% \begin{tabular}{ll}
% module: & contents:\\[0.5ex]
% +package+ & package \textsf{hvmaths}\\
% +driver+ &  driver for documentation \\
% \end{tabular}
% \end{quote}
%
%
% \Finale
%
%
% \iffalse
% The next line of code prevents DocStrip from adding the
% character table to the modules:
%\endinput
% \fi
%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%