lualatex t.tex
对于以下代码
% t.tex
\documentclass{beamer}
\usepackage{luatexja-preset}
\begin{document}
\begin{frame}
$\mathrm{a}$
\end{frame}
\end{document}
导致以下错误
! LaTeX Error: Math alphabet identifier \mathrm is undefined in math version `n
ormal'.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.10 \end{frame}
t.tex
如果我注释掉该行,编译时不会出现错误
\usepackage{luatexja-preset}
答案1
% t.tex
\RequirePackage{luatex85}
\documentclass[professionalfonts]{beamer}
\usepackage{luatexja-preset}
\DeclareMathAlphabet\mathrM{\encodingdefault}{\familydefault}{m}{n}
\let\mathrm\mathrM % not sure why I can't declare this directly
\begin{document}
\begin{frame}
a $a,\mathrm{a},\mathgt{a}$
\end{frame}
\end{document}