latex3 / unicode-math

XeLaTeX/LuaLaTeX package for using unicode/OpenType maths fonts
http://ctan.org/pkg/unicode-math
LaTeX Project Public License v1.3c
245 stars 29 forks source link

After loading unicode-math \defaultfontfeatures for \ttfamily are overwritten (?) #607

Open miccoli opened 1 year ago

miccoli commented 1 year ago

Description

After \usepackage{unicode-math} the command \setmonofont does not work as expected.

Add info or delete as appropriate:

Minimal example demonstrating the issue

\documentclass{minimal}

\usepackage{fontspec}
\usepackage{unicode-math}
\setmonofont{SourceCodePro-Regular.otf}[]

\begin{document}

\begin{minipage}{15em}
\ttfamily
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{minipage}

\end{document}

Further details

In the above example the paragraph is justified and hyphenated, while it should be raggedright and not hyphenated. It seems that the default settings for \ttfamily in fontspec.cfg are not respected:

\defaultfontfeatures
 [\ttfamily]
 {WordSpace={1,0,0},
  HyphenChar=None,
  PunctuationSpace=WordSpace}

In fact the correct behavior is restored by either one of this changes:

hvoss49 commented 1 year ago

I cannot see it with up-to-date TeXLive

miccoli commented 1 year ago

I cannot see it with up-to-date TeXLive

I tested on Overleaf with TeXLive 2022. From the logs:

This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex 2022.8.9)  7 JAN 2023 09:05
<snip>
Package: fontspec 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX
<snip>
Package: unicode-math 2020/01/31 v0.8q Unicode maths in XeLaTeX and LuaLaTeX
miccoli commented 1 year ago

Just for completeness I add also the full log.

