5
$\begingroup$

In the documentation article for Polygon in Mathematica 12, there is an example with the input:

pol = Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}]

In the documentation article the output is displayed as:

Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}]

But when I evaluate the code I get a different output with some information about the polygon, the number of points, the dimension, and more. It looks like this:

polygon

Is there a way to control what is obtained as output?

$\endgroup$
5
  • $\begingroup$ Try applying InputForm or the more verbose FullForm to the polygon. $\endgroup$
    – flinty
    Commented Aug 1, 2020 at 22:44
  • $\begingroup$ Thank you very much! That is what I sometimes need. Is this new feature in version 12? $\endgroup$
    – wdacda
    Commented Aug 1, 2020 at 22:59
  • 1
    $\begingroup$ No FullForm/InputForm have been there forever since 1988 - these bubble things with info have been there in the last few versions at least. It would be nice if there was an option to turn off these front-end bubble forms which also appear for SparseArray, ProbabilityDistribution, ClassifierFunction, InterpolationFunction etc. $\endgroup$
    – flinty
    Commented Aug 1, 2020 at 23:03
  • 2
    $\begingroup$ I jumped from version 8 to version 12. The "bubble things" were an unpleasant surprise. Thank you flinty for answering my question with your comment. Why don't you post your comment as an answer? Although simple, it was very useful to me. $\endgroup$
    – wdacda
    Commented Aug 2, 2020 at 6:44
  • $\begingroup$ see Lukas Lang's comment on m_goldberg's answer - BoxForm`UseIcons = False seems to work though it's a protected symbol so you need to unprotect it to change it. $\endgroup$
    – flinty
    Commented Aug 3, 2020 at 12:12

2 Answers 2

6
$\begingroup$

The examples in the documentation article for Polygon should have been re-evaluated before Mathematica 12 was released, but it is evident that they weren't. This is true even for V12.1.1. If you manually evaluate the examples shown in the documentation they will show the new iconized argument form. This is a documentation bug,

That said, you can get the old output form like this:

pol = Defer @ Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}]
Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}]
$\endgroup$
8
  • $\begingroup$ Do you know of any way (global options?) to turn off iconization in the front-end? $\endgroup$
    – flinty
    Commented Aug 2, 2020 at 23:12
  • $\begingroup$ @flinty. I do not. $\endgroup$
    – m_goldberg
    Commented Aug 2, 2020 at 23:13
  • 3
    $\begingroup$ @flinty You can use With[{prot = Unprotect@BoxForm`UseIcons}, BoxForm`UseIcons = False; Protect /@ prot;] to turn the summary forms off for some cases, including Polygon. $\endgroup$
    – Lukas Lang
    Commented Aug 3, 2020 at 11:56
  • 5
    $\begingroup$ @Lukas, it is safer to use SetSystemOptions["TypesetOptions" -> {"IconicElidedForms" -> False}] instead of the Unprotect[] business. $\endgroup$ Commented Aug 4, 2020 at 1:40
  • $\begingroup$ @flinty, see the above comment as well. $\endgroup$ Commented Aug 4, 2020 at 1:41
4
$\begingroup$

Following the comments under m_goldberg Answer to this question (https://mathematica.stackexchange.com/a/227859) the following code disables the SummaryBox for Polygon only without disabling all elided forms or modifying the protected symbol BoxForm`UseIcons:

ClearAll[Region`PolygonDump`summaryBox]
Region`PolygonDump`summaryBox[poly_, format_] :=  ToBoxes[InputForm@poly, format]
Region`PolygonDump`summaryBox[___] := $Failed
Attributes[Region`PolygonDump`summaryBox] = {HoldAllComplete};

Disablingthe SummaryBox for Polygon

Region`PolygonDump`summaryBox is the internal function constructing the SummaryBox for Polygon which I found using GeneralUtilities`PrintDefinitions[Polygon]. I have not noticed any problems using this but unwanted side effects might occur when modifying core functions and the internal functionality for BoxForm of Polygon might change in the future but the presented solution works for me in 12.1.1.0.

$\endgroup$

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.