在参考文献中包含 DOI 后删除

在参考文献中包含 DOI 后删除

在我将 DOI 添加到参考文献中后,条目 @article 在期刊后显示 [online]。我想将其删除。提前致谢!

输入文件

\documentclass[a4paper,12pt]{article} 
\usepackage[backref=true,backend=biber,style=bath,maxcitenames=2,
            uniquelist=false,sorting=ynt]{biblatex}    
\addbibresource{References.bib}
\usepackage{xpatch}
\xpatchbibmacro{pageref}{parens}{brackets}{}{}
%\usepackage{} etc.
\DefineBibliographyStrings{english}{%
    backrefpage  = {Back to p.}, % for single page number
    backrefpages = {Back to pp.} % for multiple page numbers
}    
\DeclareFieldFormat{doi}{%
        doi\addcolon\space
        \ifhyperref
        {\href{https://doi.org/#1}{\nolinkurl{#1}}}
        {\nolinkurl{#1}}}

\begin{document}
\autocite{ho2015planta}    
\addcontentsline{toc}{section}{References}
\section*{References}
\emergencystretch=1em
\newrefcontext[sorting=nyt]
\printbibliography[heading=none]
\end{document}

输入参考

@article{ho2015planta,
title={\textit{In planta} biocontrol of soilborne Fusarium wilt of banana through a plant endophytic bacterium, \textit{Burkholderia cenocepacia} {869T2}},
author={Ho, Ying Ning and Chiang, Hsing Mei and Chao, Chih Ping and Su, Ching Chung and Hsu, Hui Fang and Guo, Chen tong and Hsieh, Ju Liang and Huang, Chieh Chen},
journal={Plant and {S}oil},
volume={387},
number={1-2},
pages={295--306},
year={2015},
doi={10.1007/s11104-014-2297-0},
publisher={Springer}

}

输出

Ho, YN, Chiang, HM, Chao, CP, Su, CC, Hsu, HF, Guo, Ct, Hsieh, JL 和 Huang, CC, 2015. 通过植物内生细菌 Burkholderia cenocepacia 869T2 对香蕉土传镰刀菌枯萎病进行植物生物防治。植物与土壤[在线的], 387(1-2), 第295-306页。doi: 10.1007/s11104-014-2297-0[返回第 1 页]。

答案1

在线的标记在biblatex-bath由以下宏打印bath.bbx

\newbibmacro*{isonline}{%
  \ifboolexpr{(
      test {\iffieldundef{doi}}
      and
      test {\iffieldundef{url}}
      and
      not test {\ifentrytype{online}}
    ) or
    togl {bbx:onlineshown}
  }{}{%
    \bibstring[\mkbibbrackets]{online}%
    \toggletrue{bbx:onlineshown}}}

在这种情况下,有几种方法可以抑制标记。一种直接的方法是删除该doi字段的测试。但你可以添加更复杂的测试

\documentclass[a4paper,12pt]{article}
\usepackage[backend=biber,
  style=bath,
  sorting=ynt,
  maxcitenames=2,
  uniquelist=false,
  backref=true,
]{biblatex}

\renewbibmacro*{isonline}{%
  \ifboolexpr{(
      test {\iffieldundef{url}}
      and
      not test {\ifentrytype{online}}
    ) or
    togl {bbx:onlineshown}
  }{}{%
    \bibstring[\mkbibbrackets]{online}%
    \toggletrue{bbx:onlineshown}}}

\usepackage{xpatch}
\xpatchbibmacro{pageref}{parens}{brackets}{}{}


\DefineBibliographyStrings{english}{
    backrefpage  = {Back to p\adddot},
    backrefpages = {Back to pp\adddot},
}

\DeclareFieldFormat{doi}{%
  doi\addcolon\space
  \ifhyperref
    {\href{https://doi.org/#1}{\nolinkurl{#1}}}
    {\nolinkurl{#1}}}

\begin{filecontents}{\jobname.bib}
@article{ho2015planta,
  title     = {\textit{In planta} Biocontrol of Soilborne {Fusarium} Wilt
               of Banana Through a Plant Endophytic Bacterium,
               \textit{Burkholderia cenocepacia} {869T2}},
  author    = {Ho, Ying Ning and Chiang, Hsing Mei and Chao, Chih Ping
               and Su, Ching Chung and Hsu, Hui Fang and Guo, Chen tong
               and Hsieh, Ju Liang and Huang, Chieh Chen},
  journal   = {Plant and {S}oil},
  volume    = {387},
  number    = {1-2},
  pages     = {295--306},
  year      = {2015},
  doi       = {10.1007/s11104-014-2297-0},
  publisher = {Springer},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\autocite{ho2015planta}
\emergencystretch=1em
\newrefcontext[sorting=nyt]
\printbibliography[heading=bibintoc]
\end{document}

Ho, YN, Chiang, HM, Chao, CP, Su, CC, Hsu, HF, Guo, Ct, Hsieh, JL 和 Huang, CC, 2015. 通过植物内生细菌 Burkholderia cenocepacia 869T2 对香蕉土传镰刀菌枯萎病进行植物生物防治。植物与土壤,387(1-2),第 295–306 页。doi: 10.1007/s11104-014-2297-0 [返回第 1 页]。

相关内容