我正在写实验报告,并选择report
LyX 提供的课程。我使用 LyX 2.0.3 和 MiKTeX 2.9。
我的问题是,如何将章节编号更改为以文本形式显示?
例如:
第一章 不是第 1 章;
也同样会出现在目录中
例如。:
CHAPTER ONE
1.1...............
1.1.1.........................
答案1
这是一种使用包\Numberstring
中的命令fmtcount
将数字转换为文本字符串的可能性;该tocloft
包用于在目录中的章节编号前添加单词“Chapter”:
\documentclass{report}
\usepackage{tocloft}
\usepackage{fmtcount}
\renewcommand\thechapter{\Numberstring{chapter}}
\setlength\cftchapnumwidth{3em}
\renewcommand\cftchappresnum{Chapter~}
\newlength\mylen
\settowidth\mylen{\bfseries\cftchappresnum\cftchapaftersnum} % extra space
\addtolength\cftchapnumwidth{\mylen}
\begin{document}
\tableofcontents
\chapter{Test Chapter}
\end{document}
目录图片:
本章第一页的图片:
答案2
这是一个直接补丁\@chapter
- 负责将章节内容传递给 ToC 的宏,以及fmtcount
用于格式化章节计数器的编号。此补丁感谢xpatch
:
\documentclass{report}
\usepackage{xpatch}% http://ctan.org/pkg/etoolbox
\usepackage{fmtcount}% http://ctan.org/pkg/fmtcount
\renewcommand{\thechapter}{\NUMBERstring{chapter}}%
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\makeatletter
\xpatchcmd{\@chapter}% <cmd>
{\numberline{\thechapter}}% <search>
{\@chapapp~\thechapter\quad}% <replace>
{}{}% <success><failure>
\makeatother
\begin{document}
\tableofcontents
\chapter{First chapter}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\chapter{Second chapter}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\chapter{Third chapter}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\chapter{Last chapter}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\end{document}