I'm trying to create a symbol of a gray triangle with a black border. I managed to do so using:

\newcommand{\factor}{{\color{gray} \blacktriangledown}\hspace{-1.6ex}\triangledown}

However, the two triangles go out of sync when the \factor is used in a subscript or superscript. That is, the space becomes too large and the black triangle is no longer over the gray one.

Is there a way to ask the space to be relative to the current font, such that it will take into account whether it is in super/sub-script?


The simplest way is to use \mathrlap from mathtools


With \mathrlap you get "no advancement", so the two symbols are placed one over the other.

A pair of extra braces would allow to say $a_\factor$; on the other hand there are already a number of commands that don't allow it (\notin, for example). In this case, they could be safely added:


However, the extra pair of braces will make the symbol an ordinary one, with regard to surrounding space (that's why \notin hasn't it, since it's a relation symbol). So one has to pay attention on the nature of the requested symbol.

To get spacing in math mode that changes automatically in text or in sub(super)scripts, you have to use mu units and \mspace; but in this case it's not necessary.

  • Adding an extra {} in the definition will allow you to use a_\factor instead of having to say a_{\factor}. – Peter Grill Oct 21 '11 at 18:00
  • @PeterGrill Yes; I'll add in my answer. – egreg Oct 21 '11 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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