
Estou convertendo um projeto multilíngue para LuaLaTeX quando deu um erro estranho em um 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}}
Ao separar o código, parece que configurar babel
e onchar=ids fonts
extrair NotoSerifCJK-VF
são as fontes do problema (o arquivo da fonte é baixadoaqui, o "OTCs Variáveis - TTF"). Suspeito chemfig
que provavelmente não seja parte do problema, mas não consegui reproduzi-lo em nenhum outro lugar.
Exemplo de falha mínima:
\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}
Responder1
Parece um bug no babel
. Experimente o seguinte hack no preâmbulo:
\makeatletter
\let\bblorg@mapselect\bbl@mapselect
\def\bbl@mapselect{\ifmmode\else\bblorg@mapselect\fi}
\makeatother
Mas tenho que investigar um pouco mais.