Menu

Format_Citations_for_Editors Log in to Edit

Conan Albrecht A BibDesk User

Using BibDesk Citations in Editors and Word Processors

A common question asked on the bibdesk-users email list is how to connect BibDesk to writing applications like Microsoft Word, Apple's Pages, TextEdit, or other word processors, to insert inline references while writing and/or a reference list. There are various ways to accomplish this.

These writing applications do not natively use .bib files the way LaTeX (with BibTeX or Biber) or Pandoc do. Writing in LaTeX markup or the simpler Pandoc Markdown is like writing source code that will later be compiled to produce a final typeset document, whereas writing in formatted-text editors is like editing the final typeset document directly with the source code hidden from the user. These are two different writing paradigms with different strengths and weaknesses.

BibDesk's template system

There is a basic way to put references into your writing application using only BibDesk and its template system. (BibDesk's template system is described in more detail in the Templates page of this wiki.) Note that if you are using a very contextually complex bibliography style, it may be easier to use one of the other ways in other sections below instead of BibDesk's template system. The steps for BibDesk's template system are:

If you only need a complete reference list at the end of your written document (and not inline references in the text):

  1. Write a custom template, or download a custom template, that produces the bibliography style that you want to use. When writing a custom template, it can be easier to edit a template that already exists instead of starting from zero.
  2. Add the custom template to the Templates pane of BibDesk's Preferences. Adding a Template to BibDesk describes how to do this in detail using the example of an html template.
  3. In the Citation pane of BibDesk's Preferences, set the custom template to be the "default format" for copying and dragging references.
  4. Sort the publications in BibDesk as needed, select all the publications that you want to include in the reference list, drag the selected publications (or copy and paste them) into your document in your writing application, and you are done! (An alternative last step is to use the menu command File → Export... to export a file for the reference list, then open the file in your writing application.)

If you need separate templates for inline references in the text and for the reference list at the end of the document:

  1. Write two custom templates, or download custom templates: one template for the inline references in the text and another template for the reference list at the end of the document.
  2. Add both custom templates to the Templates pane of BibDesk's Preferences. Adding a Template to BibDesk describes how to do this in detail using the example of an html template.
  3. In the Citation pane of BibDesk's Preferences, set the template for inline references to be the "default format" for copying and dragging references, since you will probably use this template most frequently.
  4. In the Citation pane of BibDesk's Preferences, set the template for the reference list at the end of the document to be the "format when holding Option key" for copying and dragging references.
  5. When you want to insert an inline reference, drag the publication(s) (or copy and paste them) into your document in your writing application.
  6. When you want to insert a complete reference list at the end of your written document, sort the publications in BibDesk as needed, select all the publications that you want to include in the reference list, hold down the Option key, and drag the selected publications (or copy and paste them) into your document in your writing application. (An alternative last step is to use the menu command File → Export... to export a file for the reference list, then open the file in your writing application.)

Alternatively, instead of dragging or copying and pasting references using BibDesk's general templates as described above, you could set up your custom template(s) as System Service templates. This is done in the Service templates section of the Citation pane of BibDesk's Preferences. Then in any writing application that can access the macOS Services menu, you can use the BibDesk services: Complete Citation, Complete Text Bibliography, or Complete Rich Text Bibliography.

A disadvantage of the previous steps is that the references in your writing application cannot be automatically changed to another bibliography style, nor automatically updated if the bibliographic data changes. However, an advantage of the previous steps is that no software is required other than BibDesk.

BibDesk's Word 2016 export format

Since BibDesk 1.7 (released May 2019), there is now a built-in export template for "Word XML", the Microsoft Word 2016 bibliography format. This option can be used to create a database that can be used with Word's built-in reference manager in the References ribbon in recent versions of Microsoft Word (2016 and later). The steps for doing this are:

  1. Use BibDesk's menu command File → Export... to export a file in Word XML format.
  2. Name the exported file Sources.xml (case sensitive).
  3. Quit Microsoft Word if it is running.
  4. Go to the folder ~/Library/Containers/com.microsoft.word/Data/Library/Application Support/Microsoft/Office to find the existing reference database for Word 2016.
  5. Rename the original Sources.xml to Sources.xml.bak as a backup.
  6. Move the exported file Sources.xml to this folder.
  7. Open Microsoft Word and your exported bibliography will appear in Word's built-in reference manager.

Note that Microsoft Word's built-in reference manager is not as flexible as Zotero's Word plug-in, described below.

Zotero as an intermediary

Zotero, an open-source cross-platform reference management application, can be used as an intermediary between BibDesk and your chosen writing application. To do this, first install Zotero, then use Zotero's menu command File → Import... to import your BibDesk database (.bib file) into Zotero. (For more control, before importing your BibDesk database into Zotero, install the Better BibTeX plugin in Zotero and configure its settings to your liking, and choose "Better BibTeX" format in the options of the File → Import... file selection box.)

You can use Zotero with your writing application in one of two ways:

  • In Zotero, select the publications for which you want to produce a reference list, control-click on them, choose Create Bibliography from Items... from the contextual menu, choose a bibliography style, and open the file that Zotero produces in your writing application. OR:
  • Insert inline citations from within Microsoft Word, LibreOffice, or Google Docs using Zotero's word processor plug-ins, described in more detail below.

Some background information: Zotero began as a plug-in for the Firefox web browser in 2006, and started its transition to a standalone application in 2011, while it also gained support for the then-new Citation Style Language (CSL) file format. CSL is an XML-based bibliography style specification analogous to BibTeX's .bst files, "but with dramatic improvements in ease-of-use, metadata flexibility, and international support". CSL has become an important bibliography style standard used by many applications (but not by BibDesk). The easy-to-use Zotero style repository contains thousands of CSL files (automatically pulled from the central CSL style repository), and the most widely used styles are frequently updated.

You may have wisely chosen to use BibDesk over Zotero due to one of BibDesk's many advantages such as its native BibTeX file format, its more Mac-like interface, or its support for macOS features such as AppleScript. Nevertheless, there are some strong reasons why Zotero can be a useful helper application when a BibDesk user writes in formatted-text editors:

  • Zotero has sophisticated and easy-to-use word processor plug-ins for Microsoft Word and LibreOffice that are automatically installed when you install Zotero. There is also a Zotero web browser plug-in that enables similar integration with Google Docs. These plug-ins are so widely used that they have become like a de facto standard for bibliographies in these writing applications.
  • Unlike some user-created scripts for BibDesk, Zotero's word processor plug-ins do not mix two different writing paradigms by inserting LaTeX commands into a formatted-text editor, but keep Zotero's code hidden behind the graphical user interface.
  • As mentioned above, Zotero uses CSL files, so any of the latest bibliography styles are certainly available and easy to install in Zotero. If you do not use one of the writing applications for which Zotero has a plug-in, it is still easy to export a formatted reference list from Zotero.

Apart from Zotero's usefulness for formatting references, it is also useful for getting data into BibDesk: George MacKerron's Zot2Bib add-on for Zotero, combined with one of Zotero's web browser add-ons, enables a BibDesk user to do one-click importing of publications from an external web browser into BibDesk from a wide range of websites.

Pandoc as an intermediary

Pandoc is a versatile command-line tool for converting between document formats, but most importantly for BibDesk users it can also convert BibTeX into formatted references using CSL files, the popular bibliography style files that were described above in the section on Zotero. If you are not very familiar with the command line, you should not be scared away from using Pandoc, because it can be installed easily using an ordinary Mac package installer, and Pandoc commands are easy to learn. If you can understand Pandoc's gentle instructions for getting started, then you can use Pandoc; if not, try one of the other options above.

After installing Pandoc, the simplest way to use it to produce formatted references from your BibDesk database is to open Terminal and run a command with the form pandoc -f bibtex -t format -C --csl=cslfile -o outputfile inputfile replacing format with your desired output file format (docx, html, markdown, rtf, or many others), cslfile with the name of your CSL file, outputfile with the name of the file to be produced, and inputfile with the name of your BibDesk database. This tells Pandoc to process the publications from your BibDesk database and produce a reference list in your chosen bibliography style in your chosen file format.

For example, let's say you have downloaded the latest APA style file (named apa.csl) from the Zotero style repository, and it is in your user documents folder with your BibDesk database (named References.bib). To produce a Microsoft Word .docx file of formatted references (named References.docx), you would open Terminal and run the command cd ~/Documents ; pandoc -f bibtex -t docx -C --csl=apa.csl -o References.docx References.bib.

You can also run a Pandoc command with AppleScript's "do shell script" command, and by saving such an AppleScript in your BibDesk Scripts folder, you can use it to produce Pandoc-formatted references from BibDesk without opening Terminal. Like most command-line tools, Pandoc can also read data from standard input instead of from a file.

Scripts

Several users have created scripts and programs that enable inserting references in Word, Pages, or other word processors. Most of these scripts run from the "Script Icon" menu in BibDesk. Including BibDesk references in these writing applications is usually as easy as the following process. This process mixes the two writing paradigms mentioned above, by inserting LaTeX commands into a formatted-text editor, and then transforming the LaTeX commands with a script.

  • In BibDesk's Preferences, in the Citation pane, make sure the default copying-and-dragging format is "TeX cite command".
  • Drag a reference from BibDesk to the appropriate location in your document. BibDesk inserts a \cite{refkey} statement in your text. You can also copy and paste or type the citation statements directly.
  • Continue dragging additional references into your document.
  • Run the script for your word processor from BibDesk's "Script" menu (the little script icon on the menu bar).
  • While each contributed script runs a little differently, most go through the document and replace each \cite{...} statement with a formatted citation reference. They also include a bibliography of formatted full citations near the end of your document.

Some scripts are also able to reverse the process back to the original \cite{...} statements.

BibDesk scripts can be found on two locations in this wiki. Because these scripts are contributed by users, there are often several available options for each word processor or editor.

You can also search this wiki or the bibdesk-users mailing list for your word processing or text editor name.


Related

Wiki: BibDesk_Applescripts
Wiki: FAQ
Wiki: Main_Page
Wiki: Other_Applications
Wiki: Templates

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.