4

This question already has an answer here:

I'm using the natbib package for the bibliography, and initially had the plainnat style but have since been told that I've got to use Harvard referencing only. So I tried changing the bibliography styles to ones I've found on online reference sheets - e.g. agsm.bst, but the only ones I find that work and put the bibliography references in the order they need to be ('Author;Year;Title;Journal;Volume;Pages') will bold the volume number like this:

JR Krebs. 1980. Optimal foraging, predation risk and territory defence. Ardea, 68:83-90

It looks very odd and I would like to remove this but I don't know how - do I need to change the code, or is there a style package that I should be using?

Here's the code I have set up:

\documentclass[12pt]{article}

\usepackage{fontspec}
\setmainfont{Arial}

\usepackage{natbib}
\usepackage{graphicx}

\usepackage{listings}
\lstset{frame=single,breaklines=true}
\setcounter{secnumdepth}{4}
\sloppy

\usepackage{geometry}
\geometry{margin=1in}


\title{PAPER TITLE}
\date{}

\begin{document}
TEXT HERE
\bibliographystyle{plainnat}
\bibliography{bibliography.bib}

and the bibliography entries are being entered like this:

@article{krebs1980optimal,
  title={Optimal foraging, predation risk and territory defence},
  author={Krebs, JR},
  journal={Ardea},
  volume={68},
  pages={83--90},
  year={1980},
  publisher={BioOne}
}

marked as duplicate by Mico, user13907, Zarko, Andrew, Stefan Pinnow Jan 19 '17 at 7:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Welcome to TeX SX! I don't use natbib, but I can say it will be easier with biblatex (which has a natbib compatibility mode). – Bernard Jan 18 '17 at 17:01
  • 7
    it's not random, deciding fonts for things like issue numbers is exactly what bibtex styles do so it is expected to change if you change styles. That is the intended style of the bibliography style you are using. You could make a copy under a different name and just look for places that it inserts \textbf but if it is for submission it is usually best not to change specified styles – David Carlisle Jan 18 '17 at 17:02
  • if I were to switch to biblatex, which bits of code would I need to alter? I am hesitant to remove things because I don't really know what I'm doing and could remove something important. – EsmeMo Jan 18 '17 at 17:39
  • @EsmeMo if the document is intended for electronic submission check first if biblatex is supported (almost all journals only accept bibtex and would not accept a biblatex version) – David Carlisle Jan 18 '17 at 18:53
  • @Bernard - Recommending a change from using natbib (and BibTeX) to using biblatex is somewhat incomplete, as far as recommendations go. You ought to provide a suggestion for the citation style as well, I believe. – Mico Jan 19 '17 at 0:47
4

It does change because this is simply what that particular style does in the BibTeX layer. You can see easily what happens if you look into the derived .bbl:

