Take the 2-minute tour ×
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.

My question is: How can I write an index above a set of dots? I mean

\mathbb{R} \cdots^{HERE} \mathbb{R}

just to say that I have "n" times cartesian product of R.

share|improve this question
    
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). –  cgnieder Feb 10 '13 at 10:43
    
Oh okey ^^ thanks for the tip :) –  Dan Feb 10 '13 at 10:44

3 Answers 3

Let's make a more realistic example: you want to put n above the dots to denote an omission of terms. Here are possible codes:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\[ X_{1}\times \stackrel{n}{\cdots} \times X_{n} \]

\[ X_{1}\times \overset{n}{\cdots} \times X_{n} \]

\[ X_{1}\times \cdots \times X_{n} \]
\end{document}

The last is just for comparison. Here's the result:

enter image description here

As it's immediately seen, the first has all the spacing wrong because, by rule, TeX transforms the binary operation symbols \times into ordinary symbols since they aren't between "legal" operands. This doesn't happen with \overset and, in fact, the spacings are correct if we compare the second and third lines.

If the "superscripted \cdots doesn't appear between binary operators, it might be necessary to help TeX in adding the correct spacings and

\mathinner{\overset{n}{\cdots}}

would be the right incantation.

Final version

Taking into account all of the above, I believe that the best is to define a new command:

\newcommand{\scdots}[2][]{\mathinner{#1\overset{#2}{\cdots}#1}}

where an optional argument is reserved for additional spacing in case it's needed (I think to overlong superscripts); so

\scdots{n}

\scdots{\textup{HERE}}

or, maybe,

\scdots[\,]{\textup{HERE}}

if the superscript really clashes with the adjacent terms.

share|improve this answer
\[ a \stackrel{\scriptstyle\mathrm{HERE}}{\cdots}  b\]

enter image description here

An alternative if you use amsmath and want to make egreg happy would be \overset

\[ a \overset{\mathrm{HERE}}{\cdots}  b\]

enter image description here

share|improve this answer
    
Thank you very much!! :D –  Dan Feb 10 '13 at 10:53
    
Wouldn't \overset be better? –  egreg Feb 10 '13 at 11:07

If you place the n index above the dots, there may actually be some ambiguity as to whether the Cartesian product contains n or n+2 elements (since the qualifier may be perceived not to include the first and last element). To avoid any such ambiguity, you could use the \overbrace command to generate the following expression:

enter image description here

\documentclass{article}
\usepackage{amsmath,amsfonts}
\newcommand{\R}{\mathbb{R}}
\begin{document}
\[ \overbrace{\R\times\cdots\times\R}^{\text{$n$ times}} \]
\end{document}
share|improve this answer

Your Answer

 
discard

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.