%
% ptmxcomp package
%
% ptmxcomp.sty
% Copyright 2004 Harald Harders
%
% This program may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.2
% of this license or (at your opinion) any later version.
% The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.2 or later is part of all distributions of LaTeX
% version 1999/12/01 or later.
%
% ChangeLog:
%
% 2004/11/19  v0.03  Harald Harders (h.harders@tu-bs.de)
% - Avoid to use package calc
%
\ProvidesPackage{ptmxcomp}
  [2004/11/19 v0.03 Declare textcomp symbols for mathptmx (HH)]

\typeout{ptmxcomp: Redefine many accents and symbols from textcomp and
  mathcomp.}%
\typeout{\space\space\space\space\space\space\space\space\space\space
  Some are ugly. These symbols generate a warning when using them.^^J}%

\RequirePackage{textcomp}
\RequirePackage[rmdefault]{mathcomp}
\RequirePackage{graphicx}
\RequirePackage{amsmath}

%    \end{macrocode}
% Umkreiste Zahlen wiederherstellen, wenn Times verwendet (wird von
% textcomp vermurkst):
%    \begin{macrocode}
\DeclareTextAccentDefault{\textcircled}{OMS}


% \cs{textohm} and \cs{tcohm} have to be corrected in case of Times as
% base font. 
\renewcommand*\tcohm{\upOmega}%
\renewcommand*\textohm{%
  \begingroup
  \ifthenelse{\equal{\f@series}{b}}{\boldmath}{}%
  \ifthenelse{\equal{\f@shape}{it}}{%
    \ensuremath{\Omega}%
  }{%
    \ifthenelse{\equal{\f@shape}{sl}}{%
      \ensuremath{\Omega}%
    }{%
      \ensuremath{\upOmega}%
    }%
  }%
  \endgroup
}

%    \end{macrocode}
% \cs{textpertenthousand} and \cs{tcpertenthousand} have to be
% replaced by European Computer Modern in case of Times as base font. 
%    \begin{macrocode}
\newcommand*\hhcls@textpertenthousand{}%
\let\hhcls@textpertenthousand=\textpertenthousand

\renewcommand\textpertenthousand{%
  \begingroup
  \fontfamily{cmr}\selectfont
  \hhcls@textpertenthousand
  \PackageWarning{ptmxcomp}{\string\textperthousand\space and
    \string\tcperthousand\space do not fit to\MessageBreak
    Times (they are taken from European Computer\MessageBreak
    Modern)}%
  \endgroup
}%
\renewcommand*\tcpertenthousand{\text{\textpertenthousand}}

%    \end{macrocode}
% Times does not have old-style digits. 
%    \begin{macrocode}
  \renewcommand*\tcdigitoldstyle{%
    \PackageWarning{ptmxcomp}{\string\tcdigitoldstyle\space is ignored}%
  }

