# Drawing two edges, one is missing an arrowhead

I'm trying to define two parallel arrows as a custom command in my preample as follows:

\newcommand{\toto}{\mathrel{%
\tikz[baseline] \draw[->] (0ex,.96ex) -- (3ex,.96ex) (0ex,.16ex) -- (3ex,.16ex);}}


The top edge appears first, but only the bottom edge gets an arrowhead. Why? How can I get arrowheads on both edges?

I also tried

\newcommand{\toto}{\mathrel{\tikz[baseline]
\draw[->] (0ex,.96ex) -- (3ex,.96ex);
\draw[->] (0ex,.16ex) -- (3ex,.16ex);}}


but it doesn't compile (saying that the first word after the second draw is undefined).

\documentclass{article}
\usepackage{tikz}

\newcommand{\toto}{\mathrel{%
\tikz[baseline] \draw[->] (0ex,.96ex) edge[->] (3ex,.96ex) (0ex,.16ex) -- (3ex,.16ex);}}

\newcommand{\tototo}{\mathrel{\tikz{[baseline]    %brace after \tikz
\draw[->] (0ex,.96ex) -- (3ex,.96ex);
\draw[->] (0ex,.16ex) -- (3ex,.16ex);}}}       %brace closing everything

\begin{document}
$\toto$

$\tototo$
\end{document}


For the first version, use edge[->] for the intermediate arrows. For the second, you are missing braces.

Your two definitions don't work for different reasons:

\newcommand{\toto}{\mathrel{%
\tikz[baseline] \draw[->] (0ex,.96ex) -- (3ex,.96ex) (0ex,.16ex) -- (3ex,.16ex);}}


When you \draw[->] an arrow, TikZ only ever adds one arrowhead at the very end of the path. Even though the path jumps from one point to another, it's still a single path for purposes of placing arrowheads and the like.

You'll notice the same effect if you use the decorations library to place a decoration (like an arrowhead) at, say, 60% of the way along the path: for figuring out where to place the decoration, TikZ effectively lines up the segments end to end (in its own internal memory, not on the page) and calculates 60% of the way along the overall path.

\newcommand{\toto}{\mathrel{\tikz[baseline]
\draw[->] (0ex,.96ex) -- (3ex,.96ex);
\draw[->] (0ex,.16ex) -- (3ex,.16ex);}}


This doesn't work because the \tikz command only parses commands up until the next semicolon. So your TikZ picture is only this:

\tikz[baseline] \draw[->] (0ex,.96ex) -- (3ex,.96ex);


Then LaTeX keeps parsing and runs into this:

\draw[->] (0ex,.16ex) -- (3ex,.16ex);


but this is no longer part of the TikZ picture, and \draw is not a LaTeX command, so it complains about an undefined command.

You can work around this by putting braces around the argument to \tikz:

\tikz[baseline] {
\draw[->] (0ex,.96ex) -- (3ex,.96ex);
\draw[->] (0ex,.16ex) -- (3ex,.16ex);
}


This way, both \draw commands are combined into a single token which is given as the "argument" to \tikz.

I'm not sure about the implications but the -- command is actually a line of a path and you decorate the whole path with one arrow in your first example.

The second example should work, but with a correct bracketing (you need to enclose the argument of the \tikz command if you have more than one tikz statement)

\newcommand{\toto}{\mathrel{\tikz[baseline] {%
\draw[->] (0ex,.96ex) -- (3ex,.96ex);
\draw[->] (0ex,.16ex) -- (3ex,.16ex);}}}