mathlive icon indicating copy to clipboard operation
mathlive copied to clipboard

Make ]a,b[ interval notation compatible with smartFence mode

Open ddoyen opened this issue 6 years ago • 3 comments

The smartFence mode automatically resizes parentheses and brackets, which is very nice. But it is not compatible with the interval notation ]a,b[ / [a,b[ / ]a,b].

Is it possible to make it compatible ? I use MathLive with french students and that's the standard interval notation here.

ddoyen avatar Sep 07 '19 13:09 ddoyen

That's an interesting problem. I'd need to give some thoughts about a possible solution, unless someone has some suggestion...

arnog avatar Sep 09 '19 23:09 arnog

Maybe add some code that checks if there is no matching open to the left/close to the right, it pairs the close/open brackets? That works for a standalone expr, but if you had ]0,3[ ∪ ]1,5[ it fails. And the open/close combinations make heuristic even more of a mess.

Or maybe have an option that says "pair the first two open/close brackets (not parens, braces, etc)" when reading left-to-right in smartFence mode? Definitely don't make that the default though. That prevents having nested brackets (hence, don't make this a default), but does work for this notation.

NSoiffer avatar Sep 09 '19 23:09 NSoiffer

One way of parsing such ambiguous notation would be to check if there is a comma , or semicolon ; in the middle, surrounded by two numbers. If yes, it's an interval. If not, it's not an interval.

However, I fully agree with NSoiffer regarding "don't make this a default". This sort of interval notation is sadly really ambiguous.

stefnotch avatar Sep 03 '20 10:09 stefnotch