Creating a Citation Style???

Is there anyway to create your own citation style within Zotero?

Cheers
«1
  • http://dev.zotero.org/creating_citation_styles
  • Thanks, I guess what I was really wondering if there was a simple way within ZOTERO to create a Citation template that you can apply to a manuscript.
  • Not currently. We would like to produce a GUI or other non-techy way of producing styles easily.

    The advantage of creating a CSL through the more technical methods is that that style can be then shared with other Zotero users, and indeed can serve as a template for citation styles in any other software that recognizes CSLs as well.
  • Would be nice if you guys updated your handling of CSL files to be more in the spirit of the spec. A simple example is the ID for a CSL style is a URI (as it is in Atom), but in the Zotero database it's a GUID. Can you not make that change now? You can then easily extend it later to load styles from URIs, etc.
  • Would be nice if you guys updated your handling of CSL files to be more in the spirit of the spec. A simple example is the ID for a CSL style is a URI (as it is in Atom), but in the Zotero database it's a GUID. Can you not make that change now?
    For 1.0, no. The latest upgrade exposed problems in mozStorage in Firefox 2.0, and we're going to do everything we can to avoid further database migrations until Firefox 3.0 is stable. The remaining releases up to 1.0 Final will be code-only changes.
  • edited August 23, 2007
    OK, but then it might make sense to include in the documentation a suggestion that if people do want to work on their own styles, they are as careful about the ID URI on the style file as they are on the GUID for Zotero. I suppose an easy approach is to reserve a URI space for this (say http://zotero.org/styles/), and append the GUID to it?

    Just a thought ...
  • Also, I don't really think I was asking you to make any database schema changes. Was just suggesting you store the URI ID in that existing column, rather than an otherwise meaningless (in the sense that it has no connection to the CSL instance) non-URI GUID. [of course, there may be something in the schema definition that precludes that]
  • The main thing holding up my using Zotero is the absence of any styles for my field (political science). I'm tempted to try to write my own style, but have never programmed in XML before. Two questions: is there somewhere I could see examples of the existing styles in CSL (other than running sqllite and extracting them)? And, anyone have some idea how much of a time sink this is likely to be (I used to program in java)?

    Thanks, Peter
  • peterm: see the APA example.

    It might be a little learning curve to understand XML and using a validating editor like oXygen or emacs nxml mode, but it's a skill that's broadly useful and transferable. Beyond that, there's also some learning curve in CSL. I can't tell you if that will constitute a "time sink" or not.

    I suppose a test is to see if you can adapt the APA style, using the csledit.xul previewer that has been mentioned elsewhere on the forums. If you feel you're making progress, follow through; if not, post the style you want on the forums and hopefully someone will get to it.
  • Thanks bdarcus, that's very helpful! Whew, now to find the time....
  • Bruce: we are using the style URI in the ID column for CSLs, as we always have.
  • edited September 1, 2007
    Simon: ok, good.

    But then why does the documentation include the sentence "‘cslID’: a GUID to uniquely identify the CSL — you can use an online GUID generator to create one"?

    While a GUID can be helpful to create the style URI, that per se is not enough. I'd suggest tweaking that to be more clear.
  • But then why does the documentation include the sentence "‘cslID’: a GUID to uniquely identify the CSL — you can use an online GUID generator to create one"?
    My mistake—must've copied that over from the translator documentation. Fixed.
  • Hi,

    I was also wondering about custom output styles : not being a developer, i am quite unsure how to write my own output style - let alone adding it to the Zotero SQLite database.

    Is anyone willing to help me out here - all i want is a really simple output style as such shown below.

    (in text citations)

    [1] or [2,3] or [4,5,6,7]

    (bibliography)
    [1]
    Authornames; year; title; journal; volume; pages.

    [2]
    Authornames; year; title; journal; volume; pages.

    Thanks
    Andy
  • Hi again,

    I have had a look at the CSL documentation, could someone post an example of a CSL document and a view of how the citation and bibliography looks in the article - to help me understand how the information in the CSL documentation relates to the actual CSL document i want to write and how this would relate to what the final view in after applying the output style...

    that would be great thanks!
    Andy
  • The best way to do this is by using the editable preview enabled by chrome://zotero/content/tools/csledit.xul.
  • Wow, this is very cool. I haven't seen it mentioned before. Note that in Win XP/FF 2.0.0.7 the pulldown menu is about 4 pixels high. It works, but it's easy to miss.
  • edited September 19, 2007
    Note that in Win XP/FF 2.0.0.7 the pulldown menu is about 4 pixels high. It works, but it's easy to miss.
    It's tiny in my FF on Linux (Gentoo) as well, and I did miss it initially. But it's a very nice tool that is helping me read the CSL. Thank you.
  • that is great!! Thanks for posting that link Dan

    Regards
    Andy
  • Hi Dan,

    Thanks to that link I have managed to make myself an output style and successfully added it to the sqlite db.

    I wanted to add the 'Extra' field that contains PMID numbers (for references taken from pubmed)

    but I don't know what the name of this variable is

    <bibliography>
    <layout>
    <text variable="citation-number" suffix=". "/>
    <text variable="extra"/>
    </layout>
    </bibliography>

    but this does not add the information, does the extra field have another name??

    Thanks
    Andy
  • edited September 19, 2007
    The Extra field isn't actually accessible in CSLs, since it's not a standard field that would be defined in the CSL spec.
  • edited September 19, 2007
    Just a warning to those using csledit.xul: in rc3, only the APA style and the new number-based styles (Nature, NLM, and IEEE) are using the new schema, and some subtle modifications have been made in the dev builds since then. Support for the old schema will be dropped in 1.0. The development version of Zotero also includes a version of MLA reformulated in the new schema.
  • Too bad. I was wondering if the Extra field might be a place for the interim storage of details (about the original edition of a published book, say) which might need to make it into my bibliography, but which currently has no place in the data model. It all will be sorted out when the relational data model is worked out, I expect. But I was looking for a short-term hack. It would probably have been hard to implement anyway.
  • In CSL, the "note" variable is intended to work as in BibTeX, and so *might* be an appropriate target for the "extra" field. I never did have any idea what "extra" is anyway ;-)
  • -----------
    Dan Wrote:
    "The Extra field isn't actually accessible in CSLs, since it's not a standard field that would be defined in the CSL spec."
    -----------

    Gaaaaaa!!! That's really annoying!

    Can anyone think of a work around to be able to output the info from the extra field (I really need to be able to output the PMIDs)

    Thanks
    Andy
  • Note that in Win XP/FF 2.0.0.7 the pulldown menu is about 4 pixels high.
    Fixed on the branch. Thanks.
  • Sorry - totally new to styles and sqlite. I managed to create a style using csledit.xul based on the Nature style and it worked in the editor. By help of the scrapers.sql, referred to as an example, I have then created a text file:
    REPLACE INTO csl VALUES('url', '2007-09-24 15:15:00', 'Clinical Infectious Diseases',
    '<?xml version="1.0" encoding="UTF-8"?>
    <?oxygen RNGSchema="../csl.rnc" type="compact"?>........</style>');
    And inserted the new style. I changed the title and date - but what about the url for this local style? The file inserts into zotero.sqlite but no new style turns up in zotero.

    Can you help me? Thanks - Chris
  • The URI is the ID for the style. You have to make sure it is unique and stable. Otherwise, Zotero will probably think it's the same as an existing style. If you're not sure how to do that under a domain of your own control, you can always follow this advice.
  • Thanks, bdarcus!

    I got it working - I actually find the csledit.xul easier to work with than the style editor in e.g. ReferenceManager. I have, however, still one problem: the in-text citations appear as e.g. [1; 2; 3; 4] but preferably it should be [1-4]. More complex combinations also often arise: [1; 2; 3; 6] - should be: [1-3; 6].
    Do you have some code for these conditional situations?

    Chris
  • If you're running rc3, no. If you're running the latest version from SVN or the development XPI, then, or a numbered citation style, you probably want:

    <citation>
    <option name="collapse" value="citation-number"/>
    <sort>
    <key variable="citation-number"/>
    </sort>
    <layout>
    (...)
    </layout>
    </citation>

    If you upgrade to the development XPI, you'll also need the latest version of the Word integration extension/template for your OS and word processor.
Sign In or Register to comment.