Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This is my first attemp with Tikz environment. I'm drawing the diagram that follows:

Tikz diagram

How can I draw the edges in a way that the ends match with the center of the rectangles' edges (red dots in the picture)?

Code:

\tikzset{
  block/.style={rectangle, text width=8em, minimum height=4ex, text centered, draw=black, fill=orange!30},
  arrow/.style={draw, thick,->,>=stealth},
}
\begin{tikzpicture}[node distance=1cm]
    \node [block] (dev-team) {Development team};
    \node [block, below=of dev-team] (git-repo) {Git repository};
    \node [block, below=of git-repo] (jenkins) {Jenkins};
    \node [block, right=of jenkins, yshift=1.5cm] (unit-tests) {unit tests};
    \node [block, right=of jenkins, yshift=0.5cm] (localisation) {localisation};
    \node [block, right=of jenkins, yshift=-0.5cm] (code-quality) {code quality};
    \node [block, right=of jenkins, yshift=-1.5cm] (ui-automation)  {UI automation};
    \node [block, below=of jenkins] (testflight) {Testflight};
    \node [block, below=of testflight, text width=2em, xshift=-1.5cm] (PO) {PO};
    \node [block, below=of testflight, text width=2em, xshift=-0.5cm] (BA) {BA};
    \node [block, below=of testflight, text width=2em, xshift=0.5cm] (DM) {DM};
    \node [block, below=of testflight, text width=2em, xshift=1.5cm] (QA) {QA};

    \path [arrow] (dev-team) -- (git-repo);
    \path [arrow] (git-repo) -- (jenkins);
    \path [arrow] (jenkins) -- (unit-tests);
    \path [arrow] (jenkins) -- (localisation);
    \path [arrow] (jenkins) -- (code-quality);
    \path [arrow] (jenkins) -- (ui-automation);
    \path [arrow] (jenkins) -- (testflight);
    \path [arrow] (testflight) -- (PO);
    \path [arrow] (testflight) -- (BA);
    \path [arrow] (testflight) -- (DM);
    \path [arrow] (testflight) -- (QA);
\end{tikzpicture}

By the way, is there any better option to position the "childs" of nodes 'Jenkins' and 'Testflight'? I've tried the child option but with no success.

share|improve this question
1  
Specify the anchors: (testflight.south)--(PO.north). –  Claudio Fiandrino Feb 11 at 14:05

1 Answer 1

up vote 7 down vote accepted

You can use the <name>.<anchor> syntax:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\tikzset{
  block/.style={rectangle, text width=8em, minimum height=4ex, text centered, draw=black, fill=orange!30},
  arrow/.style={draw, thick,->,>=stealth},
}
\begin{tikzpicture}[node distance=1cm]
    \node [block] (dev-team) {Development team};
    \node [block, below=of dev-team] (git-repo) {Git repository};
    \node [block, below=of git-repo] (jenkins) {Jenkins};
    \node [block, right=of jenkins, yshift=1.5cm] (unit-tests) {unit tests};
    \node [block, right=of jenkins, yshift=0.5cm] (localisation) {localisation};
    \node [block, right=of jenkins, yshift=-0.5cm] (code-quality) {code quality};
    \node [block, right=of jenkins, yshift=-1.5cm] (ui-automation)  {UI automation};
    \node [block, below=of jenkins] (testflight) {Testflight};
    \node [block, below=of testflight, text width=2em, xshift=-1.5cm] (PO) {PO};
    \node [block, below=of testflight, text width=2em, xshift=-0.5cm] (BA) {BA};
    \node [block, below=of testflight, text width=2em, xshift=0.5cm] (DM) {DM};
    \node [block, below=of testflight, text width=2em, xshift=1.5cm] (QA) {QA};

    \path [arrow] (dev-team) -- (git-repo);
    \path [arrow] (git-repo) -- (jenkins);
    \path [arrow] (jenkins.east) -- (unit-tests.west);
    \path [arrow] (jenkins.east) -- (localisation.west);
    \path [arrow] (jenkins.east) -- (code-quality.west);
    \path [arrow] (jenkins.east) -- (ui-automation.west);
    \path [arrow] (jenkins) -- (testflight);
    \path [arrow] (testflight.south) -- (PO.north);
    \path [arrow] (testflight.south) -- (BA.north);
    \path [arrow] (testflight.south) -- (DM.north);
    \path [arrow] (testflight.south) -- (QA.north);
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
So simple! That did it. Thanks. –  Renato Rodrigues Feb 11 at 14:10
    
Is it possible to position the childs side-by-side without manual values? –  Renato Rodrigues Feb 11 at 14:31
1  
@RenatoRodrigues you could use the powerful forest package. –  Gonzalo Medina Feb 11 at 14:32
    
Thank you. I will give it a try. –  Renato Rodrigues Feb 11 at 14:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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