Zotero best practices

right now I’m using zotero -> zotero picker for windows. and also just incorporated @Svend’s great csl.

2 Likes

Kimstacks, your author problem has two causes:

  1. You have the field set to institutional author format. You need Last Name, First Name format. Click on the little box to the right of the author’s name, and this should yield “Scott” as the last name and “Alex” as the first.
  2. For some reason, “Alex” was truncated when you imported it. This is probably a function of the web page. If you were importing the metadata from a library site, where items are required to have correct information, you probably wouldn’t have this. I don’t know for sure how Zotero scrapes this kind of web page, but possibly it looks at the HTML. If the page author entered “Alex” instead of “Alexander,” this would explain the flaw.

As for the other kind of sources, use a trusted reference source to identify the item. For example, find articles on Google Scholar and books on Google Books. Amazon also is an easily scraped, often a convenient source of book metadata. If you have access to an academic library, their electronic catalogs and ejournals are usually quite good. I’ve even downloaded pdf’s from my library’s catalog and then used Zotero to access the file, and Zotero had the correct metadata. But this varies depending on the journal’s publisher. YMMV.

As for your question about using Zotfile, it requires two steps using the context menu:

  1. Attach the file to the reference.
  2. Then, Manage Attachments > Rename Attachments

If you set up ZotFile’s settings to point to where you’re keeping your pdf attachments, ZotFile will move the pdf file from where you have it (Downloads?) to a folder in your repository. The pdf will be renamed according to the naming rules you specified in the settings, and the folder will be named appropriately (e.g., “LuhmannN”).

3 Likes

If you’re using rmarkdown, are you using RStudio too? I use the RBBT addin to RStudio and the BibLaTeX plugin to Zotero. For a given paper, I create a dedicated collection in Zotero, and add cited references to the collection as I write. When I create the collection, I set up BibLaTeX to maintain a .bib file in the RStudio project directory where I’m writing. Then, as I write, the RBBT addin works with R Markdown files the way the Zotero plugin for Word, LibreOffice, etc. Because it just has to search in the collection instead of my entire 14,000+ item Zotero repository, it’s very fast.

I agree with what some people have said about the new Zotero interface being a bit clunky, but the classic version had its problems too. Hopefully the Zotero gods are working on this. But it’s still more than adequate.

An additional comment on Philipp’s excellent video.

If you are using any author-date citation style, like APA, you can omit the author from the parenthetical cite simply by prefixing the citation text with a minus sign. E.g.,

  • “This style of programming is driven by events [@brunsEventDrivenArchitecture2010: 2-5]” is rendered as “This style of programming is driven by events (Bruns 2010: 2-5).”

  • But “As discussed by Bruns [-@brunsEventDrivenArchitecture2010: 2-5]” is rendered as “As discussed by Bruns (2010: 2-5).”

5 Likes

https://getquicker.net/Sharedaction?code=72101143-4cc5-4dfe-2dda-08d80601d539

This action is developed by me, with higher efficiency and better effect.

1 Like

My friend helped me to write a small Python parser of my bibliography in BetterBibtex bib file and save every reference as md file in Obsidian vault.
How to use it:
1: install BetterBibtex as described in Zettlr docs. Citation key later will serve as a filename so use appropriate keys, i.e. no semicolons or other special symbols are allowed.
2. Copy the script (below) and bib file into references folder inside your vault.
3. Run the script:

import json
import collections

def flatten(d, parent_key='', sep='_'):
    items = []
    for k, v in d.items():
        new_key = parent_key + sep + k if parent_key else k
        if isinstance(v, collections.MutableMapping):
            items.extend(flatten(v, new_key, sep=sep).items())
        else:
            items.append((new_key, v))
    return dict(items)

def flatten_publication_info(publication_info):
    if publication_info.get('author', False):
        publication_info['authors'] = [author['family']+' '+author['given'] for author in publication_info['author']]
        publication_info = flatten(publication_info)
        return publication_info
    elif publication_info.get('authors', False):
        publication_info['authors'] = [author['family']+' '+author['given'] for author in publication_info['authors']]
        publication_info = flatten(publication_info)
        return publication_info
    return None

