1

I would like to display this result :

Expected result

This is my code :

\begin{tikzpicture}
\begin{scope}[start chain=1 going below, start chain=2 going right, start chain=3 going right]
        \node[on chain=1] (a) {a};
        \node[on chain=1] (b) {b};
        \node[on chain=1] (c) {c};


    \chainin (a);
        \node[on chain=2] (d) {d};
        \node[continue chain=going below,on chain=2] (e) {e};
        \node[on chain=2] (f) {f};


    \chainin (d);
        \node[on chain=3] (g) {g};
        \node[continue chain=going below,on chain=3] (h) {h};
        \node[on chain=3] (i) {i};
\end{scope}
\end{tikzpicture}

This is the result of the code :

Bad result

What is the correct way to code this please?

1
  • Welcome to TeX.SE! Please always provide a small but complete document (MWE: Minimal Working Example) beginning with \documentclass and ending with \end{document}, which we can test as it is. Please, help people who will be willing to help you.
    – Zarko
    Jun 24, 2019 at 8:14

1 Answer 1

4

enter image description here

One of possible solutions is:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{chains, positioning}

\begin{document}
    \begin{tikzpicture}[
node distance = 8mm,
  start chain = going right,
every node/.append style = {on chain}
                        ]
\node   (a) {a};
\node   (b) {b};
\node   (c) {c};

\node[below=of a] (d) {d};
\node   (e) {e};
\node   (f) {f};

\node[below=of d] (g) {g};
\node   (h) {h};
\node   (i) {i};
\end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .