TransWikia.com

Top accent position of OTF math font in XeTeX and LuaTeX

TeX - LaTeX Asked on July 17, 2021

MWE:

% Xe-/LuaLaTeX
documentclass{article}
usepackage{unicode-math}
setmathfont[math-style=literal]{Latin Modern Math}

begin{document}

$dot b, dot  ?, dot{rm b}$

end{document}

enter image description here

The accent placement seems to be wrong, in my opinion. The dot{rm b} example seems to be right. How to get this as the default behaviour?

OK, in LuaTeX we can change the top_accent values of the OTF table, as Marcel Krüger has done:
Fixing the position of math accents when using unicode-math in lualatex with a text font for letters and digits

But is there a simpler solution? In this answer a faked math font is used, but I would like to patch a real math font. So some lines of code can be omitted, can’t they?

What about XeTeX? Is there a solution, too? Are the top_accent values represented by a fontdimen?

One Answer

enter image description here

The dot is positioned over the stem of the d as specified in the font but if you want it centred over the whole character for some reason then you can make the base be more than a single character and let tex position a centred accent.

documentclass{article}
usepackage{unicode-math}
setmathfont[math-style=literal]{Latin Modern Math}

begin{document}

$dot b, dot  ?, dot{symrm{b}}$

$dot{b{}}, dot {?{}}, dot{symrm{b}{}}$

end{document}

rm is a legacy command that is not defined by default in latex but defined in some classes for compatibilty with LaTeX2.09 documents.

Answered by David Carlisle on July 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP