biblatex:参考文献部分之外的可点击 doi

biblatex:参考文献部分之外的可点击 doi

有没有办法将文本中条目的 doi 作为超链接插入?

我试过了,\citefield{<key>}{doi}但结果不是超链接。我也试过在\url和中使用上述命令\href,但结果不是我想要的。

提前致谢

PS 以下是 MWE:

\documentclass{article}%twoside
\usepackage{filecontents}
\begin{filecontents}{mybib.bib}
@Article{Chen-2015,
  author       = {Chen, Yi and Moore, Katie L. and Miller, Anthony J. and {McGrath}, Steve P. and Ma, Jian Feng and Zhao, Fang-Jie},
  title        = {The role of nodes in arsenic storage and distribution in rice},
  volume       = {66},
  pages        = {3717--3724},
  doi          = {10.1093/jxb/erv164},
  journaltitle = {Journal of Experimental Botany},
  url          = {http://jxb.oxfordjournals.org/content/66/13/3717},
}

@Article{Sasaki-2015,
  author       = {Sasaki, Akimasa and Yamaji, Naoki and Mitani-Ueno, Namiki and Kashino, Miho and Ma, Jian Feng},
  title        = {A node-localized transporter {OsZIP}3 is responsible for the preferential distribution of Zn to developing tissues in rice},
  volume       = {84},
  pages        = {374--384},
  doi          = {10.1111/tpj.13005},
  journaltitle = {The Plant Journal},
  url          = {http://onlinelibrary.wiley.com/doi/10.1111/tpj.13005/abstract},
}
\end{filecontents}

\usepackage{biblatex}
\usepackage{hyperref}
\bibliography{mybib}
\begin{document}
\citefield{Chen-2015}{doi}\\ %doi as it should be printed but not an hyperlink
\href{http://dx.doi.org/\citefield{Chen-2015}{doi}}{\citefield{Chen-2015}{doi}}\\ % Doesn't work
\citefield{Sasaki-2015}{doi}\\ 
\printbibliography
\end{document}

答案1

例如,您可以mydoi使用以下格式定义新的字段格式:

\DeclareFieldFormat{mydoi}{%
% \mkbibacro{DOI}\addcolon\space
  \ifhyperref
    {\href{http://dx.doi.org/#1}{\nolinkurl{#1}}}
    {\nolinkurl{#1}}%
}

这样您就可以摆脱前导DOI:(参见上面代码中的注释行...)。现在您可以使用这种新的字段格式来获得我认为您想要的结果。

请参阅以下 MWE:

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Article{Chen-2015,
  author       = {Chen, Yi and Moore, Katie L. and Miller, Anthony J. 
                  and {McGrath}, Steve P. and Ma, Jian Feng and Zhao, Fang-Jie},
  title        = {The role of nodes in arsenic storage and distribution in rice},
  volume       = {66},
  pages        = {3717--3724},
  doi          = {10.1093/jxb/erv164},
  journaltitle = {Journal of Experimental Botany},
  url          = {http://jxb.oxfordjournals.org/content/66/13/3717},
}
@Article{Sasaki-2015,
  author       = {Sasaki, Akimasa and Yamaji, Naoki and Mitani-Ueno, Namiki 
                  and Kashino, Miho and Ma, Jian Feng},
  title        = {A node-localized transporter {OsZIP}3 is responsible 
                  for the preferential distribution of Zn to developing 
                  tissues in rice},
  volume       = {84},
  pages        = {374--384},
  doi          = {10.1111/tpj.13005},
  journaltitle = {The Plant Journal},
  url          = {http://onlinelibrary.wiley.com/doi/10.1111/tpj.13005/abstract},
}
\end{filecontents}


\documentclass{article}%twoside

\usepackage{csquotes}
\usepackage{biblatex}
\addbibresource{\jobname.bib}

\usepackage{hyperref}


\DeclareFieldFormat{mydoi}{%
% \mkbibacro{DOI}\addcolon\space
  \ifhyperref
    {\href{http://dx.doi.org/#1}{\nolinkurl{#1}}}
    {\nolinkurl{#1}}%
}


\begin{document}
\citefield{Chen-2015}[doi]{doi}  

\citefield{Chen-2015}[mydoi]{doi} % <===================================

\citefield{Chen-2015}[citeurl]{url} % <=================================

\citefield{Chen-2015}[url]{url}

\citefield{Sasaki-2015}[mydoi]{doi} % <=================================

\cite{Chen-2015} \cite{Sasaki-2015}
\printbibliography
\end{document}

结果如下:

在此处输入图片描述

我用 为您标记了相关的代码行<==============

相关内容