Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to include a link to my publication, using biblatex in a CV. But instead of the whole url, I just want a symbol which can be clicked.

My MWE is as follows:

\documentclass[11pt,a4paper]{moderncv}

% moderncv themes
\moderncvtheme[blue]{classic} 

% character encoding
\usepackage[utf8]{inputenc}                   
\usepackage{bbding}

% personal data
\firstname{John}
\familyname{Doe}
\title{}               
\address{somewhere}    

\email{some.thing@gmail.com}                      
\definecolor{linkcolour}{rgb}{0,0.2,0.6}            % hyperlinks setup
\AfterPreamble{\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour, linkcolor=linkcolour}}

\usepackage{filecontents}
\begin{filecontents}{pubs.bib}
@article{cazier_whole-genome_2014,
    title = {My publication},
    volume = {5},
    url = {http://Somewebsite.html},        journal = {Nature},
    author = {Doe, John. and Smith, John},
    month = apr,
    year = {2014},
}
\end{filecontents}

\AfterPreamble{
\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour, linkcolor=linkcolour}
}

\usepackage[backend=biber, doi=false, isbn=false, style=nature, maxbibnames=20, defernumbers=true]{biblatex}

\addbibresource{pubs.bib}



\begin{document}
\maketitle
\nocite{*}
\printbibliography[title={Publications}, type=article, resetnumbers=true]

\end{document}

What I have tried:

\AfterPreamble{
\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour, linkcolor=linkcolour}
\let\orighref\href
\renewcommand{\href}[2]{\orighref{#1}{\ArrowBoldUpRight}} %I found this code on tex.SE
}

What I get: result

As you can see, I get the little arrow replacing the email link. Whereas I want the url in the bibliography replaced with the arrow, without affecting the email link.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You should change the anything to do with the bibliography immediately before the bibliography, otherwise it would affect everything following the preamble as in your case.

enter image description here

\documentclass[11pt,a4paper]{moderncv}

% moderncv themes
\moderncvtheme[blue]{classic} 

% character encoding
\usepackage[utf8]{inputenc}                   
\usepackage{bbding}

% personal data
\firstname{John}
\familyname{Doe}
\title{}               
\address{somewhere}    

\email{some.thing@gmail.com}                      
\definecolor{linkcolour}{rgb}{0,0.2,0.6}            % hyperlinks setup
\AfterPreamble{\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour, linkcolor=linkcolour}}

\usepackage{filecontents}
\begin{filecontents}{pubs.bib}
@article{cazier_whole-genome_2014,
    title = {My publication},
    volume = {5},
    url = {http://Somewebsite.html},        journal = {Nature},
    author = {Doe, John. and Smith, John},
    month = apr,
    year = {2014},
}
\end{filecontents}

\usepackage[backend=biber, doi=false, isbn=false, style=nature, maxbibnames=20, defernumbers=true]{biblatex}

\addbibresource{pubs.bib}


\begin{document}
\maketitle
\nocite{*}

\renewcommand{\url}[1]{\href{#1}{\ArrowBoldUpRight}}

\printbibliography[title={Publications}, type=article, resetnumbers=true]

\end{document}

In order to remove the surrounding <..>, replace \renewcommand{\url}[1]{..} above with

\DeclareFieldFormat{url}{%
  \ifhyperref
    {\href{#1}{\ArrowBoldUpRight}}
    {\url{#1}}}

as suggested in It there a way to make URL link in bibliography as one word `Link`?.

enter image description here

share|improve this answer
    
Thanks, this is quite helpful. But is there a way to remove the <>? I have tried another method from here: tex.stackexchange.com/questions/165656/… \DefineBibliographyStrings{english}{% url = {\P}, } \DeclareFieldFormat{url}{% \ifhyperref {\href{#1}{\bibstring{url}}} {\url{#1}}} but if I replace \P with \ArrowBoldUpRight it doesn't work... –  srao Jun 13 at 22:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.