Subject: bug#57626: 13.1.4; cases* environment doesn't let me use $

From: Arash Esbati <[email-masked]>
Date: Wed, 07 Sep 2022 12:51:25 +0200

Hi Máté,

Wierdl Máté <[email-masked]> writes:

> In a cases* environment (from mathtools package), I try to enter math
> mode in the "text column", but auctex doesn't let me enter a $.
>
> So I have
>
> \begin{equation}
>   \label{eq:240}
>   Tx=
>   \begin{dcases*}
>     1& if 
>   \end{dcases*}
> \end{equation}
>
> and after "if" a I try to enter a formula, but auctex says in the
> minibuffer
>
> "Math mode started with ‘equation’ cannot be closed with dollar"
>
> I should be able to enter a $ in text mode.

Thanks for the report.  Can you please add the next 2 lines in your .tex
file and eval them, i.e., hit 'C-x C-e' after ')' and see if it then
works as expected?

    (add-to-list 'texmathp-tex-commands '("dcases*" env-off) t)
    (texmathp-compile)

I think this a corner case where half of a environment is math and the
other half text.  AUCTeX thinks that the entire environment is math and
hence throws an error.  I don't have a strong opinion about this, we can
add some entries like this to `texmathp-tex-commands-default':

    ("cases*"   env-off)
    ("dcases*"  env-off)
    ("rcases*"  env-off) 
    ("drcases*" env-off)

What do others think?

Best, Arash