auctex
[Top][All Lists]

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

 From: Ikumi Keita Subject: Re: Indenting the code written in square brackets as optional parameters Date: Wed, 09 Mar 2022 01:59:02 +0900

[ Including Sašo in To:, not to diverge discussion in two mail lists. ]

Hi Arash and Sašo,

>>>>> Arash Esbati <arash@gnu.org> writes:
> When in doubt, 3. is always a good choice.  But would it make sense to
> have a user option and the actual code ignores that in math-mode and
> only kicks in within regular text?

Well, I think that indent inside braces in math-mode shouldn't be
disabled because there are commands which take arguments (e.g.
\mathbf{}). (Or are you thinking to disable indents for only square
brackets inside math mode?)

> With that, one could define 2 macros like this:

> \DeclareTextSymbol{\textbracketleft}{T1}{$} > \DeclareTextSymbol{\textbracketright}{T1}{$}

> and use them for unbalanced brackets.  WDYT?

Do you mean that users who want to use unbalanced brackets within
regular texts should define and use those \textbracketleft and
\textbracketright? That would be tedious for ordinary users, so they
wouldn't like to follow such new regulation...

>>>>> Sašo Živanović <saso.zivanovic@guest.arnes.si> writes:
>> Especially, how does your patch work in the presence of valid interval
>> notation like [1,10[ or [1,10)?  Will that break indentation for the
>> remainder of the whole document?
> For [1,10[  yes it will break it
> but closing braces in the comment can prevent that:
> [1,10[%]]

Unlike my patch, yours counts commented braces, which changes the
current AUCTeX behavior. I'm a bit afraid that breaks indentation in
other contexts. (Hmm, but such cases must be rather rare, so it wouldn't
matter much?)

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine