[Tex/LaTex] \citefield link to bibliography (hyperref & backref)

back-referencingbiblatexhyperref

I would like to know if there is a way to get links and backref links on a \citefield command. For example, I want to cite only the title of a reference:

\citefield{ref}{title} 

or any other field, and get the hyperlink to the reference and the corresponding backref link.

EDIT:

MWE

\documentclass{article}
\usepackage[backref=true]{biblatex}
\usepackage{hyperref}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
@misc{B02,
author = {Buthor, B.},
year = {2002},
title = {Bravo}, 
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

Some text \cite{A01,B02}.

\newpage

In this cite \citefield{A01}{title} I do not get any link

\clearpage

Some more text \cite{A01}.

\printbibliography

\end{document}

Best Answer

As it is another approach on a lower level, I'll write it as another answer.

You also can patch the \citefield-command using the xpatch-package. Therefore you just have find its underlying macro which will be invoked by it: \blx@cite@citefield

You won't be able to use \citefield{author} as you wanted, because its internally not handled as a field but as a name, so you also had to patch \citename, if you want to use \citename{key}{author}. The third command in this row is \citelist which you also may have to patch. See biblatex-manual, 3.7.7 Low-level Commands.

My example contains patches for all three, but \citename and \citelist only in comments and untested. (It doesn't make much sense to me to use them in this way.)

If you really want to have ONE command like \citeany{key}{field/name/list}, I guess, you had to implement a new macro with an internal switch which leads to the macros \citefield, \citekey, \citelist depending on the given field/name/list. But this is rather more difficult, as you have to deal with the 5 optional parameters from the cite-commands. I don't know how to do this.

\documentclass{article}
\usepackage[backref=true,backend=biber]{biblatex}
\usepackage{hyperref}
\usepackage{filecontents}
\usepackage{silence}\WarningFilter{latex}{Overwriting file}

\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
url = {http://www.something.com}
}
@misc{B02,
author = {Buthor, B.},
year = {2002},
title = {Bravo}, 
}
\end{filecontents}

\addbibresource{\jobname.bib}

\usepackage{xpatch}
\xpatchcmd{\blx@cite@citefield}{\printfield[#4]{#5}}{\printtext[bibhyperref]{\printfield[#4]{#5}}}{}{}%patch \citefield
% \xpatchcmd{\blx@cite@citename}{\printnames[#4]{#5}}{\printtext[bibhyperref]{\printnames[#4]{#5}}}{}{}%patch \citename
% \xpatchcmd{\blx@cite@citelist}{\printlist[#4]{#5}}{\printtext[bibhyperref]{\printlist[#4]{#5}}}{}{}%patch \citelist


\begin{document}

Citefield A01 title: \citefield{A01}{title}.

\clearpage
Citefield B02 title: \citefield{B02}{title}.

Citefield A01 url: \citefield{A01}{url}.

\printbibliography

\end{document}