
명령 에서 이상한 오류가 발생했을 때 다국어 프로젝트를 LuaLaTeX로 변환하고 있습니다 chemfig
.
! 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}}
코드를 분리해 보니 babel
로 구성 onchar=ids fonts
하고 당기는 것이 NotoSerifCJK-VF
문제의 원인인 것으로 보입니다(글꼴 파일이 다운로드됨).여기, "가변 OTC - TTF" 중 하나). chemfig
아마도 문제의 일부가 아닐 것 같지만 다른 곳에서는 재현할 수 없었습니다 .
최소한의 실패 예:
\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}
답변1
에 버그가 있는 것 같습니다 babel
. 서문에서 다음 해킹을 시도해 보세요.
\makeatletter
\let\bblorg@mapselect\bbl@mapselect
\def\bbl@mapselect{\ifmmode\else\bblorg@mapselect\fi}
\makeatother
하지만 좀 더 조사해 봐야 할 것 같아요.