% \iffalse meta-comment
%
% File: uri.dtx
% Version: 2018/09/06 v2.0b
%
% Copyright (C) 2011 - 2018 by
%    H.-Martin M"unch <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,
% the README, and the derived files
%    uri.sty, uri.pdf, uri.ins, uri.drv,
%    uri-example.tex, uri-example.pdf.
%
% 'uri' is available on CTAN:
% https://www.ctan.org/pkg/uri
%
% Also a TDS.ZIP file is provided that contains all the files
% already sorted in a TDS tree:
% http://mirror.ctan.org/install/macros/latex/contrib/uri.tds.zip
%
%<*ignore>
\begingroup
  \catcode123=1 %
  \catcode125=2 %
  \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 2018/09/06 v2.0b Hyperlinks URIs like DOI,HDL,NBN,PubMed (HMM)}
\Msg{*****************************************************************************}

\keepsilent
\askforoverwritefalse

\let\MetaPrefix\relax
\preamble

This is a generated file.

Project: uri
Version: 2018/09/06 v2.0b

Copyright (C) 2011 - 2018 by
    H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
Portions of code copyrighted by other people as marked.

IMPORTANT NOTICE: The package takes options.

The usual disclaimer applies:
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.

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

In memoriam
 Claudia Simone Barth + 1996/01/30
 Tommy Muench + 2014/01/02
 Hans-Klaus Muench + 2014/08/24

\endpreamble
\let\MetaPrefix\DoubleperCent

