我知道我肯定在这里做了一些愚蠢的事情,但我不知道是什么。
\documentclass[12pt]{article}%
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{newtxtext,newtxmath}
\begin{document}
This is my equation
$\mathbf{\dot{x}}=A x \mathbf{x}$
\end{document}
当用lualatex foo.tex
数学公式编译时,缺少 x 上的点。
>lualatex foo2.tex
This is LuaTeX, Version 1.10.0 (TeX Live 2019)
restricted system commands enabled.
(./foo2.tex
LaTeX2e <2018-12-01>
luaotfload | main : initialization completed in 0.184 seconds
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size12.clo))
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3-code.tex
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/l3deprecation.def))
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def))
) (/usr/local/texlive/2019/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/tuenc.def))
(/usr/local/texlive/2019/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/newtx/newtxtext.sty
`newtxtext' v1.531, 2018/03/27 Text macros taking advantage of TeX-Gyre Termes
fonts (msharpe)
(/usr/local/texlive/2019/texmf-dist/tex/latex/fontaxes/fontaxes.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/local/texlive/2019/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/t1enc.def)
(/usr/local/texlive/2019/texmf-dist/tex/latex/lm/t1lmr.fd))
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/textcomp.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ts1enc.def)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/newtx/newtxmath.sty
`newtxmath' v1.601, 2019/10/02 Math macros based originally on txfonts (msharpe
) (/usr/local/texlive/2019/texmf-dist/tex/latex/trimspaces/trimspaces.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/centernot.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/kastrup/binhex.tex))
(/usr/local/texlive/2019/texmf-dist/tex/latex/newtx/t1ntxtlf.fd) (./foo2.aux)
(/usr/local/texlive/2019/texmf-dist/tex/latex/newtx/omlntxmi.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/newtx/untxexa.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ts1cmr.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/newtx/lmsntxsy.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/newtx/lmxntxexx.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/newtx/ot1ntxtlf.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/newtx/untxmia.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/newtx/untxsym.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/newtx/untxsyc.fd) [1{/usr/local/t
exlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./foo2.aux))
(see the transcript file for additional information)
497 words of node memory still in use:
6 hlist, 2 vlist, 2 rule, 2 glue, 4 kern, 2 sub_mlist, 1 glyph, 9 attribute,
51 glue_spec, 9 attribute_list, 1 write nodes
avail lists: 2:23,3:7,4:3,5:25,6:1,7:43,8:6,9:7,11:1
{/usr/local/texlive/2019/texmf-dist/fonts/enc/dvips/newtx/ntx-ot1-tlf.enc}{/usr
/local/texlive/2019/texmf-dist/fonts/enc/dvips/newtx/ntx-ec-tlf.enc}</usr/local
/texlive/2019/texmf-dist/fonts/type1/public/newtx/NewTXMI.pfb></usr/local/texli
ve/2019/texmf-dist/fonts/type1/public/tex-gyre/qtmb.pfb></usr/local/texlive/201
9/texmf-dist/fonts/type1/public/tex-gyre/qtmr.pfb></usr/local/texlive/2019/texm
f-dist/fonts/type1/public/newtx/txmiaX.pfb>
Output written on foo2.pdf (1 page, 34331 bytes).
Transcript written on foo2.log.
(base) >
给予
但它应该是这样的:
\documentclass[12pt]{article}%
\usepackage{amsmath}
\begin{document}
This is my equation
$\mathbf{\dot{x}}=A x \mathbf{x}$
\end{document}
2019 年
答案1
最好将 OTF 字体与 luatex 一起使用,也许:
\documentclass[12pt]{article}%
\usepackage{amsmath}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Termes}
\setmathfont{TeX Gyre Termes Math}
\begin{document}
This is my equation
$\mathbf{\dot{x}}=A x \mathbf{x}$
although perhaps better
$\dot{\symbf{x}}=A x \symbf{x}$
or
$\dot{\symbfit{x}}=A x \symbfit{x}$
\end{document}
答案2
该软件包newtxtext
无法与 一起工作fontspec
。
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{newtxmath}
\setmainfont{Tempora} % or whatever Times clone you prefer
\begin{document}
This is my equation
$\dot{\mathbf{x}}=A x \mathbf{x}$
\end{document}
还请注意pdflatex
代码
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{newtxtext,newtxmath}
\begin{document}
This is my equation
$\mathbf{\dot{x}}=A x \mathbf{x}$
\end{document}
无法生成点。这是否是 的一个错误newtxmath
尚有争议。我认为正确的语法是
\dot{\mathbf{x}}
答案3
newtxtext
尽管我完全同意 David Carlisle 的观点,但是对于你提出的关于如何使用和包的问题,字面上的答案newtxmath
是这样的:
\documentclass[12pt]{article}%
\usepackage{amsmath}
\usepackage{newtxtext,newtxmath}
\usepackage[no-math]{fontspec}
\setmainfont{TeX Gyre Termes}[NFSSFamily = ntxtlf]
\begin{document}
This is my equation:
$\dot{\mathbf{x}} = A x \mathbf{x} = \boldsymbol{\dot{\mathrm{x}}}$
\end{document}
您永远不应该这样做,但您可能确实想使用fontspec
旧式数学包,并且只删除newtxtext
。如果您真的需要将 Unicode 与旧式文本编码混合,那么可以使用的包是luainputenc
。您可能会遇到诸如大写希腊字母之类的问题,许多旧式数学包都是从 OT1 编码中加载的。
为了在实际中应用,您最好切换到unicode-math
。