Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. documentclass{article}
  2.  
  3. usepackage{pgf}
  4. pgfmathsetseed{numberpdfrandomseed}
  5. usepackage{pgffor}
  6. usepackage{tikz}
  7.  
  8. pgfmathdeclarerandomlist{FracSlopes}
  9. {%
  10. {frac{1}{2}}
  11. {frac{3}{2}}
  12. {frac{5}{2}}
  13. {frac{7}{2}}
  14. {frac{1}{3}}
  15. {frac{2}{3}}
  16. {frac{4}{3}}
  17. {frac{5}{3}}
  18. {frac{7}{3}}
  19. }
  20.  
  21. pgfmathrandomitem{FracSlope}{FracSlopes}
  22.  
  23.  
  24.  
  25.  
  26. begin{document}
  27.  
  28. % Since the line below works
  29. % I know the fraction is being selected randomly.
  30. (y=FracSlope{x})
  31.  
  32. begin{tikzpicture}[scale=0.3]
  33. draw[help lines, gray, thin] (-10,-10) grid (10,10);
  34. draw[very thick,<->] (-10.3,0)--(10.3,0);
  35. draw[very thick,<->] (0,-10.3)--(0,10.3);
  36. %
  37. % Everythig compiles if the next two lines are commented out.
  38. clip (-10,-10) rectangle (10,10);
  39. draw[blue, very thick, domain=-10:10] plot (x,FracSlope*x);
  40. % It's interpreting FracSlope as a string, not a number.
  41. % I'm *pretty* sure that's the problem.
  42. end{tikzpicture}
  43.  
  44. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement