bounding-box-lines-1.tex 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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[blue!15,fill=blue!15,ultra thick] (1,4) rectangle (6,1); % bounding box
  29. \draw[red!15,fill=red!15] (1,1) rectangle (4,4); % 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] (1,1) to (4,4);
  36. \draw[line,blue] (1,4) to (6,1);
  37. \end{tikzpicture}
  38. \end{preview}
  39. \end{document}