# Translating titles with ctex

As best as I can understand, there are two ways to load the ctex package: as a document class (i.e. \documentclass{ctexbook} or as a package (i.e. \usepackage{ctex}). As I am using another document class, I have selected the later. This means, however, that the document uses English for titles throughout the document (e.g. table of contents, glossary).

When I try to rename the titles of parts of the documents, using \CTEXoptions, this always fails. E.g.:

\documentclass{book}
\usepackage{ctex}
\usepackage{xeCJK}
\usepackage{fontspec}
\CTEXoptions[contentsname={目录名}]
\begin{document}
\tableofcontents
\chapter{This is a chapter title}
\end{document}


This fails to compile:

! Package xkeyval Error: contentsname' undefined in families CTEX'.

See the xkeyval package documentation for explanation.
Type  H <return>  for immediate help.
...

l.6 \CTEXoptions[contentsname={目录名}]

• How can I properly set the names of these items in my document?

contentsname 目录名

listfigurename 表格目录

listtablename 插图目录

figurename 图

tablename 表

abstractname 摘要

indexname 索引

bibname 参考文献

-

Load the ctexcap package instead of ctex. This will automatically redefine the strings you mentioned in your question. The command \CTEXoptions[contentsname={目录名}] will also then work.

P/S: Surely 目录名 is wrong?

-

This is a long comment of LianTze Lim's answer.

• Load ctexcap package for other document classes. But you should only load ctexcap for those document classes based on standard article, report and book. For example, you can use ctexcap together with extarticle and ltxdoc, but you should NOT use ctexcap with beamer, scrartcl or moderncv. Actally ctexcap is rarely used.
(EDIT: Well, it doesn't matter)

• You don't need to use xeCJK and fontspec explictly when you use ctex bundle.

• 目录名 should be 目录.

• You are welcome to ask this kind of questions in CTeX forum.

-