OpenOffice plugin for JabRef

Introduction

JabRef is an open source BibTeX bibliography manager.

This plugin offers an interface for inserting citations and formatting a Bibliography in an OpenOffice writer document from JabRef.

How to use the plugin

The plugin can be used with JabRef 2.4 or newer. If your JabRef version doesn't have a plugin manager (versions 2.4.x), you need to put the plugin jar file in a directory named plugins below the directory where the JabRef jar file is installed (typically under C:\Program files\Jabref 2.x if you are running under Windows). The plugin should be loaded next time you start JabRef, and an item named OpenOffice.org panel should appear in JabRef's Plugins menu.

The plugin should work with OpenOffice versions 2.4.x and 3.x, provided it is installed with Java support (this is usually the case on Windows, while in some Linux distributions you need to install a separate package named openoffice.org-java-common or something similar).

Updates:

2010-05-11: Version 0.7.4: Added option to sort alphabetically for citations with multiple entries.
2010-03-04: Version 0.7.3: Added support for <smallcaps> tag to indicate small caps in reference list. Several bug fixes.
2010-02-02: Version 0.7.2: Added MaxAuthorsFirst property to override MaxAuthors the first time each citation appears.
2009-10-07: Version 0.7.1: Several important bug fixes.
2009-08-26: Version 0.7: BibTeX fields are now preprocessed to handle LaTeX \textit and \textbf commands and character sequences. NOTE: it is no longer necessary to run FormatChars on fields.
2009-08-23: Version 0.6: Improved handling of undefined BibTeX keys. Added option to not sync automatically when adding citation.
2009-08-05: Version 0.5: Fixed connection problem on Mac. Fixed bug in merge function.
2009-06-03: Version 0.4: Added support for superscript/subscript tags in reference list, subscripted citations and different brackets for numbering in the reference list.
2009-05-17: Version 0.3: Added MinimumGroupingCount property. Some GUI changes.
2009-04-02: Version 0.2.1: Fixed bug in sorting of reference list.
2009-03-01: Version 0.2: Better sorting of citations in captions, tables and footnotes.
2009-02-25: Version 0.1.9: Added support for bold/italic citation markers, and for citations in table cells and footnotes.
2008-12-21: Version 0.1.2: Added invisible citations. Merged citations are now sorted.
2008-11-19: Version 0.1.1: Improved handling of OpenOffice shutdown and reconnect.
2008-10-25: Version 0.1: User interface improvements. Can now select which Writer document to work with.
2008-10-19: Version 0.0.9: Enabled connection to OpenOffice.org 3. Streamlined connection process.
2008-09-03: Version 0.0.8: No major changes, but packaged with JabRef 2.4.
2008-02-20: Version 0.0.7: New interface for style selection. Styles can now specify paragraph format.
2008-02-13: Version 0.0.6: Sorting and grouping of number citation markers.
2008-02-06: Version 0.0.5: Modified style file format. Fixed bug in handling names with elements like "van der".
2008-01-09: Version 0.0.4: Style file is now automatically reloaded if modified.
2007-12-17: Version 0.0.3: From this version, we bypass OO's built-in bibliographic system.
2007-12-04: Version 0.0.2
2007-12-01: Version 0.0.1

Downloads:

The plugin.

Plugin source code. The source code tree includes four OpenOffice.org jars and JabRef 2.5. The plugin is built using an included Ant build file.

Example style file

The plugin is distributed under the terms of the GNU General Public License, version 2 or later.

Using the OpenOffice interface

To communicate with OpenOffice, the OO plugin must first connect to a running OpenOffice instance. You need to start OpenOffice and enter your document before connecting from JabRef. The plugin needs to know the location of your OpenOffice executable (soffice.exe on Windows, and soffice on other platforms), and the directory where several OpenOffice jar files reside. If you connect by clicking the Connect button, the plugin will try to automatically determine these locations. If this does not work, you need to connect using the Manual connect button, which will open a window asking you for the needed locations.

