Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want a table with a single column of data, and with headings along both the rows and the column. One might expect it to work like this:

TableForm[{"one", "two", "three"}, 
 TableHeadings -> {{"$10MM", "$20MM", "$30MM"}, {"col"}}]

But this does not work; it displays the data and the row labels correctly, but it does not label the column. What am I missing?

share|improve this question
Your data consists of a single row... try TableForm[List /@ {"one", "two", "three"}, TableHeadings -> {{"$10MM", "$20MM", "$30MM"}, {"col"}}]... – Yves Klett May 30 '14 at 20:26
TableForm[List /@ {"one", "two", "three"}, TableHeadings -> {{"$10MM", "$20MM", "$30MM"}, {"col"}}] – Dr. belisarius May 30 '14 at 20:31
or {{"one"},{"two"},{"three"}} .. – george2079 May 30 '14 at 20:36
@belisarius and you even got the upvote earlier! Man, I really seem to be a people person :D – Yves Klett May 30 '14 at 20:39
@YvesKlett Me too! – Dr. belisarius May 30 '14 at 20:46
up vote 3 down vote accepted

You present a single row vector to TableForm, which is rather hankering for a column vector (or matrix).

Instead of {"one", "two", "three"} you need {{"one"}, {"two"}, {"three"}}. There are many ways to achieve this, one of them List /@ {"one", "two", "three"}:

TableForm[List /@ {"one", "two", "three"}, 
 TableHeadings -> {{"$10MM", "$20MM", "$30MM"}, {"col"}}]

Mathematica graphics

share|improve this answer

I would prefer:

Grid[{{"", "col"}}~Join~
  Transpose[{{"$10M", "$20M", "$30M"}, {"one", "two", "three"}}], 
 Dividers -> All]

because of its clarity and all the additional Grid-options.

share|improve this answer

To be different, and to illustrate behavior of TableForm which I previously described here, which is that directions flip with every additional List level:

 {{{"one", "two", "three"}}}, 
 TableHeadings -> {{Column@{"$10MM", "$20MM", "$30MM"}}, {"col"}}

There may be a cleaner way to do the headings than using Column but I can't think of it at the moment.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.