删除格式化的书目条目中的“doi:”前缀字符串

删除格式化的书目条目中的“doi:”前缀字符串

我想删除参考文献中的“doi:”前缀字符串

\documentclass[1p]{elsarticle}
\usepackage{lineno,hyperref}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{graphics}
\usepackage{natbib}
\usepackage{hyperref}
\usepackage{url}

\biboptions{numbers,sort&compress}

\modulolinenumbers[5]

\journal{Journal of Sound and Vibration}

\bibliographystyle{elsarticle-num}
\bibliography{myrefer}
@article{tichy1983active,
  title={Active noise cancellation in ducts},
  author={Tichy, Jiri and Warnaka, Glenn E and Poole, Lynn A},
  journal={The Journal of the Acoustical Society of America},
  volume={74},
  number={S1},
  pages={S25--S25},
  year={1983},
  publisher={Acoustical Society of America},
  doi={https://doi.org/10.1121/1.2020873}
}

我怎样才能删除“doi:”

我只想打印https://doi.org/10.1121/1.2020873

答案1

我可以想到两种方法来实现您的格式化目标。

  1. 更改字段

     doi={https://doi.org/10.1121/1.2020873}
    

     note={\url{https://doi.org/10.1121/1.2020873}}
    

    如果您的参考书目中包含多个带有doi字段的条目,这可能会变得乏味。

  2. 修改文件副本elsarticle-num.bst,如下:

  • 在您的 TeX 发行版中找到该文件elsarticle-num.bst。复制此文件并将副本命名为 。elsarticle-num-nodoiprefix.bst(您可以自由地想出其他名称...)

  • 在文本编辑器中打开elsarticle-num-nodoiprefix.bst。你用来编辑 tex 文件的程序就可以了。

  • 在 中elsarticle-num-nodoiprefix.bst找到以下行(可能是第 64 行):

     "doi:" 'doiprefix :=      % text prefix printed before DOI ref
    

    将其更改为

     "" 'doiprefix :=          % no text prefix printed before DOI ref
    
  • 将该文件保存elsarticle-num-nodoiprefix.bst在主 tex 文件所在的目录中。

  • 在主 tex 文件中,更改指令

    \bibliographystyle{elsarticle-num}
    

    \bibliographystyle{elsarticle-num-nodoiprefix}
    

    并执行完整的重新编译循环 - LateX、BibTeX 和 LaTeX 两次 - 以完全传播所有更改。

祝您 BibTeX 愉快。


以下是 MWE(最小工作示例),说明了使用第二种方法的结果。(第一种方法产生相同的输出。)请注意,我已设置doi={10.1121/1.2020873}为软件自动插入https://doi.org/前缀。

在此处输入图片描述

\documentclass[1p]{elsarticle}
\begin{filecontents}[overwrite]{myrefer.bib}
@article{tichy1983active,
  title={Active noise cancellation in ducts},
  author={Tichy, Jiri and Warnaka, Glenn E. and Poole, Lynn A.},
  journal={The Journal of the Acoustical Society of America},
  volume={74},
  number={S1},
  pages={S25--S25},
  year={1983},
  publisher={Acoustical Society of America},
  doi={10.1121/1.2020873}
}
\end{filecontents}

\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{graphicx}
%\usepackage{natbib} % <- this package is loaded automatically by elsarticle class
\usepackage{xurl}    % <-- use xurl, not url
\usepackage{lineno}
\usepackage{hyperref} % <-- load hyperref just once, and _last_
\biboptions{numbers,sort&compress}
\modulolinenumbers[5]
\hypersetup{colorlinks,allcolors=blue}

\journal{Journal of Sound and Vibration}

\bibliographystyle{elsarticle-num-nodoiprefix}

\begin{document}
\cite{tichy1983active}
\bibliography{myrefer}
\end{document}

相关内容