Writer2LaTeX now supports Zotero references!

The development snapshot 1.1.5 of Writer2LaTeX (http://writer2latex.sourceforge.net/index1.html) now supports Zotero references. Please do test and give feedback :-)


To use from the command line:

w2l -use_bibtex true -zotero_bibtex_files yourbibtexfilename yourdocument.odt
To use from OOo:

- Install writer2latex.oxt and writer4latex.oxt.

- Open Tools -> Options -> Writer4LaTeX -> Bibliography

   - Enable Zotero support and browse for the directory
containing the BibTeX file exported from Zotero.

- Open LaTeX -> Run LaTeX, ensure that BibTeX support is enabled in the export dialog.



Note that it uses natbib style citations, to enforce the difference between "suppress author" (\citeyearpar) and regular citations.


Also, important: the cite-key information added by the OpenOffice plugin doesn't have enough information in it to extract the cite-key information created by the standard BibTeX export in Zotero. So you have to use a modified bibtex exporter, that creates entries with the plain Zotero "item ID" as a cite-key. There is such a BibTeX exporter available from http://paste.pocoo.org/show/284381/.
Hopefully, in the future, translator installation will be a bit simpler...


If you use LyX, there is a modified version of LyZ that lets you select your own BibTeX exporter, as well as outputting cite-keys in the "writer2latex" format, available from http://github.com/unhammer/lyz.
  • edited November 10, 2010
    Hi Unhammer,

    that's great news! Could you explain how to use the cite-key information you linked? I am a Latex/lyx beginner, the lack of zotero-referenced OOo document portability has kept me from switching over. If you could explain the steps needed to get the interoperability working on ubuntu, I (and surely many other beginners) would be extremely grateful. Also: Does all this work with the latest Zotero beta or should people who want to use this wait before they switch (I'm asking this because once switched over, OOo documents cannot be downgraded anymore)?
  • Well, writer2latex is actually an Ubuntu package, so it will
    eventually seep into the repositories, but if you want to try it out
    now, installing should be now more difficult than downloading the
    snapshot from http://writer2latex.sourceforge.net/index12.html,
    unzipping and clicking on writer4latex.oxt and writer2latex.oxt to
    install. (OXT files are OpenOffice extensions, and should open in
    OpenOffice when you click on them.)

    This works with the regular non-beta Zotero (I haven't actually tried
    it with the newer versions, but can't think of why those shouldn't
    work too).

    Now, for the cite-keys, there are two possibilities.

    1.

    If you would use LyX for writing LaTeX, I would recommend you install
    my patched version of LyZ: https://github.com/unhammer/lyz/downloads
    LyZ is an extension to Zotero that lets you cite from Zotero to an
    opened LyX document. See http://www.klubko.net/?page_id=945 for more
    information on LyZ itself (e.g. how to set the correct LyXPipe path).

    My patch does not add much to the regular LyZ, except for allowing you
    to write "writer2latex" as a cite-key format in its settings.

    So basically, install lyz.xpi and restart Firefox, your Zotero will
    have a new LyZ drop-down button from which you can click Settings;
    here you enter your LyXPipe path (e.g. /home/username/.lyxpipe) and
    enter "writer2latex" as the cite-key.

    If you want, you can also select another BibTeX exporter if you have
    more than one installed.
    E.g. https://github.com/unhammer/zotero-natbib has my exporter, which
    exports web sites in a manner I find more pleasing...

    Now, LyZ by design just exports the parts of your library that it
    knows you've cited at least once from LyZ... it won't know what you've
    cited in your exported OpenOffice document. To work around this, just
    select your whole library in Zotero and click "Cite in LyX"; then
    delete that huge citation from LyX.


    2.

    If you don't plan on using LyX, you can get writer2latex cite-keys by
    downloading http://paste.pocoo.org/show/284381/ (save it as
    BibTeX-writer2latex.js) and placing it in your zotero/translators
    directory. On my system this is
    ~/.mozilla/firefox/bi3xapi2.default/zotero/translators (you can also
    choose to store your Zotero folder somewhere else, in the Zotero
    “advanced” settings)

    Restart Firefox. When you got to export, you’ll see it offered as a
    possibility. Now you can export your whole library and the cite-keys
    in your exported BibTeX file should match those in the exported LaTeX
    file. Unfortunately these cite-keys are rather unreadable, but with a
    good LaTeX editor that shouldn't matter.




    The LyX method might seem a little more involved at first, but working
    with LyZ is actually quite nice.



    Note: writer2latex has an enormous amount of exporting options, e.g. how to
    turn headings into LaTeX sections, etc. If the document doesn't look
    the way it should the first time, you might want to read up a bit on
    the writer2latex manual.
  • I tried to install the modified exporter, but it returned a general error message (something along the lines of "an error occurred trying to export the selected file"). The modified version of Lyz seems to be incompatible with the recent version of FF. Is there any other workflow from LO to LyX/LaTeX?
  • I am getting the same errors in FF 10. Is there any chance to fix BibTeX-writer2latex.js? It seems that a very similar code I wrote works okay. This function:
    "k":function (flags, item) {
    if (item.key) {
    return item.key;
    }
    return "????";
    }

    seems to kill the code. How can I debug the JS script? Thanks in advance.
  • It seems https://github.com/zotero/translators/blob/master/BibTeX.js has deviated a lot from what I pasted so long ago there. I tried finding the one it originally was based on, and introducing the same changes to the new version, my result is at https://raw.github.com/unhammer/translators/master/BibTeX-writer2latex.js Totally untested, but might work. I rarely if ever write anything any longer so I'm not sure I'll have time to keep this stuff up to date.
  • Thanks a lot unhammer. This new version works okay with me!!!!
    Now I struggle with the option of bookmarks in the word plug in which stopped working with me. But this new version definitely works now! Great work!
  • Wow, happy to hear that, imuntean. I guess I have more luck with my blind coding than is good for me =P
Sign In or Register to comment.