Best practice for creating citations?

Hi everyone,

I’m using Tropy to organize the sources for my dissertation. I use Zotero for citations of secondary literature, and I would love to be able to cite the sources I have on Tropy without having to manually type each one into Zotero.

What is the workflow you all recommend? I read that exporting data as JSON files could work, but I’m not managing to import these files into Zotero.

Thank you!
Mariana

Hi,

there is a first version of a plugin that lets you export your Tropy items as CSL/JSON for Zotero: GitHub - tropy/tropy-plugin-csl. The plugin is in an early stage but it might serve you well:

– Download the code from GitHub as ZIP file. Do not unpack the ZIP and verify that your browser did not unpack it.

– Install the plugin in Tropy by selecting the ZIP file in Preferences > Plugins.

– Duplicate the template you are using for your items in the template editor and for each field you want to export to Zotero set a corresponding CSL/JSON id in the field’s label.

– Then select this ‘export’ template in the plugin.

– You can export multiple Tropy items as a single JSON file (so you don’t have to import the items file by file into Zotero). To do so, select multiple items, right click, and select Export Selected Items > Your Zotero Plugin Name from the context menu. Make sure each item has a valid type field.

Alternatively, if you happen to end up with multiple CSL JSON files, you can install e.g. jq to concatenate your files: after installing jq, run in the command line

cat file-1.json file-2.json | jq .[] | jq -s > output.json (bash) or
cat file-1.json file-2.json | jq '.[]' | jq -s > output.json (zsh).

In case you have a folder with lots of JSON files you want to concatenate, you can use * instead of the file names (file-1.json file-2.json).

Hope it helps!

Hi!
Thank you very much! I’m trying to set this up. I’m a little lost with this step: Duplicate the template you are using for your items in the template editor and for each field you want to export to Zotero set a corresponding CSL/JSON id in the field’s label.
What is a CSL/JSON id?

Thank you!

Hi,
the CSL/JSON ids are in the long list here in the readme: GitHub - tropy/tropy-plugin-csl.

They represent the Zotero metadata fields. So for example if you want to map Tropy’s dc:title to Zotero’s title field, you enter title into the label of the dc:title property. To map dc:creator to Zotero’s author field, you’d enter author into the label of the dc:creator property and so on:

Be aware that you can only use ids that are available in that list and make sure to map a field (typically your dc:type field) to Zotero’s type field. Then, in your project, use valid type values for your items (e.g. manuscript) from this list : https://docs.citationstyles.org/en/1.0.1/specification.html#appendix-iii-types

Hi!

Thank you so much for the clarification. I was able to complete this step thanks to your explanation.

I have one more question – sorry for the lack of tech savviness!

Where do I do this? I can’t seem to find an option to alter the plugin settings.

Thank you again

Hi,

simply click anywhere on the plugin to expand its settings:

As you struggled to find the plugin settings I think we should improve the UI – thanks for the feedback!

Hi,

Thank you for the help, I’m making a lot of progress!

So sorry for requesting help once again, but I’m still struggling a bit. I managed to export the items, but only the title, author, and date fields appear in Zotero. Other fields that I have set up, such as archive, archive_location, call-number, and abstract do not appear.

Here’s what I see in Tropy

And here’s that same document in Zotero:

Here’s what the template looks like:

What do you think might be going on?

Thank you again!!

And this is the CSL JSON file if I open it in a text editor

[
{
“type”: “manuscript”,
“title”: “Relación de los capataces y peones que quedan existentes en la estancia de Surubiy y sus puestos”,
“issued”: {
“raw”: “1848-09-18”
},
“author”: [
{
“literal”: “Campurano, Juan de la Cruz”
}
]
}
]

Hi,
you are doing everything right on your end. We realized that there is an issue with the current plugin (sorry for that) and will release an update within the next days.
I’ll let you know once the new plugin version is available so you can reinstall it, that should fix the issue. Stay tuned!

The new plugin version is available by now, please give it a try.

Hi,

Thank you so much for looking into this and fixing it! The new plugin is working better. However, now the date is not showing up on Zotero (it was showing up in the previous version). Here’s the same item again on Zotero:

