Guest User

Untitled

a guest
Jul 16th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.96 KB | None | 0 0
  1. documentclass{standalone}
  2. usepackage{tikz}
  3.  
  4. begin{document}
  5. begin{tikzpicture}
  6. draw[fill] (0,0) circle (.5) -- ++(10:2) circle (.5) -- ++(-20:2) circle (.5);
  7. end{tikzpicture}
  8. end{document}
  9.  
  10. documentclass{article}
  11. usepackage{tikz}
  12.  
  13. begin{document}
  14.  
  15. begin{tikzpicture}
  16. tikzset{bead/.style={circle,fill=black,inner sep=3pt}}
  17.  
  18. draw node[bead] {} (0,0)
  19. foreach angle in {10,40,50,-50,0,150,30,-60,45,45,0}
  20. { -- ++(angle:1) node[bead] {}};
  21. end{tikzpicture}
  22.  
  23. end{document}
  24.  
  25. documentclass{article}
  26. usepackage{tikz}
  27.  
  28. begin{document}
  29.  
  30. begin{tikzpicture}
  31. tikzset{bead/.style={circle,fill=black,inner sep=3pt}}
  32. defangle{0}
  33.  
  34. draw node[bead] {} (0,0)
  35. foreach stepangle[evaluate=stepangle as angle using angle+stepangle, remember=angle] in {10,20,-30,-60,135,-20,-30,0}
  36. { -- ++(angle:1) node[bead]{}};
  37. end{tikzpicture}
  38.  
  39. end{document}
  40.  
  41. size(300,300);
  42. real linkLen=1, linkWidth=2pt;
  43. real rl=2+linkLen; // distance between beads
  44. guide g=(1,0)--(1+linkLen,0); // a link
  45. pen beadColor=orange;
  46. pen linkColor=beadColor;
  47. void bead(transform t){
  48. draw(t*g,linkColor+linkWidth);
  49. radialshade(t*unitcircle,
  50. beadColor,shift(t)*(-0.4,0.3),0.01
  51. ,black,shift(t)*(-0.4,0.3),1.5);
  52. }
  53. pair operator>(pair pos=(0,0), real phi){
  54. transform t=shift(pos.x,pos.y)*rotate(phi);
  55. bead(t); // draw a bead with a link
  56. pos+=rl*(Cos(phi),Sin(phi)); // Sin, Cos - in degrees, sin, cos - in radians
  57. return pos;
  58. };
  59.  
  60. pair pos=(0,0); // start point
  61.  
  62. if(exp(1)>pi){ // note that ">" still works the usual way to compare numbers
  63. // this branch is skipped
  64. }else{
  65. pos=pos>0>45>-45>90>135; // draw a bead chain and update the position
  66. pos>0>45>-45>90>135; // continue the chain without updating the start position
  67. beadColor=lightyellow;
  68. linkColor=lightblue;
  69. pos>90>90>90; // draw another branch from saved position, with different colours
  70. }
  71.  
  72. documentclass[10pt,a4paper]{article}
  73. usepackage{lmodern}
  74. usepackage{soul}
  75. usepackage{caption}
  76. usepackage[inline]{asymptote}
  77. defasydir{}
  78. begin{asydef}
  79. // Global Asymptote definitions
  80. real linkLen=1, linkWidth=2pt;
  81. real rl=2+linkLen; // distance between beads
  82. guide link=(1,0)--(1+linkLen,0); // a link
  83. pen beadColor=orange;
  84. pen linkColor=beadColor;
  85. void bead(transform t){
  86. draw(t*link,linkColor+linkWidth);
  87. radialshade(t*unitcircle,
  88. beadColor,shift(t)*(-0.4,0.3),0.01
  89. ,black,shift(t)*(-0.4,0.3),1.5);
  90. }
  91. pair operator>(pair pos=(0,0), real phi){
  92. transform t=shift(pos)*rotate(phi);
  93. bead(t); // draw a bead with a link
  94. pos+=rl*(Cos(phi),Sin(phi)); // Sin, Cos - in degrees, sin, cos - in radians
  95. return pos;
  96. };
  97. pair pos;
  98. end{asydef}
  99.  
  100. begin{document}
  101.  
  102. newcommandhi[1]{bf Hello st{Word} #1!}
  103.  
  104. center
  105. captionof{figure}{Example of bead chain building.}
  106. begin{asy}
  107. size(150,150);
  108. pos>0>60>0>70;
  109. beadColor=lightyellow;
  110. pos>0>-60>0>-70;
  111. pos= pos>0>0>0>0;
  112. label("textbf{Example}",pos,SE);
  113. end{asy}
  114.  
  115. center
  116. captionof{figure}{Another example of bead chain building.}
  117. begin{asy}
  118. size(150,150);
  119. beadColor=lightyellow;
  120. linkColor=lightblue;
  121. pos=pos>90>42>0>0>0>0>0>0>-130;
  122. label(
  123. "parbox{8cm}{"
  124. "The following command texttt{textbackslash hi} is defined \"
  125. +"in the main LaTeX document:\"
  126. "hi{LaTeX}}"
  127. ,pos);
  128. end{asy}
  129.  
  130. end{document}
  131.  
  132. sub asy {return system("asy '$_[0]'");}
  133. add_cus_dep("asy","eps",0,"asy");
  134. add_cus_dep("asy","pdf",0,"asy");
  135. add_cus_dep("asy","tex",0,"asy");
  136.  
  137. documentclass[pstricks,border=12pt]{standalone}
  138. usepackage{pst-plot}
  139.  
  140. defX(#1){#1}
  141. defY(#1){3+2*sin(#1)}
  142.  
  143. psset{algebraic,showpoints,dotscale=3}
  144.  
  145. begin{document}
  146.  
  147. begin{pspicture}(-1,-1)(7,6)
  148. psparametricplot[plotpoints=10]{-0.5}{6.5}{X(t)|Y(t)}
  149. end{pspicture}
  150. end{document}
  151.  
  152. end{document}
  153.  
  154. documentclass[pstricks,border=12pt]{standalone}
  155. usepackage{pst-plot}
  156.  
  157. defX(#1){#1}
  158. defY(#1){3+2*sin(#1)}
  159.  
  160. psset{algebraic,showpoints,dotscale=3}
  161.  
  162. begin{document}
  163.  
  164. multido{i=2+1}{21}{%
  165. begin{pspicture}(-1,-1)(7,6)
  166. psparametricplot[plotpoints=i]{-0.5}{6.5}{X(t)|Y(t)}
  167. end{pspicture}}
  168. end{document}
  169.  
  170. end{document}
  171.  
  172. documentclass[pstricks,border=12pt]{standalone}
  173. usepackage{pstricks-add}
  174.  
  175. begin{document}
  176.  
  177. begin{pspicture}[showgrid](-1,-1)(8,3)
  178. psStartPoint(0,0)
  179. psforeach{i}{10,40,50,-50,0,150,30,-60,45,45,0}{psVector[arrows=-*](1;i)}
  180. end{pspicture}
  181.  
  182. end{document}
  183.  
  184. documentclass[pstricks,border=12pt]{standalone}
  185. usepackage{pst-node}
  186.  
  187. begin{document}
  188.  
  189. begin{pspicture}[showgrid](-1,-1)(8,3)
  190. pnode(0,0){A}
  191. psforeach{i}{10,40,50,-50,0,150,30,-60,45,45,0}{
  192. pnode[!1 ispace PtoC](A){B}
  193. pscircle*(B){4pt}
  194. psline(A)(B)
  195. pnode(B){A}
  196. }
  197. end{pspicture}
  198.  
  199. end{document}
  200.  
  201. draw (0,0) [turtle={beads, right=10, forward, left=20, forward, …}];
  202.  
  203. draw (0,0) [turtle={beads,turn and step/.list={10,20,-30,-60,135,-20,-30,0}}] [bead];
  204.  
  205. documentclass[tikz]{standalone}
  206. usetikzlibrary{turtle}
  207. tikzset{
  208. bead node/.style={circle,fill=black,inner sep=3pt},
  209. bead path/.style={to path={ [bead] -- (tikztotarget)}},
  210. bead/.style={insert path={node[bead node]{}}},
  211. turtle/beads/.style={how/.style={bead path},right},
  212. turtle/turn and step/.style={left=#1,forward}
  213. }
  214. begin{document}
  215. begin{tikzpicture}[turtle/distance=1cm]
  216. draw (0,0) [turtle={beads,turn and step/.list={10,20,-30,-60,135,-20,-30,0}}] [bead];
  217. end{tikzpicture}
  218. end{document}
  219.  
  220. documentclass[margin=.25cm]{standalone}
  221. usepackage{tkz-graph}
  222.  
  223. begin{document}
  224. begin{tikzpicture}
  225. GraphInit[vstyle=Art]% Init the graph and choice a style
  226. SetVertexNoLabel% no label
  227. Vertex{A}
  228. foreach a in {45,10,30,-20,0,-60,-40,-45,-10,-90,+20,0,60,-40}{%
  229. begin{scope}[shift=(A)]% polar from the last vertex
  230. Vertex[a=a , d=1 cm]{B}
  231. Edge[style={thick,double=black,double distance=1pt}](A)(B)
  232. pgfnoderename{A}{B}% rename the node, useful macro here
  233. end{scope}
  234. }
  235. end{tikzpicture}
  236.  
  237. end{document}
  238.  
  239. newcommand{newVertex}[1]{%
  240. begin{scope}[shift=(A)]
  241. Vertex[a=#1 , d=1 cm]{B}
  242. end{scope}
  243. }
  244.  
  245. foreach a in {45,10,30,-20,0,-60,-40,-45,-10,-90,+20,0,60,-40}{%
  246. newVertex{a}
  247. Edge[style={thick,double=black,double distance=1pt}](A)(B)
  248. pgfnoderename{A}{B}
  249. }
Add Comment
Please, Sign In to add comment