Hot answers tagged


You can use \textsuperscript{th}. It sets its contents in text mode and can be used in math or text mode.


You should not use math, when it is normal text. Use \textsuperscript instead: 2\textsuperscript{nd}. You can also define a shortcut for this, e.g. \newcommand{\ts}{\textsuperscript} Then you could use 2\ts{nd} in the text. Edit: An even nicer solution is to load the package nth with the option super and use the \nth command: \nth{1}, \nth{2}, \nth{3}, ...


There are many tools for scripts: For general math scripts before something, use \prescript provided by mathtools package, for better alignment: $ \prescript{14}{2}{\mathbf{C}} $ For large operators, use \sideset from amsmath: $ \sideset{_a^b}{'}\sum A_n $ For chemical equations, use mhchem package: \ce{^{227}_{90}Th+} For tensors, use tensor package: $...


\documentclass{article} \def\powertower#1#2{#1\ifnum#2>1 ^{\powertower{#1}{\numexpr#2-1\relax}}\fi} \begin{document} $\powertower{x}{100}$ \end{document}


I guess the quickest and easiest solution is to simply write "2nd", "3rd", etc. Superscripts aren't really necessary.


An alternative to nth package is fmtcount. In this case the command is \ordinalnum. By default the ordinal is formatted as superscript, but this is optional, as it is also in nth: \usepackage{fmtcount} % equivalent to \usepackage[super]{nth} \usepackage[level]{fmtcount} % equivalent to \usepackage{nth} But there are some advantages over nth: Limited ...


It is not clear what you want the output to be $y\in[0,1]^{d\prime}$ the \prime is in the superscript along with d. If you want the prime to be on d then just use $y\in[0,1]^{d'}$ which is equivalent to $y\in[0,1]^{d^{\prime}}$


\documentclass[12pt]{article} \begin{document} \[ x^{x^{x^{x^{x^{x^{x^{x^{x^x}}}}}}}} \] \end{document}


For 99% of applications, Werner's answer is good enough. But since Marienplatz has offered a bounty, there presumably is interest in other ways to do this. So here, I show it done with a stack over a null entry. My preamble definition (output on the second line) appears to give the exact same result as \textsuperscript (output on the first line). But ...


I dedicate this code to Sean. :) Long live expl3! :) \documentclass{article} \usepackage{expl3} \usepackage{xparse} \ExplSyntaxOn \cs_new:Npn \paulo_epicrecursion:nn #1 #2 { #1^{ \int_compare:nTF { #2 > 1 } { \paulo_epicrecursion:nn { #1 } { \int_eval:n { #2 - 1 } } } { #1 } } } \NewDocumentCommand{ \powertower } { m m } { \...


Here's a shorter version with LaTeX3 functions: \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{ \powertower } { m m } { #1 \prg_replicate:nn { #2 - 1 } { ^\c_group_begin_token #1 } \prg_replicate:nn { #2 - 1 } { \c_group_end_token } } \ExplSyntaxOff \begin{document} $\powertower{x}{10}$ \end{document} ...


You can do it. Don't.1 \documentclass{article} \makeatletter \begingroup\lccode`~=`* \lowercase{\endgroup\def~}{\wagner@starstar} \newcommand{\wagner@starstar}{% \@ifnextchar*{\wagner@superscript}{\wagner@asterisk}% } \newcommand{\wagner@superscript}[1]{^} \mathchardef\wagner@asterisk=\mathcode`* \AtBeginDocument{\mathcode`*="8000 } \makeatother \begin{...


Are you doing this in math mode? ${}_{t}p_{x}$ should work.


' 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\...


