%\iffalse -*- doctex -*- \fi
%
%% \RCS$Id: pmn-hypr.sty,v 1.6 2004/07/07 05:59:10 turtle Exp $
%% \RCS$Revision: 1.6 $
%% \RCS$Date: 2004/07/07 05:59:10 $
%
%\iffalse metacomment
% -*- latex-mode -*-
% % $Id: pmn-hypr.sty,v 1.6 2004/07/07 05:59:10 turtle Exp $
% % (C) 2003 Peter Møller Neergaard
%%  
%%   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 option) 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.
%
% This program consists of the file pmn-hypr.sty.
% 
% To print the documentation (which for the moment is uninteresting):
% remove (or comment out) the line
%
%   \endinput
%
% occurring immediately after
%
%   %<*documentation>
% 
%\fi
%
% \CheckSum{21} 
% \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         \~}
%
% \MakeShortVerb{\"}
%
% \title{The \package{pmn-hypr} package\thanks
%   {This file has CVS revision \RCSRevision, dated \RCSDate.}}
% \author{Peter Møller Neergaard}
% \maketitle
%
% \begin{abstract}
% This package adapts  Joe Well's \package{jbw-use-hyperref} with
% a few stylistic changes of my desire:
% \end{abstract}
%
% Using the option "nohyper" when loading is disabling all
% hyperreferences; this allows us to change quickly between a
% hypertext version and a standard version.  The command
% \mcmd{\ifhyper}\marg{consequent}{alternative} allows you to choose
% between two alternatives in the two cases.
%
% \begin{enumerate}
% \item the references are colored
% \end{enumerate}
%
% \section{Package identification}
% 
% We identify ourselves.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pmn-hypr}[2003/05/23 Loading hyperref with PMN settings]
%    \end{macrocode}
%
% \begin{macro}{\ifhyper} \mbox{}
%    \begin{macrocode}
\makeatletter
\newcommand{\ifhyper}{}
\let\ifhyper\@firstoftwo
\DeclareOption{nohyper}{%
  \PassOptionsToClass{draft=true}{hyperref}%
  \let\ifhyper\@secondoftwo
  \pmn@hpr@backrf@fls}
%    \end{macrocode}
% \changes{}{2003/11/19}{Renamed from \cmd{\pmn@hpr@if@disable} to \cmd{\ifhyper}}
% \end{macro} ^^A \ifhyper
%
% \begin{macro}{\pmn@hpr@if@backrf}
% \begin{macro}{\pmn@hpr@backrf@true}
% \begin{macro}{\pmn@hpr@backrf@fls} \mbox{}
%    \begin{macrocode}
\newcommand{\pmn@hpr@backrf@true}{\let\pmn@hpr@if@backrf\@firstoftwo}
\newcommand{\pmn@hpr@backrf@fls}{\let\pmn@hpr@if@backrf\@secondoftwo}
\pmn@hpr@backrf@true
\DeclareOption{nobackref}{\pmn@hpr@backrf@fls}
\DeclareOption{backref}{\pmn@hpr@backrf@true}
%    \end{macrocode}
% \end{macro} ^^A \pmn@hpr@backrf@fls
% \end{macro} ^^A \pmn@hpr@backrf@true
% \end{macro} ^^A \pmn@hpr@if@backrf
%
% \begin{macro}{\pmn@hpr@if@noaddcontln}
% \begin{macro}{\pmn@hpr@noaddcontln@true}
% \begin{macro}{\pmn@hpr@noaddcontln@fls}
%   The \package{lncs} format writes to the "toc"-file as part of
%   defining a title.  As the title commands implicitly uses \cmd{\let}
%   (through \cmd{\let}) this results in an error.
%    \begin{macrocode}
\newcommand{\pmn@hpr@noaddcontln@true}{\let\pmn@hpr@if@noaddcontln\@iden}
\newcommand{\pmn@hpr@noaddcontln@fls}{\let\pmn@hpr@if@noaddcontln\@gobble}
\pmn@hpr@noaddcontln@fls
\DeclareOption{lncs}{\pmn@hpr@noaddcontln@true}
\DeclareOption{noaddcontentsline}{\pmn@hpr@noaddcontln@fls}
%    \end{macrocode}
% \end{macro} ^^A \pmn@hpr@noaddcontln@fls
% \end{macro} ^^A \pmn@hpr@noaddcontln@true
% \end{macro} ^^A \pmn@hpr@if@noaddcontln
%
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
% \changes{}{2003/11/04}{Added option nohyper} 
%  If \package{hyperref} is requested load Joe's package on which we
%  depend
%    \begin{macrocode}
\ifhyper
{\RequirePackage{jbw-use-hyperref}
%    \end{macrocode}
% Ask \package{hyperref} to use colored links.
%    \begin{macrocode}
\setkeys{Hyp}{colorlinks=true}
%    \end{macrocode}
% The "nohyper" option simply disables everything:
%    \begin{macrocode}
\pmn@hpr@if@noaddcontln{%
  \AtBeginDocument{%
  \renewcommand{\addcontentsline}[3]{}}}
%    \end{macrocode}
% The back referenced bibliography can only be disabled by restoring
% the old which is not saved until load time.:
%    \begin{macrocode}
\pmn@hpr@if@backrf{}{%
\AtBeginDocument{%
  \let\bibitem\BRorg@bibitem
  \let\thebibliography\BRorg@thebibliography}}}%
%    \end{macrocode}
% When \package{hyperref} is not requested we simply load the dummy
% stub. 
%    \begin{macrocode}
 {\RequirePackage{nohyperref}%
  \pmn@hpr@if@backrf{\RequirePackage{backref}}{}}
%    \end{macrocode}
% \changes{}{2003/11/10}{based \texttt{nohyper} option on \package{nohyperref}}
%    \begin{macrocode}
%    \end{macrocode}
% \begin{macro}{\backref}
%   \cmd{\backref} holds the text preceding a backreference.  By
%   default it is empty when using hyperlinks, but we prefer an
%   explicit text
%    \begin{macrocode}
\def\backref{Referenced on pp.~}
%    \end{macrocode}
% \changes{}{2003/11/02}{Added explicit text for backreference}
% \end{macro}
%
% \StopEventually{}
% 
% And the commands to typeset the documentation.  All enclosed in
% "<*documentation>"$\ldots$"</documentation>" so we exclude it if we
% ever make a docstrip file.  For now, we have simply commented it out.
% First we have to undefine the \cmd{\appendix}, \cmd{\maketitle}, and
% \cmd{\newblock}
% which has been defined above.
%    \begin{macrocode}
%<*documentation>
\endinput
\makeatletter
\let\appendix\@undefined
\let\maketitle\@undefined
\let\newblock\@undefined
\makeatother
%    \end{macrocode}
% Then we can start a real document preamble.
%    \begin{macrocode}
\documentclass{pmn-ldoc}
\newcommand{\docdate}{2003/11/02}
\usepackage[latin1]{inputenc}
 % \OnlyDescription
 % \DisableCrossrefs
\begin{document}
  \DocInput{pmn-hypr.sty}
\end{document}
%</documentation>
%    \end{macrocode}
% \Finale \sloppy \PrintChanges
