From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: Convert some Latex expressions in Emacs. Date: Tue, 17 May 2022 10:12:39 +0800 Message-ID: References: <87k0alvxf4.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16076"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 17 04:14:35 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqmjK-00040l-Ua for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 17 May 2022 04:14:34 +0200 Original-Received: from localhost ([::1]:38870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqmjJ-0002RW-FT for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 16 May 2022 22:14:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqmhj-0002RE-1C for help-gnu-emacs@gnu.org; Mon, 16 May 2022 22:12:55 -0400 Original-Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]:36601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqmhg-00088V-D0 for help-gnu-emacs@gnu.org; Mon, 16 May 2022 22:12:53 -0400 Original-Received: by mail-ed1-x533.google.com with SMTP id fd25so7987933edb.3 for ; Mon, 16 May 2022 19:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B6a8hlbl5OdU3lIF1Y6A9shjGP6Ja5LQrwJrg67oO1Q=; b=o8L5EIw2TSwlVyZPFf0KOpwtufW89xibsMq9/2T5q66/dp7Dx91y+7zqDfjAt87HyQ AK3Uhml6dTez1yqAb+pVHB62av2YfsdKIJ9MpY4i0qdooNta6GQYl9yFP9Wk5oaZ32pl j4nAX9/mjsm9ogDra93Tn6J+axEKEkU14h+TFIOAHXU5Z9PsUrfXpBrhCoL4uqCKHkue x458sd5SO1Xcw5g/cCDIkzfMhnbFUKMINtyLQT5It6104jBehRrrjDS9rWZJxD1h2VQr 3c+RLF3JoAGO/64+SXjh432DDqzR4bBtpUw35OuZav2XXTgkbNeK1iYQnPoVCYyyDNfq jknw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B6a8hlbl5OdU3lIF1Y6A9shjGP6Ja5LQrwJrg67oO1Q=; b=adu5ZqftPY0mTTc0/2MvxbdknRrOVpb7306G3067HFP3BZVALyNExnS1fmX/hdSYxW nUndUifrgLQoAeSFHunLyNfXSIl/I6ZLD2mXR8oobVNhTIdyEjYRM20roG6a5CpQnhK8 gOkj5e/50TlTEOMH1lOG8OlhHI7z4rlc5arPlzsfu0e9FD/Fvfy1mnDyqHV7KdHJDi/b v7H2RtjyNnW0KOEBSt4pkqBiCbQp3031Io1majPHdXETk3mFF3Jylu6lUWfIvcHhw189 sHROhUj6yMvvWoHEakbCASO5Lp+Efj0BNmwJVVRvTc1GuF7thEu66GWdtKQ0tg5T8Rjx Wxwg== X-Gm-Message-State: AOAM532J2/bBsQPMCJOwjBNxHQwJVS2AI9qB6siafeezIs8YSP/Awsmh AJoPko/sdcXDrI3RUK6spNYg5xTrfSbH85R1w7CSkqRSU6LENIWI X-Google-Smtp-Source: ABdhPJxnVjeTCCL3Me3wNR5+OfLaXACM4Gy1djumJLEmdHf6yomd9pPHb4HfDx1GKRjUKqH9Go6BYKVeWF9/ZFrYwgI= X-Received: by 2002:a50:ed16:0:b0:425:f420:e51a with SMTP id j22-20020a50ed16000000b00425f420e51amr16607125eds.23.1652753570793; Mon, 16 May 2022 19:12:50 -0700 (PDT) In-Reply-To: <87k0alvxf4.fsf@web.de> Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=hongyi.zhao@gmail.com; helo=mail-ed1-x533.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:137288 Archived-At: On Tue, May 17, 2022 at 8:02 AM Michael Heerdegen wrote: > > Hongyi Zhao writes: > > > 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'. > > [...] > > If you have some time you might have a look at peg.el (from Gnu Elpa). > PEGs (Parsing Expression Grammars) are a bit more expressive than > regular expressions. Takes a bit of time to get used to the concept but > if you have to solve such tasks more often it may pay off. I roughly browse the relevant introduction here [1]. It seems that all Emacs Lisp based regex patterns are more complicated and tedious than other languages, e.g., python, wolfram, and so on. [1] https://elpa.gnu.org/packages/peg.html > Michael. > Regards, Hongsheng