I keep forgetting the kind of simple edits that are so trivial to make in CSL styles. Here I catalogue a few, for my own benefit and hopefully also useful to others. The occasion is a festive one —one paper in press and another accepted with minor revisions!— and I’m not going to let the fun be spoiled by the tedious job of making minute changes to the referencing styles. Where do editors and reviewers find all this time anyway? One good soul manually added colons and spaces before the page numbers in all of my forty+ in-text references. I refuse to do that kind of dumb manual labour. Instead, I’m simply going to edit the nearest CSL style and woosh, the whole document will be fine.
The Zotero documentation offers the basic information on how to edit CSL styles and how to get your new style into Zotero; here I assume that you’ve read that. (The lowdown: use the reference test pane to see the XML code of an existing style. Make it your own. Save it under a different name. Drag it onto Firefox to add it to Zotero.) Before I give the code snippets, it is probably useful to briefly outline what a CSL style looks like so that the code looks less terrifying.
Basic anatomy of a CSL style
A CSL style is simply a file that you can edit in any text editor consisting of a number of different ‘blocks’ of information. The information is couched in terms of a relatively simple but powerful XML-based metalanguage called “Citation Style Language” or CSL for short.1 Every CSL style basically looks as follows. First, an info block providing the metadata for the style (author, name, url, type); then a lot of macros defining the building blocks; a citation block that determines what citations look like in your document; and finally a bibliography block.
<?xml version="1.0" encoding="UTF-8"?> <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" xml:lang="en"> <info> here goes the metadata </info> here go all the macros <citation> this block defines what a citation looks like </citation> <bibliography> this block defines what the bibliography looks like </bibliography> </style>
Initials vs. full first names
Some styles have initials, others have full first names. Some of the first have initials followed by a period, others without. Personally, I think it is not the best thing to abbreviate information that is crucial for disambiguation, but this is what does it:
The above form gives you “Gombrich, E.” Removing the period (i.e. having
initialize-with="") gives you “Gombrich, E”. Removing the option as a whole gives you “Gombrich, Ernst”. Note that in some styles, this setting is included in several macros (e.g. editor as well as author) so you might have to adjust it in several places.
Multiple entries by the same author
Some well-known styles (for example the Chicago Manual of Style) substitute subsequent recurrences of an author with three em-dashes. The highlighted line below is what does it:
<bibliography> ... <option name="subsequent-author-substitute" value="———"/> ... </bibliography>
If you don’t want that happening, simply remove this option from the bibliography block.
Some editors don’t like issue numbers. In the Chicago style, the issue number comes out of the locators macro, and it is generated by the following line:
<text variable="issue" prefix=", no. "/>
Deleting that line gets rid of the issue number.
Page number prefix for in-text citations
For page numbers in in-text citations, some styles want (Doe 2010:5), others (Doe 2010, 5) and yet others (Doe 2010: 5) (note the space before the page number in the latter case). This is controlled by the group delimiter in the citation block towards the end of the CSL style.
<citation> ... (basic options) ... <layout prefix="(" suffix=")" delimiter="; "> <group delimiter=": "> ... (contributors, date, locators) ... </group> </layout> </citation>
delimiter=": " yields (Doe 2010: 5), while
delimiter=", " yields (Doe 2010, 5), etc.
Some styles, like APA, have a setting for line-spacing built in. For APA it is “2” (i.e. double), but actually that is only the APA style for submitting manuscripts — for camera-ready copy, most publishers simply want normal line-spacing. Changing this is simple. Search for “line-spacing” and either set it to “0” or remove attribute+value altogether. You want to do the latter if you would like the bibliography to inherit the line-spacing settings of your document.
Do you want more information, or need to make further customizations? The Zotero documentation has a page giving a CSL syntax summary. The common options given on that page are probably most useful to start with. Also, Rintze Zelle has written a very nice CSL 1.0 primer. And don’t forget you can always ask for help in the Zotero forums. Loads of volunteer supporters there know more about CSL than I do.
3 responses to “Simple citation style edits: the power of CSL”
Thanks! I found the CSL specification to be hopelessly abstruse and the online tutorial simply did not contain enough information. You are a lifesaver!
Thanks for this introduction to CSL – a very friendly intro to CSL, which at first can appear quite imposing! In case you are looking for one, Qiqqa has a built-in CSL editor that lets you look at your style edits on-the-fly.
thanks for your helpful post. where /in which section do you insert the initialize with commadn? see also my qeustion at: http://support.mendeley.com/customer/portal/questions/216073-citation-styles-authors-initials
Thanks in advance!