Take the 2-minute tour ×
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.

With mathspec, when you change the math font to an OpenType font, the spacing within equations is not fine: it is the same than the text mode spacing. For example in the equation $e^j$, the 'j' will collide with the 'e', most of time. So with mathspec you have to type $e^{"j}$ to space the 'j'. This is refered as the 'glyph bounds' problem in the mathspec doc. What is really too bad is that it breaks compatibility with LaTeX.

Is there any way to both have correct spacing AND compatibility with LaTeX?

Here is an example with two clashes :

\documentclass{article}
\usepackage{mathspec}
\setmathsfont(Latin,Digits){Times New Roman}

\begin{document}
$e^j + |f|$ should be written $e^{"j} + |"f|$.
$\"abcdefghijklmnopqrstuvw"$
$abcdefghijklmnopqrstuvw$ : the spacing is too thin, suitable for text, not for math.
\end{document}
share|improve this question
2  
When I run xelatex to typeset $e^j$ with the default math font (Computer Modern), I do not get a clash between the e and the raised j. Incidentally, $e^{"j}$ produces the exact same output on my system as $e^j$ does. Are you maybe using a non-default set of math fonts and/or babel with a non-English language setting? –  Mico Aug 24 '11 at 15:08
    
Yes you're right, it is only with non standard (OpenType) fonts, which do not have proper math bounds for the glyphs. (Question edited in this sense.) –  Lierre Aug 24 '11 at 17:00
    
Lierre: I'm not sure I follow you on the distinction between standard (i.e., Computer Modern or Latin Modern) and "nonstandard (OpenType)" fonts. The Latin Modern fonts are now available in OpenType format, and they don't exhibit the problem you're describing. Which font (opentype or not) are you using? –  Mico Aug 24 '11 at 17:47
    
I added an example with Times New Roman, but collisions also arise with Adobe's Garamond, Caslon, Jenson, etc... I also have the problem with Latin Modern in OpenType format : which seems reasonable because OpenType fonts do not include math glyph bounds. –  Lierre Aug 25 '11 at 13:11

2 Answers 2

Lierre: Thanks for posting a complete MWE. Good news: I can reproduce your problems. Better news: On my system at least, they go away entirely when I omit the "(Latin,Digits)" option. Why do you specify these options, incidentally?

Addendum, 18/20 Sept 2011: I've just found out about the latest release of the XITS math (and text) fonts; see the XITS site for the five .otf files. The XITS Math letters have much better, i.e., larger sidebearings. If XITS and XITS Math are sufficiently Times-like for your needs, I think you'll be very pleased. The new MWE would look something like

% !TeX program = xelatex
\documentclass{article}
\usepackage{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}
\begin{document}
\noindent
$e^j + |f|$ \\
$abcdefghijklmnopqrstuvwxyz$ XITS-Math math italics\\
\textit{abcdefghijklmnopqrstuvwxyz} XITS text italics\\
\setmainfont{Times New Roman}
\textit{abcdefghijklmnopqrstuvwxyz} TNR text italics
\end{document}

enter image description here

I guess the right-hand sidebearing of the f in the first line could still be a bit more generous, but it's a huge improvement over the example with TNR that you posted originally!

Comparing the italics letters of the XITS Math font with the (text) italics letters of Times New Roman, the main new characteristics of the new math font seem to be:

  • very different shapes of v and w
  • larger "teardrop" terminals of the letters f and r
  • the letter z has a rudimental "swash" (but it's nowhere near as pronounced as the swash of the italic z in either Computer Modern or MathtimePro (the latter with the zswash option set)
  • most letters are a bit more condensed and their vertical strokes are a bit thicker
share|improve this answer
2  
without these options, the math is not in Times New Roman at all. The Latin option tells the package to use Times New Roman for the Latin letters in math mode and the Digits option does the same for the numbers. These two options (Latin,Digits) are thus more or less a minimum if you want to change the font used in math (if you use greek letters, you would also want to use the Greek option). –  Philippe Goutet Aug 27 '11 at 6:10
    
Thank you for the answer ! (And sorry for my late reaction, it seems that I don't receive the notifications...) But unfortunately @Philippe Goutet is right. I think I will ask the creator of mathspec. He should know if a solution exists. If I have an answer, I will post it here. –  Lierre Aug 29 '11 at 11:38
    
Lierre and @Philippe Goutet: I've added a new paragraph and MSE to my answer, in which I discuss the improvements brought about by the latest release of the XITS Math font, a "Times compatible" font. –  Mico Sep 18 '11 at 19:16
    
Shouldn't you load unicode-math somewhere? texlive is a bit broken for me now and I can't test, but without unicode-math I don't this this is going to work as expected. –  Khaled Hosny Sep 18 '11 at 19:42
    
@mico — I updated unicode-math yesterday to fix this problem (sorry, broken for a few days after I updated fontspec out of sync) and it will be in TL shortly; lead times are usually a day or two. –  Will Robertson Sep 18 '11 at 22:10

I was struggling with similar mathspec/opentype/spacing problems and I solved them by resorting to plain latex math mode spacing commands:

$
\,      % a small space
\:      % a medium space
\;      % a large space
\quad   % a really large space
\qquad  % a huge space
\!      % a negative space (moves things back to the left)
$

The advantage over mathspec's " and \"..." is two-fold: you can use these commands anywhere (as apposed to only right in front of single characters) and they are LaTeX and XeTeX compatible.

I'm not sure if this is exactly what you need but it fixed my (similar) problems.

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.