Here’s the text of the csl json file:
[
{
“title”: “Relación de los capataces y peones que quedan existentes en la estancia de Surubiy y sus puestos”,
“author”: [
{
“literal”: “De la Cruz Campurano, Juan”
}
],
“abstract”: “listas de peones y capataces, antiguedad de los que se retiran”,
“event-date”: {
“raw”: “1848-09-18”
},
“type”: “manuscript”,
“archive”: “Archivo Nacional de Asunción”,
“event-place”: “Surubiy”,
“archive_location”: “Nueva Encuadernación”,
“call-number”: “2695”
}
]

Thank you!

Hi,

for manuscripts you need to map Tropy’s date field to the CSL issued field instead of event-date. An exhaustive list of all CSL fields per item type can e.g. be found here: https://aurimasv.github.io/z2csl/typeMap.xml.

As can be seen in that document, the event-date variable does not have a corresponding Zotero field.

Hi,

Thank you again, everything is working now!!

One last question. I’m using two templates, one for generic manuscripts and another one for letters. What I’ve done is I duplicated both templates and mapped their fields with the appropriate Zotero fields. Then when I want to export letters, I switch the default template of the plugin to the correspondence template. Would you say that’s the most practical workaround?

Thank you so much for all your help. Hopefully, this thread will be helpful to somebody else!

Mariana

Hi,

I’m glad that we could help you!

Good thing that you checked back regarding the workflow: no, what you describe is not the intended approach (that would be too cumbersome). So what you should do instead is create multiple instances of the plugin. In the plugin settings at the far right, there are and + icons. Use + to create a new instance.

Once you have two instances, use descriptive names like Zotero Manuscripts and Zotero Letters. And then pick the corresponding templates for each of them.

After closing the preferences window, both plugin instances will show up with the chosen names in the item’s context menu – this way you can conveniently pick the plugin instance with the mappings you want.

thank you! this works great

Hey !

Thank you for the clarification! Despite several attempts, I can’t manage to import the metadata into Zotero.

Could you help me? Thank you!

The Tropy error message is as follows:

{“msg”:“Échec de l’exportation des objets.”,“stack”:“TypeError: Cannot read properties of undefined (reading ‘export’)\n at Plugins.exec (/Applications/Tropy.app/Contents/Resources/app.asar/lib/bootstrap-90a35751.js:5337:30)\n at export (/Applications/Tropy.app/Contents/Resources/app.asar/lib/bootstrap-90a35751.js:5340:17)\n at runCallEffect (/Applications/Tropy.app/Contents/Resources/app.asar/lib/project-3e0f1df6.js:25655:21)\n at runEffect (/Applications/Tropy.app/Contents/Resources/app.asar/lib/project-3e0f1df6.js:26121:7)\n at digestEffect (/Applications/Tropy.app/Contents/Resources/app.asar/lib/project-3e0f1df6.js:26166:5)\n at next (/Applications/Tropy.app/Contents/Resources/app.asar/lib/project-3e0f1df6.js:26098:9)\n at currCb (/Applications/Tropy.app/Contents/Resources/app.asar/lib/project-3e0f1df6.js:26154:7)\n at runSelectEffect (/Applications/Tropy.app/Contents/Resources/app.asar/lib/project-3e0f1df6.js:25825:5)\n at runEffect (/Applications/Tropy.app/Contents/Resources/app.asar/lib/project-3e0f1df6.js:26121:7)\n at digestEffect (/Applications/Tropy.app/Contents/Resources/app.asar/lib/project-3e0f1df6.js:26166:5)”,“system”:“Darwin 22.3.0 (arm64)”,“time”:1681378926762,“version”:“1.13.0”}

It looks like you installed the CSL plugin’s source code instead of the release bundle. Please try downloading the plugin from the release page again, picking the tropy-plugin-csl-v1.1.0.zip file, not the one labeled “Source Code (zip)”.

Hello, thank you for your answer. I installed the plugin again (the tropy-plugin-csl-v1.1.0.zip file). I think it was the right one:

The downloaded file is in .json. However, this format is not supported by Zotero when importing (Zotero → file → import or Import form Clicboard).
Zotero says : “The selected fil is not in a supported format”

Can you think of any other explanation? Thank you!

If you paste the JSON file, I’m sure we can figure out what’s missing.

Here :

Sans titre.json (10.9 KB)

Many thanks !