Skip to content

Commit

Permalink
Address #7: Avoid TikZ externalization of ORCiD logos
Browse files Browse the repository at this point in the history
Thanks to @aquileia for the report.
  • Loading branch information
duetosymmetry committed Dec 30, 2023
1 parent 5034833 commit 8b2e5a3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
15 changes: 12 additions & 3 deletions orcidlink.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
%<*driver>
\documentclass{ltxdoc}
\usepackage[dvipsnames]{xcolor}
\usepackage{orcidlink}[2021/03/15]
\usepackage{orcidlink}[2023/12/30]
\hypersetup{colorlinks,urlcolor=NavyBlue,citecolor=NavyBlue,linkcolor=NavyBlue,pdfusetitle}
\usepackage{graphicx}
\EnableCrossrefs
Expand All @@ -40,7 +40,7 @@
%</driver>
% \fi
%
% \CheckSum{33}
% \CheckSum{41}
%
% \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
Expand All @@ -67,6 +67,8 @@
% scaling ourselves, and using DeclareRobustCommand}
% \changes{v1.0.4}{2021/06/11}{Use XeTeXLinkBox to get hyperlink
% working correctly with XeTeX. Thanks to Tim Henke for the bug report.}
% \changes{v1.0.5}{2023/12/30}{Turn off TikZ externalization of logos.
% Thanks to github user aquileia for the bug report.}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
Expand Down Expand Up @@ -122,7 +124,7 @@
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{orcidlink}
[2021/06/11 v1.0.4 Linked ORCiD logo macro package]
[2023/12/30 v1.0.5 Linked ORCiD logo macro package]

%% All I did was package up Milo's code on TeX.SE,
%% see https://tex.stackexchange.com/a/445583/34063
Expand Down Expand Up @@ -150,6 +152,12 @@
%% We will compute the current X height to make the logo the right height
\newlength{\@curXheight}

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

% \end{macrocode}
%
% \begin{macro}{\orcidlink}
Expand All @@ -158,6 +166,7 @@
\texorpdfstring{%
\setlength{\@curXheight}{\fontcharht\font`X}%
\href{https://orcid.org/#1}{\XeTeXLinkBox{\mbox{%
\@preventExternalization%
\begin{tikzpicture}[yscale=-\@OrigHeightRecip*\@curXheight,
xscale=\@OrigHeightRecip*\@curXheight,transform shape]
\pic{orcidlogo};
Expand Down
9 changes: 8 additions & 1 deletion orcidlink.sty
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{orcidlink}
[2021/06/11 v1.0.4 Linked ORCiD logo macro package]
[2023/12/30 v1.0.5 Linked ORCiD logo macro package]

%% All I did was package up Milo's code on TeX.SE,
%% see https://tex.stackexchange.com/a/445583/34063
Expand Down Expand Up @@ -48,10 +48,17 @@
%% We will compute the current X height to make the logo the right height
\newlength{\@curXheight}

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

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

0 comments on commit 8b2e5a3

Please sign in to comment.