섹션 제목과 동일한 내용 제목 형식 지정

섹션 제목과 동일한 내용 제목 형식 지정

\tableofcontents다음 명령을 사용하여 섹션 제목을 일반 섹션 제목과 동일하게 만들려면 어떻게 해야 합니까 titlesec?

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

첫 번째 줄은 기본적으로 섹션 제목에 작은 대문자를 사용하도록 하고, 두 번째 줄은 섹션 제목 주위의 간격을 설정합니다.

따라서 섹션 제목은 이후 다음과 같습니다.

올바른 형식의 제목

내 목차에도 같은 일이 일어나기를 원합니다. 현재는 다음과 같습니다.

내가 선호하는 방식으로 라벨이 붙은 규칙적인 형식의 라텍스 목차

최소한의 작업 예:

\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}

관련 정보