3

How can I draw straight vertical arrow in my tikzpicture using

\draw[arrow](position1)--node{text}(position2);

My diagram looks like

\tikzstyle{kaesten}=[rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, text width=4cm, text=TUMWhite, fill=TUMBlue]

\tikzstyle{pdm}=[rectangle, rounded corners, minimum width=5cm, minimum height=2cm, text centered, text=TUMWhite, fill=TUMBlue1]

\tikzstyle{arrow}=[thick,->,>=stealth]
\tikzstyle{arrow_beidseitig}=[thick,<->,>=stealth]

\begin{figure}[H]
\centering
\begin{tikzpicture}[node distance=3.5cm]
\node(aenderungsverwaltung)[kaesten, scale=0.7]{Änderungsverwaltung};
\node(verwaltung)[kaesten, below of=aenderungsverwaltung, scale=0.7]{Verwaltung freigegebener Dokumente};
\node(freigabe)[kaesten, left of=verwaltung, scale=0.7]{Freigabe};
\node(konstruktion)[kaesten, left of=freigabe, scale=0.7]{Konstruktion};
\node(fertigungsvorbereitung)[kaesten, right of=verwaltung, scale=0.7]{Fertigungsvorbereitung};
\node(fertigung)[kaesten, right of=fertigungsvorbereitung, scale=0.7]{Fertigung};
\node(pdm)[pdm, text width=14cm, below of=verwaltung,scale=0.7]{Product Data Management (PDM)
\begin{itemize}
    \color{TUMWhite}
    \item Archivierung
    \item Datenmanagement
    \item Prozessmanagement
    \item dokumentenorientiert
\end{itemize}
};

\footnotesize
\draw [arrow] (aenderungsverwaltung) -| node[align=left, anchor=south]{Änderungsauftrag} (konstruktion);
\draw[arrow] (konstruktion) -- (freigabe);
\draw[arrow] (freigabe)--(verwaltung);
\draw[arrow] (verwaltung)--(fertigungsvorbereitung);
\draw[arrow] (fertigungsvorbereitung)--(fertigung);
\draw[arrow_beidseitig] (konstruktion)|-node[align=left, anchor=east]{\hspace*{-1.5cm}Laufende \\ \hspace*{-1.5cm}Arbeiten}(pdm);
\draw[arrow_beidseitig] (freigabe)--node[align=left, anchor=south west]{\hspace*{-3cm}Freigegebene \\ \hspace*{-3cm}Konstruktion}(pdm);
\draw[arrow_beidseitig] (verwaltung)--node[align=left, anchor=south east]{\hspace*{4cm}Zugriff auf \\ \hspace*{4cm}Konstruktionen}(pdm);
\draw[arrow_beidseitig] (fertigungsvorbereitung)--node[align=left]{\hspace*{4cm}Freigegebene \\ \hspace*{4cm}Konstruktionen}(pdm);
\draw[arrow] (fertigungsvorbereitung)|-(aenderungsverwaltung);
\draw[arrow] (fertigung)|-node[anchor=south]{Änderungsanforderung}(aenderungsverwaltung);



\end{tikzpicture}
\caption{Informationsfluss in Konstruktion und Entwicklung}
\label{fig:informationsfluss}
\end{figure}

enter image description here

How can I adjust my code to get straight lines like in the following figure

enter image description here

Thank you so much for your help.