After the connection has been established, you can insert citations by selecting one or more entries in JabRef and using the Push to OpenOffice button in the dropdown menu of JabRef's toolbar, or by using the appropriate button in the OpenOffice plugin panel in the side pane. This will insert citations for the selected entries at the current cursor position in the OpenOffice document, and update the bibliography to contain the full reference.

Note: JabRef does not use OpenOffice's built-in bibliography system, because of the limitations of that system. A document containing citations inserted from JabRef will not generally be compatible with other reference managers such as Bibus and Zotero.

Two different types of citations can be inserted - either a citation in parenthesis, "(Author 2007)", or an in-text citation, "Author (2007)". This distinction is only meaningful if author-year citations are used instead of numbered citations, but the distinction will be preserved if you switch between the two styles.

If you modify entries in JabRef after inserting their citations into OpenOffice, you will need to synchronize the bibliography. The Sync OO bibliography button will update all entries of the bibliography, provided their BibTeX keys have not been altered (JabRef encodes the BibTeX key into the reference name for each citation to keep track of which BibTeX key the original JabRef entry has).

The style file

You need to select a style file before connecting to OpenOffice - an external file which is selected using a standard file dialog. The style file defines the format of citations and the format of the bibliography. You can use standard JabRef export formatters to process entry fields before they are sent to OpenOffice. Through the style file, the intention is to give as much flexibility in citation styles as possible.

Here is an example style file:

NAME
Example style file for JabRef-oo plugin.

JOURNALS
Journal name 1
Journal name 2

PROPERTIES
Title=References
IsSortByPosition=false
IsNumberEntries=false
ReferenceParagraphFormat=Default
ReferenceHeaderParagraphFormat=Heading 1

CITATION
AuthorField=author/editor
YearField=year
MaxAuthors=3
MaxAuthorsFirst=6
AuthorSeparator=,
AuthorLastSeparator= &
EtAlString= et al.
YearSeparator=
InTextYearSeparator=
BracketBefore=[
BracketAfter=]
BracketBeforeInList=[
BracketAfterInList=]
CitationSeparator=;
UniquefierSeparator=,
GroupedNumbersSeparator=-
MinimumGroupingCount=3
FormatCitations=false
ItalicCitations=false
BoldCitations=false
SuperscriptCitations=false
SubscriptCitations=false


LAYOUT
article=\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\author} (<b>\year\uniq). <i>\title, \journal \volume\begin{pages} : \format[FormatPagesForHTML]{\pages}\end{pages}.

book=\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\author}\begin{editor}\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\editor} (Ed.)\end{editor}, <b>\year\uniq. <i>\title. \publisher, \address.

incollection=\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\author} (<b>\year\uniq). <i>\title. In: \format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\editor} (Ed.), <i>\booktitle, \publisher.

inbook=\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\author} (<b>\year\uniq). <i>\chapter. In: \format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\editor} (Ed.), <i>\title, \publisher.

phdthesis=\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\author} (<b>\year\uniq). <i>\title, \school.

default=\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\author} (<b>\year\uniq). <i>\title, \journal \volume\begin{pages} : \format[FormatPagesForHTML]{\pages}\end{pages}.

(Note that the layout for each entry type must be constrained to a single line in the style file - above, the lines are broken up to improve readability.)

The PROPERTIES section describes global properties for the bibliography:

The CITATION section describes the format of the citation markers inserted into the text. If numbered entries are used, only the BracketBefore and BracketAfter properties are relevant - they define which characters the citation number is wrapped in. The citation is composed as follows:
[BracketBefore][Number][BracketAfter]
where [Number] is the number of the citation, determined according to the ordering of the bibliography and/or the position of the citation in the text. If a citation refers to several entries, these will be separated by the string given in the property CitationSeparator (for instance, if CitationSeparator=;, the citation could look like [2;4;6]). If two or more of the entries have a series of consecutive numbers, the numbers can be grouped (for instance [2-4] for 2, 3 and 4 or [2;5-7] for 2, 5, 6 and 7). The property GroupedNumbersSeparator (default -) determines which string separates the first and last of the grouped numbers. The integer property MinimumGroupingCount (default 3) determines what number of consecutive numbers are required before entries are grouped. If MinimumGroupingCount=3, the numbers 2 and 3 will not be grouped, while 2, 3, 4 will be. If MinimumGroupingCount=0, no grouping will be done regardless of the number of consecutive numbers.

