'$' character in Bibtex export file
Hello Zotero guys,
Recently I have exported some references from my library to the Bibtex format to use inside Latex. Unfortunately, one of the references had the '$' character in its title and Zotero exported the Bibtex references with this character like this:
@inproceedings{anthony_$n-protractor:_2012, ...
The '$' character is a special character in Latex language causing some issues when I tried to cite this reference in my paper.
The solution was pretty obvious: I just renamed the citation to something without this character and everything worked.
The problem is that I have to do this everytime I export this set of references from Zotero to Bibtex. It would be nice if you change this behavior. This character could be replaced by anything, like DOLLAR or USD, or whatever other character.
Recently I have exported some references from my library to the Bibtex format to use inside Latex. Unfortunately, one of the references had the '$' character in its title and Zotero exported the Bibtex references with this character like this:
@inproceedings{anthony_$n-protractor:_2012, ...
The '$' character is a special character in Latex language causing some issues when I tried to cite this reference in my paper.
The solution was pretty obvious: I just renamed the citation to something without this character and everything worked.
The problem is that I have to do this everytime I export this set of references from Zotero to Bibtex. It would be nice if you change this behavior. This character could be replaced by anything, like DOLLAR or USD, or whatever other character.
Or is the problem the citekey? - do we need to escape the $ there as well?
If you scape that in the citekey, it will not work properly (I have tried).
I believe a good solution is just to ignore this character (remove it) from the citekey, or replace it by something else.
Please, let me know if I can help you with anything regarding this problem.
the file BibTeX.js in the translator directory of the Zotero data folder:
http://www.zotero.org/support/zotero_data#locating_your_zotero_library - in any text editor,
find this line:
var citeKeyCleanRe = /[^a-z0-9\!\$\&\*\+\-\.\/\:\;\<\>\?\[\]\^\_\`\|]+/g;
and remove the \$ so it reads
var citeKeyCleanRe = /[^a-z0-9\!\&\*\+\-\.\/\:\;\<\>\?\[\]\^\_\`\|]+/g;
The \$ looks like a very purposeful inclusion there, so I want to figure out why it's there in the first place before deleting it from the general translator.
Well, I will do it as a quick fix. I hope you are able to fix it in next release.
Thank you!
It is not a compile problem. But it does not generate the PDF file properly.
bibtex mydoc.aux
pdflatex mydoc.tex
and got a fine looking PDF inspite of a vermeulen_$topical_1996 citekey
What exactly happens in your case?
I dont know what happened. The PDF file was being generated without references..
The only weird thing that happens with a $ character inside a citekey is that the TexMaker editor marks the whole text after the '$' as a command in math mode. But it is just an editor issue. Compilation and PDF creation (appearently) work fine.
Well, I think I will keep out this '$' from the Bibtex translator, because the TexMaker editor is not working properly with that: it can't autocomplete any other command since the '$' is not followed by another '$' "ending a supposed command".
You may have to redo this in case of future updates (which don't coincide with Zotero updates - translators get updated almost instantly), but now that you know where/how that should be quick.
I dont think people who have '$' in their citekeys will have a big problem. LaTex will complain at compile time and it will be fixed by just changing the citekey's occurrences in the document. A find and replace would do the job very quickly.
Another way to have a solution would be to create another BibTex translator with this feature, thus, people who has '$' in their citekeys will not be affected.