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'm using the tikz package in LaTeX to construct a feedback loop for a control system as a part of a paper on control systems. The problem I'm running into is that I would like to place symbols under the arrows between the blocks in addition to the symbols which are currently above the arrows. For example I would like to place a symbol for $phi$ below the arrow, under the $tau$ symbol. I have no idea how to achieve this since I'm fairly new to LaTeX and tikz. Any help would be appreciated.

I've embedded all of my code below, as well as a snapshot of how the feedbackloop currently looks with the code.

enter image description here

\documentclass[class=minimal,border=15pt]{standalone}


\usepackage[utf8]{inputenc}
\usepackage[swedish]{babel}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}


\tikzstyle{block} = [draw, fill=gray!3, rectangle, minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, fill=gray!3, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]

\begin{tikzpicture}[auto, node distance=2cm,>=latex']
 \node [input, name=input] {};
 \node [sum, right of=input] (sum) {};
 \node [block, right of=sum] (controller) {Regulator};
 \node [block, right of=controller, node distance=3cm] (motor) {G$_{motor}$};
 \node [block, right of=motor, pin={[pinstyle]above:Störningar},
        node distance=3cm] (system) {Dynamik$_{\varphi}$};

 \draw [->] (controller) -- node[name=u] {$u$} (motor);
 \node [output, right of=system] (output) {};
 \node [block, below of=motor] (msystem) {Mätsystem};

 \draw [draw,->] (input) -- node {$\varphi_{ref}$} (sum);
 \draw [->] (sum) -- node {$e$} (controller);
 \draw [->] (motor) -- node {$\tau$} (system);
 \draw [->] (system) -- node [name=y] {$\varphi$}(output);
 \draw [->] (y) |- (msystem);
 \draw [->] (msystem) -| node[pos=0.99] {$-$}  node [near end] {$\varphi_m$} (sum);
\end{tikzpicture}

\end{document} 
share|improve this question

migrated from stackoverflow.com May 14 '13 at 20:23

This question came from our site for professional and enthusiast programmers.

    
Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner May 14 '13 at 20:31
    
Replace \draw [->] (y) |- (msystem); with \draw [->] (y) |- node[pos=0.95] {$\varphi$} (msystem);. –  Ignasi May 14 '13 at 21:05
    
Or \node [below] at (tau |- msystem) {$\varphi$}; where tau is the name of the $\tau$ node. — Also, take a look at Should \tikzset or \tikzstyle be used to define TikZ styles?, Difference between right of= and right=of in PGF/TikZ and Package PGF Math Error: Unknown operator `o' or `of' –  Qrrbrbirlbel May 14 '13 at 21:30
add comment

2 Answers 2

You can use multiple label keys in the options for a node:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[mynode/.style={draw,circle,minimum size=2cm}]
\node[mynode,label=left:$a$,label=right:$b$,label=60:$c$,label=220:$d$] {};
\end{tikzpicture}

\end{document}

enter image description here

In your case, you need an additional precaution since you declared auto globally, so you need to use auto=false for the node that will have multiple labels:

\documentclass[class=minimal,border=15pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[swedish]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,arrows}

\tikzset{
block/.style = {draw, fill=gray!3, rectangle, minimum height=3em, minimum width=6em},
sum/.style = {draw, fill=gray!3, circle, node distance=1cm},
input/.style = {coordinate},
output/.style = {coordinate},
pinstyle/.style={pin edge={to-,thin,black}}
}

\begin{document}

\begin{tikzpicture}[node distance=1cm,>=latex']
 \node [input, name=input] {};
 \node [sum, right = of input] (sum) {};
 \node [block, right = of sum] (controller) {Regulator};
 \node [block, right = of controller, node distance=3cm] (motor) {G$_{motor}$};
 \node [block, right  = of motor, pin={[pinstyle]above:Störningar},
        node distance=3cm] (system) {Dynamik$_{\varphi}$};

 \draw [->] (controller) -- node[name=u,auto] {$u$} (motor);
 \node [output, right=of system] (output) {};
 \node [block, below  = of motor] (msystem) {Mätsystem};
 \draw [draw,->] (input) -- node[auto] {$\varphi_{ref}$} (sum);
 \draw [->] (sum) -- node[auto] {$e$} (controller);
 \draw [->] (motor) -- node[auto=false,label=below:$\varphi$,label=above:$\tau$] {}  (system);
 \draw [->] (system) -- node [auto,name=y] {$\varphi$}(output);
 \draw [->] (y) |- (msystem);
 \draw [->] (msystem) -| node[auto,pos=0.99] {$-$}  node [auto,near end] {$\varphi_m$} (sum);
\end{tikzpicture}

\end{document} 

enter image description here

Notice also that I replaced the old \tikzstyle for the newer \tikzset syntax.

share|improve this answer
add comment

I think something like

\draw [->] (motor) edge node[above] {$\tau$} node[below] {$\phi$} (system);

should do this

share|improve this answer
    
Welcome to TeX.SX! You may have a look on our starter guide. –  mafp May 15 '13 at 21:53
add comment

Your Answer

 
discard

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