1

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?

  • \rm hasn't been defined in latex by default since 1993, surprising to see it in a lualatex document. – David Carlisle Jul 10 '21 at 10:22
  • OK, I use Plain TeX, but the MWE is much shorter in LaTeX. ;) – Weißer Kater Jul 10 '21 at 10:23
  • I saw this comment after I had posted a latex answer. – David Carlisle Jul 10 '21 at 10:32
  • No problem. What I mean is that I would like the dot to be placed in the middle over the b, not on the left side. And this happens in the "forbidden" \rm solution. – Weißer Kater Jul 10 '21 at 10:35
  • oh actually I misread your question, the placement over the Roman d looked so obviously wrong I posted a solution with the standard placement over that. I didn't notice you were asking to have that placement over the italic d as well. – David Carlisle Jul 10 '21 at 10:39
  • I extended my answer with this centred dot setting. – David Carlisle Jul 10 '21 at 10:47
  • Thank you. But does it really look wrong? Try with a wider accent. ;) \vec b and \ddddot b look horrible. The half of vector arrow does not cover the b. Compare it also to \vec b with tfm math fonts. ;) – Weißer Kater Jul 10 '21 at 10:49
  • @WeißerKater Do you only want this for b or do you want to get accents over all characters centered? – Marcel Krüger Jul 10 '21 at 12:27
  • @MarcelKrüger For upright characters the accents should be centered. For italic characters it would be nice if the middle of the accents were above the slant axis. – Weißer Kater Jul 10 '21 at 12:36

1 Answers1

1

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.

David Carlisle
  • 757,742