[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69346: 13.2; newcommand arguments affecting indentation
From: |
Arash Esbati |
Subject: |
bug#69346: 13.2; newcommand arguments affecting indentation |
Date: |
Sat, 24 Feb 2024 23:40:24 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Paul Nelson <ultrono@gmail.com> writes:
> It occurred to me that a better solution would be to constrain the
> "if*" commands matched by the regexp produced by
> LaTeX-indent-commands-regexp-make. My earlier patch fixed the
> preamble definition, which was all that mattered for the specific tex
> file that I was editing, but it is more natural to simultaneously fix
> any uses of such commands. I've attached a patch which gives my best
> attempt at doing this (no claim of optimality).
Hi Paul,
the issue with your suggestion is that it is too rigid and doesn't work
for definitions like:
--8<---------------cut here---------------start------------->8---
\newif\iffoo@bar
\iffoo@bar
do this
\else
do that
\fi
--8<---------------cut here---------------end--------------->8---
AUCTeX already tries to provide a solution for your problem, namely, the
variable `LaTeX-indent-begin-exceptions-list'. You can add your defined
macro on a per file basis with the local variables like this:
--8<---------------cut here---------------start------------->8---
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% eval: (add-to-list 'LaTeX-indent-begin-exceptions-list "ifs")
%%% End:
--8<---------------cut here---------------end--------------->8---
Personally, I would define this one macro like this and avoid the
hassle:
--8<---------------cut here---------------start------------->8---
\expandafter\newcommand\csname ifs\endcsname{%
\text{if }%
}
--8<---------------cut here---------------end--------------->8---
Or simply rename the macro to `\italicif' or something that doesn't
start if 'if'.
Best, Arash