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

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

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

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

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

  • Thanks a lot! I have searched for this function for a long time!!!
    I think I do not need to export bibtex file every time when I change it…So wonderful!

  • Dear, I have wrote a brief introduction to LyZ on my blog (in Chinese, http://www.loyhome.cn/873.html), and I’d like to translate this post into Chinese later on. Thank you again for your wonderful work!

  • Petr

    太好了! 謝謝你 😉

  • Done! See http://www.loyhome.cn/874.html if you like…:)
    By the way, can you understand Chinese? That’s really surprising!

  • acestrong

    Great job!

    谢谢你的工作!

  • Sounds great! I was always looking to prevent this extra export of data into a .bib file from zotero.

    But I have some problems:
    1. Your plug-in does not export special characters like German umlaute correctly.
    2. Deleting and renaming of bib and lyx-record does not work for me.

    But I’m working on a Mac, perhaps this explains the problem. What a pity! – I really would need your plug-in!

  • Petr

    Peter,
    thanks for you interest. Please let me know more and I try to fix it. 1. export the entries you have problem with to bibtex and send it to me (petr.simon@gmail.com). 2. in what way does not the deleting and renaming work? Please look in firefox menu bar Tools>Error Console, there should be an error message.
    Thanks

  • weremoose

    Hello,

    thanks for this plugin. I am using lyx on my mac and have problems using bibdesk for my references. I like zotero for this much more. I installed lyz and I can’t get it to work for some reason. I cannot find lyz preferences anywhere as well. In the add-ons lyz preferences is disabled and I don’t know if I have to make any changes. I get the cite in lyx option but I can’t get the citation in lyx. Any ideas or similar problem? Am I doing something wrong?

    Thanks again and happy new year!

  • I feel like an idiot, but I cannot get past the first step. I already have zotero. I installed the LyZ addon & restarted firefox. In Lyx I set the lyxserver path.

    But where is the “LyZ” menu? How do I find it? In the Firefox Tools panel, it says I do have LyZ installed, but the preferences button for LyZ is gray, it can’t be clicked.

    PS: there’s a misspelling in your title. you have an extra r in “integration” in Firefox’s addon listing, you have “LyX intergration plugin”

  • Petr

    Paul,
    thanks a lot. I have corrected the typo.
    The Lyz menu should appear in Zotero, left of the advanced search button. Lyz preferences are in the Lyz menu.
    If you don’t see it, please let me know what platform are you on and please check in Firefox menu: Tools> Error console. There should be an error message.
    Do you use any other Zotero plugins?
    Cheers

  • M!

    First: thanks for all the efforts you make
    I have installed LyZ. My question is when I click on “Update bib Tex” which .bib database it updates or how can I link the Bib Tex database that I created and inserted in the new document in LyX with Zotero, so when I click “Update BibTex” that database to be updated.
    Thanks!

  • M!

    solved! I do not know why it took some time to ask me to create a new database. It functions perfectly

  • R Ferreira

    Great tool!
    But I’m dealing with a kind of an error… When I cite in Lyx using Lyz pluging for Zotero I manage to see te citation in Lyx workplace but not in the previewed document where I only get a “[?]”.

    Can anyone help me on this one?

    Thanks

    • Petr

      Sorry for late reply, do you still have that problem have you already solved it? It seems that you haven’t inserted the Bibliography into the document. Cheers

  • Mircea

    Hey Petr, thanks for this plugin, it is really needed in the latex world :)
    I have a problem with it, though – I use Kile instead of LyX and LyZ simply does not work. I set the lyxserver correctly, but when I try to push the citation to LyX (Kile, actually), Firefox freezes and I have to kill it. Can you think of what could go wrong here?
    Thanks again for this!

  • Petr

    I have glanced at the Kile server implementation and my guess is that the hangs are caused by the fact that the Kile server only supports two commands that LyX server has and does not communicate back at all. So LyZ is waiting for response, which never comes.
    The functionality that Kile supports is very basic (only inserting citations and the whole biblipgraphy), so creating a separate plugin for Kile would be the simplest way. So none of the the convenience functions that LyZ has, will be possible for Kile. Btw. I’ve used Kile for a while, but I never saw how it could be even remotely compared to Emacs/AucTex/RefTex/Ebib.

  • Justin Wood

    Petr,
    I’ve been having some difficulty with citation records that contain non-ascii characters, like these:
    title: limiting … to 2 °C
    author: Voß, Jan-Peter

    After some messing about, I’ve finally learnt that BibTeX=LaTeX, and so rather than try to have these as Unicode in the BibTeX file – which won’t work – they need to be written as escaped LaTeX.

    title: limiting … to 2 {{\textdegree}C}}
    author: Vo{\ss}}, Jan-Peter

    This then works as I need it to with the LyX document set as Unicode UTF8, as you say above (and including package ‘textcomp’ in the document LaTeX preamble for the degree symbol).

    I also can get Zotero to export the underlying .bib file this way if it exports in a non-UTF8 encoding: so far “Western (MacRoman)” and “Western (Windows-1252)” have done the trick. That’s on my Windows box too; I will normally be using OS X.

    I’m telling you all this because I’d like to suggest that you update LyZ to allow setting the BibTeX export file encoding to handle this situation. I’m assuming Zotero’s API would allow you to do this, but I haven’t been able to find the necessary method to check at this point. (I was hoping to temporarily modify your JS code to test this before coming here.)

    Hope you feel this is worthwhile, thanks!

    PS – I have LyZ working fine on OS X, but so far I can’t get it to work on Vista32 (LyX 1.6.5). Nothing happens when calling Cite in LyX (no request to create bib file)

  • Petr

    Justin, thanks. The “ß” can be crunched by bibtex without problems. Only the degree symbol is problematic. Good idea about the encoding choice, I will look at it soon.

  • Petr

    Btw. I have no idea what Vista is about. Try to have a look at the Error console in Firefox and try to start lyx from commandline with ‘-dbg lyxserver’ option.

  • Marsh

    Dear Petr,

    Great add-on. It makes Zotero complete.

    I’ve only run into one small problem. If a web site or report is authored by an organization, LyX/LaTeX breaks the organization name into a “first” and “last” name. The way to avoid this is to use double curly brackets in the BibTeX database, but LyZ is only putting single brackets. For example, we want {{National Bureau of Economic Research}} but LyZ is putting {National Bureau of Economic Research}. As a result, without editing the .bib file, the References will have an entry: “of Economic Research, National Bureau.”

    Thanks again.

  • Petr

    Marsh,
    Thank you. I have tried putting the organization name into the single field and manually enclosing it with brackets, which seems to work fine (only LyX displays it incorrectly, splitting the name), but this might be limiting if you also use Zotero with Word or OOo plugins.
    I am not sure how to distinguish organization from an author.
    In fact all the export to bibtex is identical with Zotero’s, except for the citekeys, so this issue would be better dealt with in Zotero code.
    The only solution I can see would be to add another type of creator in Zotero (such as Organization), which would be handled during export to Bibtex by double brackets.
    Someone must have had this issue with Zotero already, have you found some discussion about it? I try to look, later today, someone must have had this problem.
    Petr

Leave a Reply to Ian Cancel reply