Translations of this page:

We’re in the process of updating the documentation for Zotero 5.0. Some documentation may be outdated in the meantime. Thanks for your understanding.

Citation Styles

Citation Formatting in Zotero

Zotero有多种方法生产引文和参考文献目录。它们可以在字处理软件 (Word,OpenOffice)中自动生成,也可以通过 Quick Copy 或者 RTF Scan来完成。而 引文格式语言 (CSL) 就是这一切得意工作的基础,Zotero基于该语言生成引文和参考文献目录。

CSL 是独立于Zotero之外的一个开源项目,不过 CSL 和 Zotero 之间存在密切联系。因为 Zotero 中有超过 1500 个 CSL 样式可供使用。 此外,Zotero 通过另外一个开源项目citeproc-js来处理 CSL 样式,以便将正确的引文格式展示出来。确切的说,是 citeproc-js 在格式化引文,Zotero 要做的只是提供一个平台(即citeproc-node)。

下面我们介绍一下如何编辑一个 CSL 文件。

Editing CSL Styles

CSL 文件事实上是由 XML 写成的。你可以使用任意一个文本编辑器来编辑它(如记事本)。

为了方便调试 CSL 文件,Zotero 自带了两个测试工具。

  • The Zotero Reference Test pane. 在 Firefox 浏览器地址栏中输入 "chrome://zotero/content/tools/csledit.xul" 访问,该工具实时展示在 Zotero 中选定条目的引文格式。
  • The Zotero Preview pane. 在 Firefox 浏览器地址栏中输入 "chrome://zotero/content/tools/cslpreview.xul" 访问,该工具会把你选定的条目以所有你已经安装的样式展示出来。

The CSL 0.8.1 to 1.0 Upgrade

Zotero 2.1 is the first release to support CSL 1.0 (through citeproc-js). Earlier versions (up to Zotero 2.0.9) supported CSL 0.8.1 through an in-house developed CSL processor.

All the styles in the Zotero Style Repository have been upgraded from CSL 0.8.1 to 1.0. The Zotero Style Repository now draws it styles from the GitHub CSL 1.0 style repository instead of from the Zotero SVN. If you have a customized style that is not in the repository and is still in the 0.8.1 format, you can continue using it: Zotero 2.1 and newer still accept CSL 0.8.1 styles and convert them internally to CSL 1.0. However, if you want to take full advantage of the new features of CSL 1.0, consider upgrading your style.

CSL 0.8.1 and 1.0 styles can be easily distinguished by looking at the cs:style element at the top of the style. CSL 1.0 styles include a version attribute on this element with a value of “1.0”, e.g. “<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0">”. CSL 0.8.1 styles lack the version attribute.

Editing CSL 1.0 Styles

请参考下列资源:

Editing CSL 0.8.1 Styles

请参考下列资源:

Validation

When editing a CSL style, it is crucial to verify whether the finished style is valid XML and conforms to the CSL schema. This ensures that Zotero can install the style and process it correctly. Fortunately, there are several XML validation tools with support for the RELAX NG Compact schema language. These include the editors Emacs (when using the nXML addon) and oXygen XML Editor (both offer real-time validation), and the command-line utilities RNV and Jing. However, especially for infrequent use, the easiest option might be the online XML validator Validator.nu. To validate a style using this website:

  1. Select the style you want to validate. When using “Address” option, provide the URL to the style. With “File Upload”, select the style file on your computer. With “Text Field”, paste the style code into the text box.
  2. Enter the URL to the CSL schema file in the “Schemas” text field. For CSL 1.0, this is “https://github.com/citation-style-language/schema/raw/v1.0/csl.rnc”. For CSL 0.8.1, this is “https://github.com/citation-style-language/schema/raw/v0.8.1/csl.rnc”.
  3. Check the “Be lax about HTTP Content-Type” check-box and select the “XML; don't load external entities” option in the “Parser” drop-down menu.
  4. Click the “Validate” button. If the style is correct, you will get the message “The document validates according to the specified schema(s) and to additional constraints checked by the validator.”. Only errors are important, warnings can be ignored.

Installing and Deleting Styles

CSL styles can be installed either via the Firefox File menu (select “Open File…”) or by dragging and dropping the style into an open browser window. Styles can also be added via the Style Manager in the Zotero preferences, located on the Styles tab of the Cite tab. Styles can also be deleted via the Style Manager. Finally, if you are hosting CSL styles online, serving the styles with a “text/x-csl” MIME type will allow Zotero to automatically install the style.

Contributing CSL Styles

For information on how to distribute CSL styles, see the information on sharing styles.

Translating CSL Locales

CSL locale files allow for easy, automatic localization of citations and bibliographies generated with CSL styles. For more information about CSL locales, to see the current status of translation, and to learn how you can contribute to these translations, see the localization section.

Diving Deeper

CSL and citeproc-js

To learn more about CSL, visit the CSL project home and the xbiblio mailing list. For more information about the citeproc-js CSL processor, see the citeproc-js code repository, integrator's manual, and mailing list.

citeproc-node

citeproc-node allows citeproc-js to be deployed on a server. See the citeproc-node installation instructions.