olsak / OpTeX

OpTeX - LuaTeX format with extended Plain TeX macros
http://petr.olsak.net/optex/
36 stars 14 forks source link

Dots don't respect the math style #20

Closed cao- closed 3 years ago

cao- commented 3 years ago
\fontfam[lm]

$\matrix{Φ(x_1, x_1) & Φ(x_1, x_2) & \cdots & Φ(x_1, x_N)\cr
                     Φ(x_2, x_1)& Φ(x_2, x_2) & \cdots & Φ(x_2, x_N)\cr
                      \vdots      & \vdots     & \ddots& \vdots    \cr
               Φ(x_N, x_1) & Φ(x_N, x_2) & \cdots & Φ(x_N, x_N)}$              

\bye

The \cdots are small, instead the \vdots and \ddots aren't.

olsak commented 3 years ago

I suggest to add the lines

\_protected \_def\vdots{\_relax \_ifnum \_mathstyle>3 \_unicodevdots \_else \_vdots \_fi}
\_protected \_def\ddots{\_relax \_ifnum \_mathstyle>3 \_unicodeddots \_else \_ddots \_fi}
\_protected \_def\adots{\_relax \_ifnum \_mathstyle>3 \_unicodeadots \_else \_adots \_fi}

into the file unimath-codes.opm at lines (say 244-246) and to add the sequences \unicodevdots \unicodeddots \unicodeadots into the list of sequences at lines 383-386.

This solution uses compessed adots, vdots and ddots from Unicode math font when the math style is script or scriptsriptstyle. It will not work in non-Unicode math and when we are using {...\over...} syntax. But it does not matter, we need to have compressed dots only in compressed matrices. Other solutions brig more complicate code to \vdots, \adots, \ddots but Ihope that this is not needed.

cao- commented 3 years ago

Your solution seems reasonable, for me it is ok. (Shouldn't it be \_mathstyle>2?)

olsak commented 3 years ago

_mathstyle 0,1: D, 2,3: T, 4,5: S, 6,7: SS, we want to set compressed dots in S and SS styles (i.e. when \matrix is in T, S or SS styles).

cao- commented 3 years ago

Ok, sorry, I thought they were numbered differently. Thank you