2015-09-26 23:37 GMT+02:00 Arash Esbati <esb...@gmx.de>: > Hi Mosè, > > Mosè Giordano <m...@gnu.org> writes: > >> 2015-09-26 16:19 GMT+02:00 Arash Esbati <esb...@gmx.de>: >>> >>> The idea is to pass the type of new float-env to AUCTeX and process it, >>> e.g.: >>> >>> --8<---------------cut here---------------start------------->8--- >>> \usepackage{newfloat} >>> >>> \DeclareFloatingEnvironment[ >>> name=Code, >>> listname={List of Codes}, >>> fileext=lol]{code} % {verbatim} >>> --8<---------------cut here---------------end--------------->8--- >>> >>> Currently, the definition above needs a mandatory `{'. The downside is >>> that if a user omits the opening brace, the regexp fails and it parses >>> garbage until the next brace. >> >> Sorry, I didn't get how the type of the environment is specified: it's >> the first and only mandatory argument, isn't it? Why one should omit >> the opening brace? > > Thanks for your response and sorry for being unclear. Let me rephrase > that: The idea is to pass the type of a new float-env to AUCTeX as a > TeX-comment enclosed in braces, e.g. > > --8<---------------cut here---------------start------------->8--- > \usepackage{newfloat} > > \DeclareFloatingEnvironment[ > name=Code, > listname={List of Codes}, > fileext=lol]{code} % {verbatim} > % ^^^^^^^^^^^^^ {verbatim|figure|table} > --8<---------------cut here---------------end--------------->8---
Probably it's just my fault because I don't know the package and its syntax, but giving a (not very thorough) look at the documentation I can't find this. > I am looking at everything following the `{code}'. My current > definition fails if a user does something like: > > --8<---------------cut here---------------start------------->8--- > \usepackage{newfloat} > > \DeclareFloatingEnvironment[ > name=Code, > listname={List of Codes}, > fileext=lol]{code} > % ^ no `{' after this point > --8<---------------cut here---------------end--------------->8--- > > I hope it is more clear now. Anyway, you can try using a shy group that may or may not be there: \\(?:[ %]*{\\([^}]*\\)}\\)? The trick is "?" after the group. Hope this helps. Bye, Mosè _______________________________________________ auctex-devel mailing list auctex-devel@gnu.org https://lists.gnu.org/mailman/listinfo/auctex-devel