我的问题大致与这个。如何强制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
或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}
我使用小写字母而不是全部大写字母,但当然可以轻松更改。