%% This is part of the OpTeX project, see http://petr.olsak.net/optex

\_famdecl [New Computer Modern] \NewCM {CM with Book variants, Cyrillic, Greek}
        {\book \ttset \sans \caps} {\rm \bf \it \bi} {NewCM-Regular}
        {[NewCM10-Regular]}
        {\_def\_fontnamegen {[NewCM\_typfV-\_currV]:\_capsV\_fontfeatures}}

\_wlog{\_detokenize{%
Modifiers:^^J
 \book ...... slightly bolder \rm, \it^^J
 \ttset ..... Typewriter variants^^J
 \sans ...... Sans serif variants^^J
 \caps ...... caps & small caps (not in Italic variants)^^J%
Note: use \book\normalmath if you want Math in book-style too.
}}

\_moddef \resetmod {\_fsetV caps={},typf=10,book={} \_fvars Regular Bold {\_ncmI} {\_ncmBI} }
\_moddef \book     {\_fsetV book=Book \_fvars Book Bold {\_ncmI} {\_ncmBI}
                    \_def\_unimathfont{NewCMMath-Book}}
\_moddef \ttset    {\_fsetV typf=Mono10 }
\_moddef \sans     {\_fsetV typf=Sans10 }
\_moddef \caps     {\_fsetV caps=+smcp;\_ffonum; }

\_def\_ncmtyprm{10}
\_def\_ncmtypsans{Sans10}
\_def\_ncmI  {\_bookV \_ifx\_typfV\_ncmtypsans Oblique\_else Italic\_fi}
\_def\_ncmBI {Bold\_ifx\_typfV\_ncmtyprm Italic\_else Oblique\_fi}

\_initfontfamily % new font family must be initialized

\_loadmath {[NewCMMath-Regular]}
\_loadboldmath{[NewCMMath-Bold]} \to {[NewCMMath-Regular]}

\_endcode

If you want to use \book variant in the whole document, you can load
NewCMMath-Book Unicode math font too. Use the following declaration in this
case:

\loadmath{[NewCMMath-Book]}
\loadboldmath{NewCMMath-Bold} \to {[NewCMMath-Book]}
\fontfam[newcm]
\book\rm

or for sans serif math you can use:

\loadmath{[NewCMSansMath-Regular]}
\fontfam[newcm]
\sans\rm

See the file `f-heros.opm` for information about principles of such
font-macro-files.

