Debian Codegraph @

texmf-dist/doc/metapost/base/source-tutorial/arrows.tex

raw
1 \subsection{Arrow commands}
2
3 When drawing simple graphs and other illustrations, the use of arrows is
4 often essential. There are two arrow commands in \MP{} for
5 accommodating this need\Dash |drawarrow| and |drawdblarrow|. Both of
6 these commands require a path argument. For example,
7
8 \begin{lstlisting}[style=MP]
9 drawarrow (0,0)--(72,72);
10 \end{lstlisting}
11 draws an arrow beginning at |(0,0)| and ending at |(72,72)| along the
12 line segment connecting these points.
13
14 The path argument of both |drawarrow| and |drawdblarrow| need not be
15 line segmented paths\Dash they may be any \MP{} path. The only
16 difference between |drawarrow| and |drawdblarrow| is that |drawarrow|
17 places an arrow head at the end of the path and |drawdblarrow| places an
18 arrow head at the beginning and the end of the path. As an example, to
19 draw the curved path in \autoref{fig:draw1} with an arrow head at the
20 end of the path (i.e., at |z3|), the following command can be used
21
22 \begin{lstlisting}[style=MP]
23 drawarrow z1{right}..z2{dir 45}..{up}z3;
24 \end{lstlisting}
25 and is illustrated in \autoref{fig:draw2}.
26
27 \begin{figure}
28 \begin{withattachment}{draw.mp}
29 \centering
30 \includegraphics{draw-2.mps}
31 \end{withattachment}
32 \caption{Using \texttt{drawarrow} along a path}
33 \label{fig:draw2}
34 \end{figure}