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}

 

相关文章:

  • 2021-09-15
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2021-09-18
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-06
  • 2021-07-18
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2021-10-02
相关资源
相似解决方案