[Tex/LaTex] Drawing a rectangular shape with a border around it in TikZ

nodestikz-pgf

Could anyone please tell me how do I draw a rectangular shape with a black border around it?

I want that for all my rectangles in the following TikZ picture:

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[every node/.style = {shape          = rectangle,
                                         rounded corners,
                                         fill           = black!30!white,
                                         minimum width  = 3cm,
                                         minimum height = 1.5cm,
                                         align          = center,
                                         text           = black},
                   black edge/.style  = { -,
                                         ultra thick,
                                         black,
                                         shorten >= 2pt}]

% the nodes : possible  \newcommand*\dx{5} \newcommand*\dy{2}
\node(0;0) at (5,0) {Patients};
  \node(1;1)  at (10, 2) {Treatment $A_1$};
  \node(1;-1) at (10,-2) {Treatment $A_2$};
\foreach \j in {-1,1}
  { \draw[black edge] (0;0.east) -- (1;\j.west); }
\end{tikzpicture}
\end{document}

Best Answer

You can use draw,double=<color>,double distance = <dimen> in every node style.:

\documentclass{article}

\setlength{\parindent}{0mm}

\usepackage{paralist}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[every node/.style = {shape          = rectangle,
                                         rounded corners,
                                         draw,                    %% here
                                         double=red,              %% here
                                         double distance =1pt,    %% here
                                         fill           = black!30!white,
                                         minimum width  = 3cm,
                                         minimum height = 1.5cm,
                                         align          = center,                                         
                                         text           = black},
                   black edge/.style  = { -,
                                         ultra thick,
                                         black,
                                         shorten >= 2pt}]

% the nodes : possible  \newcommand*\dx{5} \newcommand*\dy{2}
\node(0;0) at (5,0) {Patients};
  \node(1;1)  at (10, 2) {Treatment $A_1$};
  \node(1;-1) at (10,-2) {Treatment $A_2$};
\foreach \j in {-1,1}
  { \draw[black edge] (0;0.east) -- (1;\j.west); }
\end{tikzpicture}

\end{document}

If you don't want color, use simple double instead of double=<color>.

enter image description here