1.问题:
本人是在WIN7下用texlive 2016,编辑器用的是WinEdt 10.1 ,运行如下代码:
1 documentclass{ctexbook} 2 egin{document} 3 itle{中文 LaTeX{} 测试} 4 author{姓名} 5 maketitle 6 ableofcontents 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 egin{document} 3 itle{中文 LaTeX{} 测试} 4 author{姓名} 5 maketitle 6 ableofcontents 7 chapter{测试} 8 中文测试. 9 chapter{再测试} 10 中文测试. 11 end{document}