Professional Documents
Culture Documents
Citation Styles - Editing Step-By-Step (Zotero Documentation)
Citation Styles - Editing Step-By-Step (Zotero Documentation)
Upgrade Storage
Home
Web Library
Groups
Documentation
Forums
Get Involved
Search
You are here: start > dev > citation_styles > style_editing_step-by-step
Paste the style code into the Zotero CSL Editor, so you instantly see the effect of code changes on the
style output. If you make your edits directly in the test pane, save your edits often via your text editor
or using the “Save” button , as changes in the test pane get lost easily.
See the documentation page [http://citationstyles.org/citation-style-language/documentation/] of the CSL
project website for information on making CSL changes (in particular, make sure to take a look at the
CSL specification [http://citationstyles.org/downloads/specification.html]. Below we discuss a few common
and simple style edits to get you started.
The style title and ID are stored within the <title/> and <id/> elements near the top of the style. For
example,
can be changed to
The URLs that you put in as an ID do not have to exist (i.e., you can use a zotero.org/style/mystyle
type ID even if the style will not be posted on the Zotero repository).
Validation
Before installing a modified style, always make sure it is valid XML and CSL by validating against the
CSL schema [https://github.com/citation-style-language/styles/wiki/Validation].
Examples Edits
Changing Punctuation
In this example, we want to display the publisher (“CSHL Press”) and the location of the publisher
(“Cold Spring Harbor, NY”) in a bibliographic entry. While this can be achieved with the code
<text variable="publisher"/>
<text variable="publisher-place"/>
this would result in “CSHL PressCold Spring Harbor, NY”. Fortunately, we can add some punctuation with
the prefix, suffix and delimiter attributes. Let's say we want to separate the publisher and
publisher-place by a comma-space, and wrap the whole in parentheses, i.e. “(CSHL Press, Cold
Spring Harbor, NY)”. This can be done with:
The advantage of use a group element is that whenever you have a publisher, but no publisher-
place, you don't end up with incorrect punctuation: the output would become “(CSHL Press)”. If you
would set the punctuation directly onto the text elements, e.g.
In CSL, these settings can appear on the style, citation, bibliography or names elements in the
form of the et-al-min and et-al-use-first attributes (it is possible to have separate settings for
items that have been cited previously by using the et-al-subsequent-min and et-al-
subsequent-use-first attributes).
For example,
will result in name lists like “Doe”, “Doe & Smith” and, if there are three or more names, “Doe et al.”.
Try changing these numbers and observe the effect.
Changing Disambiguation
CSL offers multiple methods to disambiguate cites or names. For example, a style might normally
render only the family name (e.g., “(Doe 1999, Doe 2002)”). If the authors are Jane Doe and Thomas
Doe, these names can be disambiguated by adding initials or the full given names (e.g., “(J. Doe 1999,
T. Doe 2002)”).
Disambiguation methods are selected on the citation element. For example, to disable given name
disambiguation, delete the disambiguate-add-givenname attribute, e.g. change
<citation disambiguate-add-givenname="true">
...
</citation>
to
<citation>
...
</citation>
Separation of authors
By default several authors are separated by a delimiter , and the word and. This settings can be
changed, for example to use the symbol & instead:
<names variable="author">
<name form="short" and="symbol" delimiter=", "/>
...
</names>
<names variable="author">
<name form="short" delimiter="/"/>
..
</names>
The appearance of citations in (full) footnote styles may depend on their position in the paper. If the
same source is cited twice, it may be that a shortened version is used in the second (and any further)
citation. To handle this distinction, one can use conditional rendering based on the position
[http://citationstyles.org/downloads/specification.html#choose] of the citation. A generic structure could then
look as
<citation>
<layout>
<choose>
<if position="ibid-with-locator">
...
</if>
<else-if position="ibid">
...
</else-if>
<else-if position="subsequent">
...
</else-if>
<else>
...
</else>
</citation>
</layout>
</citation>
If a case is missing in your style, you can add that and fill out what and how the information should be
rendered in that case (an example of such a full footnote style [https://www.zotero.org/styles/chicago-
fullnote-bibliography?source=1]).
Save the style with a “.csl” file extension (you can generally do this by simply typing ”.csl” after the
name of your file). Then, go to the Cite pane in the Zotero preferences. Click on the “+” sign below the
list of installed styles. In the file selection dialogue that opens, navigate to the .csl file you just created
and open it. This will install your new style into the Zotero data directory.
4 - Sharing Styles
If you think that your modified style might be useful to other people, consider submitting
[https://github.com/citation-style-language/styles/blob/master/CONTRIBUTING.md] it to the Zotero Style
Repository.
Getting Help
If you get stuck at any point, try posting a question on the Zotero forums.
−Table of Contents
dev/citation_styles/style_editing_step-by-step.txt · Last modified: 2023/01/07 17:37 by dstillman
Blog
Forums
Developers
Support
Privacy
Get Involved
Jobs
About
Zotero is a project of the Corporation for Digital Scholarship, a nonprofit organization dedicated to the
development of software and services for researchers and cultural heritage institutions, and is
developed by a global community.