From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id eMblNc5/rWNJGAAAbAwnHQ (envelope-from ) for ; Thu, 29 Dec 2022 12:53:51 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id ELriNM5/rWOJNgAAG6o9tA (envelope-from ) for ; Thu, 29 Dec 2022 12:53:50 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5A7B9FCF4 for ; Thu, 29 Dec 2022 12:53:50 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pArT2-0002xj-NT; Thu, 29 Dec 2022 06:53:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pArT0-0002xI-1X for emacs-orgmode@gnu.org; Thu, 29 Dec 2022 06:52:58 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pArSy-0002Ac-2a for emacs-orgmode@gnu.org; Thu, 29 Dec 2022 06:52:57 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id ECF1424010C for ; Thu, 29 Dec 2022 12:52:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1672314774; bh=syevWu4Vl4DQpkDn/qjp9weHcql/kkbKFc+CEGag2LU=; h=From:To:Cc:Subject:Date:From; b=p45qxLvbRvXBSgawldddr/z8xKKaZuTiRfWcuLfMvZWdhvAtyc9nRBmpSEy6jUt/K 6vofoDtUZI8GpgxPqPCZ++ABS3Rn0u4bsmMhdBMDSrD4kJmHeTe7/x3v4pjeToO9Xb x6LoHSdBDf0K4tiQNn4e3Ig7VG8LSWQy05VFZfAb9MyK15DmI/xcgEK9awZZpbfB86 ycAdjjWAZBsLIwhE5Ip5i6J8md8Uwr3rdclHeL5qtCIU/e2MNSIleZL3scPHZSgr5n Fj4H7bv9wWtisiw81s/bkU3YZ/+kQ4w8KBqRJpICJQDKCVapiacBdA6O8uU5EgpiAr eQp4fUytO+ePQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NjRbT1WhWz9rxD; Thu, 29 Dec 2022 12:52:53 +0100 (CET) From: Ihor Radchenko To: alain.cochard@unistra.fr Cc: emacs-orgmode@gnu.org Subject: Re: Problems with LaTeX export for $x\text{foo $x$}$-like construts? In-Reply-To: <87wn6av84v.fsf@localhost> References: <25516.19256.621545.995694@gargle.gargle.HOWL> <87wn6av84v.fsf@localhost> Date: Thu, 29 Dec 2022 11:52:44 +0000 Message-ID: <875yduv33n.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1672314830; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=JrAC0dkKvIR/QMhYzO2DuIc036undIbUCVAAb0KcUA0=; b=EnoUYd2J69pYZUAasf/Wq/U8t1cXgeKOL6dxmpAiu6igXAGtXmEAPbF7eAaG+ZzEbXyh7O 9AKEEdkOmX69Gn2AvqwqvMUUSIoIGGBO/PmvC1xbXHteBmTQ2QVSCsYxn58ctK5U6oytcW bzCskVyren0sB8ZLeaSEi8CHsjK1hHnvem+o/ErTja6ySuKcxMWK8M7iwtv0YgAwROk2hY zR0fOFU99RxpxZRwiCbhu20e8NsJsFZCS8FXKT7CCtRikNk1DSG+721BqrWPMwvt1REmsN jsQ0qrKwmN1/V20Byd7uhjf+b9Djn4PeZ9dLeDmk9gpZ9Zokv3+1Qh825mnAzw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=p45qxLvb; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1672314830; a=rsa-sha256; cv=none; b=X9ssxPk2mmmjsAmbbKLZ7Un6JUKrtE3HFeBP39EwAX4ONd+ieBcjgxrH+s6Tu0+dygJRWH ZKJV3Vjfub6dya7shYHHbiriZNs54nv+j5ptxFvyjYsDJ8weMqEjXdlWfuZFSnmDKTQ1TC TvQbCSLLvEXo+ZbTvhVtmpuRwQd6A7gKJpRlBhx4nf4D+rDGtTKBVCXYoLPZ3bgbHhL1dz s2vItf45rmejGTdtIC64QHV9tX5Q31FVKNyiGwmGm3u+4nNXQ2Aj37JjJvvEtEPKZC7Jpc bki8HDBynwtcmoPsrSnXXvMjdkHGKcHizhrRvQXs0IQDY8DQbQS9NAwLRP3C3g== X-Spam-Score: -2.46 X-Migadu-Queue-Id: 5A7B9FCF4 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=p45qxLvb; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -2.46 X-TUID: J0NIvrGY3TUS Ihor Radchenko writes: > Unfortunately, I do not see an easy solution without hitting parser > performance. Our general approach is to avoid forward-parsing as much as > possible with an exception to paired brackets (because Elisp allows > parsing paired brackets fast using C-level code). However, AFAIK, there > is no easy way to parse brackets that are not single symbols. "\(" is > impossible to match using `scan-lists'. One interesting idea to consider is using PEG (third-party ELPA package). The above examples with paired parenthesis can be parsed using the following PEG: (with-peg-rules ((no-paren (not "\\(") (not "\\)") (any)) (no-paren-expr (+ no-paren)) (paren-expr "\\(" (* (or no-paren-expr paren-expr)) "\\)")) (peg-run (peg paren-expr))) PEG is not built-in though, so we cannot use it in Org. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at