I want a custom symbol on top of a variable. The problem is that the symbol size always keeps the same if the variable size is changed. In a more sophisticated formula with fractions etc. that looks horrible.
Here an example. To reduce the vertical space I have used code from How can i shrink (or expand) the vertical spacing in \stackrel?.
\documentclass{minimal}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand{\defeq}{%
\mathrel{\vbox{\offinterlineskip\ialign{%
\hfil##\hfil\cr
$\text{\tikz{\draw[-, line width=0.2ex] (1.6ex,0.5ex) -- (1.6ex,-0.5ex); \begin{scope}[xshift=0ex] \draw[-, line width=0.2ex] (0,0) -- (1.4ex,0); \fill[black] (1.5ex,0) -- (1ex,0.5ex) -- (1ex,-0.5ex) -- cycle; \end{scope} }}$\cr
\noalign{\kern-0.4ex}
}}}}
\begin{document}
\begin{equation}
B_{\overset{\defeq}{AB}} \overset{\defeq}{AB}
\end{equation}
\end{document}