modifying citation format

16 views
Skip to first unread message

janwillem van dijk

unread,
Nov 4, 2007, 9:07:17 AM11/4/07
to zotero-dev, j.va...@nrg-nl.com
I have included a new citation format using the
"creating_citation_styles" page. It essentially is a modificated
"Nature" style. I have also added "callNumber" to the "zoteroFieldMap"
in cite.js. This all works (after some trial and error) fine. Now I
want in stead of a serial number "[Name Year]", e.g. [Rutherford
1952] replacing the "1." in "1. Rutherford, E. Chadwick, J. Ellis,
C.D. & Pool, M.L. Radiations from Radioactive Substances. American
Journal of Physics 20 (7), 459 (1952).". One option I thought of is to
add the "Name year" as callNumber but I do not see how to write an SQL
script that could do this automatically on the entire database or to
modify one of the many javascripts of Zotero for that purpose. Both my
experience with XML and related languages and with SQLite is very very
limited unfortunately.
Please some advise, many thanks, Janwillem.

Bruce D'Arcus

unread,
Nov 4, 2007, 9:26:25 AM11/4/07
to zoter...@googlegroups.com
On 11/4/07, janwillem van dijk <jwev...@xs4all.nl> wrote:

> Now I want in stead of a serial number "[Name Year]", e.g. [Rutherford
> 1952] replacing the "1." in "1. Rutherford, E. Chadwick, J. Ellis,
> C.D. & Pool, M.L. Radiations from Radioactive Substances. American
> Journal of Physics 20 (7), 459 (1952).".

I'm not understanding this. Can you explain again?

Bruce

janwillem van dijk

unread,
Nov 4, 2007, 11:43:33 AM11/4/07
to zotero-dev
Sorry,
In the main text of a book, with only one reference table for all
chapters, a reference will look like [Rutherford 1952]. In the table,
the references will be listed in alphabetical order as:
.....
.....
[Rutherford 1952] Rutherford, E. Chadwick, J. Ellis, C.D. & Pool, M.L.

Radiations from Radioactive Substances. American Journal of Physics 20
(7), 459 (1952).
.....
.....

How do I get this [lastName year] in the mystyle.csl script.
Essentially I do not see how I get the last name of the first author
as a separate item.


On 4 Nov, 15:26, "Bruce D'Arcus" <bdar...@gmail.com> wrote:

Bruce D'Arcus

unread,
Nov 4, 2007, 11:59:53 AM11/4/07
to zoter...@googlegroups.com, development discussion for xbiblio
janwillem van dijk wrote:

> In the main text of a book, with only one reference table for all
> chapters, a reference will look like [Rutherford 1952]. In the table,
> the references will be listed in alphabetical order as:
> .....
> .....
> [Rutherford 1952] Rutherford, E. Chadwick, J. Ellis, C.D. & Pool, M.L.
> Radiations from Radioactive Substances. American Journal of Physics 20
> (7), 459 (1952).
> .....
> .....
>
> How do I get this [lastName year] in the mystyle.csl script.
> Essentially I do not see how I get the last name of the first author
> as a separate item.

Ah, the last name of the first author.

Well, you can use a "form" attribute value of "short" for the first part.

For the second, we've never explicitly looked at an example like this;
there's nothing explicit in CSL about a first author.

I'm actually not sure we could do this, and we'll probably need some
changes in the schema and in the Zotero code.

At first I thought you might just set the et-al rules options for "1"
and "1", but that applies globally to a particular context (say a
citation), while you want to be able to use it in the bibliographic list
too (as the label).

One option might be something like:

<macro name="citation-label">
<names variable="first-author" form="short" suffix=" "/>
<date>
...
</date>
</macro>

... and then call that macro from the respective places.

My only worry about a variable like "first-author" is it might be too
inflexible.

With that in mind, perhaps this would be better?

<names variable="author" use-first="1" form="short" suffix=" "/>

