# Citekey variable?

**URL:** <https://discourse.citationstyles.org/t/citekey-variable/1651>\
**Category:** CSL Evolution\
**Created:** [June 8, 2020, 12:51am UTC](https://discourse.citationstyles.org/t/citekey-variable/1651 "2020-06-08T00:51:35Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Karcher](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/sebastian_karcher/32/176_2.png) [@Sebastian\_Karcher](https://discourse.citationstyles.org/u/Sebastian_Karcher)\
**Post date:** [June 8, 2020, 12:51am UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/1 "2020-06-08T00:51:35Z")

</div>

I’m having a hard time following the updates for 1.0.2, but at least from [https://github.com/citation-style-language/schema/pull/227](https://github.com/citation-style-language/schema/pull/227) it looks like we don’t have a variable for citekeys (there’s citation label, but as per the specs that’s for thinks like KaSm99 that’s part of printed citations).

Am I right about this? If so, should we add this? Seems like it’d really help with transfer between Word/LibreOffice and citekey based formats like pandoc markdown and LaTeX.

---

<div class="post-metadata">

**Author:** ![Denis\_Maier](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@Denis\_Maier](https://discourse.citationstyles.org/u/Denis_Maier)\
**Post date:** [June 8, 2020, 5:57am UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/2 "2020-06-08T05:57:22Z")

</div>

Yeah `citation-label` is not the same thing as `citekey`. But there is `id` already in csl-data.json. That should be the same as `citekey`, right? If so, isn’t that question more relevant to Zotero and other end reference managers?

If not, what would the intended purpose of `citekey` be next to `id`?

Or is this about making `citekey` available in styles?

---

<div class="post-metadata">

**Author:** ![gduffner](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/gduffner/32/208_2.png) [@gduffner](https://discourse.citationstyles.org/u/gduffner)\
**Post date:** [June 8, 2020, 9:24am UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/3 "2020-06-08T09:24:01Z")

</div>

Isn’t the `id` controlled by the application? `citekey` on the other hand should be under user control. Looking at a `citekey` in a mansucript should intuitively reveal to the author what is cited, while a numeric `id`, generated by the application hardly would.

---

<div class="post-metadata">

**Author:** ![Denis\_Maier](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@Denis\_Maier](https://discourse.citationstyles.org/u/Denis_Maier)\
**Post date:** [June 8, 2020, 9:41am UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/4 "2020-06-08T09:41:02Z")

</div>

> [@gduffner](#):
>
> Isn’t the `id` controlled by the application?

That depends on the application. In a plain text context, `id` is used as a citekey. Zotero is different of course.

---

<div class="post-metadata">

**Author:** ![gduffner](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/gduffner/32/208_2.png) [@gduffner](https://discourse.citationstyles.org/u/gduffner)\
**Post date:** [June 8, 2020, 9:47am UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/5 "2020-06-08T09:47:18Z")

</div>

Of course, when I write a bibtex file or manually a csl json file (is that regularly done besides of testers?), I wouldn’t invent an id besides the citekey. But whenever an application collects the data in a database, it will most probably have to assign a id that is safe from human manipulation. Therefore a separate `citekey` variable that could be exposed to the user is a good idea IMO.

---

<div class="post-metadata">

**Author:** ![Denis\_Maier](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@Denis\_Maier](https://discourse.citationstyles.org/u/Denis_Maier)\
**Post date:** [June 8, 2020, 10:26am UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/6 "2020-06-08T10:26:06Z")

</div>

But isn’t that just a question of which fields e.g. Zotero has. I’m all in favour of a citekey field in Zotero that could be used to populate csl id on export to csl json, yaml or bibtex. But I don’t see why we should need a variable in CSL for that. (Perhaps there are use cases, but I am not convinced this is one.)

---

<div class="post-metadata">

**Author:** ![Denis\_Maier](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@Denis\_Maier](https://discourse.citationstyles.org/u/Denis_Maier)\
**Post date:** [June 8, 2020, 10:28am UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/7 "2020-06-08T10:28:44Z")

</div>

By the way: this us just how the citekey field by BBT is currently handled.

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [June 8, 2020, 10:54am UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/8 "2020-06-08T10:54:28Z")

</div>

> [@Denis\_Maier](#):
>
> But isn’t that just a question of which fields e.g. Zotero has. I’m all in favour of a citekey field in Zotero that could be used to populate csl id on export to csl json, yaml or bibtex. But I don’t see why we should need a variable in CSL for that.

This. Applications should set the id to the citekey if users want this feature.

Right?

ID = citekey; they’re the same thing.

We could make this explicit in the spec though?

---

<div class="post-metadata">

**Author:** ![bwiernik](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/bwiernik/32/438_2.png) [@bwiernik](https://discourse.citationstyles.org/u/bwiernik)\
**Post date:** [June 8, 2020, 12:03pm UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/9 "2020-06-08T12:03:47Z")

</div>

Agreed. `id` is the equivalent to citekey in CSL-JSON. Considering that Zotero and Mendeley don’t use the `id` field at all in their Word processor plugins, they should probably always put a citekey there.

---

<div class="post-metadata">

**Author:** ![gduffner](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/gduffner/32/208_2.png) [@gduffner](https://discourse.citationstyles.org/u/gduffner)\
**Post date:** [June 8, 2020, 1:11pm UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/10 "2020-06-08T13:11:24Z")

</div>

Well, seeing that `id` is the only required field from the item object according to the schema, I got the impression that there was more importance to it.

So, the id is used only for identifying the same object within the word document not for identifying it in the communication with the source application?

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [June 8, 2020, 1:24pm UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/11 "2020-06-08T13:24:27Z")

</div>

Practically speaking, it’s only a local token to link citation and source.

Which is what a citekey is.

Aside: early on, I went out of my way to avoid borrowing from bibtex 😉

---

<div class="post-metadata">

**Author:** ![Sebastian\_Karcher](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/sebastian_karcher/32/176_2.png) [@Sebastian\_Karcher](https://discourse.citationstyles.org/u/Sebastian_Karcher)\
**Post date:** [June 8, 2020, 1:55pm UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/12 "2020-06-08T13:55:22Z")

</div>

I don’t have a fundamental objection to using id for this, but I think you’re making this sound too simple:  
Before turning an auto-generated, non-displayed variable into something that’s displayable and user-configurable (that can be duplicate in a document, e.g. if multiple people edit a document), it’d be worth checking with implementations on how they use it and if that’d cause problems.

I don’t think Zotero does much with the id – they use the uri they display outside of the schema JSON for linking, but Mendeley might, for example, and we don’t have much insight on other tools like paperpile and Readcube/Papers on this.

And even where the application doesn’t use it much, if this is going to be in 1.0.2 it may still require more changes to word processor integration to deal with old ids in documents, e.g., than would be desirable for a minor update.

---

<div class="post-metadata">

**Author:** ![Denis\_Maier](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@Denis\_Maier](https://discourse.citationstyles.org/u/Denis_Maier)\
**Post date:** [June 8, 2020, 2:20pm UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/13 "2020-06-08T14:20:14Z")

</div>

Just to clarify: I, at least, was not talking about changing the ways how Zotero interacts with word processors. All I was saying is this: If Zotero added a citekey field, this can just be mapped to CSL `id` at export time. But that should not affect interaction with word processors at all.

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [June 8, 2020, 2:20pm UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/14 "2020-06-08T14:20:59Z")

</div>

> [@Sebastian\_Karcher](#):
>
> And even where the application doesn’t use it much, if this is going to be in 1.0.2 it may still require more changes to word processor integration to deal with old ids in documents, e.g., than would be desirable for a minor update.

Admittedly, I hadn’t thought about that.

I see three options:

1. do nothing (`id` was designed, from the beginning, with this case in mind)
2. do nothing with csl-data.json, but add a note in the spec (what I suggested above)
3. add a new variable to hold a human-friendly id (say `citekey`), that may-or-may-not be the same as the `id` (what you suggested at top)

There are problems with all three, but I think we should do 2 or 3, and still lean towards 2.

I agree we should have feedback, but the only project developers who’ve been around here and active recently is @Dan_Stillman, who I am certain has thought about this issue, given that’s come up in the zotero forums since the beginning.

On implementers: we really need to get them added to a PR review team, and a commitment to actually provide feedback, but I don’t even know at this point who we contact.

---

<div class="post-metadata">

**Author:** ![Sebastian\_Karcher](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/sebastian_karcher/32/176_2.png) [@Sebastian\_Karcher](https://discourse.citationstyles.org/u/Sebastian_Karcher)\
**Post date:** [June 8, 2020, 2:24pm UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/15 "2020-06-08T14:24:58Z")

</div>

> [@Denis\_Maier](#):
>
> Just to clarify: I, at least, was not talking about changing the ways how Zotero interacts with word processors. All I was saying is this: If Zotero added a citekey field, this can just be mapped to CSL `id` at export time. But that should not affect interaction with word processors at all.

Right, I don’t think it _should_ have to change, but since `id` is used in the current data model in the word processor integration, I’m wondering if using it for citekey would require a change.

---

<div class="post-metadata">

**Author:** ![Denis\_Maier](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@Denis\_Maier](https://discourse.citationstyles.org/u/Denis_Maier)\
**Post date:** [June 8, 2020, 2:37pm UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/16 "2020-06-08T14:37:14Z")

</div>

> [@Sebastian\_Karcher](#):
>
> but since `id` is used in the current data model in the word processor integration, I’m wondering if using it for citekey would require a change.

Isn’t it already used for citekey, e.g. by pandoc.

---

<div class="post-metadata">

**Author:** ![Sebastian\_Karcher](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/sebastian_karcher/32/176_2.png) [@Sebastian\_Karcher](https://discourse.citationstyles.org/u/Sebastian_Karcher)\
**Post date:** [June 8, 2020, 2:45pm UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/17 "2020-06-08T14:45:20Z")

</div>

> [@Denis\_Maier](#):
>
> Isn’t it already used for citekey, e.g. by pandoc.

But that’s just because that’s how pandoc understands internal ids. Using ids for citekeys means we’re changing how that variable is expected to work - it can now be printed, it can be changed by a user, it can be changed in an existing document, etc. There’s a fair chance that will cause problems for applications that in some way have relied on the previous behavior.  
It’s possible that’s not the case, in which case I think Bruce’s 2) is definitely the right choice, but if it will require significant adjustments by implementers, that’d strengthen the case for 3)

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [June 8, 2020, 2:51pm UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/18 "2020-06-08T14:51:55Z")

</div>

How does `citation-label` fit?

---

<div class="post-metadata">

**Author:** ![Denis\_Maier](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@Denis\_Maier](https://discourse.citationstyles.org/u/Denis_Maier)\
**Post date:** [June 8, 2020, 2:55pm UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/19 "2020-06-08T14:55:31Z")

</div>

I think `citation-label` has a different purpose.  
That said, I still don’t really understand what the intended purpose of a citekey variable would be that `id` can not cover. Can someone give an example?

---

<div class="post-metadata">

**Author:** ![Sebastian\_Karcher](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/sebastian_karcher/32/176_2.png) [@Sebastian\_Karcher](https://discourse.citationstyles.org/u/Sebastian_Karcher)\
**Post date:** [June 8, 2020, 2:56pm UTC](https://discourse.citationstyles.org/t/citekey-variable/1651/20 "2020-06-08T14:56:39Z")

</div>

`citation-label` is entirely separate, at least as currently described:

> citation-label  
> label identifying the item in in-text citations of label styles (e.g. “Ferr78”). May be assigned by the CSL processor based on item metadata.

So if you have a trigraph style (like American Mathematical Society or the DIN one we currently have available), you’d need both that and a citekey

[Next page](https://discourse.citationstyles.org/t/citekey-variable/1651.md?page=2)
