按照@Mico的回答(对不起,Mico,但它似乎不喜欢识别你的名字)参考书目格式不一致我正在尝试使用elsarticle-num
natbib 包(带数字选项)的参考书目样式。不幸的是,编译时会产生没有参考书目的文档。有人能帮我解决这个问题吗?
还有很多类似的问题,例如Elsarticle - 数字书目不起作用和引用无法与 Natbib 配合使用但我发现所有这些都指的是略有不同的场景,例如在elsarticle
文档类中,使用\citep
或不同的参考书目样式等等。
以下代码生成一个示例输出。
\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{afterpage}
\usepackage{hyperref}
\graphicspath{ {images/} }
\usepackage[numbers]{natbib} %Calls bibliography commands
\begin{document}
\title{Inconsistant bibliography formatting example}
\author{Author}
\maketitle
\noindent Citation one \cite{Darwin2010}.
\\
\\
\noindent Citation two \cite{ReesChalkley2019}.
%\begin{figure}[h]
% \centering
% \includegraphics[width=0.5\textwidth]{spiral}
% \caption{Example of a parametric plot ($\sin (x), \cos(x), x$)}
%\end{figure}
\bibliography{/home/oli/Dropbox/Documents/PhD/thesis/contemporary_version/thesis_corrections/pre-final/bib_problem_recreation/bib_dir/example.bib}
\bibliographystyle{elsarticle-num}
%\bibliographystyle{unsrt}
\end{document}
下图显示未创建参考书目。
正确使用\bibliographystyle{unsrt}
即可生成参考书目。
example.bib文件如下:
@article{ReesChalkley2019,
abstract = {In the future, entire genomes tailored to specific functions and environments could be designed using computational tools. However, computational tools for genome design are currently scarce. Here we present algorithms that enable the use of design-simulate-test cycles for genome design, using genome minimisation as a proof-of-concept. Minimal genomes are ideal for this purpose as they have a simple functional assay, the cell either replicates or not. We used the first (and currently only published) whole-cell model, for the bacterium Mycoplasma genitalium . Our computational design-simulate-test cycles discovered novel in-silico minimal genomes smaller than JCVI-Syn3.0 , a bacteria with, currently, the smallest genome that can be grown in pure culture. In the process, we identified 10 low essentiality genes, 18 high essentiality genes, and produced evidence for at least two Mycoplasma genitalium in-silico minimal genomes. This work brings combined computational and laboratory genome engineering a step closer.},
author = {Rees, Joshua and Chalkley, Oliver and Landon, Sophie and Purcell, Oliver and Marucci, Lucia and Grierson, Claire},
doi = {10.1101/344564},
file = {:home/oli/.local/share/data/Mendeley Ltd./Mendeley Desktop/Downloaded/Rees et al. - 2019 - Designing Minimal Genomes Using Whole-Cell Models.pdf:pdf},
journal = {bioRxiv},
month = {mar},
pages = {344564},
publisher = {Cold Spring Harbor Laboratory},
title = {{Designing Minimal Genomes Using Whole-Cell Models}},
url = {https://www.biorxiv.org/content/10.1101/344564v3},
year = {2019}
}
@book{Darwin2010,
abstract = {Title from publishers bibliographic system (viewed on 11 Apr 2014). Charles Darwin (1809–1882) first published this work in 1868 in two volumes. The book began as an expansion of the first two chapters of On the Origin of Species: 'Variation under Domestication' and 'Variation under Nature' and it developed into one of his largest works; Darwin referred to it as his 'big book'. In volume 2, concerned with how species inherit particular characteristics, Darwin first published his 'provisional hypothesis' of pangenesis. This theory of 'gemmules' was not met with much acceptance and today is not valuable as scientific explanation, but it was important in laying down the key questions that needed to be answered regarding the processes of genetic inheritance. Darwin also used volume 2 to challenge the theories of evolution by design, expounded by the botanist Asa Gray. Darwin's arguments were some of the very first in a long debate that remains hot today.},
author = {Darwin, Charles},
isbn = {1108014232},
pages = {500},
publisher = {Cambridge University Press},
title = {{The Variation of Animals and Plants under Domestication Volume 2}},
url = {https://books.google.co.uk/books?hl=en{\&}lr={\&}id={\_}uON0AO7qwYC{\&}oi=fnd{\&}pg=PA1{\&}dq=Variation+of+Animals+and+Plants+under+Domestication{\&}ots=hqeZySDFfI{\&}sig=YY5rjn06wS5HccnZ8kvVEMC7bpU{\#}v=onepage{\&}q=Variation of Animals and Plants under Domestication{\&}f=false},
year = {2010}
}
文档是在 Ubuntu 上使用以下脚本编译的:
#/bin/bash
# declare filename so that you only need to change it once in the file
filename=example
# Clean up files
shopt -s extglob
rm ${filename}.!(tex)
# build latex files
pdflatex -interaction=nonstopmode ${filename}.tex
bibtex ${filename}.aux
makeglossaries ${filename}
pdflatex ${filename}.tex
pdflatex ${filename}.tex
pdflatex ${filename}.tex
并且已经运行了5次。
example.blg
表明I couldn't open style file elsarticle-num.bst
:
This is BibTeX, Version 0.99d (TeX Live 2015/Debian)
Capacity: max_strings=35307, hash_size=35307, hash_prime=30011
The top-level auxiliary file: example.aux
I couldn't open style file elsarticle-num.bst
---line 22 of file example.aux
: \bibstyle{elsarticle-num
: }
I'm skipping whatever remains of this command
I found no style file---while reading file example.aux
You've used 2 entries,
0 wiz_defined-function locations,
89 strings with 685 characters,
and the built_in function-call counts, 0 in all, are:
= -- 0
> -- 0
< -- 0
+ -- 0
- -- 0
* -- 0
:= -- 0
add.period$ -- 0
call.type$ -- 0
change.case$ -- 0
chr.to.int$ -- 0
cite$ -- 0
duplicate$ -- 0
empty$ -- 0
format.name$ -- 0
if$ -- 0
int.to.chr$ -- 0
int.to.str$ -- 0
missing$ -- 0
newline$ -- 0
num.names$ -- 0
pop$ -- 0
preamble$ -- 0
purify$ -- 0
quote$ -- 0
skip$ -- 0
stack$ -- 0
substring$ -- 0
swap$ -- 0
text.length$ -- 0
text.prefix$ -- 0
top$ -- 0
type$ -- 0
warning$ -- 0
while$ -- 0
width$ -- 0
write$ -- 0
(There were 2 error messages)
答案1
(这个答案只是总结并结合了各位贡献者的一些评论)
natbib
OP 无法使用、BibTeX 和书目样式创建格式化书目的主要原因elsarticle-num
是,书目样式文件elsarticle-num.bst
不存在于 OP 的 TeX 分发中。解决方案是从以下 URL 下载文件:
https://www.elsevier.com/__data/assets/file/0011/56846/elsarticle-num.bst
一旦正确安装了 bst 文件,创建格式化的参考书目就不会再遇到任何障碍。
为了方便排版较长的 URL 字符串,尤其是允许轻松换行较长的 URL 字符串,还建议加载网址装载之前立即打包超链接包裹。
OP 的一位或多位顾问似乎对在排版参考书目中实现“格式一致性”的必要性有重大困扰。(例如,参考书目样式产生的输出
unsrtnat
对他们来说是不可接受的,因为它缺乏格式一致性。)为了适应这种相当强烈的观点,让超链接材料“融入”周围环境肯定有帮助。添加说明\hypersetup{colorlinks,urlcolor=black}
在加载包后,在序言中
hyperref
,这无疑有助于实现此目标。超链接仍将存在 - 只是您无法仅通过查看格式化的书目条目来了解它。
答案2
我发现下面确实给出了完整的参考文献列表:(再次进行 pdflatexing 之前,请不要忘记至少编译一次参考书目。
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{afterpage}
\usepackage{hyperref}
\graphicspath{ {images/} }
%\usepackage[numbers]{natbib} %Calls bibliography commands
\RequirePackage{filecontents}
\begin{filecontents}{mybibx.bib}
@Article{boiral_2006,
author = {Olivier Boiral},
title = {Global Warming: Should Companies Adopt a Proactive Strategy?},
journal = {Long Range Planning},
year = {2006},
volume = {39},
number = {3},
month = {jun},
pages = {315--330},
doi = {10.1016/j.lrp.2006.07.002},
publisher = {Elsevier {BV}},
}
@Article{koe1,
author = {G. {K\oe nig}},
title = {Production de la connaissance et pratiques organisationnelles},
journal = {Revue de Gestion des Ressources Humaines},
year = {1993},
volume = {9},
pages = {4-17},
}
\end{filecontents}
\begin{document}
\title{Inconsistant bibliography formatting example}
\author{Author}
\maketitle
\noindent Citation one \cite{boiral_2006}.
\\
\cite{koe1}
\\
\bibliography{mybibx}
\bibliographystyle{elsarticle-num}
\end{document}