Search code examples
citationscsl

Creating a minimal citation style


I would like to create a citation style (to be used in Zotero) for which a reference entry would - very minimalistically - only include the following fields:

  • the first author's surname (+the second's if there are two authors, or followed by "et al." if there are 3 or more authors)
  • the year of publication in brackets
  • the abbreviated journal (or book publisher's) name, in italics

These fields would be linked together as shown in these examples:

  • Smith & Johnson (2005), OUP
  • Brady et al. (2010), Nat Comms
  • Mueller (2023), Sci Rep

I've been trying to achieve this for ages using the Visual CSL Editor at https://editor.citationstyles.org/visualEditor/, using a copy of the apa.csl file found in Zotero (APA 7th edition style) as a sandbox fork file.

However, I simply don't get how the damn elements need to be combined in order to get this result. After a lot of trial annd error, I cannot find where exactly the different macros need to stand in the nested hierarchy on the left-hand side.

Making this trial&error very time consuming is the fact that not all changes can be previewed in the Example Bibliography (as it only includes a book chapter and a thesis, but no journal name). Instead, one needs to save the CSL, import into Zotero, restart Zotero, then try exporting a library items with the new style; then reload the Editor page in the browser, since due to a bug, you cannot keep editing that same file.

The screenshot below shows how far I've got. Any indications of what needs to be done, or a demonstration CSL file, would be greatly appreciated!

enter image description here


Solution

  • If you want to start with a style, don't start with APA, which is incredibly complex. Take something like American Chemical Society, which is simpler and already omits titles for many item types.

    But given how little you need the style to do, it might just be worth starting fresh ("Style --> New Style" at the top left of the editor).

    You can then add one node after the other using the + sign.

    Alternatively, some basic code like this will work, depending on what you need exactly, use in the bibliography and/or citation section of the CSL, but note that you do need something in citation (bibliography is optional)

        <names variable="author">
          <name form="short" and="symbol" et-al-min="3" et-al-use-first="1"/>
        </names>
        <date variable="issued" form="numeric" date-parts="year" prefix=" (" suffix=")"/>
        <group prefix=", ">
          <choose>
            <if variable="container-title" match="any">
              <text variable="container-title" form="short" font-style="italic"/>
            </if>
            <else>
              <text variable="publisher" font-style="italic"/>
            </else>
          </choose>
        </group>