Skip to content

Commit

Permalink
Implement ORCID's officially recommended formats
Browse files Browse the repository at this point in the history
Thanks to @Hugo-Heagren for suggestions. This is based on his original
code with hash ccb60fd in PR #11.
  • Loading branch information
duetosymmetry committed Jun 27, 2024
1 parent 11f7302 commit fe2e6ee
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 25 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
LPPL License 1.3c

Copyright (C) 2019-2023 Leo C. Stein <[email protected]>
Copyright (C) 2019-2024 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 Down
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# orcidlink-LaTeX-command
LaTeX style file to add a macro for inserting a linked ORCiD logo

This LaTeX style file just defines a single macro, `\orcidlink`. The code is from [this TeX.SE answer](https://tex.stackexchange.com/a/445583/34063). My contribution was wrapping it into a style file (and improving the fragility of the command a bit).
This LaTeX style file defines `\orcidlink` and a few related macros.
The code is from [this TeX.SE
answer](https://tex.stackexchange.com/a/445583/34063). I wrapped it
into a style file and improved the fragility of the command a bit.
Later (at the suggestion of Hugo Heagren) we added the `\orcidlogo`
command, and commands for the three recommended formats: full,
compact, and inline, with commands `\orcidlinkf`, `\orcidlinkc`, and
`\orcidlinki`.

Installation
------------
Expand Down Expand Up @@ -30,6 +37,14 @@ When you want to insert the hyperlinked ORCiD logo, use `\orcidlink{0000-0000-00
This will appear as a clickable hyperlink, and will look like this:
![Author LaTeX render preview image](https://raw.githubusercontent.com/duetosymmetry/orcidlink-LaTeX-command/f03c85cd9fe3e40bec5f51b1319b0e9ab30c2e09/preview.png)

If you simply want the ORCiD logo without a hyperlink anywhere, use
`\orcidlogo`.

ORCiD’s [guidelines](https://info.orcid.org/brand-guidelines/)
recommend three formats: full, compact, and inline. The three formats
are available, through `\orcidlinkf{orcid}`, `\orcidlinkc{orcid}`, and
`\orcidlinki{Name}{orcid}`.

Dependancies and Compatibility
------------------------------

Expand All @@ -49,6 +64,6 @@ Credits
The original TikZ icon code was created by user [Milo on
TeX.SE](https://tex.stackexchange.com/users/128068/milo).
This package was created and is maintained by [Leo
C. Stein](http://duetosymmetry.com/), (c) 2019-2023.
C. Stein](http://duetosymmetry.com/), (c) 2019-2024.
This material is subject to the [LaTeX Project Public License
1.3c](https://www.ctan.org/license/lppl1.3).
91 changes: 78 additions & 13 deletions orcidlink.dtx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
% Copyright (C) 2019-2023 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 @@ -27,9 +27,12 @@
%<*driver>
\documentclass{ltxdoc}
\usepackage[dvipsnames]{xcolor}
\usepackage{orcidlink}[2023/12/30]
\hypersetup{colorlinks,urlcolor=NavyBlue,citecolor=NavyBlue,linkcolor=NavyBlue,pdfusetitle}
\usepackage{orcidlink}[2024/06/25]
\hypersetup{colorlinks,urlcolor=NavyBlue,citecolor=NavyBlue,linkcolor=NavyBlue}
\hypersetup{pdftitle={The orcidlink package},pdfauthor={Leo C. Stein},
pdfsubject={-}}
\usepackage{graphicx}
\usepackage{microtype}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
Expand All @@ -40,7 +43,7 @@
%</driver>
% \fi
%
% \CheckSum{41}
% \CheckSum{59}
%
% \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 Down Expand Up @@ -69,6 +72,8 @@
% 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.}
% \changes{v1.1.0}{2024/06/25}{Support ORCID's three different ID
% formats. Thanks to Hugo Heagren for suggestions.}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
Expand All @@ -84,8 +89,10 @@
%
% \section{Introduction}
%
% This is a LaTeX style file to add a macro for inserting a linked
% ORCiD logo. The package provides exactly one command, |\orcidlink|.
% This is a LaTeX style file providing a macro for inserting a
% hyperlinked ORCiD logo. The package also provides three commands
% for ORCiD's three recommended ID printing formats, and a command for
% just the ORCiD logo, not linked to anything.
%
% \section{Usage}
%
Expand Down Expand Up @@ -113,6 +120,36 @@
% \includegraphics[width=0.5\textwidth]{preview}\newline{}
% The macro is used in the author line of this documentation as well.
%
% \DescribeMacro{\orcidlogo}
% If you simply want the ORCiD logo without a hyperlink anywhere, use
% |\orcidlogo|.
%
% ORCiD's \href{https://info.orcid.org/brand-guidelines/}{guidelines}
% recommend three formats: full, compact, and inline. The three
% formats are available:
% \begin{enumerate}
% \item \DescribeMacro{\orcidlinkf\marg{orcid}} Full format. Example:
% |\orcidlinkf{0000-0001-7559-9597}| will insert
% \orcidlinkf{0000-0001-7559-9597}
% \item \DescribeMacro{\orcidlinkc\marg{orcid}} Compact format.
% Example: |\orcidlinkc{0000-0001-7559-9597}| will insert
% \orcidlinkc{0000-0001-7559-9597}
% \item \DescribeMacro{\orcidlinki\marg{Name}\marg{orcid}} Inline
% format. Example: |\orcidlinki{Leo C. Stein}{0000-0001-7559-9597}|
% will insert \orcidlinki{Leo C. Stein}{0000-0001-7559-9597}
% \end{enumerate}
%
% \DescribeMacro{\orcidlinkX\marg{before}\marg{orcid}\marg{after}}
%
% The command |\orcidlinkX{before}{orcid}{after}| is a helper macro
% that's used to implement all of the others. Though it is just an
% internal helper, I saw no reason to keep it internal.
% |\orcidlinkX{before}{orcid}{after}| results in
% \orcidlinkX{before}{orcid}{after}. The entire output is hyperlinked
% to the ORCiD page. There is a thin space |\,| between ``before,''
% the logo, and ``after.'' However if ``before'' is empty, the space
% will be omitted; similarly for ``after.''
%
% \section{Package Compatibility}
%
% This package relies on \texttt{hyperref} and \texttt{tikz}. If you
Expand All @@ -132,10 +169,11 @@
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{orcidlink}
[2023/12/30 v1.0.5 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 Down Expand Up @@ -168,18 +206,45 @@

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

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

\endinput
% \end{macrocode}
Expand Down
4 changes: 2 additions & 2 deletions orcidlink.ins
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Copyright (C) 2019-2023 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 @@ -25,7 +25,7 @@

This is a generated file.

Copyright (C) 2019-2023 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 Down
22 changes: 15 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) 2019-2023 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}
[2023/12/30 v1.0.5 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 Down Expand Up @@ -54,16 +55,23 @@
\tikzset{external/export next=false}\else\fi%
}

\DeclareRobustCommand\orcidlink[1]{%
\newcommand{\orcidlogo}{%
\texorpdfstring{%
\setlength{\@curXheight}{\fontcharht\font`X}%
\href{https://orcid.org/#1}{\XeTeXLinkBox{\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 fe2e6ee

Please sign in to comment.