Drag and Drop Bibtex \cite{}

I'm a big zotero fan but I have a critical feature / hack request.

I'd like to be able to easily insert the Bibtex \cite{} command into a document from zotero, using the existing drag-and-drop or copy-and-paste functionality. This should be a trivial task. By setting Preferences->Export->Quick Copy -> Default Export Format to "Bibtex" Zotero will drag and drop the entire Bibtex entry into, but this is much too much information. I would like only the \cite{} command so that I can drag and drop it quickly in-line into a wating document, similar to the way BibDesk on OS X works.

Is it simple to write my own "Default Export Format" to only have the \cite{} information? Can someone point me to information? If it isn't trivial, would someone else consider taking on this task? In many ways I think it is critical, especially since there is no Word 2004 OS X plugin support for SyncPreview.

Thanks again! Go zotero.
  • Moroever, it would be very helpful to be able to see the Bibtex cite key somehow within zotero, either as an optional column in the main pane, or as a key on the "Info" tab.

    As it is now, there is no way to access the cite key at all from within Zotero.

    Just a thought.
  • If your LaTeX editor supports lyxpipes, look at:

    There has already been much discussion of whether to include a BibTeX key in the interface (as or with other local identifiers).
  • Thank you noksagt for the info.

    I wrote a hack to solve this problem. I modified Simon Kornblith's "BibTex" translator version 1.0.0b4.r1 so that it only exports the "\cite{key}".

    I have posted the hacked version:

    To install, simply save the file to your Zotero translator's directory and restart Zotero.

    If you don't know where your translator's directory is: go to Zotero Preferences. Open the Advanced pane. Click on "Show Data Directory." This will take you to a "zotero" folder. The "zotero" folder will contain a "translators" folder. Save the.BibtexCiteKeyOnly.js file here.

    After you restart Zotero, you can use the drag and drop functionality by going to the "Export" preferences pane and choosing "BibTex CiteKey-Only Exporter" as the Default Output Format. Now, you can select a reference and drag it off the screen into a waiting text editor. Alternatively you can use Cmd+Shift+C to copy the \Cite{key} to your clipboard.

    I hope this is useful. Enjoy.
  • OK, it works, I can use it. It is same with idea of Mr. Ajlyon. I can use it now.. Thank you.
  • Looks like the new Zotero updates have broken this functionality, at least on mac.
  • Essentially, BibTeX.js was reworked somewhat because of some changes in Z 2.1. If you take a look at the new BibTeX.js, you should be able to hack together this again.

    I won't be able to fix this myself for at least several more weeks. If you still need it then, let me know and I'll take a look.
  • Thanks, looks like I just had to re-hack it for the most recent update. I'll make my bibtex output files available to others later today (Apr 4 2011) at: http://www.stanford.edu/~messing/BibTexCiteKeyOnly.js.
  • edited April 28, 2011
    Thanks, that works for me however for the new translator to appear in the list to choose from I think the "translatorID" needs changing a little bit to make it different from the existing Bibtex translator, e.g. I changed the first letter "translatorID":"5cb7002....etc

    And drag and drop doesn't seem to work for Standalone Zotero.
  • Great work! That last link to the updated script seems to be broken though. Can anyone host it again somewhere, please?
  • it's not broken, it just has a period at the end that shouldn't be there:
  • This is excellent!

    However the current version did not work for me, it was not outputting the "_" characters at least from standalone.

    I reworked it from the original bibtex.js and made it so that a multiple selection is output as a single reference, i.e. \citep{ref1,ref2,ref3} instead of \citep{ref1}\citep{ref2}\citep{ref3}.

    its at http://pastebin.com/GXmCJevn
  • Hi Everyone,

    You are all discussing something I'm trying to figure out. However, I'm relatively new to Zotero and LaTeX, so I'm not sure how to use the code that's been posted here.

    Could someone please explain in novice-friendly terms how to make Zotero show bibtex citation keys?
  • Hey Vezer,

    Just follow Kramer's instructions from the 3rd of May 2009, they are pretty straightforward once you give them a go. The only thing I did differently was to use pobrien86's code; just copy and paste the code in the scrolling box at the bottom of the screen into a file called 'BibTexCiteKeyOnly.js' and follow Kramer's instructions and you will be fine :)
  • Hi everyone! Thanks again for the solution. For some reason pobrien86's solution works on the firefox zotero but not my standalone. I was wondering if you all have the same experience from tclose's post, it seems as it works for her/him.

    Thanks for the help!
  • edited September 9, 2011
    I've simply modified the BibTeX.js provided in the default installation in order to respectively produce \cite{...} and \citep{...} commands, and only the list of currently selected item keys.

    You can download them from the link below:

    Iade Gesso (http://www.iadegesso.netsons.org/ - website in Italian language only)
  • Thanks for the great job, maclabbibio, I've been using it for a couple of weeks now: it's simply genius. I noticed a little "bug" though: when the first author's name contains a special character. I give a concrete example: The first author's name is Förstner. Zotero exports "forstner" as bibtex key, quick-export "foerstner" (transcribing the special character Ö in an international way).
  • edited May 31, 2012
    the difference was in the function "tidyAccents". There is an updated and expanded code in Zotero 3.0 to fix diacritics, which maclabbiblio's version was not using.
    I took the newest bibtex translator (5-13-2012) and modified it again:


    it uses the new diacritic removal method and will output "forstner" in your citation key. This is a citep version. (really easy to change, just search for \\citep in the text file and change it to whatever other cite** version you want.)

    I also removed most of the rest of the file that is not relevant to outputting the citation key.

    works for me on standalone 3.0.7
  • edited May 10, 2013
    Works just fine as of Zotero 4.0.8 (standalone). Many thanks!
  • Kramer's instructions from 03.09.2009 don't seem to work for me, using v 4.0.11 on a mac. After restart the option for BibTex CiteKey-* does not show up in the Default Output Format options. I've also tried it with the latest version pobrien86 has provided. Is there a step not described here?
  • edited September 13, 2013
    where exactly are you placing the file?
    I have just heard from someone who installed this yesterday following these instructions, so this definitely still works.
  • https://github.com/friflaj/zotero-better-bibtex has a ready-to-install extension to zotero that takes care of this and other things.
Sign In or Register to comment.