3

Consider the following example:

\documentclass{article}
\usepackage{kpfonts-otf}

% https://tex.stackexchange.com/a/22255 \newcommand\restrict[2]{{% we make the whole thing an ordinary symbol \left.\kern-\nulldelimiterspace % automatically resize the bar with \right #1 % the function \vphantom{\big|} % pretend it's a little taller at normal size \right|_{#2} % this is the delimiter }}

\begin{document}

( \restrict{f}{U} = \frac{\restrict{g}{U}}{\restrict{h}{U}} )

\end{document}

One would get the following result with LuaLaTeX:

enter image description here

As you can see, the vertical bars in script size are broken.

Is there some way to fix this behavior?

Jinwen
  • 8,518
  • +1. \frac isn't needed to create the problematic output. The code snippet $\restrict{f}{U} \quad \scriptstyle\restrict{g}{U} \quad \scriptscriptstyle\restrict{h}{U}$ gets the job done too. :-) – Mico Sep 26 '22 at 02:20
  • Strangely, the output is correct when your file is compiled with XeLaTeX. The output is also correct when compiled with LuaLaTeX and other fonts (lmodern-math, erewhon-math, etc.). I fail to understand what is going wrong with KpMath-Regular.otf – Daniel Flipo Sep 26 '22 at 17:23
  • The bug also vanishes if KpMath-Regular.otf is loaded with \setmathfont{KpMath-Regular.otf}[Renderer=Node]. Bug of the Basic renderer? – Daniel Flipo Sep 26 '22 at 17:58
  • @Jinwen I updated the answer you refer to, leaving the phantom only in display style. Not that this solves your problem, but leads to better output anyway. – egreg Sep 27 '22 at 09:17

1 Answers1

2

There is an extensible recipe for the vertical bar where one piece refers to the base character. The other extensible snippets are in private slots. The font has ssty replacements for the base character but not for the other extensible snippets. Therefore, in script and scriptscript sizes there is a mismatch. Other fonts, like latin modern, have a dedicated replacement for the base character in the extensible. They don't even have ssty variants for the bar. They use scaling. If you really want dedicated script and scriptscript style extensibles all snippets should have a dedicated alternate.

mickep
  • 8,685
  • 1
    Good point! It means that some fix has to be applied to the ssty variants of | rather than deleting them like in latin modern. The ssty variants provide better sub/sup-scripts regarding the boldness. I'll test that tomorrow and let you know. – Daniel Flipo Sep 26 '22 at 19:55
  • 1
    @Jinwen The bug you pointed out is fixed in version 0.44 that I am uploading to CTAN. – Daniel Flipo Sep 28 '22 at 12:50