0

The following tex produces the image below. I want the arrow in the centre of the lines. Is it possible to modify the given tex to fix it? Thanks

\begin{tikzpicture}[grow=right,scale=1,solid node/.style={circle,draw,inner sep=1.5,fill=black}]
\draw[{<[scale=2.5,
          length=3,
          width=3]}-] (0.7,0.7)node[solid node,fill=green]{} -- (1.5,1.5) node[solid node]{};
          \draw[{<[scale=2.5,
          length=3,
          width=3]}-] (1.5,1.5)node[solid node]{} -- (2.5,2)node[solid node]{};
          \draw[{<[scale=2.5,
          length=3,
          width=3]}-] (2.5,2)node[solid node]{} -- (3.4,2.2)node[solid node,fill=red]{};
\end{tikzpicture}

enter image description here

4
  • 2
    Welcome to TeX-SE! Here is a possible way.
    – user121799
    Commented Apr 23, 2019 at 6:27
  • I have gone through all those post. It seems a lot of change in tex if I want to follow their methods. I think there must be a easy way to fix it by simple change in the tex provided. Commented Apr 23, 2019 at 6:31
  • The TeX provided is not a compilable document. You are expecting us to guess what the preamble is and so on. And yes, your code is unnecessarily complicated, one can simplify it in many ways. A quickly written simpler code that is a complete MWE and solves your problem is:
    – user121799
    Commented Apr 23, 2019 at 21:05
  • \documentclass[tikz,border=3.14mm]{standalone} \usetikzlibrary{arrows.meta,decorations.markings} \begin{document} \begin{tikzpicture}[solid node/.style={circle,draw,inner sep=1.5,fill=black}, -<-/.style={postaction=decorate,decoration={markings,mark=at position 0.5 with {\arrow{<[scale=2.5,length=3,width=3]}}}}] \draw (0.7,0.7) node[solid node,fill=green] (n1) {} (1.5,1.5) node[solid node] (n2){} (2.5,2)node[solid node] (n3) {} (3.4,2.2)node[solid node,fill=red] (n4){} (n1) edge[-<-] (n2) (n2) edge[-<-] (n3) (n3) edge[-<-] (n4); \end{tikzpicture} \end{document}
    – user121799
    Commented Apr 23, 2019 at 21:05

0

Browse other questions tagged .