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 AECnEy+WeWJyKwAAbAwnHQ (envelope-from ) for ; Tue, 10 May 2022 00:31:11 +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 UNWFEy+WeWI2KQAAauVa8A (envelope-from ) for ; Tue, 10 May 2022 00:31:11 +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 DBE923592E for ; Tue, 10 May 2022 00:31:08 +0200 (CEST) Received: from localhost ([::1]:39424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1noBuF-0005jn-Ti for larch@yhetil.org; Mon, 09 May 2022 18:31:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1noBtH-0005hv-NV for emacs-orgmode@gnu.org; Mon, 09 May 2022 18:30:07 -0400 Received: from mail-vs1-xe29.google.com ([2607:f8b0:4864:20::e29]:47025) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1noBtF-0000o5-UC for emacs-orgmode@gnu.org; Mon, 09 May 2022 18:30:07 -0400 Received: by mail-vs1-xe29.google.com with SMTP id z144so15303656vsz.13 for ; Mon, 09 May 2022 15:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=dSkt5Sz/op9NIsUPS7uQI8c1488wYviVSf6gorSDyY4=; b=JroWFI55V30OvW6QLVixSaz4NVb7dCrTDEZ/t+/f/lfD8fW0hpaR9j+oBZ1hqvAxWl KD5kSZdJ7uIf/Tv0jnlzEARF2Y3ADY/O1HUgBtzgL0aRFOUsP6RKQZGkWI29E1pwPeGD GTl8Ov2pFUEMLEM/mK+dJIsGWIOUUuG8ugoz8HwmYl6NEIpvsviRQ8yOfV4z4mZ3MGCU B4lR1xGUWaiZeGtvjhlTRf0jtExFpOQVhgDnFM6gCz7bejP2EZ0TRQ3yPUQ+uJXyHHEd lmW4e1QmK6aImL2w+uzZr7tpAP969vnD9V0cK3nAKlmkEihyYeA2sisnTH6MY1ei4X3b sSng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=dSkt5Sz/op9NIsUPS7uQI8c1488wYviVSf6gorSDyY4=; b=pqbM2mThnDrENGOy1RASB4C0zANrPf6enFPvizeV5MjvGx3iZAne/7nOCjd4fzKXkK nXeKhS7CR5pYNGD30QDNum0mmMbiIWepGMvZXC//9gxJudFL1HO2gLK1zVCCNy9kxZbP 5lkmjwYYMUyQ23nB3BIfmWNtDq+em4IIOXj0J8P+4zO7lXd1wz1lWfh/cOodDUz3lmS1 d0k32czxTiRilCML/WR+c+aReVhcnnS0+xFTMlqrrxiknEfu7JirNq/Ot9SYsxzbLd15 DuShFxTGMAdELRCWKz91PRDabB7WHOOJilvqDJSovYWqPniThli0Tk62MyPJ7cXQOuw5 D0mw== X-Gm-Message-State: AOAM532MJEyS39vA4CtFitxEC4VMmg+6zYZqvp4SWSRfS2KdkqaN7ebt Whxo17IYTfYC+U0HVvQlCKCWL6/vaWXYO6fVqDvlQH6Njk0= X-Google-Smtp-Source: ABdhPJy02oHlfcboaHlOMMBfTXDnhukihIRd3A1DjYCM2WqR37+gNacsWU/kbCG86puSB7PoeX5PHLbzqYO3Vh73b4g= X-Received: by 2002:a67:d713:0:b0:32d:57af:a401 with SMTP id p19-20020a67d713000000b0032d57afa401mr10002633vsj.80.1652135404491; Mon, 09 May 2022 15:30:04 -0700 (PDT) MIME-Version: 1.0 From: Pride Allman Date: Mon, 9 May 2022 18:29:53 -0400 Message-ID: Subject: [PATCH] lisp/org-table.el: Use booktabs on org-table-export To: emacs-orgmode@gnu.org Content-Type: multipart/mixed; boundary="000000000000e7edfd05de9bbfda" Received-SPF: pass client-ip=2607:f8b0:4864:20::e29; envelope-from=allmanpride@gmail.com; helo=mail-vs1-xe29.google.com 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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=1652135469; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=K8os/ZIW9i3gb/9b1MX/uXFcgj/rDo28eZX7bz4M1o8=; b=JXLnWP82xWJs5yTiecffDTsAYsfchGXJW5okwMRFVZrdxGSMKOnAjBYKrGfUrJr5l0C0Da 4v803+0CgMpkCzuL/CQBUgWwoV05vRECeoLKVZJOb0mkYQoEviJ3Sq2lKFaTNnZoRDxs07 9Zf+I2Tr/ms14+sz2+JhmcJAiNdmhv9h0UpXs1zSVfejSwfpCSWq35VrW3TbQldF0oTG37 AHKkpnXEa7tF8SyXi5XpHIYbOpoI1EIVLSUAT8mNquNsptQoilxZcwbbJWf96qBO8d2PVn Rg0Tt5fxIvr/tUxQfxWRl2A2FkmK+4f+HRvfteXkkDcYLD2vKLWFv9FRZCvX6A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652135469; a=rsa-sha256; cv=none; b=SMmkcLccF3WZuVO0+xG40GAWEml1VwBhk4ImTOdj5rETFG7p6EZKECa/LAWdc7yipWDamQ w17JpgTEP18H7nuwo1Sh0l/SSQJCQOeBfTpqgwKgHh/6mNSln9etlmvS4gWDinymT8Quc6 mtHiUqg8VhGA3UmZ6rPFsbEyQNrHyYwdEy+Pe7wYrdMywWtAk9zFNiVh5IaT+OZpFTek3S 6vZflFLO2S92J228N4YSpIELi1RDK1RNkKhBmcBePw7K0T1wJElP0QgDnnMdLBaouzOIpy RaWVu3ciGu07OVd5XCCipPUoSel/8mOHO5gkhyMuhWHgcXfFxpvdjl8lI3B2/g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=JroWFI55; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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.30 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=JroWFI55; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: DBE923592E X-Spam-Score: 7.30 X-Migadu-Scanner: scn1.migadu.com X-TUID: QN6365hxaMOa --000000000000e7edfd05de9bbfda Content-Type: multipart/alternative; boundary="000000000000e7edfb05de9bbfd8" --000000000000e7edfb05de9bbfd8 Content-Type: text/plain; charset="UTF-8" Hello, This is my first patch so hopefully I followed the instructions correctly, While using ~org-table-export~ on a table directly even with ~org-latex-tables-booktabs~ set to ~t~, it exports a normal table instead of booktabs table. But on the same situation, if you export the whole buffer the table will be exported according to booktabs. So my theory was there is a discrepancy between the method used by ~org-latex-export-to-latex~ and the ~org-table-export~. And on browsing the codes for those two I found this. The code for ~org-latex-table-row~ used by latex export backend has this line: #+begin_src emacs-lisp :tangle yes (booktabsp (if (plist-member attr :booktabs) (plist-get attr :booktabs) (plist-get info :latex-tables-booktabs))) #+end_src Shows that it also takes into account the ~info~ plist. I couldn't find out what that info plist has, but I can assume it's the information on the overall buffer or that table's context, and it has the effect of using the booktabs from the config. While the code for ~orgtbl-to-latex~ shows it only takes into account the ~booktabs~ parameter on latex table. #+begin_src emacs-lisp :tangle yes :latex-tables-booktabs (plist-get params :booktabs) #+end_src So I tried changing the line in ~orgtbl-to-latex~ to #+begin_src emacs-lisp :tangle yes :latex-tables-booktabs (if (plist-member params :booktabs) (plist-get params :booktabs) org-latex-tables-booktabs) #+end_src So if there is ~booktabs~ parameter then it'll overwrite the settings but if not it'll use the booktabs config. There is probably a better way to use it, but this works for now so I tried this. Please find the attached patch with the fix. Regards, Gaurav --000000000000e7edfb05de9bbfd8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

This is my first patc= h so hopefully I followed the instructions correctly,

While using ~org-table-export~ on a table directly even with ~org-= latex-tables-booktabs~ set to ~t~, it exports a normal table instead of boo= ktabs table. But on the same situation, if you export the whole buffer the = table will be exported according to booktabs.

So my theory was there= is a discrepancy between the method used by ~org-latex-export-to-latex~ an= d the ~org-table-export~. And on browsing the codes for those two I found t= his.

The code for ~org-latex-table-row~ used by latex export ba= ckend has this line:

#+begin_src emacs-lisp :tangle yes=
(booktabsp (if (plist-member attr :booktabs) (plist-get attr :booktab= s)
=C2=A0 =C2=A0 =C2=A0(plist-get info :latex-tables-booktabs)))
#= +end_src

Shows that it also takes into account the ~info~ plist.
=

I couldn't find out what that info plist has, but I can assume = it's the information on the overall buffer or that table's context,= and it has the effect of using the booktabs from the config.

While = the code for ~orgtbl-to-latex~ shows it only takes into account the ~bookta= bs~ parameter on latex table.

#+begin_src emacs-lisp :tangle yes
= =C2=A0:latex-tables-booktabs (plist-get params :booktabs)
#+end_src
So I tried changing the line in ~orgtbl-to-latex~ to

#+begin_sr= c emacs-lisp :tangle yes
=C2=A0:latex-tables-booktabs (if (plist-membe= r params :booktabs) (plist-get params :booktabs)
=C2=A0 =C2=A0 =C2=A0= org-latex-tables-booktabs)
#+end_src

So if there is ~booktabs~ pa= rameter then it'll overwrite the settings but if not it'll use the = booktabs config.

There is probably a better way to use it, but this = works for now so I tried this.

Please find the attached p= atch with the fix.

Regards,
Gaurav
--000000000000e7edfb05de9bbfd8-- --000000000000e7edfd05de9bbfda Content-Type: text/x-patch; charset="US-ASCII"; name="0001-lisp-org-table.el-Use-booktabs-on-org-table-export.patch" Content-Disposition: attachment; filename="0001-lisp-org-table.el-Use-booktabs-on-org-table-export.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l2zamynn0 RnJvbSAyNjRmYjhiN2YyYzU3ODJjOTJjNWJlZmZlNTRhYzE4Yzk3YjRiNjg1IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBHYXVyYXYgPGFsbG1hbnByaWRlQGdtYWlsLmNvbT4KRGF0ZTog TW9uLCA5IE1heSAyMDIyIDE4OjA1OjUyIC0wNDAwClN1YmplY3Q6IF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