# Tag Info

67

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

61

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

55

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

47

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

44

In TeX and LaTeX, it is vital to distinguish between "commands" or "control sequences" on the one hand and TeX-special characters on the other. Only the former begin, in general, with a backslash (\) character. (But see the final paragraph below for examples of commands which do not start with a backslash.) ^ and _ are but two examples of TeX-special ...

40

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

31

These symbols remind of footnote symbols, which following this sequence: (1) *, (2), \dagger, (3) \ddagger, (4), \mathsection, (5) \mathparagraph, (6) \|, (7) **, (8) \dagger\dagger and (9) \ddagger\ddagger. You'll notice this sequence when viewing the definition of \@fnsymbol (from latex.ltx): \def\@fnsymbol#1{\ensuremath{\ifcase#1\or *\or \dagger\or \...

29

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

28

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

28

There's nothing weird about the placement of the three superscript asterisks. They are placed at different heights because they occur in three distinct math styles. (Aside: TeX has 8 possible math styles. See p. 140f. in the TeXbook for more information about these 8 styles.) in the first term, TeX is in (uncramped) display style, labelled D in the TeXbook; ...

27

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

27

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

27

The apostrophe is essentially equivalent to ^{\prime}, which is the reason for the output you get from ^{\dagger''}. It's a very handy shorthand in most cases, compare f'(x) with f^{\prime}(x). In your case you don't want a second level superscript. Solution: use \prime. \documentclass{article} \usepackage{amsmath} \begin{document} \[ \hat{c}_{\omega l}^{...

26

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

26


24

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

22

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

21

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

19

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

18


16

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

15


15

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

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