I see the same with versions 8.0.4, 10.4.1 and 11.1.0 on Windows 7 x64. Only with version 5.2 the outputs are formatted identically.
Let us look at the underlying box expression printed in the Notebook in each case (the following is the output from version 11.1.0):
CellPrint[ExpressionCell[TableForm[Partition[Range@4, 2], TableSpacing -> {0, #}],
"Output", CellTags -> "GridSpacings"]] & /@ {.5, 1/2};
cells = NotebookRead /@ Cells[CellTags -> "GridSpacings"];
Cases[#, Verbatim[Rule][GridBoxSpacings, _], -2] & /@ cells
{{GridBoxSpacings -> {"Columns" -> {Offset[0.28], {Offset[0.35]}, Offset[0.28]},
"ColumnsIndexed" -> {}, "Rows" -> {Offset[0.2], {Offset[0.]}, Offset[0.2]},
"RowsIndexed" -> {}}},
{GridBoxSpacings -> {"Columns" -> {Offset[0.28], {1/2}, Offset[0.28]},
"ColumnsIndexed" -> {}, "Rows" -> {Offset[0.2], {Offset[0.]}, Offset[0.2]},
"RowsIndexed" -> {}}}}
One can see essential difference in the spacing specifications for "Columns"
! These GridBox
options are all undocumented, but if we assume that their forms are the same as for Spacings
we are confused again because in our case the middle term shouldn't matter:
{s1,{c},sn}
use s1
, then repeatedly use c
, but use sn
at the end
Oh, Gid
has a lot of "oddities", probably this is just another one.
But what makes things even more painful is that the above oddity is due to a conversion performed solely by the FrontEnd, because the Kernel's ToBoxes
creates numerically identical expressions:
N@ToBoxes@TableForm[Partition[Range@4, 2], TableSpacing -> {0, .5}] ===
N@ToBoxes@TableForm[Partition[Range@4, 2], TableSpacing -> {0, 1/2}]
True
Hence we can't catch such an "oddity" without conversation with the FrontEnd.
TableForm[Partition[Range@12, 4], TableSpacing -> {0, 0.5}] === TableForm[Partition[Range@12, 4], TableSpacing -> {0, 1/2}]
returnsFalse
in my case too. $\endgroup$FullForm
to look at what you're comparing.) What is odd is that the displayed tables look different. $\endgroup$GridBox
withColumnSpacings
andRowSpacings
attributes. Interestingly,Grid
seems to have no problem withSpacings
. $\endgroup$