From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gHueH7Bg9GBCXwEAgWs5BA (envelope-from ) for ; Sun, 18 Jul 2021 19:11:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id WDNUG7Bg9GAgVQAAB5/wlQ (envelope-from ) for ; Sun, 18 Jul 2021 17:11:12 +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 E92806C62 for ; Sun, 18 Jul 2021 19:11:11 +0200 (CEST) Received: from localhost ([::1]:32962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5AJp-0007de-TR for larch@yhetil.org; Sun, 18 Jul 2021 13:11:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5AJH-0007cb-Pf for emacs-orgmode@gnu.org; Sun, 18 Jul 2021 13:10:36 -0400 Received: from smtp5-g21.free.fr ([2a01:e0c:1:1599::14]:15042) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5AJF-0007jP-NC for emacs-orgmode@gnu.org; Sun, 18 Jul 2021 13:10:35 -0400 Received: from [192.168.1.60] (unknown [88.162.223.185]) (Authenticated sender: emm.charpentier@free.fr) by smtp5-g21.free.fr (Postfix) with ESMTPA id A62975FFA0; Sun, 18 Jul 2021 19:10:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1626628231; bh=lZ91swUplnVVCHh6Ljn0vB3bP+EfUopWSO26QSalltI=; h=Subject:From:To:Date:In-Reply-To:References:From; b=qIUTyKTWlNkywbSUCNAGNn6QMzP+6xffB2BD6fEE5BWRELXiAhK+Obpnt6CA8AH4x PN2x9wIaLVnpel3zWYsDE1xM0DJyrJgc3oURZtZeFqi3WlyoU59WaMqek+WlyIZ81Y +jNX2SsSqIHRwwG472gmpPgV4eloHmcyio6nuq9sqa65HmYxnGYnBA0II/vBS2ivCK BNvlA+WLQVzJGmAcmUShl9/ZfEg8QeejQ0oQISCGZDq3WLDhgRyFVM3bWO+Gs38SaR S9M6sDG+fZMHHyw6bB0a63eWaTnAZeMDUz9Y545aqXAJKwsK1VKT2FmAFy7XFn3jgm pQN1190pskrPQ== Message-ID: Subject: Re: Suggestion : Option enabling LaTeX blocks to non-latex exporters. From: Emmanuel Charpentier To: Timothy , emacs-orgmode Date: Sun, 18 Jul 2021 19:10:27 +0200 In-Reply-To: <878s23y9ze.fsf@gmail.com> References: <27a07324dffd035a3c5978dbe81e82ff7fbc0c8b.camel@free.fr> <878s23y9ze.fsf@gmail.com> Organization: =?ISO-8859-1?Q?Organis=E9?= ? Moi ??? Content-Type: multipart/alternative; boundary="=-D8uY+/Yi0Qi2BUhcipUv" 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: , 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=1626628272; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=Z3lrCEFC7FwQUPdFikFDcXe4zpIN09wpzvfGdwdkSRk=; b=h66na9PT6PoZqdQPebhQWqgoCpA8LM+qKy9PNNxD8oMtP8hkpQcUwyhjQnDdWjH2ZQGWPf UhjqWF7hjLm+tpGfLgwfVps2nyva14KDcdUSi8jRBeJvuPijE7op6X6+dEEw3XHNC34rM8 I5Rj/8YbCueJ/xQ1Q+wQm64YFqSjsw/SLYJZY/25C1ghCkzBMYCNmNKrPzoI2/bQmXYQkV YAEGSjm/UKS40tXWigfL8mWDFeg/O+k7FcbB0l/XHPrBoW82ScgDeWsdDaprAG+zsRETb5 l6CBSv1muMKhZ1bHiOSsuwq4jAg3EyA+uUIID93tsJTowXBW85dz/448oqw0Ew== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626628272; a=rsa-sha256; cv=none; b=SYABZOaTc+/vgrxVH8pa/OfXvVaNWwU0c6ZcyLpgBFY0t4XXNZUTRHRBPMPeJFcMV79vlX Xw0TS6GABM4hqzPchJTgt1axrFpxX7aujJqSFoFsmudTx2IgBTreVtSSF3GdsPjDKL66AB WurANPr+H7KL/tgKRd/UY6oDA7NYkqmCqEiqziQ7isFB3jSM6PUErd0n8oiTSBBZaSATY+ EG5b42LuOl5GI9fXjhbTw7gZCZNMYIUUv/GbMUZ3ZOre8+VDALVgSySKb6wqrqNPnvmrbq TbcLe3m51g0ddUPP247zMIJviyVri7cllEGrpxflBSL1W5w8YZ2N7Y5vzG1Uug== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=free.fr header.s=smtp-20201208 header.b=qIUTyKTW; 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-Spam-Score: -3.11 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=free.fr header.s=smtp-20201208 header.b=qIUTyKTW; 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: E92806C62 X-Spam-Score: -3.11 X-Migadu-Scanner: scn0.migadu.com X-TUID: ZSD2nQ45yNuJ --=-D8uY+/Yi0Qi2BUhcipUv Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Well... this : #+begin_src sage :exports both :results output raw a, b = var("a, b"); print("\\begin{equation*}\n%s\n\\end{equation*}"%latex(sin(a+b)==sin(a+b).trig_expand())) # print("\\(%s\n\\)"%latex(sin(a+b)==sin(a+b).trig_expand())) #+end_src #+RESULTS: \begin{equation*} \sin\left(a + b\right) = \cos\left(b\right) \sin\left(a\right) + \cos\left(a\right) \sin\left(b\right) \end{equation*} will get you the expected result, in ODT as in PDF. But this might be happenstance : the slightly simpler #+begin_src sage :exports both :results output raw a, b = var("a, b"); # print("\\begin{equation*}\n%s\n\\end{equation*}"%latex(sin(a+b)==sin(a+b).trig_expand())) print("\\(%s\n\\)"%latex(sin(a+b)==sin(a+b).trig_expand())) #+end_src #+RESULTS: \(\sin\left(a + b\right) = \cos\left(b\right) \sin\left(a\right) + \cos\left(a\right) \sin\left(b\right) \) will print the expected results *twice* (in ODT and in PDF). The more straightforward)  #+begin_src sage :exports both :results value latex var("a, b") latex(cos(a+b)==cos(a+b).trig_expand()) #+end_src #+RESULTS: #+begin_export latex \cos\left(a + b\right) = \cos\left(a\right) \cos\left(b\right) - \sin\left(a\right) \sin\left(b\right) #+end_export gives the expected result in PDF (i. e. results *once*,whether the code has #+results: or not), but not in ODT. The "Kitchin's workaround" : #+begin_src sage :exports both :results drawer print("\\(\\displaystyle{%s}\\)"%latex(tan(a+b)==tan(a+b).trig_expand())) #+end_src #+RESULTS: :results: \(\displaystyle{\tan\left(a + b\right) = -\frac{\tan\left(a\right) + \tan\left(b\right)}{\tan\left(a\right) \tan\left(b\right) - 1}}\) :end: works as (un)expected, but is still less straightforward. I'd rather have a documented, understood way to export LaTeX snippets/ blocks marked as such explicitly exported to ODT... Hope this is clearer, -- Emmanuel Charpentier   Le dimanche 18 juillet 2021 à 22:25 +0800, Timothy a écrit : > > Hi Emmanuel, > > It may interest you to hear that I submitted a patch a month or two > ago > (which was merged) to support LaTeX environments as results. > > That means that this is now possible: > > > #+begin_src something > ...stuff... > #+end_src > > #+results: > \begin{equation*} >   some latex which will be exported nicely > \end{equation*} > > > All the best, > > Timothy --=-D8uY+/Yi0Qi2BUhcipUv Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Well... this :


<= /div>
#+begin_src sage :exports both :results output raw
  a,=
 b =3D var("a, b");
  print("\\begin{equation*}\n%s\n\\end{equati=
on*}"%latex(sin(a+b)=3D=3Dsin(a+b).trig_expand()))
  # print("\\(=
%s\n\\)"%latex(sin(a+b)=3D=3Dsin(a+b).trig_expand()))
#+end_src

