% \iffalse meta-comment
%
% uri package
% file version: v1.0a
% file date:          2011/03/04
% documentation date: 2011/03/04
%
% Copyright (C) 2011 H.-Martin M\"{u}nch (Martin dot Muench at Uni-Bonn dot de)
% Portions of code copyrighted by other people as marked.
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any later
% version. This version of this license is in
%    http://www.latex-project.org/lppl/lppl-1-3c.txt
% and the latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of
% LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work is H.-Martin Muench.
%
% This work consists of the main source file uri.dtx
% and the derived files
%    uri.sty, uri.ins, uri.drv,
%    uri-example.tex, uri.pdf.
%
% Unpacking:
%    (a) If uri.ins is present:
%           tex uri.ins
%    (b) Without uri.ins:
%           tex uri.dtx
%    (c) If you insist on using LaTeX
%           latex \let\install=y\input{uri.dtx}
%        (quote the arguments according to the demands of your shell)
%
% Documentation:
%    (a) If uri.drv is present:
%           (pdf)latex uri.drv
%           makeindex -s gind.ist uri.idx
%           (pdf)latex uri.drv
%           makeindex -s gind.ist uri.idx
%           (pdf)latex uri.drv
%    (b) Without uri.drv:
%           (pdf)latex uri.dtx
%           makeindex -s gind.ist uri.idx
%           (pdf)latex uri.dtx
%           makeindex -s gind.ist uri.idx
%           (pdf)latex uri.dtx
%
%    The class ltxdoc loads the configuration file ltxdoc.cfg
%    if available. Here you can specify further options, e.g.
%    use DIN A4 as paper format:
%       \PassOptionsToClass{a4paper}{article}
%
% Installation:
%    TDS:tex/latex/uri/uri.sty
%    TDS:doc/latex/uri/uri.pdf
%    TDS:doc/latex/uri/uri-example.tex
%    TDS:source/latex/uri/uri.dtx
%
%<*ignore>
\begingroup
  \def\x{LaTeX2e}%
\expandafter\endgroup
\ifcase 0\ifx\install y1\fi\expandafter
         \ifx\csname processbatchFile\endcsname\relax\else1\fi
         \ifx\fmtname\x\else 1\fi\relax
\else\csname fi\endcsname
%</ignore>
%<*install>
\input docstrip.tex

\obeyspaces
\Msg{*************************************************}
\Msg{* Installation                                  *}
\Msg{* Package: uri v1.0a 2011/03/04 LaTeX2e package *}
\Msg{* Hyperlinks URIs like DOI,HDL,NBN,PubMed (HMM) *}
\Msg{*************************************************}

\keepsilent
\askforoverwritefalse

\let\MetaPrefix\relax
\preamble

This is a generated file.

IMPORTANT NOTICE:
The package takes options.

The usual disclaimers apply:
If it doesn't work right that's your problem.
(Nevertheless, send an e-mail to the maintainer
 when you find an error in this package.)

This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
version 1.3c of this license or (at your option) any later
version. This version of this license is in
   http://www.latex-project.org/lppl/lppl-1-3c.txt
and the latest version of this license is in
   http://www.latex-project.org/lppl.txt
and version 1.3c or later is part of all distributions of
LaTeX version 2005/12/01 or later.

This work has the LPPL maintenance status "maintained".

The Current Maintainer of this work is H.-Martin Muench
(Martin dot Muench at Uni-Bonn dot de).

This work consists of the main source file uri.dtx
and the derived files
   uri.sty, uri.pdf, uri.ins, uri.drv,
   uri-example.tex.

\endpreamble
\let\MetaPrefix\DoubleperCent

\generate{%
  \file{uri.ins}{\from{uri.dtx}{install}}%
  \file{uri.drv}{\from{uri.dtx}{driver}}%
  \file{ltxdoc.cfg}{\from{uri.dtx}{ltxdoc}}%
  \usedir{tex/latex/uri}%
  \file{uri.sty}{\from{uri.dtx}{package}}%
  \usedir{doc/latex/uri}%
  \file{uri-example.tex}{\from{uri.dtx}{example}}%
}

