Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Update: (11/29/2012) Looks like Mathematica 9 has the same behavior.

The following graphic shows how Mathematica kerns italic characters in an inline math formula cell (first row) where an \[InvisibleSpace] has been inserted between consecutive characters (which could represent either multiplication of terms or multi-indices depending on context) vs. in an ordinary, non-math text cell which was switched to italics using Ctrl-I (second row).

enter image description here

When the letters ijk for example appear together in a subscript as indices, the spacing between the i and the j appears too wide relative to the distance between the j and the k.

Original Q: Is it possible to turn off this special kerning in math formula cells?

Updated Q: (10/1/2012) A reasonable but nevertheless somewhat inconvenient method to work around this issue has been suggested below. Does anyone know the reason why the kerning rules for juxtaposing italic characters inside math formula cells are different from those for normal, non-math italic text?


For ease of copying:

Cell[TextData[{
 "Text ",
 Cell[BoxData[
  FormBox[
   RowBox[{
   "a", "\[InvisibleSpace]", "b", "\[InvisibleSpace]", "c", 
    "\[InvisibleSpace]", "d", "\[InvisibleSpace]", "e", 
    "\[InvisibleSpace]", "f", "\[InvisibleSpace]", "g", 
    "\[InvisibleSpace]", "h", "\[InvisibleSpace]", "i", 
    "\[InvisibleSpace]", "j", "\[InvisibleSpace]", "k", 
    "\[InvisibleSpace]", "l", "\[InvisibleSpace]", "m", 
    "\[InvisibleSpace]", "n", "\[InvisibleSpace]", "o", 
    "\[InvisibleSpace]", "p", "\[InvisibleSpace]", "q", 
    "\[InvisibleSpace]", "r", "\[InvisibleSpace]", "s", 
    "\[InvisibleSpace]", "t", "\[InvisibleSpace]", "u", 
    "\[InvisibleSpace]", "v", "\[InvisibleSpace]", "w", 
    "\[InvisibleSpace]", "x", "\[InvisibleSpace]", "y", 
    "\[InvisibleSpace]", "z"}], TraditionalForm]],
  FormatType->"TraditionalForm"],
 " Text"
}], "Text"]
share|improve this question
6  
Can you specify exactly how you typed/created the two lines? Making more than one letter in an inline math cell switches the fontslant back to plain. Therefore, if I just type abc.. in an inline cell it is upright. When I use explicitly italic, than it looks equally spaced. I tested OSX here, which system do you have? –  halirutan Sep 18 '12 at 11:33
    
First row: Between each letter I inserted an [InvisibleSpace] to prevent the sequence of letters from switching from italic back to roman (which as you point out is the default behavior inside a math inline cell). Second row: typeset as italic text inside a text cell. Perhaps the real issue here has to do with how Mma varies the width of the [\InvisibleSpace] according to the letter forms that surround it. –  StackExchanger Sep 19 '12 at 2:36

1 Answer 1

up vote 6 down vote accepted

You can redefine RowBox to automatically wrap specific characters in an AdjustmentBox which reduces the right-side spacing. This isn't perfect but might get you on the right track.

Unprotect[RowBox];
RowBox[chars_List  /; MemberQ[chars, "i" | "e" | "f" | "o"]] := 
  RowBox[Replace[chars , {
     "i" -> AdjustmentBox["i", BoxMargins -> {{0, -0.1}, {0, 0}}],
     "e" -> AdjustmentBox["e", BoxMargins -> {{0, -0.15}, {0, 0}}],
     "f" -> AdjustmentBox["f", BoxMargins -> {{0, -0.15}, {0, 0}}],
     "o" -> AdjustmentBox["o", BoxMargins -> {{0, -0.1}, {0, 0}}]
     }, {1}]];
Protect[RowBox];

Comparison:

before and after

This won't catch sub/superscripted characters, and it will affect all RowBoxes, not just the ones used for TraditionalForm. I could not figure out how to do the same trick, but only for FormBox[RowBox[chars_List], TraditionalForm]. Maybe someone else can figure that part out.

share|improve this answer
2  
Your suggestion is a nice application of the AdjustmentBox, but raises the question now of why this kind of tweaking should even be necessary. Does anyone know the reason why the kerning rules for juxtaposing italic characters inside math formula cells are different from those for normal, non-math italic text? –  StackExchanger Sep 19 '12 at 19:30
    
I like your proposed solution (in lieu of a more direct fix) and will probably post my updates as a new question later. –  StackExchanger Dec 7 '12 at 6:00

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.