Índice de contenidos: no hay número de capítulo en la etiqueta de la sección

Índice de contenidos: no hay número de capítulo en la etiqueta de la sección

Mi tabla de contenido se ve así:

 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

¿Cómo puedo hacer que se vea así?

 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}

Respuesta1

Esto es lo que necesita.

  • \renewcommand{\thesection}{\arabic{section}}
  • \titleformat{\section} {\normalfont\Large\bfseries}{\thechapter.\thesection}{1em}{}para títulos
  • \renewcommand{\p@section}{\thechapter.}para referencias cruzadas.

Por supuesto, es necesario ajustar el espaciado en las entradas de TOC.

Ejemplo

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

Respuesta2

Puede que no sea la mejor y más fácil respuesta... Redefiní las secciones para mostrar un edry diferente al toc y tener una apariencia diferente en el cuerpo:

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

Puedes hacer lo que quieras dentro de tus nuevas secciones en el comando def. Acabo de hacer la opción original sin estrella sin toc para tener una opción de toc.

Resultado en contenidos:

ingrese la descripción de la imagen aquí

Y en cuerpo:

ingrese la descripción de la imagen aquí

información relacionada