# authblk with protected commands and pdflatex

When trying to use this answer to add a linked image to an author with the authblk package, somehow all the following text is shifted, with pdfLaTeX:

\documentclass{scrartcl}
\usepackage{scalerel}
\usepackage{authblk}
\usepackage{tikz}
\usetikzlibrary{svg.path}

\definecolor{orcidlogocol}{HTML}{A6CE39}
\tikzset{
blaaa/.pic={
\fill[orcidlogocol] svg{M256,128c0,70.7-57.3,128-128,128C57.3,256,0,198.7,0,128C0,57.3,57.3,0,128,0C198.7,0,256,57.3,256,128z};
\fill[white] svg{M86.3,186.2H70.9V79.1h15.4v48.4V186.2z}
svg{M108.9,79.1h41.6c39.6,0,57,28.3,57,53.6c0,27.5-21.5,53.6-56.8,53.6h-41.8V79.1z M124.3,172.4h24.5c34.9,0,42.9-26.5,42.9-39.7c0-21.5-13.7-39.7-43.7-39.7h-23.7V172.4z}
svg{M88.7,56.8c0,5.5-4.5,10.1-10.1,10.1c-5.6,0-10.1-4.6-10.1-10.1c0-5.6,4.5-10.1,10.1-10.1C84.2,46.7,88.7,51.3,88.7,56.8z};
}
x}

\newcommand\orcidicon[1]{\href{https://orcid.org/#1}{\mbox{\scalerel*{
\begin{tikzpicture}[yscale=-1,transform shape]
\pic{blaaa};
\end{tikzpicture}
}{|}}}}

\usepackage{hyperref} %<--- Load after everything else

\begin{document}

\title{Title goes here}
\author[1]{Rincewind \protect\orcidicon{8000-0000-0000-0000}\,, Unseen University}
\affil[1]{\small rw@unseen.edu}

\maketitle

\end{document}


Is there a way to combine authblk with images inside the author macros? Or is there another package to have authors with arbitrary footnotes/affiliations? Note that this problem seem to happen with pdfLaTeX only, not with XeLaTeX (there's no hyperlink there though).

A fix with overlay:

\documentclass{scrartcl}
\usepackage{scalerel}
\usepackage{authblk}
\usepackage{tikz}
\usetikzlibrary{svg.path,calc}

\definecolor{orcidlogocol}{HTML}{A6CE39}
\tikzset{
blaaa/.pic={
\fill[orcidlogocol] svg{M256,128c0,70.7-57.3,128-128,128C57.3,256,0,198.7,0,128C0,57.3,57.3,0,128,0C198.7,0,256,57.3,256,128z};
\fill[white] svg{M86.3,186.2H70.9V79.1h15.4v48.4V186.2z}
svg{M108.9,79.1h41.6c39.6,0,57,28.3,57,53.6c0,27.5-21.5,53.6-56.8,53.6h-41.8V79.1z M124.3,172.4h24.5c34.9,0,42.9-26.5,42.9-39.7c0-21.5-13.7-39.7-43.7-39.7h-23.7V172.4z}
svg{M88.7,56.8c0,5.5-4.5,10.1-10.1,10.1c-5.6,0-10.1-4.6-10.1-10.1c0-5.6,4.5-10.1,10.1-10.1C84.2,46.7,88.7,51.3,88.7,56.8z};
}
x}

\newcommand\orcidicon[1]{\href{https://orcid.org/#1}{\mbox{
\begin{tikzpicture}[ overlay,remember picture]
\coordinate (A);
\coordinate(B) at ($(A)-(7pt,5pt)$);
\end{tikzpicture}
\begin{tikzpicture}[overlay,remember picture,yscale=0.05,xscale=0.05,transform shape]
\pic at (B) {blaaa};
\end{tikzpicture}
}{|}}}

\usepackage{hyperref} %<--- Load after everything else

\begin{document}

\title{Title goes here}
\author[1]{Rincewind \protect\orcidicon{8000-0000-0000-0000}\,, Unseen University}
\affil[1]{\small rw@unseen.edu}

\maketitle

\end{document}


• Hi, your example still fails for me, so, trying to find the reason, I found that it works with XeLaTeX. With that information, I tried my own example with XeLaTeX., and it works! With pdfLaTeX, I get my garbled first result. – quazgar Oct 12 '18 at 7:46
• @quazgar Just an information... I had your original post's problem on sharelatex and solve it (on share latex) like this... I used pdflatex in both. (I mean overleaf v2) – koleygr Oct 13 '18 at 8:03
• You are right, it works. Also works here now, maybe I made a copy&paste mistake at first. Thanks for the solution! – quazgar Oct 16 '18 at 12:21
• Welcome @quazgar. Happy texing. I don't remember clearly now, but I think that the copy paste error was mine before the edit... – koleygr Oct 16 '18 at 12:36