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 have some trouble drawing a control system block diagram using TikZ. I want a certain node to be shown as a dot, indicating a connection. However, the dot is not positioned at the center of the node but above it. How can I fix this?

The problem is obvious from a PS or PDF generated from this LaTeX document:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}

\pagestyle{empty}

\tikzstyle{block} = [draw, rectangle, minimum width = 0.75cm, minimum height = 0.75cm]
\tikzstyle{sum} = [draw, circle, minimum size=.5cm, node distance=1.75cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]

\begin{tikzpicture}[node distance=2cm,auto,>=latex']
    \node [input, name=input] {};
    \node [sum, right of=input] (sum) {};
    \node [block, right of=sum] (a1) {$A_1(s)$};
    \node [block, right of=a1] (a2) {$A_2(s)$};
    \node [block, right of=a2] (k) {$K$};
    \node [output, right of=k] (output) {}; 

    \draw [->] (a1) -- (a2);
    \draw [->] (a2) -- node [name=vout] {$V_o$} (k);

   \node [block, below of=a2] (a3) {$A_1(s)$};

   \draw [draw,->, node] (input) -- node {$V_\mathrm{ref}$} node[pos=0.95] {{\tiny $+$}} (sum);
   \draw [->] (sum) -- (a1);
   \draw [->] (k) -- node[name=vl]  {$V_L$} (output);
   \draw [->] (vl) |- (a3);
   \draw [->] (a3) -| node[pos=0.99, right] {{\tiny $-$}} (sum);

   \fill (vl) circle [radius=2pt];
\end{tikzpicture}
\end{document}
share|improve this question
add comment

3 Answers

You can use

   \fill (vl.south) circle [radius=2pt];

or even better,

   \fill (vl|-k) circle [radius=2pt];

A complete example:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}

\pagestyle{empty}

\tikzstyle{block} = [draw, rectangle, minimum width = 0.75cm, minimum height = 0.75cm]
\tikzstyle{sum} = [draw, circle, minimum size=.5cm, node distance=1.75cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]

\begin{tikzpicture}[node distance=2cm,auto,>=latex']
    \node [input, name=input] {};
    \node [sum, right of=input] (sum) {};
    \node [block, right of=sum] (a1) {$A_1(s)$};
    \node [block, right of=a1] (a2) {$A_2(s)$};
    \node [block, right of=a2] (k) {$K$};
    \node [output, right of=k] (output) {}; 

    \draw [->] (a1) -- (a2);
    \draw [->] (a2) -- node [name=vout] {$V_o$} (k);

   \node [block, below of=a2] (a3) {$A_1(s)$};

   \draw [draw,->] (input) -- node {$V_\mathrm{ref}$} node[pos=0.95] {{\tiny $+$}} (sum);
   \draw [->] (sum) -- (a1);
   \draw [->] (k) -- node[name=vl]  {$V_L$} (output);
   \draw [->] (vl) |- (a3);
   \draw [->] (a3) -| node[pos=0.99, right] {{\tiny $-$}} (sum);

   %\fill (vl.south) circle [radius=2pt];
   \fill (vl|-k) circle [radius=2pt];
\end{tikzpicture}
\end{document}

enter image description here

Another option would be to first set a coordinate for V_L at the appropriate location, and then use this coordinate to place the circle:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}

\pagestyle{empty}

\tikzstyle{block} = [draw, rectangle, minimum width = 0.75cm, minimum height = 0.75cm]
\tikzstyle{sum} = [draw, circle, minimum size=.5cm, node distance=1.75cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]

\begin{tikzpicture}[node distance=2cm,auto,>=latex']
    \node [input, name=input] {};
    \node [sum, right of=input] (sum) {};
    \node [block, right of=sum] (a1) {$A_1(s)$};
    \node [block, right of=a1] (a2) {$A_2(s)$};
    \node [block, right of=a2] (k) {$K$};
    \node [output, right of=k] (output) {}; 

    \draw [->] (a1) -- (a2);
    \draw [->] (a2) -- node [name=vout] {$V_o$} (k);

   \node [block, below of=a2] (a3) {$A_1(s)$};

   \draw [draw,->] (input) -- node {$V_\mathrm{ref}$} node[pos=0.95] {{\tiny $+$}} (sum);
   \draw [->] (sum) -- (a1);
   \draw [->] (k) -- coordinate[label=above:$V_L$] (vl)  (output);
   \draw [->] (vl) |- (a3);
   \draw [->] (a3) -| node[pos=0.99, right] {{\tiny $-$}} (sum);

   \fill (vl) circle [radius=2pt];
\end{tikzpicture}
\end{document}

Yet another option is to use a coordinate (as in the last example above) and then use the *-> arrow type, with a convenient value for shorten, as in

\draw [->] (k) -- coordinate[label=above:$V_L$] (vl)  (output);
\draw [*->,shorten <= -2pt] (vl) |- (a3);

A complete example:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}

