# How to use \mathrm in Beamer with luatexja-preset?

lualatex t.tex


for the following code

% t.tex
\documentclass{beamer}

\usepackage{luatexja-preset}

\begin{document}

\begin{frame}
$\mathrm{a}$
\end{frame}

\end{document}


results in the following error

! 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 compiles without the error if I comment out the line

\usepackage{luatexja-preset}

• the package redefines mathnormal not to have any alphabets other than \mathgtif \mathgt doesn't select the required font then which font do you want \mathrm to select. (Sorry I find the documentation for luatexja a bit hard to follow:-) – David Carlisle Oct 10 '16 at 11:19
• @DavidCarlisle Thanks for your analysis. Opened an issue in LuaTeX-ja ticket system. osdn.net/ticket/browse.php?group_id=5593&tid=36711 – Hironobu YAMASHITA Oct 12 '16 at 5:51

% 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}

• The behavior is common to commands defined with \DeclareSymbolFontAlphabet. I wonder who wrote the code. – egreg Oct 10 '16 at 17:06
• @egreg do you mean common in general (I couldn't reproduce) or common for luatex-ja in beamer fonts? – David Carlisle Oct 11 '16 at 9:08
• I had the same problem with \mathcal` – egreg Oct 11 '16 at 9:18
• Solved in luatexja 20161017.0 release – Hironobu YAMASHITA Oct 20 '16 at 17:35