3

How do I make an offset border like shown in the attached picture. This looks like it should be done with tikz pretty easily. I can use the "double" option for the node, but I have no idea how to continue for the attachment of the arrow(s).

Example for an offset border

Addition:

In the meantime, I got the following result:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,decorations.markings,arrows}

\begin{document}

\tikzstyle{border_arrow} = [%
  decoration={markings,mark=at position 1 with {\arrow[scale=2,line width=.25pt,red!50]{open triangle 60}}}, %
  red!50, double distance=4.4pt, shorten >= 9.5pt, shorten <= .45mm, %
line width=.5pt, %
  preaction = {decorate}, %
  postaction = {draw,line width=4.4pt, white,shorten >= 8.5pt, shorten <= 1pt}]
\tikzstyle{my_node} = [double,double distance=1mm, inner sep=3mm, text width=2.5cm, align=center,line width=.5pt,font=\sffamily\footnotesize\color{white},draw=red!50, fill=red!50]

\begin{tikzpicture}
\node (data1) [my_node] {Commercial Starting Material};
\node [right=of data1] (A) {}; % phantom node to avoid overlapping
\draw[border_arrow] (data1.east|-A.west) -- (A.west);
\node (data2) [right of=A, my_node,xshift=.6cm] {A $\to$ B $\to$ C $\to$ D};
\end{tikzpicture}

\end{document}

If someone has a more simple way to achieve a similar result, I'm glad to hear it.

  • Please convert your code snipped to complete small document (MWE: Minimal Working Example), which will contain all necessary packages and yours definitions. How it is, can not be compiled. Help us too help you. – Zarko Oct 17 '16 at 14:01
  • I changed it to a MWE, thanks for the advise. – es560 Oct 17 '16 at 14:47
2

I try to reproduce yours provided image:

enter image description here

Of course my code is written from scratch (since your code is not helpful at all ...):

\documentclass[tikz,
                border=3mm]{standalone}
\usetikzlibrary{calc,
                fit,
                positioning,
                shapes}

\begin{document}
\begin{tikzpicture}[
 node distance = 0mm and 12mm,
 databox/.style = {inner sep=3mm, text width=2.4cm, align=center, fill=red,
                   font=\sffamily\footnotesize\bfseries\color{white}
                   },
arrowbox/.style = {arrow box, arrow box  arrows={east:12mm},
                   arrow box shaft width=5mm, arrow box head extend=3mm,
                   draw=red, very thick, inner sep=3mm
                   }
                    ]
\node (data1)   [databox]   {Commercial Starting Material};
\node (A1)      [arrowbox, fit=(data1)] {};
%
\node (data2)   [databox, right=of A1.east]
                            {A $\to$ B $\to$ C $\to$ D};
\node (A2)      [arrowbox, fit=(data2)] {};
\end{tikzpicture}
\end{document}
1

An alternative solution based on a matrix node which has arrowbox style and contains a databox node.

I thought that a matrix node was always rectangular, but now I know it can take whatever shape we want. The matrix only arranges inner nodes.

Based in Zarko's code:

\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{positioning, shapes}

\begin{document}
\begin{tikzpicture}[
     node distance = 0mm and 12mm,
     databox/.style = {rectangle, %<---- added
                   inner sep=3mm, text width=2.4cm,  
                   align=center, fill=red,
                   font=\sffamily\footnotesize\bfseries\color{white}
                   },
     arrowbox/.style = {arrow box, arrow box  arrows={east:12mm},
                   arrow box shaft width=5mm, arrow box head extend=3mm,
                   draw=red, very thick, inner sep=3mm,
                   minimum width=36mm, minimum height=15mm
                   }
                    ]
\matrix[arrowbox] (A1) {\node[databox] {Commercial Starting Material};\\};
\matrix[arrowbox, right=of A1.east] (A1) {%
      \node[databox] {A $\to$ B $\to$ C $\to$ D};\\};
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.