Open arwinj opened 8 years ago
Only %, $ and & are escaped.
https://github.com/mkucej/i-librarian/blob/master/export.php#L562
At one point I, Librarian was not escaping anything. Someone, a user, asked me to do that. I forgot what the reason was. My question is - what is wrong with not escaping anything at all?
It's seem, if I am not mistaken, backshlash are also escaped. https://github.com/mkucej/i-librarian/blob/master/export.php#L340 This suppresses all maths in titles.
%, #, and & procuses latex errors upon compilation. They are used for comments, arguments in commands, and array column separation, respectively. As they have no place in title, I think they should be/stay escaped. $ and { can be part of titles, and produces errors in Latex if not in pairs. As they exist mostly is pairs in titles, I think they should not be escaped.
Not escaping anything is also a solution, and forces the user to look at what is in the title. However, some bibtex errors are difficult to locate, and might produce some headache.
I was one of the user pointing out the % character for escaping. It may be better to wait for another one to give his opinion on the matter. For information, I had to modify lines export.php#L340 and export.php#L562 to avoid any errors. I manually modify the library entries for any other character that could cause latex errors.
Thank you for correcting the double curly brackets in the bibtex export (issue #47). New engines, like XeLatex, handle the accented and special characters in author names (I suppose it is working for all characters, like chinese, etc.) However, depending on the journal, the titles are not processed uniformely. In automatic field importation using the DOI, some titles might contain: — unescaped latex characters link — math latex link — other syntax: Perpendicular coupling at Fe–FeF[sub 2] interfaces link
The actual behavior escaping (\ $ %) produces errors, as the '_' character is not escaped (there might also be others, like ^). Also, escaping all ' \ ' forbid all latex command in title.
There is no perfect handling of this, as the latex special characters (& % $ # { } ~ ^ \ ) could all be used in titles. What I suggest: — keep escaping %, as it is for comment only. — \ should not be touched, as it allows latex command in title. Nor ^ and used in formula — $...$ could be escaped, as it could be replaced by (...). But a lot of titles I have encountered contains those — { } are meaningfull, and should not be escaped — I don't have any use of ~, # and &
The best solution is maybe to let the user decide, by adding a regex-like command in the settings.
Best regards,
PS: I use the 4.3 version