如何在 CV(moderncv 类)的参考书目中用符号替换 url 文本?

如何在 CV(moderncv 类)的参考书目中用符号替换 url 文本?

我想在简历中使用 biblatex 包含指向我出版物的链接。但我不想要整个 URL,而想要一个可以点击的符号。

我的MWE如下:

\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{[email protected]}                      
\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}

我已尝试过:

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

我得到的是: result

如您所见,我得到了替换电子邮件链接的小箭头。而我希望用箭头替换参考书目中的网址,而不影响电子邮件链接。

答案1

您应该在参考书目之前立即更改与参考书目相关的任何内容,否则它会影响序言之后的所有内容,就像您的情况一样。

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{[email protected]}                      
\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}

为了删除周围<..>,将\renewcommand{\url}[1]{..}上面的替换为

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

就像建议的那样有没有办法将参考书目中的 URL 链接制作成一个单词“链接”?

enter image description here

相关内容