Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. documentclass[border=10mm]{standalone}
  2. usepackage{tikz}
  3. usetikzlibrary{calc,fit}
  4. tikzset{
  5. % When open box is called via edge, draw a rectangle with no top:
  6. open box/.code={%
  7. pgfkeysalso{%
  8. to path={%
  9. let
  10. p{start}=(tikztostart),
  11. p{end}=(tikztotarget)
  12. in
  13. (tikztostart) -| (tikztotarget)
  14. (x{start},y{start}) -- (x{start},y{end})
  15. % Make a fitted node to get good anchors
  16. node[fit={(tikztostart)(tikztotarget)}, inner sep=0pt](#1){}
  17. }
  18. }
  19. }
  20. }
  21.  
  22. begin{document}
  23. begin{tikzpicture}
  24. draw (0,0) edge[open box={therect}] (2,2);
  25. % How can this be switched with e.g: %<---
  26. % draw (0,0) open box[name=therect] (2,2) %<---
  27. node at (therect.center){RECT!};
  28. end{tikzpicture}
  29. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement