LyZ is a plugin for Zotero, which is intended to make working with LyX/Zotero more pleasant. The latest source code is available at GitHub. The latest stable release is available from the GitHub releases page.
NOTE: As of version 4.0, LyZ is distributed from the GitHub releases page. New updates will not be published to the location checked by previous versions of LyZ (the Mozilla Add-ons page). To receive new LyZ updates, please update to the latest version of LyZ.
.xpi
file from the GitHub releases page..xpi
file.\\.\pipe\lyxpipe
. Linux and Mac users can use e.g. ~/.lyxpipe
and change the LyZ settings accordingly.extensions.lyz.use_utf8
to true in about:config
to avoid escaping (in case you need to use non-latin scripts such as Chinese).NOTE for Firefox users: Firefox treats .xpi
files as Firefox add-ons and tries to install them.
To download:
You can also download it either with a different browser or with a command-line tool like curl
or wget
.
Open the LyX document you want to add a citation to and put the cursor at the point in the text at which you want the citation added.
From Zotero, select a citation and either from the LyZ menu or from the context menu (right click on the citation) do “Cite in LyX”.
When you try to insert a citation into a new document (i.e. document unknown to LyZ) you have to select a 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. Further citations are automatically added to this database.
Insert the BibTeX database into the LyX document by adding a bibliography (Insert->List/TOC->BibTeX Bibliography...
) and then selecting the newly created *.bib file as the database.
Document->Settings->Bibliography
, you may choose a citation style which determines how your citations will appear in the text. Natbib and Jurabib give more flexible citation styles than the default numerical option.Insert additional citations
If you modify the reference information of previously cited items in Zotero, use “Update BibTeX” from the LyZ menu to update the BibTeX database.
0_XXXXX
. Format keyword “zoteroShort” will produce only XXXXX, which can be used when exporting from OOo.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 the regular expression /[^a-z0-9\!\$\&\*\+\-\.\/\:\;\<\>\?\[\]\^\_\`\|]+/g
.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…
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.
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“.
Lyz stores identifiers for all of the references in the BibTeX database as a space separated string in the first line of the BibTeX file. Do not modify this line. When Lyz updates the BibTeX file, it first reads this line to check the current contents of the BibTeX (this behavior is useful if you are passing the BibTeX around between computers and want Lyz to keep up with the changes). If this line is not properly formed, an error will occur and Lyz will not work properly.
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.
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.
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.
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.
URLs in bibliography. Use bibliography style that can handle URLs, such as apalike, or add \usepackage{url}
to your preamble.
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.
When working with non-latin scripts such as Chinese, set extensions.lyz.use_utf8
to true in about:config
to avoid escaping.
Please follow these tips to find out the source of your problem:
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.
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.
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.
Extract useful information from Zotero’s Error Console (by starting Zotero on the command line with the --jsconsole
option) and from commandline where you ran lyx.exe -dbg lyxserver
.
Peruse the Issues opened by other users at https://github.com/wshanks/lyz. Be sure to check the closed issues as well to see if a solution has already been found for your problem. If not, open a new issue.
Some users have found that the Update BibTeX command stops working unexpectedly. One possible solution is to edit the lyz.sqlite
file in the Zotero data directory directly and to remove any bibliography entries in it that look malformed (e.g. some of their fields are empty). To edit lyz.sqlite
, a SQLite editor is needed. The sqlite-manager Firefox addon is a light-weight option. If you experience this issue and have any insight on what causes it, please contact the developer via GitHub (open a new issue or comment on one of the closed issues related to Update BibTeX).
On Windows the lyxpipe path (\\.\pipe\lyxpipe
) is a special path and not a real file. You should not try to change this path to something else.
Zotero 5.0 introduced numerous API changes. Versions 3.0.0 and higher of Lyz are compatible with Zotero 5.0 and greater. Versions 2.x and lower only support Zotero version 4 and earlier.
The current maintainer of LyZ is not the original creator and is not intimately familiar with the source code. He plans to update LyZ as necessary to maintain functionality with the latest releases of LyX and Zotero. He will also happily accept and merge code patches submitted by other users. He will try to help with other issues that users experience, but he doesn't make any promises about being able to make things work.
Lyz was written by Petr Šimon. It is inspired by Lytero, which Petr wanted to improve, but he 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! It is currently maintained on GitHub by Will Shanks.