\obeyspaces
\Msg{*************************************************************}
\Msg{*                                                           *}
\Msg{* To finish the installation you have to move the following *}
\Msg{* file into a directory searched by TeX:                    *}
\Msg{*                                                           *}
\Msg{* uri.sty                                                   *}
\Msg{*                                                           *}
\Msg{* To produce the documentation run the file `uri.drv'       *}
\Msg{* through (pdf)LaTeX, e.g.                                  *}
\Msg{*  pdflatex uri.drv                                         *}
\Msg{*  makeindex -s gind.ist uri.idx                            *}
\Msg{*  pdflatex uri.drv                                         *}
\Msg{*  makeindex -s gind.ist uri.idx                            *}
\Msg{*  pdflatex uri.drv                                         *}
\Msg{*                                                           *}
\Msg{* At least two runs are necessary e.g. to get the           *}
\Msg{*  references right!                                        *}
\Msg{*                                                           *}
\Msg{* Happy TeXing!                                             *}
\Msg{*                                                           *}
\Msg{*************************************************************}

\endbatchfile

%</install>
%<*ignore>
\fi
%</ignore>
%
% \section{The documentation driver file}
%
% The next bit of code contains the documentation driver file for
% \TeX{}, i.\,e., the file that will produce the documentation you
% are currently reading. It will be extracted from this file by the
% \texttt{docstrip} programme. That is, run \LaTeX\ on \texttt{docstrip}
% and specify the \texttt{driver} option when \texttt{docstrip}
% asks for options.
%
%    \begin{macrocode}
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesFile{uri.drv}[2011/03/04 v1.0a
            Hyperlinks URIs like DOI,HDL,NBN,PubMed (HMM)]%
\documentclass{ltxdoc}[2007/11/11]% v2.0u
\usepackage[hiresbb]{lscape}[2000/10/22]% v3.01, from the graphics bundle
\usepackage{holtxdoc}[2010/04/24]% v0.19
%% uri may work with earlier versions of LaTeX2e and those
%% class and packages, but this was not tested.
%% Please consider updating your LaTeX, class, and packages
%% to the most recent version (if they are not already the most
%% recent version).
%% Warning: holtxdoc, 2010/04/24 v0.19, requires the packages
%% hypdoc,   2010/03/26, v1.9
%% hyperref, 2010/03/30, v6.80u (latest: 2011/02/07, 6.82b)
%% pdftexcmds, 2010/04/01, v0.9
%% ltxcmds,  2010/03/09, v1.4   (latest: 2010/04/26, v1.7)
%% hologo,   2010/04/24, v1.2
%% array                        (latest: 2008/09/09, v2.4c)
%% (or more recent versions) and does neither work with
%% nor check for earlier versions!
\hypersetup{%
 pdfsubject={Hyperlinks URIs like DOI, HDL, NBN, PubMed (HMM)},%
 pdfkeywords={LaTeX, uri, hyperlink, arXiv, ASIN, DOI, HDL, NBN, PubMed, OID, TINY, TINY:P, preview, XMPP, citeurl, mailto, ukoeln, uref, Hans-Martin Muench},%
 pdfencoding=auto,%
 pdflang={en},%
 breaklinks=true,%
 linktoc=all,%
 pdfstartview=FitH,%
 pdfpagelayout=OneColumn,%
 bookmarksnumbered=true,%
 bookmarksopen=true,%
 bookmarksopenlevel=3,%
 pdfmenubar=true,%
 pdftoolbar=true,%
 pdfwindowui=true,%
 pdfnewwindow=true%
}
\setlength\hfuzz{1pt} % Ignore slight overfulls.
\CodelineIndex
%\PageIndex           % instead of \CodelineIndex to get the page numbers
\EnableCrossrefs
%\DisableCrossrefs    % Say \DisableCrossrefs if index is ready.
%\RecordChanges       % Gather update information.
%\OnlyDescription     % Comment out for implementation details.
\hyphenation{created document docu-menta-tion every-thing ignored}
\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}%
\begin{document}
  \DocInput{uri.dtx}%
\end{document}
%</driver>
%    \end{macrocode}
%
%    \begin{macrocode}
%<*ltxdoc>
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesFile{ltxdoc.cfg}[2011/03/04 v1.0a configuration file for uri (HMM)]
  %% Code from original ltxdoc.cfg [2007/01/08 latex-tds: ltxdoc.cls configuration (HO)],  %%
  % copyrighted 2006, 2007 Heiko Oberdiek, part of project `latex-tds'.
  % That 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.3c or later is part of all distributions of LaTeX
  % version 2005/12/01 or later.
  % That work has the LPPL maintenance status `maintained'.
  % The Current Maintainer of that work is Heiko Oberdiek.
  %
  \PassOptionsToClass{a4paper}{article}
  \AtEndOfClass{%
    \RequirePackage[numbered]{hypdoc}[2010/03/26]% v1.9
    \pdfstringdefDisableCommands{%
      \let\env\relax % longtable.dtx
      \let\mytt\relax % tabularx.dtx
    }%
    \addtolength{\topmargin}{-10mm}%
    \addtolength{\textheight}{20mm}%
    % Depending on the page style, the head or foot area
    % are put into the text area.
    % Usually the page style is the default "plain".
    % tools/verbatim.dtx uses "myheadings".
    \def\string@plain{plain}%
    \def\string@myheadings{myheadings}%
    \def\current@pagestyle{plain}%
    \let\ltxdoc@cfg@pagestyle\pagestyle
    \def\pagestyle#1{%
      \def\current@pagestyle{#1}%
      \ltxdoc@cfg@pagestyle{#1}%
    }%
    \edef\ltxdoc@cfg@jobname{\jobname}%
    \def\ltxdoc@cfg@longtable{longtable}%
    \@onelevel@sanitize\ltxdoc@cfg@longtable
    \ifx\ltxdoc@cfg@jobname\ltxdoc@cfg@longtable
      \def\current@pagestyle{both}%
    \fi
    \let\ltxdoc@cfg@document\document
    \def\document{%
      \ifx\current@pagestyle\string@plain
        \addtolength{\textheight}{\headheight}%
        \addtolength{\textheight}{\headsep}%
        \setlength{\headheight}{0pt}%
        \setlength{\headsep}{0pt}%
        \global\textheight\textheight
        \global\headheight\headheight
        \global\headsep\headsep
      \fi
      \ifx\current@pagestyle\string@myheadings
        \addtolength{\textheight}{\footskip}%
        \global\textheight\textheight
      \fi
      \ltxdoc@cfg@document
    }%
  %% End of code from original ltxdoc.cfg [2007/01/08 latex-tds: ltxdoc.cls configuration (HO)]  %%
  %% Place additional code here.  %%
  }

%</ltxdoc>
%    \end{macrocode}
%
% \fi
%
% \CheckSum{253}
%
% \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         \~}
%
% \GetFileInfo{uri.drv}
%
% \begingroup
%   \def\x{\#,\$,\^,\_,\~,\ ,\&,\{,\},\%}%
%   \makeatletter
%   \@onelevel@sanitize\x
% \expandafter\endgroup
% \expandafter\DoNotIndex\expandafter{\x}
% \expandafter\DoNotIndex\expandafter{\string\ }
% \begingroup
%   \makeatletter
%     \lccode`9=32\relax
%     \lowercase{%^^A
%       \edef\x{\noexpand\DoNotIndex{\@backslashchar9}}%^^A
%     }%^^A
%   \expandafter\endgroup\x
% \DoNotIndex{\documentclass,\usepackage,\hfuzz,\small,\tt,\begin,\end}
% \DoNotIndex{\NeedsTeXFormat,\filedate,\fileversion,\DoNotIndex}
% \DoNotIndex{\def,\edef,\divide,\advance,\multiply}
% \DoNotIndex{\",\-,\,,\\,\hskip,\H,\ldots,\indent,\noindent,\textbackslash}
% \DoNotIndex{\textbf,\textit,\textquotedblleft,\textquotedblright,\textsf,\texttt,\textsc}
% \DoNotIndex{\ifthenelse,\and,\equal,\whiledo,\if,\ifx,\ifnum,\else,\fi}
% \DoNotIndex{\CodelineIndex,\EnableCrossrefs,\DisableCrossrefs}
% \DoNotIndex{\DocInput,\AltMacroFont}
% \DoNotIndex{\@ne,\tw@,\thr@@}
% \DoNotIndex{\newpage,\pagebreak,\newline,\linebreak,\nolinebreak}
% \DoNotIndex{\lipsum,\MessageBreak,\pageref,\protect}
% \DoNotIndex{\RecordChanges,\OnlyDescription}
% \DoNotIndex{\smallskip,\medskip,\bigskip,\space,\,}
% \DoNotIndex{\item}
% \DoNotIndex{\plainTeX,\TeX,\LaTeX,\pdfLaTeX}
% \DoNotIndex{\holtxdoc,\kvoptions,\Oberdiek}
% \DoNotIndex{\gdef,\listfiles,\undefined,\value}
% \DoNotIndex{\markboth,\M"{u}ench,\section}
% \DoNotIndex{\href,\pagenumbering,\textsc,\xext,\6,\ProvidesPackage}
%
% \title{The \textsf{uri} package\footnote{This file%
%        has version number v1.0a, last%
%        revised 2011/03/04, documentation dated 2011/03/04.}}
% \author{H.-Martin M\"{u}nch\\
% (\texttt{Martin dot Muench at Uni-Bonn dot de})}
% \date{2011/03/04}
%
% \maketitle
%
% \begin{abstract}
% This package allows to automatically hyperlink uris of type
% arXiv, ASIN, DOI, HDL, NBN, PubMed, OID, TINY, TINY with preview, and XMPP
% in such a way that they are resolved to an address understood by web browsers
% without native support or add-ons for such types of uri
% and provides commands |citeurl|, |mailto|, |ukoeln|, and |uref|.
% \end{abstract}
%
% \bigskip
%
% \noindent Disclaimer for web links: The author is not responsible for any contents
% referred to in this work unless he has full knowledge of illegal contents.
% If any damage occurs by the use of information presented there, only the
% author of the respective pages might be liable, not the one who has referred
% to these pages.
%
% \bigskip
%
% Trademarks appear throughout this documentation without any trademark symbol;
% they are the property of their respective trademark owner. There is no intention
% of infringement; the usage is to the benefit of the trademark owner.
%
% \bigskip
%
% \noindent Save per page about $200\unit{ml}$ water,
% $2\unit{g}$ CO$_{2}$ and $2\unit{g}$ wood:\\
% Therefore please print only if this is really necessary.
%
% \tableofcontents
%
% \newpage
%
% \section{Introduction}
% \indent Diverse types of URIs exists. While every web browser knows how to handle
% an uri like \url{http://www.mozilla.org/} (otherwise it should not call itself
% web browser), there are probably quite a few web browsers which cannot handle e.\,g.
% \url{arXiv:0905.0105v2} (just test it by clicking the hyperlink).
% There are four types of solution:
% \begin{enumerate}
% \item Change the programme code of the web browser to recognise the uri. While
% this is probably the best way, it is also the most difficult one (if it is
% possible at all, e.\,g. for proprietary web browsers).
%
% \item Use (write) a plug-in resolving the uri before passing it to the
% browser. For the Firefox browser this is done by the QuietUrl extension (if
% case be after manually adding the respective rule for the according uri
% type), available at
% \url{https://addons.mozilla.org/de/firefox/downloads/latest/5243/}.
% While this is quite useful, one cannot assume that everybody has an according
% plug-in (or even that an according plug-in exists for the used (version of the)
% web browser).
%
% \item Use only the full, expanded uri. Then they can be reliable accessed by
% everybody, but those uris usually become quite long, which is not really
% nice (and line breaks have their own problems).
%
% \item
%
% \begin{enumerate}
% \item Write the short uri, but link to the long, expanded
% one (e.\,g. \href{http://arxiv.org/abs/0905.0105v2}{arXiv:0905.0105v2}).
% This combines reliability and aesthetics, but can be cumbersome to write,
% especially when a lot of those addresses are used.
%
% \item Do as described at (a), but automatically. This is the way this package
% can be used.
% \end{enumerate}
% \end{enumerate}
%
% \section{Usage}
%
% \indent Just load the package placing
% \begin{quote}
%   |\usepackage[<|\textit{options}|>]{uri}|
% \end{quote}
% \noindent in the preamble of your \LaTeXe\ source file
% (preferably after calling the \textsf{url} and \textsf{hyperref} package).
% For the different types of uri and available options see the documented
% code below.\\
%
% \section{Alternatives\label{sec:Alternatives}}
%
% There are similar packages, which do (or do not) similar
% things. Here is a list of some possible alternatives:\\
%
% \DescribeMacro{doi}
% \begin{description}
% \item[-] The \textsf{doi} package \textquotedblleft contains a user-level command
% |\doi{}|, which takes a doi number, and creates a hyperlink from it. The format
% of the doi can be controlled by redefining the |\doitext| command\textquotedblright
% \ (from the \textsf{doi} package \texttt{ReadMe}). It does not handle other types
% of uris, naturally.
% \end{description}%
%
% \DescribeMacro{doipubmed}
% \begin{description}
% \item[-] The \textsf{doipubmed} package handles |DOI| as well as |PubMed| uris.
% \end{description}%
%
% \bigskip
%
% \noindent (You programmed or found another alternative,
%  which is available at \CTAN{}?\\
%  OK, send an e-mail to me with the name, location at \CTAN{},
%  and a short notice, and I will probably include it in
%  the list above.)\\
%
% \smallskip
%
% \noindent About how to get those packages, please see subsection~\ref{ss:Downloads}.
%
% \newpage
% \begin{landscape}
%
% \section{Example}
%
%    \begin{macrocode}
%<*example>
\documentclass{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{hyperref}[2011/02/07]% v6.82b
\hypersetup{%
 extension=pdf,%
 plainpages=false,%
 pdfpagelabels=true,%
 hyperindex=false,%
 pdflang={en},%
 pdftitle={uri package example},%
 pdfauthor={Hans-Martin Muench},%
 pdfsubject={Example for the uri package},%
 pdfkeywords={LaTeX, uri, Hans-Martin Muench},%
 pdfview=Fit,%
 pdfstartview=Fit,%
 pdfpagelayout=SinglePage,%
 bookmarksopen=false%
}
\usepackage{uri}[2011/03/04]% v1.0a
\listfiles
\begin{document}
\pagenumbering{arabic}

\section*{Example for uri}
\markboth{Example for uri}{Example for uri}

This example demonstrates the use of package\newline
\textsf{uri}, v1.0a as of 2011/03/04 (HMM).\newline
No options were given, thereby the default options were used.\newline
For more details please see the documentation!\newline

\bigskip

The \textsf{uri} package allows to hyperlink (with the \textsf{hyperref} package
of \textsc{Heiko Oberdiek}) uris of type
\begin{itemize}
\item[--] arXiv (\url{http://www.arXiv.org/}), e.\,g. \arxiv{0905.0105v2}.

\item[--] ASIN \newline
(\url{%
http://www.amazon.co.uk/gp/help/customer/display.html/277-3416785-8259466?ie=UTF8&nodeId=898182}%
), \newline
(that one is a good example for using a TINY url: \tinyuri{687j3oh})\newline
  e.\,g. \asin{0471491039}.

\item[--] DOI (\url{http://www.doi.org/index.html}), e.\,g. \doi{10.1000/182}.

\item[--] HDL (\url{http://www.handle.net/factsheet.html}), e.\,g. \hdl{2128/2486}.

\item[--] NBN (\url{http://nbn-resolving.de/urn:nbn:de:1111-200606309}), \newline
  e.\,g. \nbn{urn:nbn:de:kobv:83-opus-16928}. (You could also use the option
  \texttt{nbnpre=URN:NBN:DE:} and then \texttt{\textbackslash nbn\{kobv:83-opus-16928\}}.)

\item[--] PubMed (\url{http://www.ncbi.nlm.nih.gov/pubmed/}), \newline
  e.\,g. \pubmed{17822909}.

\item[--] OID (\url{http://www.oid-info.com/#oid}), e.\,g. \oid{2.16.840}.

\item[--] TINY (\url{http://tinyurl.com}), e.\,g. \tinyuri{MST19-105603} \newline
  (uses \texttt{tinyuri} instead of \texttt{tiny}, because that command already existed).

\item[--] TINY with preview, e.\,g. \tinypuri{MST19-105603}.

\item[--] XMPP (\url{http://xmpp.org/about/}), e.\,g. \xmpp{time}.
\end{itemize}

Additionally some commands are provided by the uri package:
\begin{itemize}
\item[--] \texttt{siteurl} similar to the command of the \textsf{doipubmed} package, \newline
  \citeurl{http://ctan.org/pkg/doipubmed}.

\item[--] \texttt{mailto} for e-mail addresses, e.\,g. \mailto{spam@dante.de}.
  Adding something like \texttt{?subject=Concerning uri package} after \texttt{mailto:\#\#1}
  in the style file would even add this subject to (every!) e-mail hyperlink.

\item[--] \texttt{ukoeln} for short University of Cologne (Universit\"{a}t zu K\"{o}ln,
  U~Koeln; Germany; \url{http://www.pressoffice.uni-koeln.de/}) addresses, \newline
  e.\,g. \ukoeln{XM492}.

\item[--] \texttt{uref} takes two arguments, the first gives the target of the hyperlink,
the second gives the text to be displayed for it, e.\,g. information about
the \uref{http://ctan.org/pkg/pageslts}{pagesLTS} package, similar to \texttt{\textbackslash href}.
\end{itemize}

\bigskip

Text before (e.\,g. \textsf{DOI:}) and after (well, no example) the uri to be displayed can be
adapted by the package options.\newline

Even \begin{verbatim} \doi{1.2/3-4(5)6:7<8::A-B9>0.9.C8;7-\654%23!$} \end{verbatim}
would work (if that DOI would exist):\newline
\doi{1.2/3-4(5)6:7<8::A-B9>0.9.C8;7-\654%23!$}.

\end{document}
%</example>
%    \end{macrocode}
%
% \StopEventually{
% }
%
% \section{The implementation}
%
% We start off by checking that we are loading into \LaTeXe\ and
% announcing the name and version of this package.
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{uri}[2011/03/04 v1.0a
   Hyperlinks URIs like DOI,HDL,NBN,PubMed (HMM)]

%    \end{macrocode}
%
% A short description of the \textsf{uri} package:
%
%    \begin{macrocode}
%% Allows to automatically hyperlink uris of type
%% arXiv, ASIN, DOI, HDL, NBN, PubMed, OID, TINY, TINY with preview, XMPP
%% in such a way that they are resolved to an address understood by browsers
%% without native support or add-ons for such types of uri
%% and provides commands citeurl, mailto, ukoeln, and uref.
%    \end{macrocode}
%
% For the handling of the options we need the \textsf{kvoptions}
% package of Heiko Oberdiek (see subsection~\ref{ss:Downloads}):
%
%    \begin{macrocode}
\RequirePackage{kvoptions}[2010/02/22]% v3.7
%    \end{macrocode}
%
% We need the \textsf{url} package of Donald Arseneau and Robin Fairbairns
% (see subsection~\ref{ss:Downloads}):
%
%    \begin{macrocode}
\RequirePackage{url}[2006/04/12]% v3.3, documentation as of 2010/01/20

%    \end{macrocode}
%
% When spaces shall be kept, |\usepackage[obeyspaces]{url}| should be used
% in the document (and |\ | in the options), and for using special characters even
% |\usepackage[obeyspaces,T1]{url}| could be a good idea.~-
% When the \textsf{hyperref} package has been loaded, we hyperlink the uris,
% otherwise we do not do this.\\
% \textbf{So, if you want hyperlinks, load \textsf{uri} after \textsf{hyperref},
% otherwise before} (or no \textsf{hyperref} at all, of course).\\
%
% For each supported uri type there are two options, \texttt{...pre} and \texttt{...post},
% e.\,g. \texttt{asinpre} and \texttt{asinpost}. For example the option |doipre={DOI:\ }|
% results in \textquotedblleft DOI:\ \textquotedblright \ (without the quotation marks,
% of course) to be written before the DOIs.\\
% (There are more brackets and braces then necessary here, but somebody
% is going to tamper with it, and then it will not work~-- better prevent this.)
%
%    \begin{macrocode}
\SetupKeyvalOptions{family = uri, prefix = uri@}

\DeclareStringOption[{arXiv:}]{arxivpre}[{arXiv:}]
\DeclareStringOption[{}]{arxivpost}[{}]

\DeclareStringOption[{ASIN:}]{asinpre}[{ASIN:}]
\DeclareStringOption[{}]{asinpost}[{}]

\DeclareStringOption[{DOI:}]{doipre}[{DOI:}]
\DeclareStringOption[{}]{doipost}[{}]

\DeclareStringOption[{HDL:}]{hdlpre}[{HDL:}]
\DeclareStringOption[{}]{hdlpost}[{}]

\DeclareStringOption[{}]{nbnpre}[{}]
\DeclareStringOption[{}]{nbnpost}[{}]

\DeclareStringOption[{PubMed:}]{pubmedpre}[{PubMed:}]
\DeclareStringOption[{}]{pubmedpost}[{}]

\DeclareStringOption[{URN:OID:}]{oidpre}[{URN:OID:}]
\DeclareStringOption[{}]{oidpost}[{}]

\DeclareStringOption[{TINY:}]{tinypre}[{TINY:}]
\DeclareStringOption[{}]{tinypost}[{}]

\DeclareStringOption[{TINY:P:}]{tinyppre}[{TINY:P:}]
\DeclareStringOption[{}]{tinyppost}[{}]

\DeclareStringOption[{URN:XMPP:}]{xmpppre}[{}]
\DeclareStringOption[{}]{xmpppost}[{}]

\DeclareStringOption[{<}]{citeurlpre}[{<}]
\DeclareStringOption[{>}]{citeurlpost}[{>}]

\DeclareStringOption[{mailto:}]{mailtopre}[{mailto:}]
\DeclareStringOption[{}]{mailtopost}[{}]

\DeclareStringOption[{http://ukoeln.de/}]{ukoelnpre}[{http://ukoeln.de/}]
\DeclareStringOption[{}]{ukoelnpost}[{}]

\ProcessKeyvalOptions*

%    \end{macrocode}
%
% Now we define the commands, using |\tinyuri| instead of |\tiny|, because that command already existed before
% (and accordingly |\tinypuri|, even if |\tinyp| did not exist).
%
%    \begin{macrocode}
\@ifpackageloaded{hyperref}{%
\newcommand{\uref}[2]{\protect\href{#1}{\protect\nolinkurl{#2}}}%
%% arXiv
\DeclareUrlCommand\arxiv{\def\UrlLeft##1\UrlRight{\href{http://arxiv.org/abs/##1}{\uri@arxivpre##1\uri@arxivpost}}}%
%% ASIN
\DeclareUrlCommand\asin{\def\UrlLeft##1\UrlRight{\href{http://amzn.com/##1}{\uri@asinpre##1\uri@asinpost}}}%
%% DOI
\DeclareUrlCommand\doi{\def\UrlLeft##1\UrlRight{\href{http://dx.doi.org/##1}{\uri@doipre##1\uri@doipost}}}%
%% HDL
\DeclareUrlCommand\hdl{\def\UrlLeft##1\UrlRight{\href{http://hdl.handle.net/##1}{\uri@hdlpre##1\uri@hdlpost}}}%
%% NBN
\DeclareUrlCommand\nbn{\def\UrlLeft##1\UrlRight{\href{http://nbn-resolving.org/##1}{\uri@nbnpre##1\uri@nbnpost}}}%
%% OID
\DeclareUrlCommand\oid{\def\UrlLeft##1\UrlRight{\href{http://www.oid-info.com/cgi-bin/display?oid=##1&submit=Display&action=display}{\uri@oidpre##1\uri@oidpost}}}%
%% PubMed
\DeclareUrlCommand\pubmed{\def\UrlLeft##1\UrlRight{\href{http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=##1&dopt=Abstract}{\uri@pubmedpre##1\uri@pubmedpost}}}%
%% TINY
\DeclareUrlCommand\tinyuri{\def\UrlLeft##1\UrlRight{\href{http://tinyurl.com/##1}{\uri@tinypre##1\uri@tinypost}}}%
%% TINYP (tiny with preview)
\DeclareUrlCommand\tinypuri{\def\UrlLeft##1\UrlRight{\href{http://preview.tinyurl.com/##1}{\uri@tinyppre##1\uri@tinyppost}}}%
%% XMPP
\DeclareUrlCommand\xmpp{\def\UrlLeft##1\UrlRight{\href{http://xmpp.org/protocols/urn:xmpp:##1/}{\uri@xmpppre##1\uri@xmpppost}}}%
%% citeurl
\DeclareUrlCommand\citeurl{\def\UrlLeft##1\UrlRight{\href{##1}{\uri@citeurlpre##1\uri@citeurlpost}}}%
%% mailto
\DeclareUrlCommand\mailto{\def\UrlLeft##1\UrlRight{\href{mailto:##1}{\uri@mailtopre##1\uri@mailtopost}}}%
%% ukoeln
\DeclareUrlCommand\ukoeln{\def\UrlLeft##1\UrlRight{\href{http://ukoeln.de/##1}{\uri@ukoelnpre##1\uri@ukoelnpost}}}%
}{% otherwise, i.e. if hyperref has not been loaded:
\newcommand{\uref}[2]{\protect\nolinkurl{#2}}%
%% arXiv
\DeclareUrlCommand\arxiv{\def\UrlLeft##1\UrlRight{\uri@arxivpre##1\uri@arxivpost}}%
%% ASIN
\DeclareUrlCommand\asin{\def\UrlLeft##1\UrlRight{\uri@asinpre##1\uri@asinpost}}%
%% DOI
\DeclareUrlCommand\doi{\def\UrlLeft##1\UrlRight{\uri@doipre##1\uri@doipost}}%
%% HDL
\DeclareUrlCommand\hdl{\def\UrlLeft##1\UrlRight{\uri@hdlpre##1\uri@hdlpost}}%
%% NBN
\DeclareUrlCommand\nbn{\def\UrlLeft##1\UrlRight{\uri@nbnpre##1\uri@nbnpost}}%
%% OID
\DeclareUrlCommand\oid{\def\UrlLeft##1\UrlRight{\uri@oidpre##1\uri@oidpost}}%
%% PubMed
\DeclareUrlCommand\pubmed{\def\UrlLeft##1\UrlRight{\uri@pubmedpre##1\uri@pubmedpost}}%
%% TINY
\DeclareUrlCommand\tinyuri{\def\UrlLeft##1\UrlRight{\uri@tinypre##1\uri@tinypost}}%
%% TINYP (tiny with preview)
\DeclareUrlCommand\tinypuri{\def\UrlLeft##1\UrlRight{\uri@tinyppre##1\uri@tinyppost}}%
%% XMPP
\DeclareUrlCommand\xmpp{\def\UrlLeft##1\UrlRight{\uri@xmpppre##1\uri@xmpppost}}%
%% citeurl
\DeclareUrlCommand\citeurl{\def\UrlLeft##1\UrlRight{\uri@citeurlpre##1\uri@citeurlpost}}%
%% mailto
\DeclareUrlCommand\mailto{\def\UrlLeft##1\UrlRight{\uri@mailtopre##1\uri@mailtopost}}%
%% ukoeln
\DeclareUrlCommand\ukoeln{\def\UrlLeft##1\UrlRight{\uri@ukoelnpre##1\uri@ukoelnpost}}%
}

%    \end{macrocode}
%
% Note that you cannot create those addresses by this way, only link to existing ones.\\
%
% That was already everything which was necessary.\\
% (Ones you get the syntax for the |\DeclareUrlCommand| right, it is straight forward.
% Emphasis is at \textquotedblleft Ones\textquotedblright \ldots )
%
% \begin{macro}{\AtBeginDocument}
% \indent |\AtBeginDocument| it is checked whether the \textsf{doi} or the
% \textsf{doipubmed} package are loaded.
%
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifpackageloaded{doi}%
    {\PackageWarning{uri}{Packages uri AND doi detected.\MessageBreak%
       Result will depend on order of loading!\MessageBreak%
       Consider using only one package.\MessageBreak%
       The uri package alone should be sufficient.\MessageBreak%
       }%
    }{\relax}%
  \@ifpackageloaded{doipubmed}%
    {\PackageWarning{uri}{Packages uri AND doipubmed detected.\MessageBreak%
       Result will depend on order of loading!\MessageBreak%
       Consider using only one package.\MessageBreak%
       The uri package alone should be sufficient.\MessageBreak%
       }%
    }{\relax}%
  }
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \end{landscape}
% \newpage
%
% \section{Installation}
%
% \subsection{Downloads\label{ss:Downloads}}
%
% Everything is available on \CTAN{}, \url{ftp://ftp.ctan.org/tex-archive/},
% but may need additional packages themselves.\\
%
% \DescribeMacro{uri.dtx}
% For unpacking the |uri.dtx| file and constructing the documentation it is required:
% \begin{description}
% \item[-] \TeX Format \LaTeXe, 1994/06/01, v2$\varepsilon $: \CTAN{}
%
% \item[-] document class \textsf{ltxdoc}, 2007/11/11, v2.0u,\\
%           \CTAN{macros/latex/base/ltxdoc.dtx}
%
% \item[-] package \textsf{lscape}, 2000/10/22, v3.01, from the graphics bundle:\\
%           \CTAN{macros/latex/required/graphics/}
%
% \item[-] package \textsf{holtxdoc}, 2010/04/24, v0.19,\\
%           \CTAN{macros/latex/contrib/oberdiek/holtxdoc.dtx}
%
% \item[-] package \textsf{hypdoc}, 2010/03/26, v1.9,\\
%           \CTAN{macros/latex/contrib/oberdiek/hypdoc.dtx}
% \end{description}
%
% \DescribeMacro{uri.sty}
% The |uri.sty| for \LaTeXe\ (i.\,e. all documents using
% the \textsf{uri} package) requires:
% \begin{description}
% \item[-] \TeX Format \LaTeXe, 1994/06/01, v2$\varepsilon $, \CTAN{}
%
% \item[-] package \textsf{kvoptions}, 2010/02/22, v3.7,\\
%           \CTAN{macros/latex/contrib/oberdiek/kvoptions.dtx}
%
% \item[-] package \textsf{url}, 2006/04/12 (documentation 2010/01/22), v3.3,\\
%           \CTAN{macros/latex/contrib/url}
% \end{description}
%
% \DescribeMacro{uri-example.tex}
% The |uri-example.tex| requires the same files as all
% documents using the \textsf{uri} package, especially:
% \begin{description}
% \item[-] package \textsf{uri}, 2011/03/04, v1.0a,\\
%           \CTAN{macros/latex/contrib/uri/uri.dtx}\\
%   (Well, it is the example file for this package, and because you are reading the
%    documentation for the \textsf{uri} package, it can be assumed that you already
%    have some version of it~-- is it the current one?)
% \end{description}
%
% As possible alternatives in section \ref{sec:Alternatives} there are listed
% \DescribeMacro{doi}
% \DescribeMacro{doipubmed}
% \begin{description}
% \item[-] package \textsf{doi}, 2007/07/24, v?.?,\\
%           \CTAN{macros/latex/contrib/doi/}
%
% \item[-] package \textsf{doipubmed}, 2007/08/20, v1.01,\\
%           \CTAN{macros/latex/contrib/doipubmed/}
% \end{description}
%
% \DescribeMacro{Oberdiek}
% \DescribeMacro{holtxdoc}
% \DescribeMacro{kvoptions}
% All packages of Heiko Oberdiek's bundle `oberdiek'
% (especially \textsf{holtxdoc} and \textsf{kvoptions})
% are also available in a TDS compliant ZIP archive:\\
% \CTAN{install/macros/latex/contrib/oberdiek.tds.zip}.\\
% \textbf{Warning}: holtxdoc, 2010/04/24 v0.19, requires the packages
% \begin{description}
% \item[-] hypdoc, 2010/03/26, v1.9
% \item[-] hyperref, 2010/03/30, v6.80u (latest: 2011/02/07, v6.82b)
% \item[-] pdftexcmds, 2010/04/01, v0.9
% \item[-] ltxcmds, 2010/03/09, v1.4 (latest: 2010/04/26, v1.7)
% \item[-] hologo, 2010/04/24, v1.2
% \item[-] array (latest: 2008/09/09, v2.4c)
% \end{description}
% (or more recent versions) and does neither work with
% nor check for earlier versions!\\
% (It is probably best to download\\
% \CTAN{install/macros/latex/contrib/oberdiek.tds.zip}
% and use this, because the packages in there should be both
% recent and compatible.)\\
%
% \DescribeMacro{M\"{u}nch}
% A list of my packages can be found at
% \ \url{http://www.Uni-Bonn.de/~uzs5pv/LaTeX.html}.\\
%
% \subsection{Package, unpacking TDS}
%
% \paragraph{Package.} This package is available on \CTAN{}:
% \begin{description}
% \item[\CTAN{macros/latex/contrib/uri/uri.dtx}]\hspace*{0.1cm} \\
%       The source file.
% \item[\CTAN{macros/latex/contrib/uri/uri.pdf}]\hspace*{0.1cm} \\
%       The documentation.
% \item[\CTAN{macros/latex/contrib/uri/uri-example.pdf}]\hspace*{0.1cm} \\
%       The compiled example file, as it should look like.
% \item[\CTAN{macros/latex/contrib/uri/README}]\hspace*{0.1cm} \\
%       The README file.
% \end{description}
% There is also a uri.tds.zip available:
% \begin{description}
% \item[\CTAN{install/macros/latex/contrib/uri.tds.zip}]\hspace*{0.1cm} \\
%       Everything in TDS compliant, compiled format.
% \end{description}
% which additionally contains\\
% \begin{tabular}{ll}
% uri.ins & The installation file.\\
% uri.drv & The driver to generate the documentation.\\
% ltxdoc.cfg & The \LaTeX\ documentation configuration file,\\
%            & also for generating the documentation.\\
% uri.sty &  The \xext{sty}le file.\\
% uri-example.tex & The example file.%
% \end{tabular}
%
% \bigskip
%
% \noindent For required other packages, see the preceding subsection.
%
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
% \docstrip\ archive. The files are extracted by running the
% \xfile{.dtx} through \plainTeX:
% \begin{quote}
%   \verb|tex uri.dtx|
% \end{quote}
%
% About generating the documentation see paragraph~\ref{GenDoc} below.\\
%
% \paragraph{TDS.} Now the different files must be moved into
% the different directories in your installation TDS tree
% (also known as \xfile{texmf} tree):
% \begin{quote}
% \def\t{^^A
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
%   uri.sty & tex/latex/uri.sty\\
%   uri.pdf & doc/latex/uri.pdf\\
%   uri-example.tex & doc/latex/uri-example.tex\\
%   uri-example.pdf & doc/latex/uri-example.pdf\\
%   uri.dtx & source/latex/uri.dtx\\
% \end{tabular}^^A
% }^^A
% \sbox0{\t}^^A
% \ifdim\wd0>\linewidth
%   \begingroup
%     \advance\linewidth by\leftmargin
%     \advance\linewidth by\rightmargin
%   \edef\x{\endgroup
%     \def\noexpand\lw{\the\linewidth}^^A
%   }\x
%   \def\lwbox{^^A
%     \leavevmode
%     \hbox to \linewidth{^^A
%       \kern-\leftmargin\relax
%       \hss
%       \usebox0
%       \hss
%       \kern-\rightmargin\relax
%     }^^A
%   }^^A
%   \ifdim\wd0>\lw
%     \sbox0{\small\t}^^A
%     \ifdim\wd0>\linewidth
%       \ifdim\wd0>\lw
%         \sbox0{\footnotesize\t}^^A
%         \ifdim\wd0>\linewidth
%           \ifdim\wd0>\lw
%             \sbox0{\scriptsize\t}^^A
%             \ifdim\wd0>\linewidth
%               \ifdim\wd0>\lw
%                 \sbox0{\tiny\t}^^A
%                 \ifdim\wd0>\linewidth
%                   \lwbox
%                 \else
%                   \usebox0
%                 \fi
%               \else
%                 \lwbox
%               \fi
%             \else
%               \usebox0
%             \fi
%           \else
%             \lwbox
%           \fi
%         \else
%           \usebox0
%         \fi
%       \else
%         \lwbox
%       \fi
%     \else
%       \usebox0
%     \fi
%   \else
%     \lwbox
%   \fi
% \else
%   \usebox0
% \fi
% \end{quote}
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
% TDS installing feature, then some files can already be in the right
% place, see the documentation of \docstrip.
%
% \subsection{Refresh file name databases}
%
% If your \TeX~distribution (\teTeX, \mikTeX,\dots) relies on file name
% databases, you must refresh these. For example, \teTeX\ users run
% \verb|texhash| or \verb|mktexlsr|.
%
% \subsection{Some details for the interested}
%
% \paragraph{Unpacking with \LaTeX.}
% The \xfile{.dtx} chooses its action depending on the format:
% \begin{description}
% \item[\plainTeX:] Run \docstrip\ and extract the files.
% \item[\LaTeX:] Generate the documentation.
% \end{description}
% If you insist on using \LaTeX\ for \docstrip\ (really,
% \docstrip\ does not need \LaTeX), then inform the autodetect routine
% about your intention:
% \begin{quote}
%   \verb|latex \let\install=y\input{uri.dtx}|
% \end{quote}
% Do not forget to quote the argument according to the demands
% of your shell.
%
% \paragraph{Generating the documentation.\label{GenDoc}}
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
% the documentation. The process can be configured by the
% configuration file \xfile{ltxdoc.cfg}. For instance, put the following
% line into this file, if you want to have A4 as paper format:
% \begin{quote}
%   \verb|\PassOptionsToClass{a4paper}{article}|
% \end{quote}
%
% \noindent An example follows how to generate the
% documentation with \pdfLaTeX :
%
% \begin{quote}
%\begin{verbatim}
%pdflatex uri.drv
%makeindex -s gind.ist uri.idx
%pdflatex uri.drv
%makeindex -s gind.ist uri.idx
%pdflatex uri.drv
%\end{verbatim}
% \end{quote}
%
% \subsection{Compiling the example}
%
% The example file, \textsf{uri-example.tex}, can be compiled via\\
% \indent |latex uri-example.tex|\\
% or (recommended)\\
% \indent |pdflatex uri-example.tex|\\
% but will need probably three compiler runs to get everything right.
%
% \section{Acknowledgements}
%
% I (H.-Martin M\"{u}nch) would like to thank Heiko Oberdiek
% (heiko dot oberdiek at googlemail dot com) for providing
% a~lot~(!) of useful packages (from which I also got everything I
% know about creating a file in \xfile{dtx} format, ok, say it: copying),
% and the \Newsgroup{comp.text.tex} and \Newsgroup{de.comp.text.tex}
% newsgroups for their help in all things \TeX.
%
% \phantomsection
% \begin{History}\label{History}
%   \begin{Version}{2011/03/04 v1.0a}
%     \item First version of this package.
%   \end{Version}
% \end{History}
%
% % \PrintChanges
%
% \bigskip
%
% When you find a mistake or have a suggestion for an improvement of this package,
% please send an e-mail to the maintainer, thanks! (Please see BUG REPORTS in the README.)
%
% \pagebreak
%
% \PrintIndex
%
% \Finale
\endinput