I've been using the code given in this answer to tune the authoryear citation style to my needs. More specifically, I'm trying to have references in the form (First Author, year), with everything within parentheses linking to the bibliography.

Unfortunately, the link created with this method doesn't actually work. Consider the following MWE:




    author = {Cubitt, T. and Montanaro, A. and Piddock, S.},
    journal = {arXiv:1701.05182},
    title = {Universal Quantum Hamiltonians},
    url = {https://arxiv.org/abs/1701.05182},
    year = {2017}

% \renewcommand{\cite}{\mycitep}

% -------------- START AUTHORYEAR FIX

\newcommand{\multicite}[1]{% taken from egreg, see link

    \ifthenelse{\equal{#1}{aa}}                                                                  % if nargin == 1
      {(\multicite{#3})}                                                                         %    \citep{key(s)}
      {\ifthenelse{\equal{#2}{bb}}                                                               % elseif nargin == 2
          {(\hyperlink{cite.#3}{\citeauthor{#3}\black{,~}\citeyear{#3}\black{,~}#1})}            %    \citep[pg]{key}
          {\ifthenelse{\equal{#1}{}}                                                             % elseif #1 = []
              {(\hyperlink{cite.#3}{\citeauthor{#3}\black{,~}\citeyear{#3}\black{,~}#2})}        %    \citep[][pg]{key}
              {\ifthenelse{\equal{#2}{}}                                                         % elseif #2 == []
                  {(#1~\multicite{#3})}                                                          %    \citep[eg][]{key(s)}
                  %                                                                              % else
                  {(#1~\hyperlink{cite.#3}{\citeauthor{#3}\black{,~}\citeyear{#3}\black{,~}#2})} %    \citep[eg][pg]{key}}
% ------------------- END AUTHORYEAR FIX



This link works~\citep{cubitt2017universal}, but this doesn't~\mycitep{cubitt2017universal}.


This gives

enter image description here

which would be great if not for the fact that the link produced by \mycitep doesn't work: clicking on it does nothing, whereas the same reference created with \citep correctly sends me to the relevant bit in the bibliography.

How can I fix this? (another way to have the same type of reference style with working links would be equally good for me)

Browse other questions tagged or ask your own question.