我正在使用 RSC 参考样式来编写我的硕士论文的参考书目。我想将我的每个参考书目项目与其 doi 超链接起来,这样如果我单击参考文献,它就会将我引导到其外部 doi 链接。但我不想显示参考文献的 doi。
我正在使用natbib
包,我的参考书目文件是.bib
文件。我正在使用 TeXmaker。我对 LateX 非常陌生,根据互联网上的一些研究,我知道我必须修改文件rsc.bst
。我试过了,但参考书目没有变化。如果有人能帮我解决这个问题,我将不胜感激。您可以下载rsc.bst
和.bib
从这里。
以下是参考书目的最小工作示例。
\documentclass[11pt,b5paper,twoside,openright]{report}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage[square,numbers,sort&compress]{natbib}
\usepackage{mathtools}
\usepackage{lipsum}
\usepackage{verbatim}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
urlcolor=blue, % color of external links
linkcolor=black, % color of toc, list of figs etc.
citecolor=blue, % color of links to bibliography
}
\begin{document}
\phantomsection
\addcontentsline{toc}{chapter}{bibliography} % bibliography in table of contents
This is rsc \cite{RN8423} reference style \cite{RN8437}.
\bibliographystyle{rsc}
\bibliography{thesis_bib}
\end{document}
补充评论:
实际上,我之所以使用rsc
样式是因为我的参考文献,标题中有很多化学公式或名称。所以我不想花太多时间通过下标或上标文本来纠正它们。我愿意使用任何其他隐藏标题字段的样式。此外,我愿意切换到biblatex
...
答案1
因为您提到您愿意改变,biblatex
请稍后再查看 MWE。
对于biblatex
定义自己的样式,与您使用的类似的rsc.bst
是chem-rsc
,最好的是使用biber
而不是您使用的bibtex
。以下代码可满足您的需要(包filecontents
仅用于将bib文件和tex代码合并到一个可编译代码中;包csquotes
是必需的biblatex
,并\jobname.bib
命名使用创建的bib文件filecontents
):
\usepackage{csquotes}
\usepackage[%
backend=biber, % <====================================================
doi=false, % show no doi in the bibliography <====================
url=false,
isbn=false,
style=chem-rsc % <====================================================
]{biblatex}
\addbibresource{\jobname.bib} % Use bib file created with filecontents
以下代码构建了应显示的链接。根据给定的输入,它显示 doi,如果 doi 不可用则显示 url,如果没有可用的 url 则显示 isbn 等:
\newbibmacro{string+doiurlisbn}[1]{%
\iffieldundef{doi}{%
\iffieldundef{url}{%
\iffieldundef{isbn}{%
\iffieldundef{issn}{%
#1%
}{%
\href{http://books.google.com/books?vid=ISSN\thefield{issn}}{#1}%
}%
}{%
\href{http://books.google.com/books?vid=ISBN\thefield{isbn}}{#1}%
}%
}{%
\href{\thefield{url}}{#1}%
}%
}{%
\href{http://dx.doi.org/\thefield{doi}}{#1}%
}%
}
以下代码定义了标题或者期刊名称变得可点击并显示给定的 doi,或者...
\DeclareFieldFormat{title}{\usebibmacro{string+doiurlisbn}{\mkbibemph{#1}}}
\DeclareFieldFormat{journaltitle}{\usebibmacro{string+doiurlisbn}{\mkbibemph{#1}}}
\DeclareFieldFormat[article,incollection]{title}%
{\usebibmacro{string+doiurlisbn}{\mkbibquote{#1}}}
如果您想要更改两个或多个作者之间的符号以及最后一位作者之后的符号,请参见以下代码并根据需要进行更改:
\renewcommand*{\multinamedelim}{\addcomma\space} % \addand
\renewcommand*{\finalnamedelim}{\addcomma\space} % \addpunct
因为将 doi 链接到完整的印刷 bib 项目并不容易,所以我只链接了给定示例的标题或期刊名称。
使用以下完整的 MWE
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{RN8437,
author = {Garrett, C. G. B. and Brattain, W. H.},
title = {Physical theory of semiconductor surfaces},
journal = {Physical Review},
volume = {99},
number = {2},
pages = {376-387},
ISSN = {0031-899X},
DOI = {10.1103/PhysRev.99.376},
year = {1955},
type = {Journal Article},
}
@book{RN8423,
author = {Madou, Marc J. and Morrison, S. Roy},
title = {Chemical sensing with solid state devices},
publisher = {Academic Press},
address = {San Diego},
series = {Chemical sensing with solid state devices},
ISBN = {978-0-12-464965-1},
DOI = {10.1016/B978-0-12-464965-1.50006-5},
url = {http://www.sciencedirect.com/science/article/pii/B9780124649651500065},
year = {1989},
type = {Book},
}
\end{filecontents*}
\documentclass[11pt,b5paper,twoside,openright]{report}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{csquotes}
\usepackage[%
backend=biber, % <====================================================
doi=false,
url=false,
isbn=false,
style=chem-rsc % <====================================================
]{biblatex}
\addbibresource{\jobname.bib}
\newbibmacro{string+doiurlisbn}[1]{%
\iffieldundef{doi}{%
\iffieldundef{url}{%
\iffieldundef{isbn}{%
\iffieldundef{issn}{%
#1%
}{%
\href{http://books.google.com/books?vid=ISSN\thefield{issn}}{#1}%
}%
}{%
\href{http://books.google.com/books?vid=ISBN\thefield{isbn}}{#1}%
}%
}{%
\href{\thefield{url}}{#1}%
}%
}{%
\href{http://dx.doi.org/\thefield{doi}}{#1}%
}%
}
%\DeclareFieldFormat{default}{\usebibmacro{string+doiurlisbn}{#1}}
\DeclareFieldFormat{title}{\usebibmacro{string+doiurlisbn}{\mkbibemph{#1}}}
\DeclareFieldFormat{journaltitle}{\usebibmacro{string+doiurlisbn}{\mkbibemph{#1}}}
\DeclareFieldFormat[article,incollection]{title}%
{\usebibmacro{string+doiurlisbn}{\mkbibquote{#1}}}
\renewcommand*{\multinamedelim}{\addcomma\space} % \addand
\renewcommand*{\finalnamedelim}{\addcomma\space} % \addpunct
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
urlcolor=blue, % color of external links
linkcolor=black, % color of toc, list of figs etc.
citecolor=blue, % color of links to bibliography
}
\begin{document}
\phantomsection
\addcontentsline{toc}{chapter}{bibliography} % bibliography in table of contents
This is rsc \cite{RN8423} reference style \cite{RN8437}.
%\nocite{*} % to test the complete bib file
\printbibliography
\end{document}
我得到以下结果:
请根据需要更改分隔符。