最近写总结,遇上了一些 LaTeX 中文编号的问题,特此记录。
首先是 \xCJKnumber
命令:
使用 \xCJKnumber
1 命令可以使数字中文化,那么要使用这个命令首先要加载宏包 \usepackage{xCJKnumb}
, xCJKnumb
宏包需要额外下载(点击这里下载)
下载后将其放到 texlive$/XXXX/texmf-dist/tex/latex/
目录下,XXXX是版本年代,如 2013,新建一个同名的文件夹,将 .sty
文件放入同名文件夹中。
最后在终端输入 mktexlsr
,更新一下索引。
以上只會改變內文裡的Chapter 目錄裡的不會改。
目錄裡的也要改的話要在目錄指六後面加上以下指令(此處使用xCJKnumb)
\titlecontents{chapter}[0em]
{}{\makebox[4.1em][l]
{第\xCJKnumber{\thecontentslabel}章}}{}
{\titlerule*[0.7pc]{.}\contentspage}將目錄標題中文化使用下列指令
\renewcommand\contentsname{目錄}
\renewcommand\listfigurename{圖目錄}
\renewcommand\listtablename{表目錄}要寫成表1.1 圖1.1的話需加入下列指令
\newcommand{\loflabel}{圖}
\newcommand{\lotlabel}{表}然後再圖目錄處加入
\renewcommand{\numberline}[1]{\loflabel~#1\hspace*{1em}}
\listoffigures表目錄處加入
\renewcommand{\numberline}[1]{\lotlabel~#1\hspace*{1em}}
\listoftables手動將章節加入目錄可以參考這篇http://www.ptt.cc/bbs/LaTeX/M.1242265895.A.D0A.html
大致內容如下
使用 addcontentsline指令
\addcontentsline{toc}{章節名}{標題}
章節名 要加入目錄的那段的層級 ex: chapter section
標題 要加入目錄那段的名字 ex: Chapter ABC的ABC
然后是定制 subsection
不显示上级标题(也就是 section
)的编号,例如 subsection
默认显示的是 1.1
,那么我现在只需要 1
。
重定义命令:
\renewcommand{\thesubsection}{\arabic{subsection}}
每当使用命令\newcounter自命名一个新计数器时,系统将会自动地定义一条新命令:\newcommand{\the新计数器}{\arabic{新计数器}},这条命令可用于显示该计数器的当前值。
Example:
\newcounter{Exe}[section] \renewcommand{\theExe}{\thesection.\arabic{Exe}} \newcommand{\Exe}{\par{ \heiti 例 } \refstepcounter{Exe}\textbf{% \theExe}\hspace{0.5em}} \section{节} \Exe
-
\xCJKnumber
命令是\CJKnumber
的 XeTeX 版本。 ↩