'chap. ' appears in reference list from pages field
I am using a custom citation style that I created myself and I've discovered some weird behaviour in the reference list.
I have a report item in Zotero which has 'ch. 4' in the pages field because I want to reference a chapter rather than specific pages.
Surprisingly, when I look at my reference list for this item it comes up as 'chap. ch. 4'. That is, it adds the prefix 'chap. ' rather than adding 'p.' or not adding a prefix at all.
Is there a way to change this or take advantage of it?
I know I could just enter '4' in the pages field but then it will revert to 'p. 4'.
I'm assuming this is some sort of default behaviour because I don't have any code in my CSL file that refers to this. Below is the only code I use for the reference list that refers to pages:
I have a report item in Zotero which has 'ch. 4' in the pages field because I want to reference a chapter rather than specific pages.
Surprisingly, when I look at my reference list for this item it comes up as 'chap. ch. 4'. That is, it adds the prefix 'chap. ' rather than adding 'p.' or not adding a prefix at all.
Is there a way to change this or take advantage of it?
I know I could just enter '4' in the pages field but then it will revert to 'p. 4'.
I'm assuming this is some sort of default behaviour because I don't have any code in my CSL file that refers to this. Below is the only code I use for the reference list that refers to pages:
<macro name="pages">
<label variable="page" form="short" suffix=". " strip-periods="true"/>
<text variable="page"/>
</macro>
<macro name="edition">
<choose>
<if is-numeric="edition">
<group delimiter=" ">
<number variable="edition" form="ordinal"/>
<text term="edition" form="short" strip-periods="true"/>
</group>
</if>
<else>
<text variable="edition"/>
</else>
</choose>
</macro>
In the same line, have you validated the style? You can paste the code here to find out if there are syntax errors:
http://simonster.github.io/csl-validator.js/
stdin:139:12: error: missing attributes of http://purl.org/net/xbiblio/csl^label
required:
attribute ^variable
allowed:
attribute ^plural
attribute ^prefix
attribute ^font-style
attribute ^font-variant
attribute ^font-weight
attribute ^text-decoration
attribute ^vertical-align
attribute ^text-case
error: invalid input
I'm not exactly sure what this means or how to fix it?
But it isn't obvious to me that it has anything to do with the 'chap. ' issue.
Any thoughts?
<names variable="author">
<label form="short" prefix="" suffix=" ;" strip-periods="true"/>
<name form="short" name-as-sort-order="all" and="text" sort-separator=", " delimiter=", " delimiter-precedes-last="never" initialize-with="."/>
<substitute>
<names variable="editor"/>
<label form="short" suffix="" strip-periods="true"/>
<text macro="noauthor_title"/>
</substitute>
</names>
</else>
</choose>
</macro>
I don't know if this is going to fix the chap. issue, but invalid styles can produce all types of weird behavior.
@fbennet:
sample data and style are here:
https://gist.github.com/adam3smith/5522615
doesn't look like this depends on the style, though, anything that prints page numbers for reports (at a minimum) will do.
Unfortunately, I just installed the updated style file and I still get the 'chap. ' issue.
(P.S. I'm still not sure how to import a single field author using Zotero RDF. If you have a moment to help : https://forums.zotero.org/discussion/29213/import-an-zotero-rdf-citation-with-single-field-author/ )
This is a bug, obviously, but as you have noticed, it is potentially useful. Unfortunately, the feature that triggers the bug (which is useful) is not available in standard CSL.
In the CSL-m extension of CSL that is used in the Multilingual Zotero variant, "page" is a numeric variable, and must be set using cs:number rather than cs:text. If you make that change in your style, you should find that the localized "chap." label appears and that the shorthand label "ch." is removed, to give you "chap. 4". That's the intended behaviour, but unfortunately "pages" is not a numeric variable in standard CSL, so the modified style won't validate, and can't be distributed through the official CSL repository.
To eliminate confusion, I'll be fixing the processor to render "p. ch. 4" in this case, which is probably not what you want, but more correct under the standard CSL schema.