auctex
[Top][All Lists]

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

 From: Arash Esbati Subject: Re: Indenting the code written in square brackets as optional parameters Date: Sat, 05 Mar 2022 09:58:37 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50

Hi Keita,

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

>>>>>> Arash Esbati <arash@gnu.org> writes:
>> Does your proposal deal with cases where you only have an opening
>> bracket?
>
> Hmm, it doesn't seem to do so according to experiment.

I thought so :-)

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

Can we use the same trick we use for the fontification of \$, i.e., put a
closing ] as a comment in the same line?

--8<---------------cut here---------------start------------->8---
\documentclass[a4paper]{article}
\begin{document}

Text {%
this is indented and we trust that a closing \} will come.%
}

Text [% ]
and the text is not indented.
\end{document}
--8<---------------cut here---------------end--------------->8---

Does this make sense?

Best, Arash