summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/uri/uri-example.tex
blob: e0adc6a06a6fc86209b8a50b5d6ab6ce5cf89499 (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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
%%
%% This is file `uri-example.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% uri.dtx  (with options: `example')
%% 
%% 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
%% 
\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}
\endinput
%%
%% End of file `uri-example.tex'.