Page Layout ⇒ Table of Contents enhanced ? First the chapters listing
Table of Contents enhanced ? First the chapters listing
I wonder if it is possible to have a more advanced table of content listing. Right now, what I have is Contents followed by
chapter 1, followed by all sections in chapter 1.
After that Chapter 2, followed by all sections in chapter2 , and
so on.
Since I like to use hyperref to help me to navigate through the book, so I think if I can have a listing of all chapters, WITHOUT the sections, and then when I click on a link to particular chapter, I will get to the place where all sections under that chapter are listed. This way, I could very quickly get to a section very quickly without skipping all irrelevant chapters and those accompanied sections.
This is a very nice feature, can we enable it ?
Thanks !
chapter 1, followed by all sections in chapter 1.
After that Chapter 2, followed by all sections in chapter2 , and
so on.
Since I like to use hyperref to help me to navigate through the book, so I think if I can have a listing of all chapters, WITHOUT the sections, and then when I click on a link to particular chapter, I will get to the place where all sections under that chapter are listed. This way, I could very quickly get to a section very quickly without skipping all irrelevant chapters and those accompanied sections.
This is a very nice feature, can we enable it ?
Thanks !
NEW: TikZ book now 40% off at Amazon.com for a short time.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Table of Contents enhanced ? First the chapters listing
Take a look at the titletoc manual (Section 7.3 - Partial ToCs). Pay special attention to the examples in the appendix. For the main ToC set the tocdepth counter to Zero in order to show only chapters.
Best regards
Thorsten
Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Table of Contents enhanced ? First the chapters listing
found it extremely hard to understand the manual.
in one try, but then later on I got error messages.
I got some gibberish CChapter1,Chapter2,Chapter3,...\usepackage{titlesec}
\usepackage{titletoc}
\include{common-places}
\include{abbrev}
\begin{document}
\startcontents[chapters]
\printcontents[chapters]
\stopcontents[chapters]
%\startcontents[parts]
%\printcontents[parts]
%\stopcontents[parts]
\tableofcontents
in one try, but then later on I got error messages.
! Missing \endcsname inserted.
<to be read again>
\let
l.2 \contentsline {chapter}
{\numberline {1}Some very basic graphics topics}{
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Table of Contents enhanced ? First the chapters listing
Please always post full examples instead of useless code snippets. See the code below for a first basic approach.
Code: Select all
\documentclass[11pt,a4paper,english]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[raggedright]{titlesec}
\usepackage{titletoc}
\usepackage[math]{blindtext}
\usepackage[linktocpage]{hyperref}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
[\vspace*{2pc} \normalfont\normalsize \startcontents \printcontents{l}{1}{}]
\begin{document}
\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
\addtocontents{ptc}{\protect\setcounter{tocdepth}{2}}
\tableofcontents
\chapter{First Chapter}\label{chp:one}
\blindtext
\section{First Section}\label{sec:oneone}
\blindtext
\section{Second Section}\label{sec:onetwo}
\blindtext
\chapter{Second Chapter}\label{chp:two}
\blindtext
\section{First Section}\label{sec:twoone}
\blindtext
\section{Second Section}\label{sec:twotwo}
\blindtext
\chapter{Third Chapter}\label{chp:three}
\blindtext
\section{First Section}\label{sec:threeone}
\blindtext
\section{Second Section}\label{sec:threetwo}
\blindtext
\end{document}
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Table of Contents enhanced ? First the chapters listing
Serious I am so happy that one of the questions that always pops into my head is answered by your example file above. I really appreciate your help ! Million thanks! I save some time in nagivating between pages of my research notes because of you!
Re: Table of Contents enhanced ? First the chapters listing
Is it possible to enable the words in the table of content to be
underlined so that when I click on it, it will go to correct page?
Right now, I have to click on the page numbers at the right end of each entry to go a particular page.
I am hoping that I can click on any words within a line to nagivate, i.e., I have more "areas" to choose. Thanks.
The same issue happens in the main TOC and the toc for each individual chapter.
underlined so that when I click on it, it will go to correct page?
Right now, I have to click on the page numbers at the right end of each entry to go a particular page.
I am hoping that I can click on any words within a line to nagivate, i.e., I have more "areas" to choose. Thanks.
The same issue happens in the main TOC and the toc for each individual chapter.
Table of Contents enhanced ? First the chapters listing
Hi,
remove the option linktocpage from the list of options for the hyperref package; i.e., instead of
use something like
remove the option linktocpage from the list of options for the hyperref package; i.e., instead of
Code: Select all
\usepackage[linktocpage]{hyperref}
Code: Select all
\usepackage{hyperref}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Table of Contents enhanced ? First the chapters listing
For good measure you should enable line breaks for list entries (ToC, LoF, LoT) that occupy more than one line.
Best regards
Thorsten
Code: Select all
\usepackage[breaklinks=true]{hyperref}
Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Table of Contents enhanced ? First the chapters listing
What a lucky day for me. It works. Thanks Thorsten and gmedina!!