Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

First of all I am sorry for my not minimum WE. I will explain why it's not... I am creating a ToC in a book-class document. ToC starts at page iii(I am using roman numbering) and ends at iv. The ToC entry though indicates that ToC starts at iv.

Another issue is that before ToC there two blank pages(i,ii) but I don't know how to make them dissapear.

The last issue has to do with LoT. Despite including LoT before arabic page numbering, LoT starts on page 1. I tried \setcounter{page}{xi} but it is indicated that there is a number missing.

How can I resolve those issues. Here comes my WE(despite 8 errors pdf is produced). The reason why it's not MWE is that I wanted to add chapters and section in order to create a two page ToC.

\documentclass[11pt,a4paper]{book}
\usepackage{kerkis}
\usepackage{units}
\usepackage[pdftex]{graphicx}
\usepackage[Glenn]{fncychap}
\usepackage{float}
\usepackage{xcolor}

\usepackage{tocloft}
\setlength\cftparskip{0pt}
\setlength\cftbeforesecskip{-5pt}
\setlength\cftbeforesubsecskip{-8pt}
\setlength\cftbeforechapskip{-1pt}
\setlength\cftaftertoctitleskip{-50pt}
 \setlength\cftbeforefigskip{-5pt}
\setlength\cftbeforetabskip{-5pt}
\makeatletter
\newcommand*{\tocwithouttitle}{\@starttoc{toc}}
\makeatother
%--------------------------------------------------------------------------------
\makeatletter
\newcommand*{\lofwithouttitle}{\@starttoc{lof}}
\makeatother
%--------------------------------------------------------------------------------
\makeatletter
\newcommand*{\lotwithouttitle}{\@starttoc{lot}}
\makeatother
%--------------------------------------------------------------------------------
%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}

\newcommand{\HRule}{\rule{\linewidth}{0.8mm}}

\begin{document}
\begin{titlepage}
\begin{figure}[H]
 \begin{center}
 \includegraphics[scale=0.2]{logo.jpg}
 \end{center}
 \end{figure}
 \begin {center}
 \large
{University\\Faculty\\Department\\Group}\\
\vspace{2cm}
\HRule\\ \vspace{0.7cm} \textbf{\LARGE Title}\\ \vspace{0.7cm}\HRule
\vspace{2cm}
{\La rge Author}\\ \vspace{2cm}
supervision\\
\vspace{2cm}
{\Large Prof\\
\Large Supervisor}\\ \vspace{4cm}
Month Year
\end{center}

\newpage
\thispagestyle{empty}
\mbox{}
\end{titlepage}

\pagenumbering{roman}

\textcolor{blue}{\chapter*{\contentsname}}
\markboth{\MakeUppercase{\contentsname}}{\MakeUppercase{\contentsname}}
\textcolor{blue}{\tocwithouttitle}
\addcontentsline{toc}{chapter}{Contents}

\textcolor{blue}{\chapter*{Abstract}}
\addcontentsline{toc}{chapter}{Abstract}
\markboth{\MakeUppercase{Abstract}}{\MakeUppercase{Abstract}}

This is the abstract

\textcolor{blue}{\chapter*{Aknowledgements}}
\addcontentsline{toc}{chapter}{Aknowledgements}
\markboth{\MakeUppercase{Aknowledgements}}{\MakeUppercase{Aknowledgements}}

These are aknowledgements

\textcolor{blue}{\chapter*{LoF}}
\markboth{\MakeUppercase{LoF}}{\MakeUppercase{LoF}}
\textcolor{blue}{\lofwithouttitle}
\addcontentsline{toc}{chapter}{LoF}

 \textcolor{blue}{\chapter*{LoT}}
\markboth{\MakeUppercase{LoT}}{\MakeUppercase{LoT}}
\textcolor{blue}{\lotwithouttitle}
%\setcounter{page}{xi}<----Error missing number/seems it doesn't accept roman like that
\addcontentsline{toc}{chapter}{LoT}

\pagenumbering{arabic}

\chapter{Introduction}

This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introductionThis is the introductionThis is the introductionThis is the introductionThis is the introductionThis is the introductionThis is the introductionThis is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.v.This is the introduction.This is the introductionThis is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the introduction.This is the     introduction.This is the introduction.This is the introduction.This is the introduction.

\newpage
\section{Intro}
bla bla bla\\
\section{Intro}
bla bla bla\\
\section{Intro}
bla  bla bla\\
\section{Intro}
bla bla bla\\
\subsection{intro}
bla bla bla\\

\newpage
\section{Intro}
bla bla bla\\
\section{Intro}
bla bla bla\\
\section{Intro}
 bla bla bla\\
\section{Intro}
bla bla bla\\
\subsection{intro}
bla bla bla\\

