My Zotero > Logseq > Zettlr > Word Workflow

Things are changing fast with a lot of development happening in efforts to develop a Comprehensive Zotero Plugin. But this thread is for people like me who are (a) impatient, and (b) lazy, and want to have the best integration possible with the least amount of effort. That being said, this is a work in progress and I will update this post as the workflow changes. (Last update: 2022-07-16)

The research workflow Zotero > Logseq

  1. Install BetterBibLaTeX in Zotero
  2. Set it to export a Better BibLaTeX .bib file (set to automatically update).
    • This is the file that will be scanned to enter citations in your Logseq database in step 5.
  3. Install the MarkDB-Connect (Zotero Markdown DataBase Connect) plugin for Zotero.
  4. Configure MarkDB to scan your Pages folder for pages whose name starts with @ and have a valid BetterBibTeX citekey in them.
    • This will give you two-way sync between Zotero and Logseq. It can add a Zotero tag such as #logseq for all items that it finds in your graph, and then open those pages directly from Zotero. (I suggest assigning a color to this tag, as it will then show up clearly in your library.)
  5. Install Sawhney’s Citation Manager Plugin
  6. Configure Citation Manager as follows:
    • The page template should name pages to @{citekey} and have the metadata citekey:: {citekey} to best work with MarkDB. (The second is not strictly necessary, but seems to help.)
    • Include the following somewhere to be able to link back to Zotero: Local library: [{citekey}](zotero://select/items/@{citekey})
    • Include the following to be able to open the PDF within Logseq: ``File(s): {file++}

Note: This does not currently pull your Zotero annotations into Logseq, but I think the Zotero MD-Notes plugin might help with that? (I haven’t tried this yet.)

The Publishing workflow Logseq > Zettlr > Word

  1. In the preferences for Citation Manager for Logseq, set the inline literature citation format to [@{citekey}]
    • You do not need to create pages for every citation you reference, this is only for taking notes. Only the [@{citekey}] code is necessary for the next step.
    • Currently doesn’t quite work as well as it might because the template will enter the citation in a new block, not at the current location in the text, so you have to delete the result and paste it where it should go in the text. Another option is to simply switch to Zotero and copy the code from there. You can do this by configuring BetterBibTeX to use the Pandoc format for “quick copy” actions.
  2. Set up another export file from Better BibLaTeX (with automatic updating). This one should be a Better CSL JSON file. Set this one to be read by Zettlr.
  3. Point Zettlr to the CSL JSON file in the “citations” tab of the preferences.
  4. When writing, edit the citation as needed, for instance adding a page number would look like this: [@citekey, p123], separate two citations with a semicolon.
  5. Copy-paste the resulting paragraph into Zettlr and export to Word!
    • It will automatically recognize and convert the citations because it is using the exact same citekeys as the Citation Manager Plugin. This means you don’t really need to do any additional work.
    • Right now, I am just manually copy-pasting the block to a document in Zettlr. I haven’t tried exporting a whole page, or section of a page yet, but I don’t see any particular difficulty. You can remove bullets and brackets using the “copy as” contextual bullet menu.

Note: Someone on the Zettlr Discord gave me a fix for removing URLs and DOI from the bibliography in the Chicago (author-date) style.

Final thoughts:

This all works surprisingly well already, but note that while this workflow results in a well formatted word document with proper in-text citations and a bibliography, it may not be ideal for collaboration. For that you would probably want a Word document that had “live” Zotero markers in it so that someone else with a shared library could continue to edit the document. I’m not yet sure how to accomplish this?

This is all a bit abstract, so I illustrated what the process should look like if everything worked perfectly - as well as some notes about were it doesn’t.

3 Likes

Hi @Luhmann !

Thanks for your greats articles !

Can you share your page completed page template (and maybe inline) please ?

I haven’t tried it myself yet but a lua filter for Pandoc to achieve this has been around for a while now:

This might be a helpful resource: Help: From Markdown to Zotero live citations - Zotero Forums

1 Like

Sure:

alias:: {author lastname} ({date}) {title}
source:: [[{type}]]
citekey:: {citekey}
tags:: [[publication]], [[Logseq citation manager]], 
status:: 
icon:: đź“š

- {author++}. {date}. *{title}*. {publisher}.
  {author++}. {date}. "{title}." *{journaltitle}* {volume} ({number}): {pages}.
	- DOI: {doi}
	- URL: {url}
	- File(s): {file++}
	- Local library: [{citekey}](zotero://select/items/@{citekey})
- Abstract:
	- {abstract}
- Notes

Note that I have two rows for the full book citation. One is for books and one is for articles. I delete whichever is wrong. Hopefully eventually the template will be able to be context-sensitive and produce the right template for each type of source.

1 Like

Thanks. Zettlr supports lua filters for Pandoc, so it should be much simpler than the workflow descried in the Zotero forums link. I’ll have to test this out later…

2 Likes

Thanks a lot @Luhmann !

Thanks for sharing! I’m still in the initial stages of my dissertation and was wondering how others organised their literature to get some inspiration and discuss about it.

I’ve a question regarding the fundamental purpose of Zettlr. It’s clear you use it to export it to Word with formatted in text citations and a bibliography, but do you do all of your (draft) writing in Logseq, so you can export a finished product to Zettlr and respectively Word?

Thanks for the great writeup!

Do you have an idea how to deal with images?

I think a better way than to use Zettlr to mangle the citations to Chicago style “((Makhulu and Smith 2022, p, 178)” would be to just leave the BibTeX keys in the document with something easily recognizable (start all of them with an “@”? Then open the document in Word, and manually replace all keys with proper Fields using the Zotero plugin (I just tried, search also works for keys). Maybe someone could write a VB plugin that searches for such strings and then calls the Zotero plugin to replace them by fields

The advantage is that otherwise one could mix up citations in case there similar citations by the same authors. (Makhulu and Smith 2022a), (Makhulu and Smith 2022b) which don’t uniquely resolve back to an item.

Alt+F9 in Word toggles the Field codes, they contain information that is currently not available on the Logseq side (citation ID), but in principle it should be eventually possible to directly export from Logseq and turn all links that link to a citation page into a Field.

2 Likes

Wouldn’t you need to put that in quotes? Any comma in the title will result in two separate aliases, won’t it? Or do you add them manually if needed?

Zettlr does keep the citation key, it just displays it without so that you can edit your paper without seeing all the code. If you click each citation you get the citekey. As I say, and you can see in my example, the additions to the citekey are also hidden until export (or clicking) - such as the page number.

Moreover, it is supposedly possible to use a lua script in Zettlr to export to a Word document with live zotero keys if that is what you want. I haven’t tested this yet.

2 Likes

I don’t currently draft papers in Logseq, see my forum post on longform writing. I previously used Ulysses, but because of this workflow I will now try to use Zettlr instead to see if that works. I mostly use Logseq for initial note taking and outlining.

I generally clean it up manually. Hopefully later on there can be an option for a cleaned up {title} field that doesn’t have any non-letter characters, precisely for this reason…

That’s interesting. Why would you prefer to clean up the title, which might deteriorate the title’s recognizability, over setting the whole alias in quotes? In my experience, that prevents the alias from being interpreted as multiple aliases.

In my field, some titles can be quite long… I often only us the part before the semicolon as an alias, and ignore the rest.

2 Likes

Baroque titles? :wink:
But in that case, that makes sense.

Great Article. I replicated most of the workflow mentioned.
One problem I face is that I can’t open logseq notes from Zotero. Does anyone else on linux face the same issue?
Here are my MarkDB settings.


HI. I could not get the Citation Manager Plugin to work and I wanted live Zotero citations in a Word document without manual replacement of every citation instance. This is to allow easier collaboration outside of Logseq and easy style adjustments once closer to submission ready. After scanning many blogs and trying and failing a few things (most of this is new), I ended up with this sequence:

Please let me know if there is an easier way!

ASSUMING: Zotero and BetterBibTex, Pandoc and zotero.lua, and Word Zotero Plugin are installed and configured - see Help: From Markdown to Zotero live citations - Zotero Forums. And that you have Typora or some MD editor with find and replace.

Best to place everything you need in one folder, the library, zotero.lua and MD file for conversion. I have a special conversion folder. Remove any spaces in file names.

  1. Create journal article in Logseq using double brackets around [[@citekeys]] (no parentheses) where your want your inline references to go. This is for items imported from Zotero (I use the native Logseq Zotero plugin that creates a page with metadata and imports annotations, if you have extracted them using Zotfile in Zotero).

  2. Add page links with double brackets if this is useful for writing and the [[language]] appears natural - brackets will be sorted by the end of the process.

  3. Use Markdown headers, italics, bold, embedded links, etc., as you please to format the article. EXCEPT - using single or double brackets will complicate this, as they will be removed. Sorry about that!

Article ready for export?

  1. Ensure brackets are displayed in Logseq (ctrl+c ctrl+b). Go to Document View (a plugin). This removes bullet points from view while retaining brackets and rich text.

  2. Select all and copy. Paste into Typora (or another MD editor with find and replace).

  3. Replace double brackets [[@citekey]] with single brackets [@citekey]. This is what Pandoc looks for to convert all citekeys that correspond to a Zotero item. Save.

  4. Open PowerShell, go the folder with your files, and input: pandoc --lua-filter=zotero.lua “MD_to_convert.md” -s -o “Preffered_output_title”.docx

Check for any errors you may need to deal with in PowerShell

  1. If successful, open Word document, which should be in the same folder as the files, and click “refresh” on Zotero Word plugin, selecting your citation style. You should now have Zotero live citations. If your citation style uses brackets, DO NOT create the bibliography yet.

  2. Find and Replace remaining [single] brackets - left over from any non citekey page links - with nothing. This is why you should only use page links that sound natural in the text.

  3. Create bibliography with Zotero. Finish formatting to taste/necessity

Save as PDF in Word if you like

TADA! You can work in Logseq with operational @citekey links to their pages and all their connections, notes, the PDF in Zotero, etc., all the way up to a document for submission or collaboration outside Logseq.

Many people use Pandoc. It would be great to auto export from Logseq to Word via Zotero, but in the meantime, I imagine it would be simple to create a Logseq export that rendered @citekeys readable to Pandoc with single brackets, removed double brackets from page links, and retained all the other MD formatting.

My thanks for any feedback and tips.

1 Like

I’m having the same issue under Ubuntu Linux 20.04.
Does anyone have a workaround?

hi @war3241 and @Flan – i’m the maker of the Zotero plugin MarkDB-Connect. Someone just pointed me to this post. If you’re still having problems configuring the plugin, please post an issue in the github repo and I’d be happy to take a look.

2 Likes