From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Huszagh Subject: Re: Issues with nested begin..end blocks in inline math environments Date: Sat, 14 Dec 2019 20:01:59 -0800 Message-ID: <87sglmw820.fsf@gmail.com> References: <87d0d0e5kg.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:51975) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igL6b-0000fh-NY for emacs-orgmode@gnu.org; Sat, 14 Dec 2019 23:02:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igL6a-0002eG-IB for emacs-orgmode@gnu.org; Sat, 14 Dec 2019 23:02:05 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]:41547) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igL6a-0002e7-9f for emacs-orgmode@gnu.org; Sat, 14 Dec 2019 23:02:04 -0500 Received: by mail-pl1-x62d.google.com with SMTP id bd4so2971161plb.8 for ; Sat, 14 Dec 2019 20:02:04 -0800 (PST) In-Reply-To: <87d0d0e5kg.fsf@ucl.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Fraga, Eric" Cc: "emacs-orgmode@gnu.org" --=-=-= Content-Type: text/plain I'm submitting this as a patch. I've used it on hundreds of latex fragments over the past week or so and haven't experienced any issues (which is expected since the change is small). --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-element.el-allow-environment-blocks-in-math-deli.patch Content-Description: regex-patch >From a699b699ed4132839c39f1152868bb13364422c7 Mon Sep 17 00:00:00 2001 From: Matt Huszagh Date: Sat, 14 Dec 2019 19:54:41 -0800 Subject: [PATCH] org-element.el: allow environment blocks in math delimiters * lisp/org-element.el (org-element--latex-begin-environment): Add a non-capturing block for `\(' or `$' so that previously recognized latex environments can also appear within an inline math environment. * lisp/org-element.el (org-element--latex-end-environment): Match the begin environment noncapturing block with `$' or `\)'. --- lisp/org-element.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 110ff5624..6d7ec32c6 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -2222,14 +2222,14 @@ containing `:key', `:value', `:begin', `:end', `:post-blank' and ;;;; Latex Environment (defconst org-element--latex-begin-environment - "^[ \t]*\\\\begin{\\([A-Za-z0-9*]+\\)}" + "^[ \t]*\\(?:\\\\(\\|\\$\\)?\\\\begin{\\([A-Za-z0-9*]+\\)}" "Regexp matching the beginning of a LaTeX environment. The environment is captured by the first group. See also `org-element--latex-end-environment'.") (defconst org-element--latex-end-environment - "\\\\end{%s}[ \t]*$" + "\\\\end{%s}[ \t]*\\(?:\\\\)\\|\\$\\)?$" "Format string matching the ending of a LaTeX environment. See also `org-element--latex-begin-environment'.") -- 2.24.0 --=-=-=--