#+RESULTS:
\begin{equation*}
\s=
in\left(a + b\right) =3D \cos\left(b\right) \sin\left(a\right) + \cos\left(=
a\right) \sin\left(b\right)
\end{equation*}

<= div>will get you the expected result, in ODT as in PDF. But this might be h= appenstance : the slightly simpler

#+begin_src sag=
e :exports both :results output raw
  a, b =3D var("a, b");
=
 #  print("\\begin{equation*}\n%s\n\\end{equation*}"%latex(sin(a+b)=3D=
=3Dsin(a+b).trig_expand()))
  print("\\(%s\n\\)"%latex(sin(a+b)=
=3D=3Dsin(a+b).trig_expand()))
#+end_src

#+RESULTS:
\(\sin\left(a + b\right) =3D \cos\left(b\right) \sin\=
left(a\right) + \cos\left(a\right) \sin\left(b\right)
\)

will print the expected results *twice* (in ODT and= in PDF).

The more straightforward) 

#+begin_src sage :exports both :results value latex
<= pre> var("a, b")
  latex(cos(a+b)=3D=3Dcos(a+b).trig_expand())
#+end_src

#+RESULTS:
#+begin_ex=
port latex
\cos\left(a + b\right) =3D \cos\left(a\right) \cos\lef=
t(b\right) - \sin\left(a\right) \sin\left(b\right)
#+end_export

gives the expected result in PDF (i. e. results *on= ce*,whether the code has #+results: or not), but not in ODT.

The "Kitchin's workaround" :

#+begin_src sage :exports both :results d=
rawer
  print("\\(\\displaystyle{%s}\\)"%latex(tan(a+b)=3D=3Dtan(=
a+b).trig_expand()))
#+end_src

#+RESULTS=
:
:results:
\(\displaystyle{\tan\left(a + b\right) =3D =
-\frac{\tan\left(a\right) + \tan\left(b\right)}{\tan\left(a\right) \tan\lef=
t(b\right) - 1}}\)
:end:

works as (un)ex= pected, but is still less straightforward. I'd rather have a documented, un= derstood way to export LaTeX snippets/ blocks marked as such explicitly exp= orted to ODT...

Hope this is clearer,
--
Emmanuel Charpentier

&nb= sp;
Le dimanche 18 juillet 2021 =C3=A0 22:25 +0800, Timothy a =C3= =A9crit :

Hi Emman= uel,

It may interest you to hear that I submitted = a patch a month or two ago
(which was merged) to support LaTeX en= vironments as results.

That means that this is now= possible:


#+begin_src something
...stuff...
#+end_src

#+results:=
\begin{equation*}
  some latex which will be expo= rted nicely
\end{equation*}


All the best,

Timothy
--=-D8uY+/Yi0Qi2BUhcipUv--