
このマクロのおかげで
\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}
この質問から生まれた 章の「文字通りの」番号付け
すべてうまくいっています。各章の最初のページでは「第 1 章」、「第 2 章」など、必要なものが見つかりました。しかし、目次では、章と同じ番号順が使用され、文字どおりなので、明らかに望んでいません。では、\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}