Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dev:citation_styles:style_editing_step-by-step [2015/01/08 07:20] – [Manually Editing CSL styles] zuphilipdev:citation_styles:style_editing_step-by-step [2023/01/07 17:37] (current) – [3 - Install your Edited Style with Zotero] dstillman
Line 14: Line 14:
 Start by checking the [[/styles|Zotero Style Repository]]. If you want to improve an existing CSL style, make sure that you start from the most recent version (the repository shows the date and time each style was last updated). If you want to create a new style, find the style that most closely matches what you need using the previews in the style repository. Start by checking the [[/styles|Zotero Style Repository]]. If you want to improve an existing CSL style, make sure that you start from the most recent version (the repository shows the date and time each style was last updated). If you want to create a new style, find the style that most closely matches what you need using the previews in the style repository.
 Typically the best way to find a most similar style is the "[[http://editor.citationstyles.org/searchByExample/|search by Example]]" function of the visual style editor.  Typically the best way to find a most similar style is the "[[http://editor.citationstyles.org/searchByExample/|search by Example]]" function of the visual style editor. 
- 
-**Important** If you have ever used Zotero 2.0 or an earlier version on your computer, your [[/support/zotero_data|Zotero data directory]] probably still contains styles in the CSL 0.8.1 format. While Zotero 2.1 and newer still supports this older format, it is strongly recommended to always start with an up-to-date style CSL 1.0 style from the [[/styles|Zotero Style Repository]], or, if you want to make changes to a CSL 0.8.1 style not present in the style repository, to first [[http://citationstyles.org/downloads/upgrade-notes.html#updating-csl-0-8-styles|update it to CSL 1.0]]. 
  
 ==== 2 - Edit the Style ==== ==== 2 - Edit the Style ====
Line 21: Line 19:
 Download the style you want to edit to your computer, and open it in a (plain) text editor like Notepad on Windows, TextEdit on Mac OS X (select "Make Plain Text" under "Format"), or gedit in Linux. Other options are [[http://notepad-plus-plus.org/|Notepad++]] for Windows, [[http://www.barebones.com/products/TextWrangler/|TextWrangler]] for Mac OS X, [[http://www.oxygenxml.com/|oXygen XML Editor]], [[http://www.thaiopensource.com/nxml-mode/|Emacs in nXML mode]], and [[http://www.jedit.org/|jEdit]], which all support XML syntax highlighting (CSL is an XML-based language) and in some cases also real-time [[https://github.com/citation-style-language/styles/wiki/Validation|validation against the CSL schema]]. Download the style you want to edit to your computer, and open it in a (plain) text editor like Notepad on Windows, TextEdit on Mac OS X (select "Make Plain Text" under "Format"), or gedit in Linux. Other options are [[http://notepad-plus-plus.org/|Notepad++]] for Windows, [[http://www.barebones.com/products/TextWrangler/|TextWrangler]] for Mac OS X, [[http://www.oxygenxml.com/|oXygen XML Editor]], [[http://www.thaiopensource.com/nxml-mode/|Emacs in nXML mode]], and [[http://www.jedit.org/|jEdit]], which all support XML syntax highlighting (CSL is an XML-based language) and in some cases also real-time [[https://github.com/citation-style-language/styles/wiki/Validation|validation against the CSL schema]].
  
-Paste the style code into the [[/support/dev/citation_styles/reference_test_pane|Zotero Reference Test pane]], 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 {{:dev/citation_styles/csledit-save.png}}, as changes in the test pane get lost easily.+Paste the style code into the [[/support/dev/citation_styles/reference_test_pane|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 {{:dev/citation_styles/csledit-save.png}}, as changes in the test pane get lost easily.
  
 See the [[http://citationstyles.org/citation-style-language/documentation/|documentation page]] of the CSL project website for information on making CSL changes (in particular, make sure to take a look at the [[http://citationstyles.org/downloads/specification.html|CSL specification]]. Below we discuss a few common and simple style edits to get you started. See the [[http://citationstyles.org/citation-style-language/documentation/|documentation page]] of the CSL project website for information on making CSL changes (in particular, make sure to take a look at the [[http://citationstyles.org/downloads/specification.html|CSL specification]]. Below we discuss a few common and simple style edits to get you started.
 +
 +=== Change the Style Title and ID ===
 +
 +**Important:** Before installing your edited style, you must change the style title and ID at the top of the style code. If you don't change these, your modified style will be overwritten the next time the original style is updated.
 +
 +The style title and ID are stored within the ''<title/>'' and ''<id/>'' elements near the top of the style. For example,
 +
 +<code><title>American Psychological Association 6th edition</title>
 +<title-short>APA</title-short>
 +<id>http://www.zotero.org/styles/apa</id></code>
 +
 +
 +can be changed to
 +
 +<code><title>American Psychological Association 6th edition Modified</title>
 +<title-short>APA</title-short>
 +<id>http://www.zotero.org/styles/apa-modified</id></code>
 +
 +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 [[https://github.com/citation-style-language/styles/wiki/Validation|validating against the CSL schema]].
  
 === Examples Edits ==== === Examples Edits ====
Line 88: Line 109:
   ...   ...
 </citation> </citation>
 +</code>
 +
 +
 +==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:
 +
 +<code xml>
 +<names variable="author">
 +  <name form="short" and="symbol" delimiter=", "/>
 +  ...
 +</names>
 +</code>
 +
 +or to not use ''and'' at all, but to use the delimiter ''/'':
 +
 +<code xml>
 +<names variable="author">
 +  <name form="short" delimiter="/"/>
 +  ..
 +</names>
 </code> </code>
  
 == Conditional Rendering (full footnote style) == == Conditional Rendering (full footnote style) ==
  
-The appearance of citations in (full) footnote styles may depend on the position in the paper. If the same source is cited twice it may be that the second time only shorter version is used. To handle this distinctions one can use [[http://citationstyles.org/downloads/specification.html#choose|conditional rendering based on the position]] of the citation. A generic structure could then look as+The appearance of citations in (full) footnote styles may depend on their position in the paper. If the same source is cited twiceit may be that a shortened version is used in the second (and any further) citation. To handle this distinction, one can use [[http://citationstyles.org/downloads/specification.html#choose|conditional rendering based on the position]] of the citation. A generic structure could then look as
  
 <code xml> <code xml>
Line 115: Line 157:
 </code> </code>
  
-If a case is missing in your style, then you can add that and fill out what and how the information should be rendered in that case (<a href="https://www.zotero.org/styles/chicago-fullnote-bibliography?source=1">an example of such a full footnote style</a>).+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 ([[https://www.zotero.org/styles/chicago-fullnote-bibliography?source=1|an example of such a full footnote style]]).
  
-=== Change the Style Title and ID ===+==== 3 - Install your Edited Style with Zotero ====
  
-Before installing your edited style, change the title and ID of your style if you don't want your modified style to overwrite the original style. +See [[/support/styles|Citation Styles]].
- +
-The style title and ID are stored within the ''<title/>'' and ''<id/>'' elements near the top of the style. For example, +
- +
-<code><title>Harvard Reference format 1 (Author-Date)</title>  +
-<id>http://www.zotero.org/styles/harvard1</id></code> +
- +
-can be changed to +
- +
-<code><title>Harvard Style Modified</title> +
-<id>http://www.zotero.org/styles/harvard-modified</id></code> +
- +
-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 [[https://github.com/citation-style-language/styles/wiki/Validation|validating against the CSL schema]]+
- +
-==== 3 - Install your Edited Style with Zotero ==== +
-===Zotero for Firefox=== +
-Save the style with a ".csl" file extension (you can generally do this by simply typing ".csl" after the name of your file) , and drag-and-drop the CSL style file onto an open Firefox browser window, and click the "Install" button (you can ignore the grey bar at the top of the window ("This XML style does not appear...")).+
  
-{{:style_install.png?600}}+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 [[/support/preferences/cite|Cite pane]] in the Zotero [[/support/preferences|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.
  
-===Zotero Standalone=== 
-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 [[/support/preferences/cite|"Cite" tab]] in the Zotero [[/support/preferences|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. 
 ==== 4 - Sharing Styles ==== ==== 4 - Sharing Styles ====
  
Line 151: Line 171:
 ==== Getting Help ==== ==== Getting Help ====
  
-If you get stuck at any point, try searching the [[/forum/|Zotero forums]], or, if that doesn't give an answer, post in the forum's [[/forum/11/|styles section]]. +If you get stuck at any point, try posting a question on the [[/forum/|Zotero forums]]. 
dev/citation_styles/style_editing_step-by-step.1420719636.txt.gz · Last modified: 2015/01/08 07:20 by zuphilip