auctex-devel
[Top][All Lists]

## a function that converts expression1/expression2 to \frac{expression1}{e

 From: Uwe Brauer Subject: a function that converts expression1/expression2 to \frac{expression1}{expression2} Date: Wed, 29 Dec 2021 08:22:47 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Hi

This has annoyed me for years, honestly.

I sometimes receive latex files, with constructions like this

In fact, if $6/5<\gamma<2$, there exists a solution
Then
$$\rho(t, x)=\left\{ \begin{array}{ll} {\left[\frac{K \gamma}{4 \pi \kappa(\gamma-1)}\right]^{1/\left(2-\gamma^{\prime}\right)} u(|x|)^{1 /(\gamma-1)}} & \text { for } 0 \leqq|x| \leqq R \\ 0 & \text { for } R<|x| \end{array} \right.$$

What annoys me is the use of 6/5 instead of \frac{5}{6} (I know
sometimes it is even advised to use it).

But in general I want \frac

So I have the following function

(defun my-change-frac ()
"Changes stuff like 1/2 to \frac{1}{2}."
(interactive)
(query-replace-regexp "\$$\\<[0-9]*\$$\$$[\\/]\$$\$$[0-9]*\\>\$$"
"\\\\frac{\\1}{\\3}"))

It covers the 6/5 case but not, for example,
1/\left(2-\gamma^{\prime}\right)

Does anybody have an idea?
In general shouldn't auctex have such a function?

Regards

Uwe Brauer


smime.p7s
Description: S/MIME cryptographic signature

reply via email to