我打算向计算物理杂志由 Elsevier 出版。尽管出版商没有明确指定初次提交的参考书目格式要求,但我有兴趣复制该期刊上已发表文章的最终 PDF 的实际参考书目样式。
要求是每个书目项目(即整行条目)都成为可点击的超链接(doi
如果可用则使用该字段,否则使用文件url
中相关键的字段bib
)。
由于我正在使用elsarticle.cls
,因此无法使用。因此需要biblatex
一个基于的解决方案。natbib/bibtex
首先从以下 MWE 开始:
\documentclass[number]{elsarticle}
\begin{document}
\begin{frontmatter}
\title{Dummy document \tnoteref{t1,t2}}
\tnotetext[t1]{Title footnote 1}
\tnotetext[t2]{Title footnote 2}
\author[a]{First Author\fnref{fn1}}
\ead{firstemail_id@insti_1.edu}
\author[b]{Second Author\fnref{fn2}}
\ead{secondemail_id@insti_2.edu}
\address[a]{Address of author with affiliation `a'}
\address[b]{Address of author with affiliation `b'}
\fntext[fn1]{This is a footnote.}
\fntext[fn2]{Another author footnote}
\begin{abstract}
Dummy abstract.
\end{abstract}
% Research highlights
\begin{highlights}
\item Research highlight 1
\item Research highlight 2
\end{highlights}
\begin{keyword}
Some \sep keywords
\end{keyword}
\end{frontmatter}
\section{Introduction}{\label{sec:intro}}
Intro
\section{Next}{\label{sec:blah}}
More blah
\nocite{*} % Temporary placeholder. Comment out after bib file is populated and \cite commands issued
\bibliographystyle{elsarticle-num}
\bibliography{manuscript_references.bib}
\end{document}
答案1
正如我在问题评论中所写,我不一定认为这是提交给爱思唯尔期刊的最佳想法,但只要.bst
稍微修改一下文件就可以做到。
我确信还有其他方法可以实现这一点,但这是我所做的。
elsarticle-num-names.bst
已经有办法将参考文献的某些部分排版为指向 URL 的链接(@misc
带有字段的条目标题url
已经直接链接到 URL),因此我们可以使用此机制并对其进行扩展,以将链接区域扩展到完整的文章,并考虑 DOI。
DOI 的扩展或多或少比较简单。扩展链接区域需要对宏和函数进行一些调整。
elsarticle-num-names.bst
与(v2.1 [2019-04-15],CTAN 上的当前版本)的差异是
--- elsarticle-num.bst 2019-04-05 15:29:24.000000000 +0200
+++ link-elsarticle-num.bst 2020-03-26 21:55:15.423852900 +0100
@@ -114,32 +114,51 @@
}
FUNCTION {setup.inlinelink}
-{ makeinlinelink
- { hrefform #1 = % hypertex
- { "\special {html:<a href=" quote$ * url * quote$ * "> }{" * 'openinlinelink :=
+{
+ doi empty$
+ {
+ url empty$
+ { "" }
+ { url }
+ if$
+ }
+ { doiurl doi * }
+ if$
+ duplicate$ empty$
+ 'pop$
+ {
+ hrefform #1 = % hypertex
+ { "\special {html:<a href=" quote$ * swap$ * quote$ * "> }" * 'openinlinelink :=
"\special {html:</a>}" 'closeinlinelink :=
}
{ hrefform #2 = % hyperref
- { "\href{" url * "}{" * 'openinlinelink :=
+ { "\href{" swap$ * "}{" * 'openinlinelink :=
"}" 'closeinlinelink :=
}
- 'skip$
+ 'pop$
if$ % hrefform #2 =
}
if$ % hrefform #1 =
#0 'makeinlinelink :=
}
- 'skip$
- if$ % makeinlinelink
+ if$
}
-FUNCTION {add.inlinelink}
+FUNCTION {add.openinlinelink}
{ openinlinelink empty$
'skip$
- { openinlinelink swap$ * closeinlinelink *
+ { openinlinelink write$
"" 'openinlinelink :=
}
if$
}
+FUNCTION {add.closeinlinelink}
+{ closeinlinelink empty$
+ 'skip$
+ { closeinlinelink write$
+ "" 'closeinlinelink :=
+ }
+ if$
+}
FUNCTION {output.nonnull}
{ % Save the thing we've been asked to output
's :=
@@ -157,7 +176,6 @@
% Write out what's currently at the top of the stack, using the
% original output.nonnull function.
s
- add.inlinelink
output.nonnull.original % invoke the original output.nonnull
}
{ % Still in brackets. Add open-bracket or (continuation) comma, add the
@@ -203,12 +221,6 @@
if$
}
-FUNCTION {fin.entry.original}
-{ add.period$
- write$
- newline$
-}
-
FUNCTION {new.block}
{ output.state before.all =
'skip$
@@ -472,7 +484,7 @@
FUNCTION {write.url}
{ url empty$
{ skip$ }
- { "\newline\urlprefix\url{" url * "}" * write$ newline$ }
+ { "\newline\urlprefix\nolinkurl{" url * "}" * write$ newline$ }
if$
}
@@ -1032,13 +1044,11 @@
}
FUNCTION {make.href.hypertex}
{
- "\special {html:<a href=" quote$ *
- swap$ * quote$ * "> }" * swap$ *
- "\special {html:</a>}" *
+ pop$
}
FUNCTION {make.href.hyperref}
{
- "\href {" swap$ * "} {\path{" * swap$ * "}}" *
+ pop$ "\path{" swap$ * "}" *
}
FUNCTION {make.href}
{ hrefform #2 =
@@ -1054,12 +1064,7 @@
FUNCTION {format.url}
{ inlinelinks #1 = url empty$ or
{ "" }
- { hrefform #1 =
- { % special case -- add HyperTeX specials
- urlintro "\url{" url * "}" * url make.href.hypertex * }
- { urlintro "\url{" * url * "}" * }
- if$
- }
+ { urlintro "\nolinkurl{" * url * "}" * }
if$
}
@@ -1104,14 +1109,13 @@
FUNCTION {output.bibitem}
{ outside.brackets 'bracket.state :=
output.bibitem.original
- inlinelinks url empty$ not and
- { #1 'makeinlinelink := }
- { #0 'makeinlinelink := }
- if$
+ setup.inlinelink
+ add.openinlinelink
}
FUNCTION {fin.entry}
-{ output.web.refs % urlbst
+{
+ output.web.refs % urlbst
makeinlinelink % ooops, it appears we didn't have a title for inlinelink
{ setup.inlinelink % add some artificial link text here, as a fallback
"[link]" output.nonnull }
@@ -1121,7 +1125,14 @@
{ "]" * }
'skip$
if$
- fin.entry.original
+ add.period$
+ write$
+ type$ "webpage" =
+ 'skip$
+ 'write.url
+ if$
+ add.closeinlinelink
+ newline$
}
FUNCTION {webpage}
@@ -1139,7 +1150,6 @@
}
if$
new.block
- title empty$ 'skip$ 'setup.inlinelink if$
format.title "title" output.check
inbrackets "online" output
new.block
@@ -1159,7 +1169,6 @@
FUNCTION {article}
{ output.bibitem
format.authors "author" output.check
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.title "title" output.check
crossref missing$
{ journal
@@ -1179,7 +1188,6 @@
'skip$
if$
fin.entry
- write.url
}
FUNCTION {book}
@@ -1194,7 +1202,6 @@
if$
}
if$
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.btitle "title" output.check
crossref missing$
{ format.edition output
@@ -1208,20 +1215,17 @@
if$
format.note output
fin.entry
- write.url
}
FUNCTION {booklet}
{ output.bibitem
format.authors output
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.title "title" output.check
howpublished output
address output
format.note output
format.date "year" output.check
fin.entry
- write.url
}
FUNCTION {inbook}
@@ -1236,7 +1240,6 @@
if$
}
if$
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.btitle "title" output.check
crossref missing$
{
@@ -1254,13 +1257,11 @@
format.pages "pages" output.check
format.note output
fin.entry
- write.url
}
FUNCTION {incollection}
{ output.bibitem
format.authors "author" output.check
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.title "title" output.check
crossref missing$
{ format.in.ed.booktitle "booktitle" output.check
@@ -1277,13 +1278,11 @@
format.pages "pages" output.check
format.note output
fin.entry
- write.url
}
FUNCTION {inproceedings}
{ output.bibitem
format.authors "author" output.check
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.title "title" output.check
crossref missing$
{ format.in.ed.booktitle "booktitle" output.check
@@ -1303,7 +1302,6 @@
format.pages "pages" output.check
format.note output
fin.entry
- write.url
}
FUNCTION {conference} { inproceedings }
@@ -1320,7 +1318,6 @@
}
{ format.authors output.nonnull }
if$
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.btitle "title" output.check
author empty$
{ organization empty$
@@ -1339,13 +1336,11 @@
format.note output
format.date "year" output.check
fin.entry
- write.url
}
FUNCTION {mastersthesis}
{ output.bibitem
format.authors "author" output.check
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.title "title" output.check
bbl.mthesis format.thesis.type output.nonnull
school "school" output.check
@@ -1353,26 +1348,22 @@
format.note output
format.date "year" output.check
fin.entry
- write.url
}
FUNCTION {misc}
{ output.bibitem
format.authors output
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.title output
howpublished output
format.note output
format.date "year" output.check
fin.entry
- write.url
empty.misc.check
}
FUNCTION {phdthesis}
{ output.bibitem
format.authors "author" output.check
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.title "title" output.check
bbl.phdthesis format.thesis.type output.nonnull
school "school" output.check
@@ -1380,7 +1371,6 @@
format.note output
format.date "year" output.check
fin.entry
- write.url
}
FUNCTION {proceedings}
@@ -1389,7 +1379,6 @@
{ organization output }
{ format.editors output.nonnull }
if$
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.btitle "title" output.check
format.bvolume output
format.number.series output
@@ -1413,13 +1402,11 @@
if$
format.note output
fin.entry
- write.url
}
FUNCTION {techreport}
{ output.bibitem
format.authors "author" output.check
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.title "title" output.check
format.tr.number output.nonnull
institution "institution" output.check
@@ -1427,18 +1414,15 @@
format.note output
format.date "year" output.check
fin.entry
- write.url
}
FUNCTION {unpublished}
{ output.bibitem
format.authors "author" output.check
- title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
format.title "title" output.check
format.note "note" output.check
format.date "year" output.check
fin.entry
- write.url
}
FUNCTION {default.type} { misc }
@@ -1487,6 +1471,8 @@
write$ newline$
" \def\href#1#2{#2} \def\path#1{#1}\fi"
write$ newline$
+ "\providecommand*{\nolinkurl}{\url}"
+ write$ newline$
}
EXECUTE {begin.bib}
修改后的文件link-elsarticle-num.bst
可以从以下位置下载https://gist.github.com/moewew/1519006f9de5500db470bcc4701edeb5(该页面与原始页面也有很大的不同)。
有了link-elsarticle-num.bst
以下 MWE
\documentclass[number]{elsarticle}
\usepackage[T1]{fontenc}
\usepackage[colorlinks]{hyperref}
\begin{filecontents}{\jobname.bib}
@article{sigfridsson,
author = {Sigfridsson, Emma and Ryde, Ulf},
title = {Comparison of Methods for Deriving Atomic Charges from the
Electrostatic Potential and Moments},
journal = {Journal of Computational Chemistry},
year = 1998,
volume = 19,
number = 4,
pages = {377-395},
doi = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
}
@misc{elk,
author = {Anne Elk},
title = {A Theory on {Brontosauruses}},
year = {1971},
url = {https://example.edu/~elk/bronto.pdf},
}
@book{nussbaum,
author = {Nussbaum, Martha},
title = {{Aristotle's} {`De Motu Animalium'}},
year = 1978,
publisher = {Princeton University Press},
address = {Princeton},
}
\end{filecontents}
\begin{document}
\nocite{*}
\bibliographystyle{link-elsarticle-num}
\bibliography{\jobname}
\end{document}
生产
如果要抑制 URL 和 DOI 的明确输出,请删除
output.web.refs % urlbst
和
type$ "webpage" =
'skip$
'write.url
if$
阻止 它FUNCTION {fin.entry}
读取link-elsarticle-num.bst
FUNCTION {fin.entry}
{
makeinlinelink % ooops, it appears we didn't have a title for inlinelink
{ setup.inlinelink % add some artificial link text here, as a fallback
"[link]" output.nonnull }
'skip$
if$
bracket.state close.brackets = % urlbst
{ "]" * }
'skip$
if$
add.period$
write$
add.closeinlinelink
newline$
}
答案2
要将引用的书目转换为带有elsarticle
类的可点击链接(隐式使用bibtex
ref 管理器),可以使用\usepackage{hyperref}
。输出的第二页如下:
输入的 tex 文件是
\documentclass[number]{elsarticle}
\usepackage[hidelinks, colorlinks=true]{hyperref} %% ADDS LINKS TO REFERENCES, YOU CAN IGNORE THE OPTIONS [hidelinks, colorlinks=true] IF YOU LIKE.
\begin{document}
\begin{frontmatter}
\title{Dummy document \tnoteref{t1,t2}}
\tnotetext[t1]{Title footnote 1}
\tnotetext[t2]{Title footnote 2}
\author[a]{First Author\fnref{fn1}}
\ead{firstemail_id@insti_1.edu}
\author[b]{Second Author\fnref{fn2}}
\ead{secondemail_id@insti_2.edu}
\address[a]{Address of author with affiliation `a'}
\address[b]{Address of author with affiliation `b'}
\fntext[fn1]{This is a footnote.}
\fntext[fn2]{Another author footnote}
\begin{abstract}
Dummy abstract.
\end{abstract}
% Research highlights
\begin{highlights}
\item Research highlight 1
\item Research highlight 2
\end{highlights}
\begin{keyword}
Some \sep keywords
\end{keyword}
\end{frontmatter}
\section{Introduction}{\label{sec:intro}}
Intro
\section{Next}{\label{sec:blah}}
More blah in example of citation here \cite{Tenis_2000}. Another example of citation \cite{kilde}. Here is a third citation for a real article with doi and url \cite{Aalbersberg_2014}.
\nocite{*} % Temporary placeholder. Comment out after bib file is populated and \cite commands issued
\bibliographystyle{elsarticle-num}
\bibliography{reference} %%% DON’T ADD EXTENSION OF FILE
\end{document}
这里使用的参考文件是 reference.bib
@Book{kilde,
author = {John Doe},
publisher = {John Wiley},
title = {Differential equations : an introduction to modern methods and applications},
year = {2020},
address = {New Jersey},
isbn = {9780471651413},
keywords = {Differential equations},
language = {In English},
}
@Article{Tenis_2000,
author = {Michael Tenis},
journal = {Jounal of Energy},
title = {New article about something},
year = {2000},
month = aug,
number = {7},
pages = {66--88},
volume = {2},
}
@Article{Aalbersberg_2014,
author = {IJsbrand Jan Aalbersberg and Sophia Atzeni and Hylke Koers and Beate Specker and Elena Zudilova-Seinstra},
journal = {{LIBER} Quarterly},
title = {Bringing Digital Science Deep Inside the Scientific Article: the Elsevier Article of the Future Project},
year = {2014},
month = {apr},
number = {4},
pages = {274},
volume = {23},
doi = {10.18352/lq.8446},
publisher = {Uopen Journals},
url = {https://doi.org/10.18352/lq.8446},
}
这\usepackage{hyperref}
使用许多选项来调整链接到您的链接。例如更改链接颜色,放置下划线或方框等。您可以在其手动的。这是用于将引文链接到参考书目部分的参考文献。
要将参考书目部分中的参考文献链接到其出版网站,您应在文件中使用url
或doi
或两者字段reference.bib
。网站Crossref这有很大帮助,因为您可以将所有参考信息Actions>Cite
(包括url
和doi
)直接从那里复制到您的reference.bib
文件中。
注意使用\bibliography
命令时后面要跟上bib文件的名字没有像这样的扩展\bibliography{reference}
。