f = open('My Library.json','r', encoding='utf8')
data = json.load(f)
for elem in data:
    try:
        flat_publication = flatten_publication_info(elem)
        if flat_publication:
            filename = 'ZOT' + elem['id'] + '.md'
            writer = open(filename,'w+', encoding='utf8')
            title = flat_publication['title']
            abstract = flat_publication.get('abstract','Empty')
            authors = ';'.join(flat_publication['authors'])
            writer.write('tags: #zotero #reference\nlinks: [[Zotero library]] [[Readings MOC]]\n') #header
            writer.write('### %s\n ###### Authors\n%s\n ###### Abstract\n%s' % (title,authors,abstract))
            writer.close()
    except Exception as e:
        print('Problems with %s' % (elem['id']))
        print(e)

It will produce a lot of md files that you could reference from Obsidian. It will look like this:

7 Likes

That‘s cool, doing everything in Obsidian.

1 Like

I’ve posted the plugin I wrote before in Zotero integrations - #30 by argentum (updated workflow here), but I thought I’d add here a few things that could help make the most of Zotero (and also of the mdnotes plugin itself). My workflow

How to

Extract annotations and highlights

Zotfile will extract annotations from your PDF and store them as notes in Zotero. The notes include links to the specific page in the PDF where the highlight was made:

image

You can configure how to format these HTML notes with Zotfile’s hidden preferences, check the .pdfExtraction settings here

Keep in mind that if you annotate your PDFs, Zotfile is also able to extract “pop-up notes”, but not inline notes. These highlights:

End up in this note:
image

Splitting annotations and Highlights into different notes

There are a few settings worth looking into, depending on your workflow:

  • By default, the extensions.zotfile.pdfExtraction.colorNotes setting is turned off, which means all the highlights and annotations will be extracted to a single note.
    • You can change the format of the title with extensions.zotfile.pdfExtraction.formatNoteTitle

    • Setting extensions.zotfile.pdfExtraction.colorAnnotations to true, will add the color as a background in the annotations, and you can use %(color_category) to add labels in extensions.zotfile.pdfExtraction.formatAnnotationHighlight according to the colors in extensions.zotfile.pdfExtraction.colorCategories

  • Splitting notes by color can be turned on by setting extensions.zotfile.pdfExtraction.colorNotes to true
    • You can customize the title of the note in extensions.zotfile.pdfExtraction.formatNoteTitleColor

Export notes to markdown

Now that you have notes attached to your Zotero reference, you can export the reference’s metadata and your highlights and annotations to a markdown file.
The menus in Zotero are unfortunately not context-aware, so to know what to select for each menu follow the cheatsheet at the top of the README of mdnotes. The plugin helps with the following:

  • Exporting metadata of a reference
  • Exporting Zotero notes (e.g. those extracted by Zotfile or literature notes written by you)
    • The export format for markdown is a little hardcoded (right now), but you can experiment with changing Zotfile’s notes formats and include markdown or wikilinks in your annotations:

    • If you want to structure your notes, you can use underline (instead of highlight) to create H4 headings. A PDF like this:
      image
    • After being exported, results in a markdown note like this:
  • Creating a file for your notes. Since this file contains your notes, this is the only file that won’t be overwritten during batch export. If you want to replace it, you can choose the Create Notes file menu.

The plugin also can add these files you created as links to Zotero so you can double click them and edit them.

The default settings export all the information of the references in multiple files. If that doesn’t work for you, there some settings to play around with, depending on what you want:

  • If you don’t want to “pollute” your graph, you can choose to export everything in a single file.
  • If you don’t want to include highlights and annotations in your export (e.g. as literature notes), you can either disable them in the settings so they’re not included in the export. If you export everything in a single file, you can have the metadata in the same file.
  • Instead of using batch export on every item, selectively choose what you send to your vault by using the individual menus.

Get links to a Zotero item or PDF

You can use Zutilo to get a link to the Zotero item or a PDF. You want to enable Copy select item links in Zutilo’s settings so that it shows up in the context menu or as a shortcut. That will give you a link with Zotero’s URL e.g. zotero://select/library/items/FE7B33LA which you can format in markdown.

Update: @silent developed a Zotero translator to easily copy markdown-formatted zotero links here.

Naming conventions

Using Zotfile and Betterbibtex, it’s possible to establish certain rules about how your files are named. I covered this in a reply further down:

Web clipping

In order to successfully use Zotero to save articles, it should have a “translator” that can correctly get the data for the citation out of it. You can find a list of existing translators here

Plugins

