Is it possible to use the WordCloud function to create a word cloud out of LaTeX expressions or images (with transparencies) representing equations?
Asked
Active
Viewed 230 times
4
1 Answers
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 Polygons.
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.
Szabolcs
- 234,956
- 30
- 623
- 1,263



exp = Integrate[1/(1 - x^32), x] // Expand; exp = List @@ exp; WordCloud[ToString[HoldForm[exp // Release]], ColorFunction -> ColorData["GrayTones"]]– chris Feb 26 '17 at 18:14WordCloud[ Table[Rasterize[ MaTeX["x^{" <> ToString[n] <> "}", Magnification -> 5], RasterSize -> 200], {n, 20}]]– C. E. Feb 26 '17 at 20:45