Zettelkasten Forum

Auto-bibliography creation, via citekeys

Ok script wizards, I'm wondering if someone might be able/willing to help me replicate, using Keyboard Maestro, a feature of sublimeless_zk that I really liked (before I stopped using s_zk, due to @rene 's apparent abandonment of it sad face) : auto-bibliography creation.

When executed, this feature finds all of the citekeys in the open note, queries a .bib file for the corresponding citations, and appends to the end of the note a nice list of formatted bibliographical entries.

For example, if the following citekeys were located somewhere are in the open note --- [#Crary2005]; [#Bates2002]; [#Frodeman2010] --- then upon execution the following entries would be appended to the end of the note:

[#Bates2002]: Bates, David. 2002. “Cartographic Aberrations: Epistemology and Order in the Encyclopedic Map.” In Using the Encyclopédie: Ways of Knowing, Ways of Reading, edited by Daniel Brewer and Julie Candler Hayes, 1–20. SVEC, 2002:05. Oxford: Voltaire Foundation.

[#Crary2005]: Crary, Jonathan. 2005. Techniques of the Observer: On Vision and Modernity in the Nineteenth Century. Cambridge, Mass.: MIT Press.

[#Frodeman2010]: Frodeman, Robert, Julie Thompson Klein, and Carl Mitcham, eds. 2010. The Oxford Handbook of Interdisciplinarity (1st Edition). Oxford ; New York: Oxford University Press.

Alphabetical order, formatted in what looks like ASA citation style (I would prefer Chicago citation style, but beggars, I've heard, cannot be choosers), each formatted correctly according to its type: article, authored book, and edited volume, respectively.

The .py file for this feature might offer some clues to this wizardry, but sadly it is all gibberish to me.

Perhaps this is a big an ask, but I ask it humbly! Is this possible? Could anyone offer leads on how it might be done?


  • In case anyone is interested, I cobbled together something rudimentary and inelegant but functional, using pandoc and pandoc-citeproc.


    I'm wondering if anyone here is familiar enough with pandoc and pandoc-citeproc to improve it a bit.

    Briefly, it:

    • grabs the path to the current note in The Archive
    • uses 'grep' to extract all citekeys
    • reformats citekeys from multimarkdown [#AuthorYYYY] to markdown @ AuthorYYYY, because that's what pandoc recognizes
    • creates a .md file with all citekeys (sorted and duplicates removed) listed in YAML metadata "no cite" format recognized by pandoc, so that it outputs only bibliographic entries, not in-line citations
    • uses pandoc-citeproc filter to create plaintext bibliographic entries from the citekeys and append them to the end of the note


    • It is a bit roundabout. I would like to streamline it if possible by doing away with the step of creating the citekeys.md file, but I don't currently see another way.

    • Also, the plaintext bibliographic entries that are the output of pandoc-citeproc have line breaks, for some reason. Can't figure out why. I'd like for them to not have line breaks.

    • I would like to match the format above, with the citekey listed before the bibliographic entry, but I haven't figured out how to do that yet. ¯\_(ツ)_/¯

  • @argonsnorts Maybe I'm confused but I thought the formating of "auto-bibliography creation" was handled by pandoc and pandoc-citeproc via the template option.

    See https://pandoc.org/demos.html #24.
    Find references to "biblatex" on https://pandoc.org/MANUAL.html#templates.

    I think adding Keyboard Maestro would complicate things a lot.
    One thing I did learn from a Latex lecture I went to on-campus was that Science Journals all have templates that they require writers to use to submit for publication and this controls that formatting and style. These are standardized.

    1. APA (American Psychological Association) is used by Education, Psychology, and Sciences.
    2. MLA (Modern Language Association) style is used by the Humanities.
    3. Chicago/Turabian style is generally used by Business, History, and the Fine Arts.

    Will Simpson
    I must keep doing my best even though I'm a failure. My peak cognition is behind me. One day soon I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.

Sign In or Register to comment.