0

I have a problem with my book. I'm studying LaTex since 3 months, so I'm not an expert. Anyway, I'm using the fncychap package but I'd like to have a different table of contents' heading. In detail, I don't know how to overcome the fncychap settings and, in particular how to reduce the distance between the table of contents and the upper headings. This is the code part that is interested in the problem.

\documentclass[12pt,a5paper]{book}\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{indentfirst}
\usepackage{quoting}
%\usepackage{geometry}
\usepackage[head=30pt,foot=10pt, height=165mm, top=2.3cm, bottom=1.8cm ]{geometry}

\usepackage{layouts}
\usepackage{verse}

%imposta il titolo dei capitoli con poco spazio dal bordo superiore
\usepackage{titlesec}
\titleformat{\chapter}[display]   
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}   
\titlespacing*{\chapter}{0pt}{-20pt}{40pt}

\usepackage[Bjornstrup]{fncychap}
%aggiusta la distanza dal bordo superiore peri titoli di 'fncychap'
\makeatletter
\patchcmd{\@makechapterhead}{\vspace*{50\p@}}{\vspace*{-20\p@}}{}{}
\patchcmd{\@makeschapterhead}{\vspace*{50\p@}}{\vspace*{-20\p@}}{}{}
\patchcmd{\DOTI}{\vskip 80\p@}{\vskip 40\p@}{}{}
\patchcmd{\DOTIS}{\vskip 40\p@}{\vskip 0\p@}{}{}
\makeatother

%gestione del formato dell'indice
\usepackage[titles]{tocloft}
%\setlength\cftaftertoctitleskip{0pt}
\setlength{\cftbeforesecskip}{0.5ex}
\renewcommand{\cftsubsecfont}{%
    \fontencoding{T1}
    %\fontfamily{garamond}
    \fontseries{m}
    \fontshape{it}
    \fontsize{11}{13}
    \selectfont
}
\begin{document}
%---crea indice 
    \clearpage\thispagestyle{empty}
\cleardoublepage
\pagenumbering{gobble}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}

    \thispagestyle{empty}

    \frontmatter
\chapter {Introduzione}
\chapter [Poesie d'amore o ai suoi confini]{\parbox{\linewidth}{\raggedleft Poesie d'amore\\
             o ai suoi confini}}
\end{document}

Problably the solution is very easy, but I really can't find it. And, regarding the code, probably something is superfluous, so if someone could also help me in understanding how to razionalize. Thank in advance.

  • Could you provide more detail regarding your request: "to overcome the fncychap settings and, in particular how to reduce the distance between the table of contents and the upper headings"? Are you referring to the distance from the bottom of the rectangular block to the first entry in the ToC? – Werner Sep 20 '16 at 18:48
  • Sorry for my abstruse question. I try to clarify. – user3754038 Sep 20 '16 at 20:00
  • I need to reduce the space between the upper header and tow how the top part of the TOC. But, first I'd like to know how to creat a different header for the TOC, taking in count that fncychap sets all headers, and using the code aboce I can't do this. – user3754038 Sep 20 '16 at 20:04
  • Well, my typewriting is awful... – user3754038 Sep 20 '16 at 20:38
  • I need to reduce the space between the upper header and the top part of the TOC. But, first I'd like to know how to create a different header for the TOC, taking in count that fncychap sets all headers, and using the code above I can't do this. Hope someone could help me. Thanks. – user3754038 Sep 20 '16 at 20:39
1

To change the heading of the table of contents, add the line

\AtBeginDocument{\renewcommand{\contentsname}{My new TOC title}}

somewhere before \begin{document}, or add the command

\renewcommand{\contentsname}{My new TOC title}

between \begin{document} and \tableofcontents.

To reduce the gap between the table of contents and its heading, add the command

\addtocontents{toc}{\vspace{-5ex}}

shortly after \begin{document} (modify the number as needed). You can also add the command to the \AddBeginDocument command above, resulting in

\AtBeginDocument
  {\renewcommand{\contentsname}{My new TOC title}%
   \addtocontents{toc}{\vspace{-5ex}}%
  }
  • Perfect. Thanks a lot. Exacly what I was looking for. – user3754038 Sep 23 '16 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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