[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [AUCTeX-devel] Don't fold braces and brackets in math mode

**From**: |
Tassilo Horn |

**Subject**: |
Re: [AUCTeX-devel] Don't fold braces and brackets in math mode |

**Date**: |
Mon, 09 Mar 2015 09:31:56 +0100 |

**User-agent**: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) |

Mosè Giordano <address@hidden> writes:
>* consider the following math environment:*
>
>* \begin{equation}*
>* \alpha[b]{c}*
>* \end{equation}*
>
>* It's folded to*
>
>* \begin{equation}*
>* α*
>* \end{equation}*
>
>* because the square brackets and braces are interpreted by AUCTeX as*
>* arguments to the `\alpha' macro, but most of the commands to be folded*
>* in math modes (e.g. greek letters) don't take arguments and square*
>* brackets are often used as they are.*
There are also some exceptions to this rule, e.g., \sqrt[3]{x} which is
the third root of x.
>* The attached patch fixes this issue by ignoring square brackets and*
>* curly braces in math mode. Comments welcome.*
I don't have a strong opinion here as I don't use folding (or only
folding in the sense of `outline-minor-mode'). But it looks like hard
to get right in every situation, i.e., with your patch your example
above would work whereas \sqrt[3]{x} which now folds correctly to [sqrt]
would fold to [sqrt][3]{x}, that is, its arguments wouldn't be folded
anymore.
Maybe you could treat whitespace as macro end in math mode? E.g.,
"\alpha [b] {c}" is treated as three separate items as you expect
whereas "\alpha[b]{c}" is just one item.
Bye,
Tassilo