If numbered entries are not used, author-year citations will be created based on the citation properties. A parenthesis citation is composed as follows:
[BracketBefore][Author][YearSeparator][Year][BracketAfter]
where [Author] is the result of looking up the field or fields given in the AuthorField property, and formatting a list of authors. The list can contain up to MaxAuthors names - if more are present, the list will be composed as the first author plus the text specified in the property EtAlString. If several, slash-separated, fields are given in the AuthorField property, they will be looked up successively if the first field is empty for the given BibTeX entry. In the example above, the "author" field will be used, but if empty, the "editor" field will be used as a backup.

The names in the author list will be separated by the text given by the AuthorSeparator property, except for the last two names, which will be separated by the text given by AuthorLastSeparator. If the property AuthorLastSeparatorInText is given, it overrides the former for citations of the in-text type. This makes it possible to get citations like (Olsen & Jensen, 2008) and Olsen and Jensen (2008) for the same style.

[Year] is the result of looking up the field or fields given in the [YearField] property.

An in-text citation is composed as follows:
[Author][InTextYearSeparator][BracketBefore][Year][BracketAfter]
where [Author] and [Year] are resolved in exactly the same way as for the parenthesis citations.

If two different cited sources have the same authors and publication year, and author-year citations are used, their markers will need modification in order to be distinguishable. This is done automatically by appending a letter after the year for each of the publications; 'a' for the first cited reference, 'b' for the next, and so on. For instance, if the author "Olsen" has two cited papers from 2005, the citation markers will be modified to (Olsen, 2005a) and (Olsen, 2005b). In the bibliography layout, the placement of the "uniquefier" letter is indicated explicitly by inserting the virtual field uniq.

If several entries that have been "uniquefied" are cited together, they will be grouped in the citation marker. For instance, of the two entries in the example above are cited together, the citation marker will be (Olsen, 2005a, b) rather than Olsen, 2005a; Olsen, 2005b). The grouped uniquefier letters (a and b in our example) will be separated by the string specified by the UniquefierSeparator property.

The property FormatCitations determines whether the citation markers should be formatted with regards to italics, boldness, superscript and subscript. If FormatCitations is false, no such formatting will be done. If true, the citations will be italicized or not depending on the ItalicCitations property, set to bold or not depending on the BoldCitations property, and similar for the SuperscriptCitations and SubscriptCitations properties.

The LAYOUT section describes how the bibliography entry for each entry type in JabRef should appear. Each line should start with either the name of a BibTeX entry type, or the word default, followed by a '='. The default layout will be used for all entry types for which an explicit layout hasn't been given.

The remainder of each line defines the layout, with normal text and spaces appearing literally in the bibliography entry. Information from the BibTeX entry is inserted by adding \field markers with the appropriate field name (e.g. \author for inserting the author names). Formatting information for the field can be included here, following JabRef's standard export layout syntax. Refer to JabRef's documentation on custom export filters for more information about which formatters are available.

If author-year citations are used, you have to explicitly specify the position of the "uniquefier" letter that is added to distinguish similar-looking citations. This is done by including a marker for the virtual field uniq, typically right after the year (as shown in the example style file). The uniq field is automatically set correctly for each entry before its reference text is laid out.

To indicate formatting in the bibliography, you can use the HTML-like tag pairs <b> </b>, <i> </i>, <sup> </sup> and <sub> </sub> to specify bold text, italic text, superscript and subscript, respectively.

If you are using numbered citations, the number for each entry will be automatically inserted at the start of each entry in the reference list. By default, the numbers will be enclosed in the same brackets defined for citations. The optional citation properties BracketBeforeInList and BracketAfterInList override BracketBefore and BracketAfter if set. These can be used if you want different types of brackets (or no brackets) in the reference list. Note that these need not be brackets as such - they can be any combination of characters.

Known issues

Contact

If you have tested this plugin, and want to give your feedback, or if you want to contribute to the development of the plugin, please contact me at the e-mail address mortenalver at users.sourceforge.net.