1

EDIT2 (simplified, clarified and updated):

I am currently using natbib with a custom plainurl.bst bibliography style on Sharelatex.com. Also tried with the plainurl.bst-style that comes as default with TexLive.

Code is as follows:

\documentclass{article}
\usepackage[square]{natbib}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris id metus at ex mollis dignissim. 
Quisque vel dolor semper dui lobortis eleifend id vitae massa. Sed quis odio eget massa luctus 
vehicula at in augue. Nam tempus in ante nec rutrum. Sed sollicitudin risus imperdiet turpis 
volutpat tempor. Sed dignissim neque at nunc tristique, vel tempus nibh lobortis. Pellentesque 
a cursus libero, porttitor molestie quam. Phasellus vitae dolor eu metus cursus volutpat 
vel sit amet risus. Vestibulum odio metus, scelerisque vitae semper sit amet, feugiat sit 
amet dolor. Morbi ut porttitor ex, nec egestas tortor. Suspendisse convallis cursus consequat.    
Etiam quis lorem ex. Cras tempus erat et dolor tempus, sed feugiat augue sagittis 
\cite{orson99, joint2006safety}.

Integer quis tincidunt mauris, eget blandit tortor. Pellentesque lobortis mollis 
sem, non dignissim libero dignissim a. Pellentesque ac malesuada dolor, nec gravida elit. 
Donec consequat arcu eget euismod sagittis. Aenean sollicitudin tincidunt mi ut bibendum. 
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. 
Nullam venenatis, ante quis imperdiet bibendum, velit mauris dapibus ex, ac hendrerit arcu 
nunc quis est. Integer vitae eleifend sapien, a rutrum enim. Mauris id turpis eu 
dolor tristique convallis. Sed quis ligula et neque rhoncus iaculis. Nulla tempor rutrum 
ultrices. Etiam congue neque accumsan est iaculis placerat. In sed hendrerit nulla. Sed 
fringilla erat quis tristique bibendum. Nunc tristique ullamcorper ligula eget lacinia 
\cite{mead1999food}.

Ut sit amet lorem felis. Donec purus libero, sodales laoreet suscipit sed, semper vel 
libero. Aenean consequat erat sed orci bibendum, sit amet dignissim diam elementum. 
Proin pharetra efficitur dui, vitae lacinia nisi venenatis ac. Vivamus id risus luctus, 
scelerisque ligula laoreet, blandit orci. Ut sodales mattis enim, et tristique augue 
fermentum nec. Mauris velit nulla, ornare ullamcorper magna ut, facilisis placerat dolor. 
Proin diam ipsum, vulputate ut tortor at, scelerisque aliquet eros. Curabitur id 
venenatis enim. Pellentesque vitae consectetur erat. Nullam quis nisi condimentum, 
lobortis eros sed, finibus sem. Sed vel dolor ac mi vulputate aliquet eget eget ipsum. 
Duis id interdum augue, id pellentesque libero. Vestibulum a massa eget urna ornare feugiat 
faucibus in nunc. Duis accumsan arcu blandit fringilla eleifend 
\cite{joint2006safety}.

\bibliographystyle{plainurl}
\bibliography{ref}
\end{document}

The text looks as follows in the compiled PDF:

text2

MAIN PROBLEM:

Here the problem is that the order when combining several references in one bracket gets wrong. The result is as follows: [1; 3]. However, the desired (preferably replace semicolon with comma) format is: [1, 2]. In short the desired outcome is that within text the citations are in numerical order: 1, 2, 3, 4, 5. In short words within the text the citations should appear in this order: [1, 2], [3], [4], [5]. Also the bibliography at the bottom must be sorted in the exact same order.

The list of references/bibliography at the end of the document looks as follows in the compiled PDF:

reflist2

PROBABLY RELATED TO MAIN PROBLEM:

Here (above graphic) most importantly the references should be sorted numerically [1], [2] and [3] (which they currently are inside the bibliography list). So we want [2] and [3] to change place to reflect the actual order in the body of the document. I guess this is solved when the main problem is solved.

Requirements that are allready satisfied in the current setup, but that must be preserved in a solution/alternative to natbib:

Among the most important requirements (these already are fulfilled by the solution I currently use) is that the last/family name should appear first, for each entry in bibliography, and the firstname middlename appear after abbreviated to one letter each like this: Lastname, F. M. also the website link must be shown.

Here are the contents of the example bibliography file ref.bib used:

@book{joint2006safety,
  title={Safety evaluation of certain food additives},
  author={Dunn, Lloyd M and Dunn, Leota M and Bulheller, Stephan and H{\"a}cker, Hartmut},
  number={56},
  year={2006},
  publisher={World Health Organization}
}
@article{mead1999food,
  title={Food-related illness and death in the United States.},
  author={Mead, Paul S and Slutsker, Laurence and Dietz, Vance and McCaig, Linda F and Bresee, Joseph S and Shapiro, Craig and Griffin, Patricia M and Tauxe, Robert V},
  journal={Emerging infectious diseases},
  volume={5},
  number={5},
  pages={607},
  year={1999},
  publisher={Centers for Disease Control and Prevention}
}
@online{orson99,
    author    = "Lastname, Firstname Middlename",
    title     = "{Website title. (03-04.1993)}",
    url       = "https://www.website.com/lkjdfgljfg/ljfdlgjlkjfdgkljlkdf/gjlkjfdgjlkfdglkjfgjl/lkfødkføkdsfølkdf",
    note={(accessed 08.04.2018)}
}

Contents of the plainurl.bst-file can be found here (but I added a minor tweak to it changing order of last and first name, can't post it here as it surpasses the limit for this post): http://tug.ctan.org/tex-archive/biblio/bibtex/contrib/urlbst/plainurl.bst

UPDATE

Following Mico's suggestion I tried using the natbib.bst-file that comes with the Livetex 2017 distribution. However the problem persists. Any ideas on what might be causing the issue? Is it possible to achieve a numerical ordering without manually ordering everything numerically in the bibliography file itself?

  • 2
    Your write-up is a bit confusing. For instance, the title contains the word "harvard", which is typically a synonym for "authoryear-style" citation call-outs. Yet you employ a bibliography style that generates numeric-style citation call-outs. Which citation style should be used? Please advise. – Mico Apr 14 '18 at 22:09
  • 1
    Sorry for the confusion, our institution that use that style (unfortunately not in Latex) calls it a custom version of "Harvard"-style. They might have made a mistake naming that customized style. I removed the word Harvard now, and use/replaced by just custom. – jibo Apr 14 '18 at 22:13
  • Thanks. Next comment: You say you get a citation call-out of the form [1; 3]. In contrast, the unmodified plainurl style generates a citation call-out of the form [1,2]. Something in the modified style file is creating the undesirable outcome. – Mico Apr 14 '18 at 22:19
  • More generally, it would appear that a lot of changes (hacks?) are required in order to adapt plainurl to your formatting requirements. In cases such as this one, trying to hack an existing bibliography style (bst) file is likely to be difficult and error-prone. You will almost certainly much better off running the makebst utility, which part of the custom-bib package, and create a bespoke bst file that works fine right away. – Mico Apr 14 '18 at 22:25
  • Hmm that is interesting that you get correct ordering in the text. What version of plainurl.bst did you test with? The custom file I am using is here (but I added a minor tweak to it changing order of last and first name): tug.ctan.org/tex-archive/biblio/bibtex/contrib/urlbst/… For makebst, custom-bib is there any good tutorial/instructions on how to use? I found this documentation it might be the best option: ctex.org/documents/packages/bibref/makebst.pdf – jibo Apr 14 '18 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.