Lyx Support

I really like zotero and I think this application has a great potential to save many scientists a lot of time. But I miss the possibility to directly push the citation to lyx or other latex editors. As most other scientist I know work with a combination of lyx and Jabref instead of MS Word and Endnote but they would probably not switch to zotero because it means working with an additional programme instead of saving one....
It would be great if a 'push to lyx/kyle/emacs...' feature could be implemented in a future version of zotero - this would definitely enlarge the Zotero community!
  • I'll second that. My work around is to export a BibTeX file & use that.

    Documentation on the lyxpipe (which is used by both lyx and kyle) is:
    http://wiki.lyx.org/LyX/LyXServer

    I believe that JabRef's method of interacting with Emacs is different, and the method of interacting with WinEdt is different than the other two techniques. Most BibTeX-based reference managers choose to support at least lyxpipe.
  • It looks like LyXServer integration could be added fairly easily via a Zotero utility.

    We probably won't have time to work on this ourselves any time soon, but we're happy to provide guidance (ideally on the dev list) as needed.

    Note that the next beta will also have a Quick Copy feature that lets you copy a citation to the clipboard with a keystroke, and we're planning to add support for export formats too, which would make copying-and-pasting BibTeX trivial.
  • I'm interested in working with others on a plugin for zotero to implement citation integration with kile and lyx. It looks like others are interested too (merle in http://forums.zotero.org/discussion/31/bibtex-export/ for one). As I see it, there are only a few parts necessary to make a lyxpipe-based citation plugin.

    1) There needs to be an accessiblevariable that zotero will use as the bibtex key when generating a bibtex file (preferably something human readable like Smith2007a). See http://forums.zotero.org/discussion/31/bibtex-export/ for a discussion of the format - it looks like there is already code for generating this key from sql queries (used for the bibtex export). There was some discussion of making this globally unique to prevent an exported bibtex file from zotero from conflicting (or mis-citing) with a key generated from a more recent database, but the Google scholar bibtex export format seems to me to solve this problem and still keep it readable (AutherLastName_Year_FirstLettersOfTitle passed through a regexp to remove disallowed characters). This part seems almost ready to use for the integration plugin, if not completely ready, and would work as written if we were not so worried about global uniqueness or human readability.

    2) A bibtex export. This is nicely implemented, with the above caveat.

    3) The user needs a way to trigger a "push" to the lyx pipe for a zotero entry by selecting it and pressing a button in zotero. I think this would make more sense than the plugins that integrate into open office and word, since lyx and kile don't really have plugin capability. This action could be bound to a control key combination, or the zotero plugin could add a little button on the zotero toolbar. I think that this should be easy, but I don't see anything like that code in the zotero "hello world" extension. Is that because it's an external firefox plugin? Would it be easier to add the button to a separate menu or the firefox menu? Are there other ways to extend zotero or add to it directly? Perhaps writing to the pipe could occur simultaneously with the "copy selected items to clipboard" function that zotero now has (ctrl-alt-c).

    4) Have zotero pass a text string incorporating the bibtex key for an item (let's call it $key) to the lyx pipe file. The correct format would be to write a string to ~/.lyxpipe.in (that's a hidden file preceded by a tilde representing the user's home directory, it looks odd in the font on this forum). The string would be:

    LYXCMD:zotero:citation-insert:$key

    I have put "zotero" as the clientname. See http://wiki.lyx.org/LyX/LyXServer and http://wiki.lyx.org/LyX/InsertingReferences for information on this format. You can test that this works by starting kile (or lyx with the pipe set as .lyxpipe, but the format might be slightly different if you have an old version) and typing at the command line:

    echo "LYXCMD:zotero:citation-insert:Smith2007a" >~/.lyxpipe.in

    This sort of writing to a file would seem to me to be trivial. Is this true? Is zotero sandboxed away from the filesystem by running in firefox?

    Using this plugin would be as simple as installing a zotero utility that adds this functionality, running kile (or lyx) to open the lyx pipe and start citing entries in your zotero database by selecting them and hitting the button / keypress. Then, you would export your entire zotero library to bibtex, point to this bibtex library in your latex file, and compile your latex document. See the discussion at http://forums.zotero.org/discussion/146/integration-with-latex/ for automating the export of the bibtex file.

    So, it looks like much of the code to do this is already written, and the other parts might be simple. Anyone want to help put the parts together? I can help a bit, but I'm not that conversant in JavaScript. Merle, would you like to work together on this? Dan Stillman, could you offer us some pointers?

    As I see it the first decision will be to talk about these and other options and ideas for a first try, then get together a group to work on it and let utilities@zotero.org know we have started, then to decide whether to implement it as a separate firefox extension or in some other way, and then gather the code to reuse and glue it together. Any other ideas?

    Some additional features for future versions could include WinEdit / Emacs integration. Also, functionality for custom generated keys (like Jabref has) would be a great additional feature (see the request by orange in the discussion at http://forums.zotero.org/discussion/31/bibtex-export/ to see how important this is to some people). Lastly, to make this more robust, the plugin should check the message generated in ~/.lyxpipe.out after trying to insert a citation, to make sure the citation was received, although this dose not seem to be implemented in kile.

    The parts are all there, let's make what we want!
  • jamesh: Sounds great and quite feasible. If you could post this to the dev list, I'll respond with some pointers there.
  • Posted to the dev list at: http://groups.google.com/group/zotero-dev/browse_thread/thread/d7a5a2fb3c34975a

    Let's continue this discussion there.
  • Demetrio Girardi has written a beta Firefox plugin with this functionality, and a simplified export scheme incorporating an earlier patch to allow custom key generation in the exported bibtex file.

    See http://groups.google.com/group/zotero-dev/msg/24ff076ccf8e41b4 for this great integration.
  • Is lyx support availabe in early 1.5 version?
  • I echo the calls for Lyx support. Or at least better bibtex exporting.
  • LyX support is offered through the Lytero plugin (I haven't tested it in 2.0; it worked in 1.0 and 1.5). What BibTeX export improvements do you want?
  • "offered" is an exaggeration.. LyXPipe doesn't work on Windows so LyX users on Windows have to
    1) edit the lytero.js file with some hackery mentioned on google groups, and
    2) click the Save button each time they make a change

    Out-of-the-box LyX integration (or lytero included in Zotero) would be a million times better...
  • IMHO, Zotero as a project needs to be responsible for less code; not more. It sounds like someone ought to fork LyXPipe and put it up on GitHub.
  • I agree that LyXPipe should not be Zotero's responsibility, but Zotero _could_ be a lot simpler for LyX users with very little work. As I understand it, Lytero isn't a very big extension, it does two things, (1) add two buttons for saving bibtex more quickly, and (2) communicate with LyXPipe.

    But Zotero should _already_ be able to export to bibtex without hassle, this is really just a UI problem. At the moment, it takes several clicks _and_ you have to type in the same file name each and every time you export to bibtex.

    An alternative would be that Zotero simply had the ability to keep a bibtex file synched to a collection (by synched, I here mean, it saves to the bib file each time you make a change to your collection, or if that's too hard, at least each time you press a big save button). So users eg. have an option to specify a bibtex-file for each collection. Or something. Then you'd basically have LyX integration without even needing LyXPipe for Windows. I hope that was understandable? I feel I'm starting to rant...
  • I think you're "alternative" is the preferable approach, and that it could be handled with an extension (no need to be included within Zotero). I will probably be writing a little script to keep a local copy of my library in sync (in RDF; not bibtex) once Zotero opens up the API and starts serving up decent RDF. If I do, I'll post it publicly.
Sign In or Register to comment.