Citation support for Muse

Muse is an authoring and publishing environment for Emacs. You can mark up documents using a very terse wiki-like syntax and then transform these documents to a variety of output formats, including HTML, LaTeX, and DocBook. Muse currently does not support citations or bibliographies. This is an attempt to retrofit citation and bibliography support for RefDB and bibtex. The short-term goal is to make Muse publish LaTeX and DocBook files which can further be processed with bibtex (LaTeX) or RefDB (LaTeX, DocBook) to generate formatted citations and bibliographies in output formats like HTML and PDF.


Currently there is a very basic implementation available as a patch against Muse version 3.02.93 (3.03 RC3). It kinda works for the target styles, but there is no support in the remaining styles. A later version of the patch will hopefully be included in the official Muse version. There is also a patch against muse-contex, a style which is not yet part of Muse. This patch needs further tweaks by someone who understands ConTeXt.


Two patches are available:


Unless you maintain your own Muse version anyway, you should download the sources and unpack them. Apply the patch to the sources like this:

tar -xzf muse-latest.tar.gz
cd muse/lisp
patch </path/to/muse-cite.patch

If you have the muse-contex.el file in the same directory, you can patch that file along these lines as well

Now you have to set up your .emacs to use the patched version of Muse instead of the installed one, if any:

(setq load-path (cons "/path/to/muse/lisp" load-path))
(require 'muse-mode)
(require 'muse-html)
(require 'muse-latex)
(require 'muse-docbook)
(require 'muse-contex)

How to use citations

The following is an example Muse file using citations:

#bibsource REFDB

* Title
** Subtitle

Some text before <cite>Miller1999</cite> and after the citation.

This is an author-only citation <cite type="author">Miller1999</cite>.

And this is a year-only citation <cite type="year">Miller1999</cite>.

Finally, this is a multi-head citation <cite>Miller1999,Andrews2005</cite>.

The #bibsource directive defines the source of the bibliographies:

Citations are encoded as <cite> elements which enclose the citation keys as they are defined in the bibliography file or database. In multi-head citations the citation keys have to be separated by colons or semicolons. The latex and docbook styles translate these to the proper separator automatically.

The <cite> elements take an optional "type" attribute to define how the citation is rendered. If the attribute is missing, you'll get a regular citation according to the bibliography style, e.g. (Miller et al., 1999). If the attribute is set to "author", only the name of the author(s) will be rendered. Accordingly, "year" will cause the year to be printed. This is useful to create citations like this:

These attributes work ok with DocBook+RefDB, whereas the LaTeX support is a bit whacky.

Remember that refdb-mode (the Emacs interface to RefDB) can retrieve references by simply marking the citation key and running the refdb-getref-by-field-on-region command. Later versions of refdb-mode will also allow to insert references as Muse citations (this is already implemented for DocBook, TEI, and LaTeX documents).

You may have noticed that there is no element to indicate the position of the bibliography. The latter is always created at a valid position close to the end of the document.

Post-processing the Muse output

Both the LaTeX and the DocBook output need some special treatment to make full use of the <cite> tag.


You'll have to provide a bibtex file that contains the cited references. Either you type this by hand, or you use RefDB to create such a file from a database. In either case, you'll have to run bibtex&latex&latex to include the references and to create the links appropriately.


The DocBook output of Muse uses the short citation format. There are two ways to transform this output:

Future directions