10

In math mode, the spaces between subscripts and letters are not always the same, but depending on the preceding letters!

See e.g. (different colours indicate different spaces)enter image description here

Is it the feature of packages {amssymb} {amsmath} or ....

Equations using {newtxmath} math font:

    \begin{equation}
    \left.
    \begin{array} {c}
    \displaystyle \frac{\partial\epsilon_f}{\partial t} + \nabla \cdot (\epsilon_f \boldsymbol{u}_f) = 0 \\
    \displaystyle \frac{\partial  (\rho_f \epsilon_f \boldsymbol{u}_f)}{\partial t} + \nabla \cdot (\rho_f \epsilon_f \boldsymbol{u}_f \boldsymbol{u}_f) = -\epsilon_f \nabla p + \mu \nabla^2(\epsilon_f \boldsymbol{u}_f) + \boldsymbol{f}_b
    \end{array}
    \right\}
    \end{equation}

Is there any global setting/solution for this issue, i.e. to adjust the spacing automatically depending on the letters and subscripts?

EDIT: put {bm} package after amsmath and font packages will significantly improve the spacing.

3
  • Since you are using newtxmath I'd like to recommend the mtpro2 package, whose lite version is free. it has a package option subscriptcorrection, which deals exactly with the kind of problem you have.
    – mafp
    Jan 10 '13 at 15:57
  • I just had a look at the Readme pf mtpro2 package. Some of the mathematical symbols and operators seem to be improved a lot. Does the free version lite provide these features?
    – KOF
    Jan 10 '13 at 16:11
  • Which stuff is available or not can be checked in the manual.
    – mafp
    Jan 10 '13 at 17:00
7

After some testing I found that loading \usepackage{bm} significantly improves the spacing. As David points out in the comment, the kerning is possible, but grouping plays a role here. Obviously his package bm does better job on \boldsymbol than amsmath. Just remember to load bm after amsmath and after your font packages!

5
  • I know \! produces a negative thin space in math mode, but I was wondering, is there a versatile solution to adjust the spacing automatically to a certain value between subscript and letter?
    – KOF
    Jan 10 '13 at 14:32
  • TeX does use per-character kerning information of subscripts compare $P_1 P{}_1$ where the subscript is pulled in for P in the first case but not in the second. Jan 10 '13 at 14:34
  • @tohecz Thanks, I tried bm package before, the spacing looks even. However, the bold math font will become cm font. Anyway, it's a good solution for now.
    – KOF
    Jan 10 '13 at 15:10
  • @KOF bm will use the fonts that are loaded at the point the package is loaded so if boldmath version is already set up before bm is loaded then it shouldn't use cm fonts. Jan 10 '13 at 15:20
  • @DavidCarlisle, now it works like charm when putting bm package after the font package!
    – KOF
    Jan 10 '13 at 15:24
6

It is a feature of the font and TeX's font parameters.

While TeX does have some fontdimen parameters which control subscript positioning the main controller here is the font metrics where Tex is using the kerning information to pull (or not) subscripts under italic sloped base. However the visual gap also depends on which pixels are black compared to the specified rectangular bounding box of the glyph, and TeX has no knowledge of that at all.

3
  • 1
    if you compare the results of \[ f_\epsilon \boldsymbol{f}_\epsilon \] you will find that the position of the subscript is quite different. one might suspect that the metrics of cmmi and cmmib aren't equivalent, but comparison of the two (via .pl files) shows that not to be the case. that implies that the definition via \boldsymbol must be faulty, and indeed, \[ \text{\textit{\textbf{f}}}_\epsilon \] gives the same result as using \boldsymbol. i'll add this to our problems list. Jan 10 '13 at 15:49
  • 1
    @barbarabeeton The metrics are not used if you use boldsymbol as that starts an hbox (4 actually) and does a new math list in each in a \mathchoice so there is no possibility of getting kern information between the characters it's like \hbox{f}\hbox{f}\hbox{i} has no ligature. That's why \bm goes to some effort to get bold without doing that Jan 10 '13 at 16:37
  • which is why \boldsymbol really needs to be looked at. thanks for the pointer. there was already a request on our list to consider how bm was implemented to see if it could lead to any improvements in amsmath; since it was suggested by frank mittelbach, it's kind of an imperative, when amsmath finally gets scheduled for overhaul, but now that there's a good bad example, it gets upgraded from a request to a bug. Jan 10 '13 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.