12

I would like to draw something similar to this:

I was able to draw the triangles, but I cannot figure out how to easily draw the arrows. This is my attempt:

\documentclass[12pt]{book}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{amsmath}

\begin{document}

\begin{tikzpicture}
\draw (-6, -3) -- (6, -3)  -- (-2, 3) -- cycle; % Left - Right - Top
\draw (-4,0) -- (2, 0); % Horizontal Bisector
\draw (0, -3) -- (-4,0); % Left Bisector
\draw(0,-3) -- (2,0); % Right Bisector
\draw [->] (0.5, 0.825) -- (-0.5, 1.575); % slope -3/4
\end{tikzpicture}

\end{document}

Which looks like this:

Calculating the length, direction, and position of each arrow would take me hours. Is there a way to specify an arrow by giving the initial point, length, and direction? If not, is there a different way to do this diagram? I am a beginner at TikZ (and LaTeX in general) so I am not necesarily looking so much for the absolute shortest solution, but more for a solution that I can understand. Thanks.

2 Answers 2

10

Here is a version that modifies the to path. So you need to replace -- by to, and to apply the style, e.g.

\draw[pft] (-6, -3) to (0, -3) to (-4,0) to cycle;

The to path is modified in such a way that a sloped arrow (from the shapes.arrows library) is attached in the middle of the path. allow upside down is used to avoid that TikZ intelligently rotates the arrows in a way that is appropriate for texts. I also would use symbolic coordinates, and the nodes can be placed in the centers of the triangles with barycentric cs:.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{shapes.arrows}
\begin{document}

\begin{tikzpicture}[pft/.style={to path={--(\tikztotarget)
    node[midway,above=0.6em,marrow,allow upside down]{}}},
    marrow/.style={sloped,fill, minimum height=3cm, single arrow, single arrow
    head extend=.5cm, single arrow head indent=.25cm,xscale=0.3,yscale=0.15}]
 \path (-6, -3) coordinate (A)  (6, -3) coordinate (B) (-2, 3) coordinate (C)
  (A) -- (B) coordinate[midway] (AB) (B) -- (C) coordinate[midway] (BC)         
  (C) -- (A) coordinate[midway] (CA);   
 \draw[pft] (A) to (AB) to (CA) to cycle
    (AB) to (B) to (BC) to cycle
    (CA) to (BC) to (C) to cycle
    (CA) to (AB) to (BC) to cycle;
 \path (barycentric cs:A=1,AB=1,CA=1) node{$T_1^{(1)}$}
  (barycentric cs:AB=1,BC=1,CA=1) node{$T_2^{(1)}$}
  (barycentric cs:CA=1,BC=1,C=1) node{$T_3^{(1)}$}
 (barycentric cs:B=1,AB=1,BC=1) node{$T_4^{(1)}$};
\end{tikzpicture}
\end{document}

enter image description here

12

You can use the the show path construction and the markings decoration to put an arrow next to every path segment. The limitations are that you have to repeat the last point in the path (-- cycle alone won't do it) and you have to take care of the direction in which you draw the path.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings,decorations.pathreplacing}

\begin{document}

\begin{tikzpicture}[
        parallel arrows/.style={
            postaction=decorate,
            decoration={
                show path construction,
                lineto code={
                    \path[
                        postaction=decorate,
                        decoration={
                            markings,
                            mark=at position .5 with {
                                \draw[red,-stealth] (-.5,.1) -- (.5,.1);
                            }
                        }
                    ] (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
                }
            }
        }
    ]
    \draw[parallel arrows] (-6,-3) -- (0,-3) -- (-4,0) -- (-6,-3) -- cycle;
    \draw[parallel arrows] (0,-3) -- (6,-3) -- (2,0) -- (0,-3) -- cycle;
    \path[parallel arrows] (-4,0) -- (0,-3) -- (2,0) -- (-4,0) -- cycle;
    \draw[parallel arrows] (-4,0) -- (2,0) -- (-2,3) -- (-4,0) -- cycle;
\end{tikzpicture}

\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.