# Make square parenthesis to grow around an arbitrary expression (in output)?

Posted 5 months ago
696 Views
|
6 Replies
|
5 Total Likes
|
 This is a subroutine that I use to put round parentheses around an arbitrary expression (in output). dExP [expr_]: = TraditionalForm @ Style ["" [expr]]; Parentheses grow according to the size of the expression.Is there something similar for square brackets?
6 Replies
Sort By:
Posted 5 months ago
 This works with double parentheses
Posted 4 months ago
 Just remove or move TraditionalForm inside of the parentheses: dExP[expr_] := Style[""[TraditionalForm@expr]]; dExP[x^x^x] 
Posted 4 months ago
 I would do it this way: wrapInRoundParentheses[expr_] := DisplayForm@RowBox[{"(", expr, ")"}]; wrapInSquareBrackets[expr_] := DisplayForm@RowBox[{"[", expr, "]"}]; 
Posted 4 months ago
 Thank you all,but the parentheses do not grow enough in the case of square brackets. Attachments:
 According to this answer, you should specify SpanMaxSize -> Infinity styling directive: wrapInSquareBrackets[expr_] := DisplayForm@StyleBox[RowBox[{"[", expr, "]"}], SpanMaxSize -> Infinity]