Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensible delimiters/radicals suggestions #33

Closed
RuixiZhang42 opened this issue Mar 25, 2019 · 2 comments · Fixed by #70
Closed

Extensible delimiters/radicals suggestions #33

RuixiZhang42 opened this issue Mar 25, 2019 · 2 comments · Fixed by #70
Labels
enhancement New feature or request
Milestone

Comments

@RuixiZhang42
Copy link

This is a follow-up discussion from latex3/unicode-math#277

The \left<del>...\right<del> algorithm from TeX has two default parameters: \delimiterfactor=901 and \delimitershortfall=5pt. The former \delimiterfactor implies that the delimiter will be as at least 90.1% tall as the content inside.

Here are 3 main suggestions regarding the extensible delimiters in Fira Math:

  1. Leave size 1 as is.
    The current size 1 delimiters/radicals are designed at 1.319em. This is perfect for the Fira family, since the preferred line spacing for Fira is 1.4 times the font size. See Lower line height in FiraMono? mozilla/Fira#67 (comment) and Reduced Line Height Is Also Reduced Readability In MonoSpace mozilla/Fira#189 (comment) Moreover, this size should be between 1.4×0.901=1.2614 em and 1.4 em, confirming that 1.319 em is perfect ;-)
  2. Make size 2 and up to be integer quarter multiples of size 1.
    Currently, the ratios between size 2 and up and size 1 are rather peculiar: 1.249, 1.497, 1.746, 1.995 and so on. In TeX, the default \Big, \bigg and \Bigg are exactly 1.5, 2 and 2.5 times of \big. It would be nice to have size 2 and up to be exactly 1.25, 1.5, 1.75, 2 and so on. In particular, users are likely to define \newcommand\vast{\bBigg@{3}} and \newcommand\Vast{\bBigg@{3.5}}. See https://tex.stackexchange.com/a/6796 and https://liam.page/2018/11/09/the-bigger-than-bigger-delimiter-in-LaTeX/ (in Chinese, @Liam0205)
  3. Either consider removing even sizes or instruct users to issue \delimiterfactor=945.
    Due to the default \delimiterfactor=901, the many intermediate even-numbered sizes would cause problem: If the content is size-8 tall, then size-7 delimiter will be used. In fact, this happens for all size 8 and up. The threshold is given by the last pair of size-14 and 15: \delimiterfactor needs to be bigger than 1000×4.25/4.5. The other consideration is the following: In TeX, it is advised not to (ab)use \left\right. The use of manual sizing is recommended. Note that the intermediate sizes are not accessible by manual sizing \big and friends anyway.
\documentclass{article}
\usepackage{xcolor,amsmath,unicode-math}
\setmathfont{FiraMath-Regular.otf}
\makeatletter
\ExplSyntaxOn
\tl_new:N \g_@@_big_to_normal_size_ratio_tl
\tl_gset:Nn \g_@@_big_to_normal_size_ratio_tl
  {
    \fp_eval:n { 1.319 / 0.990 } % FiraMath-Regular.otf
  }
\addto@hook\every@math@size{%
  \global\big@size \g_@@_big_to_normal_size_ratio_tl\ht\Mathstrutbox@
  \global\advance\big@size \g_@@_big_to_normal_size_ratio_tl\dp\Mathstrutbox@ }
