line-segments-f1.tex 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. \documentclass{article}
  2. \usepackage{gensymb}
  3. \usepackage[pdftex,active,tightpage]{preview}
  4. \setlength\PreviewBorder{2mm}
  5. \usepackage{tikz}
  6. \usetikzlibrary{arrows, calc, positioning,decorations.pathreplacing,shapes}
  7. \tikzset{
  8. %Define standard arrow tip
  9. >=stealth',
  10. % Define arrow style
  11. pil/.style={
  12. ->,
  13. thick},
  14. line/.style={
  15. very thick,
  16. black,
  17. to path={% works only with "to" and not "--"
  18. -- (\tikztotarget) node[at start,point] {} node [at end,point] {} \tikztonodes
  19. }
  20. },
  21. point/.style={
  22. thick,
  23. draw=gray,
  24. cross out,
  25. inner sep=0pt,
  26. minimum width=4pt,
  27. minimum height=4pt,
  28. },
  29. }
  30. \begin{document}
  31. \begin{preview}
  32. \begin{tikzpicture}
  33. \newcommand\MinX{0}
  34. \newcommand\MinY{0}
  35. \newcommand\MaxX{7}
  36. \newcommand\MaxY{7}
  37. % Coordinate system
  38. \draw [<->, thick, red] (0,{\MaxY+0.5}) -- (0,0) -- ({\MaxX+0.5},0);
  39. \coordinate (A) at (3,4);
  40. \coordinate (B) at (4,5);
  41. \coordinate (C) at (2,2);
  42. \coordinate (D) at (6,6);
  43. % \draw[color=orange, very thick, fill=orange!20] (A) -- (B) -- cycle;
  44. \draw[line] (A) -- (B);
  45. \draw[line] (C) -- (D);
  46. \draw[step=0.5cm,color=gray] ({\MinX-0.25}, {\MinY-0.25}) grid ({\MaxX+0.25},{\MaxY+0.25});
  47. \path[every node/.style={point}]
  48. node at (A) {}
  49. node at (B) {}
  50. node at (C) {}
  51. node at (D) {};
  52. \end{tikzpicture}
  53. \end{preview}
  54. \end{document}