Scrivener for Scientific Writing — setup

Andrzej Wodecki
4 min readDec 17, 2019

--

Photo by Alejandro Escamilla on Unsplash

Below please find my final setup for writing a scientific paper/book. Although my requirements seemed to be clear&simple, it took me app. 40 hours to put everything together. And here it is: my final set-up ready :)

My needs

I want my system to support me in:

  1. Managing scientific sources and citations
  2. Insert and enumerate simple equations
  3. Export the final document to MS Word docx format, keeping all Styles (like headings).

Tools

  1. Storing all documents and drafts: Google Drive
  2. Managing scientific sources: Zotero (https://www.zotero.org/)
  3. Making notes and structuring content: MindManager (https://www.mindjet.com/mindmanager/)
  4. Writing: Scrivener (https://www.literatureandlatte.com/scrivener/overview)
  5. Exporting: Pandoc (https://pandoc.org/).

My Workflow

Initiate the project

  1. set-up a Google Drive folder and create subfolders: {book title},… {book chapters}…, setup
  2. set-up a Zotero folder for all needed resources {book title}
  3. export this folder to Setup Google Drive folder in a BibTex format using Better Bibtex plugin (how to can be found in points 1–5 here) > mylibrary.bib
  4. in the Setup Google Drive folder store: a docx template for Your book (with all proper styles), mylibrary.bib and Your preferred citation style (choose sth from https://www.zotero.org/styles, eg. https://www.zotero.org/styles/chicago-author-date-16th-edition)

Managing knowledge sources

  1. Gather all necessary knowledge resources (books, papers, websites, reports etc.) using Zotero web plugin, it’s ISBN search or just drag&drop files from Your folders
  2. Organize them using TAGS
  3. Make notes: annotate PDFs and then export notes to Zotero using ZotFile, integrate the most important notes into MindManager
  4. Make draft structure (paragraph-detail level) in MindManager

Writing

  1. organize all the writing in Scrivener using folders
  2. control targets and writing progress with meta-tags
  3. compile to docx via MultiMarkdown and Pandoc (see compile presets below).

Install

Zotero

  1. Install Zotero (from www.zotero.org)

2. Install useful plugins:

  • Better Bibtex plugin (see installation instructions here) > to export Your reference library as a BibTex file
  • ZotFile > for efficient PDF management, especially exporting annotations from PDF to Zotero

3. Install Zotpick-applescript > for a possibility of calling Zotero citation during writing with a single click:

Scrivener

I suggest to purchase it directly from https://www.literatureandlatte.com/scrivener/overview — an AppStore version has some limitations.

Pandoc

For markdown to docx conversion.

  1. from the terminal with brew install pandoc or from this page.
  2. Additionally, install the following pandoc extensions
  • pandoc-citeproc: for managing citations. Installation instructions here, or:

brew install pandoc-citeproc

  • pandoc-eqnos: for enumerating equations. Installation instructions here, or pip install pandoc-fignos

Setup

The only, and the most difficult to, setup you need is Scrivener.

(suggested, but not required): import my Scrivener preferences and theme settings from scrivener settings GitHub folder

Compile presets. This is the most important — magic happens here!

From scrivener settings import My Markdown.scrformat.

  • click File > Compile
  • drag and drop My Markdown.scrformat into the Formats panel on the right. Choose “My Formats” option

To see it’s presets: right-click > Edit. I made a lot of changes to Styles, basing mostly on Scrivomatic MarkDown exports (see: https://github.com/iandol/scrivomatic).

The most important settings are in the Processing script. It took me app 30 hours to get there :). When you click Processing > Edit Script you will see sth like that:

The script itself is below (for Your Copy-Paste convenience — some fine tuning will be necessary):

fullfilename=$1
filename=$(basename "$fullfilename")
fname="${filename%.*}"
pandoc --filter pandoc-citeproc --filter /Applications/Anaconda/anaconda/bin/pandoc-eqnos --bibliography '/Users/Andy/Dysk Google/Scrivener/setup/! final setup/github/setup/mylibrary.bib' --csl '/Users/Andy/Dysk Google/Scrivener/setup/! final setup/github/setup/ee.csl' $filename -f markdown-auto_identifiers+tex_math_dollars --reference-doc '/Users/Andy/Dysk Google/Scrivener/setup/! final setup/github/setup/MS Word - Cambria.docx' -o $fname.docx

IMPORTANT: update paths to Your local settings:

/Applications/Anaconda/anaconda/bin/pandoc-eqnos <<< Your pandas-eqnos installation. Attention: I don’t know why, but even if pandoc-eqnos works perfect from Your terminal, here the full path is needed…

/Users/Andy/Dysk Google/Scrivener/setup/! final setup/github/setup/mylibrary.bib — this is a path to Your Google Drive/…/setup/mylibrary.bib file.

/Users/Andy/Dysk Google/Scrivener/setup/! final setup/github/setup/ee.csl — this is a path to Your Google Drive/…/setup/{preferred style sheet} file.

/Users/Andy/Dysk Google/Scrivener/setup/! final setup/github/setup/MS Word — Cambria.docx — this is a path to Your Google Drive/…/setup/{preferred docx style} file.

That’s it! It should work, although it may be very cumbersome…

Usage

Create a New Scrivener Project

Write something

Compile:

  • Compile for: MultiMarkdown
  • Choose Presets: My Markdown

My Example

I put one example on my GitHub folder: https://github.com/wodecki/writing

  1. Open draft project from the main GitHub folder
  2. Compile
  3. And check the output.

Useful resources

My inspirations:

https://raphaelkabo.com/blog/posts/markdown-to-word/

http://davepwsmith.github.io/academic-scrivener-howto/

Zotero, Markdown and Pandoc:

All videos on Zotero, Markdown and Pandoc from Nicholas Cifuentes-Goodbody, starting from https://www.youtube.com/watch?v=Gm2MbYB3k4o&list=PLXt-tu7G1H3vlRXLmGyOzeAp7ZKDK0pty&index=1. Great!

Scrivener has its own really great tutorials here.

My Github project with all the files

https://github.com/wodecki/writing

Happy writing :)

Andy

--

--