
Estoy convirtiendo un proyecto multilingüe a LuaLaTeX cuando me dio un error extraño en un chemfig
comando:
! LaTeX Error: Command \rmfamily invalid in math mode.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.13 \chemfig{\charge{135:4pt={+}}{H}-{F}}
Al separar el código, parece que configurar babel
y onchar=ids fonts
extraer NotoSerifCJK-VF
son las fuentes del problema (el archivo de fuente se descargaaquí, el de “OTC variables – TTF”). Sospecho chemfig
que probablemente no sea parte del problema, pero no pude reproducirlo en ningún otro lugar.
Ejemplo de error mínimo:
\documentclass{article}
% Loading chemfig before, between, or after the babel stuff does not change the error
\usepackage{chemfig}
\usepackage[main=english]{babel}
% Either of these two lines,
\babelprovide[import,onchar=ids fonts]{chinese}
\babelprovide[onchar=ids fonts]{french}
% combined with this line, will cause the error
\babelfont[chinese]{rm}[Path=./assets/fonts/]{NotoSerifCJK-VFttf.ttc} % make sure file name has only one dot
\begin{document}
\chemfig{\charge{135:4pt={+}}{H}-{F}}
\end{document}
Respuesta1
Parece un error en babel
. Pruebe el siguiente truco en el preámbulo:
\makeatletter
\let\bblorg@mapselect\bbl@mapselect
\def\bbl@mapselect{\ifmmode\else\bblorg@mapselect\fi}
\makeatother
Pero tengo que investigar un poco más.