From mboxrd@z Thu Jan 1 00:00:00 1970
Return-Path:
Received: from mp1 ([2001:41d0:8:6d80::])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
by ms0.migadu.com with LMTPS
id qwZcOggk4mDURwAAgWs5BA
(envelope-from )
for ; Sun, 04 Jul 2021 23:11:36 +0200
Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
by mp1 with LMTPS
id iKdKNQgk4mABEQAAbx9fmQ
(envelope-from )
for ; Sun, 04 Jul 2021 21:11:36 +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 E958D2C75B
for ; Sun, 4 Jul 2021 23:11:35 +0200 (CEST)
Received: from localhost ([::1]:40878 helo=lists1p.gnu.org)
by lists.gnu.org with esmtp (Exim 4.90_1)
(envelope-from )
id 1m09Oo-0005Oc-FT
for larch@yhetil.org; Sun, 04 Jul 2021 17:11:34 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:51664)
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1m09OQ-0005OU-Gn
for emacs-orgmode@gnu.org; Sun, 04 Jul 2021 17:11:10 -0400
Received: from smtp5-g21.free.fr ([2a01:e0c:1:1599::14]:21400)
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1m09ON-0002sG-RD
for emacs-orgmode@gnu.org; Sun, 04 Jul 2021 17:11:10 -0400
Received: from [192.168.1.33] (unknown [88.162.223.185])
(Authenticated sender: emm.charpentier@free.fr)
by smtp5-g21.free.fr (Postfix) with ESMTPA id F273F5FF67;
Sun, 4 Jul 2021 23:11:01 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr;
s=smtp-20201208; t=1625433065;
bh=KBkEz7wmDNnI8/2bt/IVUzpLEeR+Wysnw8PXT7iB/i4=;
h=Subject:From:To:Cc:Date:In-Reply-To:References:From;
b=KdCz/YhLdAGJXT1BC58b/mYP3EWDZjWK0XS/Er2BnMahrSdNWZzYloEykPQ7P0GCh
wn6E2u+vLwcS8AeSK0iWeoOwwjVpa026rd6gXCMCypOyTTrVGBI44cCTKiv23Kgmij
GQAKRVtid1f63t8veQJSzlvpfmgeFW7i5WnDrDcLxlfZE9ILL6aZLd9H4kEQRz7/DK
KbUa6J/jRb/xgYpURlHic+0sGj35MNN2ho/hEQpJzl7eHYUYpAGLLTywhKAAhbC1VK
tuaE+ajlJriwXqK4OxoxWVKblf8Kg/V4apGZSVqkV0Rit9pQWU9oISD08P2db8irT6
8bzWKYAPInliA==
Message-ID:
Subject: Re: LaTeX-producing code : how to export results to HTML/ODT ?
From: Emmanuel Charpentier
To: John Kitchin
Date: Sun, 04 Jul 2021 23:11:01 +0200
In-Reply-To:
References:
Organization: =?ISO-8859-1?Q?Organis=E9?= ? Moi ???
Content-Type: multipart/alternative; boundary="=-ITk6RilfeZVYryl9XZmO"
User-Agent: Evolution 3.38.3-1
MIME-Version: 1.0
Received-SPF: pass client-ip=2a01:e0c:1:1599::14;
envelope-from=emm.charpentier@free.fr; helo=smtp5-g21.free.fr
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001 autolearn=ham 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=1625433096;
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=A+8BR/mcs09gwnnNABPYXBrroHnRJk21jwz1Cgr+lhs=;
b=hGhGlj3y5sIau4Krm9ClbFgr76ouPoh11MLJKaIsvD1IcPuG7kd8JiTW40cwvYlusO2zOe
SOG2BdiwIQHv54UyCESCzhRTgk4Yqjm7mFo+kPL970TFT1ByB/SCGyKtZi3Vn2YxlROCRy
2J4JiM+EqG/Zcs8UyZevXouwpwbqUdMrk2sjAhkGEcnarjQBH7jSO6JZu7v+PiTbXwgiJB
ZFJHxgC8s7AvJRZpQMV6OOCEkWlm4rntB8uHfY/Eci5V0s4NZhrqsT/5ap0Oq2h5k6+jwL
MSJ6moxrFDxc1KTwD+bEMYMWj3qNAZKVQ8rI1M0T6QMjxpR3SMwAGbs+RvSZYA==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625433096; a=rsa-sha256; cv=none;
b=clQWwIHIx79kn8l78cI6KNX8fOSMGK1bU9U8ax9BhWJIXnyD1Ktkt/wdpG5WNWynV2GbIn
QXEg0xlkoqg9tcDFPlEVBzlBZZBWCLGxbEOQvPlF0SfntZJ5j2tP3gr2mnxKmh+bCVJsuX
S416A5imC7dwgBSdEHhE76YWStF4OrdmTnHJSeSDsKmkwWF0D2LeEn5eqzu+UA7Y1I0sMJ
0O3i89OG6LMWAtlnBvfeHOktFg/hLMJDkaEZU8rskFgAlLerxH8W4Pud/OXQcBqyLFFd6R
ILpAUX41rgkHAlAe82ERxhdoVpgXHdfznK2kM3X87t6SCrnuP4UolPFw9k9WTQ==
ARC-Authentication-Results: i=1;
aspmx1.migadu.com;
dkim=pass header.d=free.fr header.s=smtp-20201208 header.b="KdCz/YhL";
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.61
Authentication-Results: aspmx1.migadu.com;
dkim=pass header.d=free.fr header.s=smtp-20201208 header.b="KdCz/YhL";
dmarc=pass (policy=none) header.from=free.fr;
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: E958D2C75B
X-Spam-Score: -0.61
X-Migadu-Scanner: scn0.migadu.com
X-TUID: jYzXbE6zW++A
--=-ITk6RilfeZVYryl9XZmO
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
The following does what I want : export ln a LaTeX block to latex and
beamer, export as a raw LaTeX snippet in HTML and ODT, no export
otherwise :
#+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=%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
#+RESULTS:
Current exporter src_emacs-lisp[:results raw]{org-export-current-backend}.
A printing auxilliary :
#+name: printme
#+begin_src emacs-lisp :exports both :var data=()
(if data
(cond ((memq org-export-current-backend '(latex beamer))
(format "#+begin_export latex\n%s\n#+end_export" data))
((memq org-export-current-backend '(odt html))
data)
(t data))
"")
#+end_src
A "normal" function call with filtered result...
#+name: foo
#+begin_src emacs-lisp :exports both :results value raw :post printme(data=*this*)
"Pseudo-function returning a LaTeX pseudo-result."
"\\[\\displaystyle{\\sin\\left(\\frac{a}{b}\\right)}\\]"
#+end_src
Real-life test :
#+name: gee
#+begin_src sage :exports both :results raw :post printme(data=*this*)
a, b = var("a, b")
R = str(LatexExpr("\\[\\displaystyle{%s}\\]"%latex(tan(a+b) == tan(a+b).trig_expand())))
R += "\n\n"
R += str(LatexExpr("\\[\\displaystyle{%s}\\]"%latex(tan(a-b) == tan(a-b).trig_expand())))
LatexExpr(R)
#+end_src
But this still has snags : you must not have evaluated results in the
buffer. Which is problematic if you want to use caching... Exporting
LaTeX blocks to ODT/HTML would be a better solution...
Ideas ?
Le dimanche 04 juillet 2021 à 14:10 -0400, John Kitchin a écrit :
> 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
> 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 =#+begin_export latex ... #+end_export latex= 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. So 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,
--=-ITk6RilfeZVYryl9XZmO
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
The following does what I want : export ln a =
LaTeX block to latex and beamer, export as a raw LaTeX snippet in HTML and =
ODT, no export otherwise :
#+property: header-args=
:sage :session
#+options: tex:t toc:nil author:nil
#+be=
gin_src emacs-lisp :exports none
;; (customize-set-variable ;; 'org-latex-to-mathml-convert-command
;; "latexmlm=
ath \"%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
=
#+RESULTS:
Current exporter sr=
c_emacs-lisp[:results raw]{org-export-current-backend}.
A printing auxilliary :
#+name: printme
#+begin_src emacs-lisp :exports both :var data=3D()
(if d=
ata
(cond ((memq org-export-current-backend '(latex beamer)=
)
(format "#+begin_export latex\n%s\n#+end_export" data))=
pre> ((memq org-export-current-backend '(odt html))
=
data)
(t data))
"")
#+end_src
A "normal" function call with filtered result...
=
#+name: foo
#+begin_src emacs-lisp :exports b=
oth :results value raw :post printme(data=3D*this*)
"Pseudo-fun=
ction returning a LaTeX pseudo-result."
"\\[\\displaystyle{\\si=
n\\left(\\frac{a}{b}\\right)}\\]"
#+end_src
<=
pre>Real-life test :
#+name: gee
#+begin=
_src sage :exports both :results raw :post printme(data=3D*this*)
a, b =3D var("a, b")
R =3D str(LatexExpr("\\[\\displaystyle{=
%s}\\]"%latex(tan(a+b) =3D=3D tan(a+b).trig_expand())))
R +=3D =
"\n\n"
R +=3D str(LatexExpr("\\[\\displaystyle{%s}\\]"%latex(ta=
n(a-b) =3D=3D tan(a-b).trig_expand())))
LatexExpr(R)
=
#+end_src
But this still has snags : you must not =
have evaluated results in the buffer. Which is problematic if you want to u=
se caching... Exporting LaTeX blocks to ODT/HTML would be a better solution=
...
Ideas ?
Le dimanche 0=
4 juillet 2021 =C3=A0 14:10 -0400, John Kitchin a =C3=A9crit :
Can you declare the output as or=
g so they will just be latex snippets?
Dear list,
Org-mode offers the ability to create functions retu=
rning LaTeX results : such occurrences are frequent with Sagemath, Maxima, =
Mathematica, R, and even emacs's Calc...
Such func=
tions can be declared has having LaTeX output, and the resulting =3D#=
+begin_export latex ... #+end_export latex=3D block is exported as La=
TeX and end up in the PDF versin.
But such blocks =
seem to export *only* to LaTeX/PDF ; more specically, they do n=
ot export to HTML nor ODT. In order to insert those results at export, one =
*has* to print them *raw*. See the attached examples, and com=
pare PDF, HTML and ODT outputs of the enclosed zip archive (necessary to av=
oid the wrath of the spam filter of my provider ;-)...)..
Unless I am mistaken, this is the *only* way to export LaTeX export=
s to HTML/ODT ; I am not aware of any option allowing to force such exports=
. So a couple questions :
- Am I mistaken ?
- Are there mo=
re 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 ex=
port structure (or possibly to the various exporters) ?
<=
/div>
Thanks in advance,
=
html>
--=-ITk6RilfeZVYryl9XZmO--