Making minor changes to citation style

I have been trying to make some minor customizations to the APA citation style by using the visual editor at, but because I don’t know what I’m doing I’m not getting anywhere.

I’m trying to do change two things:

  • Citing specific pages in-text. Currently this is (author, year, p. 123). I would like to change the “p.” to a “:”, as in (author, year:123).
  • Citing specific chapter in-text. I want to change this from (author, year, chapter 123) to (author, year, ch. 123). Thus, changing “chapter” to “ch.”

Is there someone here who can point me in the right direction? Any help would be greatly appreciated.

The first thing to do is to add locators to the example citations by clicking the “Example citations” menu in the upper right and using the drop-down lists which are usually labeled “Normal citation” to values corresponding to specific pages and chapters. This will allow you to see how the changes you make will actually look.

Next, go to the code editor and replace “citation locator” macro and the citation block with the following:

<macro name="citation-locator">
      <if locator="chapter">
        <text variable="locator" form="short" prefix=", ch. "/>
        <text variable="locator" form="short" prefix=":"/>
<citation et-al-min="6" et-al-use-first="1" et-al-subsequent-min="3" et-al-subsequent-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true" collapse="year" givenname-disambiguation-rule="primary-name">
    <key macro="author"/>
    <key macro="issued-sort"/>
  <layout prefix="(" suffix=")" delimiter="; ">
    <group delimiter=", ">
      <text macro="author-short"/>
      <text macro="issued-year"/>
    <text macro="citation-locator"/>

Some explanation: in the first block I hard-coded the separators you wanted into the prefixes of the locator variables. There are two reasons for this. The first is that the CSL language has variables for locators but the short version of “chapter” is “Chap.” and not “Ch.” so this value had to be included as a text variable. The second reason is that you asked for a different delimiter ( “,” vs. “:” ) for pages and chapters, so this also needed to be hand coded.

In the second block I added a group for the author and year and moved the locator out of this group. This allows for the delimiter “,” between the author and the year, while there is no delimiter between the year and the locator.

This can all be done in the visual editor by changing various delimiter and prefix/suffix variables, but it is sometimes easier just to edit the code. The code editor also updates the example citations in real-time so it is relatively easy to experiment.

1 Like

Thank you for taking the time to write this out.

I learned a few things, for example: I never noticed the ‘example citations’ button in the top right corner. This does it make it indeed much easier to experiment. Also, thank you for not just providing the code, but explaining why you wrote it as it is.

I’ll be sure to use it in the coming days and weeks :smile:

Kind Regards.