Document ClassesTable of Contents

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
yago
Posts: 29
Joined: Sat Dec 13, 2008 6:40 pm

Table of Contents

Post by yago »

In order to clear the question that I posted past 13th december, I send you an example in the attached file. Thanks.
Attachments
index_scan.jpg
index_scan.jpg (95.69 KiB) Viewed 2987 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Keta
Posts: 63
Joined: Tue Nov 25, 2008 1:00 pm

Table of Contents

Post by Keta »

I tried to format the toc as you show with the titlesec and titletoc packages, and got a quite similar look. I did not get, though, the " mark instead of "Lección" for the second and subsequent entries. I only formatted how the table of contents look, not the sections (well, I had to format the Chapter a little bit since the title of the toc is typeset as a chapter title).

I'm not a very experienced user, so I'm pretty sure some others might provide better solutions. Anyway, in case you find it helpful, here is the code:

Code: Select all

\documentclass[a4paper,10pt]{report}

% Encoding and language
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenx}
\usepackage[spanish]{babel}

% The following prevents section numbers from
% being restarted after every chapter
\usepackage{remreset}
\makeatletter \@removefromreset{section}{chapter} \makeatother

% Changing chapter and section numerals
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{section}}

% Change "Índice general" to "Índice"
\addto\captionsspanish{
	\renewcommand\contentsname{Índice}}

% Section and toc formatting
\usepackage{titlesec,titletoc}

% Chapter formatting
\titleformat{\chapter}%
	[block]%
	{\begin{center}\Large}%
	{\MakeUppercase{\chaptertitlename} \thechapter\ --}%
	{5pt}%
	{\MakeUppercase}%
	[\rule{2cm}{.8pt}\end{center}]

% TOC chapter formatting
\titlecontents{chapter}%
	[0pt]%
	{\begin{center}}%
	{{\scshape \chaptertitlename} \thecontentslabel.---\itshape}%
	{}%
	{}%
	[\end{center}]

% TOC section formatting
\titlecontents{section}%
	[0pt]%
	{}%
	{Lección \thecontentslabel.ª---}%
	{\scshape}%
	{\titlerule*[1pc]{...}\contentspage}%
	[]

\begin{document}
 
\tableofcontents

\clearpage
\addcontentsline{toc}{section}{Introducción}
\chapter*{Introducción}

\chapter{Enlace, ordenación y sentido en el plano}
\section{Las relaciones de incidencia}
\section{Las relaciones de orden y separación}
\section{El sentido en el plano}

\chapter{Congruencia y paralelismo en el plano}
\section{Movimiento y congruencia}
\section{Simetrías y perpendicularidad en el plano}
\section{Las traslaciones y el paralelismo}
\section{La circunferencia}
 
\end{document}
yago
Posts: 29
Joined: Sat Dec 13, 2008 6:40 pm

Table of Contents

Post by yago »

Thanks to keta for his help about my TOC problem in his message of 29th december. The state of my "investigation" is in teh attached file where, as you can see, I have a problem with the typeset of a large "part" title (in reality, in my document, the \part is renamed to "Capítulo", and \chapter is renamed to "Lección") that's extends out of the rightmargin of the TOC. The code for the TOC structure is this one:

Code: Select all

\usepackage{titletoc,titlesec}

\addto\captionsspanish{\renewcommand{\contentsname}{\bfseries\rm\Huge{\'Indice}}}
\addto\captionsspanish{\renewcommand{\partname}{Cap\'itulo}}
\addto\captionsspanish{\renewcommand{\chaptername}{Lecci\'on}}

\titleformat{\chapter}[block] 
{\filcenter\bfseries\Large\scshape} 
{\bfseries\Large\scshape{\chaptertitlename} \bfseries\Large\scshape{\thechapter}\bfseries\Large{\rm\textordfeminine.---}}
{1ex} 
{}

\titlecontents{part}[1em]{\addvspace{2pc}\Large\scshape\bfseries{Cap\'itulo}\hspace{.5em}}{\Large\itshape\thecontentslabel\\*[.2pc]}{\contentsmargin{0pt}\Large}{\hfill\Large\contentspage}
[\begin{center}\addvspace{-1pc}\rule{0.2\linewidth}{1pt}\end{center}]

\titlecontents{chapter}[56pt]{\addvspace{1pc}\scshape}{\contentsmargin{5pt}
\bfseries\makebox[0pt][r]{\large\scshape{Lecci\'on}\hspace{.3pc}\large\thecontentslabel{.}\enspace}\large}
{\contentsmargin{0pt}\large}{\titlerule*[0.5pc]{.}\large\bfseries\contentspage}[\addvspace{-1.5pc}]
The keta code to typeset Introducción* in the TOC is not here, but I expect to put it in the final code. Thanks for your help.
Attachments
Indice_070109.jpg
Indice_070109.jpg (57.26 KiB) Viewed 2874 times
Post Reply