From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/doipubmed/doipubmed.dtx | 394 +++++++++++++++++++++++++++ 1 file changed, 394 insertions(+) create mode 100644 macros/latex/contrib/doipubmed/doipubmed.dtx (limited to 'macros/latex/contrib/doipubmed/doipubmed.dtx') diff --git a/macros/latex/contrib/doipubmed/doipubmed.dtx b/macros/latex/contrib/doipubmed/doipubmed.dtx new file mode 100644 index 0000000000..5544adac64 --- /dev/null +++ b/macros/latex/contrib/doipubmed/doipubmed.dtx @@ -0,0 +1,394 @@ +%\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 +%% 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 \~} +% +%\fi +% \iffalse +% Doc-Source file to use with LaTeX2e +% Copyright (C) 2007 Nicola Talbot, all rights reserved. +% \fi +% \iffalse +%<*driver> +\documentclass{ltxdoc} + +\usepackage{color} +\usepackage[colorlinks, + bookmarks, + bookmarksopen, + 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} +\end{document} +% +%\fi +% +%\title{Documentation for doipubmed.sty} +%\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 \cs{url} has been defined, the +% definition will remain, otherwise the \texttt{url} package +% will be loaded. +% +%\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} +%\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}. +% +%\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} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{doipubmed}[2007/08/20 1.01 (NLCT)] +% \end{macrocode} +% If \cs{url} has not been defined, load the \sty{url} +% package. +% \begin{macrocode} +\@ifundefined{url}{\RequirePackage{url}}{} +% \end{macrocode} +% If \cs{href} has been defined (e.g.\ if the \sty{hyperref} +% package has been loaded), then do nothing, otherwise if +% \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} +}{% +\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. +%\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} +% \end{macrocode} +%\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*{\pubmedtext}[1]{PubMed: #1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\doi} +%\changes{1.01}{2007/8/19}{no works with awkward characters} +% \begin{macrocode} +\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} +%\end{macro} +% +%\begin{macro}{\citeurl} +% \begin{macrocode} +\newcommand*{\citeurl}[1]{\textless\url{#1}\textgreater} +% \end{macrocode} +%\end{macro} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*doipubmed.perl> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +#!/usr/bin/perl + +# 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($_) = @_; + 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 = &translate_commands("\\doitext$OP$br_id$CP$doi$OP$br_id$CP"); + + $doi=~s/#/${percent_mark}23/g; + 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 = &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), + $_); +} + +sub do_cmd_citeurl{ + local($_) = @_; + local($url); + + s/$next_pair_pr_rx/$url=$2;''/eo; + + join('', '<', + &make_href($url, $url), '>', + $_); +} + +1; +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\Finale +\endinput -- cgit v1.2.3