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.

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

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,intersections,shapes.geometric,decorations.pathmorphing,decorations.pathreplacing,decorations.shapes,decorations.markings,patterns,calc,fit,arrows,backgrounds,matrix}

\begin{document}
\begin{tikzpicture}[auto]

\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);
\end{scope}

\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);
\end{tikzpicture}



\end{document}
share|improve this question
2  
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
add comment

2 Answers 2

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.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\tikzset{deco/.style 2 args={
            decoration={             
                        markings,   
                        mark=at position {#1} with { 
                                    \arrow{latex},
                                    \node[anchor=\pgfdecoratedangle-90] {#2};
                        }
            },
            postaction={decorate}
    }
}
\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);
\end{tikzpicture} 
\end{document}

This would give

enter image description here

share|improve this answer
add comment

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

enter image description here

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings,arrows}

\begin{document}
\begin{tikzpicture}[auto]

\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); 

\end{tikzpicture}
\end{document}

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

share|improve this answer
add comment

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.