bounding-box-lines-3.tex 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. \documentclass{article}
  2. \usepackage[pdftex,active,tightpage]{preview}
  3. \setlength\PreviewBorder{0mm}
  4. \usepackage{tkz-fct}
  5. \usetikzlibrary{arrows, decorations.pathreplacing}
  6. \usetikzlibrary{shapes.misc}
  7. \tikzset{
  8. line/.style={
  9. very thick,
  10. black,
  11. to path={% works only with "to" and not "--"
  12. -- (\tikztotarget) node[at start,point] {} node [at end,point] {} \tikztonodes
  13. }
  14. },
  15. point/.style={
  16. ultra thick,
  17. draw=gray,
  18. cross out,
  19. inner sep=0pt,
  20. minimum width=4pt,
  21. minimum height=4pt,
  22. },
  23. }
  24. \begin{document}
  25. \begin{preview}
  26. \begin{tikzpicture}
  27. \draw[white,fill=white] (-0.5,-0.5) rectangle (7.2,5.2); % background
  28. \draw[red!15,fill=red!15] (1,4) rectangle (4,2); % bounding box
  29. \draw[blue!15,fill=blue!15] (2,1) rectangle (4,2); % bounding box
  30. \tkzInit [xmin=0,xmax=6.5,ymin=0,ymax=4.5]
  31. \begin{scriptsize}
  32. \tkzGrid[color = gray!30!white]
  33. \tkzAxeXY
  34. \end{scriptsize}
  35. \draw[line,red] (2,1) to (4,2);
  36. \draw[line,blue] (1,4) to (4,2);
  37. \end{tikzpicture}
  38. \end{preview}
  39. \end{document}