2

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",
}
  • I miss a minimal working example with bibliography (MWEB). – Bobyandbob Jun 5 '17 at 13:54
  • @Mico You're right, I confused. I just changed the text. – DavideChicco.it Jun 5 '17 at 15:36
  • 1
    You could actually achieve almost all of your stated formatting needs simply by switching from the elsarticle-num-names bib style to the elsarticle-harv style. Well, the year won't be encased in parentheses, but at least it'll be in the desired position, viz., immediately following the author block. Can you (and/or your publisher) live with this rather minor imperfection? (A second, even less noticeable, imperfection is that there will be a comma between the volume (number) group and the pages group...) – Mico Jun 5 '17 at 15:45
  • @Mico Thanks, you solved my problem! Now I have another issue with which you might help me, if you can. How can I put the year in brackets? For example, from 2017 to (2017). Thanks! – DavideChicco.it Jun 8 '17 at 15:48
  • @Mico I originally thought about solving this problem by putting the parentheses in the year field of the references, e.g. (2007). Then I realized that this change was creating problems in the citations, that became like (Natale et al., (2007)). So I removed them from the references and decided to ask here. Thanks – DavideChicco.it Jun 8 '17 at 21:28
1

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}
  • @DavideChicco.it - Was this answer at all useful? – Mico Jun 11 '17 at 7:54

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.