3

I want to adjust the kerning between f' in math mode (and other pairs) across the entire document. I found https://tex.stackexchange.com/a/219881/54601, which is exactly what I want but for text mode, and indeed it does not work for math mode. How do I do it? I do not want to have to create a macro for every pair. I would like to use XeTeX if possible. Is it? I have already gone through like a hundred different questions on TeX SE and I could not find an answer to my question.

Here is an example that needs fixing. No, I do not want to use any other font, and no, I do not want to fix each instance manually nor use a macro. Is LaTeX or XeTeX is incapable of fixing such a simple typographical issue?

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{xits-math.otf}
\setmathfont[range=\mathit]{Times New Roman Italic}
\begin{document}
$f'$
\end{document} 
  • 2
    Did you in the hundred questions never saw the "show a minimal example"? – Ulrike Fischer Jul 13 '15 at 7:37
  • 1
    Provide a MATH table for “Times New Roman Italic”. Sorry, but you're asking for something that cannot be solved on the TeX side, because the font you want to use lacks the necessary information. – egreg Jul 13 '15 at 9:16
  • 1
    Even if your question were general this wouldn't mean that one can answer it without runing some tests first and without some information like if you are using unicode math or not. Beside this your example is actually rather specific as you are using a text font instead of a dedicated math font for the math variables. Without it or with \setmathfont[range=\mathit]{TeX Gyre Termes Math} there would be no problem. – Ulrike Fischer Jul 13 '15 at 9:22
  • 2
    @user21820 No, it's that Times New Roman Italic is lacking the necessary information for XeTeX being able to use it as a math font. – egreg Jul 13 '15 at 9:33
  • 1
    the stix fonts (based on times), when finally released, will have the necessary opentype math table to handle spacing in math properly. as already observed, the alphabet properly used for math is not the same as that used for text, even though the lettershapes may be identical. the most obvious difference lies in the metrics, and there is no practical substitute for having those in the font itself. – barbara beeton Jul 13 '15 at 13:40
2

(Too long for a comment, hence posted as an answer of sorts.)

I assume you're using a Windows-based computer. When I compile your MWE under Windows 7 and MikTeX 2.9, I get exactly the problem that you report in your posting. That's why I'm guessing you're on a Windows-based system.

Now: Is there any chance at all that you could switch to a Mac to compile your document? The reason I ask is that Times New Roman Italics under MacOSX 10.10.4 "Yosemite" does have the required kerning information stored in the font tables. To wit, when I compile your test program, under either XeLaTeX or LuaLaTeX, on a system that runs MacOSX 10.10.4 "Yosemite" and MacTeX2015, I get the following output:

enter image description here

No kerning adjustment would appear to be necessary, right?


Addendum to address your follow-up comment: $VWab$, $\dfrac{2\pi ft}{k}$ is rendered as follows:

enter image description here

I don't know about your aesthetics, but I'd say that's pretty nice. :-)

\documentclass[border=1pt]{standalone}
\usepackage{amsmath,unicode-math}
\setmathfont{XITS Math}
\setmathfont[range=\mathit]{Times New Roman Italic}
\begin{document}
$VWab$, $\dfrac{2\pi ft}{k}$
\end{document} 
  • Right I am on Windows and your Mac output looks perfect. However, do things like $VWab,\dfrac{2\pi ft}{k}$ come out nicely? – user21820 Jul 13 '15 at 12:06
  • @user21820 - I've posted an addendum to show the output of $VWab,\dfrac{2\pi ft}{k}$. Incidentally, what is "VWab"? – Mico Jul 13 '15 at 12:18
  • Yes that looks superb. Why doesn't my Windows font have that?! Haha.. $VWab$ is just to make a big unnatural spacing between W and a. – user21820 Jul 13 '15 at 12:20
  • 1
    @user21820 - The issue you've encountered isn't caused by (Xe/Lua)LaTeX -- after all, I'm running LaTeX too... -- but by a faulty font definition file under Windows. By the way, I count my lucky stars and thank my guardian angel each and every day for being a Mac user rather than a Windows user. (Well, very occasionally I have to use Windows, and I work as fast as I can to finish...) The math italic kerning issue is but the tip of the proverbial iceberg... – Mico Jul 13 '15 at 12:26
  • 1
    I doubt that it a "windows font against mac font kerning" problem. At first the f and the prime are from two different fonts and so kerning shouldn't be relevant. And at second I get (on windows) a perfect f' when compiling with lualatex, only with xelatex it is to near. – Ulrike Fischer Jul 14 '15 at 7:34
0

I had the same problem using \setmathfont. Here is a minimal working example exhibiting problem and solution (using f\prime instead of f'):

\documentclass[fontsize=30pt]{scrartcl}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\begin{document}
\[ f'\,a'\quad f\prime\,a\prime \]
\end{document}

Here is the output, compiled by TeX Live 2013's xelatex on Ubuntu linux:

xelatex output

Interestingly, using a smaller font size mitigated the problem.

When not using \setmathfont to set a custom math font, the problem didn't occur.

  • 2
    Do you use a Windows/MikTeX setup? If not, which operating system and TeX distribution do you use? Do you use LuaLaTeX or XeLaTeX? Please consider augmenting your code snippet into a MWE. – Mico Aug 4 '15 at 10:45
  • 1
    (1) This is not exactly an answer to the question since you use LM and not Times. (2) Remember that $f\prime$ is wrong -- the prime symbol is too large this way. Actually, $f'$ is equivalent to $f^\prime$, where \prime acts as a superscript! – yo' Aug 4 '15 at 11:03
  • 1
    I agree that this is not a clean solution, at least this is the easiest workaround I came across. I actually like the "wrong" but more pronounced look of f\prime. Any info on why using \prime without superscript is considered wrong? Also this is not the Times font, I don't have it installed. – trimitri Aug 4 '15 at 11:31

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.