In this question I am only interested in mathematical expressions arising in output cells, not more elaborate code which is typically found in input cells. My understanding is that such output is made of boxes which, like every expression in Mathematica, have a the structure of a tree.
I would have naively thought that what can be selected in an output cell is any subtree of that tree. E.g. in the fraction x+y
over z
(with box form FractionBox[RowBox[{"x","+","y"}],"z"]
), one cannot select y
and z
without selecting the whole fraction.
However, this is too naive: MakeBoxes[-x y]
gives the nested structure RowBox[{RowBox[{-, x}], , y}]
, but one can nevertheless select x
and y
in the output of -x y
without selecting -
.
Another similar case is that MakeBoxes[ab cd]
gives RowBox[{"ab"," ","cd"}]
but one can select (in the output of ab cd
) b c
, whose box representation is not a subtree.
I think my question boils down to: is RowBox
is the only case where one can select a non-subtree?
RowBox[{"b", "+", SuperscriptBox["b", "2"]}]
(i.e. b+b^2), one can select b+b. $\endgroup$ – Bruno Le Floch Apr 11 '16 at 16:23MakeBoxes[Grid[{{1, 2}, {3, 4}}]]
gives...GridBox[{{"1", "2"}, {"3", "4"}}...]...
but you can select{{"1"},{"3"}}
$\endgroup$ – andre314 Apr 11 '16 at 19:50