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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was writing this formula:

$$^gp = ^gR^l_l+^go_l$$

$g$ are superscripts, but they should be close to other letters. How can I solve this problem?

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). – Andrey Vihrov Oct 5 '11 at 13:52
4  
just a sidenote, you really should not be using $$ ... $$. These don't deal with vertical spacing in a consistent way, use \[ ... \] instead – Roelof Spijker Oct 5 '11 at 13:58
up vote 14 down vote accepted

For a quick and dirty solution, try putting an empty group {} before the ^ symbol.

\documentclass{article}
\begin{document}
\[
^gp = {}^gR^l_l+{}^go_l
\]
\end{document}

For a better method, check out the mathtools package, which provides the \prescript command.

share|improve this answer
    
This prevents the superscripts from being appended to the symbols they occur before. Of course it has no effect on the first superscript. Since italicized letters slant to the right it is reasonable to want the superscripts pushed to the right as well, further than what this answer provides. For this use \! as in the answer I've posted. – j0equ1nn Feb 4 at 22:34

In addition to the other solutions already presented, here is another one:

The (super-small) leftidx package provides left and right super- and subscripts to be typeset by means of \leftidx that is defined as follows:

\newcommand\leftidx[3]{%
  {\vphantom{#2}}#1#2#3%
}

It therefore provides

\leftidx{<left indexes>}{<object>}{<right indexes>}

where <left indexes> and <right indexes> are similar in context to regular super and subscript usage. Here's an example:

\documentclass{article}
\usepackage{leftidx}% http://ctan.org/pkg/leftidx
\begin{document}
\[\leftidx{^g}{p}{} = \leftidx{^g}{R}{^l_l}+\leftidx{^g}{o}{_l}\]
\end{document}

Leftidx package example

share|improve this answer

Regardless of how you are implementing mathmode, this will move the superscripts closer to what they precede:

^g\!p = {}^g\!R^l_l+{}^g\!o_l

This will work inside single or double $, inside align, etc. If the issue was simply that you didn't want the superscripts appended to the symbols before them, then you have your answer already by inserting the {}. Personally I have sometimes wanted the superscripts closer even beyond this, to compensate for italicized letters slanting to the right. The

\!

simply reduces horizontal space.

share|improve this answer
    
@egreg True that you need to separate the superscript from a symbol directly before it, which can be done with {}. Otherwise, how am I just reproducing the problem? Using \! is a far more efficient solution than the previous answers. In fact many of the answers do not even result in a reduction of horizontal space, which is what was requested. – j0equ1nn Feb 4 at 22:29
    
I ran into this independently, wanting closer superscripts since italicized letters slant to the right. This is more apparent though with capital letters. Look at what happens for instance with $^gS$ versus $^g\!S$. – j0equ1nn Feb 4 at 22:36
    
Okay but I wasn't. I wanted to put this here in case anyone sought to resolve the issue I mentioned. After all a question about that would likely be closed as duplicate and linked to this. I don't mean to be irritating, I came upon this question myself seeking an answer to the issue I brought up. – j0equ1nn Feb 4 at 22:41

The first solution suggested by @Ian Thompson may have some alignment issues (depending on what you actually have as super-/subscripts). But there again, a work-around is:

\begin{equation*}
{}^{14}_{6}\text{C}
\qquad \text{versus} \qquad
{}^{14}_{\phantom{1}6}\text{C}
\end{equation*}

NOTE: Example taken from The Not So Short Introduction to LaTeX2e (page 70).

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.