# Tag Info

156

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}, ...

35

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

25

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}}$

25

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} ...

24

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 } { ...

23

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

22

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

21

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} ...

20

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

20

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}.

20

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

17

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

15

The first one might not be a good idea, like you already noticed, because op could be mistaken for o⋅p. But I don’t think the other options are correct either. \operatorname{op} puts correct spacing around keywords, when used as mathematical operators. That is not the case here. \text{op}, at least syntactical, means prose. But you are trying to display ...

14

What? afraid of going beyond 255? not me! This was obtained as $\epictower{x}{600}$. I must point out that this reproduces exactly what TeX would have done (were it not for the limitation to 255 group levels) inclusive of what appears as a quite odd feature regarding extra horizontal spaces; these spaces may be seen from using \fboxes, let me demonstrate ...

14

you're using the right quote inside the superscript. that will make the primes too small. you should use \prime instead. is this more like what you want? this was produced with $f^{\prime\prime\prime\cdots\prime\prime}$ explanation: the right quote is a shorthand for $^\prime$, and special treatment is given to multiple right quotes so that they ...

14

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} ...

14

The default positions of sub and superscripts are closer to the baseline in textstyle as TeX tries to maximise the chance that the expression does not disturb the paragraph line spacing. Your first example is the standard setting for inline math, however with the larger scripts caused by the subscripting, TeX has to move them further apart. This is ...

14

The star is treated as binary operator. In the first two cases, there are not enough math atoms for a binary operator, but in the third case, the first star is "multiplicated" with the third star and the second star is set as binary operator with additional spaces. You can get rid of this behaviour by putting the star in braces. Braces in math mode make a ...

13

You have additional $signs in your code snippet. The superscript ^, and subscript _ need to be in math mode. Use$\triangle^m$for superscript. If you want a subscript use$\triangle_m$. If you intention is to make the entire term a sub- or superscript then you'll need to enclose it with a {} group. Note: For the superscript version, I think it looks ... 13 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} 13 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 ... 13 Why is the vertical positioning different in the two expressions? Because in the first case you're adding subscripts and superscripts to the parenthesis, while in the second case the whole subformula is the nucleus of the math atom to which the superscript and subscript fields are added. Is there anything the LaTeX user should pay attention to to get such ... 13 If you are typesetting chemical formula, look up the mhchem package. This allows you to typeset chemical formulae easily. For example: \ce{CO2} has the "2" as a subscript. Neat. \documentclass{article} \usepackage{mhchem} \begin{document} \ce{H2SO4} \end{document} Yields: 13 Just for fun, with low level commands: \documentclass{article} \newcommand{\stacked}[2]{% \vcenter{\tabskip=0pt \gdef\separator{/} \halign{\scriptstyle##$\hfil&&$\scriptstyle\separator##\hfil\cr #1\cr \noalign{\nointerlineskip\kern.2ex\gdef\separator{\phantom{/}}} #2\crcr \noalign{\kern.275ex} }% }% } ... 13 Definitely not ^{op} the math italic font should never be used for multi-letter identifiers. ^\operatorname{op} (by default) uses the same font as \mathrm with \mathop spacing (the same as \log or \sin. The \mathop has no effect in the usage shown but would in other contexts. ^\text{op} (with the amsmath definition of \text) will make a mathord, using the ... 12 You can use \DeclareMathSizes; here's what LaTeX has by default: \DeclareMathSizes{5}{5}{5}{5} \DeclareMathSizes{6}{6}{5}{5} \DeclareMathSizes{7}{7}{5}{5} \DeclareMathSizes{8}{8}{6}{5} \DeclareMathSizes{9}{9}{6}{5} \DeclareMathSizes{\@xpt}{\@xpt}{7}{5} \DeclareMathSizes{\@xipt}{\@xipt}{8}{6} \DeclareMathSizes{\@xiipt}{\@xiipt}{8}{6} ... 12 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 ... 12 It's not necessary to go into math mode (explicitly) in order to typeset text symbols: the relevant command is \textsuperscript. For example, your authors can be Jun Zheng\textsuperscript{\textdagger}, Suhail Saquib\textsuperscript{\textasteriskcentered}, ... and the first affiliation \makebox[0pt][r]{\textsuperscript{\textdagger}}Department of ... 12 You could redefine \frac to look ahead: \documentclass{article} \makeatletter \let\old@frac=\frac \def\frac#1#2{% \@ifnextchar^ {\left(\old@frac{#1}{#2}\right)} {\old@frac{#1}{#2}}% } \makeatother \begin{document}\frac{1}{2}, \frac{1}{2}^2$. $\frac{1}{2}, \frac{1}{2}^2$ \end{document} This gives: 12 The superscript "th" seems to have come into use in the Victorian age; then it was dropped and it resurrected when some word processor made it their default. See the nice column on TUGboat by Peter Flynn about this (TUGboat 26, n. 3, 2005, p.~196). In mathematical writing such a use can be confused with exponents: what does$i^{th}\$ mean? Is it "i raised ...

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