16

To draw a LaTeX arrow I use the following code:

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\usetikzlibrary{arrows, arrows.meta}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{}
\begin{tikzpicture}[scale=.9, transform shape]
\draw [ultra thick, green!40!black, -latex'] (-.72,4.) -- +(-90:1.4);
\end{tikzpicture}
\end{frame}
\end{document}

Which gives me the left arrow. To make it a double headed arrow, I use a node to fake the second head, which gives me the right double headed arrow.

\begin{tikzpicture}[scale=.9, transform shape]
\draw [ultra thick, green, -latex'] (-.72,4.) node [minimum size=.8cm, xshift=0cm, yshift=-.26cm, path picture={\draw [ultra thick, green, solid, -latex'] (0,0) -- +(90:.4cm);}]{} -- +(-90:1.4);
\end{tikzpicture}

Enter image description here

Is there a way to make a true LaTeX double headed arrow without the use of the node to fake the second head?

Hany
  • 4,709
  • 2
    Why don't you use latex'-latex' ? – BambOo Aug 08 '18 at 09:05
  • Thank you. I tried -latex' -latex' which gave me an error, I did not know that I have to omit the first - – Hany Aug 08 '18 at 09:09
  • 2
    - in arrows definitions represents the arrow line, while < or >, or whatever style, define the kind of tip and position: <-> two sided arrow, -> from left to right, <- from right to left. – Ignasi Aug 08 '18 at 10:05
  • 1
    I came here via Google, but was having problems applying these suggestions. But @Ignasi 's comment I think shows the simplest way: \draw [<->] (-1/3,2/3) -- (-1/3,4/3); I found it on page 41-42 (section 2.17) of the PGF manual (https://ctan.mirrors.hoobly.com/graphics/pgf/base/doc/pgfmanual.pdf) that @BambOo mentioned. – Izek H Jul 16 '21 at 17:22

2 Answers2

23

I hope this helps:

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\usetikzlibrary{arrows, arrows.meta}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{}
\begin{tikzpicture}[scale=.9, transform shape]
\draw[>=triangle 45, <->] (0,0) -- (2,0);
\end{tikzpicture}
\end{frame}
\end{document}

which shall give you

enter image description here

Extra

You could choose to play probably play with \draw[>=style options, <->, color options] (0,0) -- (2,0);

enter image description here

12

To provide a complete answer :

You can use the latex'-latex' style definition.

More documentation is available on arrows definition at section 16.2 page 182 of the pgf manual.

BambOo
  • 8,801
  • 2
  • 20
  • 47
  • Thank you very much for your answer. I will read this section thoroughly. – Hany Aug 08 '18 at 09:44
  • How does one do curved arrows with latex-latex? – user3236841 Apr 29 '21 at 04:14
  • @user3236841 I you have another question, please create a new post, otherwise you may receive little attention. In the meantime, have a look at https://tex.stackexchange.com/questions/508135/why-is-the-bounding-box-not-updated-when-using-arrows-meta-arrowheads-in-inline. Where multiple bent arrows are shown (one of my own questions, maybe not the best example). – BambOo Apr 29 '21 at 07:28