From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Entities Parsing Code Date: Sat, 8 Oct 2011 18:06:27 +0200 Message-ID: References: Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:52313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCZQ0-0007G8-GZ for emacs-orgmode@gnu.org; Sat, 08 Oct 2011 12:06:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RCZPz-0002Ou-IO for emacs-orgmode@gnu.org; Sat, 08 Oct 2011 12:06:32 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:44872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCZPz-0002On-DE for emacs-orgmode@gnu.org; Sat, 08 Oct 2011 12:06:31 -0400 Received: by wwp14 with SMTP id 14so6160164wwp.30 for ; Sat, 08 Oct 2011 09:06:30 -0700 (PDT) In-Reply-To: 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: Pavel Panchekha Cc: emacs-orgmode@gnu.org On 19.9.2011, at 23:39, Pavel Panchekha wrote: > I've been noticing that the org-pretty-entities code incorrectly lexes = numbers as part of TeX command names; for example, if I type $\sim2n^2$, = the \sim will not be replaced with a ~ because the 2 is lexed as part of = the command name. This is incorrect; in TeX, numbers are not legal = parts of a command name. Hi Pavel, this is on purpose, in order to support names like \frac12. = Most, but not all entity names are strict TeX. You can work around this = by inserting spaces - \sim2n^2 looks quite unreadable to me anyway - I would, also in a TeX file, always = write it like=20 \sim 2 n^2 - Carsten >=20 > Here's a patch that fixes the issue: >=20 > diff --git a/lisp/org.el b/lisp/org.el > index 73b1073..0db5a0b 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -5735,7 +5735,7 @@ needs to be inserted at a specific position in = the font- > (when org-pretty-entities > (catch 'match > (while (re-search-forward > - = "\\\\\\([a-zA-Z][a-zA-Z0-9]*\\)\\($\\|[^[:alnum:]\n]\\)" > + "\\\\\\([a-zA-Z]+\\)\\($\\|[^[:alpha:]\n]\\)" > limit t) > (if (and (not (org-in-indented-comment-line)) > (setq ee (org-entity-get (match-string 1))) >=20 > --=20 > - Pavel Panchekha >=20