Is there an automated way to generate either a wordcloud or at the very least a list of all symbols used in all math environments in a LaTeX document?

I'd like to generate a symbol-only wordcloud, and I found Wordle, and a semi-automatic way to get it directly into a TeX document, but not how to only include math in the wordcloud, let alone that subscripts would be kept intact. I also found this externalization to R, which seems to be great (including choosing the font for the result), although I'm not sure how it would handle math or math-only...

Is there any way to generate this without copy-pasting each equation into the Wordle input form and hope I don't run out of input size?

2 Answers 2


Depending on how complicated your requirements are, the general approach I would take is to use a scripting language with regex to find all latex commands (in python, say \(?:[^a-zA-Z]|[a-zA-Z]+[*=']? from here), and then apply a custom built filter to limit it to math symbol commands.

The part about keeping subscripts intact is much harder. Parsing arbitrarily recursive structures is, shall we say, difficult. You could go one level deeper with a modification of Brent.Longborough's answer here.


Now it could be possible with the wordcloud package : https://www.ctan.org/pkg/wordcloud

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .