[XeTeX] word cloud or tag cloud in XeLaTeX

Michiel Kamermans pomax at nihongoresources.com
Mon May 24 18:36:24 CEST 2010


On 5/23/2010 9:38 AM, Juan Francisco Fraile Vicente wrote:
> Thanks, Mike!
> I am asking about both of the methods. The first could be the better, 
> perhaps. But there is this web: 
> http://www.tocloud.com/javascript_cloud_generator.html that gives the 
> html code. I mean also more complex clouds , like those with cross 
> words (vertical and horizontal). Perhaps this only need a littel bit  
> of time texing, but I'd like to know if someone has developed a style 
> or package to do these things.

I don't think anyone's written a package to do that (yet). I don't think 
you should even want to using LaTeX to do word cloud abstraction form 
some data (that's simply not what it's good for), but if you already 
have the data and you want to text visualise it, then I think the 
easiest approach would be something akin to writing a command that takes 
your formatted data, normalised to - say - 10, sticks it in a box, and 
then lets TeX do its thing by relying on the relsize package. Something 
that would look like

\begin{wordcloud}
\cloudentry{Google}{6}
\cloudentry{Yahoo!}{3}
\cloudentry{Bing}{0.8}
\cloudentry{AOL}{0.2}
\end{wordcloud}

with

\newcommand{\cloudentry}[2]{
\renewcommand{\magstep}{#2}
\larger #1\smaller}

and a new environment definition that sets up a box of some sort (or 
not, depending on whether you want the text in a box or not). Quite 
terribly I can't remember how to plain-TeX an "if #2 > 1, do ... else 
..." construction, but you'd want to set up the magstep (which tells 
relsize by how much to increase/decrase font size) and then use 
\larger\smaller if the value is greater or equal to 1, or 
\smaller\larger if the value is less than 1.

Not the most amount of help, but hopefully enough to get things going.

- Mike


More information about the XeTeX mailing list