# Tikz Arrow Libraries: How can I migrate from arrows to arrows.meta without getting annoyed?

I have some legacy code that uses the arrows library, and I want to reuse some of that code in new work with the arrows.meta library (including, later, tweaking the arrow heads).

Rather than going through everything to fix >=triangle 45 (etc), I thought I might just be able to define a new style to pass through to the new library. Here's my MWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
% Failed attempt at providing legacy arrowheads:
\tikzset{triangle 45/.tip={Triangle[angle=45]}}
\begin{document}
% Legacy tikzpicture:
\begin{tikzpicture}[>=triangle 45]
\draw[->] (0,0) -> (2,0);
\end{tikzpicture}
\end{document}


However, that fails miserably:

...
(d:/TeXlive/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.meta.code.tex
))
Runaway argument?
45 +0 +0 +0 \pgf@stop \expandafter \pgfarrowsaddtooptions \expandafter \ETC.
! File ended while scanning use of \pgfarrowsfourparameters@.
<inserted text>
\par
<*> test.tex


It looks like .tip is expecting more parameters, but I couldn't find anything in the manual to clarify this.

What am I doing, or expecting, wrong?

• I think it should be something like Triangle[angle=45:1pt 3] (pag. 211) – Nico Boni Dec 19 '14 at 10:11
• @dcmst : That works, even though I don't really understand most of the parameters. If you'd care to post that as an answer, I'll be happy to accept it. – Brent.Longborough Dec 19 '14 at 12:29

The angle key should be specified in the form of angle=<angle>:<dimension>, where, according to the PGF manual:

This key sets the length and the width of an arrow tip at the same time. The length will be the cosine of <angle>, while the width will be twice the sine of half the <angle>.

So in the MWE given above, we'll have

Triangle[angle=45:3pt]


It is also possible to specify an optional argument:

Triangle[angle=45:1pt 5]


which according to the manual:

if the optional factors are given, they add a certain multiple of the line width to <dimension> before the sine and cosines are computed.

\documentclass[margin=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
% Failed attempt at providing legacy arrowheads:
\tikzset{triangle 45/.tip={Triangle[angle=45:3pt]}}
\begin{document}
% Legacy tikzpicture:
\begin{tikzpicture}[>=triangle 45]
\draw[->] (0,0) -> (2,0);
\draw[-{Triangle[angle=45:1pt 5]}] (0,-.2) -> (2,-.2);
\end{tikzpicture}
\end{document}


The key angle' does not require a <dimension> to be specified:

Sets the width of the arrow to twice the tangent of <angle>/2 times the arrow length. This results in an arrow tip with an opening angle of <angle> at its tip and with the specified length unchanged.

All the quotes are from the PGF manual, pag 188.