summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/doipubmed
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-11 23:52:23 +0000
committerKarl Berry <karl@freefriends.org>2006-01-11 23:52:23 +0000
commit327a012e51d523cc09b8436d713192ebdcafde1d (patch)
tree417e2c8ef0d790a4c57136b2604045d2c26f1052 /Master/texmf-dist/source/latex/doipubmed
parent60f6bd8f7bd0b70d95fc8c39b8c8dbb49c24e5dc (diff)
trunk/Master/texmf-dist/source/latex/doipubmed
git-svn-id: svn://tug.org/texlive/trunk@227 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/doipubmed')
-rw-r--r--Master/texmf-dist/source/latex/doipubmed/doipubmed.dtx204
-rw-r--r--Master/texmf-dist/source/latex/doipubmed/doipubmed.ins19
2 files changed, 223 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/doipubmed/doipubmed.dtx b/Master/texmf-dist/source/latex/doipubmed/doipubmed.dtx
new file mode 100644
index 00000000000..cf2c4e75700
--- /dev/null
+++ b/Master/texmf-dist/source/latex/doipubmed/doipubmed.dtx
@@ -0,0 +1,204 @@
+%\iffalse
+%<*package>
+%% \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 \~}
+%</package>
+%\fi
+% \iffalse
+% Doc-Source file to use with LaTeX2e
+% Copyright (C) 2005 Nicola Talbot, all rights reserved.
+% \fi
+% \iffalse
+%<*driver>
+\documentclass{ltxdoc}
+
+\usepackage[colorlinks,
+ bookmarks,
+ bookmarksopen,
+ pdfauthor={N.L.C. Talbot},
+ pdftitle={Documentation for doipubmed.sty},
+ pdfkeywords={date,time,LaTeX}]{hyperref}
+
+
+
+\begin{document}
+\DocInput{doipubmed.dtx}
+\end{document}
+%</driver>
+%\fi
+%
+%\def\filedate{9 September 2005}
+%\def\fileversion{1.0}
+%\def\filename{doipubmed.dtx}
+%\def\docdate{9 September 2005}
+%\title{Documentation for doipubmed.sty}
+%\author{Nicola Talbot}
+%\date{\docdate}
+%\maketitle
+% \section{Introduction}
+% The commands defined in this package were primarily designed
+% for use in bibliographies to make it easier to cite
+% documents with digital object identifiers (DOI) or PubMed
+% entries. If the command \verb|\url| has been defined, the
+% definition will remain, otherwise the \texttt{url} package
+% will be loaded.
+%
+% Example:
+%\begin{verbatim}
+%@article{Cawley2002e,
+% author = "Cawley, Gavin C. and Talbot, Nicola L. C.",
+% title = "Fast leave-one-out cross-validation of sparse least-squares
+% support vector machines",
+% journal = "Neural Networks",
+% volume = 17,
+% number = 10,
+% pages = "1467--1475",
+% month = DEC,
+% year = 2004,
+% note = "(\doi{10.1016/j.neunet.2004.07.002},
+% \pubmed{15541948}). Also available from
+% \citeurl{http://theoval.cmp.uea.ac.uk/~gcc/publications}"
+%}
+%\end{verbatim}
+%
+% \section{doipubmed.sty code}
+% Package initialisation and identification
+% \begin{macrocode}
+%<*package>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{doipubmed}[2005/09/09 (NLCT)]
+% \end{macrocode}
+% If |\url| has not been defined, load the \texttt{url}
+% package.
+% \begin{macrocode}
+\@ifundefined{url}{\RequirePackage{url}}{}
+% \end{macrocode}
+% If |\href| has been defined (e.g.\ if the \texttt{hyperref}
+% package has been loaded), then do nothing, otherwise if
+% |\htmladdnormallink| has been defined (e.g.\ if the
+% \texttt{html} package has been loaded) then define
+% |\href| in terms of |\htmladdnormallink|, otherwise define
+% |\href| to simply print the second argument and the first
+% is ignored (so there will be no hyperlink).
+% \begin{macrocode}
+\@ifundefined{href}{
+\@ifundefined{htmladdnormallink}{
+\newcommand{\href}[2]{#2}
+}{%
+\newcommand{\href}[2]{\htmladdnormallink{#2}{#1}}
+}
+}{}
+% \end{macrocode}
+% Define some commands to allow the user to change the format
+% of the text provided with the hyperlink. The argument will
+% be the argument as passed to |\doi| or |\pubmed|:
+% \begin{macrocode}
+\newcommand{\doitext}[1]{doi: #1}
+\newcommand{\pubmedtext}[1]{PubMed: #1}
+% \end{macrocode}
+%\DescribeMacro{\doi}Define |\doi|. Syntax:
+%|\doi{|\meta{code}|}|.
+% For example, |\doi{10.1109/ICPR.2004.1334245}|
+% will produce \href{http://dx.doi.org/10.1109/ICPR.2004.1334245}{doi: 10.1109/ICPR.2004.1334245}.
+% \begin{macrocode}
+\newcommand{\doi}[1]{\href{http://dx.doi.org/#1}{\doitext{#1}}}
+% \end{macrocode}
+%\DescribeMacro{\pubmed}Define |\pubmed|. Syntax:
+%|\pubmed{|\meta{code}|}|.
+%For example, |\pubmed{15541948}| will produce
+% \href{http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=15541948&dopt=Abstract}{PubMed: 15541948}.
+% \begin{macrocode}
+\newcommand{\pubmed}[1]{%
+\href{http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=#1&dopt=Abstract}{%
+\pubmedtext{#1}}}
+% \end{macrocode}
+%\DescribeMacro{\citeurl}Define |\citeurl| to place address
+% between \textless\ and \textgreater.
+% \begin{macrocode}
+\newcommand{\citeurl}[1]{\textless\url{#1}\textgreater}
+%</package>
+% \end{macrocode}
+% \section{doipubmed.perl code}
+% This is the code for the \LaTeX2HTML style file. The text
+% produced by the |\doi| and |\pubmed| commands don't include
+% the code (but this can be changed by redefining |\doitext|
+% and |\pubmedtext|)
+% \begin{macrocode}
+%<*perl>
+#!/usr/bin/perl
+
+# File : doipub.perl
+# Author : Nicola Talbot
+# Date : 9th September 2005
+# Description : LaTeX2HTML style file implementing doipubmed package
+
+sub do_cmd_doitext{
+ local($_) = @_;
+ local($doi);
+
+ s/$next_pair_pr_rx/$doi=$2;''/eo;
+ join('', "doi", $_);
+}
+
+sub do_cmd_pubmedtext{
+ local($_) = @_;
+ local($pubmed);
+
+ s/$next_pair_pr_rx/$pubmed=$2;''/eo;
+ join('', "PubMed", $_);
+}
+
+sub do_cmd_doi{
+ local($_) = @_;
+ local($doi,$doitext,$br_id);
+
+ s/$next_pair_pr_rx/$br_id=$1;$doi=$2;''/eo;
+
+ $doitext = &do_cmd_doitext("$OP$br_id$CP$doi$OP$br_id$CP");
+
+ join('',
+ &make_href("http://dx.doi.org/$doi", $doitext),
+ $_);
+}
+
+sub do_cmd_pubmed{
+ local($_) = @_;
+ local($pubmed,$pubmedtext,$br_id);
+
+ s/$next_pair_pr_rx/$br_id=$1;$pubmed=$2;''/eo;
+
+ $pubmedtext = &do_cmd_pubmedtext("$OP$br_id$CP$pubmed$OP$br_id$CP");
+
+ join('',
+ &make_href("http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=$pubmed&dopt=Abstract",
+ $pubmedtext),
+ $_);
+}
+
+sub do_cmd_citeurl{
+ local($_) = @_;
+ local($url);
+
+ s/$next_pair_pr_rx/$url=$2;''/eo;
+
+ join('', '&lt;',
+ &make_href($url, $url), '&gt;',
+ $_);
+}
+
+1;
+%</perl>
+% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex/doipubmed/doipubmed.ins b/Master/texmf-dist/source/latex/doipubmed/doipubmed.ins
new file mode 100644
index 00000000000..67d3a5af9f3
--- /dev/null
+++ b/Master/texmf-dist/source/latex/doipubmed/doipubmed.ins
@@ -0,0 +1,19 @@
+\input docstrip
+
+\preamble
+Copyright (C) 2005 Nicola Talbot, all rights reserved.
+If you modify this file, you must change its name first.
+You are NOT ALLOWED to distribute this file alone. You are NOT
+ALLOWED to take money for the distribution or use of either this
+file or a changed version, except for a nominal charge for copying
+etc.
+\endpreamble
+
+\askforoverwritefalse
+
+\generate{
+\file{doipubmed.sty}{\from{doipubmed.dtx}{package}}
+\file{doipubmed.perl}{\nopreamble\nopostamble\from{doipubmed.dtx}{perl}}
+}
+
+\endbatchfile