TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose you have n variations of a small text or a formula like this:

% Formula 1
      v(t_o) = \lim_{h \to 0} \frac{v(t_0 + h) - v(t_0)}{h}

% Formula 2
      v(t_o) = \lim_{h \to 0} \frac{v(t_0 + \Delta t) - v(t_0)}{\Delta t}


% Formula n

Is it possible to distribute evenly those formulas randomly, on a page with random rotations of the formulas by +- x degree. The formulas must not overlap.

share|improve this question
You can use tikz for this. – Leo Liu Oct 19 '11 at 12:48
@'Leo Liu'. Thanks. Could you provide some more details? – student Oct 19 '11 at 13:34
You could manually distribute them using \hspace and \vspace and take the random rotation from tex.stackexchange.com/questions/9323/… – doncherry Oct 19 '11 at 18:30
I'm a little confused by 'distribute evenly those formulas randomly'. Do you want the distribution even (on a rectangular or circular grid for example) and the formulas randomly assigned to the points, or would you like the distribution random (not on a grid)? – cmhughes Oct 19 '11 at 21:27

Following @Leo's suggestion, here's a start for how you might do this in Tikz:



\pgfkeys{/rotatednodes/.cd, width/.initial=10cm, 
  height/.initial=10cm, maxrotation/.initial=20}

\pgfkeys{/rotatednodes/.cd, #1}
\foreach\eq in \@eqlist{
  \advance\@nodenum by 1
 \node[rotate=\r] (randomnode_\number\@nodenum) at (\x/100,\y/100) {\eq};


which you would then use like

\rotatednodes[width=2cm, maxrotation=90]{$x$, $y$, $z$, $a$, $b$, $c$}

which gives

Equations positioned and rotated at random

or something similar to it.

The optional arguments are width, height, and maxrotation which all do more or less what they say. The fiddling with keys for the arguments was just for fun: the crucial bit is using \pgfmathrandominteger to randomise the position and rotation of the nodes, and I guess using \foreach to loop through the various equations.

There are several issues with this simple implementation, notably that absolutely no attempt is made to check for node overlap, and that only the centres of the nodes are guaranteed to fall within a widthxheight rectangle, but hopefully this will help you find a solution that works for your particular case.

share|improve this answer
You can use \pgfmathdeclarerandomlist and \pgfmathrandomitem to get random item from equations. – Leo Liu Oct 20 '11 at 15:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.