首页 > 代码库 > Package inputenc Error: Unicode char \u8: not set up for use with LaTeX.

Package inputenc Error: Unicode char \u8: not set up for use with LaTeX.

用TexStudio编辑文档时,不知是多加了空格还是啥,总是提示如下错误: 

Package inputenc Error: Unicode char \u8:  not set up for use with LaTeX.

 删除掉一些内容(code)之后可以成功编译,不过添加(code)之后,又反复出现了。如此几次,真是抓狂。

遂到tex.stackchange.com上找寻到:戳这里。说是有Non-Breaking Space。

依照其添加了:

\DeclareUnicodeCharacter{00A0}{~}

不过问题依旧啊。

阅读文档:

This is due to the utf8 definition not necessarily having a mapping of all the character glyphs you are able to enter on your keyboard. 

后面还提到:

With XeTeX and LuaTeX the inputenc package is no longer needed. Both engines support UTF-8 directly and allow the use of TTF and OpenType fonts to support Unicode characters. See the Fonts7 section for more information.

 

将编译环境换成XeLatex,不过汉字完全不见了!!

 

继续搜索‘XeLatex 中文‘,原来是缺少宏包,引入宏包(注释掉原来的CJK宏包引用,貌似会造成冲突):

 

\usepackage{xeCJK}

 

成功编译。相信这次是从根源上解决了这个问题。

 

Package inputenc Error: Unicode char \u8: not set up for use with LaTeX.