Debian Codegraph @

texmf-dist/doc/latex/uri/uri-example.tex

raw
1 %%
2 %% This is file `uri-example.tex',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% uri.dtx (with options: `example')
8 %%
9 %% This is a generated file.
10 %%
11 %% Project: uri
12 %% Version: 2018/09/06 v2.0b
13 %%
14 %% Copyright (C) 2011 - 2018 by
15 %% H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
16 %% Portions of code copyrighted by other people as marked.
17 %%
18 %% IMPORTANT NOTICE: The package takes options.
19 %%
20 %% The usual disclaimer applies:
21 %% If it doesn't work right that's your problem.
22 %% (Nevertheless, send an e-mail to the maintainer
23 %% when you find an error in this package.)
24 %%
25 %% This work may be distributed and/or modified under the
26 %% conditions of the LaTeX Project Public License, either
27 %% version 1.3c of this license or (at your option) any later
28 %% version. This version of this license is in
29 %% http://www.latex-project.org/lppl/lppl-1-3c.txt
30 %% and the latest version of this license is in
31 %% http://www.latex-project.org/lppl.txt
32 %% and version 1.3c or later is part of all distributions of
33 %% LaTeX version 2005/12/01 or later.
34 %%
35 %% This work has the LPPL maintenance status "maintained".
36 %%
37 %% The Current Maintainer of this work is H.-Martin Muench.
38 %%
39 %% This work consists of the main source file uri.dtx,
40 %% the README, and the derived files
41 %% uri.sty, uri.pdf, uri.ins, uri.drv,
42 %% uri-example.tex, uri-example.pdf.
43 %%
44 %% In memoriam
45 %% Claudia Simone Barth + 1996/01/30
46 %% Tommy Muench + 2014/01/02
47 %% Hans-Klaus Muench + 2014/08/24
48 %%
49 \documentclass[british]{article}[2014/09/29]% v1.4h
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 \PassOptionsToPackage{hyphens}{url}% url is loaded internally by hyperref
52 \usepackage{hyperref}[2011/02/07]% v6.82b
53 \hypersetup{%
54 extension=pdf,%
55 plainpages=false,%
56 pdfpagelabels=true,%
57 hyperindex=false,%
58 pdflang={en},%
59 pdftitle={uri package example},%
60 pdfauthor={Hans-Martin Muench},%
61 pdfsubject={Example for the uri package},%
62 pdfkeywords={LaTeX, uri, Hans-Martin Muench},%
63 pdfview=Fit,%
64 pdfstartview=Fit,%
65 pdfpagelayout=SinglePage,%
66 bookmarksopen=false%
67 }
68 \usepackage{uri}[2018/09/06]% v2.0b
69 \RequirePackage{amsmath}
70 \RequirePackage{relsize}
71 \gdef\doialternative{%
72 \hbox{\text{\fontfamily{lmss}\selectfont{\smaller{%
73 DO\hspace{-0.025em}I\raisebox{0.24ex}{:}}}\kern-0.01em}}\allowbreak%
74 }% used later for demonstration of \urisetup
75 \renewcommand*{\thesubsection}{\arabic{subsection}}
76 \listfiles
77 \begin{document}
78 \pagenumbering{arabic}
79
80 \section*{Example for uri}
81 This example demonstrates the use of package\newline
82 \textsf{uri}, v2.0b as of 2018/09/06 (HMM).\newline
83 No options were given, thereby the default options were used.\newline
84 For more details please see the documentation!
85
86 \subsection{Supported types of uri\label{uritypes}}
87 The \textsf{uri} package allows to hyperlink (with the
88 \textsf{hyperref} package of \textsc{Heiko Ober\-diek}) uris of type
89 \begin{itemize}
90 \item[--] arXiv (\url{https://www.arXiv.org/}), e.\,g. \arxiv{math/9201303}.
91
92 \item[--] ASIN %
93 (\url{https://www.amazon.co.uk/gp/help/customer/display.html/277-3416785-8259466?ie=UTF8&nodeId=898182}), %
94 (that one is a good example for using a TINY url: \tinyuri{y7ju25ln}) %
95 e.\,g. \asin{0201134489}.
96
97 \item[--] DOI (\url{https://www.doi.org/index.html}), e.\,g. \doi{10.1000/182} or\linebreak%
98 \doi{10.1111/coin.12165}. For DOIs also \url{http://www.shortdoi.org/} %
99 should be mentioned, which provides \doi{10/b8xfbg} as synonym for that long doi %
100 given in \hyperref[relaxation]{\ref*{relaxation} Stress test} %
101 (and also synonyms for all other DOIs).
102
103 \item[--] HDL (\url{https://www.handle.net/index.html}), e.\,g. \hdl{2128/2486}.
104
105 \item[--] NBN (\url{http://nbn-resolving.de/urn:nbn:de:1111-200606309}),\newline%
106 e.\,g. \nbn{urn:nbn:de:bsz:mit1-opus-3145}.
107
108 \item[--] OCLC (the global library cooperative %
109 \href{https://www.oclc.org/en/about.html}{OCLC} maintains %
110 \href{https://www.worldcat.org/whatis/default.jsp}{WorldCat}), %
111 e.\,g. \oclc{935889548}.
112
113 \item[--] OID (\url{http://www.oid-info.com/#oid}), e.\,g. \oid{2.16.840}.
114
115 \item[--] PubMed (\url{https://www.ncbi.nlm.nih.gov/pubmed/}),\newline%
116 e.\,g. \pubmed{24925405}.
117
118 \item[--] TINY (\url{https://tinyurl.com/}), e.\,g. \tinyuri{MST19-105603}\newline%
119 (uses \verb|\tinyuri| instead of \verb|\tiny|, because that command already existed).
120
121 \item[--] TINY with preview (\url{https://preview.tinyurl.com/}), %
122 e.\,g. \tinypuri{MST19-105603}.
123
124 \item[--] WebCite (\url{https://www.webcitation.org/}), e.\,g. \wc{71dxjl73I},
125 which is short for \wc{query?url=http%3A%2F%2Fctan.org&date=2018-08-13}{%
126 }.
127
128 \item[--] XMPP (\url{https://xmpp.org/about/}) changed, for example
129 \verb|URN:XMPP:time| was moved from \url{https://xmpp.org/protocols/urn:xmpp:time/}
130 to\linebreak \url{https://xmpp.org/extensions/xep-0202.html}. Therefore
131 \verb|\xmpp| is no longer provided by this package. For backward compatibility
132 \verb|\xmpp{...}| gives an error message and links to
133 \url{https://xmpp.org/extensions/}.
134 \end{itemize}
135
136 \subsection{Pre/post text, \texttt{\textbackslash urisetup}}
137 \noindent Text before (e.\,g. \textsf{DOI:}) and after (well, no example)
138 the uri to be displayed can be adapted by the package options.
139 After loading the package it is possible (even somewhere within the document's body)
140 to change these \hbox{\ldots \verb|pre|} (and \hbox{\ldots \verb|post|)} texts
141 by \verb|\urisetup|, e.\,g.\newline
142 \verb|\urisetup{arxivpre={\textsf{\scshape arXiv:}\hspace{.2em}}}|.\newline
143 This command can also be used in the preamble to define pre/post texts
144 which otherwise are not understood by \LaTeX. -- Compare
145 \arxiv{0905.0105v2} to
146 \urisetup{arxivpre={\textsf{\scshape arXiv:}\hspace{.2em}}}
147 \arxiv{0905.0105v2} or
148 \doi{10.1000/182} to
149 \urisetup{doipre={\doialternative}}% \doialternative was defined in the example's preamble.
150 \doi{10.1000/182}.
151
152 \subsection{\texttt{\textbackslash citeurl}, \texttt{\textbackslash mailto}, %
153 \texttt{\textbackslash ukoeln}, and \texttt{\textbackslash uref}}
154 Additionally some commands are provided by the uri package:
155 \begin{itemize}
156 \item[--] \verb|\citeurl| similar to the command of the \textsf{doipubmed} package,\newline%
157 \citeurl{https://ctan.org/pkg/doipubmed}.
158
159 \item[--] \verb|\mailto| for e-mail addresses (optionally with e-mail subject), e.\,g.\newline%
160 \mailto{[email protected]} or with subject %
161 \mailto[Some subject of the e-mail]{[email protected]}.
162
163 \item[--] \verb|\ukoeln| for short University of Cologne (Universit\"{a}t zu K\"{o}ln, %
164 U~Koeln; Germany; \url{https://www.portal.uni-koeln.de/8911.html?&L=1})
165 ad-\linebreak dresses, e.\,g. \ukoeln{PDGKL}.
166
167 \item[--] \verb|\uref| takes two arguments, the first gives the target of the hyperlink, %
168 the second gives the text to be displayed for it, e.\,g. information about the %
169 \uref{https://ctan.org/pkg/uri}{uri package}, similar to \verb|\href|. %
170 When \textsf{hyperref} was not loaded, \newline%
171 \verb|\uref{first argument}{second argument}| %
172 defaults to\newline
173 \verb|\url{second argument}|.
174 \end{itemize}
175
176 \subsection{Stress test\label{relaxation}}
177 Even \verb|\doi{1.2/3-.(5):<>;%A\8!$~&{}#X}|
178 would work (if that DOI would exist; same for the other types of uri):
179 \doi{1.2/3-.(5):<>;%A\8!$~&{}#X}{%
180 } (In the error message at doi.org the \verb|#X| is not included,
181 because it is interpreted as \textquotedblleft anchor X\textquotedblright{} at
182 page \verb|1.2/3-.(5):<>;%A\8!$~&{}|, which already is not found.)\newline
183 Adding \verb|opening bracket percent-sign line break closing bracket|\newline
184 (please see the source code of the example)
185 makes programs happy, which check for bracket pairs and take the
186 first percent sign as the start of a comment and therefore miss
187 the closing bracket (but therefore also the following opening one).
188 And this real DOI works:\newline
189 \doi{10.1002/1097-4636(200108)56:2<282::AID-JBM1096>3.0.CO;2-5}\newline
190 (short: \doi{10/b8xfbg}, see DOI in %
191 \hyperref[uritypes]{\ref*{uritypes} Supported types of uri}).
192 \pagebreak
193
194 \subsection{Name-to-Thing resolver}
195 It is also possible to resolve a lot of identifiers by
196 the Name-to-Thing resolver by just appending the identifier to
197 \url{https://n2t.net/}, e.\,g. \newline%
198 \url{https://n2t.net/arXiv:math/9201303}, \newline%
199 \url{https://n2t.net/ASIN:0201134489}, \newline%
200 \url{https://n2t.net/DOI:10.1111/coin.12165}, \newline%
201 \url{https://n2t.net/HDL:2128/2486}, \newline%
202 \url{https://n2t.net/urn:nbn:de:bsz:mit1-opus-3145}, \newline%
203 \url{https://n2t.net/OCLC:935889548}, \newline%
204 \url{https://n2t.net/PubMed:24925405}, and also \newline%
205 \url{https://n2t.net/ISBN:9783638922005} and \newline%
206 \url{https://n2t.net/ARK:12148/bpt6k15385d}.\newline%
207 (And for resolving OIDs like OID:2.16.840 instead of %
208 \url{http://www.oid-info.com/cgi-bin/display?oid=2.16.840&submit=Display&action=display} %
209 it is possible to use %
210 \url{https://identifiers.org/OID:2.16.840}.)\newline%
211 Disadvantages: It is longer and requires \href{https://n2t.net/}{n2t.net} to work %
212 (or \href{https://identifiers.org/}{identifiers.org} for OID).\newline%
213 Advantage: Anybody reading the printed document can just enter %
214 the url as given into their browser without thinking about how to resolve %
215 that type of uri.
216
217 \subsection{Disclaimer for web links}
218 The author is not responsible for any contents referred
219 to in this work unless if having full knowledge of illegal contents. If any damage
220 occurs by the use of information presented there, only the author of the respective
221 pages might be liable, not the one who has referred to these pages.
222 \end{document}
223 \endinput
224 %%
225 %% End of file `uri-example.tex'.