From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kA+6FFVUhWKIUwAAbAwnHQ (envelope-from ) for ; Wed, 18 May 2022 22:17:25 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id gHKjFFVUhWJbxAAAauVa8A (envelope-from ) for ; Wed, 18 May 2022 22:17:25 +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 AACC2C67B for ; Wed, 18 May 2022 22:17:24 +0200 (CEST) Received: from localhost ([::1]:55290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nrQ6l-0000A1-NB for larch@yhetil.org; Wed, 18 May 2022 16:17:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrQ5r-00009j-HA for emacs-orgmode@gnu.org; Wed, 18 May 2022 16:16:27 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:33305) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nrQ5p-0006TO-1c for emacs-orgmode@gnu.org; Wed, 18 May 2022 16:16:27 -0400 Received: by mail-ed1-x52e.google.com with SMTP id n23so4484779edy.0 for ; Wed, 18 May 2022 13:16:24 -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=ptFXUzcYkTgtzuysO/nRJQX7htGSEpDoZliBdsaprf8=; b=AHi4qFBGlkjIEGSf9F6XlFYfTurCXLFJ5wkedgr3xqX5B81VPJ1r0OCErn5KmzHJeG mDeJDDmGUZzXARmPxMe7Ds0kMYaQQpYersWSVGIato/XxBtIwJiQeckluVC1EM0GZ7XN dfLMVax+id82IEoMnRzXRd/ln84cPIyz+UgZjQs1DdUYuwl8kiht+IQ/3KP8p4v4rvbZ kvnTHAIGdn8frul8g4+kDKI4Q7G633iNiBRWlHDqKdvLzzJVVsvwwCz9rtimNnuZht50 P2rzNpxAvaeRgXeiYKthoTKOBQSTJSBSLp4fdLcPRXr75lLPwifqLm1UAXI4mHwhPmaQ roDw== 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=ptFXUzcYkTgtzuysO/nRJQX7htGSEpDoZliBdsaprf8=; b=XkWQLFxqri2Yl9CNeZJYIrKI4Hq5SfigiKXBLAahYIfLDbUYkDxmSz+JmEDlMoQbiL OXNeWta72PpdaWGOeOxRo+9abn26wp3wnVtWtHZgoofjAE9KdrRdpNhJdUdRaNif4Ag4 w3VKJJ4u8FZJPjZG7z0p8Ojm1TvWhHj8WNOLe0xIccEwPVl17XjqwvoNKdZBfbV4Y31s cTMqSJ5zLDMxVLAQllqhx190vhcpHgqivKSN/0X1tUNKisd0j1fv2XJanfcIp/QfKLVT KWcq3FzIHYGLG3FodORYk68MB2Lwe5/wJJYd6icmmKkvg3BwFikBaQOFVKhQWwT1V3Kf ePYw== X-Gm-Message-State: AOAM533SIz82xk4wc1iClw59eMgRtInBS7ZCat/ORO0HxJRFR1VG1FLz HBDFeCXFtjd2xmPnNdsCVtoeaYSw/PIMTmbckMXaZbEwNg8= X-Google-Smtp-Source: ABdhPJxzHAuN/Mh0tUuKZwvRMfbrFZKGZrPqkgBjSSRNuRpYDvRDUPha78npcBSrTfesAPLeoP1k+Il7B5gBIlFYH4M= X-Received: by 2002:a05:6402:cae:b0:42a:ba8f:9d05 with SMTP id cn14-20020a0564020cae00b0042aba8f9d05mr1565028edb.277.1652904983027; Wed, 18 May 2022 13:16:23 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: John Kitchin Date: Wed, 18 May 2022 16:16:11 -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="0000000000005c7f3605df4eeead" Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=johnrkitchin@gmail.com; helo=mail-ed1-x52e.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 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 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=1652905045; 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=ptFXUzcYkTgtzuysO/nRJQX7htGSEpDoZliBdsaprf8=; b=C0GIzBNeQl6CnwHWbBkpOpub1H1d2RLNDtZbYlQ8sDo0WaZgv+rL8GxTGk2dFDIn4SBk9M wQb82q9GOFdMAlBlF+aiZIzV0Ja8hLMuJjju9AzfDDyJosgnI2FjcNu/kC1erH3k5PW/iz PVKq+pmPOjk1UQg7OigXiPnkKf54ycJvF8kTazalv9VLjRpfq4PMIkb/UC61a/Pbv4J3LX 7o/jCiVxfh2QmQ7jCqW+oMDJJsEwttcjJEQuCLFZeny41Un5Uhz3bmXm9UglCR/UffEUoL OXFgHPkH5SyzyuHUf3YdBvCmO0pJW9NDvasePjtO2bGuVIOi/JPzDYbq/Ox2rg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652905045; a=rsa-sha256; cv=none; b=Y0V3A8L1yWF2VJuYbSHIeoKcFQOXoz4wsrOz5sFXr2jkf391tjxDdUD8l1kNLSVu4ezWMb fsyfV3md9BtuNq7wwigwpGweYael3oOW9fkHhFQ6EuMA7th37rit64OR5Dzz22uv3ZuNOv R64IY3xWFuMmjME8g0bn4tZ7CbXLR2Nd6dnkEe8V8M6D3A+7A+CXpx8w4NL5Yw0DZ2C/Cv ex4wD8fX7i8AXnqD16G/yRauPjRtYXCsCFYdIUl2fvd7nSQ8nyf8WKAABYY93h7XlUEGon Mgbef7/KbrSSVRmEUzsO2NJlJ27PGMYfJIcRskQL4hM9TBA2eKtpX91A0gfnDQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=andrew.cmu.edu header.s=google-2021 header.b=AHi4qFBG; 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: -7.54 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=andrew.cmu.edu header.s=google-2021 header.b=AHi4qFBG; 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: AACC2C67B X-Spam-Score: -7.54 X-Migadu-Scanner: scn0.migadu.com X-TUID: SzeFpAb/lCeq --0000000000005c7f3605df4eeead Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 to 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 tables= 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 tabl= e, > 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 fin= e > 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 the > 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 fi= le 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 > > > > > > --0000000000005c7f3605df4eeead Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I use a function in an after execute hook for this:=C2=A0<= a href=3D"https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205= ">https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205
This works=C2=A0on a subtree, which has been fine for me. Y= ou could adapt it to only work in the results section.

=
John

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

=

On Wed, May 18, 2022 at 4:07 PM Richard Stanton <rhstanton@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 LaTeX or HTML. The simplest way to do this seems = to be to generate the output as an org table, and using the built-in versio= n of org (9.4.6 (9.4.6-798-g738759.dirty-elpaplus @ /Users/stanton/.emacs.d= /elpa/org-plus-contrib-20210929/)), this works fine using either a python o= r emacs-jupyter code block:

#+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





--0000000000005c7f3605df4eeead--