3

MWE:

\documentclass[12pt]{article}
\usepackage{pgf}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
    \begin{tikzpicture}
    \draw [line width=1pt] (0,5)-- (0,0);
    \draw [line width=1pt] (5,0)-- (0,5);
    \draw [line width=1pt] (0,0)-- (5,0);
    \draw [fill=black] (0,5) circle (1.5pt);
    \draw[color=black] (0.0,5.5) node {$A$};
    \draw [fill=black] (0,0) circle (1.5pt);
    \draw[color=black] (0.0,-0.5) node {$B$};
    \draw [fill=black] (5,0) circle (1.5pt);
    \draw[color=black] (5.0,-0.5) node {$C$};
    \end{tikzpicture}
\end{document}

Question:

How can I draw direction arrow on each lines of triangle? (all possible style of arrows)

sandu
  • 7,950
SandyM
  • 2,757

2 Answers2

5

Maybe I misread the question, but if you want to vary the type of the arrow you may want to use

\documentclass[12pt]{article} 
\usepackage{tikz} 
\usetikzlibrary{decorations.markings}
\begin{document}
% based on https://tex.stackexchange.com/a/39282/121799
\tikzset{->-/.style n args={2}{decoration={
  markings,
  mark=at position #1 with {\arrow{#2}}},postaction={decorate}}}
\begin{tikzpicture}[bullet/.style={circle,inner sep=1.5pt,fill}] 
 \path  (0,5) node[bullet,label=above:$A$](A){}
  (0,0) node[bullet,label=below:$B$](B) {}
  (5,0) node[bullet,label=below:$C$](C) {};
  \foreach \X/\Arrow [remember=\X as \LastX (initially C)]in
  {A/latex,B/stealth,C/>}
  {\draw[line width=1pt,->-={0.5}{\Arrow}] (\LastX) -- (\X);}
\end{tikzpicture} 
\end{document}

enter image description here

As for your comment: this draws three triangles. Is that what you are looking for?

\documentclass[12pt]{article} 
\usepackage{tikz} 
\usetikzlibrary{decorations.markings}
\begin{document}
% based on https://tex.stackexchange.com/a/39282/121799
\tikzset{->-/.style n args={2}{decoration={
  markings,
  mark=at position #1 with {\arrow[line width=1pt]{#2}}},postaction={decorate}}}
\begin{tikzpicture}[bullet/.style={circle,inner sep=1.5pt,fill}] 
 \begin{scope}
  \path  (0,5) node[bullet,label=above:$A$](A){}
   (0,0) node[bullet,label=below:$B$](B) {}
   (5,0) node[bullet,label=below:$C$](C) {};
   \foreach \X [remember=\X as \LastX (initially C)] in  {A,B,C}
   {\draw[line width=1pt,->-={0.5}{latex}] (\LastX) -- (\X);}
  \end{scope} 
 \begin{scope}[xshift=6cm]
  \path  (0,5) node[bullet,label=above:$A$](A'){}
   (0,0) node[bullet,label=below:$B$](B') {}
   (5,0) node[bullet,label=below:$C$](C') {};
   \foreach \X [remember=\X as \LastX (initially C')]in  {A',B',C'}
   {\draw[line width=1pt,->-={0.5}{stealth}] (\LastX) -- (\X);}
  \end{scope} 
  \begin{scope}[yshift=-6.6cm]
  \path  (0,5) node[bullet,label=above:$A$](A''){}
   (0,0) node[bullet,label=below:$B$](B'') {}
   (5,0) node[bullet,label=below:$C$](C'') {};
   \foreach \X [remember=\X as \LastX (initially C'')]in  {A'',B'',C''}
   {\draw[line width=1pt,->-={0.5}{>}] (\LastX) -- (\X);}
  \end{scope} 
\end{tikzpicture} 
\end{document}

enter image description here

  • No friend, you understand my question better And the answer that I had hoped for almost got to be found. Only one request is please give me three different codes with arrows(three triangle with arrows) that you mentioned. – SandyM Mar 14 '19 at 04:27
  • Should i increase size of arrows? i am waiting....... – SandyM Mar 14 '19 at 04:31
  • @Sandy The three different arrows are already in \foreach \X/\Arrow [remember=\X as \LastX (initially C)]in {A/latex,B/stealth,C/>}, where they are set as latex, stealth and standard types. Yes, you can make the arrows thicker e.g. by saying {\arrow[line width=2pt]{#2}}} instead of {\arrow{#2}}}. –  Mar 14 '19 at 04:34
  • Yes you gave it. my question is that you mentioned three different arrows in one triangle, i want three different triangle with same type of arrows. Please because i am working first time. – SandyM Mar 14 '19 at 04:39
  • Please provide full solution this will be great help for me. – SandyM Mar 14 '19 at 04:41
  • 1
    @Sandy Yes, I will be happy to follow your request if I understand it. You want three triangles? If so, do they all have the same dimensions? Are the next to each other? Or do you want 3 arrow heads on a given edge? –  Mar 14 '19 at 04:45
  • In your solution there are three different arrows in one triangle right. Now I am looking for a triangle in which all sides have same type of arrows. Therefore, there will be three triangles – SandyM Mar 14 '19 at 04:50
  • @Sandy I added a code with three triangles. –  Mar 14 '19 at 05:03
  • million trillion thanks for your help. – SandyM Mar 14 '19 at 05:05
  • 2
    @Sandy Just for additional information, here is a (quite complete) list of available arrow tips. –  Mar 14 '19 at 05:08
4

Using TikZ: How to draw an arrow in the middle of the line?

%\documentclass[border=2mm]{standalone}
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}

    \draw [fill=black] (0,5) circle (1.5pt);
    \draw[color=black] (0.0,5.5) node {$A$};
    \draw [fill=black] (0,0) circle (1.5pt);
    \draw[color=black] (0.0,-0.5) node {$B$};
    \draw [fill=black] (5,0) circle (1.5pt);
    \draw[color=black] (5.0,-0.5) node {$C$};

\begin{scope}[very thick,decoration={
    markings,
    mark=at position 0.5 with {\arrow{>}}}
    ] 
    \draw [line width=1pt,postaction={decorate}] (0,5)-- (0,0);
    \draw [line width=1pt,postaction={decorate}] (5,0)-- (0,5);
    \draw [line width=1pt,postaction={decorate}] (0,0)-- (5,0);
\end{scope}
\end{tikzpicture}
\end{document}
sandu
  • 7,950