我的問題大致是雙重的這個。如何強制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
假設您載入url
or 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}
我使用小型大寫字母而不是全部大寫字母,但這當然可以輕鬆更改。