44

I'm a relative beginner with Lyx. When I type in this code I'm hoping for T' to be followed by superscripts and subscripts. Instead I get a "double superscript" error when I try to view the pdf

\[
T'_{\alpha_{1}\alpha_{2}\ldots\alpha_{n}}^{\mu_{1}\mu_{2}\ldots\mu_{m}}
\]

Any idea how I can fix this?

Seamus
  • 73,242
Peter4075
  • 769

3 Answers3

41

You can insert \prime symbol as part of the superscript ^{...}, rather than having "two superscripts":

enter image description here

\documentclass{article}
\begin{document}
\[
  T_{\alpha_{1}\alpha_{2}\ldots\alpha_{n}}^{\prime\mu_{1}\mu_{2}\ldots\mu_{m}}
\]
\end{document} 
Werner
  • 603,163
  • Thank you everyone. This was the solution that worked best for me. \prime gives a nice clear symbol as well, much nicer than '. – Peter4075 Oct 20 '11 at 18:53
39

' in math mode expands to ^\prime, so your code is equivalent to T^{\prime}_{...}^{...}, which explains the error you get. You can either swap sub- and superscripts to be T'^{...}_{...} (' is defined in a way that merges it with an adjacent superscript), or use \prime inside the superscript as suggested in Werner's answer, so both

T'^{\mu_{1}\mu_{2}\ldots\mu_{m}}_{\alpha_{1}\alpha_{2}\ldots\alpha_{n}}

and

T_{\alpha_{1}\alpha_{2}\ldots\alpha_{n}}^{\prime\mu_{1}\mu_{2}\ldots\mu_{m}}

are valid.

Stephen
  • 14,890
25

In mathmode, ' acts like ^\prime. So you have two superscripts, which isn't allowed. One way around this is to group the T' like so:

\[
{T'}_{\alpha_{1}\alpha_{2}\ldots\alpha_{n}}^{\mu_{1}\mu_{2}\ldots\mu_{m}}
\]

But this doesn't look good. I'd suggest maybe replacing T' with some other variable name…

As Khaled has pointed out, this solution breaks the horizontal positioning of subscripts:

broken placement of subscripts

The top one is my grouping solution, the bottom is doing it The Right Way. Given the special service the prime superscript performs (marking out T' as an entity distinct from T, I'm not sure that this solution isn't in fact better.

Either way, I stick to my suggestion that you should consider using a different variable name.

Seamus
  • 73,242
  • Could whoever downvoted my answer explain why? – Seamus Oct 20 '11 at 17:08
  • Because grouping {T'} breaks horizontal placement of subscripts as it puts it in a box of its own with all its side effects, so it is generally a bad idea. – خالد حسني Oct 21 '11 at 00:20
  • 5
    @KhaledHosny Thanks. I'm not sure that this is a bad thing in this case. It neatly differentiates the prime from the other sub/superscripts. After all, the prime ins't just another superscript, it's serving a slightly different function… – Seamus Nov 01 '11 at 09:06
  • Right, I think you have a point here. – خالد حسني Nov 01 '11 at 12:30