
感謝這個宏
\makeatletter
\let\old@makechapterhead\@makechapterhead
\def\@makechapterhead{\def\thechapter{\words{chapter}}\old@makechapterhead}
\makeatother
\newcommand\words[1]{\expandafter\xwords\csname c@#1\endcsname}
\def\xwords#1{\ifcase#1\or
one\or
two\or
three\or
four\or
five\else
I need more words\fi}
來自這個問題 章節的「字面」編號
一切都感覺很好,我在每章的第一頁「第一章」、「第二章」等中獲得了我想要的內容,但在目錄中,它使用了相同的章節編號,所以沒有內容,顯然我不要。那麼如何\arabic{chapter}
對內容使用通常的編號 () 呢?
答案1
最好使用該包fmtcount
來取得計數器的拼字值。在這種情況下,您將需要使用該tocstyle
套件來調整目錄中的邊距。
如果您想在章節中使用它,只需將每次出現的替換section
為chapter
。
\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{fmtcount,tocstyle}
\renewcommand\thesection{\Numberstring{section}}
\begin{document}
\tableofcontents
\section{First section}
\section{Second section}
\subsection{A subsection}
\section{Third section}
\end{document}