[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [emacs-humanities] Citations in org-mode

From: M . ‘quintus’ Gülker
Subject: Re: [emacs-humanities] Citations in org-mode
Date: Tue, 9 Feb 2021 20:31:47 +0100

Dear Greg,

Am 09. Februar 2021 um 00:31 Uhr +0100 schrieb Greg Bognar via Emacs-humanities:
> The only thing holding me back is the handling of citations.  Ideally, I'd 
> like
> to be able just to insert a BibTeX citation, like you do in LaTeX, and let the
> conversion do the rest.  (I mean the conversion to docx or odt.)  In a simple
> case, a citation would be expanded into a full reference when the file is
> converted (in this project, all citations would be in endnotes, without a
> separate bibliography).

You are exactly in the situation I am in; during my studying, I used
LaTeX to create my documents which were expected to be submitted in
PDF anyway. Now that I have graduated and write “real-world” articles,
publishers always want DOCX -- publishers of Law journals do not have
much sense for LaTeX.

> This is all easy to do in LaTeX, of course.  But strangely, I haven't found
> anything useful describing how this could be done in org with docx/odt as the
> end result.

Currently, for org itself there is nothing else than org-ref, which is
geared towards LaTeX as others have pointed out. On the org-mode
mailing list, there has been a larger discussion about adaopting a
citation system into org itself and base it on Citation Style Language
(CSL), see here:


However, this is in development and not part of org-mode yet. Pandoc
is an option you may consider if you want to go outside of org-mdoe
itself; it has specific citation support and is well-maintained, in
contrast to what I outline below.

> I was hoping there would be a script that looks up the reference in
> the BiBTeX database, grabs the fields and formats it when the file is written 
> to
> docx/odt.  Even if the formatting is not what I want, I could
> probably tweak it.

Well. I have hacked together a custom solution that is horribly buggy
(since I am not that long graduated yet), but I intend to improve it
since I effectively depend on it if nothing else pops up (but no
promises). It works by leveraging org's macros (it is possible to have
org's macros call an elisp function). Currently, it only generates the
styling common in German Law journals. However, I have at least made
the styling somewhat modular (because there is no accepted unique
citation style in German Law journals). That is, if you decide to use
this, you will have to write quite a lot of elisp anyway. On the
format side, this thing can export to HTML, ODT, LaTeX, ASCII, and
Markdown; the backend-specific code is down to one single function
(zit-mkitalic) and I only need it because German jurists have the
annoying habit to quote commentaries like Doe/Donorogh/Muller, with
(only) "Muller" having to be italic because Doe/Donorogh are the
editors of the commentary. This cannot be represented in org's own
markup. For anything else, backend-independent org markup is generated
by the macro expansion function. Which means it is quite easy to
support anything org can export to, only `zit-mkitalic' needs to be

Here is it: 

There's even a (slightly outdated) README, but it is in German: 

It takes .bib files as input, which it parses by using functions from
Emacs' own bibtex-mode and some further custom code for in-field
parsing (which is quite buggy; it will for instance break on multiline
entries). To use it, you first load zit.el and then add the following
two lines to your .org file:

    #+MACRO: zit   (eval (zit-zit \"$1\"))
    #+ZITBIB: yourbibliography.bib

This makes available a macro called `zit'. You can then use that macro
the way it is described in the function documentation of the `zit-zit'
function. For example (real-world example from an article I

 Weitere Nachweise zum Meinungsstand bei 
{{{zit([Grützmacher]wandte-bullinger5[§ 69d Rz. 22 f])}}}.

As you can see, it supports multi-key citing with pre- and postnotes
each. On the downside, it only supports Biblatex .bib files (not old
Bibtex) and I do not intend to change that. The example above is a use
in a footnote, but because the `zit' macro just evaluates to the bare
citation markup, you can use it anywhere. What it does not support is
the generation of bibliographies, because this tool is only meant for
writing articles. For my PhD thesis, I will use LaTeX anyway, so it is
unlikely I add bibliography support to zit.el (I would accept patches
if they don't break the functionality I need, though).

Again: this thing is intended only for my personal use and I know it
often breaks as of now (it for example occasionally puts spaces into
the citation where it should not do, I am working on that one). The
existing styles are geared towards judicial citations; that's why it
has support for the rather arcane @jurisdiction entry type of
Biblatex, which I need all the time. To add your own styles, add it to
the `cond' statement in `zit-expand-citation-fn' and then set
`zit-cite-style' accordingly. The two existing styles should give you
an idea how to write a cite style; the entire styling is done in

The code quality is probably not ideal. For example, it modifies
`bibtex-biblatex-entry-alist' on loading.

Just yesterday I found that it is possible to hook up my system with
ebib as a .bib file manager, because ebib can be easily customised to
generate any syntax. I have not tried that out much yet after that
discovery, though.

I can make no promises on stability or anything. Use at your own risk.


Dipl.-Jur. M. Gülker | https://mg.guelker.eu |    For security:
Passau, Germany      | kontakt@guelker.eu    | () Avoid HTML e-mail
European Union       | PGP: see homepage     | /\ http://asciiribbon.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]