TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use inline TikZ code to create my own subscript symbol. For example something like

$V_{\tikz{ \draw [|->] (0,0) -- (2ex,0); }}$

The problem is that it is not scaled. The length of the arrow is longer than 2 times the character x (ex means the height of character x). How can I fix this? The problem becomes really painful, if the symbol is a subscript of a subscript. TikZ doesn't scale the symbol although the absolute height of ex changes.

I don't want to use a 'standard' math symbol. Actually, my symbol is more complicated and no mathematical symbol is available.

share|improve this question
You can start with using em instead of ex. Also arrow head size is often related to the line width hence you can also make it depend on the font size. Something like $V_{\tikz[line width=1/3em]{\draw[|->] (0,0) -- (0.5em,0);}}$ – percusse Apr 1 '13 at 16:37
Thx for your help but it won't work. Here an example: $V_{\tikz[line width=1/3em]{\draw[|->] (0,0) -- (0.5em,0);}}$ $\frac{1}{V_{\tikz[line width=1/3em]{\draw[|->] (0,0) -- (0.5em,0);}}}$ "V" is scaled properly but not the Tikz symbol. – user4811 Apr 1 '13 at 16:49
You can use amsmath’s \text macro to get the correct scaling of the font units (em and ex), still the line width is fixed and so are the arrows (including some fixed lengths like 2pt). I think one need to declare new arrows that are based on font units or scale the resulting \tikz with \resizebox and \mathchoice or \mathpalette. – Qrrbrbirlbel Apr 1 '13 at 16:52
Could you show your “actual symbol”? Maybe there is a better choice than using TikZ. – Qrrbrbirlbel Apr 1 '13 at 16:57
@Qrrbrbirlbel: This was the solution. The inline Tikz code must be encapsulated by "\text{}" for correct scaling. I have drawn the arrow head with a simple filled, triangle node. It works like a charm and looks great! Thx!!! – user4811 Apr 1 '13 at 19:03

The macro \text from the amstext (also loaded by amsmath) package sets up the correct font sizes and can used to correctly access the font units em and ex.

From your comments, it seems as if you have used font-size-based nodes for the arrows instead of using real arrows (which is probably not a bad idea because TikZ is very inflexible when it comes to arrow sizes), however I have included a small redefinition of the | arrow tip that takes one option (set with \pgfsetarrowoptions and accessed with \pgfgetarrowoptions).


\newcommand*{\my@arrow}{\text{\tikz\draw[:->] (0,0) -- (2ex,0);}}
  \advance\pgfutil@tempdima by0\pgflinewidth%
$\displaystyle\myarrow\textstyle\myarrow V_{\myarrow_{\myarrow}}$


enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.