\newcommand*\hhcls@substituteaccent[2]{%
  \expandafter\let\csname hhcls@#1\endcsname=#2
  \expandafter\DeclareRobustCommand\csname #1\endcsname[1]{%
    \begingroup
    \ifthenelse{\equal{\f@family}{ptm}}{%
      \fontencoding{TS1}\fontfamily{cmr}\selectfont
      \csname hhcls@#1\endcsname{%
        \fontencoding{T1}\fontfamily{ptm}\selectfont ##1}%
    }{%
      \ifthenelse{\equal{\f@family}{phv}}{%
        \fontencoding{TS1}\fontfamily{cmss}\selectfont
        \csname hhcls@#1\endcsname{%
          \fontencoding{T1}\fontfamily{phv}\selectfont ##1}%
      }{%
        \ifthenelse{\equal{\f@family}{pcr}}{%
          \fontencoding{TS1}\fontfamily{cmtt}\selectfont
          \csname hhcls@#1\endcsname{%
            \fontencoding{T1}\fontfamily{pcr}\selectfont ##1}%
        }{%
          \csname hhcls@#1\endcsname{##1}%
        }%
      }%
    }%
    \endgroup
    \PackageWarning{ptmxcomp}{Accent #2 substituted by
      the European\MessageBreak
      Computer Modern variant}%
  }%
}
\hhcls@substituteaccent{t}{\t}
\hhcls@substituteaccent{capitaltie}{\capitaltie}
\hhcls@substituteaccent{newtie}{\newtie}
\hhcls@substituteaccent{capitalnewtie}{\capitalnewtie}
\renewcommand*\textleftarrow{\ensuremath{\leftarrow}}%
\renewcommand*\textrightarrow{\ensuremath{\rightarrow}}%
\let\hhcls@textblank=\textblank
\renewcommand*\textblank{%
  \begingroup
    \ifthenelse{\equal{\f@family}{ptm}}{%
      \fontencoding{OT1}\fontfamily{cmr}\selectfont
      \raisebox{0.4ex}[0ex][0ex]{\symbol{32}}%
      \kern-0.25em b%
    }{%
      \ifthenelse{\equal{\f@family}{phv}}{%
        \fontencoding{OT1}\fontfamily{cmss}\selectfont
        \raisebox{0.5ex}[0ex][0ex]{\symbol{32}}%
        \kern-0.25em b%
      }{%
        \ifthenelse{\equal{\f@family}{pcr}}{%
          \fontencoding{OT1}\fontfamily{cmr}\selectfont
          \raisebox{0.3ex}[0ex][0ex]{\symbol{32}}%
          \kern-0.25em b%
        }{%
          \hhcls@textblank
        }%
      }%
    }%
  \endgroup
  \PackageWarning{ptmxcomp}{\string\textblank\space mixed\MessageBreak
    with European Computer Modern}%
}

\renewcommand*\textdblhyphen{%
  \settowidth{\@tempdima}{-}%
  \raisebox{0.15ex}[0pt][0pt]{-}%
  \kern-\the\@tempdima
  \raisebox{-0.15ex}[0pt][0pt]{-}%
  \PackageWarning{ptmxcomp}{Using faked \string\textdblhyphen}%
}
\renewcommand*\textzerooldstyle{0%
  \PackageWarning{ptmxcomp}{Old-style digit 0 not available}%
}
\renewcommand*\textoneoldstyle{1%
  \PackageWarning{ptmxcomp}{Old-style digit 1 not available}%
}
\renewcommand*\texttwooldstyle{2%
  \PackageWarning{ptmxcomp}{Old-style digit 2 not available}%
}
\renewcommand*\textthreeoldstyle{3%
  \PackageWarning{ptmxcomp}{Old-style digit 3 not available}%
}
\renewcommand*\textfouroldstyle{4%
  \PackageWarning{ptmxcomp}{Old-style digit 4 not available}%
}
\renewcommand*\textfiveoldstyle{5%
  \PackageWarning{ptmxcomp}{Old-style digit 5 not available}%
}
\renewcommand*\textsixoldstyle{6%
  \PackageWarning{ptmxcomp}{Old-style digit 6 not available}%
}
\renewcommand*\textsevenoldstyle{7%
  \PackageWarning{ptmxcomp}{Old-style digit 7 not available}%
}
\renewcommand*\texteightoldstyle{8%
  \PackageWarning{ptmxcomp}{Old-style digit 8 not available}%
}
\renewcommand*\textnineoldstyle{9%
  \PackageWarning{ptmxcomp}{Old-style digit 9 not available}%
}
\renewcommand*\textlangle{\ensuremath{\langle}}
\renewcommand*\textrangle{\ensuremath{\rangle}}
\renewcommand*\textmho{\rotatebox[origin=cc]{180}{\textohm}}
\renewcommand*\textbigcircle{\textcircled{}}

