TransWikia.com

How to control the output of Polygon

Mathematica Asked by wdacda on February 6, 2021

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?

2 Answers

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.

Answered by N0va on February 6, 2021

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}}]

Answered by m_goldberg on February 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP