% \iffalse meta-comment
%    File `pxgreeks.dtx'
%    
%    Copyright (C) 2011 by Jean-Francois Burnol
%   
%    This file may be distributed and/or modified under the
%    conditions of the LaTeX Project Public License,
%    either version 1.3 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.3 or later is part of all distributions of
%    LaTeX version 2003/12/01 or later.  
%
%    Please report errors to jfbu (at) free (dot) fr
%    
% \fi 
% \iffalse
%<*dtx>    
\ProvidesFile{pxgreeks.dtx}
       [2011/03/16 1.0 shape selection for the PX fonts Greek letters]
%</dtx>
% 
%<*driver>
\documentclass[a4paper]{ltxdoc}
\usepackage{amsmath} % for the logo
\usepackage[hscale=0.6]{geometry}
\usepackage[pdfstartview=FitH,pdfpagemode=UseNone]{hyperref}
%\RecordChanges
%\OnlyDescription
\begin{document}
 \DocInput{pxgreeks.dtx}
\end{document}
%</driver>
% \fi
% \changes{1.0}{2011/03/16}{Initial version.}
%
% \GetFileInfo{pxgreeks.dtx}
%
% \begin{center}
%   {\Large The \texttt{pxgreeks} package}\\
%   Jean-Fran\c cois \textsc{Burnol}\\
%   \texttt{jfbu (at) free (dot) fr}
% \end{center}
%
%  \begin{abstract}
%    The PX Fonts \footnote{package
%    \url{http://mirrors.ctan.org/help/Catalogue/entries/pxfonts.html}}
%    of \textsc{Young~Ryu} provide a very complete replacement for
%    the default math fonts of \TeX{} and \LaTeX{}, containing all
%    CM symbols and even all symbols from the \AmS{} fonts, and
%    more.  In particular upright shapes for the Greek letters are
%    available (they are necessary in French mathematical
%    typography).  The |pxgreeks| package\footnote{This document
%    describes |pxgreeks| version \fileversion\ (\filedate).}
%    allows \LaTeX{} users who use the PX fonts to easily select
%    the shapes (italic or upright) for the Greek lowercase and
%    uppercase letters. This is compatible with using arbitrary
%    text fonts in the document.
%  \end{abstract}
%
%  \section{Features}
%
%  The shape of the Greek letters is decided according to the
%  options passed to the package: |TeX| (=|sloped|, the default:
%  lowercase italic and uppercase upright), |upright|
%  (=|French|=|upgreek|, lowercase and uppercase upright), |ISO|
%  (=|itgreek|, lowercase and uppercase italic), |itGreek| (italic
%  uppercase) and |upGreek| (upright uppercase). Use both of
%  |itGreek| and |upgreek| to get lowercase upright and uppercase
%  italic.
%
%  The uppercase Greek letters are not taken from the PX roman
%  font |pxr| (`operators') but from either the alternate math
%  italic font |pxmia| (`lettersA', which in fact provides upright
%  Greek in OML encoding), or from the math italic font |pxmi|
%  (`letters', where uppercase Greek is in italic shape). This
%  means that if some other package redefines the `operators' font
%  used in math (presumably to co\"incide with the `roman' font
%  used for the document text), this will have no impact on the
%  Greek uppercase letters. If some package modifies the `letters'
%  font used in math (which typically is the font for Latin
%  letters and lowercase Greek letters, and with |pxgreeks| is
%  also used for the italic uppercase Greek letters), then of
%  course the glyphs will be from the new font. But the upright
%  glyphs will still be from the PX Font |pxmia| (`lettersA').
%
%  Following the model of the |fourier| package, the alternative
%  shape of the Greek letters is accessible via the \cs{other...}
%  prefix: \cs{otheralpha} will be upright if \cs{alpha} is
%  italic, and vice versa. For the lowercase Greek letters there
%  are also the macros ending in |up| (\cs{alphaup}, \dots) which
%  are already defined by |pxfonts|.
%
%  Regarding the uppercase letters, the package defines (replacing
%  the |amsmath| definitions) \cs{varGamma}, etc\dots{} as synonyms for
%  \cs{otherGamma}, etc\dots, but does not define additional
%  macros \cs{Gammaup} as this was not done by the package
%  |pxfonts|. Use rather \cs{otherGamma} if
%  necessary.\footnote{contrarily to |amsmath| we define the
%  \cs{varGamma}, etc\dots{} to be of type \cs{mathalpha} so they
%  obey, like the default \LaTeX{} \cs{Gamma}, etc \dots{} the math
%  alphabet changing commands; however to access the bold glyphs I
%  recommend using either the \cs{bm} command from the |bm|
%  package or the \cs{boldsymbol} command from the |amsbsy|
%  package and not \cs{mathbf} which by default will use the PX
%  roman font |pxr|.}
%
%  The package defines \cs{omicron}, \cs{otheromicron}, and
%  \cs{omicronup}. But there is no upright omicron in the |pxmia|
%  font, so we have to use the construct |\mathrm{\omicron}| (this
%  will a priori use the PX roman font |pxr|).
%
%  It is not necessary to write |\usepackage{pxfonts}| prior to
%  |\usepackage{pxgreeks}| as this is done by |pxgreeks| itself,
%  but for clarity of the \LaTeX{} source of the document to be
%  typeset, this is highly recommended, as |pxgreeks| does very
%  minor things compared to |pxfonts|.
%
%  Using |pxgreeks| should be hopefully compatible with any
%  package which is already compatible with |pxfonts|.
%
%
% \StopEventually{}
% 
%  \section{Implementation}
%
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pxgreeks}
	[2011/03/16 v1.0 shape selection for the PX fonts Greek letters]
