
Eu tenho o seguinte código:
\documentclass[a4paper,11pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{titlesec}
\usepackage{etoc}
\renewcommand{\thechapter}{\scshape\roman{chapter}}
\renewcommand\thesection{\arabic{section}}
\titleformat{\chapter}[display]
{\normalfont\fontsize{11}{12}\selectfont}
{\scshape\thechapter}
{0pt}
{}
\titleformat{\section}
{\normalfont\fontsize{11}{12}\selectfont}
{\thesection}
{1em}
{}
\titleformat{\subsection}
{\normalfont\fontsize{11}{12}\selectfont\itshape}
{}
{1em}
{}
\titlespacing{\chapter}
{0pt}{0pt}{3cm}
\etocsetstyle{chapter}
{}
{\leavevmode\leftskip 0cm\relax}
{\llap{\parbox[t]{1.5cm}{\mdseries\hfill\etocpage}\hspace{.5cm}}%
\normalsize\parbox[t]{1cm}{\quad\etocnumber\hfill}%
\parbox[t]{\dimexpr\linewidth-1cm-15pt\relax}{\etocname\par}\hfill\par
}
{}
\etocsetstyle{section}
{}
{\leavevmode\leftskip 0cm\relax}
{\llap{\parbox[t]{1.5cm}{\mdseries\hfill\etocpage}\hspace{.5cm}}%
\normalsize\parbox[t]{1cm}{\quad\etocnumber.\hfill}%
\parbox[t]{\dimexpr\linewidth-1cm-15pt\relax}{\etocname\par}\hfill\par
}
{}
\begin{document}
\tableofcontents
\chapter{Chapter One}
\section{Section One}
\section{Section Two}
\section{Section Three}
\section{Section Four}
\chapter{Chapter Two}
\section{Section One}
\section{Section Two}
\section{Section Three}
\section{Section Four}
\section{Section Five}
\chapter{Chapter Three}
\section{Section One}
\section{Section Two}
\section{Section Three}
\end{document}
No entanto, gostaria de fazer duas alterações:
1) números de página e número de capítulo/seção alinhados à direita e não alinhados à esquerda como no código atual
2) um pouco vspace
antes de cada linha de capítulo do Índice.
Como é possível produzir esses resultados? Sempre em código etoc? Obrigado
ADENDO O resultado que eu gostaria de ter é como na foto a seguir:
Responder1
As modificações
\etocsetstyle{chapter}
{}
{\addvspace{2ex}\leavevmode\leftskip 0cm\relax}
{\llap{\makebox[1.5cm][r]{\mdseries\etocpage}\hspace{.5cm}}%
\normalsize\makebox[1cm][r]{\etocnumber\phantom{.}}\hspace{10pt}%
\parbox[t]{\dimexpr\linewidth-1cm-27pt\relax}{\etocname\par}\hfill\par
}
{}
\etocsetstyle{section}
{}
{\leavevmode\leftskip 0cm\relax}
{\llap{\makebox[1.5cm][r]{\mdseries\etocpage}\hspace{.5cm}}%
\normalsize\makebox[1cm][r]{\etocnumber.}\hspace{10pt}%
\parbox[t]{\dimexpr\linewidth-1cm-27pt\relax}{\etocname\par}\hfill\par
}
{}
Basicamente, mudei \parbox
es para \makebox
es com r
(alinhamento à direita) e adicionei um salto vertical conveniente ( 2ex
, no meu exemplo, mas use qualquer valor para atender às suas necessidades) no terceiro argumento obrigatório para \etocsetstyle
capítulos.
O código completo:
\documentclass[a4paper,11pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{titlesec}
\usepackage{etoc}
\renewcommand{\thechapter}{\scshape\roman{chapter}}
\renewcommand\thesection{\arabic{section}}
\titleformat{\chapter}[display]
{\normalfont\fontsize{11}{12}\selectfont}
{\scshape\thechapter}
{0pt}
{}
\titleformat{\section}
{\normalfont\fontsize{11}{12}\selectfont}
{\thesection}
{1em}
{}
\titleformat{\subsection}
{\normalfont\fontsize{11}{12}\selectfont\itshape}
{}
{1em}
{}
\titlespacing{\chapter}
{0pt}{0pt}{3cm}
\etocsetstyle{chapter}
{}
{\addvspace{2ex}\leavevmode\leftskip 0cm\relax}
{\llap{\makebox[1.5cm][r]{\mdseries\etocpage}\hspace{.5cm}}%
\normalsize\makebox[1cm][r]{\etocnumber\phantom{.}}\hspace{10pt}%
\parbox[t]{\dimexpr\linewidth-1cm-27pt\relax}{\etocname\par}\hfill\par
}
{}
\etocsetstyle{section}
{}
{\leavevmode\leftskip 0cm\relax}
{\llap{\makebox[1.5cm][r]{\mdseries\etocpage}\hspace{.5cm}}%
\normalsize\makebox[1cm][r]{\etocnumber.}\hspace{10pt}%
\parbox[t]{\dimexpr\linewidth-1cm-27pt\relax}{\etocname\par}\hfill\par
}
{}
\begin{document}
\tableofcontents
\chapter{Chapter One}
\section{Section One}
\section{Section Two}
\section{Section Three}
\section{Section Four}
\chapter{Chapter Two}
\section{Section One}
\section{Section Two}
\section{Section Three}
\section{Section Four}
\section{Section Five}
\setcounter{page}{99}% just for the example
\chapter{Chapter Three}
\section{Section One}
\section{Section Two}
\section{Section Three}
\end{document}
O resultado: