I draw an arrow in Tikz and I want to specify the length with a LaTeX length, e.g., \headlength, instead of explicitly writing the length, e.g., 2em. However, it seems that the TikZ does not like LaTeX lengths as input for the length of the arrow head. (See example below)
How could I give a LaTeX length to the option length=? (Thanks!)
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\draw[-{Latex[length=2em]}] (0,0) -- (2,0); %It works!
\newlength{\headlength}
\setlength{\headlength}{2em}
\draw[-{Latex[length=\headlength]}] (0,1) -- (2,1); %It outputs error
\end{tikzpicture}
\end{document}



length, but just "text". – loved.by.Jesus Jun 21 '21 at 12:38