0

I'm new to latex, and I'm writing a document (book), since vertical space above \chapter is to big I want to reduce it, for chapters in the mainmatter I have no problem, because I use

\documentclass [12pt,oneside]{book}
\usepackage{titlesec}

\titleformat{\chapter}{\Huge\bfseries}{\chaptername\ \thechapter}{0pt}{\vskip40pt\raggedright}
\titlespacing{\chapter}{0pt}{-50pt}{40pt}
\begin{document}    
 \frontmatter

 \tableofcontents
 \chapter{Abstract}
    this...
  \mainmatter
 \chapter{Introduction}
   work...
 \chapter{Results}
   good ones...
\end{document}

where the "-50pt" is my desired vertical space above chapter. The problem arises when I try to do the same on the frontmatter chapters (abstract, toc, dedication, etc), since the code above does not affect them. Is there a way to achieve this?

Thanks in advance.

2
  • Welcome to TeX.SX! Please make your example compilable by adding the documentclass, the required packages and the document environment to your code, so that it reproduces your issue. That will help us help you.
    – TeXnician
    Commented Jan 20, 2018 at 6:01
  • 1
    Chapters in front matter is numberless. Take a look at this one may help! tex.stackexchange.com/questions/102116/…
    – Say OL
    Commented Jan 20, 2018 at 7:09

1 Answer 1

0

This is the definition of \tableofcontents in standard class book

\newcommand\tableofcontents{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
    \@starttoc{toc}%
    \if@restonecol\twocolumn\fi
    }

The table of contents' caption is printed by the stared version of chapter which has no label and counter. The titlesec package has numberless key for stared version titles.

\documentclass [12pt,oneside]{book}
\usepackage[showframe]{geometry}
\usepackage{titlesec}
\titleformat{\chapter}{\Huge\bfseries}{\chaptername\ \thechapter}{0pt}{\vskip40pt\raggedright}
\titleformat{name=\chapter,numberless}[hang]{\Huge\bfseries}{}{0pt}{\raggedright}
\titlespacing{\chapter}{0pt}{-50pt}{40pt}
\begin{document}
 \frontmatter
 \tableofcontents
 \chapter{Abstract}
    this...
  \mainmatter
 \chapter{Introduction}
   work...
 \chapter{Results}
   good ones...
\end{document}

You must log in to answer this question.

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