2

I use pdflatex (TeX Live 2013). I try to make a book that contains 27 parts. It's in Russian. Only the last part has \section and \subsection. Also I need to have the title of the book on top page header in the odd pages and the name of books parts on top page header in the even pages. For compiling \tableofcontents* (without numbers, only parts names) I tried to use this solution. But it doesn't work fine in my case. The first page turns out to be blank page and numbered with '1', and the table of contents overlaps the bottom margin on the second page. Also it doesn't continue on the third page. It's just "gone".

theres is a screenshot.

I used this code:

\documentclass[a4paper,twoside]{memoir}
\usepackage{tocloft}
\usepackage{tocvsec2}

\begin{document}

 \setsecnumdepth{none}
 \addtocontents{toc}{\protect\renewcommand{\protect\cftpartpresnum}{}}

   \tableofcontents*

\part*{Name of the part 1}
\addcontentsline{toc}{part}{Name of the part 1}
\markboth{Name of book}{Name of the part}

\part*{Name of the part 2}
\addcontentsline{toc}{part}{Name of the part 2}
\markboth{Name of book}{Name of the part}
 %-----------
\part*{Name of the part 27}
\addcontentsline{toc}{part}{Name of the part 27}
\markboth{Name of book}{Name of the part}
\section{Name of Section}
\subsection{Name of Subsection}

\end{document}

What am I doing wrong? Could somebody help me, please?

1 Answer 1

3

I don't know if this will work for your use-case:

\documentclass[a4paper,twoside]{memoir}
\usepackage{tocloft}
\usepackage{tocvsec2}
\usepackage{etoolbox}
\makeatletter
\apptocmd\l@part{\null\kern-\baselineskip}{}{}
\makeatother

\begin{document}

 \setsecnumdepth{none}
 \addtocontents{toc}{\protect\renewcommand{\protect\cftpartpresnum}{}}

   \tableofcontents*

\part*{Name of the part 1}
\addcontentsline{toc}{part}{Name of the part 1}
\markboth{Name of book}{Name of the part}

\part*{Name of the part 2}
\addcontentsline{toc}{part}{Name of the part 2}
\markboth{Name of book}{Name of the part}

\newcount\partcnt
\partcnt 3

\loop
\part*{Name of the part \the\partcnt }
\addcontentsline{toc}{part}{Name of the part \the\partcnt}
\markboth{Name of book}{Name of the part}
\ifnum\partcnt<26
\advance\partcnt 1
\repeat

\part*{Name of the part 27}
\addcontentsline{toc}{part}{Name of the part 27}
\markboth{Name of book}{Name of the part}
\section{Name of Section}
\subsection{Name of Subsection}

\end{document}

tocofparts tocofparts2

4
  • 1
    the reason the page numbers are weird on first page is that this is a picture coming from a version of the code where I had erroneously \section and \subsection also in Parts 3-26.
    – user4686
    Nov 15, 2013 at 20:58
  • It's briliant. Thank you very much. I just have to make line break for long parts' name. But I saw this topic on this forum. I will find it. Thank you once more.
    – filokalos
    Nov 15, 2013 at 22:44
  • Hope one day I will learn LaTex very good. :)))
    – filokalos
    Nov 15, 2013 at 22:46
  • 1
    @filokalos I should have explained that this is a problem arising when LaTeX has only headings and nothing else to typeset, it simply does not obey pagebreaks. You can reproduce this by just repeating many times \section{A section} with only white space in-between. Inserting a \null creates in this context an empty line which gives to TeX a legal break point, the \kern-\baselineskip compensates for the added vertical space created by the empty line. As for learning very good LaTeX, all my encouragements! :)
    – user4686
    Nov 15, 2013 at 23:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .