olsak / OpTeX

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

Using \colon for alternative fonts #11

Closed gromadan closed 3 years ago

gromadan commented 3 years ago

If you change the font using \fontfam, the macro \colon stops working. For instance,

\fontfam[heros]
\typosize[20/20]
A\colon B
\bye

Prints the colon in CM fonts at size 10pt. Curiously enough, if you do the following:

\fontfam[heros]
\typosize[20/20]
\mathchardef\colon="613A
A\colon B
\bye

then the result is correct. Although colon should be 603A and 613A stands usually for period. The same seems to happen with any other font family loaded by \fontfam.

olsak commented 3 years ago

This is bug in OpTeX, thanks for reporting. When \fontfam is used then (in almost all cases) the Unicode math font is loaded. Then the classical plain TeX setting is not true. New mathcodes for all math characters are loaded from unimath-codes.opm file. And \colon declaration is missing here. The mentioned file loads math codes for all control sequences declared in "a standard" unimath-table.opm but \colon is misssing here too. The unimath-codes.opm adds some exceptions above standard unimath-table.opm, so I'll add the exception for \colon here in a new commit.

You can use \mathcolon instead \colon now, because \mathcolon is declared. Or you can set \let\colon=\mathcolon after Unicode math font is loaded already.

Note that A\mathcolon B does no spaces outside math mode but it creates a little space after colon inside math mode. Second note: classical plain TeX ends by error when \colon is used outside math mode.