MatrixForm uses "round brackets" as delimiter. These are like parentheses, but contrary to "regular" parentheses, they stretch vertically to accommodate the height of their contents. For example:

MatrixForm[{{1, 2}, {3, 4}, {5, 6}}]

...is displayed like this

Mathematica graphics

I want to design an output format similar to MatrixForm, but using (vertically-expanding) square brackets instead.

How can I do this?

Bizarrely/perversely enough, Mathematica provides a way to produce the 90-degree-rotated version of what I want to do1:

  Grid[{{1, 2, 3}, {4, 5, 6}}], \[UnderBracket]],

Mathematica graphics

1 Even more bizarre (to me at least) is the fact that, in the code shown above, the second arguments to Overscript and Underscript are unquoted strings. Somehow, the Mathematica parser recognizes these special characters as valid Mathematica expressions all by themselves. What's up with that??? But that's really a topic for another post.

  • $\begingroup$ @FredSimons: My apologies! I managed to drop that crucial detail in the translation. I will delete the misleading EDIT and comment shortly. $\endgroup$
    – kjo
    Commented Jun 12, 2015 at 14:11
  • 1
    $\begingroup$ There are no unquoted strings here: \[UnderBracket] is a Symbol, just like, say, x. Try Head[\[UnderBracket]] to see what I mean. $\endgroup$ Commented Jun 12, 2015 at 17:29

1 Answer 1


From very old documentation (link to Wolfram website): "Parentheses within a single RowBox by default grow to span whatever other objects appear in the RowBox. Some expandable characters, however, grow by default only to a limited extent."

The latter seems to apply to square brackets. But we can overcome that by using a StyleBox:

StyleBox [RowBox[{"[",  GridBox[{ {"1", "2"},{"3", "4"},{"5", "6"}}],  "]"}], 
  SpanMaxSize->Infinity] // DisplayForm

This produces MatrixForm with square brackets.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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