create a hyperlink by using the url stored in the bibliography reference?

im wondering if i can create a hyperlink that automaticaly uses the bib file stored tag 'url' somehow? Just to prevent mistakes in linking to a reference and to a websource in the same text like:

mwe:

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=nature, url=true]{biblatex}
\usepackage{hyperref}
\begin{filecontents}{\jobname.bib}
@online{UseCase20,
title = {{Use-Case 2.0 ebook}},
journal = {Ivar Jacobson International},
year = {2014},
month = {Jul},
note = {[Online; accessed 25. Dec. 2018]},
url = {https://www.ivarjacobson.com/publications/white-papers/use-case-ebook}
}
\end{filecontents}

\begin{document}
\href{https://www.ivarjacobson.com/publications/white-papers/use-case-ebook}{sometext} \footcite{UseCase20}
\printbibliography
\end{document}


i wold like to something like this work:

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=nature, url=true]{biblatex}
\usepackage{hyperref}
\begin{filecontents}{\jobname.bib}
@online{UseCase20,
title = {{Use-Case 2.0 ebook}},
journal = {Ivar Jacobson International},
year = {2014},
month = {Jul},
note = {[Online; accessed 25. Dec. 2018]},
url = {https://www.ivarjacobson.com/publications/white-papers/use-case-ebook}
}
\end{filecontents}

\begin{document}
\href{\citeurl{UseCase20}}{sometext} \footcite{UseCase20}
\printbibliography
\end{document}


but unfortunately this breaks at l.18;

\href{\citeurl{UseCase20}}{sometext}

EDIT:

MWE with all tests:

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=nature, url=true]{biblatex}
\usepackage{hyperref}
\begin{filecontents}{\jobname.bib}
@online{UseCase20,
title = {{Use-Case 2.0 ebook}},
journal = {Ivar Jacobson International},
year = {2014},
month = {Jul},
note = {[Online; accessed 25. Dec. 2018]},
url = {https://www.ivarjacobson.com/publications/white-papers/use-case-ebook}
}
\end{filecontents}
%https://tex.stackexchange.com/a/413372/118709
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\iffieldundef{postnote}
{\href{\thefield{url}}{\printfield{title}}}
{\href{\thefield{url}}{\thefield{postnote}}}}
{\multicitedelim}
{}
% https://tex.stackexchange.com/a/412927/118709
\DeclareCiteCommand{\citeqrurl}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\qrcode{\thefield{url}}}
{\multicitedelim}
{\usebibmacro{postnote}}
% https://tex.stackexchange.com/a/413519/118709
\DeclareCiteCommand{\geturl}
{\boolfalse{citetracker}\boolfalse{pagetracker}}
{\iffieldundef{postnote}
{\xdef\biburl{\thefield{url}}}
{%
\edef\geturlTmpCmd{\csfield{postnote}}%
\expandafter\xdef\geturlTmpCmd{\thefield{url}}%
}%
}
{}
{}
\begin{document}
~\\
~\\
\citeqrurl{sometext}{UseCase20}\footcite{UseCase20}\\
~\\
\geturl{UseCase20}
%The \href{\biburl}{UseCase}\footcite{UseCase20}\\.
\printbibliography
\end{document}

• \citeurl can't be used as argument to \href, you need to define your own macro, cf. tex.stackexchange.com/q/413365/35864 and tex.stackexchange.com/q/412924/35864. – moewe Dec 25 '18 at 9:01
• see above i tested all 3 types of macro but none makes a klickable link to the url... the last test even breaks, so its commented. – novski Dec 25 '18 at 9:19
• The correct syntax for \citelink would have been \citelink[sometext]{UseCase20}. \citeqrurl as implemented in the linked answer was intended for a different use case and would have to be tweaked for yours. The last solution worked for me as well (even though I find it much less elegant for this use case). – moewe Dec 25 '18 at 9:39

\citeurl does not return the URL of the entry in question (in an expandable way), instead it is meant to print the formatted URL. That means that it can't be used as the URI argument for \href. If you want to be able to \href the URL of an entry to arbitrary text, the simplest way is to create a new \cite... macro. Since \cite... macros have a fixed argument structure the one below works as follows

\citehrefurl[<arbitrary text that is going ot be linked>]{<entrykey>}


You could create a new command with arbitrary arguments. Usually I strongly advise against creating new commands from \cite... commands via \newcommand, but in this case we can make an exception.

\documentclass{article}
\usepackage[style=nature, url=true]{biblatex}
\usepackage{hyperref}

\DeclareCiteCommand{\citehrefurl}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}}
{\iffieldundef{url}
{\PackageWarning{biblatex}
{The entry \thefield{entrykey} has no URL.\MessageBreak
\printfield{postnote}}
{\href{\thefield{url}}
{\iffieldundef{postnote}
{\PackageWarning{biblatex}
{Text argument missing,\MessageBreak
using the title for entry\MessageBreak
\thefield{entrykey}}%
\printfield[citetitle]{labeltitle}}
{\printfield{postnote}}}}}
{}
{}

\newcommand*{\citehrefurlwrap}[2]{\citehrefurl[#2]{#1}}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{UseCase20,
title   = {Use-Case 2.0 ebook},
author  = {Ivar Jacobson and Ian Spence and Kurt Bittner},
date    = {2011-12},
url     = {https://www.ivarjacobson.com/publications/white-papers/use-case-ebook},
urldate = {2018-12-25},
}
\end{filecontents}

\begin{document}
\citehrefurl{UseCase20}

\citehrefurl[some text]{UseCase20}

\citehrefurlwrap{UseCase20}{some other text}

\citeurl{UseCase20}

\href{https://www.ivarjacobson.com/publications/white-papers/use-case-ebook}{sometext}

\printbibliography
\end{document}


Sorry there is no image at the moment. I'm having trouble uploading them. Feel free to add a screenshot of the result if you like.

This is basically a slightly modified version of jakun's \citelink from their answer to How to create a link to a URL provided in a bib file with custom text which was in turn inspired by Create QR-code from citeurl.

• exept the last ordinary \href link none of the above creates a click able link in my case. – novski Dec 25 '18 at 9:44
• @novski What exact result do you get instead? Do note that the url field in your example was faulty: It contained to much whitespace. I fixed that in my code. – moewe Dec 25 '18 at 9:46
• sorry for that. i corrected the mwe. but i copied your mwe from this answer. and i get 3 lines of "UseCase20" and one line "sometext" only "sometext" is clickable... – novski Dec 25 '18 at 9:51
• Take my MWE and compile it in a new, empty folder with LaTeX, Biber, LaTeX, LaTeX. If you get bold UseCase20 as output that means that biblatex failed to resolve the citation. That should have little to do with the macro itself. – moewe Dec 25 '18 at 9:52
• @novski To see that the code above works as intended check out v1.overleaf.com/read/chsgpnfhwhvs. – moewe Dec 25 '18 at 9:54