summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/uri/uri.sty
blob: 92187fd90141294b2f4111da6955a749c62ec3c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
%%
%% This is file `uri.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% uri.dtx  (with options: `package')
%% 
%% 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.
%% 
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{uri}[2011/03/04 v1.0a
   Hyperlinks URIs like DOI,HDL,NBN,PubMed (HMM)]

%% 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.
\RequirePackage{kvoptions}[2010/02/22]% v3.7
\RequirePackage{url}[2006/04/12]% v3.3, documentation as of 2010/01/20

\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*

\@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}}%
}

\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}%
  }
\endinput
%%
%% End of file `uri.sty'.