LyZ: LyX plugin for Zotero

LyZ is a plugin for Zotero, which is intended to make working with LyX/Zotero more pleasant.

Features

  • Inserting citations to LyX from Zotero.
  • BibTeX database automatically updated when citation is inserted.
  • BibTeX database can be updated when the references in Zotero are modified.Get Zotero
  • Custom BibTeX key format.
  • Unique BibTeX key check.
  • Custom BibTeX translators.
  • Synchronization of BibTex keys between LyX document, BibTeX database and LyZ.
  • Editing of master/child documents (the same BibTeX database) and multiple documents (different BibTeX database for each document).
  • Persistent association of LyX documents and BibTeX databases.
  • Support for group cooperation.

Installation and Settings

  1. LyZ works with Zotero 2.0 and later.
  2. Install LyZ  from Firefox Addons and restart Firefox.
  3. Open LyX and set LyXServer path (in LyX go to menu, Tools > Preferences... > Paths and set LyXServer pipe to): Windows users can use the default path setting in LyZ, i.e. “\\.\pipe\lyxpipe”. Linux and Mac users can use e.g. “~/.lyxpipe” and change the LyZ settings accordingly.
  4. By default all characters are escaped, e.g. š becomes \v{s}. Set extensions.lyz.use_utf8 to true in about:config to avoid escaping (in case you need to use non-latin scripts such as Chinese).
  5. Open document in LyX.

Adding and inserting citations

  1. Open Zotero, select citation and either from LyZ menu or from context menu (right click on the citation) do “Cite in LyX”.
  2. When you try to insert citation into a new document (i.e. document unknown to LyZ) you have to select BibTeX database. You will be asked to either create a new database or choose a database you have created before (by LyZ). Type the database name (*.bib extension is automatically added if you don’t provide it) and press OK. The citation is added into the BibTeX database you have just created and inserted into the LyX document. Your citation should appear in LyX document now.
  3. Insert the BibTeX database into LyX document. See BibTeX and LyX.
  4. Insert additional citations, new ones from Zotero, previously added citation can be either inserted through the LyX interface or from Zotero.
  5. If you modify the reference information in Zotero, use “Update BibTeX” from LyZ menu to update the BibTeX database.

