Bibtex export

Is there a way of changing the key used in the bibtex export?
«13
  • I had the same question. I'm thrilled to see great bibtex support in the beta... but I would like (1) the ability to define my own bibtex "key", and (2) to be able to see the entry's "key" in the "Info" pane.
  • I'd like some more thought given to this before it's added. Keys as used in BibTeX are only useful for BibTeX, and I don't want to see Zotero in any privileging it. E.g. *I* don't want a key field in my interface and DB.
  • Bruce:

    Unique keys are still used outside of BibTeX too. As you probably know, the bibliography manager in the current OO.o does have an 'identifier' column which must be unique (similar to BibTeX keys).

    RIS has "ID:", ISI/ENDNOTE has "%F:", etc.

    I don't know whether the key field should be part of the interface/DB. If kkutner's criticism of the default naming, perhaps a way to change the algorithmic naming (hidden away in the extension preferences) would be reasonable.
  • @noksagt -- as you may know, I'm not a fan of the current support in OOo. Keys are specific to a particular user and database, and so they aren't really good practice to use for citation identifiers. I would hope as Zotero adds support for integration with word-processors, for example, that they not use natural language keys like this, but rather ideally use URIs based on more robust identifiers.

    So yeah, my instinct is to prefer being able to configure the key generation.
  • Small difficulty with BibTeX export: page number field is not exported, and keys can have embedded spaces (when author is named "O brien" for example), embedded spaces cause BibTex applications (such as JabRef) inability to import the bib file.
  • Bump - BibTeX export keys should be conformed to the following:

    From http://www.gerg.ca/software/btOOL/doc/bt_language.html

    NAME [a-z0-9\!\$\&\*\+\-\.\/\:\;\<\>\?\[\]\^\_\`\|]+

    Best,

    Randall
  • Also, the BibTeX month output needs to be changed from the current

    month = {nov},

    to

    month = NOV,

    Best,

    Randall
  • Does the recently released version (1.0.0b4.r1.r1352) offer a means of customising the Bibtex key format? Generic Bibtex keys make the Bibtex export practically useful only within an editing environment which autocompletes the keys. This is what's keeping me just playing with Zotero for now.
  • Hi all!

    IMHO a well formatted BibTeX output is strategic to Zotero. I think it could be useful getting this link at hand to support the discussion. You'll find a "Format" tag in it.

    http://www.bibtex.org/

    Regards,
  • To me its important to be able to create my own type of bibtex key. I use the keys as my own mental ref for things, also in my notes etc, and I don't fancy having to convert all this to Zotero's way. I suppose I could push Zotero's output through a converter of some type, but a simple workflow with few steps would be idea.
  • The export should include the day of the month in the month field. See, for example, note 9 in

    ftp://tug.ctan.org/pub/tex-archive/biblio/bibtex/contrib/doc/btxdoc.pdf

    Which specifies an output such as

    month = jul # "~4,"

    Note the lack of braces.

    It would be helpful if the first attached note to each entry was entered as the annote field as well...
  • The export should also handle quotation characters gracefully; the current output doesn't validate nicely in bibtex for me because it doesn't do bibtex-style double quotes (like ``this'') for items with quotes in any field.
  • bump. imho something must be done wrt the keys for zotero to really work with bibtex: as it is now, you must have your .bib file open, and search throught it the item you want to cite to get it's key (or did I missed smthg?).

    So at least to be able to see the generated key in the info pane, and maybe the naming scheme somewhere in the preferences. You may even add a check to keep it hidden for those who seem to be really allergic...
  • (first, THANK you for developing zotero)
    i would join my opinion to those FOR the possibility of customizing BibTeXkeys.

    My reasons: Till recently i used to use a global bib file with some logic i already elaborated for biblio keys. These notations are not smarter than those present actually in zotero, but not worse either, and my TeX documents are based on them. Any compilation or other document recycling with my bibliography up to date requires the citations redone (or keys on new entries of the zotero-generated bib file made conform to my old rules). This is quite tedious and might constitute a source of errors while typesetting documents.

    ANOTHER ISSUE (in this conservative context) might be at least keeping the original keys while importing a bib file data.
  • @mg: FWIW (and I'm aware this isn't answering your question), I've come to the conclusion that using a global bibtex file isn't such good idea. It has some advantages, but I found it left me too much a hostage to fortune (ie. re later possible edits of the file, etc).

    Now when I use LaTeX/BibTeX, I create a unique bib file for that project, exported from a Zotero collection, which I keep with the tex source. That way I know I can always build a self-consistent document.

    Again FWIW (ie. it doesn't answer your question, and is really just a comment on my change of process) I have stopped worrying about bibtex key naming at all. I just use AucTex and allow it to find my entries. Admittedly my loyalty to LaTeX is slight (I have a sense that it is a temporary solution, and only really use it because the alternatives are so dire), which probably puts me in a different category from most users. I'd drop it in a shot if a workable alternative tool for academic writing became available.
  • https://www.zotero.org/trac/ticket/763
  • What are some examples of key formats that people are using?

    One option (which I just mentioned on the ticket) is to allow the use of a format string similar to the one currently used for attachment file naming (default: "{%c - }{%y - }{%t{50}}", meaning "First Creator - Year - First 50 Characters of Title"). A formatted BibTeX string would also have to be stripped using the regex from Randall above.

    Doing it this way wouldn't allow for the retaining of keys on import, but it seems that as long as the format string could replicate the logic people were using in their imported keys, it would address the large majority of requests in these forums.
  • When I was doctrinaire about such things, I used {Last Name}{YYYY}{First letter of first 3 significant title words} (where 'significant' excludes the, and, a, etc). Essentially that's what google scholar spits out.

    eg. Dennis Garlick's (2002) "Understanding the nature of the general factor of intelligence: The role of individual differences in neural plasticity as an explanatory mechanism" would be garlick2002ung
  • I used to use {Last Name}{YYYY}{First significant title word} The title word had to undergo some manual tweaking sometimes to avoid duplication. (But I'm not using BibTeX these days).
  • Thanks for taking care of it (and zotero is great, did'nt say it on my first post so here it is...). I use {Last Name}{YY} and add a letter in case of duplicate (my .bib is not that big -yet-). But any scheme would suit me, as long as the info is available in the info pane of the entry (I do not try to remember them)

    something else about bibtex export: the 'volume' and 'pages' field are exported ok, but it seems the 'number' field is not exported, is that normal? Overall, i guess the more field are exported the better, as latex takes care of which one are actually used... Is there any way a user can tweak the export format? I don't have much time as I'm (being late at) writing my PhD, but...
  • I use {Last Name}{YY} and add a letter in case of duplicate
    Schemes similar to this (first author's last name, 2 or 4 digit year, and a unique letter or number to catch dups (with various punctuation between fields) are quite common. I think these schemes are used by bibutils, CiteULike, JabRef, refbase, etc.
  • (maybe slightly off topic, but:)

    I began to look into the bibtex export code, and I finally found it in the zotero.sqlite file (which I dumped into a text file because I known nothing of SQL, line 15755 if it means anything). The key generation code is here indeed, and the number field is indeed not exported (there is a comment before the "fieldMap" relevant line (15391?), is that intentional?).

    Anyway, if I was to change it, how could I do it? I guess that code is elsewhere before being written in the .sqlite... I am really sorry if those are simple questions, but I really have very little time right now (and I have to decide whether to use zotero or not for my thesis in a matter of days).

    thanks...
  • wow, that's exactly what I was looking for, thanks a lot. I did look through the doc but managed not to find it (I guess I wasn't expecting it to be that simple...)
  • Merle, others are interested in this as well, as part of a plugin to push citations to the latex front-ends lyx and kile. For more information see the resent posts at:

    http://forums.zotero.org/discussion/537/lyx-support

    If you (or anyone else) has worked on this, or if you would like to, please post to that discussion, since these projects would work well together.
  • I also use LaTeX and BibTeX. I have found the export feature to be lacking for a few reasons, most of which have been previously mentioned.

    Key:
    I would like to at least define a format for the keys as well (I use primary author name followed by "_" followed by two digit year followed by "_" followed by a number to prevent duplicates). In my .bib file I keep all items in alphabetical order so that I can easily determine the last number of the key. I suppose this would not be so important if the key were to be automatically generated, but I would need easy access to the key for citations.

    Formatting:
    I am no BibTeX expert so perhaps the current format of the export will work, but in the documentation I've read, the information is supposed to be located between double quotes, like...

    article@{author_07_01,
    author = "First LastName",
    ...
    pages = "1--9",
    }

    instead of between brackets like in the current export...

    @article{ComplicatedKey,
    author = {First LastName},
    ...
    pages = {1-9},
    }

    I also agree with some of the comments above regarding the formatting of the dates.

    Fields:
    There are some fields that are useful depending upon the type of reference you are recording, and I find that sometimes they are not available with Zotero.

    In my humble opinion, in order to be a truly useful tool to the greatest number of researchers, a more customizable database and export feature is necessary. I realize that it is a challenge to implement customization when trying to automatically gather data from web sources, but I believe most people would much rather adapt a tool to their work flow than adapt their work flow to a tool.
  • aarockhill - I have always used the bracket format of writing citations, as I used to create the files myself rather than using any citation manager. I have started using bibtex as this is what zotero exports to, but until I have the keys sorted I am not willing to swap my files over to using this until I am either finished with a piece (so only have to update all the citation data once) or I no longer have to worry about my citation keys being changed.

    The method I use of defining keys, which I also use to file papers as well as using to refer to work in my notes, is
    SurnameYY
    If that is already taken, I add the next letter of the alphabet (b, c, d etc.). Where the Surname is hyphenated, I only use the first part of the surname.

    Unlike others here, I do remember the the key citation keys that I am working with at the time, so I want them to be simple and straightforward.
  • I actually use non-generatable IDs designed to be the most mnemonic to me. However, I try to stay XML/XSLT centered and stay somewhat independent of tools like BibTex; I generate my LaTeX and BibTeX from XML source using XSLT, which does lots of cross checking for errors in addition to generating legal output.

    For my purposes, I really just want to be able to set an ID field to arbitrary text. I am looking at using the "Extra" field for that (since I don't know its original intent anyway :-). So long as it gets spit out into the (RDF) XML, I can use XSLT to whack it into any format I need, barring unforeseen complications.

    It would be nice if Zotero had some kind of slick integration with XSLT, since that's a pretty well-known standard language for transforming marked-up text, for which a fair number of experienced programmers exist.. One could imagine "Export using stylesheet..." and "Generate report using stylesheet..." options, for example.
  • If anyone still wants more key export flexibility than Zotero offers, I can recommend bibtool.

    I run it as a quick post-process after the zotero->bibtex export. It can autogenerate keys very flexibly, sort, clean up output in various ways, etc.
Sign In or Register to comment.