Does anyone know of any utilities or have experience converting special characters in a BibTeX file to its proper unicode equivalent in a bash script? Trouble is I can't even find a full list of the BibTeX special characters anywhere. I created a monster of a regex and I'm still encountering issues with escaping because the particular way BibTeX special characters (ie with backslashes, quotes, and braces) is not very compatible with RegEx or shell code...
I was thinking perhaps it might be enough to have a simple regex with a capture group that looks for the {\ }
pattern within a BibTeX tag, and if there is a match, the contents of that (e.g. {\\'{o}}
) could be matched using some kind of external dictionary file I create, to map that sequence to its proper unicode character... ó
in this case. It's just hard to do this without having access to a complete list of the special characters. And they tend to be very common in research paper metadata (what I am processing).
Also another issue is that different BibTex files will have different syntax for the special characters - the name Müller
might be encoded as author = {M{\"{u}}ller}
, author = {M{\"{\u}}ller}
(extra backslash in the inner braces), or even author = {M\"{u}ller}
(no braces around special character TeX fragment).
I have an interactive shell script that lets me process research papers I've downloaded, view/skip/forget them, or enter their DOI, at which point the shell script retrieves the paper's BibTeX, renames, the file according to a convention I use, using the BibTex tag data and DOI, and then after I'm done with the session it imports all of the processed files into Zotero for me and then runs another script I wrote that adds the both PDF attachments and Dropbox links for each paper processed. But these special characters are gunking up my filenames and my Zotero metadata...
TL;DR - Does anyone know how to convert BibTeX/TeX special characters to unicode within the context of a bash script? Or does anyone know where I can find a complete list of BibTeX special characters?
does anyone know where I can find a complete list of BibTex special characters
, check official website bibtex.org/SpecialSymbols