summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/doi
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-04-11 22:58:58 +0000
committerKarl Berry <karl@freefriends.org>2007-04-11 22:58:58 +0000
commit4b9b1bcdd965d2220397723d248a8c0e7a4cdd32 (patch)
tree9e1a6e4365eb2b61f8269a6a2a2648ec2bb20445 /Master/texmf-dist/tex/latex/doi
parent514d376562aded27012738499e8bdac6360e919b (diff)
new latex package doi (11apr07)
git-svn-id: svn://tug.org/texlive/trunk@4146 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/doi')
-rw-r--r--Master/texmf-dist/tex/latex/doi/doi.sty42
1 files changed, 42 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/doi/doi.sty b/Master/texmf-dist/tex/latex/doi/doi.sty
new file mode 100644
index 00000000000..5e686c47e64
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/doi/doi.sty
@@ -0,0 +1,42 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{doi}[2005/03/24 handle doi numbers]
+%% original code written by Heiko Oberdiek and published on comp.text.tex
+%% Packaged as a style file by Maarten Sneep, with some minor
+%% changes suggested by Bruno Voisin to accomodate the Apple
+%% pdf framework
+%%
+%% This code is placed under the LPPL
+
+%% We need hyperref, but you probably want to load hyperref
+%% beforehand, or set some options later on.
+\RequirePackage{hyperref}
+
+\newcommand*{\doi}{%
+ \begingroup
+ \lccode`\~=`\#\relax
+ \lowercase{\def~{\#}}
+ \lccode`\~=`\<\relax
+ \lowercase{\def~{\textless}}
+ \lccode`\~=`\>\relax
+ \lowercase{\def~{\textgreater}}
+ \lccode`\~=0\relax
+ \catcode`\#=\active
+ \catcode`\<=\active
+ \catcode`\>=\active
+ \@doi
+}%
+
+\def\@doi#1{%
+ \let\#\relax
+ \let\textless\relax
+ \let\textgreater\relax
+ \edef\x{\toks0={{#1}}}%
+ \x
+ \edef\#{\@percentchar23}%
+ \edef\textless{\@percentchar3C}% instead of {\string<} for Apple
+ \edef\textgreater{\@percentchar3E}% instead of {\sting>} for Apple
+ \edef\x{\toks1={\noexpand\href{http://dx.doi.org/#1}}}%
+ \x
+ \edef\x{\endgroup\the\toks1 \the\toks0}
+ \x
+}