FlamingTempura / bibtex-tidy

Cleaner and Formatter for BibTeX files
https://flamingtempura.github.io/bibtex-tidy/
MIT License
832 stars 63 forks source link

escape special characters #412

Closed stepeos closed 5 days ago

stepeos commented 11 months ago

i have this example reference @book{HITHERE, title = {my very sepcial book}, author = {My favouriteAuthor}, year = 2011, publisher = {This & That}, isbn = {1234567810}, edition = 1 } As you can see, if any of the fields like publisher in this case, has special characters that are not escaped, then latex will crash and burn, trying to compile this.

Is it possible to automatically escape such characters like ampersand to \& ?

EDIT: I actually just saw, that this should be handled in function escapeSpecialCharacters(str). Is there a reason, that ampersand is not in the speicalCharacters ?

FlamingTempura commented 5 days ago

Apologies for delay in responding @stepeos - I've tried your example with the 'escape special characters' option enabled, and can confirm ampersand is escaped:

@book{HITHERE,
    title        = {my very sepcial book},
    author       = {My favouriteAuthor},
    year         = 2011,
    publisher    = {This \& That},
    isbn         = 1234567810,
    edition      = 1
}

Let me know if you're still seeing issues with this.