목차: 섹션 레이블에 장 번호가 없습니다.

목차: 섹션 레이블에 장 번호가 없습니다.

내 목차는 다음과 같습니다.

 I        Chapter I
 I.1      Section I.1
 I.2      Section I.2

 II       Chapter II
 II.1     Section II.1
 II.2     Section II.2

어떻게 하면 다음과 같이 만들 수 있나요?

 I        Chapter I
 1        Section I.1
 2        Section I.2

 II       Chapter II
 1        Section II.1
 2        Section II.2

?

MWE:

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{titletoc}

\titleclass{\part}{top}
\titleformat{\part}[display]
{\centering\normalfont}
{\itshape \partname~\thepart}{1.0em}
{\bfseries\MakeUppercase}
\titlespacing*{\part}{0pt}{0pt}{20pt}

\renewcommand{\thechapter}{\Roman{chapter}}

\dottedcontents{chapter}[3.0em]{\scshape\bfseries\vspace{1.0em}}{2.5em}{0pc}
\dottedcontents{section}[3.0em]{}{3.5em}{0.75pc}

\begin{document}

\startcontents[parts]
\part{Part I}

\printcontents[parts]{}{0}{}

\chapter{Chapter I}
\section{Section I.1}
\section{Section I.2}

\chapter{Chapter II}
\section{Section II.1}
\section{Section II.2}

\stopcontents[parts]

\end{document}

답변1

여기에 필요한 것이 있습니다.

  • \renewcommand{\thesection}{\arabic{section}}
  • \titleformat{\section} {\normalfont\Large\bfseries}{\thechapter.\thesection}{1em}{}제목의 경우
  • \renewcommand{\p@section}{\thechapter.}상호 참조용.

물론 TOC 항목의 간격을 조정해야 합니다.

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{titletoc}

\titleclass{\part}{top}
\titleformat{\part}[display]
{\centering\normalfont}
{\itshape \partname~\thepart}{1.0em}
{\bfseries\MakeUppercase}
\titlespacing*{\part}{0pt}{0pt}{20pt}

\renewcommand{\thechapter}{\Roman{chapter}}

\titleformat{\section}
{\normalfont\Large\bfseries}{\thechapter.\thesection}{1em}{}
\renewcommand{\thesection}{\arabic{section}}
\makeatletter 
\renewcommand{\p@section}{\thechapter.}
\makeatother

\dottedcontents{chapter}[3.0em]{\scshape\bfseries\vspace{1.0em}}{2.5em}{0pc}
\dottedcontents{section}[3.0em]{}{3.5em}{0.75pc}

\begin{document}

\startcontents[parts]
\part{Part I}

\printcontents[parts]{}{0}{}

\chapter{Chapter I}
\section{Section I.1}
\section{Section I.2}

\chapter{Chapter II}
\section{Section II.1}
\section{Section II.2}

\stopcontents[parts]

\end{document}

답변2

가장 좋고 쉬운 대답은 아닐 수도 있습니다... 나는 toc에 대한 edry를 표시하고 본문에 다른 모양을 갖도록 섹션을 재정의했습니다.

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{titletoc}

\titleclass{\part}{top}
\titleformat{\part}[display]
{\centering\normalfont}
{\itshape \partname~\thepart}{1.0em}
{\bfseries\MakeUppercase}
\titlespacing*{\part}{0pt}{0pt}{20pt}


\titleformat{\section}{\large\bf}{}{0pt}{}

\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{section}}
\dottedcontents{chapter}[3.0em]{\scshape\bfseries\vspace{1.0em}}{2.5em}{0pc}
\dottedcontents{section}[3.35em]{}{3.5em}{0.75pc}

\let\oldsection\section
    \makeatletter
    \def\section{%
    \@ifstar{\@Starred}{\@nonStarred}%
    }
    \def\@Starred{%
    \@ifnextchar[%
    {\GenericWarning{}{Warning: A starred section can not have parameters. I am going to ignore them!}\@StarredWith}%
    {\@StarredWithout}%
    }      
    \def\@StarredWith[#1]#2{%
    \oldsection*[\thesection]{\thechapter.\thesection\space#2}%
    }
    \def\@StarredWithout#1{
    \oldsection*{\thechapter.\thesection\space#1}%
    }
    \def\@nonStarred{%
    \@ifnextchar[%
    {\@nonStarredWith}%
    {\@nonStarredWithout}%
    }
    \def\@nonStarredWith[#1]#2{%
    \oldsection[#1]{\thechapter.\thesection\space#2}%
    }
    \def\@nonStarredWithout#1{%
    \oldsection[#1]{\thechapter.\thesection\space#1}%
    }
    \makeatother




\begin{document}

\startcontents[parts]
\part{Part I}

\printcontents[parts]{}{0}{}

\chapter{Chapter I}
\section{Section I.1}
\section{Section I.2}

\chapter{Chapter II}
\section{Section II.1}
\section{Section II.2}


\stopcontents[parts]

\end{document}

def 명령의 새 섹션 내에서 원하는 모든 작업을 수행할 수 있습니다. 방금 toc 옵션을 갖기 위해 toc 옵션 없이 별표 없는 원본을 만들었습니다.

결과 내용:

여기에 이미지 설명을 입력하세요

그리고 신체에서는:

여기에 이미지 설명을 입력하세요

관련 정보