2

Since I would like a \widehat that is wider than \hat for a single letter, I searched and found this answer. However, when I was trying to compile with LuaLaTeX, I got the following result:

enter image description here

Is there some way to fix this?


Below is a MWE.

\documentclass{amsart}

\usepackage{kpfonts}

\usepackage{scalerel,stackengine} \stackMath \newcommand\reallywidehat[1]{% \savestack{\tmpbox}{\stretchto{% \scaleto{% \scalerel*[\widthof{\ensuremath{#1}}]{\kern.1pt\mathchar"0362\kern.1pt}% {\rule{0ex}{\textheight}}%WIDTH-LIMITED CIRCUMFLEX }{\textheight}% }{2.4ex}}% \stackon[-8.5pt]{#1}{\tmpbox}% }

\begin{document} Kepler fonts

$\sigma, \hat{\sigma}, \widehat{\sigma}, \reallywidehat{\sigma}, \reallywidehat{\sigma\sigma\sigma}$

$\varepsilon, \hat{\varepsilon}, \widehat{\varepsilon}, \reallywidehat{\varepsilon}, \reallywidehat{\varepsilon\varepsilon\varepsilon}$

$a, \hat{a}, \widehat{a}, \reallywidehat{a}, \reallywidehat{aaa}$

$c, \hat{c}, \widehat{c}, \reallywidehat{c}, \reallywidehat{ccc}$ \end{document}

Jinwen
  • 8,518

1 Answers1

0

If you add

\fontname\textfont3

at the end, you'll see that the font is KpMath-Regular.otf, where the slot U+0062 is occupied with a “b” and this explains what you get.

\documentclass{amsart}

\usepackage{kpfonts}

\usepackage{scalerel,stackengine} \stackMath \newcommand\reallywidehat[1]{% \sbox8{\ensuremath{#1}}% \savestack{\tmpbox}{\stretchto{% \scaleto{% \scalerel*[0.08\wd8]{\kern.1pt{\hat{}}\kern.1pt}% {\rule{0ex}{\textheight}}%WIDTH-LIMITED CIRCUMFLEX }{\textheight}% }{1.2ex}}% \stackon[-0.7ex]{#1}{\tmpbox}% }

\begin{document} Kepler fonts

$\reallywidehat{\sigma\sigma\sigma\sigma\sigma\sigma\sigma\sigma\sigma\sigma}$

$\reallywidehat{\sigma\sigma\sigma}$

\end{document}

This needs fixes, but I leave to you the task, because I don't think that the result is worth the effort.

egreg
  • 1,121,712
  • Thank you for this! Actually the problem for me is that the \widehat in the current version of kpfonts for single letters c, e, etc. seems too tight, and I have already sent an email to Herbert Voß (who seems to be the current maintainer of kpfonts) asking if this can be fixed (I remember in an earlier version there doesn't seem to be such a problem). – Jinwen Oct 23 '23 at 11:42