5
$\begingroup$

I can find nothing in the Mathjax tutorial about left superscripts, which are used for the set of functions with a given domain and codomain.

$\endgroup$
8
  • 3
    $\begingroup$ I have used, e.g., \overset {2}\, x which renders as $\overset {2}\,x$ though there might be a more natural way to do it. $\endgroup$
    – lulu
    Sep 1, 2021 at 19:02
  • 2
    $\begingroup$ @lulu Shouldn't you post that as an answer? $\endgroup$ Sep 1, 2021 at 19:03
  • 1
    $\begingroup$ Well, no...because I am not at all sure that someone else might not have something better. Note that, for example, my left superscript doesn't come out at the same height as a right superscript would. If I replace $x$ with $x^2$ I get $\overset {2}\,x^2$ which doesn't really look great. $\endgroup$
    – lulu
    Sep 1, 2021 at 19:04
  • 2
    $\begingroup$ Actually, \,^2x^2, which renders as $\,^2x^2$ looks pretty good. To be clear: all I have done there is to put a regular superscript onto a space. $\endgroup$
    – lulu
    Sep 1, 2021 at 19:15
  • 5
    $\begingroup$ ${}^2x$ renders as ${}^2x$. An alternative is something like $\phantom{t}^2t^2$: $\phantom{t}^2t^2$. $\endgroup$
    – Xander Henderson Mod
    Sep 1, 2021 at 19:18
  • 2
    $\begingroup$ Just join the rest of us and write $M^\kappa$. $\endgroup$
    – Asaf Karagila Mod
    Sep 1, 2021 at 19:31
  • $\begingroup$ This is quite common (with subscripts) when dealing with hypergeometric functions like ${}_pF_q(\dots)$ and I use the approach given by @XanderHenderson. $\endgroup$
    – Paramanand Singh Mod
    Sep 2, 2021 at 11:23
  • 1
    $\begingroup$ I use the @XanderHenderson method also. But often with spacing on the left: 5\,{}_2F_1 not 5{}_2F_1 to yield $5\,{}_2F_1$ not $5{}_2F_1$ $\endgroup$
    – GEdgar
    Sep 2, 2021 at 15:47

1 Answer 1

11
$\begingroup$

As pointed out in the comments (by lulu and Xander), it is possible to put the superscript on a blank space. And an alternative is to put it on a vertical (=zero width) phantom box created by TeX's \vphantom-command, or empty braces ${}$. I experiment with the differences in what follows.

This is what it looks like if you simply put the superscript on a blank space: $$\,^2\Gamma^i_{jk},\qquad \,^2\bigcup_{n=1}^{17}U_i,\qquad\,^2\alpha_i$$ You see that the superscript is always at the same height irrespective of the height of the following character. This makes sense because the elevation of a superscript depends on the height of the box it is a superscript of. Here the box contains that blank space.

Next I test what changes, if instead of a blank space we place the superscript on a vertical phantom box that gets its height calculated from the character immediately following the superscript: $$\vphantom{\Gamma}^2\Gamma^i_{jk},\qquad \vphantom{\bigcup}^2\bigcup_{n=1}^{17}U_i,\qquad\vphantom{\alpha}^2\alpha_i$$ You see that this time the left superscript on a tall character is placed higher. MathJax-Source for the above displayed line: $$\vphantom{\Gamma}^2\Gamma^i_{jk},\qquad \vphantom{\bigcup}^2\bigcup_{n=1}^{17}U_i,\qquad\vphantom{\alpha}^2\alpha_i$$. You see that you need to write the superscripted character twice – once as a phantom and then for real.

Using empty braces it looks like $${}^2\Gamma^i_{jk},\qquad {}^2\bigcup_{n=1}^{17}U_i,\qquad{}^2\alpha_i.$$ As expected, the elevation of the left superscript is then determined only by the height of the box created by the empty braces.

Having the superscript on a blank space may also affect horizontal spacing. After all, the vertical phantom box should have zero width, whereas the box containing any amount of blank space has a strictly positive width. So the output may look different. Let's test.

Here are $\,^j\Gamma_{ik}$ symbols $\,^i\alpha_j$ where the left superscript is on a blank space.

Here are $\vphantom{\Gamma}^j\Gamma_{ik}$ symbols $\vphantom{\alpha}^i\alpha_j$ where the left superscript is on a vertical phantom.

Here are ${}^j\Gamma_{ik}$ symbols ${}^i\alpha_j$ where the left superscript is on a box created by empty braces.

As expected, there is a bit less white space in front of the symbol, when we use either a phantom or empty braces.

Your pick!


However, neither of these suggestions logically ties the superscript to the character on its right. Therefore something strange or undesirable may happen. The phantoms are just a hack (as is, of course, the use of a blank space). Anyway, my recommendation is to use \vphantom because it creates a box of the appropriate height and zero width. If, instead, you need a box of zero height and the width of a known character, there is the analogous command \hphantom, 'h' for horizontal.

$\endgroup$
4
  • 2
    $\begingroup$ I will add that if you use something like this in some post, you might consider using a macro. E.g., if you use $\newcommand{\Map}[2]{{\vphantom{{#2}}}^{#1}{#2}}$ $\newcommand{\Map}[2]{{\vphantom{{#2}}}^{#1}{#2}}$, then in the whole post you can use $\Map AB$ to get $\Map AB$. And if you later want to change the way it looks, you can simply change the macro and it will change all occurrences. (If there are many of them, it is a lot of work to change each one of them.) And to some extent this resolves also the problem that "logically ties the superscript to the character on its right." $\endgroup$ Sep 2, 2021 at 8:59
  • $\begingroup$ @Xander Henderson: From an 8 April 2002 sci.math post of mine where tetrated numbers occur: "It is standard practice to denote x^^y as x with a left superscript y. [A left superscript is sometimes called a "prescript".] Of course, that option is not available in ASCII format. In fact, as far as I know, that option (i.e. a left superscript) is not available in LaTeX either, at least as an explicit command in the same way that \$x^{y}\$ and \$x_{y}\$ represent "x superscript y" and "x subscript y", respectively. (continued) $\endgroup$ Sep 2, 2021 at 20:23
  • $\begingroup$ However, I've discovered that \${}^{y}x\$ represents x^^y fairly well. [That is, use 'y' as a superscript to an empty space and then follow this "exponentiated pair" with 'x'.]" $\endgroup$ Sep 2, 2021 at 20:23
  • 2
    $\begingroup$ related TeX.SE post for the LaTeX side of things here $\endgroup$ Sep 3, 2021 at 1:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .