Hi I am getting an arrow that overlaps my box, any thoughts on what is causing this and how to fix it?


\tikzstyle{block} = [draw,rectangle,thick,minimum height=2em,minimum width=2em,align=center]
\tikzstyle{sum} = [draw,circle,inner sep=0mm,minimum size=2mm]
\tikzstyle{connector} = [->,thick]
\tikzstyle{output} = [coordinate]


\begin{tikzpicture}[scale=1, auto, >=stealth']
\lineskip -2pt
 \matrix[ampersand replacement=\&, row sep=1.3cm, column sep=1.32cm]{
    \node [block, name=OCP] {OCP}; \&
    \node [block, name=V] {Vehicle}; \&
 \& \\
 \node [output] (q1) {}; \&
 \node [block, name=E] { State Prediction }; \&
  \node [output] (q2) {}; \& \\
\node [output, left of=OCP] (IN) {};
\node [output, right of=E] (RE) {};
\node [output, left of=E] (LE) {};
\node [output, below of=OCP] (A) {};
\node [output, below of=V] (B) {};
\draw [connector] ([xshift=-2em]IN.west) -- node[name=L] 
{$\mathbf{Q},\mathbf{R}$,$\mathbf{S}$} (OCP);
\draw [connector] (OCP) -- node[name=U] {$\textbf{A}$} (V);
\draw [connector] (V) -- node[name=XA] {$\mathbf{B}$} (q2) -- (RE);
\draw [connector] (LE) -- node[name=XB] {$\mathbf{C}$} (q1) -| (OCP);

enter image description here

The above is fixed with the accepted answer. The following is an additional question using the accepted answer:

If I want the arrows to come in at angles, how do I make them hit the center of the box?

   \draw [connector] (OCP) -- node[name=U] {$\textbf{A}$} (V);
   \draw [connector] (V) -- node[name=XA] {$\mathbf{B}$} (B) -- (E);
   \draw [connector] (E) -- node[name=XB] {$\mathbf{C}$} (A) -| (OCP);

enter image description here


Changing the nodes from where the arrows are drawn:

\draw [connector] (OCP) -- node[name=U] {$\textbf{A}$} (V);
\draw [connector] (V) -- node[name=XA] {$\mathbf{B}$} (q2) -- (E);
\draw [connector] (E) -- node[name=XB] {$\mathbf{C}$} (q1) -| (OCP);

results in this:

Non-overlapping arrows

  • Thank you Tom, I simplified my actual question and I just expanded it in my original post. Do you mind taking a look? – Huckleberry Febbo Aug 10 '18 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.