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

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

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

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

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

  • Greg

    Great to hear that there will be an update! Any chance that it will use the same new word integration with the slick small popup window?

  • Petr

    Hi Greg,
    I’m getting ready 😉 Still a bit busy though, but I will get to it soon. Unfortunately, integration similar to what you see in Word is not trivial. I would require hacking LyX, so don’t get your hopes up :)

  • Sue

    hi,

    i have a big problem. Try to connect zotero and lyx, it was working for one time, then broke. I dont have any idea why. If i try to “cite in lyx”, i receive that Error “Could not retrieve document name.” but i dont have any zotero-document left. i’m no specialist in computer and really desperate. Can somebody help me?

    thx ahead

  • Roey Angel

    Hi,
    I’m getting that error that others have reported here already: “Could not retrieve document name.”
    I’m using zotero on kubuntu(11.1) with the latest lyx (2.0). I made sure my lyx pipe is configured and that lyz knows it’s path (~/.lyx/lyxpipe.).
    Any idea how to solve it?
    Second thing, I much prefer using Kile for writing papers, is it possible to use lyz with Kile?

    Thanks in advance,
    Roey

    • Petr

      Thanks Roey,
      I’m going to look at that very soon. It would be helpful, if you could follow the instructions on the bottom of my LyZ page, especially starting LyX with “-dbg lyxserver”. Please let me know what it says there. Also please have a look at FF’s error console.
      I thought about Kile at the very beginning, but unfortunately Kile does not have enough functionality to do all the things we can do with LyX. If I remember correctly, only pushing citations was possible.
      Cheers

  • Roey Angel

    Hi,
    Thanks for the quick reply.
    I ran the debbuger (sorry, I missed out on the instructions before sendign the previous post).
    This is what I got after clicking ‘Cite in LyX':
    ../../src/Server.cpp(930): LyXComm: status:31, read_buffer_:, cmd:LYXCMD:lyz:server-get-filename
    ../../src/Server.cpp(1078): Server: Received: ‘LYXCMD:lyz:server-get-filename’
    ../../src/Server.cpp(1122): Server: Client: ‘lyz’ Command: ‘server-get-filename’ Argument: ”
    ../../src/Server.cpp(967): LyXComm: Sending ‘INFO:lyz:server-get-filename:

    ../../src/Server.cpp(781): LyXComm: Closing connection
    ../../src/Server.cpp(741): LyXComm: Opening connection
    ../../src/Server.cpp(774): LyXComm: Connection established

    Firefox doesn’t produce any error in the consule.

    Thanks again,
    Roey

  • Petr

    Roey, no worries :)
    I can assume you have a lyx document opened and you are using the latest lyz, right? I am still thinking there must be something wrong with your configuration.
    Please try “server-get-filename” in the LyX mini-buffer and also try in terminal: echo "LYXCMD:lyz:server-get-filename" > ~/.lyx/lyxpipe
    Do they return the filename?
    Thanks

  • roey angel

    Damn!
    or as Einstein is beleived to have once said: “Two Things Are Infinite: the Universe and Human Stupidity”
    It turns out that everytime I test Lyz I had LyX open but without an open document.

    Everything seems to work fine now when I work with an open document. 😛

    and if I may still query about Kile.
    Kile has an option to “”let kile process LyX commands sent by bibliography editors/viewers”. When I mark this option I can send citations directly to kile from a bibtex data base (say, using Kbibtex), even if the database was built using LyZ, but not directly from LYZ.
    Any idea why?

    Thanks again,
    Roey

    • Petr

      Bug resolved :) Having an open LyX document is indeed a requirement 😉
      As for Kile. I’ll have a look, maybe they have added other functionality since I last tried. I know it’s is definitely possible to push citations into Kile document. Can you do more then just insert citations with other bib managers?
      LyZ does not work for Kile, because before LyZ sends citation to the document, it asks the lyxserver for filename etc and Kile does not support that (as far as I know).

  • Roey Angel

    I’m not sure Kile does any thing else then get citations from bib managers and generate a reference list (what else should it do?).
    I dont think kile supports something like asking for the filename my only point was that it’s possible to use the lyxserver in order to push a citation directly into kile (without going through Lyx).

    Roey

  • Petr

    Right. I would like to add Emacs support anyway, so let me include Kile as well. But it won’t do much, just inserting citations.
    Don’t hold your breath though, it might take a week or three :) But I should be able to get into it quite soon.

  • Roey Angel

    Hi again,
    I noticed that lyz always pushes citations using \citet (I use the biblatex package with natbib=true).
    At least in my field of research the usual format is (author year) which can be achieved using \citep.
    Is there a way to tell lyz which natbib command to use when pushing citations?
    What I do at the moment is click on any citation in my lyz document and change it individually.

    Also, is there a way to change the translator from bibtex to biber? would it make a difference?

    Thanks
    Roey

  • Petr

    Hi Roey,
    Currently there’s no way to change that (except editing the source code). I suppose I could add a dialog where you could select that, but I confess, I use lyz just for the first insert and then just use the dialog in Lyx to insert it again.
    But hey, the code is open, feel free to make patch 😉
    And if you just use one type of citation in you documents, e.g. only (Author, Year), just open the lyx document in text editor and replace them all at once 😉
    Petr

  • Chris

    Hello Petr.

    System Information:
    LyX: 2.0.0 and 2.0.3
    Zotero: Standalone 3.0.3
    LyZ: 2.1.4
    OS: Windows 7, 64-bit Ultimate

    First, LyZ looks to be a really good fit for what I’m trying to do.

    Second, I cannot get this to work. I have set my LyX Server Pipe (\\.\pipe\lyxserver), have a file open in LyX, and receive a “Wrong path to Lyx server” message. It appears I need to set something up in Zotero standalone, but I’m not certain what I’ve missed.

    Any suggestions?

  • Chris

    There’s the issue.

    When you say I should set the same path in LyZ, how would I do this?

    I see no options for the extension in Zotero standalone 3.0.3, just a setting to turn automatic updates on or off.

    As I’ve said, I’m sure it’s something basic I’m missing here.

    Thanks for you response,

    Chris

  • Chris

    I think I see where this gets set.

    Under Zotero Preferences > Miscellaneous > Open about:config, I see this:

    extensions.lyz.lyxserver;\\.\pipe\lyxpipe

    Odd, it looks like my installation of LyZ is configured out-of-the-box to look for a pipe called “lyxpipe” (at least for my two installations of this version under Zotero standalone 3.0.3).

    With that fixed, I’m up and running now! I’ve got to say, this is great! Thanks!

    (I don’t expect you to know or have time for this, but I have a more general question, as I’m new to LaTeX: what is the best workflow for bibliography entries? Right now, I’m using a stand-alone bibliography file, which I have to update after each new reference–a two-step process that I’d like to get down to one step if possible. Thanks again!)

    • Petr

      Great :)
      Btw, LyZ has it’s own settings. Just click on the LyZ icon, you should see it.
      Not sure what you mean that you have to update the bibliography file. Do you mean that you need to add the citation? If that’s the case, there’s nothing you can do about that. Except that LyZ makes it a bit easier when you decide you want to use Zotero.
      I usually insert the citation from Zotero only the first time. When I need to cite the same author again, I do it from LyX.

  • Chris

    Petr,

    Yes, this is what I meant. Only after this did I notice the “LyZ” menu. Oops.

    Thank you for the support, and THANK YOU for a product that is (once configured) dead-simple to use and work with. : ) (now if only Mendeley would provide similar hooks…)

    Chris

  • Petr

    My pleasure. Enjoy!

  • Seongsoo

    Hi Petr,
    First of all, thank you for the great work. LyZ really makes my life easier. After following all the steps necessary, I ended up being able to insert a citation on LyX from Zotero (standalone). But the problem comes when I update bibtex file using LyZ menu on Zotero. Even if I update bibtex, there is no change. My BibTex file is not updated although a newly added reference is inserted in LyX. I added a dozen references to my zotero library but they are not reflected both in my BibTex file and consequently the bibliography list of my LyX document file. Did I miss something? Thank you!

    • Petr

      Hi Seongsoo,
      sorry for late answer. Let me try to understand your problem. You have to insert each and every citation you want in LyX document manually. Update bibtex is only for “updating” entries you have already inserted. Hope I have not misunderstood what you mean. If you are indeed trying to update modified entries and bibtex file is not being updated, please have a look in Firefox’s Error console. There seems to be some problem with update bibtex, but I haven’t had the time to test it.
      Cheers
      Petr

  • Martin

    Hi, my drive has failed and I lost my firefox directory. Fortunately I had zotero sync and my zotero is back. How can I get by lyz managed bibliography inside lyx files back as well?

    • Petr

      Martin,
      you should be able to get that back from the bibtex file, at least that’s how I remember it works :) Give it a try: backup you bibtex file, insert new citation and select you existing bibtex file. When you run update bibtex it should import the keys it finds in the file.
      Good luck and let me know if it works (sorry, have been away for a while and haven’t used LyZ much lately… thesis defense incoming next week…)
      Cheers
      Petr

  • Martin

    Hey Petr,
    yes, everything works!! Thanks a lot! How was your viva?

  • Petr

    Martin, great to hear that it works! Thesis has been defended :) Now I’m getting ready for a round of revisions…

Leave a Reply to Mike Sleutel Cancel reply