Skip to main content
3 of 3
added the bugs header and the versions
bmf
  • 17.2k
  • 2
  • 33
  • 69

Inconsistency of interpreting TableForm inputs

Bug introduced in 12.3.1 or earlier and persisting through 13.2.0 or later.


Consider this line of code and its result:

TableForm[{{a, b}, {c, d}}, TableHeadings -> {None, {1, 2}}] 

table-form of a list

As you see, when I assign the output of TableForm to a variable, it is saved as a List. But when I restart the kernel by executing Quit and run the second line, it returns:

{None,OutputFormsDump`HeadedColumns}[{{1,2},{a,b},{c,d}}] 

So it seems that you have to execute a TableForm command somewhere in your code before assigning a list in table-from! Currently, I use a rather ugly hack like this:

table-form fix

which checks the Depth of a simple table before executing the assignment. If tables are not interpreted as list, then it prints a temporary TableForm and after that, all table inputs will behave as lists.

Why does this happen? Is this a feature or a ?

polfosol
  • 964
  • 7
  • 21