Skip to content

Commit

Permalink
Update to latest version of orcidlink
Browse files Browse the repository at this point in the history
  • Loading branch information
duetosymmetry committed Sep 5, 2024
1 parent e936337 commit d6a4bbf
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions orcidlink.sty
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
%%
%% This is a generated file.
%%
%% Copyright (C) 2020 by Leo C. Stein <[email protected]>
%% Copyright (C) 2019-2024 by Leo C. Stein <[email protected]>
%% --------------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
Expand All @@ -20,10 +20,11 @@
%%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{orcidlink}
[2021/03/15 v1.0.3 Linked ORCiD logo macro package]
[2024/06/26 v1.1.0 Support ORCID's three different ID formats.]

%% All I did was package up Milo's code on TeX.SE,
%% see https://tex.stackexchange.com/a/445583/34063
%% This started out as Milo's code on TeX.SE,
%% see https://tex.stackexchange.com/a/445583/34063.
%% It has since been expanded with more commands.
\RequirePackage{hyperref}
\RequirePackage{tikz}

Expand All @@ -48,15 +49,29 @@
%% We will compute the current X height to make the logo the right height
\newlength{\@curXheight}

\DeclareRobustCommand\orcidlink[1]{%
%% Prevent externalization of the ORCiD logo.
\newcommand{\@preventExternalization}{%
\ifcsname tikz@library@external@loaded\endcsname%
\tikzset{external/export next=false}\else\fi%
}

\newcommand{\orcidlogo}{%
\texorpdfstring{%
\setlength{\@curXheight}{\fontcharht\font`X}%
\href{https://orcid.org/#1}{\mbox{%
\XeTeXLinkBox{%
\@preventExternalization%
\begin{tikzpicture}[yscale=-\@OrigHeightRecip*\@curXheight,
xscale=\@OrigHeightRecip*\@curXheight,transform shape]
\pic{orcidlogo};
\end{tikzpicture}%
}}}{}}
}}{}}

\DeclareRobustCommand\orcidlinkX[3]{\href{https://orcid.org/#2}{%
\ifstrempty{#1}{}{#1\,}\orcidlogo\ifstrempty{#3}{}{\,#3}}}
\newcommand{\orcidlinkf}[1]{\orcidlinkX{}{#1}{https://orcid.org/#1}}
\newcommand{\orcidlinkc}[1]{\orcidlinkX{}{#1}{#1}}
\newcommand{\orcidlinki}[2]{\orcidlinkX{#1}{#2}{}}
\newcommand{\orcidlink}[1]{\orcidlinkX{}{#1}{}}

\endinput
%%
Expand Down

0 comments on commit d6a4bbf

Please sign in to comment.