Overleaf raw log ``` This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex 2022.8.9) 7 JAN 2023 09:32 entering extended mode \write18 enabled. %&-line parsing enabled. **main.tex (./main.tex LaTeX2e <2022-06-01> patch level 5 L3 programming layer <2022-08-05> (/usr/local/texlive/2022/texmf-dist/tex/latex/base/minimal.cls Document Class: minimal 2001/05/25 Standard LaTeX minimal class ) (/usr/local/texlive/2022/texmf-dist/tex/latex/fontspec/fontspec.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/l3packages/xparse/xparse.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/l3kernel/expl3.sty Package: expl3 2022-08-05 L3 programming layer (loader) (/usr/local/texlive/2022/texmf-dist/tex/latex/l3backend/l3backend-xetex.def File: l3backend-xetex.def 2022-08-05 L3 backend support: XeTeX \g__graphics_track_int=\count181 \l__pdf_internal_box=\box51 \g__pdf_backend_object_int=\count182 \g__pdf_backend_annotation_int=\count183 \g__pdf_backend_link_int=\count184 )) Package: xparse 2022-06-22 L3 Experimental document command parser ) Package: fontspec 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX (/usr/local/texlive/2022/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty Package: fontspec-xetex 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX \l__fontspec_script_int=\count185 \l__fontspec_language_int=\count186 \l__fontspec_strnum_int=\count187 \l__fontspec_tmp_int=\count188 \l__fontspec_tmpa_int=\count189 \l__fontspec_tmpb_int=\count190 \l__fontspec_tmpc_int=\count191 \l__fontspec_em_int=\count192 \l__fontspec_emdef_int=\count193 \l__fontspec_strong_int=\count194 \l__fontspec_strongdef_int=\count195 \l__fontspec_tmpa_dim=\dimen138 \l__fontspec_tmpb_dim=\dimen139 \l__fontspec_tmpc_dim=\dimen140 (/usr/local/texlive/2022/texmf-dist/tex/latex/base/fontenc.sty Package: fontenc 2021/04/29 v2.0v Standard LaTeX package ) (/usr/local/texlive/2022/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (/usr/local/texlive/2022/texmf-dist/tex/latex/unicode-math/unicode-math.sty Package: unicode-math 2020/01/31 v0.8q Unicode maths in XeLaTeX and LuaLaTeX (/usr/local/texlive/2022/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty Package: unicode-math-xetex 2020/01/31 v0.8q Unicode maths in XeLaTeX and LuaLaTeX (/usr/local/texlive/2022/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty Package: l3keys2e 2022-06-22 LaTeX2e option processing using LaTeX3 keys ) (/usr/local/texlive/2022/texmf-dist/tex/latex/base/fix-cm.sty Package: fix-cm 2020/11/24 v1.1t fixes to LaTeX (/usr/local/texlive/2022/texmf-dist/tex/latex/base/ts1enc.def File: ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file LaTeX Font Info: Redeclaring font encoding TS1 on input line 47. )) (/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsmath.sty Package: amsmath 2022/04/08 v2.17n AMS math features \@mathmargin=\skip47 For additional information on amsmath, use the `?' option. (/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amstext.sty Package: amstext 2021/08/26 v2.01 AMS text (/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsgen.sty File: amsgen.sty 1999/11/30 v2.0 generic functions \@emptytoks=\toks16 \ex@=\dimen141 )) (/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsbsy.sty Package: amsbsy 1999/11/29 v1.2d Bold Symbols \pmbraise@=\dimen142 ) (/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsopn.sty Package: amsopn 2022/04/08 v2.04 operator names ) \inf@bad=\count196 LaTeX Info: Redefining \frac on input line 234. \uproot@=\count197 \leftroot@=\count198 LaTeX Info: Redefining \overline on input line 399. LaTeX Info: Redefining \colon on input line 410. \classnum@=\count199 \DOTSCASE@=\count266 LaTeX Info: Redefining \ldots on input line 496. LaTeX Info: Redefining \dots on input line 499. LaTeX Info: Redefining \cdots on input line 620. \Mathstrutbox@=\box52 \strutbox@=\box53 LaTeX Info: Redefining \big on input line 722. LaTeX Info: Redefining \Big on input line 723. LaTeX Info: Redefining \bigg on input line 724. LaTeX Info: Redefining \Bigg on input line 725. \big@size=\dimen143 LaTeX Font Info: Redeclaring font encoding OML on input line 743. LaTeX Font Info: Redeclaring font encoding OMS on input line 744. \macc@depth=\count267 LaTeX Info: Redefining \bmod on input line 905. LaTeX Info: Redefining \pmod on input line 910. LaTeX Info: Redefining \smash on input line 940. LaTeX Info: Redefining \relbar on input line 970. LaTeX Info: Redefining \Relbar on input line 971. \c@MaxMatrixCols=\count268 \dotsspace@=\muskip16 \c@parentequation=\count269 \dspbrk@lvl=\count270 \tag@help=\toks17 \row@=\count271 \column@=\count272 \maxfields@=\count273 \andhelp@=\toks18 \eqnshift@=\dimen144 \alignsep@=\dimen145 \tagshift@=\dimen146 \tagwidth@=\dimen147 \totwidth@=\dimen148 \lineht@=\dimen149 \@envbody=\toks19 \multlinegap=\skip48 \multlinetaggap=\skip49 \mathdisplay@stack=\toks20 LaTeX Info: Redefining \[ on input line 2953. LaTeX Info: Redefining \] on input line 2954. ) \g__um_fam_int=\count274 \g__um_fonts_used_int=\count275 \l__um_primecount_int=\count276 \g__um_primekern_muskip=\muskip17 (/usr/local/texlive/2022/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex))) Package fontspec Info: Font family 'SourceCodePro-Regular.otf(0)' created for (fontspec) font 'SourceCodePro-Regular.otf' with options (fontspec) [WordSpace={1,0,0},HyphenChar=None,PunctuationSpace=WordSpace]. (fontspec) (fontspec) This font family consists of the following NFSS (fontspec) series/shapes: (fontspec) (fontspec) - 'normal' (m/n) with NFSS spec.: (fontspec) <->"[SourceCodePro-Regular.otf]/OT:script=latn;language=dflt;" (fontspec) - 'small caps' (m/sc) with NFSS spec.: (fontspec) and font adjustment code: (fontspec) \fontdimen 2\font =1\fontdimen 2\font \fontdimen 3\font (fontspec) =0\fontdimen 3\font \fontdimen 4\font =0\fontdimen (fontspec) 4\font \fontdimen 7\font =0\fontdimen 2\font (fontspec) \tex_hyphenchar:D \font =-1\scan_stop: Package fontspec Info: Font family 'SourceCodePro-Regular.otf(1)' created for (fontspec) font 'SourceCodePro-Regular.otf' with options []. (fontspec) (fontspec) This font family consists of the following NFSS (fontspec) series/shapes: (fontspec) (fontspec) - 'normal' (m/n) with NFSS spec.: (fontspec) <->"[SourceCodePro-Regular.otf]/OT:script=latn;language=dflt;" (fontspec) - 'small caps' (m/sc) with NFSS spec.: LaTeX Font Info: Overwriting math alphabet `\mathtt' in version `normal' (Font) OT1/cmtt/m/n --> TU/SourceCodePro-Regular.otf(1)/m/n on input line 5. LaTeX Font Info: Overwriting math alphabet `\mathtt' in version `bold' (Font) OT1/cmtt/m/n --> TU/SourceCodePro-Regular.otf(1)/bx/n on input line 5. (./output.aux) \openout1 = `output.aux'. LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for TU/lmr/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 7. LaTeX Font Info: ... okay on input line 7. LaTeX Font Info: Overwriting math alphabet `\mathrm' in version `normal' (Font) OT1/cmr/m/n --> TU/lmr/m/n on input line 7. LaTeX Font Info: Overwriting math alphabet `\mathit' in version `normal' (Font) OT1/cmr/m/it --> TU/lmr/m/it on input line 7. LaTeX Font Info: Overwriting math alphabet `\mathbf' in version `normal' (Font) OT1/cmr/bx/n --> TU/lmr/bx/n on input line 7. LaTeX Font Info: Overwriting math alphabet `\mathsf' in version `normal' (Font) OT1/cmss/m/n --> TU/lmss/m/n on input line 7. LaTeX Font Info: Overwriting math alphabet `\mathsf' in version `bold' (Font) OT1/cmss/bx/n --> TU/lmss/bx/n on input line 7. Package fontspec Info: Font family 'latinmodern-math.otf(0)' created for font (fontspec) 'latinmodern-math.otf' with options (fontspec) [BoldItalicFont={},ItalicFont={},SmallCapsFont={},Script=Math,BoldFont={latinmodern-math.otf}]. (fontspec) (fontspec) This font family consists of the following NFSS (fontspec) series/shapes: (fontspec) (fontspec) - 'normal' (m/n) with NFSS spec.: (fontspec) <->"[latinmodern-math.otf]/OT:script=math;language=dflt;" (fontspec) - 'small caps' (m/sc) with NFSS spec.: (fontspec) - 'bold' (b/n) with NFSS spec.: (fontspec) <->"[latinmodern-math.otf]/OT:script=math;language=dflt;" (fontspec) - 'bold small caps' (b/sc) with NFSS spec.: Package fontspec Info: Font family 'latinmodern-math.otf(1)' created for font (fontspec) 'latinmodern-math.otf' with options (fontspec) [BoldItalicFont={},ItalicFont={},SmallCapsFont={},Script=Math,SizeFeatures={{Size=8.5-},{Size=6-8.5,Font=latinmodern-math.otf,Style=MathScript},{Size=-6,Font=latinmodern-math.otf,Style=MathScriptScript}},BoldFont={latinmodern-math.otf}]. (fontspec) (fontspec) This font family consists of the following NFSS (fontspec) series/shapes: (fontspec) (fontspec) - 'normal' (m/n) with NFSS spec.: (fontspec) <8.5->"[latinmodern-math.otf]/OT:script=math;language=dflt;"<6-8.5>"[latinmodern-math.otf]/OT:script=math;language=dflt;+ssty=0;"<-6>"[latinmodern-math.otf]/OT:script=math;language=dflt;+ssty=1;" (fontspec) - 'small caps' (m/sc) with NFSS spec.: (fontspec) - 'bold' (b/n) with NFSS spec.: (fontspec) <->"[latinmodern-math.otf]/OT:script=math;language=dflt;" (fontspec) - 'bold small caps' (b/sc) with NFSS spec.: LaTeX Font Info: Encoding `OT1' has changed to `TU' for symbol font (Font) `operators' in the math version `normal' on input line 7. LaTeX Font Info: Overwriting symbol font `operators' in version `normal' (Font) OT1/cmr/m/n --> TU/latinmodern-math.otf(1)/m/n on input line 7. LaTeX Font Info: Encoding `OT1' has changed to `TU' for symbol font (Font) `operators' in the math version `bold' on input line 7. LaTeX Font Info: Overwriting symbol font `operators' in version `bold' (Font) OT1/cmr/bx/n --> TU/latinmodern-math.otf(1)/b/n on input line 7. Package fontspec Info: latinmodern-math scale = 1.0001. Package fontspec Info: latinmodern-math scale = 1.0001. Package fontspec Info: latinmodern-math scale = 1.0001. Package fontspec Info: latinmodern-math scale = 1.0001. Package fontspec Info: latinmodern-math scale = 1.0001. Package fontspec Info: Font family 'latinmodern-math.otf(2)' created for font (fontspec) 'latinmodern-math.otf' with options (fontspec) [BoldItalicFont={},ItalicFont={},SmallCapsFont={},Script=Math,SizeFeatures={{Size=8.5-},{Size=6-8.5,Font=latinmodern-math.otf,Style=MathScript},{Size=-6,Font=latinmodern-math.otf,Style=MathScriptScript}},BoldFont={latinmodern-math.otf},ScaleAgain=1.0001,FontAdjustment={\fontdimen (fontspec) 8\font =6.77pt\relax \fontdimen 9\font =3.94pt\relax (fontspec) \fontdimen 10\font =4.44pt\relax \fontdimen 11\font (fontspec) =6.86pt\relax \fontdimen 12\font =3.45pt\relax (fontspec) \fontdimen 13\font =3.63pt\relax \fontdimen 14\font (fontspec) =3.63pt\relax \fontdimen 15\font =2.89pt\relax (fontspec) \fontdimen 16\font =2.47pt\relax \fontdimen 17\font (fontspec) =2.47pt\relax \fontdimen 18\font =2.5pt\relax (fontspec) \fontdimen 19\font =2.0pt\relax \fontdimen 22\font (fontspec) =2.5pt\relax \fontdimen 20\font =0pt\relax \fontdimen (fontspec) 21\font =0pt\relax }]. (fontspec) (fontspec) This font family consists of the following NFSS (fontspec) series/shapes: (fontspec) (fontspec) - 'normal' (m/n) with NFSS spec.: (fontspec) <8.5->s*[1.0001]"[latinmodern-math.otf]/OT:script=math;language=dflt;"<6-8.5>s*[1.0001]"[latinmodern-math.otf]/OT:script=math;language=dflt;+ssty=0;"<-6>s*[1.0001]"[latinmodern-math.otf]/OT:script=math;language=dflt;+ssty=1;" (fontspec) - 'small caps' (m/sc) with NFSS spec.: (fontspec) and font adjustment code: (fontspec) \fontdimen 8\font =6.77pt\relax \fontdimen 9\font (fontspec) =3.94pt\relax \fontdimen 10\font =4.44pt\relax (fontspec) \fontdimen 11\font =6.86pt\relax \fontdimen 12\font (fontspec) =3.45pt\relax \fontdimen 13\font =3.63pt\relax (fontspec) \fontdimen 14\font =3.63pt\relax \fontdimen 15\font (fontspec) =2.89pt\relax \fontdimen 16\font =2.47pt\relax (fontspec) \fontdimen 17\font =2.47pt\relax \fontdimen 18\font (fontspec) =2.5pt\relax \fontdimen 19\font =2.0pt\relax \fontdimen (fontspec) 22\font =2.5pt\relax \fontdimen 20\font =0pt\relax (fontspec) \fontdimen 21\font =0pt\relax (fontspec) - 'bold' (b/n) with NFSS spec.: (fontspec) <->s*[1.0001]"[latinmodern-math.otf]/OT:script=math;language=dflt;" (fontspec) - 'bold small caps' (b/sc) with NFSS spec.: (fontspec) and font adjustment code: (fontspec) \fontdimen 8\font =6.77pt\relax \fontdimen 9\font (fontspec) =3.94pt\relax \fontdimen 10\font =4.44pt\relax (fontspec) \fontdimen 11\font =6.86pt\relax \fontdimen 12\font (fontspec) =3.45pt\relax \fontdimen 13\font =3.63pt\relax (fontspec) \fontdimen 14\font =3.63pt\relax \fontdimen 15\font (fontspec) =2.89pt\relax \fontdimen 16\font =2.47pt\relax (fontspec) \fontdimen 17\font =2.47pt\relax \fontdimen 18\font (fontspec) =2.5pt\relax \fontdimen 19\font =2.0pt\relax \fontdimen (fontspec) 22\font =2.5pt\relax \fontdimen 20\font =0pt\relax (fontspec) \fontdimen 21\font =0pt\relax LaTeX Font Info: Encoding `OMS' has changed to `TU' for symbol font (Font) `symbols' in the math version `normal' on input line 7. LaTeX Font Info: Overwriting symbol font `symbols' in version `normal' (Font) OMS/cmsy/m/n --> TU/latinmodern-math.otf(2)/m/n on input line 7. LaTeX Font Info: Encoding `OMS' has changed to `TU' for symbol font (Font) `symbols' in the math version `bold' on input line 7. LaTeX Font Info: Overwriting symbol font `symbols' in version `bold' (Font) OMS/cmsy/b/n --> TU/latinmodern-math.otf(2)/b/n on input line 7. Package fontspec Info: latinmodern-math scale = 0.9999. Package fontspec Info: latinmodern-math scale = 0.9999. Package fontspec Info: latinmodern-math scale = 0.9999. Package fontspec Info: latinmodern-math scale = 0.9999. Package fontspec Info: latinmodern-math scale = 0.9999. Package fontspec Info: Font family 'latinmodern-math.otf(3)' created for font (fontspec) 'latinmodern-math.otf' with options (fontspec) [BoldItalicFont={},ItalicFont={},SmallCapsFont={},Script=Math,SizeFeatures={{Size=8.5-},{Size=6-8.5,Font=latinmodern-math.otf,Style=MathScript},{Size=-6,Font=latinmodern-math.otf,Style=MathScriptScript}},BoldFont={latinmodern-math.otf},ScaleAgain=0.9999,FontAdjustment={\fontdimen (fontspec) 8\font =0.4pt\relax \fontdimen 9\font =2.0pt\relax (fontspec) \fontdimen 10\font =1.67pt\relax \fontdimen 11\font (fontspec) =1.11pt\relax \fontdimen 12\font =6.0pt\relax (fontspec) \fontdimen 13\font =0pt\relax }]. (fontspec) (fontspec) This font family consists of the following NFSS (fontspec) series/shapes: (fontspec) (fontspec) - 'normal' (m/n) with NFSS spec.: (fontspec) <8.5->s*[0.9999]"[latinmodern-math.otf]/OT:script=math;language=dflt;"<6-8.5>s*[0.9999]"[latinmodern-math.otf]/OT:script=math;language=dflt;+ssty=0;"<-6>s*[0.9999]"[latinmodern-math.otf]/OT:script=math;language=dflt;+ssty=1;" (fontspec) - 'small caps' (m/sc) with NFSS spec.: (fontspec) and font adjustment code: (fontspec) \fontdimen 8\font =0.4pt\relax \fontdimen 9\font (fontspec) =2.0pt\relax \fontdimen 10\font =1.67pt\relax (fontspec) \fontdimen 11\font =1.11pt\relax \fontdimen 12\font (fontspec) =6.0pt\relax \fontdimen 13\font =0pt\relax (fontspec) - 'bold' (b/n) with NFSS spec.: (fontspec) <->s*[0.9999]"[latinmodern-math.otf]/OT:script=math;language=dflt;" (fontspec) - 'bold small caps' (b/sc) with NFSS spec.: (fontspec) and font adjustment code: (fontspec) \fontdimen 8\font =0.4pt\relax \fontdimen 9\font (fontspec) =2.0pt\relax \fontdimen 10\font =1.67pt\relax (fontspec) \fontdimen 11\font =1.11pt\relax \fontdimen 12\font (fontspec) =6.0pt\relax \fontdimen 13\font =0pt\relax LaTeX Font Info: Encoding `OMX' has changed to `TU' for symbol font (Font) `largesymbols' in the math version `normal' on input line 7. LaTeX Font Info: Overwriting symbol font `largesymbols' in version `normal' (Font) OMX/cmex/m/n --> TU/latinmodern-math.otf(3)/m/n on input line 7. LaTeX Font Info: Encoding `OMX' has changed to `TU' for symbol font (Font) `largesymbols' in the math version `bold' on input line 7. LaTeX Font Info: Overwriting symbol font `largesymbols' in version `bold' (Font) OMX/cmex/m/n --> TU/latinmodern-math.otf(3)/b/n on input line 7. Underfull \hbox (badness 1895) in paragraph at lines 11--12 []\TU/SourceCodePro-Regular.otf(0)/m/n/10 Lorem ipsum dolor sit [] Underfull \hbox (badness 1895) in paragraph at lines 11--12 \TU/SourceCodePro-Regular.otf(0)/m/n/10 aliqua. Ut enim ad [] Underfull \hbox (badness 2698) in paragraph at lines 11--12 \TU/SourceCodePro-Regular.otf(0)/m/n/10 occaecat cupidatat non [] LaTeX Font Info: Font shape `TU/latinmodern-math.otf(2)/m/n' will be (Font) scaled to size 10.00107pt on input line 12. LaTeX Font Info: Font shape `TU/latinmodern-math.otf(2)/m/n' will be (Font) scaled to size 7.00075pt on input line 12. LaTeX Font Info: Font shape `TU/latinmodern-math.otf(2)/m/n' will be (Font) scaled to size 5.00053pt on input line 12. LaTeX Font Info: Font shape `TU/latinmodern-math.otf(3)/m/n' will be (Font) scaled to size 9.99893pt on input line 12. LaTeX Font Info: Font shape `TU/latinmodern-math.otf(3)/m/n' will be (Font) scaled to size 6.99925pt on input line 12. LaTeX Font Info: Font shape `TU/latinmodern-math.otf(3)/m/n' will be (Font) scaled to size 4.99947pt on input line 12. [1] (./output.aux) ) Here is how much of TeX's memory you used: 7332 strings out of 475856 162255 string characters out of 5801793 675711 words of memory out of 5000000 28414 multiletter control sequences out of 15000+600000 470087 words of font info for 46 fonts, out of 8000000 for 9000 1348 hyphenation exceptions out of 8191 84i,5n,115p,475b,278s stack positions out of 10000i,1000n,20000p,200000b,200000s Output written on output.xdv (1 page, 5004 bytes). ```

From the log you see that if unicode-math.sty is loaded, fontspec will create two font families, SourceCodePro-Regular.otf(0) and SourceCodePro-Regular.otf(1), the first with the correct settings, the second with default ones.

hvoss49 commented 1 year ago

my fault. My xelatex was a link to lualatex, which works well. With xelatex I can confirm it ...

bgvoisin commented 1 year ago

A quick-and-dirty fix would be to change line 163 of um-code-mathtext.dtx from

%<XE> \fontspec_gset_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}

to

%<XE> \fontspec_gset_family:Nnn \g__fontspec_mathtt_tl {WordSpace={1,0,0},HyphenChar=None,PunctuationSpace=WordSpace,#1} {#2}

namely to add the features from fontspec.cfg into the definition of \__fontspec_setmonofont_hook:nn. I just tried on my setup, editing unicode-math-xetex.sty, and this seems to work.

A better way to go would be to pick up whatever's in fontspec.cfg, which the user may have customized.