[Tex/LaTex] Bib file, how to change the position of the year field in the references

bibtexcitingcross-referencing

I've been working on a chapter for an Elsevier book elsarticle.cls class file and the elsarticle-num-names reference file.

This Harvard style shows the referenced papers in the following format, for example:

  • D. A. Natale, C. N. Arighi, W. C. Barker, J. Blake, T.-C. Chang, Z. Hu, H. Liu, B. Smith, C. H. Wu, Framework for a protein ontology, BMC
    Bioinformatics 8 (9), 2007 S1.

I would like to switch the year field to the beginning of the reference, this way:

  • D. A. Natale, C. N. Arighi, W. C. Barker, J. Blake, T.-C. Chang, Z. Hu, H. Liu, B. Smith, C. H. Wu, 2007. Framework for a protein
    ontology, BMC Bioinformatics 8 (9) S1.

(bolding added for emphasis)

How can I do it?

Thanks

EDIT: It's hard to create a minimal working example because I'm using 4 files to create the pdf.

Here's the bibliography declaration at the start of the main tex file, and at the end of it:

\bibliographystyle{elsarticle-num-names}
\biboptions{authoryear}
...
\bibliography{pro_chapter_bib_file}

And here's the entry in the bib file:

@article{natale2007framework,
  title        = "Framework for a protein ontology",
  author       = "Natale, Darren A. and Arighi, Cecilia N. and
                  Barker, Winona C. and Blake, Judith and
                  Chang, Ti-Cheng and Hu, Zhangzhi and Liu,
                  Hongfang and Smith, Barry and Wu, Cathy H.",
  journal      = "BMC Bioinformatics",
  volume       = "8",
  number       = "9",
  pages        = "S1",
  year         = "2007",
  publisher    = "BioMed Central",
}

Best Answer

If I understand your bibliography formatting requirements correctl6, the elsarticle-harv bibliography style would be a good starting point. You'll need to make just three modifications. I suggest you proceed as follows.

  • Locate the file elsarticle-harv.bst in your TeX distribution. Make a copy of this file and call the copy, say, elsarticle-harv-mod.bst. (Do not modify an original file of the TeX distribution directly.)

  • Open the file elsarticle-harv-mod.bst in a text editor; the editor you use for your tex files will do fine.

  • In the bst file, locate the function format.names. (It starts on line 377 in my copy of the file. In this function, locate the following line:

           "{vv~}{ll}{, jj}{, f.}" format.name$
    

    Change it to

           "{f. }{vv~}{ll}{, jj}" format.name$
    

    (After all, you've indicated that the abbreviated given names should be placed ahead of the surnames.)

  • Next, locate the function format.date; in all likelihood, it'll start on l. 617. In this function, locate the following line (the penultimate line of the function):

       ", " swap$ *
    

    Change it to

       ", (" swap$ * ")" *
    

    (This change will encase the year field in round parentheses.)

  • Finally, locate the function format.journal.pages, which should start on line 783. In this function, locate the line

               ", " *
    

    Delete the comma, i.e., change the line to

               " " *
    
  • Save the file elsarticle-harv-mod.bst either in the directory where your main tex file is located or in a directory that's searched by your TeX distribution. If you choose the second option, you will likely need to update the filename database of your TeX distribution suitably.

  • In your main tex file, change the instruction \bibliographystyle{elsarticle-harv} to \bibliographystyle{elsarticle-harv-mod}, and do a full recompile cycle: LaTeX, BibTeX, and LaTeX twice more.

Happy BibTeXing!

A full MWE:

enter image description here

\RequirePackage{filecontents}
\begin{filecontents}{pro_chapter_bib_file.bib}
@article{natale2007framework,
  title        = "Framework for a protein ontology",
  author       = "Natale, Darren A. and Arighi, Cecilia N. and Barker, Winona C. 
                  and Blake, Judith and Chang, {Ti-Cheng} and Hu, Zhangzhi
                  and Liu, Hongfang and Smith, Barry and Wu, Cathy H.",
  journal      = "BMC Bioinformatics",
  volume       = "8",
  number       = "9",
  pages        = "S1",
  year         = "2007",
  publisher    = "BioMed Central",
}
\end{filecontents}

\documentclass[authoryear]{elsarticle}
\bibliographystyle{elsarticle-harv-mod}

\begin{document}
\cite{natale2007framework}
\bibliography{pro_chapter_bib_file}
\end{document}