強制 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

假設您載入urlor hyperref,您可以採用定義的該分支並執行

\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}

羅賓·米爾納、約阿希姆·帕羅和大衛·沃克。移動流程的演算,I 和 II。資訊.計算機,100(1):1–77, 1992。

我使用小型大寫字母而不是全部大寫字母,但這當然可以輕鬆更改。

相關內容