\renewcommand*\textuparrow{\ensuremath{\uparrow}}%
\renewcommand*\textdownarrow{\ensuremath{\downarrow}}%
\newcommand*\hhcls@tsone@symbol[2]{%
  \begingroup
    \ifthenelse{\equal{\f@family}{ptm}}{%
      \fontfamily{cmr}%
    }{%
      \ifthenelse{\equal{\f@family}{phv}}{%
        \fontfamily{cmss}%
      }{%
        \ifthenelse{\equal{\f@family}{pcr}}{%
          \fontfamily{cmtt}%
        }{%
        }%
      }%
    }%
    \fontencoding{TS1}\selectfont\symbol{#2}%
  \endgroup
  \PackageWarning{ptmxcomp}{\string#1\space used from\MessageBreak
    European Computer Modern}%
}
\renewcommand*\textborn{\hhcls@tsone@symbol{\textborn}{98}}
\renewcommand*\textdivorced{\hhcls@tsone@symbol{\textdivorced}{99}}
\renewcommand*\textdied{\hhcls@tsone@symbol{\textdied}{100}}
\renewcommand*\textleaf{\hhcls@tsone@symbol{\textleaf}{108}}
\renewcommand*\textmarried{\hhcls@tsone@symbol{\textmarried}{109}}
\renewcommand*\textmusicalnote{\hhcls@tsone@symbol{\textmusicalnote}{110}}
\renewcommand*\textdblhyphenchar{\textdblhyphen}

\renewcommand*\textdollaroldstyle{\$%
  \PackageWarning{ptmxcomp}{No old-style dollar available.\MessageBreak
    Using ordinary one}%
}
\renewcommand*\textcentoldstyle{\textcent%
  \PackageWarning{ptmxcomp}{No old-style cent available.\MessageBreak
    Using ordinary one}%
}
\renewcommand*\textcolonmonetary{%
  \settowidth{\@tempdima}{C}%
  \makebox[\the\@tempdima][c]{\rule{0.05em}{0pt}|}\kern-\the\@tempdima C%
}
\renewcommand*\textwon{%
  \settowidth{\@tempdimb}{W}%
  \makebox[\@tempdimb][c]{\raisebox{.9ex}{\rule{\@tempdimb}{.1ex}}}%
  \kern-\the\@tempdimb
  \makebox[\@tempdimb][c]{\raisebox{.5ex}{\rule{\@tempdimb}{.1ex}}}%
  \kern-\the\@tempdimb
  W%
}
\renewcommand*\textnaira{%
  \settowidth{\@tempdimb}{N}%
  \makebox[\@tempdimb][c]{\raisebox{.9ex}{\rule{\@tempdimb}{.1ex}}}%
  \kern-\the\@tempdimb
  \makebox[\@tempdimb][c]{\raisebox{.5ex}{\rule{\@tempdimb}{.1ex}}}%
  \kern-\the\@tempdimb
  N%
}
\renewcommand*\textguarani{%
  \settowidth{\@tempdima}{G}%
  \makebox[\@tempdima][c]{\rule{0.05em}{0pt}|}\kern-\the\@tempdima G%
}
\renewcommand*\textpeso{%
  \settowidth{\@tempdimb}{P}%
  \makebox[0pt][l]{\raisebox{.4ex}{\rule{0.55\@tempdimb}{0.1ex}}}%
  P%
}
\renewcommand*\textlira{%
  \settowidth{\@tempdimb}{\textsterling}%
  \makebox[0pt][l]{\rule{0.05\@tempdimb}{0pt}%
    \raisebox{.5ex}{\rule{0.64\@tempdimb}{0.1ex}}}%
  \textsterling
}

\renewcommand*\textinterrobang{%
  \settowidth{\@tempdimb}{?}%
  \makebox[\@tempdimb][c]{!}\kern-\@tempdimb?%
}
\renewcommand*\textinterrobangdown{%
  \settowidth{\@tempdimb}{?`}%
  \makebox[\@tempdimb][c]{!`}\kern-\@tempdimb?`%
}
\renewcommand*\textdong{%
  \underline{\dj}%
}

\renewcommand*\textdiscount{%
  \settoheight{\@tempdima}{/}%
  \settoheight{\@tempdimc}{.}%
  \raisebox{\@tempdima-\@tempdimc}{.}\kern-\@tempdimc
  /%
  \kern-\@tempdimc.%
}

\renewcommand*\textestimated{%
  \scalebox{1.3}{e}%
}

\renewcommand*\textopenbullet{%
  \raisebox{-0.45ex}[\height][0pt]{\textdegree}%
}

%\renewcommand*\textservicemark{%
%  \textsuperscript{SM}%
%}

\renewcommand*\textcopyleft{%
  \rotatebox[origin=cc]{180}{\textcopyright}%
}

%\renewcommand*\textcircledP{\textcircled{P}}


\endinput