2
  • 1
    Hi and welcome, please give a fully compilable code.
    – AndréC
    Commented Oct 21, 2020 at 14:08
  • 2
    Welcome to TeX:SE! Please extend your code fragment to small but complete document beginning with \documentclass and ending with `\end{document}. IN preamble let be loaded only necessary packages and libraries and your definitions used in picture.
    – Zarko
    Commented Oct 21, 2020 at 14:10

2 Answers 2

7

I replaced your TUM.. colours by standard colour names, as you didn't provide those definitions.

To answer your specific question, use e.g. (freigabe|-pdm.north) as the end coordinate. See TikZ: What EXACTLY does the the |- notation for arrows do? for an explanation of perpendicular coordinates.


In the code below I also modernized a couple of things. Generally, \tikzset{foo/.style={..},bar/.style={..}} is recommended over \tikzstyle{foo}=[..]. And the right of=.. syntax is deprecated, instead load the positioning library and use right=of .. (Difference between "right of=" and "right=of" in PGF/TikZ).

Finally, instead of using things like node[left] {\hspace{<length>}..., pass a length to left, i.e. node[left=5mm] {.... It's also possible to use e.g. node[xshift=1cm,yshift=2cm] ...

enter image description here

\documentclass[border=5mm]{standalone}  
\usepackage{tikz}  
\usetikzlibrary{positioning}
\tikzset{
 kaesten/.style={rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, text width=4cm, text=white, fill=blue},
 pdm/.style={rectangle, rounded corners, minimum width=5cm, minimum height=2cm, text centered, text=white, fill=blue},
 arrow/.style={thick,->,>=stealth},
 arrow_beidseitig/.style={thick,<->,>=stealth}
}
\begin{document}  

\begin{tikzpicture}[node distance=2.5cm and 1cm]
\node(aenderungsverwaltung)[kaesten, scale=0.7]{Änderungsverwaltung};
\node(verwaltung)[kaesten, below=of aenderungsverwaltung, scale=0.7]{Verwaltung freigegebener Dokumente};
\node(freigabe)[kaesten, left=of verwaltung, scale=0.7]{Freigabe};
\node(konstruktion)[kaesten, left=of freigabe, scale=0.7]{Konstruktion};
\node(fertigungsvorbereitung)[kaesten, right=of verwaltung, scale=0.7]{Fertigungsvorbereitung};
\node(fertigung)[kaesten, right=of fertigungsvorbereitung, scale=0.7]{Fertigung};
\node(pdm)[pdm, text width=14cm, below=of verwaltung,scale=0.7]{Product Data Management (PDM)
\begin{itemize}
%    \color{TUMWhite}
    \item Archivierung
    \item Datenmanagement
    \item Prozessmanagement
    \item dokumentenorientiert
\end{itemize}
};

\footnotesize
\draw [arrow] (aenderungsverwaltung) -| node[align=left, anchor=south]{Änderungsauftrag} (konstruktion);
\draw[arrow] (konstruktion) -- (freigabe);
\draw[arrow] (freigabe)--(verwaltung);
\draw[arrow] (verwaltung)--(fertigungsvorbereitung);
\draw[arrow] (fertigungsvorbereitung)--(fertigung);

\draw[arrow_beidseitig] (konstruktion)|-node[align=left, left]{Laufende \\ Arbeiten}(pdm);
\draw[arrow_beidseitig] (freigabe)--node[align=left, left]{Freigegebene \\ Konstruktion}(freigabe|-pdm.north);
\draw[arrow_beidseitig] (verwaltung)--node[align=left, left]{Zugriff auf \\ Konstruktionen}(pdm);
\draw[arrow_beidseitig] (fertigungsvorbereitung)--node[align=left,left]{Freigegebene \\ Konstruktionen}(fertigungsvorbereitung|-pdm.north);
\draw[arrow] (fertigungsvorbereitung)|-(aenderungsverwaltung);
\draw[arrow] (fertigung)|-node[anchor=south]{Änderungsanforderung}(aenderungsverwaltung);
\end{tikzpicture}
\end{document}  
6
  • 3
    For future questions, please do provide complete examples that can be compiled without making any modifications. Having to figure out things like custom colours and additional libraries is frankly a bit annoying at times :) Commented Oct 21, 2020 at 14:20
  • 1
    Too many things to list, you beat me to it lol. I almost thought about just providing a custom example for the |- operation.
    – Alenanno
    Commented Oct 21, 2020 at 14:22
  • 1
    I would also add these to the list of suggestions: 1. "use short node names", typing fertigungsvorbereitung 12 times gets boring fast. 2. If there are many \draw commands, only the first is really needed, the other ones can be omitted putting a ; in the end.
    – Alenanno
    Commented Oct 21, 2020 at 14:23
  • 1
    Also, if there are many nodes in a row, many a chain is in order, but that's a matter of taste/need.
    – Alenanno
    Commented Oct 21, 2020 at 14:26
  • 1
    shucks missed by few minutes -- that was quick @TorbjørnT.
    – js bibra
    Commented Oct 21, 2020 at 14:32
3

Mainly off-topic (where are between others considered @ Alenanno comments) of nice @Torbjørn T. answer (+1):

\documentclass[tikz, margin=3.14159mm]{standalone}
\usetikzlibrary{arrows.meta,
                chains,
                fit,
                positioning,
                quotes}
\usepackage{enumitem}

\begin{document}
\tikzset{
kaesten/.style args = {#1/#2}{rectangle, rounded corners, fill=#1,
                  text width=#2, minimum height=1cm,
                  align=center, text=yellow},
kaesten/.default = cyan!90!black/42mm,
    arr/.style = {-Stealth, semithick},
    alr/.style = {Stealth-Stealth, semithick},
    lbl/.style = {font=\footnotesize, align=left, #1},% #1=positioing
    lbl/.default = left
        }

    \begin{tikzpicture}[scale=0.7,
node distance = 12mm and 3mm,
  start chain = A going right
                        ]
    \begin{scope}[nodes={kaesten, on chain=A, join=by arr}]
\node   {Konstruktion};     % name: A-1
\node   {Freigabe};
\node   {Verwaltung freigegebener Dokumente};
\node   {Fertigungsvorbereitung};
\node   {Fertigung};        % name: A-5
    \end{scope}
\node (A-0) [kaesten, 
             above=of A-3] {Änderungsverwaltung};

\node (pdm) [kaesten=cyan!80!black/42mm,
             fit=(A-2) (A-4),
             inner xsep=0ex, inner ysep=3.3ex, 
             below=of A-3] {\hfil\textbf{Product Data Management (PDM)}
\begin{itemize}[nosep]
    \item Archivierung
    \item Datenmanagement
    \item Prozessmanagement
    \item dokumentenorientiert
\end{itemize}
};
% above chain
\draw [arr] (A-0) -| node[lbl=above] {Änderungsauftrag}      (A-1);
\draw [arr] (A-5) |- node[lbl=above] {Änderungsanforderung}  (A-0);
\draw       (A-4) -- (A-4 |- A-0);
% below chain
\draw[alr] (A-1) |- node[lbl]  {Laufende \\ Arbeiten}  (pdm);
%
\draw[alr] (A-2) -- node[lbl]  {Freigegebene \\ Konstruktionen} (A-2 |- pdm.north);
\draw[alr] (A-3) -- node[lbl]  {Zugriff auf  \\ Konstruktion}   (A-3 |- pdm.north);
\draw[alr] (A-4) -- node[lbl]  {Freigegebene \\ Konstruktionen} (A-4 |- pdm.north);
    \end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

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