TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've tried to manually put labels (1-2-3-4) on the arrows tip in the center of the connection lines but it seems not working good..How can i fix this?

enter image description here



\tikzset{deco/.style={decoration={markings, mark=at position #1 with {\arrow{>} }},postaction={decorate}}}
\tikzset{trape/.style={trapezium,draw,shape border rotate=90,minimum width=2cm}}
\tikzset{box/.style={rectangle,draw,minimum height=1cm,minimum width=2.5cm}}
\tikzset{cerchi/.style={circle,draw,minimum size=1cm}}

\matrix [row sep={1.5cm}]
                            &[2cm]  \node [box] (genera) {}; &[2cm]                         &[1cm] \\
 \node [cerchi] (pompa) {}; &                                & \node [trape] (turbina) {};  & \node [cerchi] (ultiliz) {}; \\
                            & \node [cerchi] (condensa) {};  &                              &      \\

\begin{scope}[>=triangle 60]
 \draw [deco=0.6]  (genera)                      -|  node[pos=0.6]{2} (turbina.top right corner);
 \draw [deco=0.6]  (turbina.bottom left corner) |-   node[above=1mm,pos=0.71]{3} (condensa);
 \draw [deco=0.4]  (condensa)                    -|  node[above=1mm,pos=0.31]{4} (pompa);
 \draw [deco=0.6]  (pompa)                      |-   node[below=1mm,pos=0.63]{1} (genera);

\draw [->,>=latex,very thick, shorten >=4 pt,shorten <=4pt] (pompa.south)--(pompa.north);

\node [coordinate] (B) at ($ (condensa.center)!.6!(condensa.west) $) {};
\node [coordinate] (C) at ($ (condensa.center)!.6!(condensa.east) $) {};
\node [coordinate] (A) at ($ (B)+(0,-1.5cm)$) {};
\node [coordinate] (D) at ($ (C)+(0,-1.5cm)$) {};
\draw (A)--(B);
\draw[decorate,decoration={zigzag,amplitude=3pt,segment length=8pt}] (B)--(C);
\draw (C)--(D);

share|improve this question
I find it hard to follow your example because of all the stuff that is not related to the problem. If you trim it down to the essentials and provide a real Minimal Working Example, that may help people answer your actual question. – Fritz May 6 '12 at 16:01
Maybe I find the way...I will post in 5 hours – Angelo May 6 '12 at 17:41
up vote 3 down vote accepted

As I commented on one of your questions you can add a node to your deco style for numbering the arrows. Here is a customized version of it that puts the number always to the left of the line (relative to the direction). Change the -90 to +90 for the relative right or fine tune it further for yet another shift.

\tikzset{deco/.style 2 args={
                        mark=at position {#1} with { 
                                    \node[anchor=\pgfdecoratedangle-90] {#2};
\draw[deco={0.5}{A}] (0,0) -- (0,2);
\draw[deco={0.75}{B},deco={0.2}{C}] (0,2) -- (2,1);
\draw[deco={0.9}{D}] (2,1) -- (0,0);

This would give

enter image description here

share|improve this answer

Whoa Percusse...it's incredible (for me ;)) that I used a code similar to yours. This is what I used:

enter image description here



\tikzset{deco/.style n args={3}{decoration={markings, mark=at position #1 with { \draw [->,>=triangle 60] (0,0) --  (3pt,0)node [near end,#2=5 pt]{#3};}},  postaction={decorate}}}

 \draw [deco={0.5}{left}{3}]   (0,0)--(0,2);
 \draw [deco={0.5}{above}{4}]  (0,2)--(3,2);
 \draw [deco={0.5}{right}{1}]  (3,2)--(3,0);
 \draw [deco={0.5}{below}{2}]  (3,0)--(0,0); 


Maybe I will now change my code with yours hints! Thank you so much!

share|improve this answer

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.