43

Is it possible to merge two or more cells in an org-mode table like when using \multicolumn{}{}{} or \multirow{}{}{} in LaTeX?

Something like this does not work:

|------------+-----------+----------+----------+-------------|
|            |             Singular            | Plural      |
|            +-----------+----------+----------+-------------|
|            | Masculine | Neuter   | Feminine | All genders |
|------------+-----------+----------+----------+-------------|
| Nominative | *der*     | *das*    | *die*    | *die*       |
| Accusative | *den*     | *das*    | *die*    | *die*       |
| Dative     | *dem*     | *dem*    | *der*    | *denen*     |
| Genetive   | *dessen*  | *dessen* | *deren*  | *deren*     |
|------------+-----------+----------+----------+-------------|

Is there a way to construct such a table in org-mode?

NickD
  • 29,717
  • 3
  • 27
  • 44
Tymric
  • 762
  • 1
  • 6
  • 15
  • 1
    Not as far as I know, but there's table-mode. – wvxvw Jan 12 '15 at 15:51
  • @wvxvw Interesting. Is it possible to integrate these tables within org-mode, perhaps even as a minor mode or between #+BEGIN_SRC and #+END_SRC tags? – Tymric Jan 12 '15 at 16:00
  • 1
    I'd try #+begin_src table but you'd need to handle the exporting somehow, and that sounds like a lot of trouble, unless there's already an exporeter for that... – wvxvw Jan 12 '15 at 16:38

1 Answers1

34

As @wvxvw points out, you can use table.el by Takaaki Ota. There is some built-in support for this in org-mode (see manual). Your example can be easily translated to table.el syntax by replacing some | with +:

+------------+-----------+----------+----------+-------------+
|            |             Singular            | Plural      |
|            +-----------+----------+----------+-------------+
|            | Masculine | Neuter   | Feminine | All genders |
+------------+-----------+----------+----------+-------------+
| Nominative | *der*     | *das*    | *die*    | *die*       |
| Accusative | *den*     | *das*    | *die*    | *die*       |
| Dative     | *dem*     | *dem*    | *der*    | *denen*     |
| Genitive   | *dessen*  | *dessen* | *deren*  | *deren*     |
+------------+-----------+----------+----------+-------------+

The table can be edited using C-c ' and it exports fine with the HTML and LaTeX backends, except that org-mode syntax (such as using asterisks for bold) inside the cells is not recognised. Here is an example of rendered LaTeX export: enter image description here

JeanPierre
  • 7,465
  • 1
  • 20
  • 39
deprecated
  • 2,805
  • 15
  • 15
  • Perfect! Thank you. As for bold type, the <b></b> tag works just fine – Tymric Jan 13 '15 at 08:34
  • 9
    The sentence "Your example can be easily translated to table.el syntax by replacing some | with +:" could be understood as recommending manual translation; but I think that it is better to use the command org-table-create-with-table.el, bound in Org Mode to ‘C-c ~’ – Jorge Feb 06 '17 at 17:01
  • Yes, I was not aware of that command - thank you! Although in this particular case the OP is starting with something that is neither a legal org-mode table nor a legal table.el table, so I doesn't work cleanly. – deprecated Feb 07 '17 at 20:36
  • 2
    What if I need latex fragments inside the table? – Artem Yu Apr 15 '20 at 11:54