|
| 1 | +% \iffalse meta-comment |
| 2 | +% |
| 3 | +% Copyright (C) 2020 by Leo C. Stein <leo.stein@gmail.com> |
| 4 | +% --------------------------------------------------------------------------- |
| 5 | +% This work may be distributed and/or modified under the |
| 6 | +% conditions of the LaTeX Project Public License, either version 1.3 |
| 7 | +% of this license or (at your option) any later version. |
| 8 | +% The latest version of this license is in |
| 9 | +% http://www.latex-project.org/lppl.txt |
| 10 | +% and version 1.3 or later is part of all distributions of LaTeX |
| 11 | +% version 2005/12/01 or later. |
| 12 | +% |
| 13 | +% This work has the LPPL maintenance status `maintained'. |
| 14 | +% |
| 15 | +% The Current Maintainer of this work is Leo C. Stein. |
| 16 | +% |
| 17 | +% This work consists of the files orcidlink.dtx and orcidlink.ins |
| 18 | +% and the derived filebase orcidlink.sty. |
| 19 | +% |
| 20 | +% \fi |
| 21 | +% |
| 22 | +% \iffalse |
| 23 | +%<*driver> |
| 24 | +\ProvidesFile{orcidlink.dtx} |
| 25 | +%</driver> |
| 26 | +% |
| 27 | +%<*driver> |
| 28 | +\documentclass{ltxdoc} |
| 29 | +\usepackage[dvipsnames]{xcolor} |
| 30 | +\usepackage{orcidlink}[2021/03/15] |
| 31 | +\hypersetup{colorlinks,urlcolor=NavyBlue,citecolor=NavyBlue,linkcolor=NavyBlue,pdfusetitle} |
| 32 | +\usepackage{graphicx} |
| 33 | +\EnableCrossrefs |
| 34 | +\CodelineIndex |
| 35 | +\RecordChanges |
| 36 | +\begin{document} |
| 37 | + \DocInput{orcidlink.dtx} |
| 38 | + \PrintChanges |
| 39 | +\end{document} |
| 40 | +%</driver> |
| 41 | +% \fi |
| 42 | +% |
| 43 | +% \CheckSum{33} |
| 44 | +% |
| 45 | +% \CharacterTable |
| 46 | +% {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 |
| 47 | +% 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 |
| 48 | +% Digits \0\1\2\3\4\5\6\7\8\9 |
| 49 | +% Exclamation \! Double quote \" Hash (number) \# |
| 50 | +% Dollar \$ Percent \% Ampersand \& |
| 51 | +% Acute accent \' Left paren \( Right paren \) |
| 52 | +% Asterisk \* Plus \+ Comma \, |
| 53 | +% Minus \- Point \. Solidus \/ |
| 54 | +% Colon \: Semicolon \; Less than \< |
| 55 | +% Equals \= Greater than \> Question mark \? |
| 56 | +% Commercial at \@ Left bracket \[ Backslash \\ |
| 57 | +% Right bracket \] Circumflex \^ Underscore \_ |
| 58 | +% Grave accent \` Left brace \{ Vertical bar \| |
| 59 | +% Right brace \} Tilde \~} |
| 60 | +% |
| 61 | +% |
| 62 | +% \changes{v1.0.0}{2020/11/19}{Converted to DTX file} |
| 63 | +% \changes{v1.0.1}{2020/11/21}{Bugfix due to misunderstanding of docstrip} |
| 64 | +% \changes{v1.0.2}{2020/11/21}{Fix fragility of command when inside of |
| 65 | +% author, and combined with hyperref's option pdfusetitle} |
| 66 | +% \changes{v1.0.3}{2021/03/15}{Improve fragility by calculating |
| 67 | +% scaling ourselves, and using DeclareRobustCommand} |
| 68 | +% \changes{v1.0.4}{2021/06/11}{Use XeTeXLinkBox to get hyperlink |
| 69 | +% working correctly with XeTeX. Thanks to Tim Henke for the bug report.} |
| 70 | +% |
| 71 | +% \DoNotIndex{\newcommand,\newenvironment} |
| 72 | +% |
| 73 | +% \GetFileInfo{orcidlink.sty} |
| 74 | +% \title{The \textsf{orcidlink} package} |
| 75 | +% \author{Leo C.\ Stein\,\orcidlink{0000-0001-7559-9597} \\ \href{mailto:leo.stein@gmail.com}{leo.stein@gmail.com}} |
| 76 | +% \date{\fileversion~from \filedate} |
| 77 | +% |
| 78 | +% \maketitle |
| 79 | +% |
| 80 | +% \noindent Source repo: |
| 81 | +% \url{https://github.com/duetosymmetry/orcidlink-LaTeX-command}. |
| 82 | +% |
| 83 | +% \section{Introduction} |
| 84 | +% |
| 85 | +% This is a LaTeX style file to add a macro for inserting a linked |
| 86 | +% ORCiD logo. The package provides exactly one command, |\orcidlink|. |
| 87 | +% |
| 88 | +% \section{Usage} |
| 89 | +% |
| 90 | +% To use this package, in the preamble include |
| 91 | +% \begin{verbatim} |
| 92 | +% \usepackage{orcidlink} |
| 93 | +% \end{verbatim} |
| 94 | +% |
| 95 | +% \DescribeMacro{\orcidlink\marg{orcid}} |
| 96 | +% Insert the ORCiD logo (\orcidlink{}), which is hyperlinked to the URL |
| 97 | +% of the researcher whose iD was specified. |
| 98 | +% Replace the mandatory argument \meta{orcid} with your |
| 99 | +% ORCiD --- just the digits, not your whole URL. |
| 100 | +% For example, the command |
| 101 | +% |\orcidlink{0000-0001-7559-9597}| will hyperlink to the URL |
| 102 | +% \url{https://orcid.org/0000-0001-7559-9597}. |
| 103 | +% This is most common in |
| 104 | +% the author list. For example, in the preamble of a RevTeX article, |
| 105 | +% if you write |
| 106 | +% \begin{verbatim} |
| 107 | +% \author{Emmy Noether\,\orcidlink{0000-0000-0000-0000}} |
| 108 | +% \end{verbatim} |
| 109 | +% then the article byline will look something like this: |
| 110 | +% |
| 111 | +% \includegraphics[width=0.5\textwidth]{preview}\newline{} |
| 112 | +% The macro is used in the author line of this documentation as well. |
| 113 | +% |
| 114 | +% \StopEventually{} |
| 115 | +% |
| 116 | +% \section{Implementation} |
| 117 | +% |
| 118 | +% \iffalse |
| 119 | +%<*package> |
| 120 | +% \fi |
| 121 | +% |
| 122 | +% \begin{macrocode} |
| 123 | +\NeedsTeXFormat{LaTeX2e}[1994/06/01] |
| 124 | +\ProvidesPackage{orcidlink} |
| 125 | + [2021/06/11 v1.0.4 Linked ORCiD logo macro package] |
| 126 | + |
| 127 | +%% All I did was package up Milo's code on TeX.SE, |
| 128 | +%% see https://tex.stackexchange.com/a/445583/34063 |
| 129 | +\RequirePackage{hyperref} |
| 130 | +\RequirePackage{tikz} |
| 131 | + |
| 132 | +\ProcessOptions\relax |
| 133 | + |
| 134 | +\usetikzlibrary{svg.path} |
| 135 | + |
| 136 | +\definecolor{orcidlogocol}{HTML}{A6CE39} |
| 137 | +\tikzset{ |
| 138 | + orcidlogo/.pic={ |
| 139 | + \fill[orcidlogocol] svg{M256,128c0,70.7-57.3,128-128,128C57.3,256,0,198.7,0,128C0,57.3,57.3,0,128,0C198.7,0,256,57.3,256,128z}; |
| 140 | + \fill[white] svg{M86.3,186.2H70.9V79.1h15.4v48.4V186.2z} |
| 141 | + svg{M108.9,79.1h41.6c39.6,0,57,28.3,57,53.6c0,27.5-21.5,53.6-56.8,53.6h-41.8V79.1z M124.3,172.4h24.5c34.9,0,42.9-26.5,42.9-39.7c0-21.5-13.7-39.7-43.7-39.7h-23.7V172.4z} |
| 142 | + svg{M88.7,56.8c0,5.5-4.5,10.1-10.1,10.1c-5.6,0-10.1-4.6-10.1-10.1c0-5.6,4.5-10.1,10.1-10.1C84.2,46.7,88.7,51.3,88.7,56.8z}; |
| 143 | + } |
| 144 | +} |
| 145 | + |
| 146 | +%% Reciprocal of the height of the svg whose source is above. The |
| 147 | +%% original generates a 256pt high graphic; this macro holds 1/256. |
| 148 | +\newcommand{\@OrigHeightRecip}{0.00390625} |
| 149 | + |
| 150 | +%% We will compute the current X height to make the logo the right height |
| 151 | +\newlength{\@curXheight} |
| 152 | + |
| 153 | +% \end{macrocode} |
| 154 | +% |
| 155 | +% \begin{macro}{\orcidlink} |
| 156 | +% \begin{macrocode} |
| 157 | +\DeclareRobustCommand\orcidlink[1]{% |
| 158 | +\texorpdfstring{% |
| 159 | +\setlength{\@curXheight}{\fontcharht\font`X}% |
| 160 | +\href{https://orcid.org/#1}{\XeTeXLinkBox{\mbox{% |
| 161 | +\begin{tikzpicture}[yscale=-\@OrigHeightRecip*\@curXheight, |
| 162 | +xscale=\@OrigHeightRecip*\@curXheight,transform shape] |
| 163 | +\pic{orcidlogo}; |
| 164 | +\end{tikzpicture}% |
| 165 | +}}}}{}} |
| 166 | + |
| 167 | +\endinput |
| 168 | +% \end{macrocode} |
| 169 | +% \end{macro} |
| 170 | +% |
| 171 | + |
| 172 | +% |
| 173 | +% \iffalse |
| 174 | +%</package> |
| 175 | +% \fi |
| 176 | +% |
| 177 | +% \Finale |
| 178 | +\endinput |
0 commit comments