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.

My problem is quite simple, yet i can't find answer. Pre:

\usetikzlibrary{matrix, shapes, arrows, positioning, fit, calc}


\tikzstyle{decision} = [diamond, draw, fill=blue!20, 
                        text width=6em, text badly centered, node distance=3cm, inner sep=0pt]
    \tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=9em, text centered, rounded corners, minimum height=2.5em]
    \tikzstyle{label} = [draw=white!0, minimum size=2ems]
    \tikzstyle{line} = [draw, -latex']
    \tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,
        minimum height=2em]
                    minimum size=1cm,
    \tikzstyle{connector} = [->,thick]
    \tikzstyle{pusty}=[draw=white, minimum size=2em]

Im using myncbar macro to create C-like shapes:

      arm/.code={\def\myarm{#1}}, % store value in \myarm
      angle/.code={\def\myangle{#1}} % store value in \myangle

    myncbar/.style = {to path={
        % We need to calculate a couple of coordinates to help us draw
        % the path. 
            % Same as (\tikztotarget)++(\myangle:\myarm)
            -- ++(\myangle:\myarm) coordinate (tmp)
            % Find the projection of the (tmp) coordinate
            % on the line from the target to p1
            -- ($(\tikztotarget)!(tmp)!(\p1)$)
            -- (\tikztotarget)\tikztonodes

And my code is:

        \begin{tikzpicture}[node distance = 2cm, auto]
            % Place nodes
            \node [decision] (init) {Minął określony czas?};
            \node [block, below of=init, node distance = 3cm] (oblicz) {Oblicz różnicę temperatur};
            \node [decision, below of=oblicz, node distance=3.5cm] (roznica) {Róznica powyżej zadanego poziomu?};
            \node [decision, below of=roznica, node distance=5.5cm] (otwarte) {Przepustnice otwarte maksymalnie i temperatura spada?};
            \node [block, right of=otwarte, node distance=5.5cm] (ostrzezenie) {Wyświetl ostrzeżenie o kończącym się paliwie};
            \node [block, below of=otwarte, node distance=4cm] (kat) {Oblicz kąt otwarcia przepustnic};
            \node [block, below of=kat, node distance=2cm] (servo) {Ustaw serwomechanizmy};
            \node [block, below of=servo, node distance=2cm] (koniec) {Koniec};

            % Draw edges
            \path [line] (init) -- node [near start] {Tak} (oblicz);
            \path [line] (init.west) to[myncbar,angle=0,arm=-2cm] node [near start] {Nie} (koniec.west);
            \path [line] (oblicz) -- (roznica);
            \path [line] (roznica) -- node [near start] {Tak} (otwarte);
            \path [line] (roznica.east) to[myncbar,angle=0,arm=6cm] node [near start] {Nie} (koniec.east);
            \path [line] (otwarte) -- node [near start] {Tak} (ostrzezenie);
            \path [line] (otwarte) -- node [near start] {Nie} (kat);
            \path [line] (kat) -- (servo);
            \path [line] (servo) -- (koniec);
            \path [line] (ostrzezenie) -- (koniec);
        \caption{Algorytm obsługi kotła}

And my problem is in this line:

\path [line] (init.west) to[myncbar,angle=0,arm=-2cm] node [near start] {Nie} (koniec.west);
\path [line] (roznica.east) to[myncbar,angle=0,arm=6cm] node [near start] {Nie} (koniec.east);

Text labels are not near start. They are near the start of the last line. Is it possible to make them near start of the first line?

share|improve this question
A complete code that we can compile (MWE) is better to answer a question ! –  Alain Matthes Jan 2 '12 at 16:18
I edited it adding code needed to compile Hope it helps –  Kaminari Jan 2 '12 at 16:55

1 Answer 1

up vote 2 down vote accepted

I guess it's hardly possible to easily refer to the first part of such a composite path. However, you could use near start with an invisible copy of the first part.

You could replace

\path [line] (roznica.east) to[myncbar,angle=0,arm=6cm]
      node [near start] {Nie} (koniec.east);


\path [line] (roznica.east) to[myncbar,angle=0,arm=6cm] (koniec.east);
\path (roznica.east) -- node [near start] {Nie} ++(6cm,0);

node near start of composite path

share|improve this answer
Thank you very much, i didn't know you can just do something like: ++(6cm,0) –  Kaminari Jan 2 '12 at 17:01
BTW how should i connect ostrzezenie and koniec? Now it's just a straight line and it doesn't look good. –  Kaminari Jan 2 '12 at 17:10
@Kaminari \path [line] (ostrzezenie) to [bend left] (koniec); looks better. –  Stefan Kottwitz Jan 2 '12 at 17:17
Thanks again, it really looks much better! –  Kaminari Jan 2 '12 at 17:41

Your Answer


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.