Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass[border=10mm]{standalone}
- usepackage{tikz}
- usetikzlibrary{calc,fit}
- tikzset{
- % When open box is called via edge, draw a rectangle with no top:
- open box/.code={%
- pgfkeysalso{%
- to path={%
- let
- p{start}=(tikztostart),
- p{end}=(tikztotarget)
- in
- (tikztostart) -| (tikztotarget)
- (x{start},y{start}) -- (x{start},y{end})
- % Make a fitted node to get good anchors
- node[fit={(tikztostart)(tikztotarget)}, inner sep=0pt](#1){}
- }
- }
- }
- }
- begin{document}
- begin{tikzpicture}
- draw (0,0) edge[open box={therect}] (2,2);
- % How can this be switched with e.g: %<---
- % draw (0,0) open box[name=therect] (2,2) %<---
- node at (therect.center){RECT!};
- end{tikzpicture}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement