Looks good to me, thanks! @Bram: Can you pull that patch?
Thanks and best regards, Bernd Am Sonntag, den 11.09.2016, 17:13 -0700 schrieb William Pettersson: > cc'ed Bernd Feige as maintainer of bib.tex syntax file. Fix can be > found in > branch https://github.com/WPettersson/vim/tree/bibtex-syntax-escaped- > braces > > There appears to be a bug in the syntax highlighting for Bibtex files > (*.bib). > Note that this bug has nothing to do with compiling anything. For any > fields > that contain set-theoretic notation (like \{a,b\}) the syntax file > will see the > (escaped) opening brace, but never the closing brace (as the closing > brace > matches skip). For instance: > > TITLE = {The set $\{a,b\}$ has 2 elements}, > > This results in all syntax highlighting not functioning after such an > entry. > These escaped braces should only occur inside math mode (inside pairs > of $'s), > so my own easy fix is to add a bibMath region as follows > > syn region bibMath contained start=/\$/ end=/\$/ skip=/\(\\\$\)/ > > and then add bibMath to the bibVarContents cluster > > syn cluster bibVarContents > contains=bibUnescapedSpecial,bibMath,bibBrace,bibParen > > Note that bibMath does not contain bibVarContents. Basically I just > ignore > anything inside a section of math, to avoid trying to match up all > the escaped > brackets, parentheses and braces inside the math. > > Another possible solution would be to make sure that the start of the > bibBrace > region doesn't match \{ but it feels like that should also be then > extended to > bibParents and possibly further, and I don't know how well the vim > syntax > engine would perform with a negative lookbehind regex. My fix seems > more > appropriate in the sense that I don't think the Bibtex syntax file > should try > to match all possible Latex syntax. > > > The above example is faked, but this does really come up. One example > that I've > met with can be seen at https://ewpettersson.se/sample.bib which is > the bibtex > entry for http://onlinelibrary.wiley.com/doi/10.1002/jcd.20001/abstra > ct > > For the record, I'm running vim-7.4.769 under Gentoo, but I did check > that the > latest copy of bib.vim in Github also has this issue. > > -- -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
