Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

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

How do you insert more columns into Table cells, as shown below?

To get to this table, go to File → New → Styled Notebook → Textbook → New → Scroll down to the Table Cells.

Screenshot of table

share|improve this question
up vote 8 down vote accepted

I guess you would like to keep formatting of the table. The following is programmatic way to do it. For simplicity I will deal with the smallest Table 1.1 in that template.

Click anywhere on the table and press Ctrl+Shift+I on Windows or Command+Shift+I on Mac. The 1st table will turn into the following code:

enter image description here

Ctrl+Shift+I produces so called InputForm of an expression. From the code above it is easy to separate the table-maker part and make a function

tbl[x_] := Grid[x, Alignment -> {{Left, Center}, {Bottom, Top}}, 
  BaseStyle -> {TextJustification -> 0, ParagraphIndent -> 0, FontFamily -> "Times"}, 
    Dividers -> {{False}, {1 -> AbsoluteThickness[2.], 
     2 -> AbsoluteThickness[0.5], -1 -> AbsoluteThickness[0.5]}}, 
    ItemSize -> {Automatic, Automatic}, Spacings -> {10., {1, 0.5}}]

Now you can just use it with arbitrary styles and number of rows or/and columns set by, Style, ConstantArray, Table or similar functions:

tbl[ConstantArray[Style["placeholder", Italic, 18, FontFamily -> "Gabriola"], {6, 3}]]

enter image description here

You now can edit placeholder dummies and then evaluate edited table (press Shift+Enter) to get final result.

If due to any reason you would like to preserve exactly the Textbook styles of table entries, you could use another part of the code you got after Ctrl+Shift+I to define a simplest data structure:

data = {{TextCell["Enter column head here", Italic, Editable -> True],
         TextCell["Enter column head here", Italic, Editable -> True]}, 
        {TextCell["Enter data here", Editable -> True], 
         TextCell["Enter data here", Editable -> True]}};

Define a function for adding columns and/or rows:

newtbl[x_, n_, m_] := Transpose[(#~Join~Table[Last[#], {i, n}]) &@
                                Transpose[x~Join~Table[Last[x], {i, m}]]]

Use it to add, for example, 2 more columns and 7 more rows:

tbl[newtbl[data, 2, 7]]

Select the resulting output cell and choose Top menu >> Format >> Style >> Table. You can even sandwich it now between "table title" and "table note" cells to make it perfect:

enter image description here

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.