1

I am using sectsty to format my chapter titles, but I want the vertical space between Chapter # and Chapter Title gone, and I can't find a way to do it without losing the styles applied by sectsty.

Here is a MWE

\documentclass[fontsize=12pt, paper=a4]{book}

\usepackage{lipsum}

\usepackage{sectsty}
\chapternumberfont{\LARGE\uppercase}
\chapterfont{\thispagestyle{empty}\LARGE\centering\uppercase}
\sectionfont{\large\uppercase}
\subsectionfont{\normalsize}

\begin{document}

\chapter{Cap name one}
\lipsum[1]
\section{Section 1.1}
\lipsum[2-4]

\chapter{Cap name two}
\lipsum[5]
\section{Section 2.1}
\lipsum[6]

\end{document}

Now if I add this following piece of code before \begin{document} the space is gone, but so is the style from secsty

\makeatletter
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \huge\bfseries \@chapapp\space {\thechapter}
        \par\nobreak
        \vskip 0\p@
      \fi
    \fi
    \interlinepenalty\@M
    {\parbox{\textwidth}{\Huge \bfseries \linespread{1.2}\selectfont #1\par\nobreak}}
    \vskip 40\p@
  }}
\makeatother
0

You could use titlesec instead sectsty:

\documentclass[12pt,a4paper]{book}

\usepackage{lipsum}

\usepackage{titlesec}
\makeatletter
\titleformat
  {\chapter}
  [display]
  {\centering\LARGE}
  {\MakeUppercase{\@chapapp\enskip\thechapter}}
  {0pt}
  {\MakeUppercase}
\makeatother
\titleformat*{\section}{\large\MakeUppercase}
\titleformat*{\subsection}{\normalsize}

\usepackage{xpatch}
\xpatchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{empty}}{}{}

\begin{document}

\chapter{Cap name one}
\lipsum[1]
\section{Section 1.1}
\lipsum[2-4]

\chapter{Cap name two}
\lipsum[5]
\section{Section 2.1}
\lipsum[6]

\end{document}

Note that I have changed fontsize=12pt and paper=a4 because they are unknown by class book.

Result:

enter image description here

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.