BibLaTeX export translator
Hi.
I always use biblatex for my LaTeX-documents.
A .bib-file using all the new features of biblatex could be very useful so I made a biblatex-translator out of the normal bibtex one.
Perhaps someone else will find this useful. There are still some things which could be fixed. Especially regarding the different types of juridical documents (which biblatex doesn't support to a great extent yet though). If you want to make changes, feel free to make them, and join the project to submit them.
The translator is available here
Moved to GitHub
(Just drop it into your /translators/ directory, direct link to translator)
I didn't make any changes to the import-parts, but I don't know if this will take precedence over the normal import of bibtex-files. Or if it should be changed to import biblatex-files (but they are very non-standard and of course not useful as an exchange format). That's not the important part right now.
I always use biblatex for my LaTeX-documents.
A .bib-file using all the new features of biblatex could be very useful so I made a biblatex-translator out of the normal bibtex one.
Perhaps someone else will find this useful. There are still some things which could be fixed. Especially regarding the different types of juridical documents (which biblatex doesn't support to a great extent yet though). If you want to make changes, feel free to make them, and join the project to submit them.
Moved to GitHub
(Just drop it into your /translators/ directory, direct link to translator)
I didn't make any changes to the import-parts, but I don't know if this will take precedence over the normal import of bibtex-files. Or if it should be changed to import biblatex-files (but they are very non-standard and of course not useful as an exchange format). That's not the important part right now.
many thanks for sharing your zotero->biblatex translator!
I just wanted let you know some troubles I discovered: with the following biblatex' .bib file:
@Article{ El03,
author = {Loughran, Ellen},
title = {Tentative Beginnings: Montaigne Rewrites His Early Essays},
journaltitle = {Neophilologus},
date = {2003},
volume = {87},
number = {3},
pages = {371-383}
}
@Book{ lc-fr,
author = {Mittelbach, Frank and Goossens, Michel},
title = {\LaTeX{} Companion},
publisher = {Pearson Education France},
date = {2006-02},
location = {Paris},
pagetotal = {1116},
edition = {2},
isbn = {978-2-7440-7182-9},
translator = {André, Jacques and Bellet, Benoît and Charpentier, Jean-Côme and Hufflin, Jean-Michel and Soulet, Yves}
}
your translator gives the following .bib file:
@article{__????,
urldate = {2010-5-4}
},
@article{loughran_tentative_2003,
title = {Tentative Beginnings: Montaigne Rewrites His Early Essays},
pages = {371-383},
journaltitle = {Neophilologus},
author = {Ellen Loughran},
urldate = {2011-0-9},
date = {2003}
},
@book{mittelbach_latex_2006,
location = {Paris},
edition = {2},
title = {{{\textbackslash}LaTeX{}} Companion},
isbn = {978-2-7440-7182-9},
language = {Français},
pagetotal = {1116},
publisher = {Pearson Education France},
author = {Frank Mittelbach and Michel Goossens},
translator = {Jacques André and Benoît Bellet and {Jean-Côme} Charpentier and {Jean-Michel} Hufflin and Yves Soulet},
urldate = {2011-0-9},
date = {2006-02}
},
@misc{lehman_textttbiblatex_2010,
title = {The {\textbackslash}texttt{biblatex} package},
url = {http://tug.ctan.org/pkg/biblatex},
author = {Philipp Lehman},
urldate = {2011-0-9},
date = {2010-11-19}
}
The troubles are namely the following ones:
1. urldate are malformed (2001-0-9 instead of 2011-01-09),
2. LaTeX commands are wrongly formed: enclosed between braces and backslashes translated in {\textbackslash} (whereas they should be just copied just as they are),
3. names (for authors, editors, translators, etc.) are translated 'FirstName LastName' whereas they should be written ''LastName, FirstName',
4. languages should be keys (for instance 'Français' should be 'french'),
5. entries are separated by commas but they should be nothing between them.
You may see that the previous points are indeed wrong in the biblatex .bib example file provide by the biblatex' author:
http://mirror.ctan.org/macros/latex/contrib/biblatex/doc/examples/biblatex-examples.bib
and also in the biblatex' documentation, pages 32 for dates, 24 for LaTeX commands and 29 for names.
Another trouble is the first entry:
@article{__????,
urldate = {2010-5-4}
},
(maybe due to the date when the zotero collection was created).
One request feature could be to make the fields less indented but the "=" signs vertically aligned, as in the original .bib file above.
Nevertheless, thanks a lot again for your work!
I'm not surprised that you found some strange behaviours.
I'll see when I have time to look into the issues, probably not the coming week unfortunately. If you want to you could definitely check into the code yourself and see if you can fix something (and join the project)
1. This should definitely be fixed.
2. And this is not the case with the standard BibTeX-translator? Strange. I don't think I've changed anything about those things.
3. This isn't neccesarily a problem. Biblatex can as far as I know handle both forms.
4. They don't have to (p. 17 biblatex 0.9 manual). Translating user-submitted language names into keys is very nontrivial (I, as a native Swedish speaker might write "Franska", someone else "Français" or "French". There is also a problem with lists, the language-field in Zotero is just plain-text. How to parse that in a safe way?)
5. This is what the standard BibTeX-translator does as well (and it has worked for me previously). Maybe that is an acceptable format for bibtex (it has never complained about such files)?
Thanks again.
I need to do some more testing. I realized today that some other things have to change for Zotero 2.1 as well...
If I can go off-topic even further, a Zotero plugin to provide easily used controlled vocabularies (languages, geographic places, etc.) would be a wonderful thing, and it would make Zotero an even better tool for, say, curating data for use in Omeka.
Maybe I'll joined the project despite my little knowledge of JavaScript.
1. Nice!
2. You say: "And this is not the case with the standard BibTeX-translator?": maybe it is, I didn't use it. But biblatex is much more permissive than BibTeX from this point of view.
3. You say: "Biblatex can as far as I know handle both forms.". If I'm right the form 'LastName, FirstName' is much more recommended, in order to help bibtex, bibtex8 and biber to separate without any ambiguity last and first names.
4. You say: "They don't have to (p. 17 biblatex 0.9 manual).": indeed, you're right. But, if available, keys are recommended as they can hence be translated, depending the current babel language. You say: 'Translating user-submitted language names into keys is very nontrivial (I, as a native Swedish speaker might write "Franska", someone else "Français" or "French". There is also a problem with lists, the language-field in Zotero is just plain-text. How to parse that in a safe way?)': You're right and it should, in Zotero, preferably be given as standardized keys (if I understand well, it's your purpose in the following comments).
5. You say: "This is what the standard BibTeX-translator does as well (and it has worked for me previously). Maybe that is an acceptable format for bibtex (it has never complained about such files)?" Maybe BibTeX-translator is not very clean from this point of view. But cleaner .bib files should be better, don't they? ;)
Regards.
You say "I'll note that Zotero multilingual branch, currently experimental but eventually destined to be part of the Zotero core, does allow for at least _metadata_ to be described using a controlled vocabulary (ISO 639 language tags, plus subtags).": could be nice!
You say "If I can go off-topic even further, a Zotero plugin to provide easily used controlled vocabularies (languages, geographic places, etc.) would be a wonderful thing, and it would make Zotero an even better tool for, say, curating data for use in Omeka."
I totally agree :)
BTW: this comment system of Zotero's forum is not as easy as mail to follow thread and to quote what other say...
<blockquote>The forum supports the <blockquote> tag.</blockquote>
The rest will have to wait for me to have a lot of free time, I suppose.
New version: BibLaTeX-2011-01-10.2.js
This is what I do with urldate, maybe it isn't optimal either. If one doesn't add an accessDate, it uses dateAdded (meaning also that all types of entries get an urldate, but I guess biblatex styles don't print it for types where it's irrelevant).
Another point is that composed first name, for instance "Jean-Michel" are enclosed in braces, which is not necessary either.
BTW, "manual" is the biblatex' document type I used for LaTeX' packages documentations in my .bib files (maybe there is one better). Do you know which zotero's document type corresponds to "manual" biblatex' document type?
A new version that works with Zotero 2.1.x has been released. Get it here:
http://code.google.com/p/zotero-biblatex-export/downloads/list
I also started out on some kind of documentation, at first describing the field mappings. Mostly to open this up for discussion (there could certainly be improvements, and I could have missed some things in the latest versions of the biblatex database-specification as well).
The list is here: http://code.google.com/p/zotero-biblatex-export/wiki/FieldConversionList
Also, there is now experimental support for zotero RDF in the latest versions of biber and biblatex and there has been some discussion on hooking directly into the zotero database. Eventually, this translator might become obsolete. More info here:
http://sourceforge.net/tracker/?func=detail&aid=2802610&group_id=228270&atid=1073795
Getting data directly from the database would minimize the trouble with having to export bib-files all the time. In the meantime, for some kind of automation, there is of course Jason Friedman's export script using MozRepl:
http://www.curiousjason.com/zoterotobibtex.html
(if someone is interested I could provide my hacky version with the added ability of extracting a specific collection by name).
Greetings
Anders
Just some little troubles I already mentioned:
1. LaTeX commands are wrongly formed: enclosed between braces and backslashes translated in {\textbackslash} (whereas they should be just copied just as they are),
2. composed first name, for instance "Jean-Michel" are enclosed in braces, which is not necessary either.
For instance, with the following .rdf file:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:z="http://www.zotero.org/namespaces/export#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:bib="http://purl.org/net/biblio#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:vcard="http://nwalsh.com/rdf/vCard#"
xmlns:prism="http://prismstandard.org/namespaces/1.2/basic/">
<bib:Article rdf:about="#item_11">
<z:itemType>newspaperArticle</z:itemType>
<dcterms:isPartOf>
<bib:Newspaper>
<dc:title>Neophilologus</dc:title>
</bib:Newspaper>
</dcterms:isPartOf>
<bib:authors>
<rdf:Seq>
<rdf:li>
<foaf:Person>
<foaf:surname>Loughran</foaf:surname>
<foaf:givenname>Ellen</foaf:givenname>
</foaf:Person>
</rdf:li>
</rdf:Seq>
</bib:authors>
<dc:title>
Tentative Beginnings: Montaigne Rewrites His Early Essays
</dc:title>
<dc:date>2003</dc:date>
<bib:pages>371-383</bib:pages>
</bib:Article>
<bib:Book rdf:about="urn:isbn:978-2-7440-7182-9">
<z:itemType>book</z:itemType>
<dc:publisher>
<foaf:Organization>
<vcard:adr>
<vcard:Address>
<vcard:locality>Paris</vcard:locality>
</vcard:Address>
</vcard:adr>
<foaf:name>Pearson Education France</foaf:name>
</foaf:Organization>
</dc:publisher>
<bib:authors>
<rdf:Seq>
<rdf:li>
<foaf:Person>
<foaf:surname>Mittelbach</foaf:surname>
<foaf:givenname>Frank</foaf:givenname>
</foaf:Person>
</rdf:li>
<rdf:li>
<foaf:Person>
<foaf:surname>Goossens</foaf:surname>
<foaf:givenname>Michel</foaf:givenname>
</foaf:Person>
</rdf:li>
</rdf:Seq>
</bib:authors>
<z:translators>
<rdf:Seq>
<rdf:li>
<foaf:Person>
<foaf:surname>André</foaf:surname>
<foaf:givenname>Jacques</foaf:givenname>
</foaf:Person>
</rdf:li>
<rdf:li>
<foaf:Person>
<foaf:surname>Bellet</foaf:surname>
<foaf:givenname>Benoît</foaf:givenname>
</foaf:Person>
</rdf:li>
<rdf:li>
<foaf:Person>
<foaf:surname>Charpentier</foaf:surname>
<foaf:givenname>Jean-Côme</foaf:givenname>
</foaf:Person>
</rdf:li>
<rdf:li>
<foaf:Person>
<foaf:surname>Hufflin</foaf:surname>
<foaf:givenname>Jean-Michel</foaf:givenname>
</foaf:Person>
</rdf:li>
<rdf:li>
<foaf:Person>
<foaf:surname>Soulet</foaf:surname>
<foaf:givenname>Yves</foaf:givenname>
</foaf:Person>
</rdf:li>
</rdf:Seq>
</z:translators>
<dc:title>\LaTeX{} Companion</dc:title>
<prism:edition>2</prism:edition>
<dc:date>2006-02</dc:date>
<z:numPages>1116</z:numPages>
<z:language>Français</z:language>
<dc:identifier>ISBN 978-2-7440-7182-9</dc:identifier>
</bib:Book>
<bib:Data rdf:about="http://tug.ctan.org/pkg/biblatex">
<z:itemType>computerProgram</z:itemType>
<z:programmers>
<rdf:Seq>
<rdf:li>
<foaf:Person>
<foaf:surname>Lehman</foaf:surname>
<foaf:givenname>Philipp</foaf:givenname>
</foaf:Person>
</rdf:li>
</rdf:Seq>
</z:programmers>
<dc:title>The \texttt{biblatex} package</dc:title>
<prism:edition>1.4b</prism:edition>
<dc:date>2011-04-12</dc:date>
<dc:identifier>
<dcterms:URI>
<rdf:value>http://tug.ctan.org/pkg/biblatex</rdf:value>
</dcterms:URI>
</dc:identifier>
</bib:Data>
</rdf:RDF>
biblatex export gives:
@article{loughran_tentative_2003,
title = {Tentative Beginnings: Montaigne Rewrites His Early Essays},
pages = {371-383},
author = {Loughran, Ellen},
date = {2003}
}
@book{mittelbach_latex_2006,
location = {Paris},
edition = {2},
title = {{{\textbackslash}LaTeX{}} Companion},
isbn = {978-2-7440-7182-9},
language = {Français},
pagetotal = {1116},
publisher = {Pearson Education France},
author = {Mittelbach, Frank and Goossens, Michel},
translator = {André, Jacques and Bellet, Benoît and Charpentier,
{Jean-Côme} and Hufflin, {Jean-Michel} and Soulet, Yves},
date = {2006-02}
}
@book{lehman_textttbiblatex_2011,
title = {The {\textbackslash}texttt{biblatex} package},
url = {http://tug.ctan.org/pkg/biblatex},
version = {1.4b},
author = {Lehman, Philipp},
date = {2011-04-12}
}
Anyways, thaks again!
I have sorted out the handling of creators a little more (and documented it on FieldConversionList).
I removed preservation of "uppercase characters in non-initial positions" with braces, which means Denis's isssue 2 in above post is "solved".
I also tried to remove the escaping of \ with {\textbackslash}, thus solving Denis's issue 1. This didn't seem to break anything, using either biber or bibtex8 with UTF-8. Latex commands in titles etc. work. The drawback is that a backslash character in a title (if that is ever used) must be written \textbackslash. This kind of locks the user to LaTeX, which isn't the goal of zotero. This has been discussed before in this thread.
I really don't know what is the best practice really. The affected part of the code is this map, where also some other things are escaped into LaTeX commands: Greetings
Anders.
Just a funny result of the previous map: if you export in Biblatex the Quick Zotero Guide (which seems to be automatically added to the user library), the annote part is in fact HTML coded so for instance:
<p>
is translated as:
{\textless}p{\textgreater}
;) Maybe a workaround should be to export HTML formatted text in pure text but maybe it is to much work...
Many thanks again!
(Just drop it into your 'zoterolibrary'/translators/ directory)
It is invisible but present when copying/pasting:
(Just drop it into your 'zoterolibrary'/translators/ directory)
It took us a lot of time, a student and I, to detect the trouble when searching this directory on a Windows machine.
Import would be nice, too, but I suppose we can wait on that.
Thank you so much for that excellent translator.
Juste one thing : :
When you say : : "/translators/ directory"
This means that you have to go to zotero's settings -> advanced -> then click on the directory that will open the ad-hoc windows.
I just give that detail because I took time to understand it haah
Whatever thanks again it's very useful.
Must be overlooking something. What? Where?
Thanks
http://www.zotero.org/support/preferences
The only directory being the data directory, would that be where I put it? And while I'm at it, does it have to have a specific name?
Thanks,
Do I have a problem? I know my data are getting stored there. Is zotero able to access the other things that are in it?
I assume everything is OK, but it's weird that "show data directory" doesn't respond.
Thanks.
Produce an error report ID right after clicking that button:
http://www.zotero.org/support/reporting_bugs#provide_a_report_id
I'm using standalone zotero, and followed the instructions for firefox/standalone.
As you say, it wouldn't work at all if it weren't able to access it. I'll assume it's OK till it's not.
Thanks again.