emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to create tables with multi-rows/columns cells?
@ 2017-09-11  3:36 jiewuza
  2017-09-11  8:47 ` Eric S Fraga
  0 siblings, 1 reply; 5+ messages in thread
From: jiewuza @ 2017-09-11  3:36 UTC (permalink / raw)
  To: emacs-orgmode


It is quite common to have multi-rows/columns cells in talbe. But as far
as I know, it seems impossible with the org built-in table editor.

So I turned to the emacs built-in table, and create a simple example:
#+BEGIN_SRC org
   +-----+-----+-----+
   |     h     |     |
   +-----+-----+  h3 |
   |  h1 | h2  |     |
   +-----+-----+-----+
   |  a  |  b  |  c  |
   +-----+-----+-----+
   |  d  |  e  |  f  |
   +-----+-----+-----+
#+END_SRC

It works. However, when I export it to HTML, I find it does not contain
<thead> tag (I would like to style the table head).

So I'd like to know how do you guys to create such tables in org-mode.

p.s. One workaround would be add support for the exporter to recognize
`===` as a separator of table head and body

#+BEGIN_SRC org
   +-----+-----+-----+
   |     h     |     |
   +-----+-----+  h3 |
   |  h1 | h2  |     |
   +=====+=====+=====+
   |  a  |  b  |  c  |
   +-----+-----+-----+
   |  d  |  e  |  f  |
   +-----+-----+-----+
#+END_SRC

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to create tables with multi-rows/columns cells?
  2017-09-11  3:36 How to create tables with multi-rows/columns cells? jiewuza
@ 2017-09-11  8:47 ` Eric S Fraga
  2017-09-12 17:34   ` Grant Rettke
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Eric S Fraga @ 2017-09-11  8:47 UTC (permalink / raw)
  To: jiewuza; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

On Monday, 11 Sep 2017 at 04:36, jiewuza wrote:
> It is quite common to have multi-rows/columns cells in talbe. But as far
> as I know, it seems impossible with the org built-in table editor.

org does not support multi-row/column cells in tables.  When you say:

> It works.

what do you mean?  If I edit your example, org does not recognise it as
a table (or, at least, not a properly defined one).

-- 
: Eric S Fraga via Emacs 24.5.1, Org release_9.1-57-gc6e563

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to create tables with multi-rows/columns cells?
  2017-09-11  8:47 ` Eric S Fraga
@ 2017-09-12 17:34   ` Grant Rettke
  2017-09-13  1:49   ` jiewuza
  2017-09-13  2:22   ` jiewuza
  2 siblings, 0 replies; 5+ messages in thread
From: Grant Rettke @ 2017-09-12 17:34 UTC (permalink / raw)
  To: jiewuza, emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 777 bytes --]

If you set the column width like this

http://orgmode.org/manual/Column-width-and-alignment.html#Column-width-and-alignment

then you can hit C-` to edit the cell and that works nicely.

Sincerely,

Grant Rettke

On Mon, Sep 11, 2017 at 4:47 AM, Eric S Fraga <esflists@gmail.com> wrote:

> On Monday, 11 Sep 2017 at 04:36, jiewuza wrote:
> > It is quite common to have multi-rows/columns cells in talbe. But as far
> > as I know, it seems impossible with the org built-in table editor.
>
> org does not support multi-row/column cells in tables.  When you say:
>
> > It works.
>
> what do you mean?  If I edit your example, org does not recognise it as
> a table (or, at least, not a properly defined one).
>
> --
> : Eric S Fraga via Emacs 24.5.1, Org release_9.1-57-gc6e563
>