\newpage
\section{Intro}
 bla bla bla\\
\section{Intro}
bla bla bla\\
\section{Intro}
bla bla bla\\
 \section{Intro}
bla bla bla\\
\subsection{intro}
bla bla bla\\

 \newpage
\section{Intro}
bla bla bla\\
\section{Intro}
bla bla bla\\
\section{Intro}
bla bla bla\\
\section{Intro}
bla bla bla\\
\subsection{intro}
bla bla bla\\

\chapter{Theory}
This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.This is about theory.

 \newpage
\section{Theo}
bla bla bla\\
\section{Theo}
bla bla bla\\
\section{Theo}
 bla bla bla\\
 \section{Theo}
 bla bla bla\\
 \subsection{theo}
 bla bla bla\\

\newpage
\section{Theo}
 bla bla bla\\
\section{Theo}
bla bla bla\\
\section{Theo}
bla bla bla\\
\section{Theo}
bla bla bla\\
\subsection{theo}
 bla bla bla\\

\newpage
\section{Theo}
bla bla bla\\
\section{Theo}
bla bla bla\\
\section{Theo}
bla bla bla\\
\section{Theo}
bla bla bla\\
\subsection{theo}
bla bla bla\\

\newpage
\section{Theo}
bla bla bla\\
\section{Theo}
bla bla bla\\
\section{Theo}
bla  bla bla\\
\se ction{Theo}
bla bla bla\\
\subsection{theo}
bla  bla bla\\

\chapter{Experiment}
This is about epxeriment.This is about epxeriment.This is about epxeriment.This is about  epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This  is about epxeriment.This is about epxeriment.This is about epxeriment.This is about  epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This  is about epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This  is about epxeriment.This is about epxeriment.This is about epxeriment.This is about  epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This  is about epxeriment.This is about epxeriment.This is about epxeriment.This is about  epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This  is about epxeriment.This is about epxeriment.This is about epxeriment.This is about  epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This  is about epxeriment.This is about epxeriment.This is about epxeriment.This is about  epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This  is about epxeriment.This is about epxeriment.This is about epxeriment.This is about  epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This    is about epxeriment.This is about epxeriment.This is about epxeriment.This is about     epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This     is about epxeriment.This is about epxeriment.This is about epxeriment.This is about     epxeriment.This is about epxeriment.This is about epxeriment.This is about epxeriment.This    is about epxeriment.This is about epxeriment.This is about epxeriment.This is about     epxeriment.

\newpage
\section{Exp}
bla bla bla\\
\section{Exp}
bla bla bla\\
\section{Exp}
bla bla bla\\
\section{Exp}
bla bla bla\\
\subsection{exp}
bla bla bla\\

\newpage
\section{Exp}
bla bla bla\\
\section{Exp}
bla bla bla\\
\section{Exp}
bla bla bla\\
\section{Exp}
bla bla bla\\
\subsection{exp}
bla bla bla\\

\newpage
\section{Exp}
bla bla bla\\
\section{Exp}
bla bla bla\\
\section{Exp}
bla bla bla\\
\section{Exp}
bla bla bla\\
\subsection{exp}
bla bla bla\\

\newpage
\section{Exp}
bla bla bla\\
\section{Exp}
bla bla bla\\
\section{Exp}
bla bla bla\\
\section{Exp}
bla bla bla\\
\subsection{exp}
 bla bla bla\\

\end{document}

My real ToC, with better spacing is that

share|improve this question
    
where is the sense of having the TOC in the TOC? I suppose that nobody will have a look into the TOC where he can find the TOC ... ;-) –  Herbert Nov 10 '12 at 16:17
    
Is your purpose to write the frontmatter pages in blue? –  egreg Nov 10 '12 at 16:17
    
@Herbert:Thank you for your answer! You are right about that but I want my theses to be perfect! –  Thanos Nov 10 '12 at 16:24
    
@egreg:Thank you very much for your comment! Yes that's true!But it doesn't matter! –  Thanos Nov 10 '12 at 16:25
1  
@Thanos: If you want it perfect then do not use such an entry in the TOC –  Herbert Nov 10 '12 at 16:32

1 Answer 1

up vote 3 down vote accepted

I can't understand some things: (1) why putting the table of contents in the table of contents; (2) why trying to squeeze the table of contents in such a horrible way; (3) why using a different color for the front matter.

However, here's a way that makes also your input way easier.

\documentclass[11pt,a4paper]{book}
\usepackage{kerkis}
\usepackage{units}
\usepackage{graphicx}
\usepackage[Glenn]{fncychap}
\usepackage{xcolor}

\usepackage{tocloft}
\setlength\cftparskip{0pt}
\setlength\cftaftertoctitleskip{-50pt}