\ExplSyntaxOff
\def\big{\bBigg@{1}}
\def\Big{\bBigg@{1.497}}
\def\bigg{\bBigg@{1.995}}
\def\Bigg{\bBigg@{2.492}}
\def\vast{\bBigg@{2.989}}
\def\vastl{\mathopen\vast}\def\vastm{\mathrel\vast}\def\vastr{\mathclose\vast}
\def\Vast{\bBigg@{3.487}}
\def\Vastl{\mathopen\Vast}\def\Vastm{\mathrel\Vast}\def\Vastr{\mathclose\Vast}
\def\VAST{\bBigg@{3.984}}
\def\VASTl{\mathopen\VAST}\def\VASTm{\mathrel\VAST}\def\VASTr{\mathclose\VAST}
\def\VASTT{\bBigg@{4.482}}
\def\VASTTl{\mathopen\VASTT}\def\VASTTm{\mathrel\VASTT}\def\VASTTr{\mathclose\VASTT}
\makeatother
\newcommand*\testbig[1]{%
  \vcenter{\hrule height0.990em width0.4pt}%
  #1%
  \vcenter{\color{red}\hrule  height1.319em width0.4pt}%
  \bigr#1%
  \vcenter{\color{blue}\hrule height1.647em width0.4pt}\,%
  \vcenter{\color{red}\hrule  height1.975em width0.4pt}%
  \Bigr#1%
  \vcenter{\color{blue}\hrule height2.303em width0.4pt}\,%
  \vcenter{\color{red}\hrule  height2.631em width0.4pt}%
  \biggr#1%
  \vcenter{\color{blue}\hrule height2.959em width0.4pt}\,%
  \vcenter{\color{red}\hrule  height3.287em width0.4pt}%
  \Biggr#1%
  \vcenter{\color{blue}\hrule height3.615em width0.4pt}\,%
  \vcenter{\color{red}\hrule  height3.943em width0.4pt}%
  \vastr#1%
  \vcenter{\color{blue}\hrule height4.271em width0.4pt}\,%
  \vcenter{\color{red}\hrule  height4.599em width0.4pt}%
  \Vastr#1%
  \vcenter{\color{blue}\hrule height4.927em width0.4pt}\,%
  \vcenter{\color{red}\hrule  height5.255em width0.4pt}%
  \VASTr#1%
  \vcenter{\color{blue}\hrule height5.583em width0.4pt}\,%
  \vcenter{\color{red}\hrule  height5.912em width0.4pt}%
  \VASTTr#1%
}
\delimiterfactor=945\relax % need to be > 1000*5.583/5.912
\parindent=0pt\relax
\begin{document}
$\testbig)$
$\testbig\rangle$
$\testbig\}$\par
Note:\par
1.\ Normal size is shown (black).\par
2.\ Only ext.\ sizes~1, 3, 5, \dots, 15 (red) are shown.\par
3.\ Too many intermediate sizes (blue), causing\\
\verb|\delimiterfactor=945| must be issued.
\end{document}

gh

@stone-zeng stone-zeng added the enhancement New feature or request label Mar 25, 2019
@RuixiZhang42
Copy link
Author

The growth rate of the first 15 extensible delimiters seems to be 0.328em per size. But I cannot confirm the same rate with >15 sizes. When the delimiters are pieced together, they don’t seem to grow at this rate. Again, with so many intermediate sizes (and such small growth rate), the following two assignments need to happen:

  1. \delimiterfactor=945 %
  2. \delimitershortfall=3pt % Any dimen < 0.328 * 10pt

On the other hand, I think size.1 can be made slightly larger to 1.32em, followed by a growth rate of 0.66em per size; that is, making the ratios precise and removing the current even-numbered sizes. In this way, one doesn’t need to change \delimiterfactor and \delimitershortfall.

@stone-zeng stone-zeng added this to the v1.0 milestone Dec 4, 2021
@stone-zeng
Copy link
Collaborator

Eventually I plan to take the following strategy:

  • The smallest ones will keep their original sizes as in Fira Sans
  • The extensible delimiters (.size01.size15) will be set to 1280, 1600, 1920, ..., 5760 (delta = 320)
    • Compared with 1280, they are exactly 1x, 1.25x, 1.5x, ..., 4.5x
    • The "even sizes" are not removed (but I don't think it's a problem and I found that STIX2 uses the similar setting, which is 1x, 1.2x, 1.4x, etc)
  • I will keep all xxx.sizeN the same height even for different characters and weights

@stone-zeng stone-zeng linked a pull request Jan 16, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants