From: Matt Huszagh <huszaghmatt@gmail.com>
To: "Fraga, Eric" <e.fraga@ucl.ac.uk>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Issues with nested begin..end blocks in inline math environments
Date: Sat, 14 Dec 2019 20:01:59 -0800 [thread overview]
Message-ID: <87sglmw820.fsf@gmail.com> (raw)
In-Reply-To: <87d0d0e5kg.fsf@ucl.ac.uk>
[-- Attachment #1: Type: text/plain, Size: 185 bytes --]
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).
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: regex-patch --]
[-- Type: text/x-patch, Size: 1457 bytes --]
From a699b699ed4132839c39f1152868bb13364422c7 Mon Sep 17 00:00:00 2001
From: Matt Huszagh <huszaghmatt@gmail.com>
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
next prev parent reply other threads:[~2019-12-15 4:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-06 19:42 Issues with nested begin..end blocks in inline math environments Matt Huszagh
2019-12-07 11:30 ` Fraga, Eric
2019-12-07 19:28 ` Matt Huszagh
2019-12-08 7:04 ` Matt Huszagh
2019-12-15 4:01 ` Matt Huszagh [this message]
2019-12-15 8:58 ` Nicolas Goaziou
2019-12-16 8:25 ` Matt Huszagh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sglmw820.fsf@gmail.com \
--to=huszaghmatt@gmail.com \
--cc=e.fraga@ucl.ac.uk \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).