7

The symbol \big\lVert is as big as \Big\lVert with the Stix Two fonts. Is this a bug in the font itself, and is there a suitable workaround?

MWE (run in lualatex):

\documentclass{minimal}
\usepackage{fontspec,unicode-math,color}
\setmathfont{STIX2Math.otf}
\begin{document}
\[
  \Bigg\Vert\;\bigg\Vert\;\Big\Vert\;\textcolor{red}{\big\Vert}\;\|
\]
\end{document}

Result

Here is a possibly related question. Unfortunately, I don't know enough about looking inside OTF font files to check if the cause is similar. But the same cure does not seem to apply here. It doesn't matter whether I include amsmath or not (I usually do).

  • Bonus question: How could I investigate the font myself? – Harald Hanche-Olsen Aug 06 '17 at 17:38
  • 2
    this is a known problem. it has been discussed on a forum regarding the stix two fonts: unfortunately, i have mislaid my password, and can't access the discussion right now, but it's been more than a year, and i don't believe there has been a well defined resolution. i will try to find out more tomorrow. – barbara beeton Aug 06 '17 at 18:58
  • There seems to be no intermediate size between normal and \Big. – egreg Aug 06 '17 at 19:20
  • @barbarabeeton After Ulrike Fischer's helpful answer, this may not be so urgent anymore. But it would be interesting to know a bit about what was said about it in the forum, and why a good resolution seemed so hard to get. Is there a hidden gotcha in Ulrike's solution, perhaps? – Harald Hanche-Olsen Aug 06 '17 at 22:17

1 Answers1

10

With lualatex I think that you can patch the font like this. With this patch \Vert behaves like |. Be aware that a lot of guesswork is involved and that I don't know how stable the internal structure is.

\documentclass{article}
\usepackage{amsmath}

\usepackage{luacode}

\begin{luacode}

local patch_stixmath = function (fontdata)
 if fontdata.psname == "STIXTwoMath"
 then
 fontdata.characters[8214]["vert_variants"][2]["end"]=
 fontdata.characters[8214]["vert_variants"][1]["end"]
 fontdata.characters[8214]["vert_variants"][2]["start"]=
 fontdata.characters[8214]["vert_variants"][1]["start"]
 end
end



luatexbase.add_to_callback
 (
  "luaotfload.patch_font",
  patch_stixmath,
  "change_stixmath"
 )
\end{luacode}

\usepackage{fontspec,unicode-math,color}
\setmathfont{STIX2Math.otf}
%\setmathfont{latinmodern-math.otf}
\usepackage{xfp,pgffor}
\begin{document}

\[
  \Bigg\Vert\;\bigg\Vert\;\Big\Vert\;\textcolor{red}{\big\Vert}\;\|
\]

\foreach\x in {1,2,...,300}
{$\left|\rule{0pt}{\fpeval{5+\x*0.1}pt}\fpeval{5+\x*0.1} \right\Vert $ }

\end{document}

enter image description here

Ulrike Fischer
  • 327,261
  • 1
    Fantastic! I get what you say about guesswork, but suspect this fix should be good at least until stix 2.1 appears. +1 now, acceptance later (after some more testing). After poking around a bit in the luatex manual, I even have the illusion of almost understanding how it works. 8-) – Harald Hanche-Olsen Aug 06 '17 at 22:12