modifying a style to include in-text page numbers

I need to modify an in-text citation style to include the reference number and page when the cited material is a quote.

For example: According to Doe, "blah, blah, blah".[1 p. 234]

My current style doesn't include page numbers when I add them to the Zotero Citation Edit page field.

This is the citation CSL for the current style:

<citation>
<option name="collapse" value="citation-number"/>
<sort>
<key variable="citation-number"/>
</sort>
<layout prefix="[" suffix="]" delimiter=",">
<text variable="citation-number"/>
</layout>
</citation>

I made the following modification in hope that I could get what I want:

<citation>
<option name="collapse" value="citation-number"/>
<sort>
<key variable="citation-number"/>
</sort>
<layout prefix="[" suffix="]" delimiter="," vertical-align="baseline">
<text variable="citation-number" />
<group prefix=", p. ">
<label variable="locator" form="short"/>
<text variable="locator"/>
</group>
</layout>
</citation>


However, not only do I not get the page numbers after the citation; it seems that my layout information is ignored because the citation number is in superscript.

If I use a style that includes in-text page numbers the page numbers that I add to the Citation Edit page field are properly inserted.

Thank you in advance for your comments on my attempt.
  • are you sure your style is "in-text"?
    I.e. have you double checked that you have
    <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" xml:lang="en">
    at the top of they style?

    What you describe sounds odd, frankly: There is no reason Zotero would superscript the citation number. There is also no reason it should leave out the locator for the citation section you have - which looks good (although you probably don't want both p. in the prefix and "label variable" - this will give you p. p 32 instead of p. 32).
    Have you tried this in the test pane? How does it look there?
  • Thank you for the quick reply. This has been driving me batty.

    I made a few changes and the citation and formatting is now correct. Wonderful!

    For example:
    "Knowledge is of two kinds. We know a subject ourselves, or we know where we can find information upon it."
    --Samuel Johnson, quoted by James Boswell [1, p.143]


    The corrected citation section now is:

    <citation>
    <option name="collapse" value="citation-number"/>
    <sort>
    <key variable="citation-number"/>
    </sort>
    <layout prefix="[" suffix="]" delimiter="," vertical-align="baseline">
    <text variable="citation-number" />
    <group prefix=", ">
    <label variable="locator" form="short" include-period="true" />
    <text variable="locator"/>
    </group>
    </layout>
    </citation>

    At the top of the style was:
    <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" xml:lang="en">

    To clarify:
    The style name wasn't "in-text" I was trying to describe a citation in the body of the text instead of something related to the bibliography/reference list. I'm using a modified version of Vancouver style for the journal Injury Prevention.

    I'm not sure how to check this using the test pane. (I have been saving the csl file and installing it with each change and viewing the result in my manuscript.) The Zotero record has the full citation information but the body-citation that I added includes the specific page where the quotation was found.
  • Cool, please make the style available once you're done.
    Here is the Zotero test pane:
    chrome://zotero/content/tools/csledit.xul
    it's absolutely indispensable for modifying styles, I admire you for having made it so far without it.
  • I have tried a few times to sign up on SVN/Trac Access but I have never been approved. (I know, I probably shouldn't have tried to sign on more than once but the guidance on the sign on screen is telegraphic and I didn't know if I might be recognized as a contributor and allowed to log in.)

    I will be pleased to share my Injury Prevention journal style. Is there another way to submit it?
  • Whether initiated by my comment above or by coincidence i just received authorization to access SVN/Trac . (Thank you.) However, I can't find how to submit a style. I'm going to provide it here. This meets the requirements for the BMJ Group journal Injury Prevention.

    I'm going to provide it here.

    <?xml version="1.0" encoding="UTF-8"?>
    <?oxygen RNGSchema="http://xbiblio.svn.sourceforge.net/viewvc/*checkout*/xbiblio/csl/schema/trunk/csl.rnc" type="compact"?>
    <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" xml:lang="en">
    <info>
    <title>Injury Prevention</title>
    <id>http://www.zotero.org/styles/injuryprevention</id>;
    <link href="http://www.zotero.org/styles/injuryprevention"/>
    <author>
    <name>Julian Onions</name>
    <email>julian.onions@gmail.com</email>
    </author>
    <author>
    <name>Michael Berkowitz</name>
    <email>mberkowi@gmu.edu</email>
    </author>
    <contributor>
    <name>David Lawrence</name>
    <email>david.lawrence@sdsu.edu</email>
    </contributor>
    <category term="numeric"/>
    <category term="medicine"/>
    <category term="public_health"/>
    <category term="sociology"/>
    <updated/>
    <summary>The Injury Prevention (a BMJ Group journal) style is a modified and hybrid version of Vancouver and AMA styles: In-text citation =square brackets, collapsed. Bibliography- doi strings always when available; special punctuation and spacing; first author and journal volume bold; journal abbreviation italics; authors et. al four or more; year-only date; page numbers for quotations via add/edit citation dialog b ox.</summary>
    <link href="http://injuryprevention.bmj.com/site/about/guidelines.xhtml"/>
    </info>
    <macro name="editor">
    <names variable="editor">
    <name name-as-sort-order="all" sort-separator=" " initialize-with="" delimiter=", " delimiter-precedes-last="always"/>
    <label form="short" prefix=", " text-case="lowercase" suffix="."/>
    </names>
    </macro>
    <macro name="anon">
    <text term="anonymous" form="short" text-case="capitalize-first"/>
    </macro>
    <macro name="author">
    <group suffix=".">
    <names variable="author">
    <name name-as-sort-order="all" sort-separator=" " initialize-with=""
    delimiter=", " delimiter-precedes-last="always"/>
    <label form="short" prefix=" " suffix="" text-case="lowercase"/>
    <substitute>
    <names variable="editor"/>
    <text macro="anon"/>
    </substitute>
    </names>
    </group>
    </macro>
    <macro name="author-short">
    <names variable="author">
    <name form="short" and="symbol" delimiter=", " initialize-with="."/>
    <substitute>
    <names variable="editor"/>
    <names variable="translator"/>
    <text macro="anon"/>
    </substitute>
    </names>
    </macro>
    <macro name="access">
    <group>
    <text value="Available at:" suffix=" "/>
    <text variable="URL"/>
    <group prefix=" (" suffix=")">
    <text term="accessed" text-case="lower" suffix=" "/>
    <date variable="accessed">
    <date-part name="month" suffix=" "/>
    <date-part name="day" suffix=", "/>
    <date-part name="year"/>
    </date>
    </group>
    </group>
    </macro>
    <macro name="title">
    <choose>
    <if type="book">
    <text variable="title" font-style="italic"/>
    </if>
    <else>
    <text variable="title"/>
    </else>
    </choose>
    </macro>
    <macro name="publisher">
    <group delimiter=": ">
    <text variable="publisher-place"/>
    <text variable="publisher"/>
    </group>
    </macro>
    <macro name="year-date">
    <group prefix=" ">
    <choose>
    <if variable="issued">
    <date variable="issued">
    <date-part name="year"/>
    </date>
    </if>
    <else>
    <text term="no date"/>
    </else>
    </choose>
    </group>
    </macro>
    <macro name="edition">
    <choose>
    <if is-numeric="edition">
    <group delimiter=" ">
    <number variable="edition" form="ordinal"/>
    <text term="edition" form="short" suffix="."/>
    </group>
    </if>
    <else>
    <text variable="edition" suffix="."/>
    </else>
    </choose>
    </macro>
    <citation>
    <option name="collapse" value="citation-number"/>
    <sort>
    <key variable="citation-number"/>
    </sort>
    <layout prefix="[" suffix="]" delimiter="," vertical-align="baseline">
    <text variable="citation-number" />
    <group prefix=", ">
    <label variable="locator" form="short" include-period="true" />
    <text variable="locator"/>
    </group>
    </layout>
    </citation>
    <bibliography>
    <option name="line-spacing" value="2"/>
    <option name="hanging-indent" value="false"/>
    <option name="et-al-min" value="4"/>
    <option name="et-al-use-first" value="3"/>
    <layout>
    <text variable="citation-number" prefix="" suffix=". "/>
    <text macro="author" suffix=""/>
    <choose>
    <if type="book">
    <group suffix=".">
    <text macro="title" prefix=" " suffix="."/>
    <text macro="edition" prefix=" " />
    <text macro="editor" prefix=" (" suffix=")"/>
    </group>
    <text prefix=" " suffix="" macro="publisher"/>
    <group suffix="." prefix="; ">
    <date variable="issued">
    <date-part name="year"/>
    </date>
    <text variable="page" prefix=":"/>
    </group>
    </if>
    <else-if type="chapter">
    <text macro="title" prefix=" " suffix="."/>
    <group class="container" prefix=" ">
    <text term="in" text-case="capitalize-first" suffix=": "/>
    <text macro="editor"/>
    <text variable="container-title" font-style="italic" prefix=" " suffix="."/>
    <text variable="volume" prefix="Vol " suffix="."/>
    <text macro="edition" prefix=" "/>
    <text variable="collection-title" prefix=" " suffix="."/>
    <group suffix=".">
    <text macro="publisher" prefix=" "/>
    <group suffix="." prefix=" ">
    <date variable="issued">
    <date-part name="year"/>
    </date>
    <text variable="page" prefix=":"/>
    </group>
    </group>
    </group>
    </else-if>
    <else>
    <group suffix=".">
    <text macro="title" prefix=" " />
    <text macro="editor" prefix=" "/>
    </group>
    <group class="container" prefix=" " suffix=".">
    <text variable="container-title" font-style="italic" form="short" suffix=""/>
    <group delimiter=";" prefix=" ">
    <date variable="issued">
    <date-part name="year"/>
    </date>
    <group>
    <text variable="volume" font-weight="bold"/>
    <text variable="issue" prefix="(" suffix=")"/>
    </group>
    </group>
    <text variable="page" prefix=":"/>
    <text variable="DOI" prefix=". doi:"/>
    </group>
    </else>
    </choose>
    <text prefix=" " macro="access" suffix="."/>
    </layout>
    </bibliography>
    </style>
  • Please post style code to a service like http://gist.github.com/, and post the link here. Apart from being harder to read without any indenting, style code can be corrupted by the forum display software.

    To submit styles directly, you should be able to check out a copy of the style archive with subversion, using a command like:

    svn co https://www.zotero.org/svn/csl all-csl-styles

    A starting place for reading up on the subversion version control system is the project site, hosted by the Apache people:

    http://subversion.apache.org/
  • Thanks for contributing this!.

    Before I or someone else submits this - would you consider adding the CC license?
    <rights>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License: http://creativecommons.org/licenses/by-sa/3.0/</rights>;
    right above </info>

    and the link to the style guide should have rel="documentation" after it
    <link href="http://injuryprevention.bmj.com/site/about/guidelines.xhtml" rel="documentation"/>
  • I have made the requested changes and the style is now available at:

    http://gist.github.com/549810/
  • thanks - it's committed and will show up on the repository soon.
    If you'll contribute more styles it will be worthwhile familiarizing yourself with validation - there were a couple of small glitches (that I fixed):

    - text-case has to be "lowercase" - just 'lower' doesn't work
    - the <rights> have to be above, not below </info>
    - their is no public_health category in the csl schema.
    Otherwise looks great and thanks again for contributing.
Sign In or Register to comment.