emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.com>
To: Giovanni Ridolfi <giovanni.ridolfi@yahoo.it>
Cc: David Hajage <dhajage@gmail.com>,
	emacs-orgmode@gnu.org,
	Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: row and col spaning in table?
Date: Wed, 18 Aug 2010 09:32:32 +0200	[thread overview]
Message-ID: <4C6B8C90.5010109@christianmoe.com> (raw)
In-Reply-To: <83bp9sqdec.fsf@yahoo.it>

Giovanni Ridolfi wrote:
> David Hajage <dhajage@gmail.com> writes:
> 
>> and I was wondering if row and col spaning was possible?
> Currently not. 
> But, if this is your case, you should use the table.el package.

Yes. Still, I'd tentatively suggest adding a feature to span Org-table 
cells across rows and columns -- on *export* only. (Sorry if this has 
been thought of before.)

Why? For static tables with complex layout, the table.el integration
is just what the doctor ordered and works really smoothly, and clearly
one would not want to mess up the ease and speed of Org-tables by
adding complexity like row and column spanning in the table editor.

But what if, say, one is using the spreadsheet functionality,
frequently updates the content for publication, and would like to
e.g. span headers over multiple sub-headers? It seems less than
optimal to maintain and update a separate Org table, then convert it
to table.el and manually edit it every time one wants to publish,
spanning the same cells each time.

For this purpose, it would be nice to be able to define reusable cell
spans the same way table formulas are entered, and with the same
syntax. Here's an idea for how it might look:

#+CAPTION: Foo and bar sales by region
| 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 |
#+TBLSPAN: A1..A3::A2..I1::B2..C2::D2..E2::F2..G2::H2..I2

The exporter would read the TBLSPAN line to see what cells should be
merged. It would concatenate the cell contents (if any), and add the
appropriate HTML, LaTeX or DocBook formatting. [1]

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

Another example:

|       | Col A | Col B |     |
|-------+-------+-------+-----|
| Row 1 | A1    | B1    | C1  |
|       | A1b   | B1b   | C1b |
| Row 2 | A2    | B2    | C2  |
|       | A2b   | B2b   | C2b |
#+TBLSPAN: @1$3..@1$4::@2$2..@3$2::@4$3..@5$4

would result in output like:

+---+-----+-----------+
|   | A   | B         |
+---+-----+-----+-----+
| 1 | A1  | B1  | C1  |
|   |     +-----+-----+
|   | A1b | B1b | C1b |
+---+-----+-----+-----+
| 2 | A2  |   B2 C2   |
|   +-----+           |
|   | A2b |  B2b C2b  |
+---+-----+-----------+

[1] HTML: =rowspan= and =colspan= attributes of the =th= and =td=
     elements. LaTeX: =\multicolumn= and =\multirow= commands. DocBook:
     =namest=, =nameend= and =morerows= attributes of the =entry=
     element.

  parent reply	other threads:[~2010-08-18  7:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-26 11:55 row and col spaning in table? David Hajage
2010-07-28  7:22 ` Giovanni Ridolfi
2010-07-28 18:28   ` Srinivas
2010-08-16 12:45     ` Carsten Dominik
2010-08-16 21:24       ` Tak Ota
2010-08-17  5:01         ` Carsten Dominik
2010-08-17 23:51           ` Srinivas
2010-08-18  7:32   ` Christian Moe [this message]
2010-08-18  7:58     ` David Hajage
2010-08-20 14:08     ` Carsten Dominik
2010-08-20 14:24       ` Christian Moe

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=4C6B8C90.5010109@christianmoe.com \
    --to=mail@christianmoe.com \
    --cc=carsten.dominik@gmail.com \
    --cc=dhajage@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=giovanni.ridolfi@yahoo.it \
    /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).