Using Scrivener with reference software (wiki)

Introduction

For certain types of writing, it is essential to cite your sources in the text and then create a bibliography / reference list. To help with this, specialist software allows you to search for references and store them in a database. Depending on the software, you can create notes and relationships for each reference, and attach and manage the source material as a PDF or other text format.

As you write, references need to be inserted into your text (either inline or as footnotes), and once you have finished, they need to be formatted in the style you want them to appear in (parenthetical, numerical, or note citations). There are two ways of doing this: using a dedicated cite-while-you-write (CWYW) interface, or using temporary citation placeholders (TC) that are scanned at a later date. While CWYW may seem “easier”, it locks you into using a specific tool and can often cause performance and stability issues as CWYW constantly updates the document with each edit.

Scrivener supports the use of temporary citations and allows you to link your reference manager directly to Scrivener (see §20.4 of the user manual for how to do this) to make inserting references easier. For example for Bookends:

Set the word processor in Bookends to “Scrivener” in Preferences⇨General and the bibliography manager in Scrivener to “Bookends” in General⇨Citations.

The general workflow when writing is to activate your reference manager/citation interface while in Scrivener, find and select an item, then insert a temporary citation back into your text. When you are finished with writing, you compile into one of a number of formats and, depending on the format, process the compiled output to generate a bibliography.

This thread aims to collect sample workflows for a number of reference management tools to show how to write in Scrivener and generate a formatted final manuscript. Each application will have a post linked to below. Anyone with experience of a tool and workflow can contribute their methods.

This is currently a WIP, the idea is to detail Endnote, Bookends, Zotero, JabRef and Mendeley. Users of other software can give suggestions for other entries. Also I (@nontroppo) am a macOS user and don’t have experience of Windows so anyone please feel free to update/augment these instructions…

Glossary

  • temporary citation — a plain text placeholder that uniquely identifies an entry in a reference manager, e.g. @doe2024. This provides a flexible way to support different writing tools and automations.
  • CWYW — a tool directly integrated into a word processor that both searches and formats references during writing. While convenient, CWYW can be slower/buggy and is much more inflexible than temporary citations; CWYW locks you (and any collaborators) into a single word processor + bibliography tool. Examples of CWYW workflows include Mellel + Bookends and Word + Endnote.
  • citation style — a set of rules for how to format both in-text citations and the bibliography list. Each reference manager offers their own tools to specify a style, for example Pandoc and Zotero use CSL, Bookends has a Formats Manager and also supports CSL. See the CSL database for examples of citations styles: Zotero Style Repository
  • BibTeX — a citation tool originally used by LaTeX, superseded by BibLateX. BibTeX can refer to the tool itself or the format of the stored references. The BibTeX format is supported by many other tools.
5 Likes

Endnote (Clarivate Software) [macOS & Windows]

Endnote is often available to academic users through a University site licences and is probably the most heavily used reference managers around. Endnote has a CWYW plugin that locks you into using Microsoft Word, but for Scrivener users Endnote also supports robust temporary citations.

Set Endnote as your citation manger in Scrivener’s settings:

Inserting temporary citations

