コンテンツのタイトルをセクションのタイトルと同じ形式にする

コンテンツのタイトルをセクションのタイトルと同じ形式にする

\tableofcontents次のコマンドを使用してフォーマットした通常のセクション タイトルと同じようにセクション タイトルを見せるにはどうすればよいですかtitlesec

\titleformat{\section}{\Large\scshape}{\thesection. }{}{}
\titlespacing*{\section}{0pt}{1em}{0.4em}

最初の行では主にセクション タイトルに小文字の大文字を使用し、2 行目ではその周囲の間隔を設定します。

したがって、セクションのタイトルは次のようになります。

正しくフォーマットされたタイトル

同じことが目次でも起きるようにしたいと思います。現在の目次は次のようになっています。

私が望むような見た目でラベル付けされた、LaTeXで書かれた通常のフォーマットの目次

最小限の動作例:

\documentclass{article}

\usepackage{titlesec}

% format section title
\titleformat{\section}{\Large\scshape}{\thesection. }{}{}

% set section titles spacing
\titlespacing*{\section}{0pt}{1em}{0.4em}

% also format subsection title
\titleformat{\subsection}{\scshape}{\thesubsection. }{}{} 

\begin{document}

\tableofcontents

\section{One}
\subsection{SubOne}
\subsection{SubTwo}
\section{Two}
\section{Three}

\end{document}

どのような助けでも大歓迎です。ありがとうございます!

答え1

目次の書式は、titletoc、の仲間titlesec

\documentclass{article}

\usepackage{titlesec}
\usepackage{titletoc}

% format section title
\titleformat{\section}{\Large\scshape}{\thesection.}{.5em}{}
% set section titles spacing
\titlespacing*{\section}{0pt}{1em}{0.4em}
% set section titles in TOC
\titlecontents{section}[1.5em]{\scshape}{\contentslabel{1.5em}}{}{}

% also format subsection title
\titleformat{\subsection}{\scshape}{\thesubsection.}{.5em}{}
% format subsection titles in TOC
\dottedcontents{subsection}[3.8em]{\scshape}{2.3em}{.6pc}

\begin{document}

\tableofcontents

\section{One}
\subsection{SubOne}
\subsection{SubTwo}
\section{Two}
\section{Three}

\end{document}

関連情報