% VALUES BELOW ARE QUESTIONABLE
%\setlength\cftbeforesecskip{-5pt}
%\setlength\cftbeforesubsecskip{-8pt}
%\setlength\cftbeforechapskip{-1pt}
% \setlength\cftbeforefigskip{-5pt}
%\setlength\cftbeforetabskip{-5pt}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
\fancyhf{}
\fancyhead[RE]{\slshape\color{\currentprintcolor}%
  \ifnum\value{chapter}>0 \MakeUppercase{\chaptername} \thechapter. \fi\leftmark}
\fancyhead[LO]{\slshape\color{\currentprintcolor}\rightmark}
\fancyhead[RO,LE]{\color{\currentprintcolor}\thepage}
\fancypagestyle{plain}{
  \renewcommand{\headrulewidth}{0pt}
  \fancyhf{}\fancyfoot[C]{\color{\currentprintcolor}\thepage}
}
\setlength{\headheight}{13.5pt}

\newcommand{\currentprintcolor}{black}
\newenvironment{printinblue}
  {\cleardoublepage\renewcommand{\currentprintcolor}{blue}\color{blue}}
  {\cleardoublepage}

\makeatletter
\newcommand*{\withouttitle}[1]{\@starttoc{#1}}
\makeatother
%--------------------------------------------------------------------------------
%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}

\newcommand{\HRule}{\rule{\linewidth}{0.8mm}}

\begin{document}

\frontmatter

\begin{titlepage}
 \begin{center}
 \includegraphics[scale=0.2]{logo.jpg}
 \end{center}
 \begin {center}
 \large
{University\\Faculty\\Department\\Group}\\
\vspace{2cm}
\HRule\\ \vspace{0.7cm} \textbf{\LARGE Title}\\ \vspace{0.7cm}\HRule
\vspace{2cm}
{\Large Author}\\ \vspace{2cm}
supervision\\
\vspace{2cm}
{\Large Prof\\
\Large Supervisor}\\ \vspace{4cm}
Month Year
\end{center}
\end{titlepage}


\begin{printinblue}

\chapter{\contentsname}
\withouttitle{toc}

\chapter{Abstract}

This is the abstract

\chapter{Acknowledgements}

These are acknowledgements

\chapter{\listfigurename}
\withouttitle{lof}

\chapter{\listtablename}
\withouttitle{lot}

\end{printinblue}

\mainmatter

\chapter{Introduction}

...    

\end{document}

If you could remove the "Glenn" chapter style I would be happier.


Many things went wrong with your input. First of all, the page numbers: if you put \addcontentsline at the end of the list (after your \tocwithouttitle, to be precise), the referenced page is the last one.

Your usage of \textcolor is wrong: \textcolor{blue}{\tocwithouttitle} gives scores of errors, because LaTeX tries to typeset the table of contents in a horizontal box: just like \mbox{\tableofcontents} that can't work.

So the best way is to change the text color for the duration of the front matter, which I do with the printinblue environment. It's also necessary to modify the way headers and footers are typeset, so I load fancyhdr and do the necessary setting for getting the same output as with the standard book class setup.

Using \frontmatter frees you from manually inserting the marks and the references for the table of contents. Moreover it sets the page numbering to roman numerals automatically; with \mainmatter you select arabic numerals for the page numbers.

share|improve this answer
    
Thank you very much for your answer! Your code is working for my WE, but I cannot get it to work with my thesis. ToC, LoF, LoT are blank. I will try a bit more. There is one issue though... Your blue enviroment is awesome!!! Lastly, you don't like Glenn, right?:) –  Thanos Nov 10 '12 at 18:22
    
I got it work-almost... ToC, LoF and LoT are printed but after LoT there are 2 blank pages(1,2 with uppercase:"Table of Contents") which means that the first chapter starts at page 3... –  Thanos Nov 10 '12 at 19:04
    
@Thanos You probably have some dangling \cleardoublepage. Difficult to tell. And no, I won't be looking at the several megabytes of your thesis, sorry. :) –  egreg Nov 10 '12 at 19:07
    
There isn't any \cleardoublepage. It crosses my mind that the nasty work is being done by "subfiles". I thought of adding a \clearemptydoublepage-like command in order to replace \cleardoublepage using \let\cleardoublepage\clearemptydoublepage but if I use it in my preable, it's applied on all chapters(I thought so) but if I apply it locally on the subfile it is again changed everywhere. I will try a bit more!Oh, btw I never recall asking you to check my thesis ;) Ciao amico mio! –  Thanos Nov 11 '12 at 8:33
    
It is really subfiles that is doing the nasty work... I used your code in a different way. I made chapter one a new .tex and I "subfiled" it in main. These two pages are left blank. I will try to see what's going on in subfiles.cls... –  Thanos Nov 11 '12 at 9:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.