Anyone have any opinions or better ideas?

Bruce

janwillem van dijk

unread,
Nov 4, 2007, 2:16:23 PM11/4/07
to zotero-dev
Thanks, this helped me halfway. I added the macro:
<macro name="citation-label">
<names variable="first-author" form="short" prefix="["
suffix=" "/>
<date variable="issued" suffix="] ">
<date-part name="year"/>
</date>
</macro>

and in the <bibliography> section
<text macro="citation-label"/>

The result is:


1952] Rutherford, E. Chadwick, J. Ellis, C.D. & Pool, M.L. Radiations
from Radioactive Substances. American Journal of Physics 20 (7), 459
(1952).

So I do not get the [name part. The second option for <names ..../>
makes no difference.
Any further suggestions very welcome.

Bruce D'Arcus

unread,
Nov 4, 2007, 2:27:25 PM11/4/07
to zoter...@googlegroups.com, development discussion for xbiblio
janwillem van dijk wrote:
> Thanks, this helped me halfway. I added the macro:
> <macro name="citation-label">
> <names variable="first-author" form="short" prefix="["
> suffix=" "/>
> <date variable="issued" suffix="] ">
> <date-part name="year"/>
> </date>
> </macro>
>
> and in the <bibliography> section
> <text macro="citation-label"/>
>
> The result is:
> 1952] Rutherford, E. Chadwick, J. Ellis, C.D. & Pool, M.L. Radiations
> from Radioactive Substances. American Journal of Physics 20 (7), 459
> (1952).
>
> So I do not get the [name part. The second option for <names ..../>
> makes no difference.

Right, because (among other things) it's not valid. I was thinking
through ways to change CSL to accommodate what you want; it's doesn't now.

Bruce

Rob Hudson

unread,
Nov 4, 2007, 4:04:06 PM11/4/07
to zoter...@googlegroups.com
So is there an easy way to modify the bibliography output to include
the "Notes" field at the end of each bib entry? I don't mind mucking
about with code a little bit to accomplish this.

If I can get notes out after bib entries then I can avoid Endnote entirely.


--
Rob Hudson
PhD Student, Technical Comm. and Rhetoric
Composition Assessment Software Developer
Texas Tech University
www.iteachwriting.com

janwillem van dijk

unread,
Nov 4, 2007, 4:05:12 PM11/4/07
to zotero-dev
So my best option is the work-around by manually putting "Rutherford
1952" in callNumber and using the modification of cite.js ??
This gives:
[Rutherford 1952] Rutherford, E. Chadwick, J. Ellis, C.D. & Pool, M.L.

Radiations from Radioactive Substances. American Journal of Physics 20
(7), 459 (1952).

janwillem van dijk

unread,
Nov 4, 2007, 4:37:38 PM11/4/07
to zotero-dev
Yes.
Add in cite.js (approx line 1517) the line:
"extra":"extra",
Mind that all entries but the last end with a comma.

Then add in the csl:
<text variable="extra"/>

My example now becomes:
[Rutherford 1952] Rutherford, E. Chadwick, J. Ellis, C.D. & Pool, M.L.


Radiations from Radioactive Substances. American Journal of Physics 20
(7), 459 (1952).

This a 5 line note in the field "Extra".
It starts for cosmetic reasons with a new line.
There is possibly a better solution for that
using prefix="newline" but i do not know
The right coding for that.

I hope that helps,
Janwillem


On 4 Nov, 22:04, "Rob Hudson" <caveat...@gmail.com> wrote:
> So is there an easy way to modify the bibliography output to include
> the "Notes" field at the end of each bib entry? I don't mind mucking
> about with code a little bit to accomplish this.
>
> If I can get notes out after bib entries then I can avoid Endnote entirely.
>

Bruce D'Arcus

unread,
Nov 4, 2007, 4:38:51 PM11/4/07
to zoter...@googlegroups.com
Rob Hudson wrote:
> So is there an easy way to modify the bibliography output to include
> the "Notes" field at the end of each bib entry?

I'm not sure; you'd have to ask Simon.

But you can always try this style and see what happens:

<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text">
<info>
<id>http://ex.net/1</id>
<title>test</title>
<updated>2007-11-04T06:36:07+00:00</updated>
</info>
<citation>
<layout>
<text variable="title"/>
<text variable="annote"/>
</layout>
</citation>
</style>

Bruce

Rob Hudson

unread,
Nov 4, 2007, 4:39:57 PM11/4/07
to zoter...@googlegroups.com
So "extra" maps to the note attachment in each bib item?

Bruce D'Arcus

unread,
Nov 4, 2007, 4:43:20 PM11/4/07
to zoter...@googlegroups.com
janwillem van dijk wrote:
> Yes.
> Add in cite.js (approx line 1517) the line:
> "extra":"extra",
> Mind that all entries but the last end with a comma.
>
> Then add in the csl:
> <text variable="extra"/>

No, that is NOT valid!

Please, make sure to validate your styles, and certainly do not make
suggestions to others that are not based on confirming your suggestions
against the schema. How Zotero deals with the style is an entirely other
matter.

The CSL data model != the Zotero data model, and there is no such
variable as "extra" in CSL ("note" is probably analogous though).

As I said in another reply to Rob, the preferred variable for him should
be "annote."

Bruce

Rob Hudson

unread,
Nov 4, 2007, 4:53:25 PM11/4/07
to zoter...@googlegroups.com
Tried to add annote with a new style in the CSL and also tried to add
it to the MLA citation style.

Neither worked. The new style wouldn't let me create a bib even though
it appeared in the list of options, and the MLA style ignored, I
presume, the annotation, which was tagged as a note and is attached to
the bib.

--

Rob Hudson

unread,
Nov 4, 2007, 5:00:30 PM11/4/07
to zoter...@googlegroups.com
Fixed the new style by wrapping it in the same tags the others were.
But "annote" comes out empty. Is this an element that isn't in CSL?
How do I map this from Zotero to the output?

It's frustrating that notes come out fine in the report but they can't
be munged for the bib.

Bruce D'Arcus

unread,
Nov 4, 2007, 5:05:42 PM11/4/07
to zoter...@googlegroups.com
On 11/4/07, Rob Hudson <cave...@gmail.com> wrote:
>
> Fixed the new style by wrapping it in the same tags the others were.
> But "annote" comes out empty. Is this an element that isn't in CSL?
> How do I map this from Zotero to the output?

I'm fairly ignorant of Zotero's code. What I can simply tell you is
that, in my view, Zotero's "note" and "extra" content ought to map to
CSL's "annote" and "note" variables respectively. I borrowed the names
from BibTeX; hopefully they're clear enough.

Bruce

Rob Hudson

unread,
Nov 4, 2007, 5:07:54 PM11/4/07
to zoter...@googlegroups.com
I like your view <g>. I just wish it were as obvious to map fields
into the CSL. Grrr!!

Rob Hudson

unread,
Nov 4, 2007, 5:09:16 PM11/4/07
to zoter...@googlegroups.com
From http://dev.zotero.org/csl_syntax_summary?rev=1192809366,

There is no mapping for annote and note. Grr.

Rob Hudson

unread,
Nov 4, 2007, 5:19:49 PM11/4/07
to zoter...@googlegroups.com
Changing cite.js with the extra tag just corrupted my Zotero install.
Had to re-do it.

Oh, well. Suppose I should just put in a suggestion to developers.
Wish there was a way to get out that Extra field or the Notes.

Dan Stillman

unread,
Nov 4, 2007, 5:39:25 PM11/4/07
to zoter...@googlegroups.com
On 11/4/07 5:09 PM, Rob Hudson wrote:
> From http://dev.zotero.org/csl_syntax_summary?rev=1192809366,
>
> There is no mapping for annote and note. Grr.

Mapping the Extra field to CSL 'note' (if we don't currently) would be a
trivial fix. I've created a ticket for this:
https://www.zotero.org/trac/ticket/819

Mapping notes is more complicated. There's an old ticket for this
(https://www.zotero.org/trac/ticket/504), but as it says, you'd need a
way to choose a particular note as the annotation (possibly the way we
used to handle abstracts before they moved to the metadata pane, or
maybe with a particular tag). The ticket also suggests a UI element to
choose when to generate an annotated bib, which would avoid needing a
separate annotated version of each style.

Leaving aside CSL 'annote', an alternative would be to do this as an
option in report generation (which will eventually have an options
window)--you'd have a choice between the current metadata table and a
bib style, and then you'd just select the notes you wanted to include in
the annotated bibliography. You could also, say, use a particular tag
for a particular annotated bibliography and assign it to relevant notes,
and then use a saved search to select the right items. It also wouldn't
require changes to all styles, though maybe there are reasons to keep
this style-specific...

Rob Hudson

unread,
Nov 4, 2007, 5:43:32 PM11/4/07
to zoter...@googlegroups.com
My ideal use case is this:

1. Choose the sources for which I want to create a bibliography.
2. Choose the bibliography style.
3. Choose whether to create an "annotated" bibliography or not.

janwillem van dijk

unread,
Nov 5, 2007, 4:41:42 AM11/5/07
to zotero-dev
Sorry I did not intend do do any harm.

I followed http://dev.zotero.org/modifying_zotero_files with the
"Longer-term Development" option.
The dictionary that maps the fields in the table "fields" of
zotero.sqlite to tags used in the csl is in cite.js. I added entries
for the two additional fields I would like to use. It looks now as
below:
Zotero.CSL.Item._zoteroFieldMap = {
"title":"title",
"container-title":"publicationTitle",
"collection-title":["seriesTitle", "series"],
"publisher":"publisher",
"publisher-place":"place",
"page":"pages",
"volume":"volume",
"issue":"issue",
"number-of-volumes":"numberOfVolumes",
"edition":"edition",
"genre":"type",
"abstract":"abstract",
"URL":"url",
"DOI":"DOI",
"extra":"extra",
"callNumber":"callNumber"
}

Then I extracted the "Nature" style using the dump method suggested in
changed in http://nsaunders.wordpress.com/2007/09/11/getting-started-with-zotero-citation-styles/.

I added the new modified csl using http://dev.zotero.org/creating_citation_styles.

The two new fields were added as:
<text variable="callNumber" prefix="[" suffix="] "/>
<text variable="extra"/>

Do I understand you correct that I should map the Zotero "extra" to
CSL "note" ? What about "callNumber"?
Where can I find concise info on this bearing in mind that this whole
bibliographic thing is new to me and being an XML-dummy (numerical
math is my thing). Where can I find how to validate a style?

Sorry for being so ignorant, Janwillem

Dan Stillman

unread,
Nov 5, 2007, 5:39:58 AM11/5/07
to zoter...@googlegroups.com

OK, but that'd more or less be the process regardless of how we
implemented this. If you'll review my previous post, the bigger question
is how you choose the notes that form the annotated bibliography. I'm
not crazy about adding anything new to the UI to do that. The advantage
of using the report feature is that you could select the notes any of
the normal ways (tag selector, saved search, etc.), pull up the report
options window, choose your desired bib style (to appear in place of the
metadata table that appears in reports now), and hit Generate.

If the annotation part of annotated bibliographies needed to be
formatted differently for different bib styles, we'd have to do this
through the bibliography interface. If not, and it was just a question
of choosing the appropriate style for the actual reference part and
appending a note to it in some standard way, doing this through the
report interface might make more sense.

janwillem van dijk

unread,
Nov 5, 2007, 1:57:54 PM11/5/07
to zotero-dev
P.S. can it be that I get a bit the hang of it?

I found the mapping in the Zotero docs and now thought it legal to map
the Zotero field "Extra" to "note" and "callNumber" to "citation-
label" in cite.js.
I added to the "Nature" style, apart from some formatting, as first
and last item respectively:
<text variable="citation-label" prefix="[" suffix="] "/>
<text variable="note" display="block" />
and get:


[Rutherford 1952] Rutherford, E. Chadwick, J. Ellis, C.D. & Pool, M.L.
Radiations from Radioactive Substances. American Journal of Physics
20 (7), 459 (1952).
This a 5 line note in the field "Extra".

It prints as a separate block.
This is done by using display="block".
The field "extra" in zotero.sqlite.fields is mapped to
"note" in cite.js.Zotero.CSL.Item._zoteroFieldMap.

Hope this is better, Janwillem


On 5 Nov, 10:41, janwillem van dijk <jwevd...@xs4all.nl> wrote:
> Sorry I did not intend do do any harm.
>

> I followedhttp://dev.zotero.org/modifying_zotero_fileswith the


> "Longer-term Development" option.
> The dictionary that maps the fields in the table "fields" of
> zotero.sqlite to tags used in the csl is in cite.js. I added entries
> for the two additional fields I would like to use. It looks now as
> below:
> Zotero.CSL.Item._zoteroFieldMap = {
> "title":"title",
> "container-title":"publicationTitle",
> "collection-title":["seriesTitle", "series"],
> "publisher":"publisher",
> "publisher-place":"place",
> "page":"pages",
> "volume":"volume",
> "issue":"issue",
> "number-of-volumes":"numberOfVolumes",
> "edition":"edition",
> "genre":"type",
> "abstract":"abstract",
> "URL":"url",
> "DOI":"DOI",
> "extra":"extra",
> "callNumber":"callNumber"
>
> }
>
> Then I extracted the "Nature" style using the dump method suggested in

> changed inhttp://nsaunders.wordpress.com/2007/09/11/getting-started-with-zotero....
>
> I added the new modified csl usinghttp://dev.zotero.org/creating_citation_styles.

Rob Hudson

unread,
Nov 5, 2007, 2:03:38 PM11/5/07
to zoter...@googlegroups.com
Is there a particular way one has to add the cite.js back into the jar
file? I get errors when I make your changes. Can you post your cite.js
file?

Rob Hudson

unread,
Nov 5, 2007, 2:28:13 PM11/5/07
to janwillem van dijk, zoter...@googlegroups.com
Got it!

I set the mode to long-term development, changed my cite.js and copied
my MLA style over with the "extra" text field in there.

Now if I can only boldface that text. And make the HTML export without
&gt and &lt.

This gives me hope! Hope the developers can make the extra field
available. I just created a style called "MLA Annotated" with that
field. Makes the system infinitely more useful.

janwillem van dijk

unread,
Nov 5, 2007, 5:38:06 PM11/5/07
to zotero-dev
Until now I did not try to put them back just used the unzipped
scripts. It seems that zip programs could do it, may be it should be
renameded. The change in cite.js was the first thing I ever did with
javascript, but any javascripter around might know. Its almost
midnight here so I am off for today.
Janwillem

On 5 Nov, 20:03, "Rob Hudson" <caveat...@gmail.com> wrote:
> Is there a particular way one has to add the cite.js back into the jar
> file? I get errors when I make your changes. Can you post your cite.js
> file?
>

Rob Hudson

unread,
Nov 5, 2007, 5:43:38 PM11/5/07
to zoter...@googlegroups.com
I eventually got your changes to work by doing the unzipped thing. But
as others have said - my changes aren't standard so they won't be much
good to me as anything but a temporary measure until or unless Zotero
changes to accommodate annotated bibs.
Reply all
Reply to author
Forward
0 new messages