Hi Tassilo,

2015-03-09 9:31 GMT+01:00 Tassilo Horn <t...@gnu.org>:
> Mosè Giordano <m...@gnu.org> 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.

Well, this macro isn't folded by default with C-C C-o C-b because
isn't in `LaTeX-fold-math-spec-list', and is correctly folded to
[sqrt] with C-c C-o C-m with point on it.  Indeed, none of the macros
by default in `LaTeX-fold-math-spec-list' takes argument.

>> 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').

Actually me neither, I just noticed this issue once.

> 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.

I agree it's difficult to have a sensible behavior in every situation.  I
think I'll give up the feature I proposed here, unless someone comes
up with a very good idea.  Thanks anyway!

Bye,
Mosè

_______________________________________________
auctex-devel mailing list
auctex-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to