From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Micha=C3=ABl_Cadilhac?= Subject: HTML export with LaTeX babel blocks Date: Wed, 28 Aug 2019 19:59:12 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000b7ae0305913705e7" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:41804) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i38n4-0001OF-B5 for emacs-orgmode@gnu.org; Wed, 28 Aug 2019 20:59:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i38n2-0001l8-Ea for emacs-orgmode@gnu.org; Wed, 28 Aug 2019 20:59:54 -0400 Received: from cadilhac.name ([163.172.56.42]:41832 helo=mattermost.cadilhac.name) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i38n2-0001h3-3w for emacs-orgmode@gnu.org; Wed, 28 Aug 2019 20:59:52 -0400 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) by mattermost.cadilhac.name (OpenSMTPD) with ESMTPSA id cace3615 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Thu, 29 Aug 2019 00:59:49 +0000 (UTC) Received: by mail-vs1-f47.google.com with SMTP id i128so1285101vsc.7 for ; Wed, 28 Aug 2019 17:59:49 -0700 (PDT) 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 --000000000000b7ae0305913705e7 Content-Type: multipart/alternative; boundary="000000000000b7ae0105913705e5" --000000000000b7ae0105913705e5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable My goal is to export SVG files of TikZ drawings in HTML. Now, what follows is a bit of a rant on `org-babel-execute:latex`; let's go through the options: - You're exporting to PNG without imagemagick: This uses `org-create-formula-image` which works really well, but it discards the options of the LaTeX block (fit, width, height, ...), including headers. It also fails to *force* using 'dvipng as processing type, so if `org-preview-latex-default-process` has been changed, it may be confusing. Finally, it uses `in-buffer` to render LaTeX as if it were in the buffer, which is not what the user would want since they are exporting to html (as a result, I get a black background on my pictures, since my buffer background is black). - You're exporting to PNG with imagemagick or to PDF: This may work. Sadly, "#+LATEX_HEADER:" is ignored, though it is in the previous case. - You're exporting to HTML. This uses htlatex=E2=80=94it's very rarely fun= ctional, but eh, you asked for TeX to HTML, and pdf2htmlEX seems unmaintained, so expect chaos. - You're exporting to SVG. This=E2=80=A6 uses htlatex? Why in paradise? org-create-formula-image wou= ld do that *brilliantly. *In any case, I can't seem to make it work: my fonts are always disappearing. So what do I do? I use the attached patch, that bypasses `htlatex` and uses the oh-so-working `org-create-formula-image`. This, of course, is not a complete solution=E2=80=94this whole function is messy at best, buggy at worst=E2=80=94but in the meantime, I can finally export my pictures to SVG = (end result: https://autoboz.org/open-problems/19.1-ccra/). If anyone has an opinion on what to do with this situation, I'd be happy to help. Cheers, M. --000000000000b7ae0105913705e5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
My goal is to export SVG files of TikZ drawings in HT= ML.=C2=A0 Now, what follows is a bit of a rant on `org-babel-execute:latex`= ; let's go through the options:

- You're e= xporting to PNG without imagemagick:
This uses `org-create-formul= a-image` which works really well, but it discards the options of the LaTeX = block (fit, width, height, ...), including headers.=C2=A0 It also fails to = force=C2=A0using 'dvipng as processing type, so if `org-preview-= latex-default-process` has been changed, it may be confusing.=C2=A0 Finally= , it uses `in-buffer` to render LaTeX as if it were in the buffer, which is= not what the user would want since they are exporting to html (as a result= , I get a black background on my pictures, since my buffer background is bl= ack).

- You're exporting to PNG with imagemagi= ck or to PDF:
This may work.=C2=A0 Sadly, "#+LATEX_HEADER:&q= uot; is ignored, though it is in the previous case.

- You're exporting to HTML.=C2=A0 This uses htlatex=E2=80=94it's = very rarely functional, but eh, you asked for TeX to HTML, and pdf2htmlEX s= eems unmaintained, so expect chaos.

- You're e= xporting to SVG.
This=E2=80=A6 uses htlatex?=C2=A0 Why in paradis= e?=C2=A0 org-create-formula-image would do that brilliantly.=C2=A0 I= n any case, I can't seem to make it work: my fonts are always disappear= ing.

So what do I do?=C2=A0 I use the attached pat= ch, that bypasses `htlatex` and uses the oh-so-working `org-create-formula-= image`.=C2=A0 This, of course, is not a complete solution=E2=80=94this whol= e function is messy at best, buggy at worst=E2=80=94but in the meantime, I = can finally export my pictures to SVG (end result:=C2=A0https://autoboz.org/open-problems/19.= 1-ccra/).

If anyone has an opinion on what to = do with this situation, I'd be happy to help.

= Cheers,
M.

--000000000000b7ae0105913705e5-- --000000000000b7ae0305913705e7 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-ob-latex-Use-org-create-formula-image-when-generatin.patch" Content-Disposition: attachment; filename="0001-ob-latex-Use-org-create-formula-image-when-generatin.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jzvz5e560 RnJvbSA3ZjJjYmVlMGU0NWJhNmE1N2M5MTNlZDQ5NjkwMjYyNDAxZTY3ZjM5IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/TWljaGE9QzM9QUJsPTIwQ2FkaWxoYWM/PSA8 bWljaGFlbEBjYWRpbGhhYy5uYW1lPgpEYXRlOiBUaHUsIDE1IEF1ZyAyMDE5IDEwOjI4OjI3IC0w NDAwClN1YmplY3Q6IFtQQVRDSF0gb2ItbGF0ZXg6IFVzZSBvcmctY3JlYXRlLWZvcm11bGEtaW1h Z2Ugd2hlbiBnZW5lcmF0aW5nIFNWRwoKKiBsaXNwL29iLWxhdGV4LmVsIChvcmctYmFiZWwtZXhl Y3V0ZTpsYXRleCk6IFJlbW92ZSBjb252b2x1dGVkIGFuZApidWdneSBodGxhdGV4IGJhc2VkIFNW RyBnZW5lcmF0a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