Skip to content

Commit

Permalink
Add orcidlinks, orcidlinkm, orcidlinkl
Browse files Browse the repository at this point in the history
* small: current/old size
* medium: matches looks of stackoverflow post
* large: should match large variant from ORCID guidelines (preview.png)
  • Loading branch information
jonas-schulze committed Dec 14, 2022
1 parent 5034833 commit 094f367
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions orcidlink.sty
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
%% The original source files were:
%%
%% orcidlink.dtx (with options: `package')
%%
%%
%% This is a generated file.
%%
%%
%% Copyright (C) 2020 by Leo C. Stein <leo.stein@gmail.com>
%% --------------------------------------------------------------------------
%% This work may be distributed and/or modified under the
Expand All @@ -17,7 +17,7 @@
%% 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.
%%
%%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{orcidlink}
[2021/06/11 v1.0.4 Linked ORCiD logo macro package]
Expand Down Expand Up @@ -45,19 +45,46 @@
%% original generates a 256pt high graphic; this macro holds 1/256.
\newcommand{\@OrigHeightRecip}{0.00390625}

%% We will compute the current X height to make the logo the right height
%% Reciprocal of the height of D within the svg above.
%% The original D spans from 79.1pt to 186.2pt; this macro holds 1/107.1.
\newcommand{\@OrigInnerHeightRecip}{0.009337068160597572}

\newlength{\@curXheight}
\newlength{\@curXdepth}

\DeclareRobustCommand\orcidlink[1]{%
%% Scale and center the logo around the given glyph
\DeclareRobustCommand\@orcidlink[2]{%
\texorpdfstring{%
\setlength{\@curXheight}{\fontcharht\font`X}%
\href{https://orcid.org/#1}{\XeTeXLinkBox{\mbox{%
\setlength{\@curXheight}{\fontcharht\font`#1}%
\setlength{\@curXdepth}{\fontchardp\font`#1}%
\addtolength{\@curXheight}{\@curXdepth}%
\href{https://orcid.org/#2}{\XeTeXLinkBox{\mbox{%
\begin{tikzpicture}[yscale=-\@OrigHeightRecip*\@curXheight,
baseline=-\@curXheight+\@curXdepth,
xscale=\@OrigHeightRecip*\@curXheight,transform shape]
\pic{orcidlogo};
\end{tikzpicture}%
}}}}{}}

\DeclareRobustCommand\orcidlinkss[1]{\@orcidlink{X}{#1}}
\DeclareRobustCommand\orcidlinkmm[1]{\@orcidlink{|}{#1}}

%% Default to the small logo
\DeclareRobustCommand\orcidlink\orcidlinkss

%% Scale the logo such that its font size matches lowercase letters of the surrounding text
\DeclareRobustCommand\orcidlinkll[1]{%
\texorpdfstring{%
\setlength{\@curXheight}{\fontcharht\font`x}%
\href{https://orcid.org/#1}{\XeTeXLinkBox{\mbox{%
\begin{tikzpicture}[yscale=-\@OrigInnerHeightRecip*\@curXheight,
baseline=(base),
xscale=\@OrigInnerHeightRecip*\@curXheight,transform shape]
\pic{orcidlogo};
\coordinate (base) at (0,186.2pt);
\end{tikzpicture}%
}}}}{}}

\endinput
%%
%% End of file `orcidlink.sty'.

0 comments on commit 094f367

Please sign in to comment.