To insert a temporary citation, you can use Insert > Bibliography/citations (Y on macOS) in Scrivener to switch to Endnote, then search and select your reference, then Edit > Copy (C on macOS) and paste it into Scrivener. The temporary citation will look like this (in this case two references seperated by a ;:

{Adolphs, 2009 #3521; Clutton-Brock, 2021 #7164}

You can insert a text prefix / suffix or other text using this template: {Prefix \Author, Year #Record-Number Suffix}, so for example to add a page number prefix would be {see p.21 \Adolphs, 2009 #3521}. See Endnote’s help for more details.

Compile options:

  1. DOCX ⇨ Microsoft Word: this is the most obvious compile target as Endnote’s plugin is best supported by Microsoft Word. The plugin can convert temporary citations into formatted ones.
  2. ODT / RTF ⇨ Endnote’s Format Paper: Endnote can scan and format a document from within Endnote. According to the help it supports scanning the following: “Microsoft® Word, OpenOffice Writer, LibreOffice Writer, Apple Pages, Scrivener, Nisus Writer, TextEdit , Mellel, and almost any other application that can save as RTF (Rich Text Format)” — for Scrivener users that means using ODT / RTF / DOCX compile outputs.
  3. LaTeX / Markdown: Endnote can export its database to BibTeX. This can be used by Pandoc and LaTeX tools. One caveat is the temporary citations that are exported are not consistent with those copied by default. Potential solutions are to edit the temporay citation options OR edit the BibTeX output format to make these consistent. See this PDF from Imperial College for more details.

Tips

It is sometimes easy to convert the temporary citations from Endnote to those used by LaTeX or Pandoc, as long as your BibTeX citation key is in the firstauthor-year format, so for example {Smith, 2012 #342} can become [@smith2012]

4 Likes

Bookends (Sonny Software) [macOS & iOS]

According to Wikipedia Bookends is the oldest still-developed reference manager available (first available in 1983!). It is used by many Scrivener users active on these forums, and is best-in-class in terms of its reference management abilities. The independent developer is very active and Bookends is regularly improved. It supports a very powerful floating citation interface that works in many apps. For iOS users, you can add and manage references on the go (in a talk, meeting, conference), and robust sync means all your references from the desktop are always available in your pocket.

Bookends has very flexible temporary citation support (p.293 of its user manual). For its native citations it uses the following format:

{Mittelstadt et al., 2001, J Biol Chem; Li et al., 2002, Nature}

You can also easily set it up to create citation keys and generate Pandoc [@mittelstadt2001] or LaTeX \cite{mittelstadt2001} temporary citations…

Inserting temporary citations

  1. Direct: Bookends has a really neat floating citation dialog. Press Control⌃ twice from Scrivener, then type in your search term:
    …then press return↵ or Y to paste it directly in Scrivener. Use the drop-down to control prefix / suffix modifiers and to access other options.
  2. Direct: You can also use Scrivener’s Insert > Bibliography/citations (Y on macOS) to switch to the main Bookends window, then search and select your reference, then press Y again to insert the temporary citation into Scrivener.
  3. External tool: For Alfred users, @nontroppo has a workflow which allows you the search and insert temporary citations in Pandoc/MMD format. See GitHub - iandol/bookends-tools: Alfred Workflow to Integrate with Bookends, an academic reference manager/bibliography tool for macOS for the details…
  4. External tool: If you use a synced bibTeX file, Chris Geisler’s excellent supercharged citation picker allows you to search and cite directly into Scrivener (even if Bookends is closed). See GitHub - chrisgrieser/alfred-bibtex-citation-picker: Citation picker & lightweight reference manager for BibTeX files, via Alfred. for the details.

Compile options:

  1. DOCX ⇨ Microsoft Word: Bookends has a Microsoft word plugin that uses the Bookends temporary citations format and can generate a formatted document.
  2. ODT / RTF ⇨ Bookends Scan Document: Bookends can scan and format a document from within Bookends using Biblio ⇨ Scan document… — according to the documentation it supports: “OpenOffice, RTF, RTFD , or text files”. See Scanning Documents on p246 of the user manual.
  3. RTF ⇨ Nisus Writer Pro (NWP) & Mellel: Both of these word-processors have deep integration with Bookends. They allow you to scan and change references, find the citation in Bookends and more. You should compile to RTF, and then use the tools in NWP or Mellel to finalise the bibliography. @xiamenese has automated this in NWP with a macro so the bibliography and other details are automatically generated.
  4. Markdown & LaTeX: Bookends can sync and update a parallel BibTeX file. This can be used by Pandoc, Quarto and LaTeX. Pandoc and Quarto uses the [@adolphs2009] citation format and can output to almost any final document target. You can see scrivomatic | A writing workflow using Scrivener’s style system + Pandoc for output… for sample batteries-included workflows for Pandoc, Quarto, Typst and Tufte Book for this.

Tutorials

Bookends has some helpful Youtube tutorials:

4 Likes

Zotero (CDS Open source) [macOS / Windows / Linux]

:exclamation:Zotero 7 has been released and is a great update, but if you want to use RTF/ODF-scan plugin it is not, and will not be made compatible with Zotero 7. So stick to V6.x or switch to the more flexible BibTex workflow…

Zotero is a well-established open source and free reference manager. Originally developed as a Firefox plugin, it became an independent app that is fully cross-platform. It has a number of plugins which enable Zotero to integrate with Scrivener. There are two main workflows with Scrivener, based on scannable citations(RTF/ODF-scan) or BibTeX(Better BibTeX) cite keys. In addition a couple of accessory tools to simplify the workflow, offering something similar to Bookends great floating citation interface.


Choose Zotero in Scrivener’s settings…

For maximum flexibility install BOTH core extensions to give you the maximum workflow flexibility.

Installing Core Extensions

  1. Better BibTeX (BBT)— follow the installation instructions.
  2. RTF/ODF Scan (only Zotero V6) — see here for detailed instructions. Install the extension in Zotero AND you must manually install the Scannable cite.js file into your Zotero Data directory translators subfolder , e.g. /Users/USERNAME/Zotero/translators/Scannable Cite.js.

To use, you must configure your Zotero Settings ⇨ Export ⇨ Quick Copy ⇨ Item Format to be either:

  • Better BibTeX Quick Copy (BBT).
  • Scannable Cite (ODF Scan)

For BBT, set it up to auto-export your Zotero references to a BIB file: Automatic export :: Better BibTeX for Zotero

For BBT you should configure the quick cite option to one of many formats, though I’d strongly recommend usng Pandoc format for maximum flexibility.

Inserting temporary citations

  1. No floating citations — In Scrivener press Y to switch to Zotero, then search+select your reference and press C to quick copy, then TAB back to Scrivener and paste.
  2. With floating citations — In Scrivener call up the tool, search and hit enter to insert it into your text.

Temporary/Scannable cite examples:

  • BBT (pandoc format): [@sallet2022]
  • ODF-scan: { | Sallet, 2022 | | |zu:1940082:7FGYRYDZ}

[optional] Install Floating Cite UI

To make writing a bit smoother you can install a UI that searches then pastes the citation. There are several options, the best ones both require Alfred, but there is a plain interface that uses Applescript:

  1. Super Citation Picker for Alfred — used for Pandoc / LaTeX based outputs. It uses a BibTeX file and searches in real-time so it can be used for any app even with Zotero closed.
  2. ZotHero for Alfred — used for Pandoc / LaTeX based outputs. It searches the Zotero database directly, no need for a BibTeX intermediate, but Zotero needs to be running.
  3. Zotpicker — Needs BBT to function, and while the recommended workflow is Pandoc, you can also use the picker for scannable cites. The script is saved as an app bundle then configure Scrivener to use this as the citation tool. Warning: this script may or may not work based macOS’s overly restrictive security settings. It is better to download the script itself, then save it as an application and self-sign it, then remove and add it from the macOS Security > Accessibility settings.

Compile options

  1. For Pandoc citations with BetterBibTeX use an MMD compiler workflow to Pandoc (with almost any output format) , using the --citeproc option which will use a CSL style to convert the temporary citations to a finished bibliography, or use Pandoc to convert your Scrivener markdown document to LaTeX and set --biblatex if you prefer to use BibLaTeX.
  2. There is a pandoc filter that can even convert the temporary citations into “Live” Zotero citations for DOCX and ODT, see Markdown/Pandoc :: Better BibTeX for Zotero for details.
  3. For RTF/ODF Scan, export to ODT then follow their instructions.
5 Likes

JabRef (Open source)

:exclamation:JabRef will finally get CSL support for LibreOffice, so these instructions may change slightly in the near future…

JabRef is an excellent open source and free cross-platform reference manager. Although it was originally for LaTeX users, the powerful GUI and other integration tools means it is a viable solution for Scrivener users with a Pandoc / Libreoffice / Word workflow too.

Installing Core Extensions

  1. For ODT compiles, you can use: LibreOffice JabRef Converter which turns temporary citations into ODT-native linked citations (and visa versa).

Inserting temporary citations

  1. Direct: JabRef allows you to choose the temporary citation format, edit the Cite command to use either Pandoc format [@key1; key2] or TeX format \cite{key1,key2}: … you then use k [Edit ▸ Copy… ▸ Copy citation key with configured cite command) to copy from JabRef and then paste it into scrivener.
  2. Floating: Super Citation Picker (see below) works well with JabRef.

Compile Options:

  1. MMD ⇨ Pandoc: Use the [@key1; key2] format for temporary citations and then use markdown for Scrivener’s compile format, and Pandoc or Quarto as a post-processing tool (many CSL styles to choose from).
  2. TeX ⇨ LaTeX: Use a direct-to-TeX format and \cite{key1, key2} format. Use BibTeX / BibLaTeX styles.
  3. ODT ⇨ LibreOffice: Use the \cite{key1, key2} format for temporary citations and then the LibreOffice JabRef Converter extension to turn the TC’s into native LibreOffice linked citations. This uses JStyles, which have some limitations…

[optional] Install Floating Cite UI

To make writing a bit smoother you can install a UI that searches then pastes the citation. For macOS this requires Alfred:

  1. Super Citation Picker for Alfred — used for Pandoc / Quarto / LaTeX based outputs. It uses a BibTeX file and searches in real-time so it can be used across multiple reference managers.
    scp

Links:

  1. JabRef Docs: push to apps.
  2. LibreOffice Integration.
  3. Workflow help with Citations and Bibliography - Help - Forum - JabRef
  4. The issue for adding CSL support to LibreOffice scanning: Support Citation Style Language (CSL) Styles in LibreOffice/OpenOffice - University Project · Issue #8893 · JabRef/jabref · GitHub – assigned for GSOC2024 so hopefully will be solved soon…
2 Likes

Mendeley (Elsevier)

Mendeley is a free online (with downloadable web-page app) reference manager from academic publishing group Elsevier. It is part of a strategy to counter the links between Endnote and search interfaces by Clarivate. The functionality is limited, although it does have good integration into the online tools that Elsevier owns like Scopus and ScienceDirect.

Mendeley used to have a proper desktop app but this was deprecated in favour of a web-based interface with an downloadable web app. They focus entirely on Microsoft Word for writing tool support (they even removed their previous LibreOffice plugin).

All is not lost however as they have recently added citation key fields and BibTeX output back into their manager. The BibTeX is not synced, so you will need to keep exporting as you add new references. With a BibTeX file you can use another tool to search and insert temporary citations into Scrivener.

Inserting temporary citations

Compile options

3 Likes

I’m hesitant to edit this myself given I’m new to the topic, but the author of Zotpic has apps on his Github – is the problem that they aren’t signed? Would be an easier step, but if they aren’t and need to be signed anyway, I don’t want to make edits.

Right that is my understanding from when I looked at this from a web search and a bit of self-testing, this is what I summarised above:

The script is saved as an app bundle then configure Scrivener to use this as the citation tool. Warning: this script may or may not work based macOS’s overly restrictive security settings. It is better to download the script itself, then save it as an application and self-sign it, then remove and add it from the macOS Security > Accessibility settings.

Maybe that situation has changed?

This is incredibly helpful. Could you perhaps offer a bit more explanation on compilation option 1.

I have Zotero + BBT + Alfred + Zothero running and the citations are outputting fine.

What is the process now for compiling the document? (I’m beginner to citekeys/Pandoc)

Hi @ashleyv

There was a recent post from @mtgardn who also uses Zotero and I provided a Scrivener project you can try to get working (read the rest of that thread too):

Make sure you create a synced.bib file using BBT as the first step.

You need to install pandoc, recommendation is to use homebrew to do so. I also demo using the Alfred workflow “supercharged citation picker” which is similar to Zothero[1].

The sample project has compile formats for 4 different outputs, you can study them. There is a Metadata file at the top of the binder, this is used to specify author, title and some paths to the bibliography files (the project itself puts them in the same folder the markdown file will be created in, but you can specify different paths if you want). You need to edit the compile post-processing pane to make sure the paths to pandoc and other tools are correctly set up, then it should just all work.


[1] I prefer it simply because it uses the bib file directly, so it is compatible with both my preferred manger Bookends and Zotero and JabRef and the manager itself doesn’t need to be open; but if you add a ref you need to sync before it shows up in the floating window.

2 Likes

Thanks for your thread! This looks really promising.

I am quite new to using these tools so could you advise where I am going wrong (I am only trying to compile to docx with formatted citations).

Screenshot 1 (my postprocessing setup):

Screenshot 2 (my updated metadata to point to the csl and bib files):

Screenshot 3 (the selection I am using to compile):

If I can get this up and running this will be quite life changing (or at least allow me to fully adopt scrivener in my workflow).

You have a small error in the environment field: there is a space after /usr/local/bin and before /Users... – paths are separated with a : — but in fact for DOCX (which uses no external tools, pandoc does everything) you don’t really need the Environment set up, removing all the paths there and it compiles fine:

Note you should be getting a compile.log which should show you what is happening, so if I put my test.bib and apa.csl on my desktop, set the path in the metadata and compile for DOCX I get this compile.log:

[INFO] Running filter citeproc
[INFO] Loaded /Users/ian/Desktop/apa.csl from /Users/ian/Desktop/apa.csl
[INFO] Loaded /Users/ian/Desktop/test.bib from /Users/ian/Desktop/test.bib
[INFO] Completed filter citeproc in 59 ms
[INFO] Loaded xkcd.png from xkcd.png

And a well formed DOCX out. Do you get any errors? Are you sure you have pandoc installed to /opt/homebrew/bin – to test where pandoc is you can type this into your terminal: where pandoc it should give you the path back.

2 Likes

Thanks for your patience.

Here is my where pandoc result which seems like there are two installs:
Screenshot 2024-11-12 at 06.46.50

Here is the compiler setup with environment cleared out (I am still using multimarkdown and Pandoc+Citations DOCX output format:

And the error log reads:
“couldn’t unpack docx container: Did not find end of central directory signature”

It currently generates a folder with an unreadable docx, the compile log and the png image.

Could it be Pandoc is not correctly setup?

It seems to be a pandoc problem, with an error I’ve never seen before. Let’s create a minimal test document. In Terminal, use these 3 commands to make test.md in the home folder (copy the text after the > one line at a time into terminal and press enter):

> cd ~
> echo "---\ntitle: A Test\nauthor: Jane Doe\n---\n\n# Intro\n\nSome text." > test.md
> cat test.md
---
title: A Test
author: Jane Doe
---

# Intro

Some text.

Does the text look OK?

Now lets see if pandoc can convert it to docx:

> pandoc --verbose --output test.docx test.md

If this doesn’t work then lets reinstall pandoc:

> brew uninstall --force pandoc
> brew install pandoc

What is the output of:

> brew list

Now try pandoc --verbose -o test.docx test.md again. If pandoc is working then something is going wrong with Scrivener calling pandoc.

Pandoc seems to be working. It managed to output the formatted docx file correctly also.

Here is the brew list:

What could I do to troubleshoot in Scrivener?

(btw what version of pandoc do you have installed?)

So next try to manually run pandoc on the markdown generated by Scrivener. Lets say you were compiling to /Users/ashleyv/Desktop/SimpleCitations-mmd

> cd ~/Desktop/SimpleCitations-mmd
> ls
compile.log.  xkcd.png  SimpleCitations.md
> pandoc -s -o Test.docx SimpleCitations.md
> open Test.docx

Does that work? Now add in the citation processing:

> pandoc -s --citeproc -o Test.docx SimpleCitations.md
> open Test.docx

Still works? If so you have at least a simple workaround, you can manually run pandoc and not use post-processing.

If it fails, please share your markdown file (https://cl1p.net/ or other inline text store).

1 Like

Thanks. I’ve managed to get it working. It may have been my own user error at some point but it is now outputting fine from within Scrivener. I will fiddle around now with the original tutorial you made to use my own bib file and csl styles but I may be up and running now as I’ve already got the Zotero floating citation bar accessible.