From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id OEhZDYtehWLrwAAAbAwnHQ (envelope-from ) for ; Wed, 18 May 2022 23:00:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id MN5iDItehWIrrwAAG6o9tA (envelope-from ) for ; Wed, 18 May 2022 23:00:59 +0200 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 4B9091FA16 for ; Wed, 18 May 2022 23:00:58 +0200 (CEST) Received: from localhost ([::1]:41806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nrQmu-0005iv-Qe for larch@yhetil.org; Wed, 18 May 2022 17:00:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrQmP-0005iW-Fa for emacs-orgmode@gnu.org; Wed, 18 May 2022 17:00:26 -0400 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:34719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nrQmM-0004JT-N4 for emacs-orgmode@gnu.org; Wed, 18 May 2022 17:00:24 -0400 Received: by mail-ed1-x52a.google.com with SMTP id en5so4580916edb.1 for ; Wed, 18 May 2022 14:00:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andrew.cmu.edu; s=google-2021; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IBKjisXV5yh0akOcnUxnBUKFWLf2q9m5Rzn10sJtglw=; b=Ykt/Mf64w1Wvvl7PmP6Gm8Cz+fR+wU8HwC0engRofm6NVLcSHBdSkG01cdhMTqVa95 mo0bjWSA1FAghn2qBCXGaXVx8dViPC68B3bSElanIFqHMRCLabIanZsO6qgS3q6Zz9rd uR3ghYseY1rMtJoqSOR76c1uP3veOUtVY7qmnRgicc6siwXwaYC1DDjdf+JRE9HGKkf4 ZmLYGEPwrDoDGM9ZPgJur0UpIS9PKCzGiAmGm/z4PZriD7JzafUp2oWB1oRNuT2Lxc8T 94y7cSHkipNQk82mgo6MmghJ3frtV7rCDCEgcnlwj+FVQc91fDnHrFFhB7pAbwJf04ub wG6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IBKjisXV5yh0akOcnUxnBUKFWLf2q9m5Rzn10sJtglw=; b=vRafcCTHpWxSOztkySlKzF54MmQ7Fxesp1I+I7h7sPD+GXASwNdAdh//dH2LrvMcxz IZEF6N3QfvQu41qNNjdjMVaWmD5gDqJbWvgVWhPQvGIavgdg6r0480PiZgFvtMmqI5GA Pm0hftuOnGeBV/H5vE5wTKb/SrsZbSrYG4vh5DiioqQF8UcZ7Gk19oONjCPYg/pdCLSc U0cPVbQHAsFA8sdMU1QkE47Ws5z+1TVQO168AyPuUUR3i/RXTpTO2OyT5mbL+CEEvG73 iVPQ2I1u1BAyFFRnq/p8b7RSJpi2PYZ4TQlKhHvdnvGfEWxcOUbhQAQ+BuQXY3Mj7GNI AZfw== X-Gm-Message-State: AOAM530arXWsY3Wc/yFjuUnioU8/2UCGB8bSBSz8uSPb83tPYdjqx2xr qQ5IVSGIl7+ijTLJH37q8+0oW038yo60IrhLvsE= X-Google-Smtp-Source: ABdhPJyp1kj8MoX3WdL5jrMpFrP9mLMBLNvGoZ5H02xjQW1zcGesL+nE8fIzJWLD21Wyeh1O0N93aTjmTzjrzkOWaSY= X-Received: by 2002:a50:a68e:0:b0:42a:c9ae:469 with SMTP id e14-20020a50a68e000000b0042ac9ae0469mr1787341edc.202.1652907620705; Wed, 18 May 2022 14:00:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: John Kitchin Date: Wed, 18 May 2022 17:00:09 -0400 Message-ID: Subject: Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version To: Richard Stanton Cc: orgmode Content-Type: multipart/alternative; boundary="000000000000942e9705df4f8b53" Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=johnrkitchin@gmail.com; helo=mail-ed1-x52a.google.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URI_DOTEDU=1.246 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 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 X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1652907659; 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=IBKjisXV5yh0akOcnUxnBUKFWLf2q9m5Rzn10sJtglw=; b=XpZYgPCZchhGlGmL5n9EM/597n+fu820L2pOReR4DoXHLtqhD6GoZarmJbILYHMBDd6hWD 8XoZBPuWSm0+tM8G0BGo3JIOfRu7SNbe4HDtd6wqz7ogvw9xA3O46fZ6/1DF8X43RH5SDq 7dhqdz2/tDckn7Av8CIL0O+ak1h77sQduY5rP3H15FE3xja/dUhuzzDinQV8nRZ/NXT6e1 IwnJ7KGMmqwEq0gZDNJ9SXvI2i9/YX1Zq8nYnS6IgkVVsAYC2f5D0hQN5rSs4o51Gsglr6 PpF7PQvr2MNfKBJBzfK3lnqe6pqqv0kf9rhRUrMP54Tg4p9jn7B9z9Cdzyc/dA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652907659; a=rsa-sha256; cv=none; b=a6su6ExtNNMep35Ohl+jPDCsHPwqDPtveNpcMJk2p1NR5K5VmX3ZNKz/01kzxQQLqQT+eH 2vAKevZRR157Rs574fAoCTMKoY6JYc5bPWbaidAB3NpPW8/WVnHC6hc2XEH6VLau1Y7884 Hgn53WZHBe8oP1/PztpBLPpF1kyERbMKAcdnX+fqrrDUdwl3rQ/QfORpmo19TYjxJ16shM A9SxWruys5FLuNEeZ1G4LOqo8kAkpzHW0DKcBezplsh/GkgmAKoD6iXxhxMC3+bglVYire WtIk5BRYi2q/yOhzg+0iMxn/kcyVkGlfvwTzzlzk4ql+45oROJskqqxcJPBbxw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=andrew.cmu.edu header.s=google-2021 header.b="Ykt/Mf64"; dmarc=pass (policy=none) header.from=andrew.cmu.edu; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -8.04 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=andrew.cmu.edu header.s=google-2021 header.b="Ykt/Mf64"; dmarc=pass (policy=none) header.from=andrew.cmu.edu; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 4B9091FA16 X-Spam-Score: -8.04 X-Migadu-Scanner: scn0.migadu.com X-TUID: RieG9ZYtDdJw --000000000000942e9705df4f8b53 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I would guess it could. I don't do anything asynchronous, and I am not sure when org-babel-after-execute-hook runs, if it is immediately there is no table to clean up I suppose. It is not necessary to run on a subtree, but on a very large document you probably don't want to do org-element-parse often. 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 Wed, May 18, 2022 at 4:57 PM Richard Stanton wrote: > Thanks for the suggestion, John. I=E2=80=99ve tried playing around with t= his, and > am I right that it seems to have trouble when execution is asynchronous? > > On May 18, 2022, at 1:16 PM, John Kitchin wrote= : > > I use a function in an after execute hook for this: > https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205 > > This works on a subtree, which has been fine for me. You could adapt it t= o > only work in the results section. > > 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 Wed, May 18, 2022 at 4:07 PM Richard Stanton > wrote: > >> I=E2=80=99m running Emacs 28.1 under macOS 12.4 and want to create table= s from >> Python code blocks that can be exported to either LaTeX or HTML. The >> simplest way to do this seems to be to generate the output as an org tab= le, >> and using the built-in version of org (9.4.6 >> (9.4.6-798-g738759.dirty-elpaplus @ >> /Users/stanton/.emacs.d/elpa/org-plus-contrib-20210929/)), this works fi= ne >> using either a python or emacs-jupyter code block: >> >> #+begin_src jupyter-python >> [ >> ["Wide a", "b", "c"], >> None, >> [1, 2, 3], >> [4, 5, 6], >> None, >> [7, 8, 9] >> ] >> #+end_src >> >> #+RESULTS: >> | Wide a | b | c | >> |--------+---+---| >> | 1 | 2 | 3 | >> | 4 | 5 | 6 | >> |--------+---+---| >> | 7 | 8 | 9 | >> >> #+begin_src python >> return [ >> ["Wide a", "b", "c"], >> None, >> [1, 2, 3], >> [4, 5, 6], >> None, >> [7, 8, 9] >> ] >> #+end_src >> >> #+RESULTS: >> | Wide a | b | c | >> |--------+---+---| >> | 1 | 2 | 3 | >> | 4 | 5 | 6 | >> |--------+---+---| >> | 7 | 8 | 9 | >> >> >> To use the latest version of org, I change just two lines in my init.el >> from >> >> (straight-use-package '(org :type built-in)) >> (straight-use-package '(org-contrib :type built-in)) >> >> to >> >> (straight-use-package '(org :type git :repo " >> https://code.orgmode.org/bzg/org-mode.git")) >> (straight-use-package '(org-contrib :type git :repo " >> https://git.sr.ht/~bzg/org-contrib=E2=80=9D)) >> >> Having done this, the python block still works fine, but the horizontal >> lines in the jupyter-python block are no longer properly aligned with th= e >> text: >> >> #+begin_src jupyter-python >> [ >> ["Wide a", "b", "c"], >> None, >> [1, 2, 3], >> [4, 5, 6], >> None, >> [7, 8, 9] >> ] >> #+end_src >> >> #+RESULTS: >> | Wide a | b | c | >> |---+---+---| >> | 1 | 2 | 3 | >> | 4 | 5 | 6 | >> |---+---+---| >> | 7 | 8 | 9 | >> >> #+begin_src python >> return [ >> ["Wide a", "b", "c"], >> None, >> [1, 2, 3], >> [4, 5, 6], >> None, >> [7, 8, 9] >> ] >> #+end_src >> >> #+RESULTS: >> | Wide a | b | c | >> |--------+---+---| >> | 1 | 2 | 3 | >> | 4 | 5 | 6 | >> |--------+---+---| >> | 7 | 8 | 9 | >> >> By the way, the org version loaded this time is 9.5.3 (9.5.3-g277897 @ >> /Users/stanton/.emacs.d/straight/build/org/). >> >> The table exports OK, but isn=E2=80=99t much fun to look at in the org f= ile >> itself. >> >> Since I like to use emacs-jupyter, any suggestions would be appreciated. >> I know this worked fine just a few weeks ago. >> >> Thanks! >> >> Richard Stanton >> >> >> >> >> >> > --000000000000942e9705df4f8b53 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I would guess it could. I don't do anything asynchrono= us, and I am not sure when org-babel-after-execute-hook runs, if it is imme= diately there is no table to clean up I suppose. It is not necessary to run= on=C2=A0 a subtree, but on a very large document you probably don't wa= nt to do org-element-parse often.


John

------------------= -----------------
Professor John Kitchin (he/him/his)
Doherty Hall A2= 07F
Department of Chemical Engineering
Carnegie Mellon University
= Pittsburgh, PA 15213
412-268-7803

<= /div>

On Wed, May 18, 2022 at 4:57 PM Richard Stanton <rhstanton@berkeley.edu> wrote:
Thanks for the suggestion, John. I=E2=80=99ve tried playing ar= ound with this, and am I right that it seems to have trouble when execution= is asynchronous?

On May 18, 202= 2, at 1:16 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:

I use a function in an after execute hook for this:=C2=A0https://github.com/jkitchin/scimax/blob/master/scimax-org.e= l#L205

This works=C2=A0on a subtree, which has been = fine for me. You could adapt it to only work in the results section.
<= div>
John

-----------------------------------
Professor John Kitc= hin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineerin= g
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803


On Wed, May 18, 2022 at 4:07 PM Richard = Stanton <rhs= tanton@berkeley.edu> wrote:
I=E2=80=99m running Emacs 28.1 under macOS 12.4 and want= to create tables from Python code blocks that can be exported to either La= TeX or HTML. The simplest way to do this seems to be to generate the output= as an org table, and using the built-in version of org (9.4.6 (9.4.6-798-g= 738759.dirty-elpaplus @ /Users/stanton/.emacs.d/elpa/org-plus-contrib-20210= 929/)), this works fine using either a python or emacs-jupyter code block:<= br>
#+begin_src jupyter-python
[
=C2=A0 =C2=A0 ["Wide a", "b", "c"],
=C2=A0 =C2=A0 None,
=C2=A0 =C2=A0 [1, 2, 3],
=C2=A0 =C2=A0 [4, 5, 6],
=C2=A0 =C2=A0 None,
=C2=A0 =C2=A0 [7, 8, 9]
]
#+end_src

#+RESULTS:
| Wide a | b | c |
|--------+---+---|
|=C2=A0 =C2=A0 =C2=A0 1 | 2 | 3 |
|=C2=A0 =C2=A0 =C2=A0 4 | 5 | 6 |
|--------+---+---|
|=C2=A0 =C2=A0 =C2=A0 7 | 8 | 9 |

#+begin_src python
return [
=C2=A0 =C2=A0 ["Wide a", "b", "c"],
=C2=A0 =C2=A0 None,
=C2=A0 =C2=A0 [1, 2, 3],
=C2=A0 =C2=A0 [4, 5, 6],
=C2=A0 =C2=A0 None,
=C2=A0 =C2=A0 [7, 8, 9]
]
#+end_src

#+RESULTS:
| Wide a | b | c |
|--------+---+---|
|=C2=A0 =C2=A0 =C2=A0 1 | 2 | 3 |
|=C2=A0 =C2=A0 =C2=A0 4 | 5 | 6 |
|--------+---+---|
|=C2=A0 =C2=A0 =C2=A0 7 | 8 | 9 |


To use the latest version of org, I change just two lines in my init.el fro= m

(straight-use-package '(org :type built-in))
(straight-use-package '(org-contrib :type built-in))

to

(straight-use-package '(org :type git :repo "https= ://code.orgmode.org/bzg/org-mode.git"))
(straight-use-package '(org-contrib :type git :repo "http= s://git.sr.ht/~bzg/org-contrib=E2=80=9D))

Having done this, the python block still works fine, but the horizontal lin= es in the jupyter-python block are no longer properly aligned with the text= :

#+begin_src jupyter-python
[
=C2=A0 =C2=A0 ["Wide a", "b", "c"],
=C2=A0 =C2=A0 None,
=C2=A0 =C2=A0 [1, 2, 3],
=C2=A0 =C2=A0 [4, 5, 6],
=C2=A0 =C2=A0 None,
=C2=A0 =C2=A0 [7, 8, 9]
]
#+end_src

#+RESULTS:
| Wide a | b | c |
|---+---+---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
|---+---+---|
| 7 | 8 | 9 |

#+begin_src python
return [
=C2=A0 =C2=A0 ["Wide a", "b", "c"],
=C2=A0 =C2=A0 None,
=C2=A0 =C2=A0 [1, 2, 3],
=C2=A0 =C2=A0 [4, 5, 6],
=C2=A0 =C2=A0 None,
=C2=A0 =C2=A0 [7, 8, 9]
]
#+end_src

#+RESULTS:
| Wide a | b | c |
|--------+---+---|
|=C2=A0 =C2=A0 =C2=A0 1 | 2 | 3 |
|=C2=A0 =C2=A0 =C2=A0 4 | 5 | 6 |
|--------+---+---|
|=C2=A0 =C2=A0 =C2=A0 7 | 8 | 9 |

By the way, the org version loaded this time is 9.5.3 (9.5.3-g277897 @ /Use= rs/stanton/.emacs.d/straight/build/org/).

The table exports OK, but isn=E2=80=99t much fun to look at in the org file= itself.

Since I like to use emacs-jupyter, any suggestions would be appreciated. I = know this worked fine just a few weeks ago.

Thanks!

Richard Stanton






--000000000000942e9705df4f8b53--