這是昨天碰到的問題,使用 lualatex 編譯下列的 TeX 檔
\documentclass{memoir}
\usepackage{luatexja-fontspec}
\begin{document}
Hello World!
\end{document}會出現下列的錯誤訊息:
! LaTeX Error: Command \printglossary already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H for immediate help.
...
l.150 ...and\printglossary{\@input@{\jobname.gls}} 這是 memoir 和 luatexja-fontspec 都定義了 \printglossary 所造成的錯誤。在網路上,有看到類似的問題,解決的方法是用 \let\printglossary\relax 將 memoir 定義的 \printglossary 取消,再載入 luatexja-fontspec 即可編譯成功。所以 TeX 要改成下列的樣子:
\documentclass{memoir}
\let\printglossary\relax
\usepackage{luatexja-fontspec}
\begin{document}
Hello World!
\end{document}雖然這樣可以解決了,但是由於更改了 memoir 的定義,不知到哪裏會出現無法預期的排版錯誤。