The description of the problem is still somehow vague, but perhaps something like this could help:
\documentclass{article}
\usepackage{tikz}
\newcommand\TBox[3][]{%
\tikz\node[draw,ultra thick,text width=#2,align=left,#1] {#3};}
\begin{document}
\TBox{5cm}{%
\TBox[fill=brown]{3cm}{\TBox[fill=red!30]{1cm}{B}\hfill\TBox[fill=cyan!30]{1cm}{C}} \\[1ex]
\TBox[fill=green!30]{1cm}{D}\quad\TBox[fill=yellow!30]{1cm}{E}}
\end{document}
\Tbox
has three arguments: the (first) optional argument can be used to pass options to the rectangular \node
for the box; the second argument specifies the text width, and the third argument is used for the contents.
After the comments, this can be closer to the desired result; now \TBox
has one optional argument (to pass options to the node) and one mandatory argument (the contents of the box):
\documentclass{article}
\usepackage{tikz}
\newcommand\TBox[2][]{%
\tikz\node[draw,ultra thick,align=left,#1] {#2};\hskip2pt}
\begin{document}
\TBox{%
\TBox[fill=brown]{Some test text \\ \TBox[fill=red!30]{Some}\TBox[fill=cyan!30]{A}} \\
\TBox[fill=green!30]{B}\TBox[fill=yellow!30]{Text}}
\end{document}
You can use positioning
library and a useful reading will be this question. Further, tikzstyle
is deprecated, use tikzset
instead.
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,shapes.geometric}
\begin{document}
\begin{tikzpicture}[>=latex']
\tikzset{block/.style= {draw, rectangle, align=center,minimum width=2cm,minimum height=1cm},
rblock/.style={draw, shape=rectangle,rounded corners=1.5em,align=center,minimum width=2cm,minimum height=1cm},
input/.style={ % requires library shapes.geometric
draw,
trapezium,
trapezium left angle=60,
trapezium right angle=120,
minimum width=2cm,
align=center,
minimum height=1cm
},
}
\node [rblock] (start) {Start};
\node [block, right =2cm of start] (acquire) {Acquire Image};
\node [block, right =2cm of acquire] (rgb2gray) {RGB to Gray};
\node [block, right =2cm of rgb2gray] (otsu) {Localized OTSU \\ Thresholding};
\node [block, below right =2cm and -0.5cm of start] (gchannel) {Subtract the \\ Green Channel};
\node [block, right =2cm of gchannel] (closing) {Morphological \\ Closing};
\node [block, right =2cm of closing] (NN) {Sign Detection \\ Using NN};
\node [input, right =2cm of NN] (limit) {Speed \\ Limit};
\node [coordinate, below right =1cm and 1cm of otsu] (right) {}; %% Coordinate on right and middle
\node [coordinate,above left =1cm and 1cm of gchannel] (left) {}; %% Coordinate on left and middle
%% paths
\path[draw,->] (start) edge (acquire)
(acquire) edge (rgb2gray)
(rgb2gray) edge (otsu)
(otsu.east) -| (right) -- (left) |- (gchannel)
(gchannel) edge (closing)
(closing) edge (NN)
(NN) edge (limit)
;
\end{tikzpicture}
\end{document}
Best Answer
Here is a solution with
chains
. You can adjust spacing however you like. The key to getting the placement right is to use\tikzchainprevious
andanchor=
as in the code below.If you add
every node/.style=join, every join/.style={red,->}
to thetikzpicture
options, you can see the chain sequence: