1

I am using LaTeX with the article document class. The Bibtex bibliography style that I am using is agsm, part of the Harvard family of bibliography styles.

I have two questions:

(1) If I cite an entry of type @book, then in the reference list I get publisher, address. I would like to re-arrange this order to address: publisher. Which part of agsm.bst should I modify?

(2) I would like to change single quotation marks ' ' to double quotation marks " " for setting off the title of entries of type @article. Which part of agsm.bst should I focus on?

  • 1
    Are you sure it's the apsr bibliography style you wish to modify? To the best of my knowledge, for entries of type @book, the apsr bibliography style is programmed to typeset the address and publisher as "address: publisher", not as "publisher, address". For entries of type @article, the apsr bib style uses double quotes, not single quotes, to encase the contents of the title field. (For entries of type @book, the title field is rendered in italics.) These default settings are quite different from what you say the apsr bibliography style does by default. Please clarify. – Mico Jun 12 '18 at 14:06
  • @Mico: you are correct. I made a typo. I am using "agsm", not "apsr" as early version I raised the question. I did correct the question. – Vũ Võ Jun 12 '18 at 14:14
  • Please also correct the other two instances of apsr in your posting. – Mico Jun 12 '18 at 14:23
2

I suggest you proceed as follows.

  • Locate the file agsm.bst in your TeX distribution. Make a copy of this file and name the copy, say, agsm-mod.bst. (Do not edit an original file of the TeX distribution directly.)

  • Open the file agsm-mod.bst in a text editor. The editor you use to edit your .tex files will do fine.

  • Let's tackle the easier task first: Changing the quoting style from single quotes to double quotes. In agsm-mod.bst, locate the function called quote. (In my copy of this file, the quote function starts on line 155.) In this function, locate the following line:

        { "`" swap$ * "'" * }
    

    Change it to

        { "``" swap$ * "''" * }
    

    This change will affect not only how titles of entries of type @article are typeset; it will also affect the titles of entries of type @misc and @booklet. I'm assuming that you're OK with this.

  • The much harder task, actually, is changing publisher, address to address: publisher for entries of type @book. It turns out to be necessary to provide several new BibTeX functions in order to accomplish this task. This is because the stock agsm style is programmed to use commas between fields everywhere; using a colon between two particular fields (here: address and publisher) is not something this bib style does easily.

    Start off by inserting the following code chunk between the functions multi.page.check and format.pages.

    FUNCTION {bibinfo.warn}
    { swap$
      duplicate$ missing$
        {
          swap$ "missing " swap$ * " in " * cite$ * warning$ pop$
          ""
        }
        { duplicate$ empty$
            {
              swap$ "empty " swap$ * " in " * cite$ * warning$
            }
            { swap$
              pop$
            }
          if$
        }
      if$
    }
    
    FUNCTION {bibinfo.check}
    { swap$
      duplicate$ missing$
        {
          pop$ pop$
          ""
        }
        { duplicate$ empty$
            {
              swap$ pop$
            }
            { swap$
              pop$
            }
          if$
        }
      if$
    }
    
    FUNCTION {format.org.or.pub}
    { 't :=
      ""
      address empty$ t empty$ and
        'skip$
        {
          address "address" bibinfo.check *
          t empty$
            'skip$
            { address empty$
                'skip$
                { ": " * }
              if$
              t *
            }
          if$
        }
      if$
    }
    
    FUNCTION {format.publisher.address}
    { publisher "publisher" bibinfo.warn format.org.or.pub
    }
    
  • Next, locate the book function in the file agsm-mod.bst. In this function, locate the following two lines

          publisher "publisher" output.check
          address output
    

    Replace these two lines with (I think you can already guess...)

          format.publisher.address output
    

    And, while you're at it, you should replace the same pair of lines in the functions inbook and incollection as well. (Just search for the two remaining instances of publisher "publisher" output.check in the bst file.)

  • Save the bst file either in the directory where your main tex file is located or in a directory that's searched by BibTeX. If you choose the second option, be sure to also update the filename database of your TeX distribution suitably.

  • Finally, in your main tex file, change the instruction

    \bibliographystyle{agsm} 
    

    to

    \bibliographystyle{agsm-mod} 
    

    and perform a full recompile cycle: LaTeX, BibTeX, and LaTeX twice more.


For good measure, here's an MWE (minimum working example) that demonstrates the result of using the agsm-mod bibliography style.

enter image description here

\RequirePackage{filecontents}
\begin{filecontents}{mybib.bib}
@article{a,
  author   = "Anne Author",
  title    = "Thoughts",
  year     = 3001,
  journal  = "Circularity Today",
  volume   = 1,
  number   = 2,
  pages    = "3-4",
}
@book{b,
  author   = "Brenda Buthor",
  title    = "Further Thoughts",
  year     = 4001,
  publisher= "Publisher",
  address  = "Some Place, XY",
}
\end{filecontents}

\documentclass{article}
\usepackage{harvard}
\bibliographystyle{agsm-mod}%

\begin{document}
\cite{a}, \cite{b}
\bibliography{mybib}
\end{document}
  • 1
    It is really perfect code. It works well for my case. Thank you very much for your great support. – Vũ Võ Jun 12 '18 at 18:42
  • for further customization of my bibliography style, can you suggest me to which documents I should address to understand "code chunk" in the *.bst files? – Vũ Võ Jun 12 '18 at 19:46
  • @VũVõ - I'm not sure I understand your question. In computer coding, a "chunk" is (at least as I understand it) a term for a block of code. That's the sense of the term I meant to use. To be more specific, the chunk I was referring to consists of four [4] BibTeX functions: bibinfo.warn, bibinfo.check, format.org.or.pub, and format.publisher.address. – Mico Jun 12 '18 at 20:25
  • I mean the code that is presented in the *.bst :-). I understood some parts of the code, but not throughout the code. This makes you laughing me coz it so ambitious :-), But I really want to understand it as much as I can. – Vũ Võ Jun 12 '18 at 21:00
  • 1
    :-) it should be "thread", not threat. kaka :-) – Vũ Võ Jun 14 '18 at 15:19

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.