From: Titus von der Malsburg <malsburg@posteo.de>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: Inline LaTeX formulae
Date: Fri, 08 May 2015 12:52:33 -0700 [thread overview]
Message-ID: <87twvmkfsu.fsf@posteo.de> (raw)
In-Reply-To: <87egmsi2ex.fsf@nicolasgoaziou.fr>
[-- Attachment #1: Type: text/plain, Size: 3563 bytes --]
On 2015-05-07 Thu 13:00, Nicolas Goaziou wrote:
> Titus von der Malsburg <malsburg@posteo.de> writes:
>
>> Rasmus’ proposal is simple and correctly implements what is specified in
>> the manual. Below is a patch that implements this solution. Does
>> anyone see a concrete problem? If not, it should be merged.
>
> I do: you removed end of line matcher. Also, I do not see the point of
> matching "\s_".
Both are fixed in the patch below. I also included opening
parentheses. It’s an unlikely case but for consistency they should be
included.
> You also need to update `org-latex-regexps' accordingly.
Done.
I also updated org.texi. Dashes are punctuation and don’t need special
mention. I also clarified that quotes and parentheses are considered to
be punctuation (although Emacs has separate syntax classes for them).
Thanks for your feedback.
Titus
diff --git a/doc/org.texi b/doc/org.texi
index 7b78417..d926de4 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10347,9 +10347,10 @@ Text within the usual @LaTeX{} math delimiters. To avoid conflicts with
currency specifications, single @samp{$} characters are only recognized as
math delimiters if the enclosed text contains at most two line breaks, is
directly attached to the @samp{$} characters with no whitespace in between,
-and if the closing @samp{$} is followed by whitespace, punctuation or a dash.
-For the other delimiters, there is no such restriction, so when in doubt, use
-@samp{\(...\)} as inline math delimiters.
+and if the closing @samp{$} is followed by whitespace or punctuation
+(parentheses and quotes are considered to be punctuation in this
+context). For the other delimiters, there is no such restriction, so when in
+doubt, use @samp{\(...\)} as inline math delimiters.
@end itemize
@noindent For example:
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 7aab9f6..8f57c90 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -2963,7 +2963,7 @@ Assume point is at the beginning of the LaTeX fragment."
(search-forward "$" nil t 2)
(not (memq (char-before (match-beginning 0))
'(?\s ?\t ?\n ?, ?.)))
- (looking-at "\\([- \t.,?;:'\"]\\|$\\)")
+ (looking-at "\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|$\\)")
(point)))
(case (char-after (1+ (point)))
(?\( (search-forward "\\)" nil t))
diff --git a/lisp/org.el b/lisp/org.el
index 6139876..46a73b6 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -540,8 +540,8 @@ An entry can be toggled between COMMENT and normal with
'(("begin" "^[ \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t)
;; ("$" "\\([ (]\\|^\\)\\(\\(\\([$]\\)\\([^ \r\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \r\n,.$]\\)\\4\\)\\)\\([ .,?;:'\")]\\|$\\)" 2 nil)
;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p
- ("$1" "\\([^$]\\|^\\)\\(\\$[^ \r\n,;.$]\\$\\)\\([- .,?;:'\")\000]\\|$\\)" 2 nil)
- ("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\([- .,?;:'\")\000]\\|$\\)" 2 nil)
+ ("$1" "\\([^$]\\|^\\)\\(\\$[^ \r\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|$\\)" 2 nil)
+ ("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|$\\)" 2 nil)
("\\(" "\\\\([^\000]*?\\\\)" 0 nil)
("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 nil)
("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil))
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
next prev parent reply other threads:[~2015-05-08 19:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-05 20:14 Inline LaTeX formulae Titus von der Malsburg
2015-05-05 20:23 ` Rasmus
2015-05-05 20:27 ` Marcin Borkowski
2015-05-05 21:32 ` Titus von der Malsburg
2015-05-05 22:56 ` Marcin Borkowski
2015-05-06 10:24 ` Rasmus
2015-05-06 20:35 ` Titus von der Malsburg
2015-05-07 7:42 ` Eric S Fraga
2015-05-07 18:00 ` Titus von der Malsburg
2015-05-07 20:00 ` Nicolas Goaziou
2015-05-08 19:52 ` Titus von der Malsburg [this message]
2015-05-08 21:40 ` Nicolas Goaziou
2015-05-08 22:25 ` Titus von der Malsburg
2015-05-09 8:01 ` Nicolas Goaziou
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=87twvmkfsu.fsf@posteo.de \
--to=malsburg@posteo.de \
--cc=emacs-orgmode@gnu.org \
--cc=mail@nicolasgoaziou.fr \
/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).