4

Following an answer from @Mico (sorry Mico but it doesn't seem to like recognising your name) on Bibliography has inconsistent formatting I am attempting to use the elsarticle-num bibliography style with the natbib package (with numbers option). Unfortunately when compiled it results in a document with no bibliography. Can anyone help me fix this?

There are many similar questions like Elsarticle - number bibliography not working and Referencing not working with Natbib but all the ones I could find refer to slightly different scenarios like in an elsarticle document class, using \citep, or different bibliography styles to name a few.

The following code produces an example output.

\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}

The following image shows that the bibliography does not get created.

example of bibliography not being created

Using \bibliographystyle{unsrt} correctly produces a bibliography.

The example.bib file is as follows:

@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}
}

Document is compiled on Ubuntu with the following script:

#/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

and has been run 5 times.

example.blg shows that 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)
13
  • 1
    I do not see in your MWE that you use the Elsevier template elsart.cls, which is usually declared in the document class as in \documentclass[authoryear,review,preprint,12pt,pdf]{elsarticle}
    – Xavier
    May 11, 2020 at 16:39
  • 2
    Have you checked file *.blg for error messages or warnings? I guess, file elsarticle-num.bst is simply missing ...
    – Mensch
    May 11, 2020 at 16:44
  • 1
    Please confirm that you performed a full recompile cycle -- LaTeX, BibTeX, and LaTeX twice more --
    – Mico
    May 11, 2020 at 16:50
  • 3
    It's on CTAN. You can either install it properly or (far easier!) just stick it in the same directory as your tex file. ctan.org/tex-archive/macros/latex/contrib/elsarticle?lang=en May 11, 2020 at 17:21
  • 1
    You may find the file at elsevier.com/__data/assets/file/0011/56846/elsarticle-num.bst.
    – Mico
    May 11, 2020 at 17:32

2 Answers 2

5

(this answer merely summarizes and combines some of the the comments made by various contributors)

  • The chief reason why the OP couldn't create a formatted bibliography using natbib, BibTeX, and the elsarticle-num bibliography style was that the bibliography style file, elsarticle-num.bst, was not present in the OP's TeX distribution.

  • The solution consisted in downloading the file from the following URL:

    https://www.elsevier.com/__data/assets/file/0011/56846/elsarticle-num.bst
    

    Once the bst file was properly installed, no further obstacles stood in the way of creating the formatted bibliography.

  • To facilitate the typesetting of long URL strings and, in particular, to allow easy line-breaking of long URL strings, a further suggestion was made to load the xurl package immediately prior to loading the hyperref package.

  • One or more of the OP's advisers appear to have major hangups about the need to achieve "formatting consistency" in the typeset bibliography. (For instance, the output produced by the unsrtnat bibliography style was not acceptable to them because it lacked formatting consistency.) To accommodate such rather strong views, it definitely helps to make the hyperlinked material "blend in" into the surroundings. Adding the instruction

    \hypersetup{colorlinks,urlcolor=black}
    

    in the preamble, after loading the hyperref package, certainly helps meet this objective. The hyperlinks will still be there -- you just wouldn't know it solely from looking at the formatted bibliographic entries.

1

I find that the following does give a complete references list: (don't forget to compile the bibliography at least once before pdflatexing again.

    \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}


1
  • for the reply. I have added more information that might help figure out why it does not work for me.
    – ojunk
    May 11, 2020 at 17:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .