When I write {{\tilde{C}}^{0}_{har}}^{\Gamma}
(or the same with fewer curly brackets) in Tex I obtain a double superscript error and I can't solve it. Does someone know how to fix this?
-
3Great question - I'd never have expected this code to result in a double superscript error! – Hendrik Vogt Jun 27 '12 at 11:09
If you want the \Gamma
at the same height as 0
in the exponent, but not next to 0
, then use
$\tilde{C}^0_{\text{har}}{}^\Gamma$
The {}
creates a new base for super-/subscripts that is separate from the first. If you want to place the \Gamma
next to 0
, then you have to combine the superscript (say) in the following way
$\tilde{C}^{0,\Gamma}_{\text{har}}$
If you want \Gamma
to be a superscript of the entire preceding structure, then use
$\mbox{$\tilde{C}^{0}_{\text{har}}$}^\Gamma$
which will place the structure in a (text) box and allow superscripting. I prefer option 2 since options 1 & 3 has \Gamma
practically in "the middle of nowhere." Note that I've used \text{...}
to write har
. This is by virtue of amsmath
.
(The purpose of this answer is to summarize the different aspects in the existing answers and to expand on egreg's explanation.)
You've encountered some really curious aspect of the TeX engine here! My short answer: follow Mico's and Boris' advice and use parentheses around \tilde{C}^{0}_{\text{har}}
; this is the way to go.
As egreg said in his answer, the culprit of your trouble is the \tilde
. In the TeXbook, grouping with {...}
in math mode is explained on page 291 (Summary of Math Mode). For the following recall that {
is a token of category 1:
A character token of category 1 [...] causes TeX to start a new level of grouping and also to begin work on a new math list. When such a group ends—with ‘
}
’—TeX uses the resulting math list as the nucleus of a new Ord atom that is appended to the current list. If the resulting math list is a single Acc atom, however (i.e., an accented quantity), that atom itself is appended.
This means that surrounding \tilde{C}^{0}_{\text{har}}
by braces has no effect! For this one also has to know that the sub- and superscripts are added to the Acc atom \tilde{C}
, making the whole thing with sub- and superscript a single Acc atom. (This is explained at the bottom of page 291.) The result is the double superscript error you encountered.
Apparently Knuth didn't see any need for the extra grouping you're trying to use here. The error message might be his way of telling you "Don't do this!"
The above explanation also shows the easiest way out of the trouble (if you really want to do it without parentheses, which I strongly advise against). Just make sure that the thing you put into the braces is not "a single Acc atom". For example, with
${{}\tilde{C}^{0}_{\text{har}}}^{\Gamma}$
you'll get the output ; already the empty math list
{}
does the trick. Of course this looks a lot more like magic than Werner's good advice to use \mbox{$...$}
. (One might see as an advantage of the {}
trick that you don't have to re-enter math mode inside an \mbox
.)
-
in simpler case, as in tex.stackexchange.com/questions/304559/…, using invisible delimiters seems (at least to me) quite readable. Thanks for your insight here! – Rmano Apr 16 '16 at 8:23
The tilde is a problem. The inputs
${\tilde{a}^b}^c$
${{\tilde{a}}^b}^c$
will give a "Double superscript" error also in Plain TeX, while
${a^b}^c$
won't. This is due to how TeX deals with "Accent" atoms. However, as Mico remarks, a notation like this is ambiguous and should be managed in a different way than trying to have a superscript hanging from nowhere.
Your example code is a bit ambiguous as to what you want to achieve: do you want the \Gamma
to be a superscript to 0
or to har
? Alternatively, should the \Gamma
symbol be a superscript relative to the entire preceding formula? The following code illustrates the differences between the three possibilities; note that I'm loading the amsmath
package to get the \text
command, and I'm using a \widetilde
rather than a \tilde
above the uppercase-C:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\widetilde{C}^{0^\Gamma}_\text{har}$,
$\widetilde{C}^0_{\text{har}^\Gamma}$, or
$\bigl( \widetilde{C}^0_\text{har} \bigr)^{\Gamma}$ ?
\end{document}
-
3I do not see how the code is ambiguous. I'd say it's clear that the
\Gamma
is supposed to be a superscript relative to the entire preceding formula - as the surrounding braces of that formula show. But the (expected) output is indeed ambiguous. Is that what you mean? (By the way, putting parentheses is the way to go!) – Hendrik Vogt Jun 27 '12 at 13:13 -
@HendrikVogt -- I suppose that what may be clear and unambiguous to one person needn't be as clear to another person. I'm glad, though, that you agree with me that using parentheses is the way to go. :-) – Mico Jun 27 '12 at 13:30
Tilde is not a problem. Using both 0
and \Gamma
as superscripts is.
I would suggest the following: $\left({\tilde{C}}^{0}_{har}\right)^{\Gamma}$
-
3The first line of your answer is not correct, as egreg explained. – Hendrik Vogt Jun 27 '12 at 13:03