Custom BibTeX keys

  1. Custom BibTeX keys can be set in LyZ > Settings dialog.
  2. The default format is “author year title”. Good alternative for the use with natbib package is format “zotero”, which will produce “human unreadable” BibTeX keys. It consists of library ID and zotero item key, e.g. 0_XXXXX. Format keyword “zoteroShort” will produce only XXXXX, which can be used when exporting from OOo.
  3. Key formats can be composed from keywords “author”, “year”, “title”, “zotero” and separators such as “_” (the following characters should be safe to use: a-z, 0-9!$&*+-.:;<>?[]^`|), e.g. “author year title”, which will produce authoryeartitle BibTeX key, e.g. tichy1988thefoundations. If you prefer the default format used in Zotero BibTeX export (tichy_thefoundations_1988), change the pattern to “author _ title _ year”. The keywords and any separating characters have to be separated by space. Characters in citekeys are escaped and unsafe characters are removed conforming to /[^a-z0-9\!\$\&\*\+\-\.\/\:\;\<\>\?\[\]\^\_\`\|]+/g.
  4. If you use custom BibTeX translator and want to use the cite keys generated in the translator, go to LyZ > Setting and switch creation of cite keys off.

Update BibTeX

Menu command “Update BibTex” will update BibTeX database of the active LyX document. Whatever changes made in Zotero will be reflected in the update, including BibTeX keys if the BibTeX key format or the relevant information (first author, title, year) have been changed.

When a single BibTeX database is shared among several authors, e.g. using version control system such as SVN and CVS, LyZ database is updated from local working copy of BibTeX database.

Only current LyX document will be updated. Multiple document update is implemented, but seems unreliable. Needs more testing…

Synchronization between LyX/BibTeX/LyZ

When Zotero reference is changed, BibTeX database as well as the LyX document can be updated. This is useful when nice BibTeX keys are used, such as ‘author year title’ and e.g. the title or the first author’s surname has been modified, which will result in modification of the BibTeX key. When the “Update BibTeX” is run, you should select to update the LyX document in case your modifications to Zotero references might affect your BibTeX keys. Before the update, a backup of the active LyX document is made (extension *.lyz). LyZ will save, close and then reopen your document.

Notes on usage

  1. Credits: Lyz is inspired by Lytero, which I wanted to improve, but ended up starting from scratch. Hence the new name. Thanks to Dan Stillman and mronkko at zotero.org forum. Justin Wood for BOM and escaping suggestions and donation!
  2. Always modify your references in Zotero. If you modify the BibTeX database manually or using other software, LyZ will overwrite all the changes when you run “Update BibTeX“.
  3. Keep your Zotero items unique. LyZ does not make an attempt to identify duplicates, they will be treated as different items and unique BibTeX keys will be created.
  4. When working with master/child documents in LyX, you will have to specify the BibTeX database for each child document. This will be the same file as specified for the master document. Unfortunately LyZ has no way of knowing the relationship between documents, so it has to be done manually.
  5. Old writing projects can be deleted from LyZ menu. When the record of BibTeX database is deleted, all associated LyX document records are also deleted. When LyX document is deleted, associated BibTeX database will remain untouched as it may be used by another document. The actual file won’t be deleted.
  6. BibTeX database is uniformly exported to UTF8 and all characters are escaped. Exporting to doesn’t seem to have any advantages. When your references contain extra characters such as the degree symbol, add \usepackage{textcomp} to your preamble.
  7. URLs in bibliography. Use bibliography style that can handle URLs, such as apalike, or add \usepackage{url} to your preamble.
  8. LyZ stores the information about documents and BibTeX databases in lyz.sqlite in the Zotero folder. If you backup Zotero with some synchronization application, you will notice the new file.
  9. When working with non-latin scripts such as Chinese, set extensions.lyz.use_utf8 to true in about:config to avoid escaping.

Source code

Please explore at https://github.com/willsALMANJ/lyz.

Problems, Ideas, Requests

Please follow these tips to find out the source of your problem:

  1. Run Lyx in debugging mode from commandline by (Linux and Mac users change accordingly)

    lyx.exe -dbg lyxserver

    Useful messages should appear whenever you send some command from Lyz. A useful message will contain words like ERROR, undefined etc.

  2. To send a command from Lyz, you simply use one of the functions, e.g. “Cite in Lyx” or use command line, viz. http://wiki.lyx.org/LyX/LyXServer.
  3. Also you can use a variant of the last version of Lyz, which has additional menu item “Test…”. This will allow you to send single commands to Lyx. Currently Lyz uses the following commands (code in the parentheses indicates usage):
    • server-get-filename (server-get-filename)
    • citation-insert (citation-insert:LYZ:author2010title)
    • buffer-next (buffer-next)
    • server-get-xy (server-get-xy)
    • buffer-write (buffer-write)
    • buffer-close (buffer-close)
    • file-open (file-open:path, where path is the response from server-get-filename)

    All functions Lyz has are patched together using these commands. The most trouble some seems to be the server-get-filename.

  4. Extract useful information from Firefox’s Error Console and from commandline where you ran lyx.exe -dbg lyxserver and send it to me or even better file a bug, ask a question or submit a request at https://github.com/willsALMANJ/lyz

Feel free to buy me a beer, vino, coffee or tea. I take it in cups, mugs, glasses, tumblers, goblets, schooners, jars and pots. Pour me whatever you feel I deserve ;)

 

 

When Zotero reference is changed, BibTeX database as well as the LyX document can be updated. This is useful when nice BibTeX keys is used, such as ‘author year title’ and e.g. the title or the first author’s surname has been modified.

[paypal-donation]

188 comments to LyZ: LyX plugin for Zotero

  • Julie

    Hi, and thank you for the plugin !

    I would also be very interested in the use of Lyz with Kile – actually I installed Lyz but I do not really use it; I have to export my zotero library in bibtex, open it with jabref and use it in Kile, but if I could use only Zotero it would be great and I would save a lot of time. I’m still a beginner and cannot write code, so I think I will wait for the improvement…

    • Petr

      I hear you :) I can’t find a good reason why would anyone want to use Kile instead of LyX. It’s so much more comfortable! I keep the request in mind, but not much can be expected, only simple citation inserting…

  • chrystus

    Good idea! Regards

  • Jonathan Hansford

    Am using Zotero Standalone but not Firefox and unable to download Lyz from Mozilla website. Tried the link at the top of the page but it took me to a login screen for WordPress. Searched the web for a download site and ended up at Softpedia:

    http://mac.softpedia.com/progDownload/LyZ-Download-68955.html

    Hope this link helps others arriving at this page.

    You could really do with fixing your link at the top of the page!

  • Jonathan Hansford

    I downloaded lyz-2.1.4-fx.xpi from Softpedia and installed it into Zotero Standalone. I restarted Zotero and can see Lyz in the Add-ons Manager, but the only options I get are “More”, “Disable” and “Remove”. Clicking on “More” gives me the option to switch automatic updates on or off.

    I cannot find any opportunity to view the Lyz options, nor can I see any Lyx-related options in the context menus.

    A search for “lyz” in about:config returns:

    extensions.enabledAddons : zoteroOpenOfficeIntegration@zotero.org:3.5.2.SA.3.0.7,zoteroWinWordIntegration@zotero.org:3.1.7.SA.3.0.7,lyz@zotero.org:2.1.4

    extensions.installCache : [{"name":"app-global","addons":{"zoteroOpenOfficeIntegration@zotero.org":{"descriptor":"C:\\Program Files\\Zotero Standalone\\extensions\\zoteroOpenOfficeIntegration@zotero.org","mtime":1340199845140},"zoteroWinWordIntegration@zotero.org":{"descriptor":"C:\\Program Files\\Zotero Standalone\\extensions\\zoteroWinWordIntegration@zotero.org","mtime":1340199844906}}},{"name":"app-profile","addons":{"lyz@zotero.org":{"descriptor":"C:\\Documents and Settings\\dev1\\Application Data\\Zotero\\Zotero\\Profiles\\j6ooagye.default\\extensions\\lyz@zotero.org","mtime":1340276452609}}}]

    I have even tried rebooting my PC and restarting Zotero Standalone.

    I am running:
    Lyz 2.1.4
    Zotero Standalone 3.0.7
    LyX 2.0.3
    WinXP SP3

  • Dominik

    Doesn’t seem to work with zotero 3.08
    Am I doing something wrong? The citation exported into lyx is ill-formatted. I just have a long string with authors etc.

    In general, does this plugin have a future? Would my workflow with zotero > lyz > lyx be future-proof? I have just considered trying out lyx. Since I heavily use zotero I guess I abandon lyx again if zotero integration doesn’t work.
    But thanks for trying!

    • Petr

      Dominik,
      can you provide more details? Seems to work just fine on my computer.
      Re the future: Can’t promise much. I won’t be using LyX much in the near future. I would like to keep LyZ updated, but I am also considering giving it up, if there’s someone out there who would keep maintaining it.
      Cheers
      Petr

  • Do you still maintain LyZ? I’d be interested in maintaining it.

  • Roey Angel

    Lyz is apparently incompatible with Zotero 4.0.1. Is a new version planned? I hope so, as Lyz has become an indispensable part of my workflow.

    Roey

  • Petr

    Hello Roey,
    Unfortunatelly I don’t know, because I am not maintaining LyZ anymore.
    LyZ is now maintainted here: https://github.com/willsALMANJ/lyz
    Please check there
    Cheers
    Petr

Leave a Reply