5

How can I draw nodes horizontally listed next to each other but with two nodes vertically listed as in the figure.

enter image description here

MWE:

\documentclass[border=10pt]{standalone}

\usepackage{tikz}

\usetikzlibrary{shapes,arrows,positioning}

\begin{document}

\tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=4.5em, text centered, rounded corners, minimum height=2.5em, font=\footnotesize, fill opacity=0.3, text opacity=1]

\begin{tikzpicture}[node distance=0.5cm]
    \node [block] (a1) {A1};

    \node [block, right=of a1] (a2) {A2};
    \node [block, right=of a2] (a3) {A3};
    \node [block, right=of a3] (a4) {A4};
\end{tikzpicture}

\end{document}
1
  • Note that \tikzstyle is deprecated.
    – cfr
    Jun 8, 2016 at 23:37

1 Answer 1

5

You can use above right or below right as a possible parameter for node.

For instance:

\node [block, above right=of a1] (a2) {A2};

You can also use seperate distances for above or right:

\node [block, above right=2cm and 1cm of a1] (a2) {A2};

To recreate your image example, you'd use:

\node [block, right=of a1] (a2) {A2};
\node [block, above right=of a2] (a3) {A3};
\node [block, below right=of a2] (a3b) {A3b};
\node [block, below right=of a3] (a4) {A4};

Output of above LaTeX code

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.