我尝试过:
\documentclass{article}
\usepackage{unicode-math}
\usepackage{fontspec}%
\setmainfont[Mapping=tex-text,Path = ./Fonts/ ,
UprightFont= TimesNewRomPSPro,
BoldFont= TimesNewRomPSPro-Bol,
ItalicFont=TimesNewRomPSPro-Ita,
BoldItalicFont=TimesNewRomPSPro-BolIta,
]{TimesNewRomPSPro}%
\setmathfont[]{latinmodern-math.otf}
\setmathfont[range=\mathup/{latin,Latin,num}]{TimesNewRomPSPro}
\begin{document}
sin $\sin x=y$ \textit{x} $\displaystyle\frac{d \hat{t}}{d s}$
\end{document}
它产生了错误,我不知道如何修复它,请注意,如果我注释该命令,\setmathfont[range=\mathup/{latin,Latin,num}]{TimesNewRomPSPro}
那么它可以正常工作,但我保留了这个命令,因为我需要获取arabic
并alpha numerals
放入字体Math
中TimesNewRoman
,请指出我做错了什么......
当我运行文件时,XeLaTeX 就挂了,截图如下:
非常感谢您宝贵的建议......
按照David Carlisle
建议,我等了一段时间,出现了错误,文件log
是
This is XeTeX, Version 3.141592653-2.6-0.999993 (MiKTeX 21.3) (preloaded format=xelatex 2022.1.5) 15 FEB 2022 22:40
entering extended mode
**./test.tex
(test.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-18>
(C:\Program Files\MiKTeX\tex/latex/base\article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(C:\Program Files\MiKTeX\tex/latex/base\size10.clo
File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option)
)
\c@part=\count175
\c@section=\count176
\c@subsection=\count177
\c@subsubsection=\count178
\c@paragraph=\count179
\c@subparagraph=\count180
\c@figure=\count181
\c@table=\count182
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
)
(C:\Program Files\MiKTeX\tex/latex/unicode-math\unicode-math.sty
(C:\Program Files\MiKTeX\tex/latex/l3kernel\expl3.sty
Package: expl3 2021-02-18 L3 programming layer (loader)
(C:\Program Files\MiKTeX\tex/latex/l3backend\l3backend-xetex.def
File: l3backend-xetex.def 2021-03-18 L3 backend support: XeTeX
()
\c__kernel_sys_dvipdfmx_version_int=\count183
\l__color_backend_stack_int=\count184
\g__color_backend_stack_int=\count185
\g__graphics_track_int=\count186
\l__pdf_internal_box=\box47
\g__pdf_backend_object_int=\count187
\g__pdf_backend_annotation_int=\count188
\g__pdf_backend_link_int=\count189
))
Package: unicode-math 2020/01/31 v0.8q Unicode maths in XeLaTeX and LuaLaTeX
(C:\Program Files\MiKTeX\tex/latex/unicode-math\unicode-math-xetex.sty
Package: unicode-math-xetex 2020/01/31 v0.8q Unicode maths in XeLaTeX and LuaLa
TeX
(C:\Program Files\MiKTeX\tex/latex/l3packages/xparse\xparse.sty
(C:\Program Files\MiKTeX\tex/latex/l3packages/xparse\xparse-2020-10-01.sty
(C:\Program Files\MiKTeX\tex/latex/l3packages/xparse\xparse-generic.tex)))
(C:\Program Files\MiKTeX\tex/latex/l3packages/l3keys2e\l3keys2e.sty
Package: l3keys2e 2021-03-12 LaTeX2e option processing using LaTeX3 keys
)
(C:\Program Files\MiKTeX\tex/latex/fontspec\fontspec.sty
Package: fontspec 2020/02/21 v2.7i Font selection for XeLaTeX and LuaLaTeX
(C:\Program Files\MiKTeX\tex/latex/fontspec\fontspec-xetex.sty
Package: fontspec-xetex 2020/02/21 v2.7i Font selection for XeLaTeX and LuaLaTe
X
\l__fontspec_script_int=\count190
\l__fontspec_language_int=\count191
\l__fontspec_strnum_int=\count192
\l__fontspec_tmp_int=\count193
\l__fontspec_tmpa_int=\count194
\l__fontspec_tmpb_int=\count195
\l__fontspec_tmpc_int=\count196
\l__fontspec_em_int=\count197
\l__fontspec_emdef_int=\count198
\l__fontspec_strong_int=\count199
\l__fontspec_strongdef_int=\count266
\l__fontspec_tmpa_dim=\dimen139
\l__fontspec_tmpb_dim=\dimen140
\l__fontspec_tmpc_dim=\dimen141
(C:\Program Files\MiKTeX\tex/latex/base\fontenc.sty
Package: fontenc 2020/08/10 v2.0s Standard LaTeX package
)
(C:\Program Files\MiKTeX\tex/latex/fontspec\fontspec.cfg)))
(C:\Program Files\MiKTeX\tex/latex/base\fix-cm.sty
Package: fix-cm 2015/01/14 v1.1t fixes to LaTeX
(C:\Program Files\MiKTeX\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.
))
(C:\Program Files\MiKTeX\tex/latex/amsmath\amsmath.sty
Package: amsmath 2020/09/23 v2.17i AMS math features
\@mathmargin=\skip49
For additional information on amsmath, use the `?' option.
(C:\Program Files\MiKTeX\tex/latex/amsmath\amstext.sty
Package: amstext 2000/06/29 v2.01 AMS text
(C:\Program Files\MiKTeX\tex/latex/amsmath\amsgen.sty
File: amsgen.sty 1999/11/30 v2.0 generic functions
\@emptytoks=\toks15
\ex@=\dimen142
))
(C:\Program Files\MiKTeX\tex/latex/amsmath\amsbsy.sty
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
\pmbraise@=\dimen143
)
(C:\Program Files\MiKTeX\tex/latex/amsmath\amsopn.sty
Package: amsopn 2016/03/08 v2.02 operator names
)
\inf@bad=\count267
LaTeX Info: Redefining \frac on input line 234.
\uproot@=\count268
\leftroot@=\count269
LaTeX Info: Redefining \overline on input line 399.
\classnum@=\count270
\DOTSCASE@=\count271
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@=\box48
\strutbox@=\box49
\big@size=\dimen144
LaTeX Font Info: Redeclaring font encoding OML on input line 743.
LaTeX Font Info: Redeclaring font encoding OMS on input line 744.
\macc@depth=\count272
\c@MaxMatrixCols=\count273
\dotsspace@=\muskip16
\c@parentequation=\count274
\dspbrk@lvl=\count275
\tag@help=\toks16
\row@=\count276
\column@=\count277
\maxfields@=\count278
\andhelp@=\toks17
\eqnshift@=\dimen145
\alignsep@=\dimen146
\tagshift@=\dimen147
\tagwidth@=\dimen148
\totwidth@=\dimen149
\lineht@=\dimen150
\@envbody=\toks18
\multlinegap=\skip50
\multlinetaggap=\skip51
\mathdisplay@stack=\toks19
LaTeX Info: Redefining \[ on input line 2923.
LaTeX Info: Redefining \] on input line 2924.
)
\g__um_fam_int=\count279
\g__um_fonts_used_int=\count280
\l__um_primecount_int=\count281
\g__um_primekern_muskip=\muskip17
(C:\Program Files\MiKTeX\tex/latex/unicode-math\unicode-math-table.tex)))
Package fontspec Info: Font family 'TimesNewRomPSPro(0)' created for font
(fontspec) 'TimesNewRomPSPro' with options
(fontspec) [Ligatures=TeX,Mapping=tex-text,Path =
(fontspec) ./Fonts/,UprightFont= TimesNewRomPSPro,BoldFont=
(fontspec) TimesNewRomPSPro-Bol,ItalicFont=TimesNewRomPSPro-Ita,Bol
dItalicFont=TimesNewRomPSPro-BolIta].
(fontspec)
(fontspec) This font family consists of the following NFSS
(fontspec) series/shapes:
(fontspec)
(fontspec) - 'normal' (m/n) with NFSS spec.:
(fontspec) <->"[./Fonts/TimesNewRomPSPro]/OT:script=latn;language=d
flt;mapping=tex-text;"
(fontspec) - 'small caps' (m/sc) with NFSS spec.:
(fontspec) <->"[./Fonts/TimesNewRomPSPro]/OT:script=latn;language=d
flt;+smcp;mapping=tex-text;"
(fontspec) - 'bold' (b/n) with NFSS spec.:
(fontspec) <->"[./Fonts/TimesNewRomPSPro-Bol]/OT:script=latn;langua
ge=dflt;mapping=tex-text;"
(fontspec) - 'bold small caps' (b/sc) with NFSS spec.:
(fontspec) - 'italic' (m/it) with NFSS spec.:
(fontspec) <->"[./Fonts/TimesNewRomPSPro-Ita]/OT:script=latn;langua
ge=dflt;mapping=tex-text;"
(fontspec) - 'italic small caps' (m/scit) with NFSS spec.:
(fontspec) - 'bold italic' (b/it) with NFSS spec.:
(fontspec) <->"[./Fonts/TimesNewRomPSPro-BolIta]/OT:script=latn;lan
guage=dflt;mapping=tex-text;"
(fontspec) - 'bold italic small caps' (b/scit) with NFSS spec.:
Package fontspec Info: Font family 'TimesNewRomPSPro(1)' created for font
(fontspec) 'TimesNewRomPSPro' with options [Mapping=tex-text,Path
(fontspec) = ./Fonts/,UprightFont= TimesNewRomPSPro,BoldFont=
(fontspec) TimesNewRomPSPro-Bol,ItalicFont=TimesNewRomPSPro-Ita,Bol
dItalicFont=TimesNewRomPSPro-BolIta].
(fontspec)
(fontspec) This font family consists of the following NFSS
(fontspec) series/shapes:
(fontspec)
(fontspec) - 'normal' (m/n) with NFSS spec.:
(fontspec) <->"[./Fonts/TimesNewRomPSPro]/OT:script=latn;language=d
flt;mapping=tex-text;"
(fontspec) - 'small caps' (m/sc) with NFSS spec.:
(fontspec) <->"[./Fonts/TimesNewRomPSPro]/OT:script=latn;language=d
flt;+smcp;mapping=tex-text;"
(fontspec) - 'bold' (b/n) with NFSS spec.:
(fontspec) <->"[./Fonts/TimesNewRomPSPro-Bol]/OT:script=latn;langua
ge=dflt;mapping=tex-text;"
(fontspec) - 'bold small caps' (b/sc) with NFSS spec.:
(fontspec) - 'italic' (m/it) with NFSS spec.:
(fontspec) <->"[./Fonts/TimesNewRomPSPro-Ita]/OT:script=latn;langua
ge=dflt;mapping=tex-text;"
(fontspec) - 'italic small caps' (m/scit) with NFSS spec.:
(fontspec) - 'bold italic' (b/it) with NFSS spec.:
(fontspec) <->"[./Fonts/TimesNewRomPSPro-BolIta]/OT:script=latn;lan
guage=dflt;mapping=tex-text;"
(fontspec) - 'bold italic small caps' (b/scit) with NFSS spec.:
LaTeX Font Info: Overwriting math alphabet `\mathrm' in version `normal'
(Font) OT1/cmr/m/n --> TU/TimesNewRomPSPro(1)/m/n on input lin
e 10.
LaTeX Font Info: Overwriting math alphabet `\mathit' in version `normal'
(Font) OT1/cmr/m/it --> TU/TimesNewRomPSPro(1)/m/it on input l
ine 10.
LaTeX Font Info: Overwriting math alphabet `\mathbf' in version `normal'
(Font) OT1/cmr/bx/n --> TU/TimesNewRomPSPro(1)/b/n on input li
ne 10.
Package fontspec Info: Font family 'latinmodern-math.otf(0)' created for font
(fontspec) 'latinmodern-math.otf' with options
(fontspec) [BoldItalicFont={},ItalicFont={},SmallCapsFont={},Script
=Math].
(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.:
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=Mat
hScript},{Size=-6,Font=latinmodern-math.otf,Style=MathScriptScript}}].
(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=df
lt;"<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.:
LaTeX Font Info: Encoding `OT1' has changed to `TU' for symbol font
(Font) `operators' in the math version `normal' on input line 11.
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 11.
LaTeX Font Info: Encoding `OT1' has changed to `TU' for symbol font
(Font) `operators' in the math version `bold' on input line 11.
LaTeX Font Info: Overwriting symbol font `operators' in version `bold'
(Font) OT1/cmr/bx/n --> TU/latinmodern-math.otf(1)/b/n on inpu
t line 11.
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=Mat
hScript},{Size=-6,Font=latinmodern-math.otf,Style=MathScriptScript}},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;l
anguage=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=dfl
t;+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
LaTeX Font Info: Encoding `OMS' has changed to `TU' for symbol font
(Font) `symbols' in the math version `normal' on input line 11.
LaTeX Font Info: Overwriting symbol font `symbols' in version `normal'
(Font) OMS/cmsy/m/n --> TU/latinmodern-math.otf(2)/m/n on inpu
t line 11.
LaTeX Font Info: Encoding `OMS' has changed to `TU' for symbol font
(Font) `symbols' in the math version `bold' on input line 11.
LaTeX Font Info: Overwriting symbol font `symbols' in version `bold'
(Font) OMS/cmsy/b/n --> TU/latinmodern-math.otf(2)/b/n on inpu
t line 11.
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=Mat
hScript},{Size=-6,Font=latinmodern-math.otf,Style=MathScriptScript}},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;l
anguage=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=dfl
t;+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
LaTeX Font Info: Encoding `OMX' has changed to `TU' for symbol font
(Font) `largesymbols' in the math version `normal' on input line 1
1.
LaTeX Font Info: Overwriting symbol font `largesymbols' in version `normal'
(Font) OMX/cmex/m/n --> TU/latinmodern-math.otf(3)/m/n on inpu
t line 11.
LaTeX Font Info: Encoding `OMX' has changed to `TU' for symbol font
(Font) `largesymbols' in the math version `bold' on input line 11.
LaTeX Font Info: Overwriting symbol font `largesymbols' in version `bold'
(Font) OMX/cmex/m/n --> TU/latinmodern-math.otf(3)/b/n on inpu
t line 11.
! Package fontspec Error: The font "TimesNewRomPSPro" cannot be found.
For immediate help type H <return>.
...
l.12
? x
Here is how much of TeX's memory you used:
7099 strings out of 411686
153068 string characters out of 2840104
653454 words of memory out of 3000000
27106 multiletter control sequences out of 15000+600000
403762 words of font info for 40 fonts, out of 8000000 for 9000
1348 hyphenation exceptions out of 8191
98i,0n,116p,302b,2768s stack positions out of 5000i,500n,10000p,200000b,80000s
No pages of output.
字体可从以下位置获取:https://easyupload.io/m/frodvl
答案1
请尝试以下操作MWE
:
\documentclass{article}
%\usepackage{unicode-math}
\usepackage[no-math]{fontspec}%
\usepackage[]{newtxmath} % For testing purposes.
\usepackage{mathspec}
\setmainfont[Ligatures=TeX,Path = ./Fonts/ ,
UprightFont= TimesNewRomPSPro,
BoldFont= TimesNewRomPSPro-Bol,
ItalicFont=TimesNewRomPSPro-Ita,
BoldItalicFont=TimesNewRomPSPro-BolIta,
]{TimesNewRomPSPro}%
\makeatletter
\AtBeginDocument{%
\DeclareSymbolFont{numbers}{\encodingdefault}{\rmdefault}{m}{n}
\DeclareMathSymbol{0}{\mathalpha}{numbers}{"30}
\DeclareMathSymbol{1}{\mathalpha}{numbers}{"31}
\DeclareMathSymbol{2}{\mathalpha}{numbers}{"32}
\DeclareMathSymbol{3}{\mathalpha}{numbers}{"33}
\DeclareMathSymbol{4}{\mathalpha}{numbers}{"34}
\DeclareMathSymbol{5}{\mathalpha}{numbers}{"35}
\DeclareMathSymbol{6}{\mathalpha}{numbers}{"36}
\DeclareMathSymbol{7}{\mathalpha}{numbers}{"37}
\DeclareMathSymbol{8}{\mathalpha}{numbers}{"38}
\DeclareMathSymbol{9}{\mathalpha}{numbers}{"39}
}
\makeatother
\begin{document}
-- --- fi fl ffi ffl \quad sin \textit{d}
\end{document}
这对我来说很完美,希望一些专家能够建议这是否正确......