\pagestyle{empty}

\tikzstyle{block} = [draw, rectangle, minimum width = 0.75cm, minimum height = 0.75cm]
\tikzstyle{sum} = [draw, circle, minimum size=.5cm, node distance=1.75cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]

\begin{tikzpicture}[node distance=2cm,auto,>=latex']
    \node [input, name=input] {};
    \node [sum, right of=input] (sum) {};
    \node [block, right of=sum] (a1) {$A_1(s)$};
    \node [block, right of=a1] (a2) {$A_2(s)$};
    \node [block, right of=a2] (k) {$K$};
    \node [output, right of=k] (output) {}; 

    \draw [->] (a1) -- (a2);
    \draw [->] (a2) -- node [name=vout] {$V_o$} (k);

   \node [block, below of=a2] (a3) {$A_1(s)$};

   \draw [draw,->] (input) -- node {$V_\mathrm{ref}$} node[pos=0.95] {{\tiny $+$}} (sum);
   \draw [->] (sum) -- (a1);
   \draw [->] (k) -- coordinate[label=above:$V_L$] (vl)  (output);
   \draw [*->,shorten <= -2pt] (vl) |- (a3);
   \draw [->] (a3) -| node[pos=0.99, right] {{\tiny $-$}} (sum);

\end{tikzpicture}
\end{document}
share|improve this answer
    
Another option would be to place $V_L$ as vl's coordinate label: coordinate[label=above:{$V_l$}] (vl). –  Ignasi Nov 5 '12 at 17:15
    
@Ignasi you're right. I'll add this to my answer. Thank you. –  Gonzalo Medina Nov 5 '12 at 17:18
add comment

It is better here to separate the node and the intersection using coordinate

   \draw [draw,->, node] (input) -- node {$V_\mathrm{ref}$} node[pos=0.95] {{\tiny $+$}} (sum);
   \draw [->] (sum) -- (a1);
   \draw [->] (k) -- node[name=vl]  {$V_L$} (output);
   \draw [->] (vl) |- (a3);
   \draw [->] (a3) -| node[pos=0.99, right] {{\tiny $-$}} (sum);

   \fill (vl) circle [radius=2pt];
share|improve this answer
add comment

Here something different with coordinate and node. I modified the code. I used /.styleand I placed {\tiny $+$} with a different method. I think the symbols are better placed.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}

\pagestyle{empty}

\begin{tikzpicture}[%
    node distance = 2 cm,auto,>=latex',
    block/.style  = {draw, rectangle, minimum width = 0.75cm, minimum height = 0.75cm},
    sum/.style    = {draw, circle, minimum size=.5cm, node distance=1.75cm},
    input/.style  = {coordinate},
    output/.style = {coordinate},
    dot/.style    = {anchor=base,fill,circle,inner sep=1pt}]

    \node [input, name=input] {};
    \node [sum, right of=input] (sum) {};
    \node [block, right of=sum] (a1) {$A_1(s)$};
    \node [block, right of=a1] (a2) {$A_2(s)$};
    \node [block, right of=a2] (k) {$K$};
    \node [output, right of=k] (output) {}; 
    \node [block, below of=a2] (a3) {$A_1(s)$};

    \draw [->] (a1) -- (a2);
    \draw [->] (a2) -- node [name=vout] {$V_o$} (k);
    \draw [draw,->] (input) -- node {$V_\mathrm{ref}$} (sum); 
    \draw [->] (sum) -- (a1);
    \draw [->] (k) -- coordinate[dot](vl) node  {$V_L$} (output); 
    \draw [->] (vl) |- (a3);
    \draw [->] (a3) -| (sum);

    \node [shift=({145:12pt})] at (sum.center)  {\tiny $+$}; % I removed {}
    \node [shift=({-45:12pt})] at (sum.center)  {\tiny $-$}; 
\end{tikzpicture} 

\end{document} 
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.