# How use Iconize object assigned to a variable (Mathematica 11.3)?

In Mathematica 11.3 we have the new Iconize function. Say I create an iconized image grabbed from the web, like this:

 hawkings = WebImageSearch["Stephen Hawking", "MaxItems" -> 5];


If I now evaluate input such as...

 Evaluate[the-actual-icon]


... where the-actual-icon is the icon just created, then I'll get the image as output. However, if I evaluate instead...

 Evaluate[pic]


...then I just get the icon object again, not the actual image.

How can I get the image by using the name pic for the icon rather than the iconized object itself?

Iconize is not meant to be used this way. Do not assign the result to a variable.

Above, you are assigning the output to a variable, i.e. storing it in kernel memory.

The purpose of Iconize is to be able to store expressions in a notebook without having them take up a lot of visual space. The icon can be copied around within the notebook, and inserted into input cells, where it will behave as if you had typed the expression it represents.

Normally, you would create an icon either by selecting an expression, right-clicking, and choosing Iconize from the menu (this method does not evaluate), or by typing Iconize[something], selecting it, then evaluating it in place (Command-Enter on Mac).

To sum up: one would not normally use the return value of the Iconize function. Instead, one would use the icon (a visual object within the notebook) that it created. It's useful only in relation with notebooks.

Before Iconize was available, I showed a very similar concept in this blog post, which in turn was inspired by a much older MathGroup post by John Fultz. Looking at this blog post may clarify the intended use of Iconize too.

• Because if the icon were the same thing as the expression, it would format as the expression, not as an icon. What's returned by Iconize must be different from the expression in order for the magic where it looks like one thing but formats as another. And I would point out that this question is directly addressed by the Possible Issues example on the ref page. In fact, I think your description of the documentation is entirely unfair. 4 notes and 11 examples? That's a reasonable amount, especially for such a tiny function. What do you think isn't addressed by the documentation? Mar 15, 2018 at 21:46
• @ItaiSeggev To be fair, the behaviour I tried to describe in the two comments above can be quite confusing, and I have no idea how to explain it clearly and concisely ... people get confused about Defer all the time, and don't understand the difference between it and HoldForm. Personally I love Iconize and I'm glad that this was implemented. Mar 15, 2018 at 21:53
• @Szabolcs Do you mean spcifically the 4th slot, or the big surrounding pink rectangle? Either will be hard/impossible to fix, and we decide to ship without solving the problem. The basic issue is that we can't ship updates to "Core" via paclets, so a function which requires a new TemplateBox style can't be supported (it would be nice to fix that one day, but there are more pressing issues...). Note that only the 4th argument inside the brackets is actually error pink. The big pink rectangle is "TemplateBox with no know DisplayFunction pink", a less hazzardous & currently unfixable problem. Mar 15, 2018 at 22:51
• @murray That is the meaning of "The formatted output of Iconize[expr] will evaluate to expr when it is supplied as input." Maybe I'm too much in the weeds of the box language to appreciate what it is and is not communicating to someone who is not an expert. Mar 16, 2018 at 22:21
• @murray To me, you might as well be asking "Why don't you state f is continuous??" after I have stated that f is differentiable. If the formatted output evaluates to expr, how can that output (and therefore the notebook) not contain expr? (In point of fact, the output doesn't evaluate to expr, it parses to expr. That is shown via the example involving unevaluated expression, but was deemed overly technical to put in the notes.) Mar 18, 2018 at 2:33