强制 bibtex 将 doi 排版为大写

强制 bibtex 将 doi 排版为大写

我的问题大致与这个。如何强制bibtex将下面的单词“DOI”格式化为大写?

在此处输入图片描述

\documentclass{article}

\begin{filecontents*}{bib.bib}
@article{milner92,
 author = {Robin Milner and Joachim Parrow and David Walker},
 title = {A Calculus of Mobile Processes, {I} and {II}},
 journal = {Inf. Comput.},
 volume = {100},
 number = {1},
 pages = {1--77},
 year = {1992},
 doi = {10.1016/0890-5401(92)90009-5},
}
\end{filecontents*}

\begin{document}
\cite{milner92}

\bibliographystyle{plainnat}
\bibliography{bib.bib}

\end{document}

DeclareFieldFormat中提到的解决先前的问题与此似乎不相关(大概是特定于biblatex)。

答案1

\documentclass{article}

\begin{filecontents*}{bib.bib}
@article{milner92,
 author = {Robin Milner and Joachim Parrow and David Walker},
 title = {A Calculus of Mobile Processes, {I} and {II}},
 journal = {Inf. Comput.},
 volume = {100},
 number = {1},
 pages = {1--77},
 year = {1992},
 doi = {10.1016/0890-5401(92)90009-5},
}
\end{filecontents*}

\expandafter\ifcsname urlstyle\endcsname
  \providecommand{\doi}{DOI: \begingroup \urlstyle{rm}\Url}\else
  \providecommand{\doi}[1]{DOI: #1}%
  \fi

\begin{document}
\cite{milner92}

\bibliographystyle{plainnat}
\bibliography{bib}

\end{document}

答案2

plainnat使用宏\doi来排版 DOI。如果未定义宏,它将使用以下替换定义

\providecommand{\url}[1]{\texttt{#1}}
\expandafter\ifx\csname urlstyle\endcsname\relax
  \providecommand{\doi}[1]{doi: #1}\else
  \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi

假设你加载urlhyperref,你可以采取定义的分支并继续

\documentclass{article}

\usepackage{natbib}

\usepackage{url}
\newcommand{\doi}{\textsc{doi}: \begingroup \urlstyle{rm}\Url}

\begin{filecontents*}{\jobname.bib}
@article{milner92,
 author  = {Robin Milner and Joachim Parrow and David Walker},
 title   = {A Calculus of Mobile Processes, {I} and {II}},
 journal = {Inf. Comput.},
 volume  = {100},
 number  = {1},
 pages   = {1--77},
 year    = {1992},
 doi     = {10.1016/0890-5401(92)90009-5},
}
\end{filecontents*}

\begin{document}
\cite{milner92}

\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}

Robin Milner、Joachim Parrow 和 David Walker。移动过程演算 I 和 II。信息计算,100(1):1–77,1992 年。DOI:10.1016/0890-5401(92)90009-5。

我使用小写字母而不是全部大写字母,但当然可以轻松更改。

相关内容