From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id OIoZAU0G4mCCGgAAgWs5BA (envelope-from ) for ; Sun, 04 Jul 2021 21:04:45 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id VD9KOEwG4mA2EQAA1q6Kng (envelope-from ) for ; Sun, 04 Jul 2021 19:04:44 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2D40D23BD4 for ; Sun, 4 Jul 2021 21:04:44 +0200 (CEST) Received: from localhost ([::1]:35486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m07Q2-00020o-Cj for larch@yhetil.org; Sun, 04 Jul 2021 15:04:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m07Pd-00020R-B1 for emacs-orgmode@gnu.org; Sun, 04 Jul 2021 15:04:17 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:53135) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m07Pa-0005lO-NJ for emacs-orgmode@gnu.org; Sun, 04 Jul 2021 15:04:17 -0400 Received: by mail-wm1-x32d.google.com with SMTP id g10so4064520wmh.2 for ; Sun, 04 Jul 2021 12:04:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andrew-cmu-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ks2l1OSUFTnXJ6XfY5lGHOuPurYpWEUs6Y02rRGhpfw=; b=YxsUBM8M2WLAUQ+dTDazIfRg5qZckWDFByvX7tsBbPwhDzXcavN52+vdeZoi+K0A5i XwhhWfJ5XSMpISxp6PEZVolOhbVZckgOi6Z1DzlqtC74pe2FXr2oqYx0a7TgDcgF3lMO B9pA9+V5Tr2uu6DgkeeZDhMbDh3Y0YfCvwS/jVlyFED/OHay0c1oBSkj1hXmio8bRoHB OTEbuSa+d/JyZspBKZ0ugYncCtrR+dbacxoFq7VTm+cxakoD9ottUzbpmVQaeX4Lb2Be 7MZdfia72y+QjgC6nhpmLtW8NMTY3l8MDcjeSXqtDGDzHzcv74Xe0vPemMVlWECQCMQu lZIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ks2l1OSUFTnXJ6XfY5lGHOuPurYpWEUs6Y02rRGhpfw=; b=KPcwqY0yYILTF8eqF4+eXcsstDjbtZ0LJqYd7V0re43rhzSEKirtI0VABOa4PMPbx4 /KlL3CkmRqPD5qncg6QPkU6VVB3F/Llf5ELtAaaGGvUR9WgMRbWDxVH2lOkX3C3coAAn trKo4az20aHv+FVmImck2Aor+Z8DuFbOhMsVYqZ/LSyh+eWSqvlqM1DuLUlnSR6zY8AH QghwkCOotQ2y8PVKtiO/u+T+BOR3TPEx7AqgWLOGxSyIaAtAVoTqaBiF0sEnkjWui8lR Zub0OuqvT0Yc3rCpE28k3SygpReCzD8JVioxGjAnssUvocLopzV3GV7JxWfYMqGgnh5v D7TQ== X-Gm-Message-State: AOAM533iyaOLrfvPs5+ylLQJvHg+byjuk/Y3lTo1bZ+uIrD6Jggu2Z7/ kTEO5hhoGMlOVGzdKED0vSPljxec+dUXnNm1ODk= X-Google-Smtp-Source: ABdhPJzyPnFM7UhgzG8kdtM/PDaxXw++i1nn0ynCyYO54zyvG6YHilQMm8Gxars+8aY4fs4P0Yk4336N+HOCF6CNdSI= X-Received: by 2002:a05:600c:4b98:: with SMTP id e24mr10927576wmp.61.1625425452572; Sun, 04 Jul 2021 12:04:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: John Kitchin Date: Sun, 4 Jul 2021 15:04:01 -0400 Message-ID: Subject: Re: LaTeX-producing code : how to export results to HTML/ODT ? To: Emmanuel Charpentier Content-Type: multipart/alternative; boundary="000000000000b5a44a05c650da94" Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=johnrkitchin@gmail.com; helo=mail-wm1-x32d.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625425484; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ks2l1OSUFTnXJ6XfY5lGHOuPurYpWEUs6Y02rRGhpfw=; b=V/oD3UqqIbi8H3RdQfd5q4yba0AMITle5zW3iK3epl368h4cRwHfi6j7jjWlyxkZH1jQq4 LJ/9z6geU1HrvwKZAzzmSZU8X8vs1BQcvoUhLh1BgcXYJbxF82c0Jf4JgeN+yy5Bxf2uOZ 4k5kaWWJisJKxLgmrQGONqh57sP20yZvqr8ovAq1FjsO/1m7BAQDCx0EIXcKI1qyk1e0to TmfaezZ5uCSAFjKRF0XXWWYAHnMODBXID97N9qeffC7mOaS8PGu7LYuBugrL+50HaoTsab 6asrq5JN8+WR9Vdv6A/lBy43ZiSJYijKG0ekKQmax9TilybDOJYynx3BnGDLNw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625425484; a=rsa-sha256; cv=none; b=Z6v7ZKR/bEujrY2fZ7j2uidXKBkABltVCso0HahYXB9fL7rY+wFfHBXiJfHhX1ExobopJ8 0ioGFIFICzlafgcFd9xjBSZK5F7DSFEyqxXCI4HDLZWCEXt1zeIMXFFXJJJ50MJNvgmti/ G9W/BEjde4qf3kTy54gVaYAtbbGwbIzHg+utsxLDCU0Z3L3i5RiOotkw+E9DegaivjTdcZ yOKTeGvRPKZAZvWodIdiXPH6IK4x+w3czPe277oysEY33vyXSzcwU482xy4iqbbbNw0uIp SvIdkxvhbCkTK+R4ukEGSfkAoFCgqVSMnxNjcvxIkEJfmyPB4PyC7LzRw6K9ZQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=andrew-cmu-edu.20150623.gappssmtp.com header.s=20150623 header.b=YxsUBM8M; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=andrew.cmu.edu (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -0.01 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=andrew-cmu-edu.20150623.gappssmtp.com header.s=20150623 header.b=YxsUBM8M; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=andrew.cmu.edu (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 2D40D23BD4 X-Spam-Score: -0.01 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2TVjV+66qWP6 --000000000000b5a44a05c650da94 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This incantation worked for me: #+name: foo #+begin_src emacs-lisp :exports both :results drawer "Pseudo-function returning a LaTeX pseudo-result." "\\[\\displaystyle{\\sin\\left(\\frac{a}{b}\\right)}\\]" #+end_src #+RESULTS: foo :results: \[\displaystyle{\sin\left(\frac{a}{b}\right)}\] :end: the key is the drawer I think. John ----------------------------------- Professor John Kitchin (he/him/his) Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Sun, Jul 4, 2021 at 2:51 PM Emmanuel Charpentier wrote: > I tried this : > > #+property: header-args:sage :session > > #+options: tex:t toc:nil author:nil > > #+begin_src emacs-lisp :exports none > > ;; (customize-set-variable > > ;; 'org-latex-to-mathml-convert-command > > ;; "latexmlmath \"%i\" --presentationmathml=3D%o") > > (custom-set-variables > > '(org-latex-to-mathml-convert-command > > "java -jar %j -unicode -force -df %o %I") > > '(org-latex-to-mathml-jar-file > > "/usr/local/bin/mathtoweb.jar")) > > #+end_src > > > A "normal" function call with org result... > > > #+name: foo > > #+begin_src emacs-lisp :exports both :results org > > "Pseudo-function returning a LaTeX pseudo-result." > > "\\[\\displaystyle{\\sin\\left(\\frac{a}{b}\\right)}\\]" > > #+end_src > > > #+RESULTS: foo > > #+begin_src org > > \[\displaystyle{\sin\left(\frac{a}{b}\right)}\] > > #+end_src > > > Which exports the LaTeX *source* (uncompiled) in PDF, HTML and ODT. > > I'm currently lookin into a =3D:post=3D workaround. But an option to expo= rt > =3Dlatex=3D blocks to selected exporters (ODT, HTML, possibly Morkdown vi= a > pandoc). > > I'll keep you posted. > > Le dimanche 04 juillet 2021 =C3=A0 14:10 -0400, John Kitchin a =C3=A9crit= : > Can you declare the output as org so they will just be latex snippets? > > On Sun, Jul 4, 2021 at 3:46 AM Emmanuel Charpentier < > emm.charpentier@free.fr> wrote: > > Dear list, > > Org-mode offers the ability to create functions returning LaTeX results : > such occurrences are frequent with Sagemath, Maxima, Mathematica, R, and > even emacs's Calc... > > Such functions can be declared has having LaTeX output, and the resulting > =3D#+begin_export latex ... #+end_export latex=3D block is exported as = LaTeX > and end up in the PDF versin. > > But such blocks seem to export **only** to LaTeX/PDF ; more specically, > they do not export to HTML nor ODT. In order to insert those results at > export, one **has** to print them **raw**. See the attached examples, and > compare PDF, HTML and ODT outputs of the enclosed zip archive (necessary = to > avoid the wrath of the spam filter of my provider ;-)...).. > > Unless I am mistaken, this is the *only* way to export LaTeX exports to > HTML/ODT ; I am not aware of any option allowing to force such exports. S= o > a couple questions : > > - Am I mistaken ? > - Are there more steamlined ways to get LaTeX in > HTML/ODF/whatever-but-not-LaTeX ? > - Wouldn't an option to allow these exports be a welcome addition to > the export structure (or possibly to the various exporters) ? > > > Thanks in advance, > > > --000000000000b5a44a05c650da94 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This incantation worked for me:

#+name:= foo
#+begin_src emacs-lisp :exports both :results drawer
=C2=A0 &quo= t;Pseudo-function returning a LaTeX pseudo-result."
=C2=A0 "\\= [\\displaystyle{\\sin\\left(\\frac{a}{b}\\right)}\\]"
#+end_src
=
#+RESULTS: foo
:results:
\[\displaystyle{\sin\left(\frac{a}{b}\ri= ght)}\]
:end:

the key is the drawer I think.
John

-= ----------------------------------
Professor John Kitchin (he/him/his)Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mell= on University
Pittsburgh, PA 15213
412-268-7803
=


On Sun, Jul 4, 2021 at 2:51 PM Emmanuel Charpentier <emm.charpentier@free.fr> wro= te:
I = tried this :

#+property: header-args:sage :session=
#+options: tex:t toc:nil author:nil
#+begin_src emacs-=
lisp :exports none
  ;; (customize-set-variable
  ;;  &=
#39;org-latex-to-mathml-convert-command
  ;;  "latexmlmath \=
"%i\" --presentationmathml=3D%o")
  (custom-set-va=
riables
   '(org-latex-to-mathml-convert-command
  =
    "java -jar %j -unicode -force -df %o %I")
   '(=
org-latex-to-mathml-jar-file
      "/usr/local/bin/mathtoweb=
.jar"))
#+end_src

A "normal&qu=
ot; function call with org result...

#+name: foo
#+begin_src emacs-lisp :exports both :results org
  &quo=
t;Pseudo-function returning a LaTeX pseudo-result."
  "=
\\[\\displaystyle{\\sin\\left(\\frac{a}{b}\\right)}\\]"
#+en=
d_src

#+RESULTS: foo
#+begin_src org
\[\displaystyle{\sin\left(\frac{a}{b}\right)}\]
#+end_src<=
/pre>

Which exports the LaTeX *source* (uncompiled) in P= DF, HTML and ODT.

I'm currently lookin into a = =3D:post=3D workaround. But an option to export =3Dlatex=3D blocks to selec= ted exporters (ODT, HTML, possibly Morkdown via pandoc).

I'll keep you posted.

Le dimanche 04 ju= illet 2021 =C3=A0 14:10 -0400, John Kitchin a =C3=A9crit=C2=A0:
<= div dir=3D"auto">Can you declare the output as org so they will just be lat= ex snippets?

On Sun, Jul 4, 2021 at 3:46 AM Emmanuel Charpentier <emm.charpentier@= free.fr> wrote:
<= div style=3D"overflow-wrap: break-word;">
Dear list,

Org-mode offers the ability to create functions returning LaTeX resu= lts : such occurrences are frequent with Sagemath, Maxima, Mathematica, R, = and even emacs's Calc...

Such functions can be= declared has having LaTeX output, and the resulting =C2=A0=3D#+begin_expor= t latex ... =C2=A0#+end_export latex=3D block is exported as LaTeX and end = up in the PDF versin.

But such blocks seem to expo= rt *only*=C2=A0to LaTeX/PDF ; more specically, they do not export to= HTML nor ODT. In order to insert those results at export, one *has*= to print them *raw*. See the attached examples, and compare PDF, HT= ML and ODT outputs of the enclosed zip archive (necessary to avoid the wrat= h of the spam filter of my provider ;-)...)..

Unle= ss I am mistaken, this is the *only* way to export LaTeX exports to HTML/OD= T ; I am not aware of any option allowing to force such exports. So a coupl= e questions :
  • Am I mistaken ?
  • Are there more steamline= d ways to get LaTeX in HTML/ODF/whatever-but-not-LaTeX ?
  • Wouldn'= ;t an option to allow these exports be a welcome addition to the export str= ucture (or possibly to the various exporters) ?

Thanks in advance,
=

--000000000000b5a44a05c650da94--