1.問題:
本人是在WIN7下用texlive 2016,編輯器用的是WinEdt 10.1 ,運行如下代碼:
1 \documentclass{ctexbook} 2 \begin{document} 3 \title{中文 \LaTeX{} 測試} 4 \author{姓名} 5 \maketitle 6 \tableofcontents 7 \chapter{測試} 8 中文測試. 9 \chapter{再測試} 10 中文測試. 11 \end{document}
返回如下錯誤:
! Improper alphabetic constant. <to be read again> \hspace l.1 ...berline {第一章\hspace {.3em}}測試}{5}
2.解決:
在google上找答案,發現原來是在\documentclass{ctexbook}中少寫了一個[UTF8] ,加上它就沒有這個錯誤了,即改為如下代碼后,就沒有該錯誤了:
1 \documentclass[UTF8]{ctexbook} 2 \begin{document} 3 \title{中文 \LaTeX{} 測試} 4 \author{姓名} 5 \maketitle 6 \tableofcontents 7 \chapter{測試} 8 中文測試. 9 \chapter{再測試} 10 中文測試. 11 \end{document}