2

How to change the arrow pointing direction, in this case to the right with tikz library.

I have following code,

\documentclass{article}

\usepackage{filecontents}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,calc,arrows,arrows.meta}
\tikzset{block/.style={draw,thick,text width=2cm,minimum height=1cm,align=center},
         line/.style={-latex}
}

\begin{document}

\begin{figure}
\begin{center}
\begin{tikzpicture}[>=stealth]
  %coordinates
  \coordinate (orig)   at (0,0);
  \coordinate (LLD)    at (4,0);
  \coordinate (AroneA) at (-7/2,11/2);
  \coordinate (ArtwoA) at (-7/2,5);
  \coordinate (ArthrA) at (-1/2,9/2);
  \coordinate (LLA)    at (1,4);
  \coordinate (LLB)    at (5,4);
  \coordinate (LLC)    at (9,4);
  \coordinate (AroneC) at (26/2,11/2);
  \coordinate (ArtwoC) at (26/2,5);
  \coordinate (ArthrC) at (25/2,9/2);
  \coordinate (conCBD) at (25/2,10/2);
  \coordinate (conCB)  at (25/2,6/2);
  \coordinate (coCBD)  at (11,6);


  %nodes
  \node[draw, minimum width=2cm, minimum height=2cm, anchor=south west, text width=2cm, align=center] (A) at (LLA) {A};
  \node[draw, minimum width=2cm, minimum height=2cm, anchor=south west, text width=2cm, align=center] (B) at (LLB) {B};
  \node[draw, minimum width=3cm, minimum height=2cm, anchor=south west, text width=2cm, align=center] (C) at (LLC) {C};


  %edges
  \draw[->] (AroneA) -- node[above]{\textit{x}} ($(A.180) + (0,1/2)$);
  \draw[->] (ArtwoA) -- node[above]{\textit{y}} (A.182);

  \draw[->] (A.0) -- node[above] {$x_d$} (B.180);
  \draw[->] (B.0) -- node[above] {$y_d$} (C.180);

  \draw[->] (C.0) -- node[above, pos=0.4]{Y} (ArtwoC);

  \path[fill] (conCBD) circle[radius=1pt];
  \path[-{Straight Barb[angle'=60,scale=4]}] (conCBD) -- (conCB) -| ($(B.180) + (-1,-0.6)$) -| ($(B.180) + (-0.1,-0.8)$);

\end{tikzpicture}

\end{center}

\end{figure}

\end{document}

enter image description here

  • Welcome! What does this have to do with latex3? I've removed the tag as it seems totally irrelevant. You can put it back if there's really a link, but please then explain. Do you want the arrow at the other end of the line Latex- rather than -Latex? Or do you want the arrow tip reversed -{Latex[reversed]} rather than -Latex? Or both {Latex[reversed]}- rather than -Latex? Latex is the current (arrows.meta) tip (rather than latex which is no longer recommended). – cfr Aug 24 '17 at 22:41
3

Relative positioning is a very nice feature of tikz. Absolute positioning can be quite hard and more prone to errors (observe your horizontal lines below x and y in your image). This kind of diagrams in general is best drawn using relative positioning or a matrix of nodes. For the reversed arrow, I used \draw [<-] (B.210) -| ++(-.6,-1) -| ([xshift=.5cm] C.east) node[above]{$Y$};.

\documentclass{article}    
\usepackage{filecontents}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,calc,arrows,arrows.meta}
\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}[>=stealth,blk/.style={draw, minimum width=2cm, minimum height=2cm}]

\node (y) {$y$};
\node (x) [above=2pt of y]{$x$};
\node (A) [right=of y,blk]{A};
\node (B) [right=of A,blk]{B};
\node (C) [right=of B,blk,minimum width=3cm]{C};

\draw [->] (y)--(A);
\draw [->] (x)--(A.west|-x);
\draw [->] (A)--node[above]{$x_d$}(B);
\draw [->] (B)--node[above]{$y_d$}(C);
\draw [->] (C.east)--++(1,0);    
\draw [<-] (B.210) -| ++(-.6,-1) -| ([xshift=.5cm]C.east)node[above]{$Y$};

\end{tikzpicture}
\end{figure}

\end{document}

enter image description here

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.