# Customize |<->| arrowhead in Tikz

I am quite happy with the |<->| arrowhead in Tikz but I would like to control the length of the |. Is there a simple way to achieve this? In tikz.code.tex, I could find

\pgfarrowsdeclarecombine*{tikz@|<@#2}{tikz@>|@#2}{#1}{#2}{|}{|}


which is somehow related to the question but it looks like in pgflibraryarrows.code.tex there is nothing to grab. It would be nice if this | length could be a parameter.

-

A much improved answer, thanks to percusse's information that arrowhead parameters can be set (and read) using \pgfsetarrowoption (and \pgfgetarrowoptions).

The declaration below is adjusted from pgf's declaration of |.

\documentclass{article}
\usepackage{tikz}

\pgfarrowsdeclare{var|}{|var}
{
\pgfarrowsleftextend{+-0.25\pgflinewidth}
\pgfarrowsrightextend{+.75\pgflinewidth}
}
{
\pgfsetdash{}{+0pt}
\pgfsetrectcap
\pgfpathmoveto{\pgfqpoint{0.25\pgflinewidth}{-\pgfgetarrowoptions{var|}}}
\pgfpathlineto{\pgfqpoint{0.25\pgflinewidth}{\pgfgetarrowoptions{var|}}}
\pgfusepathqstroke
}

\pgfarrowsdeclarecombine*{var|<}{>|var}{to}{to}{var|}{|var}
\begin{document}
\pgfsetarrowoptions{var|}{10pt}
\tikz{
\draw[var|-|var] (0,0)--(1,1);
\draw[var|<->|var] (1,0)--(2,1);
}
\end{document}

-
See the options for the var arc example in the manual p.614. –  percusse Aug 27 '12 at 11:57
shoudn't the name of the arrowhead be {|var}{var|}? And the triangles are not possible? What about var|<->var| –  pluton Aug 27 '12 at 12:28
yes, I guess {|var}{var|} is prettier. Triangles... you mean the combined arrow? I've included a declaration for var|<...`>|var' –  Sašo Živanović Aug 27 '12 at 12:48