TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

The title basically describes the problem. Here is a minimal example:



When I compile this, the 135 is down and to the left of the 345, rather than directly below it. I get the same issue when I use color instead of xcolor. Any fixes?

share|improve this question
up vote 4 down vote accepted

Using \textcolor{<color>}{<text>} works. Despite the name \text... it actually doesn't change to text mode so the content is still typeset as math.


   \[ X_{\textcolor{red}{135}}^{\textcolor{cyan}{345}} \]

Note that \color doesn't take a second argument. The {135} or {345} behind it is just taken as following material. You should also not use $$ in LaTeX documents. See Why is \[ ... \] preferable to $$?.

share|improve this answer
Thanks! Plus some more characters. – David Speyer Apr 21 '11 at 22:28

A workaround: use another pair of braces

  \[ X_{{\color{red}{135}}}^{{\color{cyan}{345}}}\]

It probably is some sort of grouping issue.

share|improve this answer
Good point. The { } around the numbers however aren't necessary.. They are not read as argument. – Martin Scharrer Apr 21 '11 at 22:30
I just had a look at the definition of xcolors definition of \textcolor and all what it does is basically call \leavevmode{\color{<color>}<text>}, so our two answers are leading to the same :-) – Martin Scharrer Apr 21 '11 at 22:36

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.