\generate{%
  \file{uri.ins}{\from{uri.dtx}{install}}%
  \file{uri.drv}{\from{uri.dtx}{driver}}%
  \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
% \verb|docstrip| programme. That is, run \LaTeX{} on \verb|docstrip|
% and specify the \verb|driver| option when \verb|docstrip|
% asks for options.
%
%    \begin{macrocode}
%<*driver>
\NeedsTeXFormat{LaTeX2e}[2015/01/01]
\ProvidesFile{uri.drv}[2018/09/06 v2.0b
            Hyperlinks URIs like DOI,HDL,NBN,PubMed (HMM)]
\documentclass{ltxdoc}[2015/03/26]% v2.0w
\usepackage{pdflscape}[2008/08/11]% v0.10
\usepackage{holtxdoc}[2012/03/21]%  v0.24
%% 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 package
%% to the most recent version (if they are not already the most
%% recent version).
\hypersetup{%
 pdfsubject={Hyperlinks URIs like DOI, HDL, NBN, PubMed (HMM)},%
 pdfkeywords={LaTeX, uri, hyperlink, arXiv, ASIN, DOI, HDL, NBN, OCLC, OID, PubMed, TINY, TINY:P, preview, WebCite, 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%
}
\CodelineIndex
\hyphenation{created document doc-u-ment-a-tion every-thing ignored}
\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}
\begin{document}
  \DocInput{uri.dtx}%
\end{document}
%</driver>
%    \end{macrocode}
%
% \fi
%
% \CheckSum{455}
%
% \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{\8,\",\-,\\,\ldots,\indent,\noindent}
% \DoNotIndex{\documentclass,\usepackage,\small,\begin,\end}
% \DoNotIndex{\NeedsTeXFormat,\filedate,\fileversion,\DoNotIndex}
% \DoNotIndex{\def,\edef,\gdef}
% \DoNotIndex{\textbf,\textit,\textsf,\textsc}
% \DoNotIndex{\if,\ifx,\ifnum,\ifdim,\else,\fi}
% \DoNotIndex{\CodelineIndex,\DocInput}
% \DoNotIndex{\newpage,\pagebreak,\newline,\linebreak,\nolinebreak}
% \DoNotIndex{\MessageBreak}
% \DoNotIndex{\smallskip,\medskip,\bigskip,\space,\,}
% \DoNotIndex{\plainTeX,\TeX,\LaTeX,\pdfLaTeX}
% \DoNotIndex{\protect,\listfiles,\textquotedblleft,\textquotedblright}
% \DoNotIndex{\markboth,\section,\item}
% \DoNotIndex{\href,\url,\nolinkurl,\pagenumbering,\xext,\ProvidesPackage}
% \DoNotIndex{\aurl,\doipubmed,\holtxdoc,\kvoptions,\Oberdiek,\M\"{u}nch}
% \DoNotIndex{\DeclareRobustCommand,\DeclareStringOption,\DeclareUrlCommand}
% \DoNotIndex{\PackageWarning,\ProcessKeyvalOptions,\SetupKeyvalOptions}
% \DoNotIndex{\UrlLeft,\UrlRight,\verb}
%
% \title{The \xpackage{uri} package}
% \date{2018/09/06 v2.0b}
% \author{H.-Martin M\"{u}nch\\\xemail{Martin.Muench at Uni-Bonn.de}}
%
% \maketitle
%
% \begin{abstract}
% \noindent This package allows to automatically hyperlink uris of type
% arXiv, ASIN, DOI, HDL, NBN, OCLC, OID, PubMed, TINY, TINY with preview,
% and Web\-Cite 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 if having 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.
%
% \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.
%
% \bigskip
%
% \tableofcontents
%
% \newpage
%
% \section{Introduction}
% \indent Diverse types of URIs exists. While every web browser should know
% how to handle an uri like \url{https://www.ctan.org/}, there are probably
% quite a few web browsers which cannot handle e.\,g. \url{arXiv:math/9201303}
% (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.
%
% \item Use/write a plug-in for the browser to resolve the uri.
%
% \item Use only the full, expanded uri. Then they can be reliable accessed by
% every\-body, 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 (\href{https://arxiv.org/abs/math/9201303}{arXiv:math/9201303}),
% but link to the long, expanded one. 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 \xpackage{url} and \xpackage{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{aurl}
% \begin{description}
% \item[-] The \xpackage{aurl} package \textquotedblleft [e]xtends the hyperref package
% with a mechanism for hyperlinked URLs abbreviated with prefixes\textquotedblright,
% i.\,e. similar to this package here.
% \end{description}
%
% \DescribeMacro{doi}
% \begin{description}
% \item[-] The \xpackage{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 \xpackage{doi} package \verb|ReadMe|). It does not handle other types
% of uris, naturally.
% \end{description}
%
% \DescribeMacro{doipubmed}
% \begin{description}
% \item[-] The \xpackage{doipubmed} package handles |DOI| as well as |PubMed| uris.
% \end{description}
%
% \bigskip
%
% \noindent (You programmed or found another alternative,
%  which is available at \url{https://www.CTAN.org}?
%  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[british]{article}[2014/09/29]% v1.4h
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\PassOptionsToPackage{hyphens}{url}% url is loaded internally by hyperref
\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}[2018/09/06]% v2.0b
\RequirePackage{amsmath}
\RequirePackage{relsize}
\gdef\doialternative{%
  \hbox{\text{\fontfamily{lmss}\selectfont{\smaller{%
  DO\hspace{-0.025em}I\raisebox{0.24ex}{:}}}\kern-0.01em}}\allowbreak%
  }% used later for demonstration of \urisetup
\renewcommand*{\thesubsection}{\arabic{subsection}}
\listfiles
\begin{document}
\pagenumbering{arabic}

\section*{Example for uri}
This example demonstrates the use of package\newline
\textsf{uri}, v2.0b as of 2018/09/06 (HMM).\newline
No options were given, thereby the default options were used.\newline
For more details please see the documentation!

\subsection{Supported types of uri\label{uritypes}}
The \textsf{uri} package allows to hyperlink (with the
\textsf{hyperref} package of \textsc{Heiko Ober\-diek}) uris of type
\begin{itemize}
\item[--] arXiv (\url{https://www.arXiv.org/}), e.\,g. \arxiv{math/9201303}.

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

\item[--] DOI (\url{https://www.doi.org/index.html}), e.\,g. \doi{10.1000/182} or\linebreak%
  \doi{10.1111/coin.12165}. For DOIs also \url{http://www.shortdoi.org/} %
  should be mentioned, which provides \doi{10/b8xfbg} as synonym for that long doi %
  given in \hyperref[relaxation]{\ref*{relaxation} Stress test} %
  (and also synonyms for all other DOIs).

\item[--] HDL (\url{https://www.handle.net/index.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:bsz:mit1-opus-3145}.

\item[--] OCLC (the global library cooperative %
  \href{https://www.oclc.org/en/about.html}{OCLC} maintains %
  \href{https://www.worldcat.org/whatis/default.jsp}{WorldCat}), %
  e.\,g. \oclc{935889548}.

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

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

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

\item[--] TINY with preview (\url{https://preview.tinyurl.com/}), %
  e.\,g. \tinypuri{MST19-105603}.

\item[--] WebCite (\url{https://www.webcitation.org/}), e.\,g. \wc{71dxjl73I},
  which is short for \wc{query?url=http%3A%2F%2Fctan.org&date=2018-08-13}{%
  }.

\item[--] XMPP (\url{https://xmpp.org/about/}) changed, for example
  \verb|URN:XMPP:time| was moved from \url{https://xmpp.org/protocols/urn:xmpp:time/}
  to\linebreak \url{https://xmpp.org/extensions/xep-0202.html}. Therefore
  \verb|\xmpp| is no longer provided by this package. For backward compatibility
  \verb|\xmpp{...}| gives an error message and links to
  \url{https://xmpp.org/extensions/}.
\end{itemize}

\subsection{Pre/post text, \texttt{\textbackslash urisetup}}
\noindent Text before (e.\,g. \textsf{DOI:}) and after (well, no example)
the uri to be displayed can be adapted by the package options.
After loading the package it is possible (even somewhere within the document's body)
to change these \hbox{\ldots \verb|pre|} (and \hbox{\ldots \verb|post|)} texts
by \verb|\urisetup|, e.\,g.\newline
\verb|\urisetup{arxivpre={\textsf{\scshape arXiv:}\hspace{.2em}}}|.\newline
This command can also be used in the preamble to define pre/post texts
which otherwise are not understood by \LaTeX. -- Compare
\arxiv{0905.0105v2} to
\urisetup{arxivpre={\textsf{\scshape arXiv:}\hspace{.2em}}}
\arxiv{0905.0105v2} or
\doi{10.1000/182} to
\urisetup{doipre={\doialternative}}% \doialternative was defined in the example's preamble.
\doi{10.1000/182}.

\subsection{\texttt{\textbackslash citeurl}, \texttt{\textbackslash mailto}, %
            \texttt{\textbackslash ukoeln}, and \texttt{\textbackslash uref}}
Additionally some commands are provided by the uri package:
\begin{itemize}
\item[--] \verb|\citeurl| similar to the command of the \textsf{doipubmed} package,\newline%
  \citeurl{https://ctan.org/pkg/doipubmed}.

\item[--] \verb|\mailto| for e-mail addresses (optionally with e-mail subject), e.\,g.\newline%
\mailto{spam@example.org} or with subject %
\mailto[Some subject of the e-mail]{spam@example.org}.

\item[--] \verb|\ukoeln| for short University of Cologne (Universit\"{a}t zu K\"{o}ln, %
  U~Koeln; Germany; \url{https://www.portal.uni-koeln.de/8911.html?&L=1})
  ad-\linebreak dresses, e.\,g. \ukoeln{PDGKL}.

\item[--] \verb|\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{https://ctan.org/pkg/uri}{uri package}, similar to \verb|\href|. %
  When \textsf{hyperref} was not loaded, \newline%
  \verb|\uref{first argument}{second argument}| %
  defaults to\newline
  \verb|\url{second argument}|.
\end{itemize}


\subsection{Stress test\label{relaxation}}
Even \verb|\doi{1.2/3-.(5):<>;%A\8!$~&{}#X}|
would work (if that DOI would exist; same for the other types of uri):
\doi{1.2/3-.(5):<>;%A\8!$~&{}#X}{%
} (In the error message at doi.org the \verb|#X| is not included,
because it is interpreted as \textquotedblleft anchor X\textquotedblright{} at
page \verb|1.2/3-.(5):<>;%A\8!$~&{}|, which already is not found.)\newline
Adding \verb|opening bracket percent-sign line break closing bracket|\newline
(please see the source code of the example)
makes programs happy, which check for bracket pairs and take the
first percent sign as the start of a comment and therefore miss
the closing bracket (but therefore also the following opening one).
And this real DOI works:\newline
\doi{10.1002/1097-4636(200108)56:2<282::AID-JBM1096>3.0.CO;2-5}\newline
(short: \doi{10/b8xfbg}, see DOI in %
\hyperref[uritypes]{\ref*{uritypes} Supported types of uri}).
\pagebreak

\subsection{Name-to-Thing resolver}
It is also possible to resolve a lot of identifiers by
the Name-to-Thing resolver by just appending the identifier to
\url{https://n2t.net/}, e.\,g. \newline%
\url{https://n2t.net/arXiv:math/9201303}, \newline%
\url{https://n2t.net/ASIN:0201134489}, \newline%
\url{https://n2t.net/DOI:10.1111/coin.12165}, \newline%
\url{https://n2t.net/HDL:2128/2486}, \newline%
\url{https://n2t.net/urn:nbn:de:bsz:mit1-opus-3145}, \newline%
\url{https://n2t.net/OCLC:935889548}, \newline%
\url{https://n2t.net/PubMed:24925405}, and also \newline%
\url{https://n2t.net/ISBN:9783638922005} and \newline%
\url{https://n2t.net/ARK:12148/bpt6k15385d}.\newline%
(And for resolving OIDs like OID:2.16.840 instead of %
\url{http://www.oid-info.com/cgi-bin/display?oid=2.16.840&submit=Display&action=display} %
it is possible to use %
\url{https://identifiers.org/OID:2.16.840}.)\newline%
Disadvantages: It is longer and requires \href{https://n2t.net/}{n2t.net} to work %
(or \href{https://identifiers.org/}{identifiers.org} for OID).\newline%
Advantage: Anybody reading the printed document can just enter %
the url as given into their browser without thinking about how to resolve %
that type of uri.


\subsection{Disclaimer for web links}
The author is not responsible for any contents referred
to in this work unless if having 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.
\end{document}
%</example>
%    \end{macrocode}
%
% \StopEventually{}
%
% \newpage
% \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}[2015/01/01]
\ProvidesPackage{uri}[2018/09/06 v2.0b
   Hyperlinks URIs like DOI,HDL,NBN,PubMed (HMM)]

%    \end{macrocode}
%
% A short description of the \xpackage{uri} package:
%
%    \begin{macrocode}
%% Allows to automatically hyperlink uris of types
%% arXiv, ASIN, DOI, HDL, NBN, OCLC, OID, PubMed, TINY, TINY with preview,
%% and WebCite
%% in such a way that they are resolved to an address understood by browsers
%% independent of 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 \xpackage{kvoptions}
% package of \textsc{Heiko Oberdiek} (see subsection~\ref{ss:Downloads}):
%
%    \begin{macrocode}
\RequirePackage{kvoptions}[2011/06/30]% v3.11
%    \end{macrocode}
%
% We need the \xpackage{url} package of \textsc{Donald Arseneau} and
% \textsc{Robin Fairbairns} (see subsection~\ref{ss:Downloads}):
%
%    \begin{macrocode}
\RequirePackage{url}[2013/09/16]% v3.4

%    \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 \xpackage{hyperref} package has been loaded, we hyperlink the uris,
% otherwise we do not do this.\newline
% \textbf{So, if you want hyperlinks, load \xpackage{uri} after \xpackage{hyperref},
% otherwise before} (or no \xpackage{hyperref} at all, of course).
%
% For each supported uri type there are two options, |...pre| and |...post|,
% e.\,g. |doipre| and |doipost|. For example the option |doipre={DOI:\ }|
% results in \hbox{\textquotedblleft{}DOI:\ \textquotedblright}
% (without the quotation marks, of course) to be written before the DOIs.\newline
% (There are more brackets and braces then necessary here, but better
% save than sorry, i.\,e. make it robust.)
%
%    \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[OCLC:]{oclcpre}[OCLC:]
\DeclareStringOption[]{oclcpost}[]

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

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

%    \end{macrocode}
%
% The commands are \verb|tinyuri| and \verb|tinypuri|,
% thus the according options are
% tinyuripre, tinyuripre, tinyuripost, tinypuripost, and tinypuripre.
% In older versions they were
% tinypre, tinypre, tinypost, tinyppost, and tinyppre.
% For backward compatibility we need to define and handle them:
%
%    \begin{macrocode}
\def\uri@tiny@pre@default{TINY:}
\def\uri@tiny@post@default{}

\def\uri@tinyp@pre@default{TINY:P:}
\def\uri@tinyp@post@default{}

\DeclareStringOption[\uri@tiny@pre@default]{tinypre}[\uri@tiny@pre@default]
\DeclareStringOption[\uri@tiny@post@default]{tinypost}[\uri@tiny@post@default]

\DeclareStringOption[\uri@tinyp@pre@default]{tinyppre}[\uri@tinyp@pre@default]
\DeclareStringOption[\uri@tinyp@post@default]{tinyppost}[\uri@tinyp@post@default]

\DeclareStringOption[\uri@tiny@pre@default]{tinyuripre}[\uri@tiny@pre@default]
\DeclareStringOption[\uri@tiny@post@default]{tinyuripost}[\uri@tiny@post@default]

\DeclareStringOption[\uri@tinyp@pre@default]{tinypuripre}[\uri@tinyp@pre@default]
\DeclareStringOption[\uri@tinyp@post@default]{tinypuripost}[\uri@tinyp@post@default]

\DeclareStringOption[WC:]{wcpre}[WC:]
\DeclareStringOption[]{wcpost}[]

\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}
%
% To set options with more complicated/problematic content,
% \verb|\urisetup| is needed. With this the user can set
% the according option(s) after loading this package
% (please see the example file).
%
%    \begin{macrocode}
\gdef\urisetup{\kvsetkeys{uri}}

%    \end{macrocode}
%
% Handling of deprecated options
% tinypre, tinypre, tinypost, tinyppost, and tinyppre:
%
%    \begin{macrocode}
\def\uri@wrapper{\uri@tiny@pre@default}
\ifx\uri@tinypre\uri@wrapper%
\else%
  \ifx\uri@tinyuripre\uri@wrapper%
    \PackageWarning{uri}{Option tinypre deprecated.\MessageBreak%
      Please use tinyuripre instead!\MessageBreak%
      Transfering content of option tinypre to tinyuripre now;\MessageBreak%
      }%
    \let\uri@tinyuripre\uri@tinypre%
  \else%
    \PackageError{uri}{Conflicting options tinypre and tinyuripre used}{%
      Option tinypre deprecated.\MessageBreak%
      Please use ONLY option tinyuripre instead!\MessageBreak%
      Ignoring option tinypre now.\MessageBreak%
      }%
  \fi%
\fi%

\def\uri@wrapper{\uri@tiny@post@default}
\ifx\uri@tinypost\uri@wrapper%
\else%
  \ifx\uri@tinyuripost\uri@wrapper%
    \PackageWarning{uri}{Option tinypost deprecated.\MessageBreak%
      Please use tinyuripost instead!\MessageBreak%
      Transfering content of option tinypost to tinyuripost now;\MessageBreak%
      }%
    \let\uri@tinyuripost\uri@tinypost%
  \else%
    \PackageError{uri}{Conflicting options tinypost and tinyuripost used}{%
      Option tinypost deprecated.\MessageBreak%
      Please use ONLY option tinyuripost instead!\MessageBreak%
      Ignoring option tinypost now.\MessageBreak%
      }%
  \fi%
\fi%

\def\uri@wrapper{\uri@tinyp@pre@default}
\ifx\uri@tinyppre\uri@wrapper%
\else%
  \ifx\uri@tinypuripre\uri@wrapper%
    \PackageWarning{uri}{Option tinyppre deprecated.\MessageBreak%
      Please use tinypuripre instead!\MessageBreak%
      Transfering content of option tinyppre to tinypuripre now;\MessageBreak%
      }%
    \let\uri@tinypuripre\uri@tinyppre%
  \else%
    \PackageError{uri}{Conflicting options tinyppre and tinypuripre used}{%
      Option tinyppre deprecated.\MessageBreak%
      Please use ONLY option tinypuripre instead!\MessageBreak%
      Ignoring option tinyppre now.\MessageBreak%
      }%
  \fi%
\fi%

\def\uri@wrapper{\uri@tinyp@post@default}
\ifx\uri@tinyppost\uri@wrapper%
\else%
  \ifx\uri@tinypuripost\uri@wrapper%
    \PackageWarning{uri}{Option tinyppost deprecated.\MessageBreak%
      Please use tinypuripost instead!\MessageBreak%
      Transfering content of option tinyppost to tinypuripost now;\MessageBreak%
      }%
    \let\uri@tinypuripost\uri@tinyppost%
  \else%
    \PackageError{uri}{Conflicting options tinyppost and tinypuripost used}{%
      Option tinyppost deprecated.\MessageBreak%
      Please use ONLY option tinypuripost instead!\MessageBreak%
      Ignoring option tinyppost now.\MessageBreak%
      }%
  \fi%
\fi%

%    \end{macrocode}
%
% We disable the deprecated options. If not disabled,
% it would be possible to use \verb|\urisetup| with them
% without error message, but this would not have any effect,
% because only the newer options
% tinyuripre, tinyuripre, tinyuripost, tinypuripost, and tinypuripre
% are regarded.
%
%    \begin{macrocode}
\DisableKeyvalOption[action={error},package=uri]{uri}{tinypre}
\DisableKeyvalOption[action={error},package=uri]{uri}{tinypost}
\DisableKeyvalOption[action={error},package=uri]{uri}{tinyppre}
\DisableKeyvalOption[action={error},package=uri]{uri}{tinyppost}

%    \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}{%
\DeclareRobustCommand{\uref}[2]{\protect\href{#1}{\protect\nolinkurl{#2}}}%
%% arXiv
\DeclareUrlCommand\arxiv{\def\UrlLeft##1\UrlRight{\href{https://arxiv.org/abs/##1}{\uri@arxivpre##1\uri@arxivpost}}}%
%% ASIN
\DeclareUrlCommand\asin{\def\UrlLeft##1\UrlRight{\href{https://amzn.com/##1}{\uri@asinpre##1\uri@asinpost}}}%
%% DOI
\DeclareUrlCommand\doi{\def\UrlLeft##1\UrlRight{\href{https://dx.doi.org/##1}{\uri@doipre##1\uri@doipost}}}%
%% HDL
\DeclareUrlCommand\hdl{\def\UrlLeft##1\UrlRight{\href{https://hdl.handle.net/##1}{\uri@hdlpre##1\uri@hdlpost}}}%
%% NBN
\DeclareUrlCommand\nbn{\def\UrlLeft##1\UrlRight{\href{https://nbn-resolving.org/urn/resolver.pl?urn=##1}{\uri@nbnpre##1\uri@nbnpost}}}%
%% OCLC
\DeclareUrlCommand\oclc{\def\UrlLeft##1\UrlRight{\href{https://www.worldcat.org/oclc/##1}{\uri@oclcpre##1\uri@oclcpost}}}%
%% 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{https://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{https://tinyurl.com/##1}{\uri@tinyuripre##1\uri@tinyuripost}}}%
%% TINYP (tiny with preview)
\DeclareUrlCommand\tinypuri{\def\UrlLeft##1\UrlRight{\href{https://preview.tinyurl.com/##1}{\uri@tinypuripre##1\uri@tinypuripost}}}%
%% WebCite
\DeclareUrlCommand\wc{\def\UrlLeft##1\UrlRight{\href{https://www.webcitation.org/##1}{\uri@wcpre##1\uri@wcpost}}}%
%% XMPP
\DeclareUrlCommand\xmpp{%
  \PackageError{uri}{Command \string\xmpp\space deprecated}{%
    XMPP (https://xmpp.org/about/) changed, for example URN:XMPP:time\MessageBreak%
    was moved from https://xmpp.org/protocols/urn:xmpp:time/\MessageBreak%
    to https://xmpp.org/extensions/xep-0202.html. Therefore\MessageBreak%
    \string\xmpp\space is no longer provided by this package.\MessageBreak%
    For backward compatibility \string\xmpp\space links to\MessageBreak%
    https://xmpp.org/extensions/.\MessageBreak%
    Please replace \string\xmpp\space in your document by the appropriate url.\MessageBreak%
  }%
  \def\UrlLeft##1\UrlRight{\href{https://xmpp.org/extensions/}{\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\mailto@subject}{\uri@mailtopre##1\uri@mailtopost}}}%
\DeclareRobustCommand\mailto[1][]{\def\mailto@subject{?subject=#1}\mailto@}%
%    \end{macrocode}
%
% \verb|\mailto| code provided by \textsc{Frank Mittelbach} (thanks!),
% making possible \verb|\mailto{person@example.org}| as well as\newline
% \verb|\mailto[Some subject of the e-mail]{person@example.org}|,
% i.\,e. \verb|mailto:person@example.org?subject=Some subject of the e-mail|.
%
%    \begin{macrocode}
%% ukoeln
\DeclareUrlCommand\ukoeln{\def\UrlLeft##1\UrlRight{\href{https://UKoeln.de/##1}{\uri@ukoelnpre##1\uri@ukoelnpost}}}%
}{% otherwise, i.e. if hyperref has not been loaded:
\DeclareRobustCommand{\uref}[1]{\url}%
%% 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}}%
%% OCLC
\DeclareUrlCommand\oclc{\def\UrlLeft##1\UrlRight{\uri@oclcpre##1\uri@oclcpost}}%
%% 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@tinyuripre##1\uri@tinyuripost}}%
%% TINYP (tiny with preview)
\DeclareUrlCommand\tinypuri{\def\UrlLeft##1\UrlRight{\uri@tinypuripre##1\uri@tinypuripost}}%
%% WebCite
\DeclareUrlCommand\wc{\def\UrlLeft##1\UrlRight{\uri@wcpre##1\uri@wcpost}}%
%% 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}}%
\DeclareRobustCommand\mailto[1][]{\mailto@}%
%% 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.
%
% (Once you get the syntax for the |\DeclareUrlCommand| right, it is straight forward.
% Emphasis is at \textquotedblleft Once\textquotedblright\ldots )
%
% \pagebreak
% \begin{macro}{\AtBeginDocument}
% \indent |\AtBeginDocument| it is checked whether any of the
% \xpackage{aurl}, \xpackage{doi}, or \xpackage{doipubmed} packages are loaded.
%
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifpackageloaded{aurl}%
    {\PackageWarning{uri}{Packages uri AND aurl detected.\MessageBreak%
       Results might depend on order of loading;\MessageBreak}%
    }{\relax}%
  \@ifpackageloaded{doi}%
    {\PackageWarning{uri}{Packages uri AND doi detected.\MessageBreak%
       Results 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%
       Results 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{https://www.ctan.org/pkg/}
% but may need additional packages themselves.
%
% \DescribeMacro{uri.dtx}
% For unpacking the |uri.dtx| file and constructing the documentation it is required
% (newer versions should be OK):
% \begin{description}
% \item[-] \TeX{} Format \LaTeXe, 2016/03/31, v2$\varepsilon $:
%   \url{https://www.CTAN.org}
%
% \item[-] document class \xclass{ltxdoc}, 2015/03/26, v2.0w,
%   \url{https://www.ctan.org/pkg/ltxdoc}
%
% \item[-] package \xpackage{pdflscape}, 2008/08/11, v0.10,
%   \url{https://www.ctan.org/pkg/pdflscape}
%
% \item[-] package \xpackage{holtxdoc}, 2012/03/21, v0.24,
%   \url{https://www.ctan.org/pkg/holtxdoc}
%
% \item[-] package \xpackage{hypdoc}, 2011/08/19, v1.11,
%   \url{https://www.ctan.org/pkg/hypdoc}
% \end{description}
%
% \DescribeMacro{uri.sty}
% The |uri.sty| for \LaTeXe{} (i.\,e. all documents using
% the \xpackage{uri} package) requires:
% \begin{description}
% \item[-] \TeX{} Format \LaTeXe, 2016/03/31, v2$\varepsilon $:
%   \url{https://www.CTAN.org}
%
% \item[-] package \xpackage{kvoptions}, 2011/06/30, v3.11,
%   \url{https://www.ctan.org/pkg/kvoptions}
%
% \item[-] package \xpackage{url}, 2013/09/16, v3.4, 
%   \url{https://www.ctan.org/pkg/url}
% \end{description}
%
% \DescribeMacro{uri-example.tex}
% The |uri-example.tex| requires the same files as all
% documents using the \xpackage{uri} package, especially:
% \begin{description}
% \item[-] package \xpackage{hyperref}, 2012/11/06, v6.83m,
%   \url{https://www.ctan.org/pkg/hyperref}\newline
%   (not generally necessary but probably used most often)
% \item[-] package \xpackage{uri}, 2018/09/06, v2.0b,
%   \url{https://www.ctan.org/pkg/uri}\newline
%   (Well, it is the example file for this package, and because you are reading the
%    documentation for the \xpackage{uri} package, it can be assumed that you already
%    have some version of it~-- is it the current one?)
% \end{description}
% \noindent and additionally (for demonstration purposes)
% \begin{description}
% \item[-] package \xpackage{amsmath}, 2016/03/10, v2.15b,
%   \url{https://www.ctan.org/pkg/amsmath}
% \item[-] package \xpackage{relsize}, 2013/03/29, v4.1,
%   \url{https://www.ctan.org/pkg/relsize}
% \end{description}
%
% As possible alternatives to \xpackage{uri} in section \ref{sec:Alternatives}
% there are listed
% \DescribeMacro{aurl}
% \DescribeMacro{doi}
% \DescribeMacro{doipubmed}
% \begin{description}
% \item[-] package \xpackage{aurl}, 2016/08/12, v?.?,
%   \url{https://www.ctan.org/pkg/aurl}
%
% \item[-] package \xpackage{doi}, 2007/07/24, v?.?,
%   \url{https://www.ctan.org/pkg/doi}
%
% \item[-] package \xpackage{doipubmed}, 2007/08/20, v1.01,
%   \url{https://www.ctan.org/pkg/doipubmed}
% \end{description}
%
% \DescribeMacro{Oberdiek}
% \DescribeMacro{holtxdoc}
% \DescribeMacro{kvoptions}
% All packages of \textsc{Heiko Oberdiek}'s bundle `oberdiek'
% (especially \xpackage{holtxdoc} and \xpackage{kvoptions})
% are also available in a TDS compliant ZIP archive:\newline
% \url{http://mirror.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip}.\newline
% It is probably best to download 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{https://www.ctan.org/author/muench-hm}.
%
% \subsection{Package, unpacking TDS}
% \paragraph{Package.} This package is available on \url{https://www.CTAN.org}.
% \begin{description}
% \item[\url{http://mirror.ctan.org/macros/latex/contrib/uri/uri.dtx}]\hspace*{0.1cm}
%       The source file.
% \item[\url{http://mirror.ctan.org/macros/latex/contrib/uri/uri.pdf}]\hspace*{0.1cm}
%       The documentation.
% \item[\url{http://mirror.ctan.org/macros/latex/contrib/uri/uri-example.pdf}]\hspace*{0.1cm}
%       The compiled example file, as it should look like.
% \item[\url{http://mirror.ctan.org/macros/latex/contrib/uri/README}]\hspace*{0.1cm}
%       The README file.
% \end{description}
% There is also a uri.tds.zip available:
% \begin{description}
% \item[\url{http://mirror.ctan.org/install/macros/latex/contrib/uri.tds.zip}]\hspace*{0.1cm}\newline
%       Everything in TDS compliant, compiled format.
% \end{description}
% which additionally contains\newline
% \begin{tabular}{ll}
% uri.ins         & The installation file.\\
% uri.drv         & The driver to generate 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.\newline
%
% \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 (\TeX{} Live, \mikTeX, \teTeX, \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 a
% 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, \xpackage{uri-example.tex}, can be compiled via\newline
% \indent \verb|(pdf)latex uri-example.tex|\newline
% but will need probably three compiler runs to get everything right.
%
% \section{Acknowledgements}
%
% I (H.-Martin M\"{u}nch) would like to thank \textsc{Heiko Oberdiek}
% 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), \textsc{Frank Mittelbach} for several bug reports
% and for code for improving the package, \textsc{Volker RW Schaa} for a bug report,
% everybody of the CTAN team for managing CTAN, and the
% \Newsgroup{comp.text.tex} and \Newsgroup{de.comp.text.tex}
% newsgroups and everybody at \url{https://tex.stackexchange.com/}
% for their help in all things \hbox{\TeX{}.}
%
% \phantomsection
% \begin{History}\label{History}
%   \begin{Version}{2011/03/04 v1.0a}
%     \item First version of this package.
%   \end{Version}
%   \begin{Version}{2011 -- 2018 v1.0\ldots}
%     \item Several versions, which where not officially published.
%   \end{Version}
%   \begin{Version}{2018/09/01 v2.0a}
%     \item Now using the \xpackage{pdflscape} package instead of \xpackage{lscape} package.
%     \item The \xpackage{holtxdoc} package was fixed (recent: 2011/02/04, v0.21), therefore
%             the warning in \xfile{drv} could be removed.-- Adapted the style of this
%             doc\-u\-ment\-a\-tion to new \textsc{Oberdiek} \xfile{dtx} style.
%     \item Made |\newcommand|s robust.
%     \item OCLC and WebCite added; alternative package aurl added,
%           URLs and documentation updated.
%     \item Name-to-Thing resolver added to the example.
%     \item XMPP removed due to changes at XMPP.
%     \item New \verb|\urisetup| to be able to use complicated pre/post text
%           (and change it mid-document!).
%     \item Added an optional argument to \verb|\mailto| for providing the e-mail's subject.
%     \item Options tinypre, tinypre, tinypost, tinyppost, and tinyppre
%            replaced by tinyuripre, tinyuripre, tinyuripost, tinypuripost, and tinypuripre,
%            because the commands are \verb|tinyuri| and \verb|tinypuri|.
%     \item Bugs fixed.
%   \end{Version}
%   \begin{Version}{2018/09/06 v2.0b}
%     \item Bug fix: README file format, .tds placement, wrong word, OID not n2t, description.
%   \end{Version}
% \end{History}
%
% \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.)
%
% \PrintIndex
%
% \Finale
\endinput