\begin{thebibliography}{xx}
\harvarditem{Krebs}{1980}{krebs1980optimal}
Krebs, J.  \harvardyearleft 1980\harvardyearright , `Optimal foraging,
  predation risk and territory defence', {\em Ardea} {\bf 68},~83--90.
\end{thebibliography}

The '68' is inside a group in which the (obsolte) font command \bf is issued, which formats the groups content bold. You can try

% arara: xelatex
% arara: bibtex
% arara: xelatex
% arara: xelatex
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
  @article{krebs1980optimal,
    title={Optimal foraging, predation risk and territory defence},
    author={Krebs, JR},
    journal={Ardea},
    volume={68},
    pages={83--90},
    year={1980},
    publisher={BioOne}
  }
\end{filecontents*}

\documentclass[12pt]{article}
\usepackage{fontspec}
  \setmainfont{Arial}
\usepackage{natbib}

\let\oldthebibliography\thebibliography
\renewcommand\thebibliography{\let\bf\relax\oldthebibliography}

\begin{document}
\nocite{*}
\bibliographystyle{agsm}
\bibliography{\jobname}
\end{document}

example_rendered

It is worth noting that this will disable \bf in the whole bibliography.

2

You can quite easily modify the bst file.

  1. Find the file agsm.bst in your TeX system

  2. Copy it in the same folder as your .tex document, with the name agsm-nobf.bst

  3. Open the new file with any text editor

  4. Find in it the only line containing the string \bf

  5. Edit so that it becomes

    FUNCTION {embolden}
    { duplicate$ empty$
        { pop$ "" }
    %    { "{\bf " swap$ * "}" * }
        { "{" swap$ * "}" * }
      if$
    }
    

    (I left the original one, but commented out, for future memory)

Now your file can become

\begin{filecontents*}{\jobname.bib}
@article{krebs1980optimal,
  title={Optimal foraging, predation risk and territory defence},
  author={Krebs, JR},
  journal={Ardea},
  volume={68},
  pages={83--90},
  year={1980},
  publisher={BioOne}
}
\end{filecontents*}

\documentclass[12pt]{article}

\usepackage{fontspec}
\setmainfont{Arial}

\usepackage{natbib}
\usepackage{graphicx}

\usepackage{listings}
\lstset{frame=single,breaklines=true}
\setcounter{secnumdepth}{4}

\usepackage{geometry}
\geometry{margin=1in}


\title{PAPER TITLE}
\date{}

\begin{document}
TEXT HERE \nocite{*}

\bibliographystyle{agsm-nobf}
\bibliography{\jobname}

\end{document}

A few things to note. I removed \sloppy and you should do it as well. The filecontents* environment is just for convenience here, in order to make the example self-contained; you'll use your bibliography.bib file, but the call should be

\bibliography{bibliography}

without .bib.

Compile, run BibTeX and compile again.

enter image description here

  • The only place where the embolden function is used in agsm.bst is inside the format.vol.num.pages function, on the line that reads { volume embolden field.or.null. An alternative to the approach you provide would be to change the preceding line to { volume field.or.null. That said, both approaches produce the exact same output. :-) – Mico Jan 19 '17 at 0:36
  • @Mico I went for a minimal patch; I thought about removing embolden, but my command of the bst language is limited. – egreg Jan 19 '17 at 0:44
1

You wrote:

I'm using the natbib package for the bibliography, and initially had the plainnat style but have since been told that I've got to use Harvard referencing only. So I tried changing the bibliography styles to ones I've found on online reference sheets - e.g. agsm.bst, ...

It is not necessary to change bibliography styles if all you need to do is change the style of the citation call-outs from numeric style to "harvard" style, which is also known as author-year style. While it is true that agsm is one of the style files provided by the harvard package, you do not have to switch to agsm (or one of the six other bibliography styles provided by the harvard package) in order to generate authoryear-style citation call-outs.

There are lots and lots of bibliography styles out there capable of generating authoryear-style citation call-outs. In fact, if you are otherwise satisfied with the formatting generated by the plainnat bibliography style, all you need to do is state the option authoryear while loading natbib. (By default, square brackets will be used; if you prefer round parentheses, state the option round as well.) Use \citet to generate "textual" citation call-outs and \citep to generate "parenthetic" citation call-outs.

Of course, if you prefer the formatting generated by the agsm style, by all means switch to agsm style. Just be aware that it is not necessary to do so if all you need to do is change the style of the citation call-outs.


enter image description here

\RequirePackage{filecontents}
\begin{filecontents}{bibliography.bib}
@article{krebs1980optimal,
  title={Optimal foraging, predation risk and territory defence},
  author ={Krebs, J. R.},
  journal={Ardea},
  volume={68},
  pages={83--90},
  year={1980},
  publisher={BioOne}
}
\end{filecontents}

\documentclass[12pt]{article}
\usepackage{fontspec}
\setmainfont{Arial}
\usepackage[authoryear,round]{natbib}
\bibliographystyle{plainnat}
\usepackage{geometry}
\geometry{margin=1in}

\begin{document}
\citet{krebs1980optimal}; \citep{krebs1980optimal}
\bibliography{bibliography}
\end{document}

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