สล็อตเว็บตรง

สล็อตเว็บตรง

สล็อตเว็บตรง

สล็อตเว็บตรง

LyZ: LyX plugin for Zotero LyZ: LyX plugin for Zotero « The Joys and Sorrows Of a Life At Sea

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

 

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.

192 comments to LyZ: LyX plugin for Zotero

  • MHW

    Works great (on Ubuntu 10.04). I’m especially grateful for the plugin since exporting the whole Zotero-Database would produce flawed BibTex files (probably due to special characters some abstracts). Thanks so much!

  • For whoever it was that wanted the “lastchecked” field, try using this slightly patched BibTeX translator: http://github.com/unhammer/zotero-natbib

    You might also be interested in this slightly patched version of LyZ: http://github.com/unhammer/lyz which lets you choose which BibTeX translator to use (in addition to giving a new cite key for use with the slightly patched Writer2LaTeX at http://github.com/unhammer/writer2latex).

  • ajj

    Hi, I’m a very lost new user. I downloaded the plugin, see the Lyz menu, have Lyx running, have set the bibliography in Lyx to my .bib file, have been making citations without any problems, have now set the path to the lyx server, but am getting lots of errors when I update in Bibtex: “specified LyXServer pipe does not exist” “Wrong path to lyxserver” “Could not contact server at: \\.\pipe\lyxpipe” and “Could not retrieve document name”.
    Obviously, my settings are all wrong. (1) What can I change? (I’m using Windows 7) (2) And anyway, where do I tell Lyz which bib file I want new entries to be written to? Not at all clear from documentation. Thanks.

  • ajj,
    the errors you see seem to occur on some systems, usually windows, for reasons unknown. I don’t have windows 7 yet, so I can’t be of much help right now. Sorry. It seems quite stable on xp at the moment.
    As for the bibtex file, please see “Adding and inserting citations” Item 2. For a new document you are asked to create new bibtex file, or use one that you have created previously with Lyz.
    Good luck

  • ajj

    Petr,
    Thanks for your reply and your patience with novices like me. After much opening and closing of programs I learned that I must open firefox *after* have my document is opened in Lyx. This was the critical step that I missed. Thanks again for writing this extremely useful program.

  • ajj

    Sorry to be a pain. But lyz is turning out to be very unstable on my Windows 7 machine. It works fine for the first insertion after opening up lyx and then opening up firefox. But then errors are generated upon trying to insert a second citation. Here’s the first error:
    Could not contact server at: \\.\pipe\lyxpipe

    And then the second error:
    Could not retrieve document name.

    But note: after 3 repetitions of trying to insert and getting these two errors, it finally inserts. This is very consistent.

    This is all very mysterious to me. If you ever have any suggestion, it would be much appreciated.
    Thanks.

  • I get an occassional error myself and there are reports from others. I will try to look into it soon, once I’ll be able to allocate some time for it 😉 Stay tuned…

  • fffred

    Hi,
    I was just wondering if there was any plan for a Firefox4-compatible version of LyZ, as Zotero 2.1b2 just got compatible.
    By the way, I also get the error reported above “Could not contact server at: \\.\pipe\lyxpipe”. It happens only when I close the Firefox window and open (I use mac os x).

  • fffred

    Oops I forgot to thank you very much for this very useful plugin !
    Thanks a lot

  • Will do. Thanks for reminder.
    And thanks for the error report. When you try again (to insert citation I presume), does the error still remain?

  • fffred

    Yes, when I try again to insert a citation, it keeps displaying those three errors. It stops only when I quit Firefox and start it over again.

    By the way, it would be really great to have an additionnal option “remove form lyx”, in order to clean the bibtex file. 😉

    Thanks again for the great job.

  • fffred,
    thanks. I try to find time to figure out what to do. I thought about the “remove from lyx”, but it seemed like not such an important feature. It shouldn’t happen that often that you want to remove a citation and it won’t appear in the references unless you cite it anyway 😉 But, sure, I agree, only if the day had more hours :) Now I have to port it to new Zotero API, but I just have so little time to look into it.

  • This single addon makes lyx an order of magnitude more useful to me. Please let me know what I can do to help.

    I’m using lyx 2.0 beta -and svn- and LyZ seems not to work there. It works perfectly fine on this computer while using 1.6.8, so I think this rules out quite a few compatibility problems.

    Now that 2.0 is approaching rc end of the year, it’d be nice to have it working by then. But of course, it all depends on how much free time you have Petr. Btw, lyx 2.0 is awesome :)

  • I am indeed looking forward to Lyx 2.0. But I didn’t have time to play with it so far, and it didn’t work for me straight away on Windows. I get on it soon. Look under the Christmas Tree 😉

  • Chris

    Hi Petr,

    thank you for lyz, your great connection piece of software.

    I got everything to work well now, here is my feedback: Since zotero’s bib export does not convert the ø character to latex’s \o properly (but inserts a “?” instead) I had to enable the utf8 export.

    Unfortunately the cite keys then got somehow messed up. They now look like this:

    AUTHORfunctionendsithtringreturnthis.substrthis.length-endsithtring.lengthendsithtring;YEARtitle
    (i.e. they now contain that additional “functionendsit…;” string between author and year)

    But all characters in the documents look good with utf8 encoding. :)

    • Petr

      I added the utf8 primarily for Chinese and the likes for which the use of bibtex keys derived from title and author would become unreadable anyway. So the idea was just to use the zotero id. After all one does not really need to read the keys using Lyz. But I confess that when in Lyx, I rather use the citation dialog and I have Lyz just for keeping my references in sync. I put that on my todo list, but can’t promise that it will be very soon. I try my best 😉

  • Chris

    Just as you say, the keys are nothing to worry about too much, they just seem to expose the presence of some bug. Everything else works fine. A Happy new year Petr!

  • Peter

    @Paweł Jochym: I have the same problem with “Update Bibtex”

    LyZ will delete all bibtex keys from .bib file(which I used before using LyZ) when I run “Update Bibtex”.
    Pawel can you send me your fix please?
    Thanks
    Peter

  • That’s actually an intended behaviour. I suggest to leave the “pre-lyz” citations in a different file and add that file to LyX bibliography together with the file managed by LyZ.

  • jacktanner

    Just a reminder to push out the 2.0.1 ver of LyZ via AMO when you can. Thanks for all your work on LyZ!

    • Petr

      Hi,
      thanks. It’s already there, waiting for a full review. Not sure how long that takes, it’s my first 😉 In the mean time you can download it from here.

  • jacktanner

    Petr, that link to /stuff is broken. However, the unreviewed LyZ 2.0.1 is already available from AMO (with a stern warning for installing unreviewed software).

Leave a Reply to Chris Cancel reply