emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Uwe Brauer <oub@mat.ucm.es>
Cc: emacs-orgmode@gnu.org
Subject: Re: org table proposal: merge and split cells in org-tables
Date: Sun, 30 Oct 2022 03:54:05 +0000	[thread overview]
Message-ID: <878rkyarvm.fsf@localhost> (raw)
In-Reply-To: <877d0ia7vd.fsf@mat.ucm.es>

Uwe Brauer <oub@mat.ucm.es> writes:

> In a conversation with Ihor Radchenko it was considered as being helpful
> to provide a table in which cells are merged and split.

We should consider this idea seriously as this and related features are
being requested frequently in the community. I recall the following
contexts:

- Support merging cells when exporting to LaTeX tables
- Text filling inside tables

> Here is one
>
> +--------+-------------------------------------------------+
> | Region |                      Sales                      |
> |        +-------------+-----------+-----------+-----------+
> |        |      Q1     |    Q2     |    Q3     |    Q4     |
> |        +-------+-----+-----+-----+-----+-----+-----+-----+
> |        | foo   | bar | foo | bar | foo | bar | foo | bar |
> +--------+-------+-----+-----+-----+-----+-----+-----+-----+
> | North  | 350   |  46 | 253 |  34 | 234 |  42 | 382 |  68 |
> +--------+-------+-----+-----+-----+-----+-----+-----+-----+
> | South  | 462   |  84 | 511 |  78 | 435 |  45 | 534 |  89 |
> +--------+-------+-----+-----+-----+-----+-----+-----+-----+

This essentially suggests supporting table.el syntax natively. Or maybe
extending it by mixing with native Org tables.

In terms of syntax, adding cell boundary support might be simply a
question of allowing +----+ in Org tables. It will not break anything as
we already parse +-----+ as table.el tables.

At lower level of org-element representation, we do not need to change
much either. table-row elements are already not tied to a fixed number
of cells in every row. And we may extend table-row 'rule type to define
the "+----+   +   +---+--+" cell boundaries.

However, in order to support merging cells, one needs to rework Org in a
number of places. At least:

1. org-element parser and interpreter
2. org-table.el in its totality
3. export backends
4. table formulas; in particular, cell references
5. update syntax document

> Or better

> ------------------------------------------------------------
> | Region |                      Sales                      |
> |        ---------------------------------------------------
> |        |      Q1     |    Q2     |    Q3     |    Q4     |
> |        ---------------------------------------------------
> |        | foo   | bar | foo | bar | foo | bar | foo | bar |
> ------------------------------------------------------------
> | North  | 350   |  46 | 253 |  34 | 234 |  42 | 382 |  68 |
> ------------------------------------------------------------
> | South  | 462   |  84 | 511 |  78 | 435 |  45 | 534 |  89 |
> ------------------------------------------------------------

This will clash with horizontal-rule syntax. Not acceptable. Also,
parsing this kind of table will be significantly harder programatically.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


  reply	other threads:[~2022-10-30  3:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-29 16:53 org table proposal: merge and split cells in org-tables Uwe Brauer
2022-10-30  3:54 ` Ihor Radchenko [this message]
2022-10-30  7:22   ` Uwe Brauer
2022-10-30  9:13 ` Jean Louis
2022-10-30  9:25   ` Ihor Radchenko
2022-10-31  5:56     ` Jean Louis
2022-10-31  8:50       ` Ihor Radchenko
2022-10-30  9:13 ` Timothy
2022-11-04  7:38 ` Max Nikulin
2022-11-05  5:44   ` Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2022-10-30  8:23 Mati
2022-10-30  8:35 ` Ihor Radchenko
2022-10-30  8:47   ` Timothy
2022-10-30  8:56     ` Ihor Radchenko
2022-10-30  9:08       ` Timothy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rkyarvm.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=oub@mat.ucm.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).