2

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

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{arrows,positioning,shapes}

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

\begin{tikzpicture}[scale=1, auto, >=stealth']
\small
\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);
\end{tikzpicture}
\end{document}

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

1 Answer 1

2

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

1
  • Thank you Tom, I simplified my actual question and I just expanded it in my original post. Do you mind taking a look? Commented Aug 10, 2018 at 16:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .