0

I am trying to draw a following figure and this is the code

 \[\begin{tikzpicture}
        ] 
        \draw[ arrow] (0,0)--(8,0);      
        \draw[arrow] (4,4)--(8,0);
        \draw[arrow] (0,0)--(4,4);
         \draw [arrow](2,2)--(4,0);
         \draw [arrow](6,2)--(4,0);
         \draw [arrow](6,2)--(2,2);
   \node[left] at (0,0) {$a_{i}$};
 \node[right] at (8,0) {$a_j$};
    \node[above] at (4,4) {$a_k$};
    \node[below] at (4,0) {$a_{ij}$};
    \node[above] at (2,2) {$a_{ik}$};
    \node[above] at (6,2) {$a_{jk}$};
    \end{tikzpicture}\]

enter image description here

I want to change the direction of the arrow as in the picture with the blue one.

Ali
  • 33
  • 4

3 Answers3

2

Like this:

enter image description here

Code:

\documentclass[10pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document} \begin{tikzpicture} %\drawgray!25 grid(8,4); \begin{scope}[very thick,decoration={ markings, mark=at position 0.5 with {\arrow{>}}} ] \draw[postaction={decorate}] (0,0)--(4,0); \draw[postaction={decorate}] (4,0)--(8,0); \draw[postaction={decorate}] (4,0)--(2,2); \draw[postaction={decorate}] (0,0)--(2,2); \draw postaction={decorate}--(4,4); \draw postaction={decorate}--(4,0); \draw postaction={decorate}--(6,2); \draw[postaction={decorate}] (6,2)--(4,4); \draw[postaction={decorate}] (8,0)--(6,2); \end{scope} \node[left] at (0,0) {$a_{i}$}; \node[right] at (8,0) {$a_j$}; \node[above] at (4,4) {$a_k$}; \node[below] at (4,0) {$a_{ij}$}; \node[above] at (2,2) {$a_{ik}$}; \node[above] at (6,2) {$a_{jk}$}; \end{tikzpicture} \end{document}

1

Two alternatives.

  1. A normal TikZ picture with two triangles and a bunch of edge nodes.
  2. A TikZ-CD where the nodes are in place of the intersections.

Code

\documentclass[tikz]{standalone}
\usetikzlibrary{cd, arrows.meta, quotes}
\tikzset{
  pics/arrow/.style={/tikz/sloped, /tikz/allow upside down,
    code=\pgfarrowdraw{#1}}, pics/arrow/.default=>}
\begin{document}
\tikz[
  >=Straight Barb, line join=round, thick,
  execute at begin node=$, execute at end node=$,
  ar2/.style={edge node={pic[near start]{arrow}pic[near end]{arrow}}},
  ar2'/.style={edge node={pic[near start]{arrow=<}pic[near end]{arrow=<}}},
  ar/.style={edge node={pic{arrow}}},
  auto=right, mc/.style={edge node={coordinate(#1)}},
]
\draw (0,0) node[left]{a_i} to["a_{ij}", ar2, mc=a] +(right:8) node[right]{a_j}
                            to["a_{jk}", ar2, mc=b] +(4,6)     node[above]{a_k}
                            to["a_{ik}", ar2',mc=c] cycle
                        (a) to[ar] (c) to[ar] (b) to[ar] cycle;

\begin{tikzcd}[ row sep=huge, arrows={thick, dash, /tikz/every to/.append style={edge node={pic {arrow=Straight Barb}}}}] & & a_k \ & a_{ik} \urar\ar[rr] & & a_{jk} \dlar\ular \ a_i \urar\ar[rr] & & a_{ij} \ular\ar[rr] & & a_j \ular \end{tikzcd} \end{document}

Output

enter image description here enter image description here

Qrrbrbirlbel
  • 119,821
0

Another possible solution:

\documentclass[10pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                decorations.markings}

\begin{document} \begin{tikzpicture}[ > = Straight Barb, every edge/.append style = {very thick, decoration={markings, mark=at position 0.5 with {\arrow{>}}}, postaction={decorate} }, lbl/.style ={label=#1, coordinate, node contents={}} ] \draw (0,0) node[lbl=left:$a_{i}$] edge (4,0) (4,0) node[lbl=below:$a_{ij}$] edge (8,0) (8,0) node[lbl=right:$a_j$] edge (6,2) (6,2) node[lbl=right:$a_{jk}$] edge (4,4)
(4,4) node[lbl=above:$a_{k}$] % (0,0) edge (2,2)
(2,2) node[lbl=left:$a_{ik}$] edge (4,4)
% (6,2) edge (4,0) (4,0) edge (2,2) (2,2) edge (6,2) ; \end{tikzpicture} \end{document}

enter image description here

Zarko
  • 296,517