TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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'm not satisfied with the new command I've made. My code:

$\ps{Y}{y}$ %example

My problem is that there's too much space between the subscripted Y and the left parenthesis. Does anyone know how to get these two closer together?

share|improve this question

migrated from stackoverflow.com May 28 '11 at 17:09

This question came from our site for professional and enthusiast programmers.

up vote 7 down vote accepted

A \left-\right subformula is treated as an Inner atom and this adds some space before and after the subformula, in certain circumstances. One can get the desired behavior by


so the spacing inserted will disappear (TeX doesn't insert space between an opening atom and an inner one, nor between an inner atom and a closing one).

It's better to define "P" with \operatorname than with \mbox.

As Philippe Goutet remarks, if superscripts or subscripts need to be attached to the closing parenthesis, the definition should be

share|improve this answer
And if you want something like $\ps{X}{\dfrac{1}{y}}^2$ to work correctly (the exponent 2 will be too low with your solution), you can by using \mathopen{}\mathclose{\left(#2\right)}. – Philippe Goutet May 29 '11 at 8:46
@Philippe You can use \ps{X}{\dfrac{1}{y}\aftergroup^\aftergroup2} :) – egreg May 29 '11 at 17:29
if you like \aftergroup trickery, you can use it to redefine \left and \right to produce open and close atoms (see tex.stackexchange.com/questions/2607/…). Here, it's really a shame that your macro \ps doesn't work correctly if there's an exponent afterwards when the fix is so simple. – Philippe Goutet May 29 '11 at 21:51
@Philippe I don't think that the OP has the necessity to set exponents after the parenthesis. But I'll edit my answer anyway. Thanks. – egreg May 29 '11 at 21:55
I knew posting to StackExchange.com was the right thing to do. I really appreciate all of the help. I'm definitely coming back here with any future questions. – Max May 30 '11 at 0:10

You can use a math kerning with a negative value (change -3mu to the value that best suits your needs):

share|improve this answer
Thanks. I really appreciate it. – Max May 28 '11 at 17:50
this will leave an unwanted space after the construction. Moreover it won't work in subscripts and superscripts (this would be solved with \nonscript\mskip-3mu, though). – egreg May 28 '11 at 21:46
@egreg: thanks for the explanation. – Gonzalo Medina May 28 '11 at 21:58
@Max: as @egreg has pointed out, my solution is not completely correct. You should accept egreg's answer instead of mine. – Gonzalo Medina May 28 '11 at 21:59
I remembered a message by Will Robertson on comp.text.tex; he ascribed the method to F. Mittelbach. – egreg May 28 '11 at 22:06

You can see how negative spacing commands are used on this page. So for your example, it would be something like

share|improve this answer
We prefer for answers on this site to be self contained rather than just links to other pages. Could you perhaps add to this answer some examples of how the OP might achieve the desired results? – Seamus May 28 '11 at 17:17
@ Seamus: Uhm, I did actually put an example but maybe I am missing the point, care to correct me please? – percusse May 28 '11 at 17:25

Your Answer


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.