From mboxrd@z Thu Jan 1 00:00:00 1970 From: Titus von der Malsburg Subject: Re: Inline LaTeX formulae Date: Fri, 08 May 2015 12:52:33 -0700 Message-ID: <87twvmkfsu.fsf@posteo.de> References: <876186zsrc.fsf@posteo.de> <874mnqzp4t.fsf@posteo.de> <87wq0mc8bc.fsf@gmx.us> <87vbg5xx4z.fsf@posteo.de> <87bnhwq1ez.fsf@delle7240.chemeng.ucl.ac.uk> <87vbg4gtef.fsf@posteo.de> <87egmsi2ex.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqoKF-0004wH-V8 for emacs-orgmode@gnu.org; Fri, 08 May 2015 15:52:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqoKB-0000OI-Qh for emacs-orgmode@gnu.org; Fri, 08 May 2015 15:52:47 -0400 Received: from mx02.posteo.de ([89.146.194.165]:50180) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqoKB-0000Kp-HL for emacs-orgmode@gnu.org; Fri, 08 May 2015 15:52:43 -0400 In-reply-to: <87egmsi2ex.fsf@nicolasgoaziou.fr> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2015-05-07 Thu 13:00, Nicolas Goaziou wrote: > Titus von der Malsburg writes: > >> Rasmus=E2=80=99 proposal is simple and correctly implements what is spec= ified 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=E2=80=99s 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=E2=80=99t need spe= cial 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 =20=20 diff --git a/doc/org.texi b/doc/org.texi index 7b78417..d926de4 100644 =2D-- a/doc/org.texi +++ b/doc/org.texi @@ -10347,9 +10347,10 @@ Text within the usual @LaTeX{} math delimiters. T= o 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, =2Dand if the closing @samp{$} is followed by whitespace, punctuation or a = dash. =2DFor the other delimiters, there is no such restriction, so when in doubt= , use =2D@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 =20 @noindent For example: diff --git a/lisp/org-element.el b/lisp/org-element.el index 7aab9f6..8f57c90 100644 =2D-- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -2963,7 +2963,7 @@ Assume point is at the beginning of the LaTeX fragmen= t." (search-forward "$" nil t 2) (not (memq (char-before (match-beginning 0)) '(?\s ?\t ?\n ?, ?.))) =2D (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 =2D-- 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 =2D ("$1" "\\([^$]\\|^\\)\\(\\$[^ \r\n,;.$]\\$\\)\\([- .,?;:'\")\000]\= \|$\\)" 2 nil) =2D ("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^ \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)) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVTRQBAAoJEK40WfPGE2idTlAH/jfAWSEdwMkBA9UKhYYIHMcx Fku82H0DgwX/KEpsYBbUUkXDgAkZ6tqbDTPOkKjV+Zo0jdg/KjzV4AceqIewfF6W oToYGgUPsGQ/KxKYkZ7NhzAPXRxJUY6e8ldochZnf8JCNxD2d77Hv8QpUTgiEWMN iMp/p/pF0MuLD/veHIvp+UqAPC9rJnGCEo2Zn2ZPV7xNvUoAH65ZXLVM4GQDX0nO bT+N/w5vPxbGjukeCQ40VaQBOggLodzrrm3dsoSA3WJdTyn2qPsixgICml4ghFNq RrQqScMH5T+mdklnkJFPf9k3CPbalEWVCwEgu1YCAHNy2ehrKd52v30ytsKdIfs= =0hx/ -----END PGP SIGNATURE----- --=-=-=--