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.

How can I shift the system node right of control1 but vertically centered between control1 and control2?

\tikzstyle{controller} = [draw, fill=blue!20, rectangle, 
    minimum height=3em, minimum width=6em]
\tikzstyle{block} = [draw, fill=yellow!20, rectangle, 
    minimum height=3em, minimum width=6em]    
\tikzstyle{sum} = [draw, circle, node distance=1.5cm]
\tikzstyle{disturbance} = [draw=none, node distance=1.5cm, line width=0pt] 
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]

\node [input, name=input] {};
\node [sum, right of=input] (sum) {};    
\node [controller, right of=sum] (control1){Control1}; 
\node [controller, above of=control1] (control2) {Control2};
\node [block, right of= control1, node distance=5cm, yshift=-1.4cm] (system) {System};
share|improve this question

1 Answer 1

up vote 6 down vote accepted

You can use positioning library instead of the deprecated input syntax <direction> of =. See this answer Difference between "right of=" and "right=of" in PGF/TikZ and also Should \tikzset or \tikzstyle be used to define TikZ styles?

Then, you can use the calc syntax to get the middle point of the two nodes.

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture}[sum/.style={draw, circle, node distance=1.5cm},
               controller/.style={draw, fill=blue!20, rectangle, 
    minimum height=3em, minimum width=6em},
               block/.style={draw, fill=yellow!20, rectangle, 
    minimum height=3em, minimum width=6em}]
  \coordinate (input);
  \node [sum, right= of input] (sum) {};    
  \node [controller, right = of sum] (control1) {Control1}; 
  \node [controller, above = of control1] (control2) {Control2};
  \node [block, right= 5cm of {$(control1)!0.5!(control2)$}] (system) {System};
\end{tikzpicture}
\end{document}

enter image description here

And please post full compilable code.

share|improve this answer

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.