1
$\begingroup$

I'm wondering how to deal with some unwanted behaviour of the new display format of Dataset in Mathematica 11 (I'm using version 11.0.1):

I'm using a custom "type", in this example MyType for which I define the output format:

MakeBoxes[mt : MyType[a_, b_], StandardForm] ^:= 
  Row[{a, "-xx-", b}] // ToBoxes;

This works fine in the standard output, e.g. evaluating MyType[1, 2] gives

1-xx-2

as output. However, when I evaluate it inside a dataset as Dataset[MyType[1, 5]], the output is

1"-xx-"5

This behavior is new in version 11 - in version 10.4, this worked fine and no quotes were added around the string. This problem also doesn't occur when I manually put a string inside a Dataset: Dataset[Row[{1, "--", 5}]] gives

1-xx-2

which is the way I want it to be displayed.

Using Format instead of MakeBoxesdoesn't help. Is there a better way to define a custom output format in v11, or is this a bug?

$\endgroup$
  • 1
    $\begingroup$ What happens if you use MakeBoxes[mt : MyType[a_, b_], StandardForm] ^:= Style[Row[{a, "-xx-", b}], ShowStringCharacters -> False] // ToBoxes; ? (I am using version 10.1.0 so I cannot test this.) $\endgroup$ – Mr.Wizard Jan 6 '17 at 13:11
  • $\begingroup$ This works - thanks a lot! $\endgroup$ – mjayvizzle Jan 6 '17 at 13:29

Browse other questions tagged or ask your own question.