The following image shows the boxes of each character as seen by tex, for each of the cases in egreg's answer. You can clearly see how the boxes of the parenthesis are "too wide", which causes the exponent to be too far. In addition, using egreg's suggestion (\biggl() removes unwanted space before the box of the left parenthesis. Note For generating the ...


I think you can justly regard this strange behaviour as kind of a bug in TeX's sub- and superscript positioning algorithm; it doesn't make sense that both the sub- and the superscript are raised. See below for some suggestions on how to fix the problem. At the end I offer a new positioning algorithm, and I compare it with the old algorithm. (Sorry for the ...


If you are using ConTeXt MkIV, you can even imitate the automatic conversion of MS Word: \usemodule[translate] \translateinput[2nd][2\high{nd}] \enableinputtranslation \starttext On the 2nd of November \unknown \stoptext This will translate all 2nd into 2\high{nd}.


Put braces around the entire part that you want superscripted: $8^{(a - b)}$ Note that from the mathematical point of view, the parentheses () are superfluous here and can be omitted: $8^{a-b}$


It is better to use the bm package for bold math italics, as it gets the positioning of accents and the spacing for sub- and superscripts right. The bm package will also redefine \boldsymbol, so you don't have to replace all \boldsymbol with \bm throughout the document. Therefore, make sure to load bm after amsbsy, which is loaded by amsmath. Still, I ...


The tensor package will do exactly what you require, and more. For your particular case, you need only type \tensor[_t]{p}{_x} Regards


You can insert \prime symbol as part of the superscript ^{...}, rather than having "two superscripts": \documentclass{article} \begin{document} \[ T_{\alpha_{1}\alpha_{2}\ldots\alpha_{n}}^{\prime\mu_{1}\mu_{2}\ldots\mu_{m}} \] \end{document}


What? afraid of going beyond 255? not me! This was obtained as $\epictower{x}{600}$. This reproduces exactly what TeX would have done (were it not for the limitation to 255 group levels) inclusive of a quite odd feature of TeX regarding extra horizontal space on the right. update 2015. I forgot to say in 2013 what I was referring too: the ...


This is a case where manual adjustment is needed. The coloring has nothing to do with it. It has to do with the shape of the parenthesis, which is quite wide. I'd recommend using \biggl and \biggr, in particular because of the coefficient in front of the open parenthesis. \documentclass{article} \usepackage{xcolor} \begin{document} \[ax^2+bx+c=a\left(x+\...


I don't really know why the result is bad; I suspect it has to do with the width of the letter. I wouldn't use such a notation, but that's a personal opinion. With \vec{o}^{\,t} the superscript is moved a bit to the right. One might perhaps let TeX do some computations in order that the shift to the right of the superscript is automatic.


You have to supply a "fake" object for TeX to put indices to: ${}^1_2X^3_4$ However, for chemistry typesetting you should use one of the specialized packages, such as mhchem. This example is taken from mhchem documentation: \ce{^{227}_{90}Th+} It will typeset the symbol for a positive Thorium ion with a charge of 90 and atomic mass of 227.


The text asterisk is raised, while the math asterisk is used for denoting an operation. You can use \mbox{*} or \text{*} (if you load amsmath). However, in general $Q^{*}$ is preferred. You can get the behavior automatically: \documentclass{article} \usepackage{amsmath} %%% magic code starts \mathcode`*=\string"8000 \begingroup \catcode`*=\active \xdef*...


When TeX assembles the various "atoms" of a formula into a whole (a "molecule", if you will), it mainly keeps track of each atom's enclosing rectangular "box", and it arranges the boxes horizontally and vertically according to the rules listed in Appendix G of the TeXbook. In the process of arranging the boxes, TeX doesn't actually "know" what's inside each ...


LaTeX knows eight math styles, four main ones and four secondary. They are called \displaystyle, \textstyle, \scriptstyle and \scriptscriptstyle. In general TeX chooses automatically the right style. In some constructions it uses the secondary style, frequently called the “cramped version”. For instance, when typesetting a fraction when the current style is ...


Let us make things complicated. \documentclass{article} \usepackage{calc} \begin{document} $L^{2,3/4,5/6}_{1,\makebox[\widthof{3/4}]{$\scriptstyle 2,$}\makebox[\widthof{5/6}]{$\scriptstyle 3\hphantom{,}$}}$ \end{document} I agree with Benjamin's comments. Hence an attempt to increase the spaces. \documentclass{article} \usepackage{calc} \begin{document}...


in latex.ltx there is a line \let\sp=^ so there is an alternate command, \sp, that will produce a superscript. @egreg notes in a comment that this isn't available for mathjax, so it's apparently not "portable". however, david cervone (mathjax lead developer) says that MathJax does handle \let\sp=^ [...]. MathJax's \let only works to set a control ...

Only top voted, non community-wiki answers of a minimum length are eligible