4

3

Is it possible to use the WordCloud function to create a word cloud out of LaTeX expressions or images (with transparencies) representing equations?

4

3

Is it possible to use the WordCloud function to create a word cloud out of LaTeX expressions or images (with transparencies) representing equations?

2

`WordCloud`

should work with any expression, but in practice some expressions, in particular `Graphics`

containing `FilledCurve`

, cause it to fail.

Here's a way around this.

Let's compile some TeX using MaTeX:

```
Needs["MaTeX`"]
letterGraphics = MaTeX@CharacterRange["a", "z"]
```

This fails:

```
WordCloud[letterGraphics]
```

But now let us convert those special graphics primitives to pure `Polygon`

s.

```
WordCloud[
BoundaryDiscretizeGraphics[#, MaxCellMeasure -> 0.01] & /@
letterGraphics]
```

If setting the `MaxCellMeasure`

to a low enough value, it works.

I tested this in Mathematica 11.2. Earlier versions may not do so well.

would this suit you? its not quite what you asked for

`exp = Integrate[1/(1 - x^32), x] // Expand; exp = List @@ exp; WordCloud[ToString[HoldForm[exp // Release]], ColorFunction -> ColorData["GrayTones"]]`

– chris – 2017-02-26T18:14:05.7701

If the question is "how to create a word cloud out of LaTeX expressions or images?" then the answer can be found here. You can turn LaTeX expressions into images using MaTeX.

– C. E. – 2017-02-26T18:29:12.610@C.E. According to the documentation (under Details), since v11 WordCloud should work with any expression, including graphics. However, I can't get it to produce reasonable output when given MaTeX-generated stuff. Of course, Heike's implementation (that you linked to) will still work. – Szabolcs – 2017-02-26T20:18:18.000

@Szabolcs Sorry, I don't know why I got that wrong. I can't get it to work with the expressions either, but rasterizing seems to help:

`WordCloud[ Table[Rasterize[ MaTeX["x^{" <> ToString[n] <> "}", Magnification -> 5], RasterSize -> 200], {n, 20}]]`

– C. E. – 2017-02-26T20:45:33.667