目次の章、節、サブセクションの番号を変更する

目次の章、節、サブセクションの番号を変更する

LaTeX で目次を作成する必要があります。章はローマ数字、セクションはアラビア数字、サブセクションは文字です。また、サブセクション レベルまでしか表示しないようにする必要があります。

次のようになります:

I. CHAPTER
II. CHAPTER
   1. Section
   2. Section
      (a) Subsection
      (b) Subsection

目次を生成するために次のコマンドを使用しますが、別の形式で生成されます。

\tableofcontents

ラテックスでこれをどうやって実現するのでしょうか?

テッド。

答え1

章、節、サブセクションのカウンターの表現を制御するコマンド 、 を再定義できます\thechapter\thesectionその後、パッケージを使用してドットを追加できます。\thesubsectiontocloft

\documentclass{book}
\usepackage{tocloft}

\renewcommand\cftchapaftersnum{.}
\renewcommand\cftsecaftersnum{.}

\renewcommand\thechapter{\Roman{chapter}}
\renewcommand\thesection{\arabic{section}}
\renewcommand\thesubsection{(\alph{subsection})}

\begin{document}

\tableofcontents

\chapter{Test Chapter One}
\section{Test Section One}
\section{Test Section One}
\subsection{Test Subsection A}
\subsection{Test Subsection B}

\end{document}

ここに画像の説明を入力してください

章番号がタイトルと重ならないようにしたり、セクション番号とタイトルの間のスペースを狭めたりするために、他の調整が必要になる場合があります。調整は次のようになります。

\renewcommand\cftchapnumwidth{2.8em}
\renewcommand\cftsecnumwidth{2em}
\renewcommand\cftsecindent{3em}
\renewcommand\cftsubsecindent{5em}

関連情報