69 Likes

That’s cool - thanks for that detailed overview!

I have been working with zotfile for quite a while now and more recently with mdnotes - but I just realised that so far I obviously only have discovered a small part of zotfile’s power! I wasn’t aware of zotfile’s hidden preferences that allow you to even better organise your notes - thanks for calling my attention to this! :slight_smile:

1 Like

Sorry that I just created another post to introduce related methods, now I introduce it again here.


In Obsidian 0.8.15, you can use URL scheme to jump to specific note.

So I share a geek way to achieve something interesting with you.

First of all, I am using pdf X-change editor plus, Zotero, Quicker(a software like autohotkey but has a GUI)

Jump from Obsidian to pdf

  1. Select what you want to save in Obsidian.
  2. Copy it and use pdf X-change editor plus to get the file path of what you are reading, capture its zotero’s library parameters(like G78UAI9B) by using autohotkey or any software you want.
  3. Get the page number of the text you selected.
  4. Then insert the library parameters & page number into the link(like: zotero://open-pdf/library/items/G78UAI9B?page=9).
  5. You can make similar text like follow.
    image
  6. Paste it in you obsidian note. Ctrl+E, You could jump from your note to pdf now.

Jump from pdf to Obsidian

  1. Get the URL link of your note.
  2. Add a web link to the text you selected in your pdf.
  3. Paste the URL link of your note in it. Click it, you could jump from pdf to your note now.

PS: If anyone find a better way to do these, please share it with me. Thanks.
PPS: The official website of Quicker software I use is https://getquicker.net, and its free version does not require login, so you can try to use it.
The script I use is:

  1. pdf to OB
  2. OB to pdf

Sorry that I didn’t add a English translation to their introduction.

A geek gif as follow:


link: Combine Zotero with Obsidian (Jump from pdf to Obsdian’s note)

11 Likes

Thank you for this amazing guide. When extracting annotations from zotfile, is it possible to replace or delete the old one extracted annotation note?

2 Likes

If you mean the yellow Zotero notes, I don’t think it is possible. Zotfile creates new notes every time you extract new annotations, if you want to get rid of them I think deleting them manually is the only way. I think there may be use cases where people annotate/highlight the PDFs for different purposes and/or at different times, and might want to keep the old notes too.

2 Likes

Has anyone created at alternative copy (i.e. Quick Copy alt 1) that is specific to Markdown? Ideally I’d have it copy the [Title](zotero link) rather than just the simple Zotero link. I’ve been trying to figure out how to do this, but any pretty lost…

1 Like

There you go! copy-link-to-selected-item

1 Like

How are you guys avoiding special character in titles names in Zotero? I have set zotfile to replace special characters, but it seem to only do it for the filenames and not the actual title within Zotero.

@argentum Can you help me understand the role of this line of code in the zotfile .travis.yml file? I’m extra cautious about software installs, even when they’re open source.

- curl -F "file=@zotfile-build-$TRAVIS_BUILD_NUMBER.xpi" https://api.anonfile.com/upload

I only became aware of “curl” this week, and I think the idea is to use it to download/build packages. I’ve been using homebrew, and read a bit about macports, then saw a bit about curl. But what’s up with the anonfile “upload” bit? If I use zotfile, what am I uploading, if anything?

Hey @s0ph0s, let me start with the disclaimer that I’m not the Zotfile developer, so all the explanation below is just based on my experience as a dev. I also want to say that there is no reason to be worried about that line, since Travis can’t run in your computer.

Travis is a continuous integration service, that is, something you use to test and build your code, and, in Zotfile’s case, “deploy” your code. You can see how Travis executes the commands listed in that yaml file over here. They seem to be using it to upload the xpi file to the link in that line, most likely to be able to send it to people if they need to test a fix.

I don’t use Zotero, but just a plain .bib file for my references. Since Zotero users might export their data with Better Bibtex to a .bib file, too, this might be interesting to some of you (works on macOS and probably on Linux, requires certain familiarity with terminal applications):

1 Like

Thank you, so this works for me now.

This part is less clear for me. I realized my pdf is now moved to ~/Zotero/storage/MCDERLHB where MCDERLHB is some kind of random name after I did a Add attachment > Add stored copy of file.

image

I think I want to have the pdf stored inside my obsidian vault. Do you recommend any other parts of the zotero stored inside the obsidian vault as well?