[-- Attachment #2: Type: text/html, Size: 1453 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to create tables with multi-rows/columns cells?
  2017-09-11  8:47 ` Eric S Fraga
  2017-09-12 17:34   ` Grant Rettke
@ 2017-09-13  1:49   ` jiewuza
  2017-09-13  2:22   ` jiewuza
  2 siblings, 0 replies; 5+ messages in thread
From: jiewuza @ 2017-09-13  1:49 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <esflists@gmail.com> writes:

> On Monday, 11 Sep 2017 at 04:36, jiewuza wrote:
>> It is quite common to have multi-rows/columns cells in talbe. But as far
>> as I know, it seems impossible with the org built-in table editor.
>
> org does not support multi-row/column cells in tables.  When you say:
>
>> It works.
>
> what do you mean?  If I edit your example, org does not recognise it as
> a table (or, at least, not a properly defined one).

I mean when I export the table to html (see below), I get what I want.

#+BEGIN_SRC org
   +-----+-----+-----+
   |     h     |     |
   +-----+-----+  h3 |
   |  h1 | h2  |     |
   +-----+-----+-----+
   |  a  |  b  |  c  |
   +-----+-----+-----+
   |  d  |  e  |  f  |
   +-----+-----+-----+
#+END_SRC

#+BEGIN_SRC html
<table border="1">
  <tr>
    <td colspan="2" align="left" valign="top">
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </td>
    <td rowspan="2" align="left" valign="top">
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
      &nbsp;&nbsp;h3&nbsp;<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </td>
  </tr>
  <tr>
    <td align="left" valign="top">
      &nbsp;&nbsp;h1&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;h2&nbsp;&nbsp;
    </td>
  </tr>
  <tr>
    <td align="left" valign="top">
      &nbsp;&nbsp;a&nbsp;&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;&nbsp;b&nbsp;&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;&nbsp;c&nbsp;&nbsp;
    </td>
  </tr>
  <tr>
    <td align="left" valign="top">
      &nbsp;&nbsp;d&nbsp;&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;&nbsp;e&nbsp;&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;&nbsp;f&nbsp;&nbsp;
    </td>
  </tr>
</table>
#+END_SRC

But there is no <thead> in the output. That is why I suggest maybe we
can add org support to treat "===" as a separator of thead and tbody.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to create tables with multi-rows/columns cells?
  2017-09-11  8:47 ` Eric S Fraga
  2017-09-12 17:34   ` Grant Rettke
  2017-09-13  1:49   ` jiewuza
@ 2017-09-13  2:22   ` jiewuza
  2 siblings, 0 replies; 5+ messages in thread
From: jiewuza @ 2017-09-13  2:22 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <esflists@gmail.com> writes:

> On Monday, 11 Sep 2017 at 04:36, jiewuza wrote:
>> It is quite common to have multi-rows/columns cells in talbe. But as far
>> as I know, it seems impossible with the org built-in table editor.
>
> org does not support multi-row/column cells in tables.  

Well, I am thinking whether this proposal would work:
1. `|@` as a separator, meaning the next cell will span multiple columns
2. `|$` as a separator, meaning the next cell will span multiple rows
3. the span will terminate when it meats a regular cell separator `|`
4. the content of the "multi-rows/columns cell"(the big cell) should be
placed in the right-bottom single cell of the big one

For example, these two tables have the same effect.
#+BEGIN_SRC org
   |@   | header |$   |
   | h1 | h2     | h3 |
   |----+--------+----|
   | a  |@$      |$   |
   | d  |@       | f  |

   +-----+-----+-----+
   |     h     |     |
   +-----+-----+  h3 |
   |  h1 | h2  |     |
   +-----+-----+-----+
   |  a  |           |
   +-----+     f     |
   |  d  |           |
   +-----+-----------+

#+END_SRC

I do not know if it can be implemented in a clear and simple way based
on the current org-table and ox-* code. Maybe '|@n$m' like separator
(m,n is a number) would be simpler. I do not know. But it is great if
org supports multi-row/column cells in tables.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-13  2:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11  3:36 How to create tables with multi-rows/columns cells? jiewuza
2017-09-11  8:47 ` Eric S Fraga
2017-09-12 17:34   ` Grant Rettke
2017-09-13  1:49   ` jiewuza
2017-09-13  2:22   ` jiewuza

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).