From 636d13a66cc63625779c228dd77846fb5f99c39e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 24 Aug 2007 18:41:08 +0000 Subject: doipubmed 1.01 (21aug07) git-svn-id: svn://tug.org/texlive/trunk@4802 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/doipubmed/doipubmed.dtx | 336 ++++++++++++++++----- .../source/latex/doipubmed/doipubmed.ins | 31 +- 2 files changed, 285 insertions(+), 82 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/doipubmed/doipubmed.dtx b/Master/texmf-dist/source/latex/doipubmed/doipubmed.dtx index cf2c4e75700..5544adac64d 100644 --- a/Master/texmf-dist/source/latex/doipubmed/doipubmed.dtx +++ b/Master/texmf-dist/source/latex/doipubmed/doipubmed.dtx @@ -1,4 +1,18 @@ %\iffalse +% doipubmed.dtx generated using makedtx version 0.94b (c) Nicola Talbot +% Command line args: +% -macrocode "doipubmed.perl" +% -setambles "doipubmed.perl=>\nopreamble\nopostamble" +% -comment "doipubmed.perl" +% -src "doipubmed.sty=>doipubmed.sty" +% -src "doipubmed.perl=>doipubmed.perl" +% -doc "manual.tex" +% -author "Nicola Talbot" +% -dir "source" +% doipubmed +% Created on 2007/8/20 16:15 +%\fi +%\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 @@ -19,20 +33,51 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2005 Nicola Talbot, all rights reserved. +% Copyright (C) 2007 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> \documentclass{ltxdoc} +\usepackage{color} \usepackage[colorlinks, bookmarks, bookmarksopen, - pdfauthor={N.L.C. Talbot}, + pdfauthor={Nicola L. C. Talbot}, pdftitle={Documentation for doipubmed.sty}, pdfkeywords={date,time,LaTeX}]{hyperref} +\usepackage{doipubmed} + + +\renewcommand{\usage}[1]{\textit{\hyperpage{#1}}} +\renewcommand{\main}[1]{\hyperpage{#1}} +\newcommand{\see}[2]{\emph{see} #1} +\makeatletter +\RecordChanges +\PageIndex +\definecolor{defbackground}{rgb}{1,1,0.75} +\newsavebox\defsbox +\newlength\defwidth + +\newenvironment{definition}{% +\setlength{\fboxsep}{4pt}\setlength{\fboxrule}{1.25pt}% +\begin{lrbox}{\defsbox}% +\setlength\defwidth\linewidth +\addtolength\defwidth{-2\fboxrule}% +\addtolength\defwidth{-2\fboxsep}% +\begin{minipage}{\defwidth}\flushleft +}{% +\end{minipage} +\end{lrbox}% +\vskip10pt +\noindent +\fcolorbox{black}{defbackground}{\usebox\defsbox}% +\vskip10pt +} +\newcommand*{\sty}[1]{\textsf{#1}} +\CheckSum{148} \begin{document} \DocInput{doipubmed.dtx} @@ -40,110 +85,247 @@ % %\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} +%\author{Nicola L. C. Talbot\\[10pt] +%School of Computing Sciences\\ +%University of East Anglia\\ +%Norwich. Norfolk\\ +%NR4 7TJ. United Kingdom\\ +%\url{http://theoval.cmp.uea.ac.uk/~nlct/}} +%\date{20th August 2007} %\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 +% entries. If the command \cs{url} has been defined, the % definition will remain, otherwise the \texttt{url} package % will be loaded. % -% Example: +%\DescribeMacro{\doi} +%\begin{definition} +%\cs{doi}\marg{ref number} +%\end{definition} +%This displays doi: \meta{ref number} with a hyperlink to the +%corresponding web entry. For example: +%\begin{verbatim} +%\doi{10.1016/j.neunet.2004.07.002} +%\end{verbatim} +%produces: +%\doi{10.1016/j.neunet.2004.07.002}. +% +%As from version 1.01, this +%command also works with awkward characters, for example: +%\begin{verbatim} +%\doi{10.1002/1521-3951(200103)224:1<271::AID-PSSB271>3.0.CO;2-\#} +%\end{verbatim} +%produces: +%\doi{10.1002/1521-3951(200103)224:1<271::AID-PSSB271>3.0.CO;2-\#}. +% +%Alternatively, you can do: %\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}" -%} +%\doi{10.1002/1521-3951(200103)224:1<271::AID-PSSB271>3.0.CO;2-\%23} %\end{verbatim} +%which produces: +%\doi{10.1002/1521-3951(200103)224:1<271::AID-PSSB271>3.0.CO;2-\%23}. % -% \section{doipubmed.sty code} +%\DescribeMacro{\pubmed} +%\begin{definition} +%\cs{pubmed}\marg{ref number} +%\end{definition} +%This displays PubMed: \meta{ref number} with a hyperlink to the +%corresponding PubMed entry. For example: +%\begin{verbatim} +%\pubmed{15541948} +%\end{verbatim} +%produces: +%\pubmed{15541948}. +% +%\DescribeMacro{\citeurl} +%\begin{definition} +%\cs{citeurl}\marg{url} +%\end{definition} +%Displays the URL inside angle brackets. For example: +%\begin{verbatim} +%\citeurl{http://theoval.cmp.uea.ac.uk/~gcc/publications/} +%\end{verbatim} +%produces: +%\citeurl{http://theoval.cmp.uea.ac.uk/~gcc/publications/}. +% +% +% +%\StopEventually{} +%\section{The Code} +%\iffalse +% \begin{macrocode} +%<*doipubmed.sty> +% \end{macrocode} +%\fi % Package initialisation and identification % \begin{macrocode} -%<*package> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{doipubmed}[2005/09/09 (NLCT)] +\ProvidesPackage{doipubmed}[2007/08/20 1.01 (NLCT)] % \end{macrocode} -% If |\url| has not been defined, load the \texttt{url} +% If \cs{url} has not been defined, load the \sty{url} % package. % \begin{macrocode} \@ifundefined{url}{\RequirePackage{url}}{} % \end{macrocode} -% If |\href| has been defined (e.g.\ if the \texttt{hyperref} +% If \cs{href} has been defined (e.g.\ if the \sty{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 +% \cs{htmladdnormallink} has been defined (e.g.\ if the +% \sty{html} package has been loaded) then define +% \cs{href} in terms of \cs{htmladdnormallink}, otherwise define +% \cs{href} to simply print the second argument and the first % is ignored (so there will be no hyperlink). +%\changes{1.01}{2007/8/19}{put \cs{href} check in \cs{AtBeginDocument}} % \begin{macrocode} +\AtBeginDocument{% \@ifundefined{href}{ -\@ifundefined{htmladdnormallink}{ -\newcommand{\href}[2]{#2} +\@ifundefined{htmladdnormallink}{% +\newcommand*{\href}[2]{#2} }{% -\newcommand{\href}[2]{\htmladdnormallink{#2}{#1}} +\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|: +% of the text provided with the hyperlink. +%\begin{macro}{\doitext} +%\begin{definition} +%\cs{doitext}\marg{doi ref} +%\end{definition} +%This controls how to format the doi link text. % \begin{macrocode} -\newcommand{\doitext}[1]{doi: #1} -\newcommand{\pubmedtext}[1]{PubMed: #1} +\newcommand*{\doitext}[1]{doi: #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}. +%\end{macro} +%\begin{macro}{\pubmedtext} +%\begin{definition} +%\cs{pubmedtext}\marg{pub med code} +%\end{definition} +% This controls how to format the PubMed link text. % \begin{macrocode} -\newcommand{\doi}[1]{\href{http://dx.doi.org/#1}{\doitext{#1}}} +\newcommand*{\pubmedtext}[1]{PubMed: #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}. +%\end{macro} +% +%\begin{macro}{\doi} +%\changes{1.01}{2007/8/19}{no works with awkward characters} % \begin{macrocode} -\newcommand{\pubmed}[1]{% +\providecommand*{\doi}[1]{% +\def\@doi@code{}% +\@doi@linksubs#1\#\@@\@doi@code +\@onelevel@sanitize{\@doi@code}% +\def\@doi@text{}% +\@doi@textsubs#1\@nil\@@\@doi@text +\href{http://dx.doi.org/\@doi@code}{\doitext{\@doi@text}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@doi@linksubs} +% \begin{macrocode} +\newtoks\@doi@toks +\def\@doi@linksubs#1\##2\@@#3{% +\def\@doi@tmp{#2}% +\expandafter\@doi@toks\expandafter{#3}% +\toks@{#1}% +\edef#3{\the\@doi@toks\the\toks@}% +\ifx\@doi@tmp\@empty + \let\@doi@next=\@doi@noop +\else + \expandafter\@doi@toks\expandafter{#3}% + \edef#3{\the\@doi@toks\%23}% + \let\@doi@next=\@doi@linksubs +\fi +\@doi@next#2\@@#3\relax +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@doi@noop} +% \begin{macrocode} +\def\@doi@noop#1\@@#2{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@doi@textsubs} +% \begin{macrocode} +\def\@doi@textsubs#1#2\@@#3{% +\def\@doi@argi{#1}% +\def\@doi@argii{#2}% +\ifx\@doi@argi\@nnil + \let\@doi@next=\@doi@noop +\else + \ifx#1<\relax + \expandafter\@doi@toks\expandafter{#3}% + \edef#3{\the\@doi@toks\noexpand\textless}% + \else + \ifx#1>\relax + \expandafter\@doi@toks\expandafter{#3}% + \edef#3{\the\@doi@toks\noexpand\textgreater}% + \else + \expandafter\@doi@toks\expandafter{#3}% + \toks@{#1}% + \edef#3{\the\@doi@toks\the\toks@}% + \fi + \fi + \ifx\@doi@argii\@nnil + \let\@doi@next=\@doi@noop + \else + \let\@doi@next=\@doi@textsubs + \fi +\fi +\@doi@next#2\@@#3\relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\pubmed} +% \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. +%\end{macro} +% +%\begin{macro}{\citeurl} % \begin{macrocode} -\newcommand{\citeurl}[1]{\textless\url{#1}\textgreater} -% +\newcommand*{\citeurl}[1]{\textless\url{#1}\textgreater} % \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|) +%\end{macro} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*doipubmed.perl> +% \end{macrocode} +%\fi +%\iffalse % \begin{macrocode} -%<*perl> #!/usr/bin/perl -# File : doipub.perl -# Author : Nicola Talbot -# Date : 9th September 2005 -# Description : LaTeX2HTML style file implementing doipubmed package +# File : doipub.perl +# Author : Nicola Talbot +# Date : 9th September 2005 +# Last Modified : 20 Aug 2007 +# Version : 1.01 +# +# This is a LaTeX2HTML style implementing the doipubmed package, and +# is distributed as part of that package. +# Copyright 2007 Nicola L.C. Talbot +# This work may be distributed and/or modified under the +# conditions of the LaTeX Project Public License, either version 1.3 +# of this license of (at your option) any later version. +# The latest version of this license is in +# http://www.latex-project.org/lppl.txt +# and version 1.3 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 Nicola Talbot. sub do_cmd_doitext{ local($_) = @_; @@ -167,10 +349,11 @@ sub do_cmd_doi{ s/$next_pair_pr_rx/$br_id=$1;$doi=$2;''/eo; - $doitext = &do_cmd_doitext("$OP$br_id$CP$doi$OP$br_id$CP"); + $doitext = &translate_commands("\\doitext$OP$br_id$CP$doi$OP$br_id$CP"); - join('', - &make_href("http://dx.doi.org/$doi", $doitext), + $doi=~s/#/${percent_mark}23/g; + join('', + &make_href("http://dx.doi.org/$doi", $doitext), $_); } @@ -180,11 +363,11 @@ sub do_cmd_pubmed{ s/$next_pair_pr_rx/$br_id=$1;$pubmed=$2;''/eo; - $pubmedtext = &do_cmd_pubmedtext("$OP$br_id$CP$pubmed$OP$br_id$CP"); + $pubmedtext = &translate_commands("\\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), + join('', + &make_href("http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=$pubmed&dopt=Abstract", + $pubmedtext), $_); } @@ -200,5 +383,12 @@ sub do_cmd_citeurl{ } 1; -% % \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\Finale +\endinput diff --git a/Master/texmf-dist/source/latex/doipubmed/doipubmed.ins b/Master/texmf-dist/source/latex/doipubmed/doipubmed.ins index 67d3a5af9f3..0ea53fa4e94 100644 --- a/Master/texmf-dist/source/latex/doipubmed/doipubmed.ins +++ b/Master/texmf-dist/source/latex/doipubmed/doipubmed.ins @@ -1,19 +1,32 @@ +% doipubmed.ins generated using makedtx version 0.94b 2007/8/20 16:15 \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. + + doipubmed.dtx + Copyright 2007 Nicola Talbot + + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either version 1.3 + of this license of (at your option) any later version. + The latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3 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 Nicola Talbot. + + This work consists of the files doipubmed.dtx and doipubmed.ins and the derived files doipubmed.sty, doipubmed.perl. + \endpreamble \askforoverwritefalse -\generate{ -\file{doipubmed.sty}{\from{doipubmed.dtx}{package}} -\file{doipubmed.perl}{\nopreamble\nopostamble\from{doipubmed.dtx}{perl}} +\generate{\file{doipubmed.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{doipubmed.dtx}{doipubmed.sty,package}} +\file{doipubmed.perl}{\nopreamble\nopostamble\from{doipubmed.dtx}{doipubmed.perl}} } \endbatchfile -- cgit v1.2.3