From mboxrd@z Thu Jan 1 00:00:00 1970 From: Titus von der Malsburg Subject: Re: Inline LaTeX formulae Date: Wed, 06 May 2015 13:35:08 -0700 Message-ID: <87vbg5xx4z.fsf@posteo.de> References: <876186zsrc.fsf@posteo.de> <874mnqzp4t.fsf@posteo.de> <87wq0mc8bc.fsf@gmx.us> 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]:33534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq62K-0000YJ-Hh for emacs-orgmode@gnu.org; Wed, 06 May 2015 16:35:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yq62H-00086u-SK for emacs-orgmode@gnu.org; Wed, 06 May 2015 16:35:20 -0400 Received: from mx02.posteo.de ([89.146.194.165]:48223) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq62H-00086k-LL for emacs-orgmode@gnu.org; Wed, 06 May 2015 16:35:17 -0400 In-reply-to: <87wq0mc8bc.fsf@gmx.us> 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: Rasmus Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2015-05-06 Wed 03:24, Rasmus wrote: > Hi Titus, > > Titus von der Malsburg writes: > >> Parentheses are punctuation, so the $ in my example should be >> interpreted as math delimiters. I think whoever wrote the code, simply >> overlooked parentheses when implementing the punctuation part. > > I believe the problem is complicated. I had a look at the code in org-element.el (thanks for the pointer). There is clearly a bigger problem here: There is a regexp listing all characters that must follow the final $ to make it qualify as a math delimiter (whitespace, punctuation). As I suspected, the parentheses are missing from that list (and adding them solves my problem). However, a metric ton of other punctuation marks are missing as well, Spanish question marks, curly/smart quotes, real dashes (a minus is not a dash!), =E2=80=A6, even the exclamation mark is missing. If syntax tables allow a proper solution, great. I understand that syntax tables have a different meaning in different modes but does that matter? We=E2=80=99re only concerned about org-mode, right? Are there scenarios where the org parser is used in a non-org-mode buffer? I also saw that the commit that introduced the problem had the following description: Avoid using slow regexp. So if the problem is only due to mistaken optimization, it would perhaps be best to just revert to the previous code. Titus > In principal you could change the regexp in > org-element-latex-fragment-parser to something like > > "\\(\\s.\\|\\s-\\|\\s)\\|\\s\"\\|\\s_\\)" > > You'd only be relying on syntax tables, which I believe is what you are > suggesting. But this is also dangerous, see e.g. the recent change of > org-string-nw-p which previously relied on "\\S" cf.: > > http://article.gmane.org/gmane.emacs.orgmode/95473 > >> This should be fixed. > > Patches welcome. You could try to submit a patch where you add closing > parenthesis characters. > > It could even be patches to org.texi! > > Thanks, > Rasmus --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVSnr8AAoJEK40WfPGE2idT8EH/06QEHP3wpHIxmgjtu8CwkfE qcYDWpDC8x57584Ey9tYjqwCLdmo7Nnd22Ht7OOYsRpvDa/wlHzOsUlPUevCUmNK 8MeHQFsnkkiTCLl8n6h63tyaQIym9QiXcNrotPyy/nmiV1UjukH/zC+MgRdUUxao 7Z49qsHcTCTXDwb9J5ENXw7DswFuj799zzC9RqmiBMNlSVsvbwDsD2Stmg4pve3n qm2yKmGfpguHy5LI+MXT6EWu7pkWVGjyuJs/jnIcVmruDnNnjCWS0nnPL6XelD9m Ecwh81X0x8wo9lEfgWBUxQ4/jWoRFaEcPVSqiZG2tbfqUQldT43Z000hp101XB0= =AbrG -----END PGP SIGNATURE----- --=-=-=--