stipub / stixfonts

OpenType Unicode fonts for Scientific, Technical, and Mathematical texts
SIL Open Font License 1.1
686 stars 41 forks source link

‖ scales too tall, compared to ⟨ and ⟩ #225

Open mdeff opened 2 years ago

mdeff commented 2 years ago

When ‖ is scaled to accommodate a subscripted letter, it looks too tall, compared to the angle brackets ⟨ and ⟩.

The following document, compiled with latexmk -pdflua, produces the following output.

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{STIX Two Math}
\newcommand*{\norm}[1]{{\ensuremath{\left‖{#1}\right‖}}}
\newcommand*{\inner}[1]{{\ensuremath{\left⟨{#1}\right⟩}}}
\begin{document}
    \[
        \inner{f}_2^2            \hspace{2em}
        \norm{f}_2^2             \hspace{2em}
        \inner{f^2}_2^2          \hspace{2em}
        \norm{f^2}_2^2           \hspace{2em}
        \inner{\frac{1}{f}}_2^2  \hspace{2em}
        \norm{\frac{1}{f}}_2^2
    \]
\end{document}

stix2

Compare with Cambria (i.e., \setmathfont{Cambria Math}): cambria

And Latin Modern (i.e., \setmathfont{Latin Modern Math}): lm_unicode

tiroj commented 2 years ago

Please confirm which version of the STIX Two Math font you are testing here. We did work coordinating the variations and heights of delimiters recently, so I will track this issue to see if we have succeeded in resolving the problem.

mdeff commented 2 years ago

Thanks for the quick feedback! I'm unsure how to check the version, but fc-query STIXTwoMath-Regular.otf reports fontversion: 138281(i)(s). Is there a better way?

Anyway, I get the same result with v2.13 b171 that I downloaded from here (fontversion: 139592(i)(s)).

firai commented 2 years ago

Seems like this is yet another difference between Word and LaTeX rendering. Pipe brackets (both single and double) are actually a touch too short in Word. I can also confirm that I'm getting similar results as @mdeff with XeLaTeX/LuaLaTeX (via Overleaf) and v2.13 b171.

Word 16 (a.k.a Office 365): image image

tiroj commented 2 years ago

The height of delimiter variant to use is determined by the math layout engine, not directly by the font. It is derived from the overall height of the relevant stacked parts of the equation, but how that is interpreted by the layout engine and a variant selection made is often a bit of a black box from my perspective. And, as noted, not all math layout engines will produce the same results from the same input using the same font.

But this sort of situation where different delimiters are getting different heights around the same content is the sort of thing that suggests a font issue: image

mdeff commented 2 years ago

I've tried a bunch of delimiters: 20211228_175618

Only ‖ is badly scaled.

⧼, ⧽, ⦑, and ⦒ are not scaled at all. (I've never seen them in mathematical texts, but they're mentioned on Wikipedia.)

Code to reproduce. ```tex \documentclass{article} \usepackage{unicode-math} \setmathfont{STIX Two Math} \newcommand*{\norm}[1]{{\ensuremath{\left‖{#1}\right‖}}} \newcommand*{\inner}[1]{{\ensuremath{\left⟨{#1}\right⟩}}} \newcommand*{\delver}[1]{{\ensuremath{\left|{#1}\right|}}} \newcommand*{\delpar}[1]{{\ensuremath{\left({#1}\right)}}} \newcommand*{\delbras}[1]{{\ensuremath{\left[{#1}\right]}}} \newcommand*{\delbrac}[1]{{\ensuremath{\left\{{#1}\right\}}}} \newcommand*{\dela}[1]{{\ensuremath{\left⟪{#1}\right⟫}}} \newcommand*{\delb}[1]{{\ensuremath{\left⧼{#1}\right⧽}}} \newcommand*{\delc}[1]{{\ensuremath{\left⦑{#1}\right⦒}}} \begin{document} \[ \inner{f}_2^2 \hspace{2.5em} \norm{f}_2^2 \hspace{2.5em} \delver{f}_2^2 \hspace{2.5em} \delpar{f}_2^2 \hspace{2.5em} \delbras{f}_2^2 \hspace{2.5em} \delbrac{f}_2^2 \hspace{2.5em} \dela{f}_2^2 \hspace{2.5em} \delb{f}_2^2 \hspace{2.5em} \delc{f}_2^2 \hspace{2.5em} \] \[ \inner{f²}_2^2 \hspace{2em} \norm{f²}_2^2 \hspace{2em} \delver{f²}_2^2 \hspace{2em} \delpar{f²}_2^2 \hspace{2em} \delbras{f²}_2^2 \hspace{2em} \delbrac{f²}_2^2 \hspace{2em} \dela{f²}_2^2 \hspace{2em} \delb{f²}_2^2 \hspace{2em} \delc{f²}_2^2 \hspace{2em} \] \[ \inner{\frac{1}{f}}_2^2 \hspace{2.1em} \norm{\frac{1}{f}}_2^2 \hspace{2.1em} \delver{\frac{1}{f}}_2^2 \hspace{2.1em} \delpar{\frac{1}{f}}_2^2 \hspace{2.1em} \delbras{\frac{1}{f}}_2^2 \hspace{2.1em} \delbrac{\frac{1}{f}}_2^2 \hspace{2.1em} \dela{\frac{1}{f}}_2^2 \hspace{2.1em} \delb{\frac{1}{f}}_2^2 \hspace{2.1em} \delc{\frac{1}{f}}_2^2 \hspace{2.1em} \] \end{document} ```
tiroj commented 2 years ago

In the v2.20, all delimiters now a) have the same set of 12 growing variants, b) are vertically centered on the max axis height, and c) are the same height as each other across the variant set. So, all else being equal, this issue should be fixed in b2.20.

mdeff commented 2 years ago

Thanks for the quick fix! Looking forward to v2.20. 🙂

tiroj commented 1 year ago

Updated sources and fonts delivered to STI Pub for testing. Issue reopened pending public release.