# Linking ORCID iD in LaTeX files

09 Aug 2019 / Reading time: 2 min

Given a growing popularity of ORCID, it is only natural to devise a way to include its identifier in $\LaTeX$ documents. Some publishers already incorporate such an option in their journals. The method I provide below has been adapted from this template. It yields a green iD icon hyperlinked to the full https URI (cf. the iD display requirements here). Feel free to use the code in your work.

## Required steps

Include in the document preamble the following code that will draw the ORCID logo.

\usepackage{tikz,xcolor,hyperref}

\definecolor{lime}{HTML}{A6CE39}
\DeclareRobustCommand{\orcidicon}{
\begin{tikzpicture}
\draw[lime, fill=lime] (0,0)
node[white] {{\fontfamily{qag}\selectfont \tiny ID}};
\draw[white, fill=white] (-0.0625,0.095)
\end{tikzpicture}
\hspace{-2mm}
}


\foreach \x in {A, ..., Z}{\expandafter\xdef\csname orcid\x\endcsname{\noexpand\href{https://orcid.org/\csname orcidauthor\x\endcsname
{\noexpand\orcidicon}}
}


Now create for each author a command that will produce an image of the logo linked to the ORCID iD in the compiled pdf file. This is done by concatenating \orcidauthor and a capital letter (anything from A to Z), like so

\newcommand{\orcidauthorA}{0000-0002-6963-295X} % For author A
\newcommand{\orcidauthorB}{0000-0001-7246-8612} % For author B
\newcommand{\orcidauthorC}{0000-0002-6416-6320} % For author C


With this method, in a given paper the maximal number of authors with ORCID iD is 26, i.e. is limited by the number of letters in the English alphabet. This is more than enough for most purposes in mathematics, and extensions are not difficult either.

As a final step, to actually produce the hyperlinked iD symbols after the author names, simply insert \orcidA{}, \orcidB{}, \orcidC{} etc. at the end of the respective author information fields.

## Working example

Here is a simple working example. The resulting pdf is provided for download here.

%------------------------------------------------------------------------------
% Example file
%------------------------------------------------------------------------------

\documentclass{amsart}

\usepackage{lipsum} % To generate some text for the article via \lipsum

%------------------------------------------------------------------------------
% Code for ORCID iD
%------------------------------------------------------------------------------
\usepackage{tikz,xcolor,hyperref}

% Make Orcid icon
\definecolor{lime}{HTML}{A6CE39}
\DeclareRobustCommand{\orcidicon}{%
\begin{tikzpicture}
\draw[lime, fill=lime] (0,0)
node[white] {{\fontfamily{qag}\selectfont \tiny ID}};
\draw[white, fill=white] (-0.0625,0.095)
\end{tikzpicture}
\hspace{-2mm}
}

\foreach \x in {A, ..., Z}{%
\expandafter\xdef\csname orcid\x\endcsname{\noexpand\href{https://orcid.org/\csname orcidauthor\x\endcsname}{\noexpand\orcidicon}}
}

% Define the ORCID iD command for each author separately. Here done for two authors.
\newcommand{\orcidauthorA}{0000-0001-5316-8964}
\newcommand{\orcidauthorB}{0000-0002-6963-295X}

\begin{document}

\title{Lorem ipsum dolor sit amet}

% First author
\author[Author One]{Author One\orcidA{}}
% IMPORTANT: specify explicitly the running author name via the option [ ],
% otherwise the ORCID logo will be generated at every occurence of the author name in the pdf file
% at the top of the page. Clearly not what one would like to see.

% Second author
\author[Author Two]{Author Two\orcidB{}}

\maketitle

\begin{abstract}
\lipsum[1] % Generate some random text
\end{abstract}

\section{Lorem ipsum dolor sit amet}

\lipsum % Generate some random text

\end{document}