From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Strange latex symbol behavior on html export Date: Thu, 14 Sep 2017 10:14:59 +0200 Message-ID: <8760cln1bw.fsf@gmx.us> References: <877ex2px4t.fsf@nicolasgoaziou.fr> <87poau1a5l.fsf@alphaville.usersys.redhat.com> <87lgli0x3n.fsf@alphaville.usersys.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsPIy-0002zo-7g for emacs-orgmode@gnu.org; Thu, 14 Sep 2017 04:15:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dsPIm-0006I6-06 for emacs-orgmode@gnu.org; Thu, 14 Sep 2017 04:15:24 -0400 Received: from [195.159.176.226] (port=33948 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dsPIl-0006F5-Mn for emacs-orgmode@gnu.org; Thu, 14 Sep 2017 04:15:11 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dsPIb-0008CA-Fz for emacs-orgmode@gnu.org; Thu, 14 Sep 2017 10:15:01 +0200 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" To: emacs-orgmode@gnu.org Nick Dokos writes: > Lawrence Bottorff writes: > >> ... I use >> >> # this makes MathJax work >> #+OPTIONS: tex:t >> >> I just now found this caption weirdness because I started a new .org >> file with no latex symbol markup besides in the caption. Quite >> bizarre that when my file sees other latex symbols, the caption >> symbols then render correctly.  >> > >> On Wed, Sep 13, 2017 at 6:55 PM, Nick Dokos wrote: >> >> Nicolas Goaziou writes: >> >> > Hello, >> > >> > Lawrence Bottorff writes: >> > >> >> Consider this markup: >> >> >> >> ------------ >> >> * MATHEMATICS AUXILIARY >> >> >> >> ** deriving sines and cosines >> >> >> >> #+caption: Right triangle with two $\pi\big/4$ angles. >> >> [[file:images/45-45-triangle.png]] >> >> >> >> $\big/$ >> >> ------------ >> >> >> >> If I remove the second $\big/$, the first latex, $\pi\big/4$, in the >> >> caption will not properly render on export to html. Include it and both >> >> render just fine. Without the second, the first looks like this: >> >> >> >> Figure 1: Right triangle with two \(\pi\big/4\) angles. >> >> >> >> Is this a bug? >> > >> > If you use >> > >> >   #+options: tex:dvipng >> > >> > the symbol in the caption is correctly rendered. It may be a bug in Mathjax. >> > >> >> I looked at the diff between html files produced with and without the $\big/$ addition. >> The one without does not include any of the mathjax configuration code at all. Is that >> code included conditionally perhaps when a latex construct is seen? Maybe the latex construct >> in the caption does not trigger the inclusion? >> >> -- >> Nick >> > > org-html--build-mathjax-config includes the mathjax code only if > > (and (memq (plist-get info :with-latex) '(mathjax t)) > (org-element-map (plist-get info :parse-tree) > '(latex-fragment latex-environment) 'identity info t)) > > is true. I guess we didn’t want to load extra JS unless it’s needed. > So if there is latex markup in the file (other than the caption) the org-element-map > call finds it and returns non-nil, but it apparently does not look inside the caption. When org-element looks at something like "#+caption: a $b$" it sees a keyword. I don’t know if it’s possible to check explicitly whether it contains maths. Alternatively, we could check if :with-latex is explicitly set in the buffer (like in ox-koma-letter) and then load it regardless. Rasmus -- This is the kind of tedious nonsense up with which I will not put