Skip to content

Instantly share code, notes, and snippets.

@imontesino
Last active February 18, 2024 03:32
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imontesino/ba411276f9bf6d696c2fe64ff35bcb34 to your computer and use it in GitHub Desktop.
Save imontesino/ba411276f9bf6d696c2fe64ff35bcb34 to your computer and use it in GitHub Desktop.
Zotero + SyncThing + Zotfile + SciHub setup (Windows and Linux)

Zotero + SyncThing + Zotfile + SciHub setup (Windows and Linux)

This guide will take you through the steps to install and setup syncing of files between multiple computers running Zotero.

Table Of Contents:

Install zotero

First install the appropriate version of Zotero for your OS.

Windows

Simply download the installer, execute it and follow the instruction. Link.

Linux

The easiest way is using the community maintained Zotero Deb Package:

curl -sL https://raw.githubusercontent.com/retorquere/zotero-deb/master/install.sh | sudo bash
sudo apt update
sudo apt install -y zotero

Browser extension

The first time you open zotero a browser will open and take you to the extension download page. Install the extension for your browser. This will allow you to easily add new material to your library.

Creating an account

Open a browser and go to zotero.org. Click on Login and then Register for a free account:

zotero_log_in

zotero_register

Fill in the form with a Username and Password and click Register.

Open Zotero and click the Sync with zotero.org button:

zotero_sync_button

A pop up will appear aking you to sign in:

zotero_open_sync_pref

Then fill in the form with the username and password you created earlier:

zotero_sync_pref

Click again on the Sync with zotero.org button and wait for the sync to finish.

Install SyncThing

SyncThing is a continuous file synchronization program. It synchronizes files between two or more computers in real time.

Windows

To simplify usage in windows download the SyncTrayzor utility. It provides a system tray icon, autostart on boot, and a GUI app without needing to open a browser.

Go to releases, and install the latest one.

When done, open the SyncTrayzor GUI by searching for it in the windows search bar.

Linux

Follow the instructions to install via the apt package manager: apt.syncthing.net.

Then to allow autostart on backup open a terminal and run the following lines:

sudo systemctl enable syncthing@$(whoami).service
sudo systemctl start syncthing@$(whoami).service

This will start SyncThing whenever the computer is turned on.

To open the GUI management app open a browser and open http://127.0.0.1:8384/

Adding new computers

Add all the computers that you want to sync your Zotero library with. Let sync computer A and B, which computer is which is irrelevant as this is a distributed syncing system.

  1. Open the GUI for SyncThing in Computer A and click on Actions > Show ID:

    syncthing_show_id

  2. Copy the id (shown as XXXXXX-XXXXXX-X...)

    syncthing_qr_code

  3. Open SyncThing GUI in Computer B and click + Add Remote Device:

    syncthing_add_remote_device

  4. Input the Device ID obtained from Computer A and give it a recognizable name:

    syncthing_add_device

  5. Finally open the GUI in Computer A and accept the connection.

Zotfile Sync folder

The previous steps will create a folder that will sync across all the devices that you add. The synced folder's location is:

  • Windows - C:\Users\<your-username>\Sync
  • Linux - /home/<your-username>/Sync

Finally inside this folder create a folder named Zotfile. E.g. /home/<your-username>/Sync/Zotfile.

Install Zotfile

Zotfile is a plugin to better manage files in Zotero. In our case we want Zotfile to put all the material's PDF's in the same folder and then sync that folder. Go to Zotfile's release page and download the latest plugin file, e.g. zotfile-5.1.2-fx.xpi.

Open Zotero and click on Tools > Add-Ons:

zotero_tools

In the Add-Ons panel you can see you installed plugins and add new ones, click on the setting wheel then Install Add-on from file...:

zotero_add_ons

Then select the downloaded .xpi file. Restart Zotero.

Then click on Tools > ZotFile Preferences..., this will open the ZotFile settings:

zotero_zotfile_settings

In Location of Files click Custom Location and fill the field with the path to the folder created in the Zotfile Sync folder step.

Configure Zotero's File Path

To prevent errors with path names in different computers tell zotero to only check file paths relative to the synced folder.

In the Zotero main screen click on Edit > Preferences, and in The Zotero Preferences menu click Advanced > Files and Folders:

zotero_folder_settings

Then in the Linled Attachment Base Directory click on Choose... then again select the folder created in Zotfile Sync folder.

Sci-Hub

WARNING: Sci-Hub is a site that could be used to access copyrighted material without the proper rights. Check your specific legislation and University Code.

You can set Sci-Hub as a backup PDF search repository. If Zotero isn't able to correctly extract the pdf from the site ot will search it on Sci-Hub.

In the Zotero main screen click on Edit > Preferences, and in The Zotero Preferences menu click Advanced > General > Config Editor:

zotero_config_editor

This allows to configure more in depth settings, as such a warning might pop up. click I acccept the risk. Don't worry we wont change anything important.

zotero_config_warning

A list of config parameters will appear. Click on the search bar and type findPDF, the following results will appear:

zotero_config_findpdf

Click on extensions.zotero.findPDFs.resolvers. A text box will apear with only []. Delete it and copy and paste the following text:

{
    "name":"Sci-Hub",
    "method":"GET",
    "url":"https://sci-hub.se/{doi}",
    "mode":"html",
    "selector":"#pdf",
    "attribute":"src",
    "automatic":true
}

And that is all! Now your Zotero is setup to easily find and sync pdf attachments for all your research needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment