LaTeX forum ⇒ XeTeXKerning for slanted Greek in TeX Gyre Termes Math

Information and discussion about XeTeX, an alternative for pdfTeX based on e-Tex
user49915
Posts: 42
Joined: Wed Apr 17, 2019 12:51 pm

Kerning for slanted Greek in TeX Gyre Termes Math

Postby user49915 » Thu May 02, 2019 10:09 pm

Continuing https://tex.stackexchange.com/questions/119175/how-to-change-kerning-around-glyph-with-lualatex, http://tex.stackexchange.com/questions/484404/kerning-for-subscripts-of-sigma and http://latex.org/forum/viewtopic.php?t=32442 (which demonstrate the issues for specific letters),the kerning around the slanted Greek letters in the `TeX Gyre Termes Math` font turned out to leave much to be desired in general.

Here is an example of problems:
  1. \RequirePackage{ifthen}
  2. \RequirePackage{ifxetex,ifluatex}
  3. \newif\ifxetexorluatex
  4. \ifxetex
  5. \xetexorluatextrue
  6. \else
  7. \ifluatex
  8. \xetexorluatextrue
  9. \else
  10. \xetexorluatexfalse
  11. \fi
  12. \fi
  13. \documentclass{article}
  14. \ifxetexorluatex
  15. \tracinglostchars=2
  16. \usepackage{fontspec}%% needed only for xelatex.
  17. \usepackage[american,british,french,norsk,german,ngerman]{babel} % warning: last language option will be chosen for fixed text of environments like example or definition (in svmono)
  18. \usepackage{mathtools}%%% loads amsmath internally
  19. \mathtoolsset{mathic=true} %%% See <!-- m --><a class="postlink" href="http://tex.stackexchange.com/a/3496">http://tex.stackexchange.com/a/3496</a><!-- m -->
  20. \usepackage{amssymb}
  21. \usepackage[math-style=ISO]{unicode-math}
  22. \setmainfont[Ligatures=TeX]{TeX Gyre Termes}
  23. \setsansfont{TeX Gyre Heros}[Scale=0.88]%%% Somewhat ok.
  24. \setmonofont{TeX Gyre Cursor}%%% No explicit turning on ligatures for the monospaced font.
  25. \setmathfont[Ligatures=TeX]{TeX Gyre Termes Math}
  26. \setmathfont[Ligatures=TeX,range={\setminus}]{Asana Math}%%% Set difference
  27. \setmathfont[Ligatures=TeX,Extension=.otf,range={"2982},BoldFont=XITSMath-Bold]{XITSMath-Regular}%%% Z notation type colon ⦂ (U+2982). (Big tall oblong ⫿ also exists in XITS, but is slightly smaller in STIX.)
  28. \setmathfont[Ligatures=TeX,Extension=.otf,range={"2AFF}]{STIX-Regular}%%% Big tall oblong ⫿ (U+2AFF). Slightly smaller than in XITS.
  29. \else
  30. \usepackage[T2A,T1]{fontenc}%%% The fontenc package is explicitly loaded with the T2A,T1 argument simply to avoid the warning of babel about missing T2A in the log. As for the order of loading, David Carlisle says in <!-- m --><a class="postlink" href="https://tex.stackexchange.com/questions/241452/generating-a-template/241479#241479">https://tex.stackexchange.com/questions ... 479#241479</a><!-- m --> that fontenc produces information needed by inputenc (which, however, delays processing till the beginning of the document, which makes the order of these two packages irrelevant). Moreover, in the examples in the documentation of newtx fontenc is always loaded before newtx.
  31. \usepackage[utf8]{inputenc} % Native LaTeX umlaut support
  32. \usepackage[american,british,french,norsk,german,ngerman]{babel} % warning: last language option will be chosen for fixed text of environments like example or definition (in svmono)
  33. \usepackage{newtxtext}% Load it after babel according to Michael Sharpe's newtx manual from Dec 14, 2017.
  34. \usepackage[slantedGreek]{newtxmath}%% Should be loaded after the text font according to its manual. The default uppercase Greek letters should be slanted according to the Springer manual.
  35. \usepackage{courier}
  36. \usepackage{mathtools}%%% loads amsmath internally
  37. \mathtoolsset{mathic=true} %%% See <!-- m --><a class="postlink" href="https://tex.stackexchange.com/a/3496">https://tex.stackexchange.com/a/3496</a><!-- m -->
  38. \fi
  39. \usepackage[babel=true,verbose=errors]{microtype}%%% Microtype documentation says it determines the best settings itself, depending on the compiler and the driver.
  40. \begin{document}
  41. \(\Delta(\sigma)\)
  42.  
  43. \(\tau_0, \tau_1, \dotsc, \tau_9, \tau_i, \tau_j, \tau_k, \tau_{\mathrm{k}}, \tau_n, \tau_{i+1}, \tau_{i-1}\)
  44.  
  45. \(\pi_0, \pi_1, \dotsc, \pi_9, \pi_i, \pi_j, \pi_k, \pi_{\mathrm{k}}, \pi_n, \pi_{i+1}, \pi_{i-1}\)
  46.  
  47. \(\sigma_0, \sigma_1, \dotsc, \sigma_9, \sigma_i, \sigma_j, \sigma_k, \sigma_{\mathrm{k}}, \sigma_n, \sigma_{i+1}, \sigma_{i-1}\)
  48. \end{document}


The output produced by `pdflatex` has a nice kerning:
pdflatex.png
compiled with pdflatex
pdflatex.png (71.87 KiB) Viewed 746 times

But the outputs produced by {xe|lua}latex have insufficient kerning:
xelatex.png
compiled with xelatex
xelatex.png (77.51 KiB) Viewed 746 times
lualatex.png
compiled with lualatex
lualatex.png (76.87 KiB) Viewed 746 times

The amount of space is way too large around the parentheses as well as between the normalsize symbol such as π,σ, or τ and its subscript. In fact, the subscript is often closer to the subsequent comma than to the preceding letter, whereas this should be the other way round.

One could probably adjust the kernings on a letter-by-letter basis as described in the postings cited above. Has anyone done this dirty work perhaps so far for all of the slanted Greek from TeX Gyre Termes Math, or would we be doomed to reinvent the wheel? Is there some microtype-based solution, perhaps? If nothing else works, can we switch to another math font family, provided it is Times-like, is available for free, and can be harmonically accompanied by a matching Times-like font for the main text, an Arial/Helvetica-like font for the sans-emphasized (or symbol) text, and a Courier-like font for the monospaced text?

Crossposts: http://golatex.de/viewtopic,p,106262.html and http://texwelt.de/wissen/fragen/24700/k ... ermes-math.

Return to “XeTeX”

Who is online

Users browsing this forum: No registered users and 1 guest