4

This is what I'm trying to do:

\documentclass[11pt,oneside]{article}
\usepackage{biblatex}
\addbibresource{../main.bib}
\usepackage{hyperref}
\begin{document}
\citeauthor{jeff2018} said in his awesome article
\href{\citeurl{jeff2018}}{\citetitle{jeff2018}} that life is great!
\end{document}

This is what I have in main.bib:

@misc{jeff2018,
  title={Life Is Great},
  author={Lebowski, Jeff},
  year={2018},
  url={http://www.yegor256.com}
}

Can't compile. What is the right way?

yegor256
  • 12,021
  • Please post the contents of the entry with key jeff2018. – Mico Jun 28 '18 at 08:48
  • 1
    @Mico done, posted – yegor256 Jun 28 '18 at 08:59
  • 1
    I was going to suggest that you write \href{\protect\citeurl{jeff2018}}{\citetitle{jeff2018}}. Unfortunately, even though this modification lets LaTeX finish without crashing, it doesn't create the expected output, i.e., the title string )"Life is Great") isn't properly clickable. Hopefully, the maintainers of the hyperref and biblatex packages will provide more helpful answers. – Mico Jun 28 '18 at 09:37
  • 1
    Have a look at https://tex.stackexchange.com/q/430063/35864, https://tex.stackexchange.com/q/413365/35864, https://tex.stackexchange.com/q/412924/35864. \href expects something that more or less expands to a raw URL, but \citeurl already applies lots of formatting to the URL and so can't really be used here. – moewe Jun 28 '18 at 10:01

1 Answers1

1

This is how:

\DeclareCiteCommand{\citea}
  {\boolfalse{citetracker}\boolfalse{pagetracker}\usebibmacro{prenote}}
  {\href{\thefield{url}}{\printnames{labelname}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
yegor256
  • 12,021