On the left I have created two nodes (Zero Node
in blue and One Node
in gray) and would like to draw over the existing path from A-B-C-D (including the notches).
On the right is my attempt drawn in red, which isn't quite right.
How can I do a better job at this and is there an easier way to do this?
Code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit}
\tikzset{Node Style Gray/.style={
rounded corners,
minimum width=3cm,
minimum height=2cm,
draw=gray,
ultra thick,
inner sep=0pt,
opacity=0.5,
}}
\tikzset{Node Style Blue/.style={
rounded corners,
minimum width=3cm,
minimum height=2cm,
draw=blue,
thick,
inner sep=0pt,
}}
\begin{document}
\begin{tikzpicture}
\node (Zero) at (0,0) {0};
\node (One) at (0,3) {1};
\node [Node Style Blue, fit={(Zero) }] (Zero Node) {};
\node [Node Style Gray, fit={(Zero Node) (One)}] (One Node) {};
\node [right] at (Zero Node.north east) {A};
\node [left] at (Zero Node.north west) {B};
\node [left] at (One Node.north west) {C};
\node [right] at (One Node.north east) {D};
%% ------------------------------------------- My attempt
\draw [rounded corners, red, ultra thick]
(One Node.north east)
-- (One Node.north west)
-- ([yshift=-1.0ex]One Node.north west |- Zero Node.north west)
-- ++(0,1.0ex)
-| ([yshift=-1.0ex]Zero Node.north east -| One Node.north east)
--cycle
;
\end{tikzpicture}
\end{document}