auctex
[Top][All Lists]

## Re: Indenting the code written in square brackets as optional parameters

 From: Tassilo Horn Subject: Re: Indenting the code written in square brackets as optional parameters Date: Sat, 05 Mar 2022 09:55:37 +0100 User-agent: mu4e 1.7.9; emacs 29.0.50

Ikumi Keita <ikumi@ikumi.que.jp> writes:

>> Text [%
>> Do we have the same level of confidence for [?
>> \end{document}
>
> Well, isn't it almost impossible? AUCTeX cannot know whether the
> author intends to insert closing "]" later but hasn't done that yet,
> or "]" is to be really missing when the document is complete.

I guess that's most probably the reason nobody tried indenting stuff in
[...], yet.  And unbalanced brackets are quite common in variants of
interval notation, e.g., the interval from 0 (inclusive) to 10
(exclusive) is frequently written as [0,10) or [0,10[ so I guess one
wouldn't want to have an effect on indentation at least in math context.

> I feel that it isn't worth discriminating whether a leading "[" is a
> delimiter of optional argument for a macro/environment or a part of
> ordinary text. How about introducing a new user option to determine
> whether indentation inside "[]" should be done or not?

Or maybe another way would be to have some restrictive contract when
exactly indentation should occur, e.g., only after [% until the next ]
at beginning of a line (possibly preceeded by only whitespace).  But
even then it might become annoying and unexpected if do have [% in your
document but don't follow the "end rule"...

Bye,
Tassilo