help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Convert some Latex expressions in Emacs.


From: Hongyi Zhao
Subject: Convert some Latex expressions in Emacs.
Date: Mon, 16 May 2022 11:25:31 +0800

Currently, I've some LaTeX code OCRed into Emacs from a book, as shown
below and in the attached file:

```
\begin{array}{l}G_{192}^{1} \\ P^{12}=E ; Q^{4}=E ; R^{4}=E ; S^{8}=E
; Q^{2}=R^{2} ; S^{2}=P^{6} Q^{2} R ; Q P=P^{7} Q^{2} R ; Q
P^{3}=P^{3} Q \\ R P=P^{10} Q R ; R Q=P^{6} Q^{3} R ; S P=P^{2} R S ;
S Q=P^{3} Q^{3} R S ; S R=R S \\ C_{1}=E ; C_{2}=P^{3} Q^{2} ;
C_{3}=P^{6} ; C_{4}=P^{9} Q^{2} ; C_{5}=P^{6} R, Q^{3}, P^{9} Q^{3} R,
Q^{2} R, P^{6} Q, P^{3} Q R \\ C_{6}=P^{9} Q^{2} R, P^{3} Q, Q R,
P^{3} R, P^{9} Q^{3}, P^{6} Q^{3} R ; C_{7}=P^{11} Q, P^{8} Q^{2},
P^{5} Q^{2} R, P^{2} Q^{3} R, P^{7} R, P^{4} Q^{2}, P^{4} Q R, P Q^{3}
;\end{array}
```

Although there is no problem with the LaTeX code itself, I want to
tweak these code as follows, so that it can be used as a GAP [1]
input:

1. Remove the following stuff: `\begin{array}{l}', `\end{array}'.
2. For each word, remove '{' and '}', spaces, and add * between two
characters of it, i.e., `P^{5} Q^{2} R' should be changed to
`P^5*Q^2*R'.
3. Change `C_{digit}` to `Cdigit`, i.e., `C_{5}=P^{6} R' should be
changed to `C5=P^6*R'.
4. Change the first `\\' to new line.
5. Change the first appear of `\\' before the first `C_{digit}` to new line.
6. Change other `\\' to comma.
7. Change `;' to comma.

Any concise tips and tricks to achieve this goal?

[1] https://www.gap-system.org/

Regards
-- 
Assoc. Prof. Hongsheng Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province

Attachment: image.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]