\RequirePackage{pxfonts}
\newif\iftgs@uplower
\newif\iftgs@itupper
\def\tgs@Greek@sh{0}
\DeclareOption{itgreek}{\tgs@uplowerfalse\tgs@ituppertrue}
\DeclareOption{upgreek}{\tgs@uplowertrue\tgs@itupperfalse}
\DeclareOption{itGreek}{\def\tgs@Greek@sh{1}}
\DeclareOption{upGreek}{\def\tgs@Greek@sh{2}}
\DeclareOption{TeX}{\tgs@uplowerfalse\tgs@itupperfalse} %default
\DeclareOption{sloped}{\ExecuteOptions{TeX}}
\DeclareOption{upright}{\ExecuteOptions{upgreek}}
\DeclareOption{French}{\ExecuteOptions{upright}}
\DeclareOption{ISO}{\ExecuteOptions{itgreek}}
\DeclareOption*{\PackageWarning{pxgreeks}{Unknown option `\CurrentOption'}}
\ProcessOptions\relax
\ifcase\tgs@Greek@sh\or\tgs@ituppertrue\or\tgs@itupperfalse\fi
%    \end{macrocode}
% macro \cs{re@DeclareMathSymbol} defined in pxfonts.sty\\
% symbol font lettersA=pxmia defined in pxfonts.sty (contains upright Greek)
%    \begin{macrocode}
\re@DeclareMathSymbol{\Gamma}{\mathalpha}{lettersA}{0}
\re@DeclareMathSymbol{\Delta}{\mathalpha}{lettersA}{1}
\re@DeclareMathSymbol{\Theta}{\mathalpha}{lettersA}{2}
\re@DeclareMathSymbol{\Lambda}{\mathalpha}{lettersA}{3}
\re@DeclareMathSymbol{\Xi}{\mathalpha}{lettersA}{4}
\re@DeclareMathSymbol{\Pi}{\mathalpha}{lettersA}{5}
\re@DeclareMathSymbol{\Sigma}{\mathalpha}{lettersA}{6}
\re@DeclareMathSymbol{\Upsilon}{\mathalpha}{lettersA}{7}
\re@DeclareMathSymbol{\Phi}{\mathalpha}{lettersA}{8}
\re@DeclareMathSymbol{\Psi}{\mathalpha}{lettersA}{9}
\re@DeclareMathSymbol{\Omega}{\mathalpha}{lettersA}{10}
%    \end{macrocode}
% \cs{varGamma} etc... defined in amsmath, but with type \cs{mathord}
%    \begin{macrocode}
\re@DeclareMathSymbol{\varGamma}{\mathalpha}{letters}{0}
\re@DeclareMathSymbol{\varDelta}{\mathalpha}{letters}{1}
\re@DeclareMathSymbol{\varTheta}{\mathalpha}{letters}{2}
\re@DeclareMathSymbol{\varLambda}{\mathalpha}{letters}{3}
\re@DeclareMathSymbol{\varXi}{\mathalpha}{letters}{4}
\re@DeclareMathSymbol{\varPi}{\mathalpha}{letters}{5}
\re@DeclareMathSymbol{\varSigma}{\mathalpha}{letters}{6}
\re@DeclareMathSymbol{\varUpsilon}{\mathalpha}{letters}{7}
\re@DeclareMathSymbol{\varPhi}{\mathalpha}{letters}{8}
\re@DeclareMathSymbol{\varPsi}{\mathalpha}{letters}{9}
\re@DeclareMathSymbol{\varOmega}{\mathalpha}{letters}{10}
\re@DeclareMathSymbol{\omicron}{\mathalpha}{letters}{`o}
%    \end{macrocode}
% unfortunately no upright omicron in lettersA=pxmia
%    \begin{macrocode}
\let\omicronup\undefined\newcommand{\omicronup}{\mathrm{o}}
\iftgs@uplower % upright lowercase Greek letters
\let\otheralpha\alpha
\let\otherbeta\beta
\let\othergamma\gamma
\let\otherdelta\delta
\let\otherepsilon\epsilon
\let\otherzeta\zeta
\let\othereta\eta
\let\othertheta\theta
\let\otheriota\iota
\let\otherkappa\kappa
\let\otherlambda\lambda
\let\othermu\mu
\let\othernu\nu
\let\otherxi\xi
\let\otherpi\pi
\let\otherrho\rho
\let\othersigma\sigma
\let\othertau\tau
\let\otherupsilon\upsilon
\let\otherphi\phi
\let\otherchi\chi
\let\otherpsi\psi
\let\otheromega\omega
\let\othervarepsilon\varepsilon
\let\othervartheta\vartheta
\let\othervarpi\varpi
\let\othervarrho\varrho
\let\othervarsigma\varsigma
\let\othervarphi\varphi
\let\otheromicron\omicron
%%
\let\alpha\alphaup
\let\beta\betaup
\let\gamma\gammaup
\let\delta\deltaup
\let\epsilon\epsilonup
\let\zeta\zetaup
\let\eta\etaup
\let\theta\thetaup
\let\iota\iotaup
\let\kappa\kappaup
\let\lambda\lambdaup
\let\mu\muup
\let\nu\nuup
\let\xi\xiup
\let\pi\piup
\let\rho\rhoup
\let\sigma\sigmaup
\let\tau\tauup
\let\upsilon\upsilonup
\let\phi\phiup
\let\chi\chiup
\let\psi\psiup
\let\omega\omegaup
\let\varepsilon\varepsilonup
\let\vartheta\varthetaup
\let\varpi\varpiup
\let\varrho\varrhoup
\let\varsigma\varsigmaup
\let\varphi\varphiup
\let\omicron\omicronup
\else % italic lowercase Greek letters (default)
\let\otheralpha\alphaup
\let\otherbeta\betaup
\let\othergamma\gammaup
\let\otherdelta\deltaup
\let\otherepsilon\epsilonup
\let\otherzeta\zetaup
\let\othereta\etaup
\let\othertheta\thetaup
\let\otheriota\iotaup
\let\otherkappa\kappaup
\let\otherlambda\lambdaup
\let\othermu\muup
\let\othernu\nuup
\let\otherxi\xiup
\let\otherpi\piup
\let\otherrho\rhoup
\let\othersigma\sigmaup
\let\othertau\tauup
\let\otherupsilon\upsilonup
\let\otherphi\phiup
\let\otherchi\chiup
\let\otherpsi\psiup
\let\otheromega\omegaup
\let\othervarepsilon\varepsilonup
\let\othervartheta\varthetaup
\let\othervarpi\varpiup
\let\othervarrho\varrhoup
\let\othervarsigma\varsigmaup
\let\othervarphi\varphiup
\let\otheromicron\omicronup
\fi
%%
\iftgs@itupper % italic uppercase Greek
\let\otherGamma\Gamma
\let\otherDelta\Delta
\let\otherTheta\Theta
\let\otherLambda\Lambda
\let\otherXi\Xi
\let\otherPi\Pi
\let\otherSigma\Sigma
\let\otherUpsilon\Upsilon
\let\otherPhi\Phi
\let\otherPsi\Psi
\let\otherOmega\Omega
\let\Gamma\varGamma
\let\Delta\varDelta
\let\Theta\varTheta
\let\Lambda\varLambda
\let\Xi\varXi
\let\Pi\varPi
\let\Sigma\varSigma
\let\Upsilon\varUpsilon
\let\Phi\varPhi
\let\Psi\varPsi
\let\Omega\varOmega
\let\varGamma\otherGamma
\let\varDelta\otherDelta
\let\varTheta\otherTheta
\let\varLambda\otherLambda
\let\varXi\otherXi
\let\varPi\otherPi
\let\varSigma\otherSigma
\let\varUpsilon\otherUpsilon
\let\varPhi\otherPhi
\let\varPsi\otherPsi
\let\varOmega\otherOmega
\else % upright uppercase Greek (default)
\let\otherGamma\varGamma
\let\otherDelta\varDelta
\let\otherTheta\varTheta
\let\otherLambda\varLambda
\let\otherXi\varXi
\let\otherPi\varPi
\let\otherSigma\varSigma
\let\otherUpsilon\varUpsilon
\let\otherPhi\varPhi
\let\otherPsi\varPsi
\let\otherOmega\varOmega
\fi
\endinput
%    \end{macrocode}
% \iffalse
%</code>
%<*dtx>
% \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         \~}
%
% \iffalse
%</dtx>
% \fi
%
% \CheckSum{528}
% \Finale
\endinput
