Subject: bug#50202: bibtex-mode: unescaped dollar sign in file field leads to wrong highlighting

From: Stefan Monnier <[email-masked]>
Date: Thu, 25 Aug 2022 13:41:00 -0400

>> But I wonder how important it is for `bibtex-mode` to try and recognize
>> the (La)TeX meaning of the $ character.
>> Maybe we should just give $ the punctuation syntax in the syntax-table.
>
> The (La)TeX meaning of the $ character is relevant for titles that my
> contain formulas.  The question is what is in the end more acceptable:
> formulas in titles that do not receive special treatment by font-lock.
> Or $ being mis-treated in url and file fields (which goes beyond these
> fields).  Maybe it is best to let the user decide whether $ should be
> treated as math delimiter (the default) or as punctation.

The downside of treating $ as punctuation is that $^2$ won't be
highlighted specially, but the upside is that "foo$bar" won't be
mishighlighted in a url.

To me the highlighting of math formulas is sufficiently secondary that
I'd err on the safe side (i.e. avoid mishighlighting).  The other option
is to try and make this choice on a field-by-field basis, which seems
like a lot of work for fairly little benefit.

        Stefan