[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Convert bla to $bla$ automatically when be highlighted and typeset a
From: |
Hongyi Zhao |
Subject: |
Re: Convert bla to $bla$ automatically when be highlighted and typeset a $. |
Date: |
Sun, 21 May 2023 21:33:43 +0800 |
On Sun, May 21, 2023 at 7:14 PM Mosè Giordano <mose@gnu.org> wrote:
>
> Hi Zhao
>
> On Sun, 21 May 2023 at 09:41, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> > I want to convert `bla` to `$bla$` automatically when be highlighted
> > and typeset a `$'.
>
> I believe you want to look at `TeX-electric-math'
> (https://www.gnu.org/software/auctex/manual/auctex/Quotes.html#index-TeX_002delectric_002dmath):
>
> --8<---------------cut here---------------start------------->8---
> TeX-electric-math is a variable defined in ‘tex.el’.
>
> Its value is ("\\(" . "\\)")
> Original value was nil
> Local in buffer foo.tex; global value is nil
>
> If non-nil, when outside math mode ‘TeX-insert-dollar’ will
> insert symbols for opening and closing inline equation and put
> the point between them. If there is an active region,
> ‘TeX-insert-dollar’ will put around it symbols for opening and
> closing inline equation and keep the region active, with point
> after closing symbol. If you press ‘$’ again, you can toggle
> between inline equation, display equation, and no equation.
>
> If non-nil and point is inside math mode right between a couple
> of single dollars, pressing ‘$’ will insert another pair of
> dollar signs and leave the point between them.
>
> If nil, ‘TeX-insert-dollar’ will simply insert "$" at point,
> this is the default.
>
> If non-nil, this variable is a cons cell whose CAR is the string
> to insert before point, the CDR is the string to insert after
> point. You can choose between "$...$" and "\(...\)".
>
> Automatically becomes buffer-local when set.
> You can customize this variable.
> --8<---------------cut here---------------end--------------->8---
Based on the above document, I've added the following hook entry in
AUCTeX's use-package configuration:
(LaTeX-mode . (lambda () (set (make-local-variable 'TeX-electric-math)
(cons "$" "$"))))
But I still cannot observe the desired behavior, as shown in the
attached screenshot.
> Bye,
> Mosè
Best,
Zhao
image.png
Description: PNG image
- Convert bla to $bla$ automatically when be highlighted and typeset a $., Hongyi Zhao, 2023/05/21
- Re: Convert bla to $bla$ automatically when be highlighted and typeset a $., Hongyi Zhao, 2023/05/21
- Re: Convert bla to $bla$ automatically when be highlighted and typeset a $., Mosè Giordano, 2023/05/21
- Re: Convert bla to $bla$ automatically when be highlighted and typeset a $.,
Hongyi Zhao <=
- Re: Convert bla to $bla$ automatically when be highlighted and typeset a $., Hongyi Zhao, 2023/05/21
- Re: Convert bla to $bla$ automatically when be highlighted and typeset a $., Mosè Giordano, 2023/05/21
- Re: Convert bla to $bla$ automatically when be highlighted and typeset a $., Hongyi Zhao, 2023/05/21
- Re: Convert bla to $bla$ automatically when be highlighted and typeset a $., Mosè Giordano, 2023/05/21
- Re: Convert bla to $bla$ automatically when be highlighted and typeset a $., Hongyi Zhao, 2023/05/21
- Re: Convert bla to $bla$ automatically when be highlighted and typeset a $., Hongyi Zhao, 2023/05/22